/* App Stories — items in .home-tabs + full-screen viewer + composer (app-result/index.php) */
/* [hidden] must win over the display:flex rules below (owner bar, expiry line, delete sheet) */
.stv [hidden], .stc [hidden] { display:none !important; }
button.home-tab { background:none; border:0; padding:0; font:inherit; cursor:pointer; -webkit-tap-highlight-color:transparent; }

/* Create story */
.story-create .story-create-wrap { border-radius:50% !important; background:#e8eefc; color:#94a3b8; overflow:visible !important; }
.story-create .story-create-wrap .home-tab-icon { border-radius:50% !important; }
.story-create-ph { width:60%; height:60%; }
.story-plus { position:absolute; right:-3px; bottom:-3px; width:22px; height:22px; border-radius:50%; background:#1877f2; color:#fff;
    border:2.5px solid #fff; display:flex; align-items:center; justify-content:center; font-size:17px; font-weight:700; line-height:1; z-index:2;
    box-shadow:0 2px 6px rgba(24,119,242,.45); }
.story-create .home-tab-label { color:#1877f2; }

/* Member story item: gradient ring (unseen) → grey (seen) */
.story-tab .story-ring { border-radius:50% !important; padding:2.5px; overflow:visible !important;
    background:conic-gradient(from 210deg, #1877f2, #7c3aed, #ec4899, #f59e0b, #1877f2); }
.story-tab .story-ring::after { display:none; }
.story-tab .story-ring .home-tab-icon { border-radius:50% !important; border:2.5px solid #fff; box-sizing:border-box; background:#e5e7eb; }
.story-tab.seen .story-ring { background:#cbd5e1; }
/* Official (admin-posted) stories: gold→blue ring + verified badge */
.story-tab.official .story-ring { background:conic-gradient(from 200deg, #f59e0b, #fbbf24, #1877f2, #0ea5e9, #f59e0b); }
.story-tab.official.seen .story-ring { background:#cbd5e1; }
.story-ok { position:absolute; right:-3px; bottom:-3px; width:20px; height:20px; border-radius:50%; background:#1877f2; color:#fff; border:2px solid #fff;
    display:flex; align-items:center; justify-content:center; z-index:2; box-shadow:0 1px 4px rgba(0,0,0,.3); }
.story-ok svg { width:13px; height:13px; }
.stv-ok { display:inline-flex; align-items:center; justify-content:center; width:16px; height:16px; margin-left:5px; border-radius:50%; background:#1877f2;
    color:#fff; vertical-align:-2px; }
.stv-ok svg { width:11px; height:11px; }
.story-av { position:absolute; right:-4px; bottom:-4px; width:22px; height:22px; border-radius:50%; object-fit:cover; border:2px solid #fff;
    box-shadow:0 1px 4px rgba(0,0,0,.25); z-index:2; background:#fff; }

/* ── Viewer ── */
.stv { position:fixed; inset:0; z-index:100000; background:#000; display:none; flex-direction:column; color:#fff;
    font-family:inherit; touch-action:pan-y; user-select:none; -webkit-user-select:none; }
.stv.open { display:flex; animation:stvIn .18s ease-out; }
@keyframes stvIn { from { opacity:0; transform:scale(.97); } to { opacity:1; transform:none; } }
.stv-bars { position:absolute; top:calc(env(safe-area-inset-top, 0px) + 8px); left:8px; right:8px; display:flex; gap:4px; z-index:3; }
.stv-bar { flex:1; height:3px; border-radius:3px; background:rgba(255,255,255,.35); overflow:hidden; }
.stv-bar i { display:block; height:100%; width:0; background:#fff; }
.stv-bar.done i { width:100%; }
.stv-head { position:absolute; top:calc(env(safe-area-inset-top, 0px) + 18px); left:10px; right:10px; display:flex; align-items:center; gap:10px; z-index:3; }
.stv-av { width:36px; height:36px; border-radius:50%; object-fit:cover; border:2px solid rgba(255,255,255,.85); background:#334155; flex:none; }
.stv-who { flex:1; min-width:0; text-shadow:0 1px 3px rgba(0,0,0,.6); }
.stv-name { font-weight:700; font-size:14px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.stv-time { font-size:12px; opacity:.85; }
.stv-btn { flex:none; width:38px; height:38px; border-radius:50%; border:0; background:rgba(0,0,0,.35); color:#fff; font-size:20px;
    display:flex; align-items:center; justify-content:center; cursor:pointer; }
.stv-btn:active { background:rgba(255,255,255,.2); }
.stv-stage { position:relative; flex:1; display:flex; align-items:center; justify-content:center; overflow:hidden; }
.stv-img { max-width:100%; max-height:100%; object-fit:contain; display:block; }
.stv-spin { position:absolute; width:36px; height:36px; border:3px solid rgba(255,255,255,.25); border-top-color:#fff; border-radius:50%; animation:stvSpin .8s linear infinite; }
@keyframes stvSpin { to { transform:rotate(360deg); } }
.stv-tap { position:absolute; top:0; bottom:0; z-index:2; }
.stv-tap.prev { left:0; width:33%; }
.stv-tap.next { right:0; width:67%; }
.stv-cap { position:absolute; left:0; right:0; bottom:0; z-index:3; padding:40px 16px calc(env(safe-area-inset-bottom, 0px) + 18px);
    background:linear-gradient(transparent, rgba(0,0,0,.75)); font-size:15px; line-height:1.55; text-align:center; white-space:pre-wrap; word-break:break-word; }
.stv-cap:empty { display:none; }
/* Owner bar: views + time left · add · delete */
.stv-own { position:absolute; left:10px; right:10px; bottom:calc(env(safe-area-inset-bottom, 0px) + 12px); z-index:4;
    display:flex; align-items:center; gap:8px; padding:8px 8px 8px 12px; border-radius:18px;
    background:rgba(15,23,42,.55); border:1px solid rgba(255,255,255,.12);
    -webkit-backdrop-filter:blur(14px) saturate(140%); backdrop-filter:blur(14px) saturate(140%); box-shadow:0 8px 28px rgba(0,0,0,.35); }
.stv-own-info { flex:1; min-width:0; display:flex; flex-direction:column; gap:2px; }
.stv-views { display:flex; align-items:center; gap:6px; font-size:13px; }
.stv-views svg { width:17px; height:17px; opacity:.9; flex:none; }
.stv-views b { font-size:15px; font-weight:800; font-variant-numeric:tabular-nums; }
.stv-vl { opacity:.8; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.stv-exp { display:flex; align-items:center; gap:5px; font-size:11.5px; opacity:.7; }
.stv-exp svg { width:13px; height:13px; flex:none; }
.stv-ic { flex:none; width:42px; height:42px; border-radius:50%; border:0; display:flex; align-items:center; justify-content:center; cursor:pointer;
    color:#fff; background:rgba(255,255,255,.14); transition:background .15s, transform .1s; -webkit-tap-highlight-color:transparent; }
.stv-ic svg { width:21px; height:21px; }
.stv-ic:active { transform:scale(.92); }
.stv-ic.stv-add { background:#1877f2; box-shadow:0 4px 12px rgba(24,119,242,.45); }
.stv-ic.danger:hover, .stv-ic.danger:active { background:rgba(239,68,68,.9); }
.stv.is-own .stv-cap { padding-bottom:calc(env(safe-area-inset-bottom, 0px) + 82px); }

/* Delete confirmation sheet */
.stv-sheet { position:absolute; inset:0; z-index:6; display:flex; align-items:flex-end; justify-content:center; background:rgba(0,0,0,0); transition:background .2s; }
.stv-sheet.show { background:rgba(0,0,0,.55); }
.stv-sheet-box { width:100%; max-width:440px; margin:0 10px calc(env(safe-area-inset-bottom, 0px) + 10px); padding:22px 18px 14px; border-radius:22px;
    background:#fff; color:#0f172a; text-align:center; transform:translateY(110%); transition:transform .22s cubic-bezier(.2,.8,.2,1); }
.stv-sheet.show .stv-sheet-box { transform:none; }
.stv-sheet-ic { width:52px; height:52px; margin:0 auto 10px; border-radius:50%; background:#fee2e2; color:#dc2626; display:flex; align-items:center; justify-content:center; }
.stv-sheet-ic svg { width:26px; height:26px; }
.stv-sheet-t { font-size:17px; font-weight:800; }
.stv-sheet-s { font-size:13.5px; color:#64748b; margin:4px 0 16px; line-height:1.5; }
.stv-sheet-del, .stv-sheet-cancel { display:block; width:100%; border:0; border-radius:14px; padding:13px; font:inherit; font-size:15px; font-weight:700; cursor:pointer; }
.stv-sheet-del { background:#dc2626; color:#fff; margin-bottom:8px; }
.stv-sheet-del:disabled { opacity:.65; cursor:wait; }
.stv-sheet-cancel { background:#f1f5f9; color:#334155; }

/* ── Composer ── */
.stc { position:fixed; inset:0; z-index:100001; background:#0b1020; display:none; flex-direction:column; color:#fff; }
.stc.open { display:flex; animation:stvIn .18s ease-out; }
.stc-top { display:flex; align-items:center; gap:10px; padding:calc(env(safe-area-inset-top, 0px) + 10px) 12px 10px; }
.stc-title { flex:1; font-weight:700; font-size:16px; }
.stc-stage { flex:1; min-height:0; display:flex; align-items:center; justify-content:center; padding:0 12px; }
.stc-stage img { max-width:100%; max-height:100%; border-radius:14px; object-fit:contain; box-shadow:0 10px 40px rgba(0,0,0,.5); }
.stc-bottom { padding:12px 12px calc(env(safe-area-inset-bottom, 0px) + 14px); display:flex; flex-direction:column; gap:10px; }
.stc-cap { width:100%; min-height:48px; max-height:120px; resize:none; border:1px solid rgba(255,255,255,.2); border-radius:12px;
    background:rgba(255,255,255,.08); color:#fff; font:inherit; font-size:15px; padding:11px 13px; box-sizing:border-box; }
.stc-cap::placeholder { color:rgba(255,255,255,.5); }
.stc-row { display:flex; align-items:center; gap:10px; }
.stc-count { font-size:12px; opacity:.6; margin-right:auto; }
.stc-share { border:0; border-radius:999px; padding:12px 26px; background:#1877f2; color:#fff; font:inherit; font-weight:700; font-size:15px; cursor:pointer; }
.stc-share:disabled { opacity:.6; }
.stc-err { color:#fca5a5; font-size:13px; text-align:center; }
.stc-err:empty { display:none; }

/* ── Reactions ── */
.rx { display:inline-flex; align-items:center; justify-content:center; width:100%; height:100%; line-height:1; }
.rx-like, .rx-love { border-radius:50%; color:#fff; }
.rx-like { background:linear-gradient(180deg,#18a3ff,#0866ff); }
.rx-love { background:linear-gradient(180deg,#ff6680,#e61e4d); }
.rx-like svg, .rx-love svg { width:56%; height:56%; }
.rx-face svg { width:100%; height:100%; display:block; }

/* viewer bar (someone else's story) */
.stv-react { position:absolute; left:0; right:0; bottom:calc(env(safe-area-inset-bottom, 0px) + 12px); z-index:4;
    display:flex; justify-content:center; gap:6px; padding:0 10px; }
.stv-r { width:44px; height:44px; padding:0; border:0; background:none; cursor:pointer; font-size:20px;
    transition:transform .15s cubic-bezier(.3,1.6,.5,1); -webkit-tap-highlight-color:transparent; filter:drop-shadow(0 2px 4px rgba(0,0,0,.35)); }
.stv-r:hover { transform:translateY(-4px) scale(1.12); }
.stv-r:active { transform:scale(.88); }
.stv-r.on { transform:translateY(-6px) scale(1.18); }
.stv-r.on::after { content:''; display:block; width:6px; height:6px; margin:4px auto 0; border-radius:50%; background:#fff; }
.stv.is-react .stv-cap { padding-bottom:calc(env(safe-area-inset-bottom, 0px) + 74px); }
@media (max-width: 360px) { .stv-r { width:38px; height:38px; font-size:17px; } .stv-react { gap:3px; } }

/* floating burst */
.stv-fx { position:absolute; inset:0; z-index:5; pointer-events:none; overflow:hidden; }
.stv-fx-p { position:absolute; width:32px; height:32px; font-size:15px; opacity:0; animation:stvFloat 1.4s ease-out forwards; }
@keyframes stvFloat {
    0%   { opacity:0; transform:translate(0,0) scale(.6); }
    15%  { opacity:1; transform:translate(calc(var(--dx) * .2), -30px) scale(1.15); }
    100% { opacity:0; transform:translate(var(--dx), -260px) scale(.9); }
}

/* owner: reaction summary next to the views (tap → Activity) */
.stv-own-info { cursor:pointer; border-radius:10px; }
.stv-own-info:focus-visible { outline:2px solid rgba(255,255,255,.5); outline-offset:3px; }
.stv-rsum { display:inline-flex; align-items:center; gap:4px; margin-left:8px; padding-left:8px; border-left:1px solid rgba(255,255,255,.25); }
.stv-rsum-ic { display:inline-flex; }
.stv-rsum-ic i { width:18px; height:18px; font-size:10px; display:inline-flex; margin-left:-4px; border-radius:50%; box-shadow:0 0 0 1.5px rgba(15,23,42,.9); background:#0f172a; }
.stv-rsum-ic i:first-child { margin-left:0; }
.stv-rsum b { font-size:14px; font-weight:800; }

/* owner: Activity sheet */
.stv-act-box { text-align:left; max-height:70vh; display:flex; flex-direction:column; padding:16px 16px 10px; }
.stv-act-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:6px; }
.stv-act-t { font-size:17px; font-weight:800; }
.stv-act-x { width:32px; height:32px; border-radius:50%; border:0; background:#f1f5f9; color:#334155; font-size:15px; cursor:pointer; }
.stv-act-sum { display:flex; align-items:center; gap:5px; font-size:13px; color:#64748b; padding-bottom:10px; border-bottom:1px solid #eef2f7; }
.stv-act-sum svg { width:16px; height:16px; }
.stv-act-sum b { color:#0f172a; }
.stv-act-list { overflow-y:auto; margin:0 -6px; padding:4px 6px; min-height:60px; }
.stv-act-row { display:flex; align-items:center; gap:10px; padding:8px 0; }
.stv-act-row + .stv-act-row { border-top:1px solid #f1f5f9; }
.stv-act-av { width:38px; height:38px; border-radius:50%; object-fit:cover; background:#e2e8f0; flex:none; }
.stv-act-who { flex:1; min-width:0; display:flex; flex-direction:column; }
.stv-act-who b { font-size:14px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.stv-act-who small { font-size:12px; color:#94a3b8; }
.stv-act-r { width:28px; height:28px; font-size:14px; flex:none; }
.stv-act-empty { padding:26px 8px; text-align:center; color:#94a3b8; font-size:14px; }
.stv-act-box .stv-spin { border-color:#e2e8f0; border-top-color:#1877f2; }
/* summary icons: full 18px faces with a thin ring (overlapping like Facebook) */
.stv-rsum-ic i { background:none; box-shadow:0 0 0 1.5px rgba(15,23,42,.85); }
.stv-rsum-ic i .rx, .stv-rsum-ic i svg { width:18px; height:18px; flex:none; }
/* Create story hidden when members can't post (kept in the DOM as the insert anchor for story items) */
.home-tabs .story-create[hidden] { display:none !important; }

/* ── "Verify your account first" sheet (Story setting: only ID-verified accounts can post) ── */
.stv-verify { position: fixed; inset: 0; z-index: 10050; display: flex; align-items: flex-end; justify-content: center;
    background: rgba(8, 12, 30, .55); opacity: 0; pointer-events: none; transition: opacity .2s; }
.stv-verify.open { opacity: 1; pointer-events: auto; }
.stv-verify-card { width: 100%; max-width: 420px; background: #fff; color: #0f172a; border-radius: 22px 22px 0 0; padding: 26px 22px 22px;
    text-align: center; transform: translateY(24px); transition: transform .25s ease-out; font-family: inherit; }
.stv-verify.open .stv-verify-card { transform: none; }
.stv-verify-ico { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 20px; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #3b82f6, #7c3aed); box-shadow: 0 10px 24px rgba(79, 70, 229, .3); }
.stv-verify-ico svg { width: 34px; height: 34px; }
.stv-verify-card h3 { margin: 0 0 6px; font-size: 17px; font-weight: 700; }
.stv-verify-card p { margin: 0 0 18px; font-size: 13.5px; line-height: 1.6; color: #64748b; }
.stv-verify-go { display: block; padding: 14px; border-radius: 14px; background: linear-gradient(135deg, #2563eb, #7c3aed); color: #fff;
    font-size: 15px; font-weight: 700; text-decoration: none; }
.stv-verify-later { margin-top: 8px; width: 100%; padding: 12px; border: 0; background: transparent; color: #64748b; font: inherit; font-size: 14px; cursor: pointer; }
[data-theme="dark"] .stv-verify-card { background: #0d1640; color: #e8edf7; }
[data-theme="dark"] .stv-verify-card p, [data-theme="dark"] .stv-verify-later { color: #9aa7c7; }
@media (min-width: 600px) { .stv-verify { align-items: center; } .stv-verify-card { border-radius: 22px; } }
