/* v323 Stories (stories323.js). Brand green gradient ring = unseen, grey ring = seen. Uses the feed tokens from social-feed.css. */
html{--st-g1:var(--accent,#4ADE80);--st-g2:var(--tt-acc-strong,#1b7f00);--st-g3:#a3e635;--st-seen:#b7bcc4;--st-gap:var(--tt-bg,var(--bg,#fff))}
html[data-theme=dark]{--st-seen:#4a4f57}
html.st-lock,html.st-lock body{overflow:hidden!important;overscroll-behavior:none}

/* ---------- bar under the Social header ---------- */
html.hs-open #homeSocial .hs-tt > .st-host{position:fixed;left:0;right:0;top:calc(var(--tt-top,0px) + var(--tt-headonly,60px));z-index:29;background:var(--tt-bg);box-sizing:border-box}
html.hs-open #homeSocial .hs-tt.tt-wall-on > .st-host{display:none}
.st-host:empty{display:none!important}
.st-bar{box-sizing:border-box;padding:2px 0 8px;max-width:760px;margin:0 auto}
.st-track{list-style:none;margin:0;padding:2px max(10px,env(safe-area-inset-left)) 0;display:flex;gap:12px;overflow-x:auto;overflow-y:hidden;scrollbar-width:none;overscroll-behavior-x:contain;scroll-snap-type:x proximity}
.st-track::-webkit-scrollbar{display:none}
.st-item{position:relative;flex:0 0 auto;width:68px;scroll-snap-align:start;margin:0}
.st-bub{display:flex;flex-direction:column;align-items:center;gap:4px;width:100%;padding:0;border:0;background:none;color:var(--tt-ink,var(--text));cursor:pointer;font:inherit}
.st-bub:focus-visible{outline:none}
.st-bub:focus-visible .st-ring{outline:3px solid var(--tt-ink,var(--text));outline-offset:2px}
.st-ring{position:relative;display:grid;place-items:center;width:64px;height:64px;border-radius:50%;padding:3px;box-sizing:border-box;background:transparent}
.st-ring.st-new{background:conic-gradient(from 200deg,var(--st-g1),var(--st-g3),var(--st-g2),var(--st-g1))}
.st-ring.st-seen{background:var(--st-seen)}
.st-ring.st-none{padding:0}
.st-av{position:relative;display:grid;place-items:center;width:100%;height:100%;border-radius:50%;overflow:hidden;box-sizing:border-box;border:2.5px solid var(--st-gap);
  background:rgba(var(--accent-rgb,74,222,128),.2);color:var(--tt-ink,var(--text));font:700 22px/1 var(--display,inherit)}
.st-ring.st-none .st-av{border:0}
.st-av img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;opacity:0;transition:opacity .2s}
.st-av img.on,.st-av img[src]{opacity:1}
.st-name{display:block;max-width:68px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font:500 12px/1.25 var(--body,inherit);color:var(--tt-ink,var(--text))}
.st-you .st-name{color:var(--tt-mut,var(--muted))}
.st-plus{position:absolute;top:42px;left:44px;width:24px;height:24px;border-radius:50%;border:2.5px solid var(--st-gap);background:var(--tt-g,var(--accent-dark,#1b7f00));color:var(--tt-on-g,#fff);display:grid;place-items:center;padding:0;cursor:pointer;box-sizing:content-box}
.st-plus svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:3;stroke-linecap:round}
.st-plus:focus-visible{outline:3px solid var(--tt-ink,var(--text));outline-offset:2px}
.st-skel .st-av{background:var(--tt-soft,#eef0ea);animation:stPulse 1.2s ease-in-out infinite}
.st-skel .st-name{width:44px;height:10px;margin:6px auto 0;border-radius:5px;background:var(--tt-soft,#eef0ea)}
@keyframes stPulse{50%{opacity:.55}}
.st-hint{margin:0;padding:0 14px;color:var(--tt-mut,var(--muted));font:500 12px/1.35 var(--body,inherit);display:none}
.st-solo .st-track{align-items:center}
.st-solo .st-hint{display:block;position:absolute;left:96px;right:12px;top:22px;padding:0}
.st-solo{position:relative}
@media (min-width:1000px){
  html.hs-open #homeSocial .hs-tt > .st-host{left:var(--tt-pl);right:auto;width:var(--tt-pw);top:calc(var(--tt-top,0px) + var(--tt-headonly,300px) + 26px);
    background:var(--tt-card);border:1px solid var(--tt-line);border-radius:20px;box-shadow:0 1px 6px var(--tt-sh);padding:12px 0 4px}
  html.hs-open #homeSocial .hs-tt > .st-host .st-bar::before{content:"Stories";display:block;margin:0 14px 8px;font:700 14px/1 var(--display,inherit);color:var(--tt-ink)}
  html.hs-open #homeSocial .hs-tt > .st-host .st-track{padding:2px 12px 0}
  .st-solo .st-hint{position:static;padding:6px 14px 4px}
}
@media (prefers-reduced-motion:reduce){.st-skel .st-av{animation:none}.st-av img{transition:none}}

/* ---------- the same ring on post and profile pictures ---------- */
.fr-av.st-ring-on{position:relative;overflow:visible!important;cursor:pointer}
.fr-av.st-ring-on::after{content:"";position:absolute;inset:-4px;border-radius:50%;padding:2.5px;pointer-events:none;z-index:2;
  background:conic-gradient(from 200deg,var(--st-g1),var(--st-g3),var(--st-g2),var(--st-g1));
  -webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);-webkit-mask-composite:xor;mask:linear-gradient(#000 0 0) content-box exclude,linear-gradient(#000 0 0)}
.fr-av.st-ring-seen::after{background:var(--st-seen)}
/* the feed's right-hand avatar had a permanent green ring; plain white edge now, so green only means "new story" */
html.hs-open #homeSocial .hs-tt .tt-av .fr-av{box-shadow:0 2px 8px rgba(0,0,0,.18)}
html.hs-open #homeSocial .hs-tt .tt-av .fr-av.st-ring-on{overflow:visible!important}
html.hs-open #homeSocial .hs-tt .tt-av .fr-av.st-ring-on img,html.hs-open #homeSocial .hs-tt .tt-av .fr-av.st-ring-on .fr-av-i{border-radius:50%;overflow:hidden}
html.hs-open #homeSocial .hs-tt .tt-av .fr-av.st-ring-on::after{inset:-6px;padding:3px}
.pf-av{position:relative;overflow:visible;isolation:isolate;z-index:2}
.pf-av .fr-av{position:relative;z-index:1}
.pf-av .fr-av[data-st-own]{cursor:pointer}
.pf-av .fr-av[data-st-own]:focus-visible{outline:3px solid var(--accent);outline-offset:6px}
.pf-av .fr-av.st-ring-on::after{inset:-6px;padding:3.5px;z-index:2}
.st-pf-add{position:absolute;left:-8px;bottom:-8px;z-index:5;width:28px;height:28px;border-radius:50%;border:2.5px solid var(--surface,#fff);background:var(--accent-dark,#1b7f00);color:#fff;display:grid;place-items:center;padding:0;cursor:pointer;box-sizing:content-box}
html[data-theme=dark] .st-pf-add{background:var(--accent,#4ADE80);color:var(--accent-ink,#000)}
.st-pf-add svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:3;stroke-linecap:round}

/* ---------- viewer ---------- */
.st-view{position:fixed;inset:0;z-index:9000;background:#000;color:#fff;display:flex;justify-content:center;align-items:stretch;touch-action:none;user-select:none;-webkit-user-select:none;outline:none}
.st-stage{position:relative;width:100%;max-width:min(100vw,calc(100dvh * 9 / 16 + 40px));height:100dvh;display:flex;flex-direction:column;transition:transform .15s ease-out}
@media (min-width:700px){.st-stage{max-width:min(520px,calc(100dvh * 9 / 16));height:calc(100dvh - 32px);margin-top:16px;border-radius:18px;overflow:hidden;background:#0b0b0b}}
.st-bars{position:absolute;z-index:4;left:8px;right:8px;top:calc(8px + env(safe-area-inset-top));display:flex;gap:4px}
.st-bars i{flex:1 1 0;height:3px;border-radius:2px;background:rgba(255,255,255,.35);overflow:hidden}
.st-bars i b{display:block;height:100%;width:0;background:#fff}
.st-bars i.done b{width:100%!important}
.st-vh{position:absolute;z-index:5;left:0;right:0;top:calc(16px + env(safe-area-inset-top));display:flex;align-items:center;gap:8px;padding:6px 6px 6px 12px;background:linear-gradient(rgba(0,0,0,.45),transparent)}
.st-vwho{display:flex;align-items:center;gap:8px;min-width:0;flex:1 1 auto}
.st-vwho .st-av{width:36px;height:36px;flex:none;border:0;font-size:15px}
.st-vt{display:flex;flex-direction:column;min-width:0}
.st-vt b{font:700 14px/1.2 var(--body,inherit);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-shadow:0 1px 3px rgba(0,0,0,.5)}
.st-vt small{font:500 12px/1.2 var(--body,inherit);opacity:.85}
.st-vbtns{display:flex;gap:2px;flex:none}
.st-ib{width:44px;height:44px;border:0;border-radius:50%;background:transparent;color:#fff;display:grid;place-items:center;cursor:pointer;padding:0}
.st-ib svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round;filter:drop-shadow(0 1px 2px rgba(0,0,0,.6))}
.st-ib[data-st-menu] svg{fill:currentColor;stroke:none}
.st-ib:focus-visible,.st-addbtn:focus-visible,.st-mi:focus-visible,.st-btn:focus-visible{outline:3px solid var(--accent,#4ADE80);outline-offset:2px}
.st-ah .st-ib{color:var(--text)}
.st-ah .st-ib svg{filter:none}
.st-media{position:relative;flex:1 1 auto;min-height:0;margin:0;display:grid;place-items:center;overflow:hidden}
.st-img{width:100%;height:100%;object-fit:contain;opacity:0;transition:opacity .18s;max-width:none}
.st-img.on{opacity:1}
.st-load{position:absolute;width:34px;height:34px;border-radius:50%;border:3px solid rgba(255,255,255,.25);border-top-color:#fff;animation:stSpin .8s linear infinite}
.st-img.on ~ .st-load,.st-failed .st-load{display:none}
.st-media:has(.st-img.on) .st-load{display:none}
@keyframes stSpin{to{transform:rotate(360deg)}}
.st-fail{position:absolute;margin:0;font:600 15px/1.4 var(--body,inherit);color:#ddd}
html body .st-view.st-view p.st-cap.st-cap,html[data-theme] body .st-view.st-view p.st-cap.st-cap{color:#fff!important;-webkit-text-fill-color:#fff}
.st-view .st-vt b,.st-view .st-vt small{color:#fff}
.st-cap{position:absolute;z-index:3;left:12px;right:12px;bottom:calc(84px + env(safe-area-inset-bottom));margin:0 auto;max-width:440px;width:max-content;padding:8px 14px;border-radius:14px;background:rgba(0,0,0,.55);font:600 16px/1.35 var(--body,inherit);text-align:center;overflow-wrap:anywhere}
.st-tap{position:absolute;z-index:2;top:80px;bottom:80px;border:0;padding:0;margin:0;background:transparent;cursor:pointer;-webkit-tap-highlight-color:transparent}
.st-prev{left:0;width:33%}
.st-next{right:0;width:67%}
.st-tap:focus-visible{outline:3px solid rgba(255,255,255,.7);outline-offset:-6px}
.st-vf{position:absolute;z-index:5;left:0;right:0;bottom:0;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 14px calc(14px + env(safe-area-inset-bottom));background:linear-gradient(transparent,rgba(0,0,0,.55))}
.st-views{display:inline-flex;align-items:center;gap:6px;font:600 13px/1 var(--body,inherit)}
.st-views svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2}
.st-addbtn{display:inline-flex;align-items:center;gap:8px;min-height:44px;padding:0 16px;border:0;border-radius:999px;background:#fff;color:#111;font:700 14px/1 var(--body,inherit);cursor:pointer}
.st-addbtn svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2.6;stroke-linecap:round}
.st-mod{background:rgba(255,255,255,.16);color:#fff}
.st-paused .st-bars{opacity:.6}
.st-sr,.st-srl{position:absolute!important;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.st-sheetwrap{position:absolute;inset:0;z-index:20;display:flex;align-items:flex-end;justify-content:center}
.st-scrim{position:absolute;inset:0;background:rgba(0,0,0,.5)}
.st-sheet{position:relative;width:100%;max-width:520px;max-height:85dvh;overflow:auto;box-sizing:border-box;padding:18px 16px calc(18px + env(safe-area-inset-bottom));border-radius:22px 22px 0 0;background:var(--surface,#fff);color:var(--text,#111)}
.st-sheet h2{margin:0 0 10px;font:700 18px/1.25 var(--display,inherit)}
.st-menu{list-style:none;margin:0;padding:0;display:grid;gap:4px}
.st-mi{display:flex;align-items:center;gap:12px;width:100%;min-height:48px;padding:0 12px;border:0;border-radius:14px;background:var(--surface2,#f2f3ef);color:inherit;font:600 15px/1.2 var(--body,inherit);text-align:left;cursor:pointer}
.st-mi svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:2;flex:none}
.st-danger{color:var(--danger,#d92d2d)}
.st-ghost{justify-content:center;background:transparent}
.st-reasons{border:0;margin:0 0 10px;padding:0;display:grid;gap:6px}
.st-reasons label{display:flex;align-items:center;gap:10px;min-height:42px;padding:0 12px;border-radius:12px;background:var(--surface2,#f2f3ef);font:500 15px/1.2 var(--body,inherit);cursor:pointer}
.st-reasons input{width:20px;height:20px;accent-color:var(--accent-dark,#1b7f00)}

/* ---------- add a story ---------- */
.st-add{position:fixed;inset:0;z-index:9000;background:rgba(0,0,0,.6);display:flex;align-items:flex-end;justify-content:center}
@media (min-width:700px){.st-add{align-items:center}}
.st-add-card{width:100%;max-width:480px;max-height:100dvh;overflow:auto;box-sizing:border-box;padding:10px 16px calc(18px + env(safe-area-inset-bottom));border-radius:24px 24px 0 0;background:var(--surface,#fff);color:var(--text,#111);display:flex;flex-direction:column;gap:12px}
@media (min-width:700px){.st-add-card{border-radius:24px;max-height:calc(100dvh - 32px)}}
.st-ah{display:flex;align-items:center;gap:4px}
.st-ah h2{flex:1 1 auto;margin:0;text-align:center;font:700 18px/1.2 var(--display,inherit)}
.st-ah-sp{width:44px;flex:none}
.st-frame{position:relative;align-self:center;width:min(100%,calc((100dvh - 360px) * 9 / 16),300px);min-width:150px;aspect-ratio:9/16;border-radius:18px;overflow:hidden;background:#0b0b0b;display:grid;place-items:center}
.st-frame.st-empty{background:var(--surface2,#f2f3ef);color:var(--muted,#5d6573);border:2px dashed var(--line,#dfe2da);gap:8px;align-content:center;font:600 13px/1.3 var(--body,inherit);text-align:center}
.st-frame.st-empty svg{width:40px;height:40px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.st-prev-img{width:100%;height:100%;object-fit:cover;max-width:none}
.st-pick,.st-btns{display:flex;gap:10px;flex-wrap:wrap}
.st-btn{flex:1 1 140px;display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:48px;padding:0 16px;border-radius:14px;border:1px solid var(--line,#dfe2da);background:var(--surface,#fff);color:var(--text,#111);font:700 15px/1 var(--body,inherit);cursor:pointer}
.st-btn svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.st-primary{background:var(--accent-dark,#1b7f00);border-color:transparent;color:#fff}
html[data-theme=dark] .st-primary{background:var(--accent,#4ADE80);color:var(--accent-ink,#000)}
.st-btn:disabled{opacity:.5;cursor:not-allowed}
.st-fine{margin:0;color:var(--muted,#5d6573);font:500 12.5px/1.45 var(--body,inherit)}
.st-err{margin:0;color:var(--danger,#d92d2d);font:600 13.5px/1.4 var(--body,inherit)}
.st-f{display:grid;gap:6px;font:600 14px/1.2 var(--body,inherit)}
.st-f em{font-style:normal;font-weight:500;color:var(--muted,#5d6573)}
.st-f input,.st-f textarea{width:100%;box-sizing:border-box;min-height:46px;padding:10px 12px;border-radius:12px;border:1px solid var(--line,#dfe2da);background:var(--surface2,#f7f8f5);color:inherit;font:500 15px/1.3 var(--body,inherit)}
.st-count{justify-self:end;color:var(--muted,#5d6573);font:500 12px/1 var(--body,inherit)}
.st-add .safety-consent{margin:0}
@media (prefers-reduced-motion:reduce){.st-stage,.st-img{transition:none}.st-load{animation:none}}

/* ---------- v323 "From earlier" label on the older post mixed into For you ---------- */
html.hs-open #homeSocial .hs-tt .tt-earlier{display:inline-flex;align-items:center;gap:5px;padding:5px 10px;border-radius:999px;background:rgba(0,0,0,.55);color:#fff;font:600 12px/1 var(--body,inherit);letter-spacing:.01em;white-space:nowrap}
html.hs-open #homeSocial .hs-tt .tt-earlier svg{width:13px;height:13px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}

/* ---------- v325 video stories (stories323.js) ---------- */
.st-vid{width:100%;height:100%;object-fit:contain;opacity:0;transition:opacity .18s;max-width:none;background:#000;pointer-events:none}
.st-vid.on{opacity:1}
.st-media:has(.st-vid.on) .st-load{display:none}
.st-view.st-stall .st-media .st-load{display:block}
.st-view.st-failed .st-media .st-vid{display:none}
.st-sound{position:absolute;z-index:8;right:10px;top:calc(80px + env(safe-area-inset-top));display:inline-flex;align-items:center;justify-content:center;gap:6px;min-width:44px;height:44px;padding:0 14px 0 12px;box-sizing:border-box;border:0;border-radius:999px;background:rgba(0,0,0,.6);color:#fff;font:700 13px/1 var(--body,inherit);cursor:pointer;-webkit-tap-highlight-color:transparent;box-shadow:0 1px 6px rgba(0,0,0,.35)}
.st-sound svg{width:22px;height:22px;flex:none;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
.st-sound.st-on{padding:0;width:44px}
.st-sound.st-on span{display:none}
.st-sound:focus-visible,.st-bigplay:focus-visible{outline:3px solid var(--accent,#4ADE80);outline-offset:2px}
.st-bigplay{position:absolute;z-index:8;left:50%;top:50%;width:76px;height:76px;margin:-38px 0 0 -38px;border:0;border-radius:50%;background:rgba(0,0,0,.6);color:#fff;display:grid;place-items:center;cursor:pointer;padding:0}
.st-bigplay svg{width:34px;height:34px;fill:currentColor;stroke:none;margin-left:4px}
.st-pick.st-pick4{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.st-pick4 .st-btn{min-width:0;padding:0 10px;font-size:14px}
.st-frame.st-empty-v{width:min(100%,calc((100dvh - 470px) * 9 / 16),300px)}
@media (max-height:520px){.st-frame.st-empty-v{align-self:stretch;width:auto;min-width:0;height:84px;aspect-ratio:auto;display:flex;justify-content:center;align-items:center}}
.st-prev-vid{width:100%;height:100%;object-fit:cover;max-width:none;background:#000}
.st-dur{position:absolute;left:8px;bottom:8px;display:inline-flex;align-items:center;gap:5px;padding:5px 9px;border-radius:999px;background:rgba(0,0,0,.6);color:#fff;font:700 12px/1 var(--body,inherit)}
.st-dur svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linejoin:round}
@media (prefers-reduced-motion:reduce){.st-vid{transition:none}}
