/* Facebook-style stories (ttc-stories.js) */
.tst-tray button,.tst-viewer button{font:inherit;color:inherit;padding:0;border:0;background:none;border-radius:0;margin:0;cursor:pointer}
.tst-tray button:focus-visible,.tst-viewer button:focus-visible,.tst-viewer a:focus-visible{outline:2px solid #3FD2E8;outline-offset:2px}

/* Tray of tall cards on the feed */
.tst-tray{position:relative;margin:0 0 14px}
.tst-row{display:flex;gap:8px;overflow-x:auto;scroll-snap-type:x proximity;scrollbar-width:none;padding:2px;overscroll-behavior-x:contain}
.tst-row::-webkit-scrollbar{display:none}
.tst-tray .tst-card{position:relative;flex:none;width:112px;height:200px;border-radius:12px;overflow:hidden;background:#15242A;scroll-snap-align:start;box-shadow:0 1px 3px #0007;text-align:left;display:block}
.tst-face{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;transition:transform .3s ease}
.tst-tray .tst-card:hover .tst-face{transform:scale(1.05)}
.tst-face img,.tst-face video{width:100%;height:100%;object-fit:cover;display:block}
.tst-card-text{padding:12px 10px;color:#fff;text-align:center;font-size:13px!important;line-height:1.25!important;display:-webkit-box;-webkit-line-clamp:6;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere;text-shadow:0 1px 4px #0007}
.tst-shade{position:absolute;inset:0;background:linear-gradient(#0008,transparent 32%,transparent 58%,#000b);pointer-events:none}
.tst-ring{position:absolute;top:10px;left:10px;border-radius:50%;padding:3px;background:#5A6E74;display:flex;z-index:1}
.tst-ring.new{background:conic-gradient(from 200deg,#3FD2E8,#647DEE,#C9A6F5,#F2994A,#3FD2E8)}
.tst-ring .tf-av{box-shadow:0 0 0 3px #0B161A}
.tst-ring.sm{position:static}
.tst-count{position:absolute;top:12px;right:10px;z-index:1;min-width:20px;height:20px;padding:0 6px;border-radius:10px;background:#0009;color:#fff;font:700 11px/20px Inter,sans-serif;text-align:center}
.tst-name{position:absolute;left:10px;right:8px;bottom:10px;z-index:1;color:#fff;font:600 13px/1.2 Inter,sans-serif;text-shadow:0 1px 4px #000;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.tst-tray .tst-create{background:#15242A;border:1px solid #23363D}
.tst-create-top{position:absolute;left:0;right:0;top:0;bottom:58px;display:flex;overflow:hidden}
.tst-create-top .tf-av{width:100%!important;height:100%!important;border-radius:0!important;font-size:34px!important;transition:transform .3s}
.tst-tray .tst-create:hover .tst-create-top .tf-av{transform:scale(1.05)}
.tst-create-plus{position:absolute;left:50%;bottom:40px;transform:translateX(-50%);width:38px;height:38px;border-radius:50%;background:#3FD2E8;color:#062026;box-shadow:0 0 0 4px #15242A;display:flex;align-items:center;justify-content:center;z-index:1}
.tst-create-plus .tf-ic{width:20px;height:20px}
.tst-create-label{position:absolute;left:0;right:0;bottom:12px;text-align:center;font:600 13px Inter,sans-serif;color:#E8F1F3}
.tst-tray .tst-scroll{position:absolute;right:-8px;top:50%;transform:translateY(-50%);width:42px;height:42px;border-radius:50%;background:#E8F1F3;color:#0B161A;box-shadow:0 4px 14px #000a;display:flex;align-items:center;justify-content:center;z-index:2}
.tst-tray .tst-scroll[hidden]{display:none}
.tst-tray .tst-scroll.left{left:-8px;right:auto}
.tst-scroll.left .tf-ic,.tst-nav.prev .tf-ic{transform:rotate(180deg)}

/* Viewer */
body.tst-open{overflow:hidden}
.tst-viewer{position:fixed;inset:0;z-index:3500;display:flex;align-items:center;justify-content:center;gap:28px;color:#fff;font-family:Inter,sans-serif;animation:tst-in .2s ease-out}
.tst-viewer.closing{animation:tst-out .18s ease-in forwards}
@keyframes tst-in{from{opacity:0;transform:scale(.98)}}
@keyframes tst-out{to{opacity:0;transform:scale(.98)}}
.tst-backdrop{position:absolute;inset:0;background:#04080Af5}
.tst-side{position:absolute;left:0;top:0;bottom:0;width:340px;box-sizing:border-box;background:#0F1B20;border-right:1px solid #1E2F36;overflow:auto;padding:18px 12px;display:none}
.tst-side h2{margin:0 8px 14px;font:700 24px 'Space Grotesk',Inter,sans-serif;color:#E8F1F3}
.tst-side h3{margin:18px 8px 8px;font:600 15px Inter,sans-serif;color:#E8F1F3}
.tst-viewer .tst-side-create,.tst-viewer .tst-side-row{display:flex;align-items:center;gap:12px;width:100%;padding:8px;border-radius:12px;text-align:left;box-sizing:border-box}
.tst-viewer .tst-side-create:hover,.tst-viewer .tst-side-row:hover,.tst-viewer .tst-side-row.on{background:#15242A}
.tst-side-plus{width:52px;height:52px;border-radius:50%;background:#15242A;color:#3FD2E8;display:flex;align-items:center;justify-content:center;flex:none}
.tst-side-create strong,.tst-side-row strong{display:block;font:600 15px Inter,sans-serif;color:#E8F1F3}
.tst-side-create small,.tst-side-row small{display:block;font-size:13px;color:#8FA6AD;margin-top:2px}
.tst-stage{position:relative;z-index:1;height:min(92vh,880px);aspect-ratio:9/16;max-width:94vw}
.tst-card-view{position:relative;width:100%;height:100%;border-radius:14px;overflow:hidden;background:#000;box-shadow:0 20px 60px #000c}
.tst-card-view.in-next{animation:tst-next .28s cubic-bezier(.2,.9,.3,1)}
.tst-card-view.in-prev{animation:tst-prev .28s cubic-bezier(.2,.9,.3,1)}
@keyframes tst-next{from{opacity:.3;transform:translateX(40px) scale(.97)}}
@keyframes tst-prev{from{opacity:.3;transform:translateX(-40px) scale(.97)}}
.tst-content{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;overflow:hidden}
.tst-blur{position:absolute;inset:-30px;width:calc(100% + 60px);height:calc(100% + 60px);object-fit:cover;filter:blur(28px) brightness(.55)}
.tst-blur[src=""]{display:none}
.tst-media{position:relative;width:100%;height:100%;object-fit:contain;display:block}
.tst-text{position:relative;color:#fff;text-align:center;padding:28px;margin:0;line-height:1.25;overflow-wrap:anywhere;white-space:pre-wrap;text-shadow:0 2px 10px #0005;max-height:76%;overflow:auto}
.tst-caption{position:absolute;left:16px;right:16px;bottom:118px;text-align:center;color:#fff;background:#000a;padding:9px 14px;border-radius:12px;margin:0;font:600 15px/1.35 Inter,sans-serif;white-space:pre-wrap;overflow-wrap:anywhere}
.tst-top{position:absolute;left:0;right:0;top:0;padding:10px 12px 28px;background:linear-gradient(#000b,transparent);z-index:2}
.tst-bars{display:flex;gap:4px}
.tst-bar{flex:1;height:3px;border-radius:2px;background:#ffffff4d;overflow:hidden}
.tst-bar i{display:block;height:100%;background:#fff;transform:scaleX(0);transform-origin:left;will-change:transform}
.tst-bar.done i{transform:scaleX(1)}
.tst-head{display:flex;align-items:center;gap:6px;margin-top:10px}
.tst-head .tf-grow{flex:1}
.tst-who{display:flex;align-items:center;gap:10px;color:#fff!important;text-decoration:none!important;min-width:0}
.tst-who strong{display:block;font:600 14px Inter,sans-serif;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tst-who small{display:block;color:#ffffffb8;font-size:12px}
.tst-viewer .tst-ib{width:36px;height:36px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:14px;color:#fff;flex:none}
.tst-viewer .tst-ib:hover{background:#ffffff26}
.tst-more{position:relative}
.tst-more summary{list-style:none;width:36px;height:36px;border-radius:50%;display:flex;align-items:center;justify-content:center;cursor:pointer;color:#fff}
.tst-more summary::-webkit-details-marker{display:none}
.tst-more summary:hover{background:#ffffff26}
.tst-more .tf-menu{right:0;left:auto;top:40px;z-index:4}
.tst-viewer .tst-more .tf-menu button{padding:10px 12px;border-radius:8px;text-align:left;color:#F28B82}
.tst-zone{position:absolute;left:0;right:0;top:76px;bottom:96px;z-index:1;touch-action:none;-webkit-touch-callout:none;user-select:none}
.tst-viewer.paused .tst-bar i{opacity:.75}
.tst-foot{position:absolute;left:0;right:0;bottom:0;padding:28px 12px 12px;background:linear-gradient(transparent,#000c);z-index:2;display:flex;flex-direction:column;gap:10px}
.tst-reply{display:flex;align-items:center;gap:8px}
.tst-reply input{flex:1;min-width:0;height:42px;border-radius:21px;border:1px solid #ffffff73;background:#00000059;color:#fff;padding:0 16px;font:14px Inter,sans-serif;outline:0}
.tst-reply input:focus{border-color:#fff}
.tst-reply input::placeholder{color:#ffffffb3}
.tst-viewer .tst-send{width:42px;height:42px;border-radius:50%;display:flex;align-items:center;justify-content:center;color:#fff;flex:none}
.tst-viewer .tst-send:hover{background:#ffffff26}
.tst-reacts{display:flex;justify-content:space-between;padding:0 4px}
.tst-viewer .tst-reacts button{font-size:28px;line-height:1;width:44px;height:44px;border-radius:50%;transition:transform .15s cubic-bezier(.3,1.6,.5,1)}
.tst-viewer .tst-reacts button:hover{transform:scale(1.25) translateY(-3px)}
.tst-viewer .tst-reacts button:active{transform:scale(.9)}
.tst-foot.own{flex-direction:row;align-items:center;justify-content:space-between}
.tst-viewer .tst-seen,.tst-viewer .tst-addmore{display:inline-flex;align-items:center;gap:8px;height:40px;padding:0 14px;border-radius:20px;background:#00000066;color:#fff;font:600 14px Inter,sans-serif}
.tst-viewer .tst-seen:hover,.tst-viewer .tst-addmore:hover{background:#ffffff2e}
.tst-seen .tf-ic,.tst-addmore .tf-ic{width:18px;height:18px}
.tst-viewer .tst-nav{position:relative;z-index:1;width:50px;height:50px;border-radius:50%;background:#ffffff26;color:#fff;display:flex;align-items:center;justify-content:center;flex:none}
.tst-viewer .tst-nav:hover{background:#ffffff40}
.tst-viewer .tst-nav[hidden]{visibility:hidden;display:flex}
.tst-viewer .tst-x{position:absolute;top:16px;right:16px;z-index:4;width:44px;height:44px;border-radius:50%;background:#ffffff26;color:#fff;display:flex;align-items:center;justify-content:center}
.tst-viewer .tst-x:hover{background:#ffffff40}
.tst-float{position:fixed;z-index:3700;font-size:34px;line-height:1;pointer-events:none;animation:tst-float 1.6s cubic-bezier(.2,.7,.3,1) forwards}
@keyframes tst-float{0%{opacity:0;transform:translate(-50%,0) scale(.4)}15%{opacity:1;transform:translate(-50%,-30px) scale(1.2)}100%{opacity:0;transform:translate(calc(-50% + var(--drift)),-280px) scale(1)}}
.tst-toast{position:fixed;left:50%;bottom:28px;transform:translateX(-50%);z-index:3800;background:#E8F1F3;color:#0B161A;padding:10px 18px;border-radius:22px;font:600 14px Inter,sans-serif;box-shadow:0 8px 24px #0009;animation:tst-toast .25s ease-out}
@keyframes tst-toast{from{opacity:0;transform:translate(-50%,10px)}}
.tst-sheet{position:fixed;left:50%;bottom:0;transform:translateX(-50%);z-index:3600;width:min(440px,100vw);max-height:62vh;display:flex;flex-direction:column;background:#111D22;border:1px solid #23363D;border-bottom:0;border-radius:18px 18px 0 0;box-shadow:0 -10px 40px #000a;animation:tst-sheet .25s ease-out}
@keyframes tst-sheet{from{transform:translate(-50%,40px);opacity:0}}
.tst-sheet-head{display:flex;align-items:center;justify-content:space-between;padding:12px 12px 8px 18px;font:700 16px Inter,sans-serif;color:#E8F1F3}
.tst-sheet-list{overflow:auto;padding:0 10px 16px}
.tst-sheet-row{display:flex;align-items:center;gap:12px;padding:8px;border-radius:12px;color:#E8F1F3!important;text-decoration:none!important}
.tst-sheet-row:hover{background:#15242A}
.tst-sheet-row strong{display:block;font:600 14px Inter,sans-serif}
.tst-sheet-row small{display:block;color:#8FA6AD;font-size:12px}
.tst-dim{color:#8FA6AD;font-size:13px;margin:6px 8px}

/* Story maker */
.tst-make{position:relative;z-index:1;width:min(1100px,96vw);max-height:94vh;overflow:auto;box-sizing:border-box;padding:8px}
.tst-make-title{margin:0 0 16px;font:700 24px 'Space Grotesk',Inter,sans-serif;color:#E8F1F3}
.tst-make>.tst-make-title{text-align:center}
.tst-choices{display:flex;gap:18px;justify-content:center;flex-wrap:wrap}
.tst-viewer .tst-choice{width:220px;height:330px;border-radius:14px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;font:700 15px Inter,sans-serif;color:#fff;text-align:center;padding:16px;box-sizing:border-box;box-shadow:0 10px 30px #0008;transition:transform .2s,filter .2s}
.tst-viewer .tst-choice:hover{transform:translateY(-4px);filter:brightness(1.08)}
.tst-choice.photo{background:linear-gradient(160deg,#3FD2E8,#0F4C75)}
.tst-choice.text{background:linear-gradient(160deg,#C9A6F5,#EE9CA7)}
.tst-choice-ic{width:56px;height:56px;border-radius:50%;background:#fff;color:#0B161A;display:flex;align-items:center;justify-content:center;box-shadow:0 4px 12px #0005}
.tst-choice-ic .tf-ic{width:26px;height:26px}
.tst-aa{font:700 20px Inter,sans-serif}
.tst-make-grid{display:grid;grid-template-columns:320px minmax(0,1fr);gap:28px;align-items:start}
.tst-make-side{background:#111D22;border:1px solid #1E2F36;border-radius:16px;padding:18px;color:#E8F1F3}
.tst-make-side h3{margin:16px 0 8px;font:600 14px Inter,sans-serif;color:#C9D8DC}
.tst-make-me{display:flex;align-items:center;gap:10px;font-size:15px;margin-bottom:6px}
.tst-swatches{display:grid;grid-template-columns:repeat(5,36px);gap:10px}
.tst-viewer .tst-swatches button{width:36px;height:36px;border-radius:50%;box-shadow:0 0 0 2px #23363D}
.tst-viewer .tst-swatches button[aria-checked=true]{box-shadow:0 0 0 3px #fff}
.tst-fonts{display:flex;flex-wrap:wrap;gap:8px}
.tst-viewer .tst-fonts button{height:36px;padding:0 12px;border-radius:18px;background:#15242A;border:1px solid #23363D;color:#E8F1F3}
.tst-viewer .tst-fonts button[aria-checked=true]{background:#3FD2E8;border-color:#3FD2E8;color:#062026}
.tst-make-actions{display:flex;gap:10px;margin-top:20px}
.tst-viewer .tst-make-actions .ta-btn{flex:1;justify-content:center;height:44px;padding:0 16px;border-radius:12px;border:1px solid #23363D;background:#15242A;color:#E8F1F3}
.tst-viewer .tst-make-actions .ta-btn.pri{background:#3FD2E8;border-color:#3FD2E8;color:#062026}
.tst-viewer .tst-make-actions .ta-btn:disabled{opacity:.6}
.tst-make-stage{display:flex;justify-content:center}
.tst-make-stage .tst-card-view{height:min(82vh,760px);aspect-ratio:9/16;width:auto}
.tst-make-text{position:relative;width:86%;background:transparent;border:0;outline:0;resize:none;color:#fff;text-align:center;font-size:30px;line-height:1.25;text-shadow:0 2px 10px #0005;max-height:76%;overflow:auto}
.tst-make-text::placeholder{color:#ffffffb3}
.tst-make-caption{position:absolute;left:14px;right:14px;bottom:18px;box-sizing:border-box;background:#000a;border:0;outline:0;border-radius:12px;color:#fff;padding:10px 12px;font:600 15px/1.35 Inter,sans-serif;resize:none;text-align:center}
.tst-make-caption::placeholder{color:#ffffffa6}

@media (min-width:1180px){.tst-viewer:not(.tst-maker){padding-left:340px}.tst-viewer:not(.tst-maker) .tst-side{display:block}}
@media (max-width:700px){
  .tst-tray .tst-scroll{display:none!important}
  .tst-viewer{gap:0}
  .tst-viewer .tst-nav{display:none}
  .tst-stage{height:100dvh;width:100vw;max-width:none;aspect-ratio:auto}
  .tst-card-view{border-radius:0}
  .tst-top{padding-top:calc(10px + env(safe-area-inset-top))}
  .tst-head{padding-right:40px}
  .tst-viewer .tst-x{top:calc(28px + env(safe-area-inset-top));right:6px;width:36px;height:36px;background:transparent}
  .tst-foot{padding-bottom:calc(12px + env(safe-area-inset-bottom))}
  .tst-make{width:100vw;max-height:100dvh;height:100dvh;padding:56px 12px 16px}
  .tst-make-grid{grid-template-columns:1fr;gap:14px}
  .tst-make-stage{order:-1}
  .tst-make-stage .tst-card-view{height:58vh}
  .tst-viewer .tst-choice{width:44vw;height:60vw}
}
/* Phones: the tray looks like Facebook's app. Three and a bit tall cards, your photo on top of Create story with the + on the seam. */
@media (max-width:759px){
  .tst-tray{margin:0;padding:8px 0 10px;background:#0F1A1F}
  .tst-row{padding:0 8px;gap:6px;scroll-padding-left:8px}
  .tst-tray .tst-card{width:calc((100vw - 28px)/3.3);max-width:132px;height:auto;aspect-ratio:9/16;border-radius:12px;box-shadow:none}
  .tst-tray .tst-create{background:#1B2A30;border:0}
  .tst-create-top{bottom:33%}
  .tst-create-top .tf-av{font-size:30px!important}
  .tst-create-top .tf-av img{transform:scale(1.22)}
  .tst-create-plus{bottom:calc(33% - 18px);width:36px;height:36px;box-shadow:0 0 0 4px #1B2A30}
  .tst-create-plus .tf-ic{width:22px;height:22px;stroke-width:2.6}
  .tst-create-label{top:calc(67% + 18px);bottom:auto;padding:0 6px;font:700 clamp(12px,3.6vw,15px)/1.15 Inter,sans-serif;word-spacing:100px}
  .tst-ring{top:8px;left:8px;padding:2.5px;background:#5A6E74}
  .tst-ring.new{background:#3FD2E8}
  .tst-ring .tf-av{width:32px!important;height:32px!important;font-size:11px!important;box-shadow:0 0 0 2.5px #0B161A}
  .tst-count{display:none}
  .tst-name{left:8px;right:6px;bottom:8px;font:700 14px/1.2 Inter,sans-serif}
  .tst-card-text{font-size:12px!important}
}
@media (prefers-reduced-motion:reduce){.tst-viewer,.tst-card-view,.tst-float,.tst-sheet,.tst-toast{animation:none!important}.tst-face{transition:none}}
