:root {
  --bg: #050806; --bg2: #08100b; --panel: #0c150f; --panel2: #121e16; --line: #1b2c20;
  --text: #e8f3ea; --muted: #8fa596; --dim: #5d7063;
  --accent: #2fbf5c; --accent2: #7dffa5;
  --metal: linear-gradient(135deg, #3ee07a 0%, #1f8f45 45%, #9cffbf 55%, #26a552 100%);
  --st: env(safe-area-inset-top); --sb: env(safe-area-inset-bottom);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif; overscroll-behavior: none; }
body { background: radial-gradient(120% 60% at 50% -10%, #0f2a18 0%, var(--bg) 60%) fixed; }
button, input, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
img { display: block; }
.muted { color: var(--muted); } .small { font-size: 13px; }

#app { position: fixed; inset: 0; bottom: calc(62px + var(--sb)); overflow-y: auto; -webkit-overflow-scrolling: touch; }
#app.full { bottom: 0; }
.page { padding: calc(var(--st) + 8px) 16px 24px; animation: rise .28s cubic-bezier(.2,.8,.2,1); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.top { display: flex; align-items: center; gap: 10px; margin: 6px 0 14px; }
.top h1 { font-size: 30px; font-weight: 800; margin: 0; flex: 1; letter-spacing: -.5px; background: var(--metal); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ibtn { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--panel2); border: 1px solid var(--line); font-size: 18px; }

/* tab bar */
#tabs { position: fixed; left: 0; right: 0; bottom: 0; height: calc(62px + var(--sb)); padding-bottom: var(--sb); display: flex; background: rgba(6,11,8,.86); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-top: 1px solid var(--line); z-index: 5; }
#tabs.hide { display: none; }
#tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--dim); font-size: 11px; font-weight: 600; position: relative; transition: color .2s; }
#tabs button svg { width: 24px; height: 24px; transition: transform .25s cubic-bezier(.2,.9,.3,1.4); }
#tabs button.on { color: var(--accent2); }
#tabs button.on svg { transform: translateY(-2px) scale(1.08); filter: drop-shadow(0 0 6px rgba(47,191,92,.6)); }
#tabs .dot { position: absolute; top: 8px; left: 50%; margin-left: 8px; min-width: 17px; height: 17px; border-radius: 9px; background: #ff4d5e; color: #fff; font-size: 10px; display: grid; place-items: center; padding: 0 4px; }

/* cards & lists */
.card { background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line); border-radius: 18px; padding: 14px; margin-bottom: 12px; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid rgba(27,44,32,.6); }
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sec { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--dim); margin: 18px 4px 6px; }
.av { position: relative; flex: none; width: 46px; height: 46px; border-radius: 50%; background: var(--panel2) center/cover; display: grid; place-items: center; font-weight: 800; color: #04140a; }
.av.sm { width: 36px; height: 36px; font-size: 13px; } .av.lg { width: 92px; height: 92px; font-size: 30px; border: 4px solid var(--bg); }
.av i { position: absolute; right: 0; bottom: 0; width: 13px; height: 13px; border-radius: 50%; border: 2.5px solid var(--bg); background: var(--dim); }
.av i.online { background: #36d66c; } .av i.playing { background: #6c8cff; } .av i.away { background: #f2b33d; }
.av.lg i { width: 22px; height: 22px; border-width: 4px; }
.btn { padding: 10px 16px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line); font-weight: 700; }
.btn.primary { background: var(--metal); color: #03130a; border: 0; box-shadow: 0 4px 18px rgba(47,191,92,.3), inset 0 1px 0 rgba(255,255,255,.4); }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.btn:active, .ibtn:active { transform: scale(.96); }
.field { width: 100%; padding: 13px 14px; border-radius: 13px; background: var(--bg2); border: 1px solid var(--line); outline: none; margin-bottom: 10px; font-size: 16px; }
.field:focus { border-color: var(--accent); }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.seg { display: flex; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; margin-bottom: 12px; }
.seg button { flex: 1; padding: 8px; border-radius: 9px; font-weight: 700; color: var(--muted); }
.seg button.on { background: var(--panel2); color: var(--text); }

/* sign in */
.auth { min-height: 100%; display: flex; flex-direction: column; justify-content: center; padding: calc(var(--st) + 20px) 24px calc(var(--sb) + 20px); }
.auth .logo { width: 84px; height: 84px; margin: 0 auto 14px; border-radius: 22px; box-shadow: 0 0 40px rgba(47,191,92,.35); }
.auth h1 { text-align: center; font-size: 34px; margin: 0 0 4px; background: var(--metal); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth p { text-align: center; margin: 0 0 22px; }
.auth .btn { width: 100%; padding: 14px; }

/* feed */
.post .head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.post .head .grow { flex: 1; min-width: 0; }
.post .txt { white-space: pre-wrap; word-wrap: break-word; }
.post .media { margin: 10px -14px 0; width: calc(100% + 28px); max-height: 520px; object-fit: cover; background: #000; }
.post .game { display: inline-block; margin-top: 8px; font-size: 12px; padding: 3px 9px; border-radius: 8px; background: rgba(47,191,92,.12); color: var(--accent2); }
.acts { display: flex; gap: 18px; margin-top: 10px; color: var(--muted); font-weight: 600; }
.acts button { display: flex; align-items: center; gap: 6px; }
.acts .liked { color: #ff5f7a; } .acts .liked span:first-child { animation: pop .35s; }
@keyframes pop { 50% { transform: scale(1.4); } }
.compose { display: flex; gap: 10px; align-items: center; }
.compose .field { margin: 0; }

/* chat */
.chat { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--bg); z-index: 6; animation: slide .25s cubic-bezier(.2,.8,.2,1); }
@keyframes slide { from { transform: translateX(30%); opacity: 0; } }
.chat .bar { display: flex; align-items: center; gap: 10px; padding: calc(var(--st) + 6px) 12px 10px; border-bottom: 1px solid var(--line); background: rgba(6,11,8,.9); backdrop-filter: blur(18px); }
.chat .bar .grow { flex: 1; min-width: 0; }
.msgs { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.bub { max-width: 78%; padding: 8px 12px; border-radius: 18px; background: var(--panel2); border: 1px solid var(--line); align-self: flex-start; white-space: pre-wrap; word-wrap: break-word; }
.bub.me { align-self: flex-end; background: linear-gradient(135deg, #2bb558, #1b8a41); border: 0; color: #f0fff4; }
.bub img { max-width: 100%; border-radius: 12px; margin: 2px 0; }
.bub .who { font-size: 11px; font-weight: 700; color: var(--accent2); }
.bub.pend { opacity: .55; }
.stamp { align-self: center; color: var(--dim); font-size: 11px; margin: 10px 0 4px; }
.inbar { display: flex; gap: 8px; align-items: flex-end; padding: 8px 10px calc(var(--sb) + 8px); border-top: 1px solid var(--line); background: rgba(6,11,8,.95); }
.inbar textarea { flex: 1; min-width: 0; width: 0;resize: none; max-height: 120px; padding: 10px 14px; border-radius: 20px; background: var(--bg2); border: 1px solid var(--line); outline: none; font-size: 16px; }
.inbar .ibtn { border-radius: 50%; }
.inbar .send { background: var(--metal); color: #03130a; border: 0; }

/* profile */
.banner { height: 150px; margin: calc(-8px - var(--st)) -16px 0; background: linear-gradient(135deg, #154a28, #071a0e) center/cover; }
.prof { text-align: center; margin-top: -46px; }
.prof .av { margin: 0 auto; }
.prof h2 { margin: 8px 0 0; font-size: 24px; }
.prof .bio { margin: 8px 0 0; white-space: pre-wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 20px; background: rgba(47,191,92,.12); border: 1px solid rgba(47,191,92,.3); color: var(--accent2); font-size: 13px; margin-top: 10px; }
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.games div { border-radius: 10px; overflow: hidden; background: var(--panel2); font-size: 12px; }
.games img { width: 100%; aspect-ratio: 460/215; object-fit: cover; }
.games span { display: block; padding: 5px 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.backbtn { position: absolute; top: calc(var(--st) + 8px); left: 12px; background: rgba(0,0,0,.45); backdrop-filter: blur(10px); border: 0; }

/* sheet */
#sheet { position: fixed; inset: 0; z-index: 20; display: none; }
#sheet.on { display: block; }
#sheet .shade { position: absolute; inset: 0; background: rgba(0,0,0,.55); animation: fade .2s; }
#sheet .box { position: absolute; left: 0; right: 0; bottom: 0; max-height: 85%; overflow-y: auto; background: var(--panel); border-top: 1px solid var(--line); border-radius: 22px 22px 0 0; padding: 10px 16px calc(var(--sb) + 16px); animation: up .28s cubic-bezier(.2,.8,.2,1); }
#sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
#sheet h3 { margin: 0 0 12px; }
@keyframes fade { from { opacity: 0; } } @keyframes up { from { transform: translateY(100%); } }
#toast { position: fixed; left: 50%; top: calc(var(--st) + 10px); transform: translate(-50%, -80px); padding: 10px 16px; border-radius: 14px; background: var(--panel2); border: 1px solid var(--accent); z-index: 30; transition: transform .3s cubic-bezier(.2,.9,.3,1.2); max-width: 90%; font-weight: 600; }
#toast.on { transform: translate(-50%, 0); }
.spin { width: 28px; height: 28px; margin: 40px auto; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: sp .8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

/* background effect from your PC's settings (bgfx.js) */
#bgfx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; transition: opacity .6s ease; }
#app { z-index: 1; }
body.th-light { background: var(--bg); }
body.th-light .bub.me { color: #fff; }

/* bubbles: yours rise from the message box with a bounce, new ones from friends slide in */
@keyframes bSent { 0% { opacity: 0; transform: translateY(22px) scale(.82); } 60% { opacity: 1; transform: translateY(-3px) scale(1.04); } 100% { transform: none; } }
@keyframes bGot { 0% { opacity: 0; transform: translateX(-16px) scale(.9); } 70% { opacity: 1; transform: translateX(2px) scale(1.01); } 100% { transform: none; } }
.bub.sent { transform-origin: bottom right; animation: bSent .42s cubic-bezier(.2,.9,.3,1.2); }
.bub.got { transform-origin: bottom left; animation: bGot .45s cubic-bezier(.2,.8,.2,1); }
@keyframes bPop { 0% { opacity: 0; transform: scale(.2); } 65% { opacity: 1; transform: scale(1.06); } 100% { transform: none; } }
@keyframes bSlideR { 0% { opacity: 0; transform: translateX(40px); } 100% { opacity: 1; transform: none; } }
@keyframes bSlideL { 0% { opacity: 0; transform: translateX(-40px); } 100% { opacity: 1; transform: none; } }
@keyframes bFade { 0% { opacity: 0; } 100% { opacity: 1; } }
body[data-bfx="pop"] .bub.sent, body[data-bfx="pop"] .bub.got { animation: bPop .38s cubic-bezier(.2,.9,.3,1.25); }
body[data-bfx="slide"] .bub.sent { animation: bSlideR .28s cubic-bezier(.2,.8,.2,1); }
body[data-bfx="slide"] .bub.got { animation: bSlideL .28s cubic-bezier(.2,.8,.2,1); }
body[data-bfx="fade"] .bub.sent, body[data-bfx="fade"] .bub.got { animation: bFade .5s ease; }
body[data-bfx="off"] .bub.sent, body[data-bfx="off"] .bub.got { animation: none; }

/* voice: floating bar while you're in a call or lounge, and the incoming call card */
.vbar { position: fixed; left: 10px; right: 10px; bottom: calc(70px + var(--sb)); z-index: 15; display: flex; align-items: center; gap: 10px; padding: 9px 10px 9px 12px; border-radius: 18px; background: rgba(10,18,13,.92); border: 1px solid rgba(var(--acc-rgb,47,191,92), .45); box-shadow: 0 8px 30px rgba(0,0,0,.5), 0 0 22px rgba(var(--acc-rgb,47,191,92), .18); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); animation: up .35s cubic-bezier(.2,.9,.3,1.2); }
.chat ~ .vbar, body:has(#chat) .vbar { bottom: calc(76px + var(--sb)); }
.vbar.ring { top: calc(var(--st) + 8px); bottom: auto; animation: ringIn .5s cubic-bezier(.2,.9,.3,1.3), ringGlow 1.4s ease-in-out infinite; }
@keyframes ringIn { from { transform: translateY(-120%); } }
@keyframes ringGlow { 50% { box-shadow: 0 8px 30px rgba(0,0,0,.5), 0 0 34px rgba(var(--acc-rgb,47,191,92), .55); } }
.vb-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.vb-t b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vb-t span { font-size: 12px; color: var(--muted); }
.vb-b { width: 40px; height: 40px; border-radius: 50%; background: var(--panel2); border: 1px solid var(--line); font-size: 17px; display: grid; place-items: center; flex: none; }
.vb-b.off { background: #3a1418; border-color: #ff4d5e; }
.vb-b.no { background: #e8384f; border: 0; color: #fff; }
.vb-b.yes { background: var(--metal); border: 0; animation: pop 1s ease-in-out infinite; }
.vb-dots { display: flex; }
.vb-dots i { width: 28px; height: 28px; border-radius: 50%; background-size: cover; background-position: center; border: 2px solid var(--bg); margin-left: -8px; transition: box-shadow .15s; }
.vb-dots i:first-child { margin-left: 0; }
[data-vu].talking .av, .vb-dots i.talking { box-shadow: 0 0 0 2px var(--accent), 0 0 14px var(--accent); }
#app.soft .page { animation: none; }

/* patch notes */
.note { background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; margin-bottom: 10px; animation: rise .4s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i) * 50ms); }
.note-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.note-h b { flex: 1; min-width: 60%; }
.note-v { font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 8px; background: var(--metal); color: #04130a; }
.note-i { display: flex; flex-direction: column; gap: 3px; padding: 8px 0 8px 10px; border-left: 2px solid var(--line); margin: 4px 0; font-size: 14px; }
.note-t { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; }
.note-i.t-new { border-color: var(--accent); } .note-i.t-new .note-t { color: var(--accent2); }
.note-i.t-improved { border-color: #6c8cff; } .note-i.t-improved .note-t { color: #9fb3ff; }
.note-i.t-fixed { border-color: #f2b33d; } .note-i.t-fixed .note-t { color: #f6cd75; }

/* profile: badges, about, links (no more status pill: the dot on the picture says it) */
.pbadges { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pbadges button { width: 34px; height: 34px; border-radius: 10px; background: rgba(255,255,255,.04); border: 1px solid var(--line); display: grid; place-items: center; animation: badgeIn .45s cubic-bezier(.2,.9,.3,1.3) both; animation-delay: calc(var(--i) * 45ms); }
.pbadges img { width: 24px; height: 24px; object-fit: contain; }
.pbadges button:active { transform: scale(.9); }
@keyframes badgeIn { from { opacity: 0; transform: scale(.4) rotate(-12deg); } }
.pabout { display: flex; justify-content: center; gap: 12px; margin-top: 8px; color: var(--muted); font-size: 13px; }
.pnow { margin-top: 8px; font-size: 13px; color: var(--accent2); }
.plinks { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.plink { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px 7px 9px; border-radius: 12px; background: color-mix(in srgb, var(--lc) 12%, var(--panel2)); border: 1px solid color-mix(in srgb, var(--lc) 35%, transparent); color: var(--text); text-decoration: none; font-size: 13px; font-weight: 600; max-width: 100%; }
.plink svg { width: 16px; height: 16px; color: var(--lc); flex: none; }
.plink span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plink:active { transform: scale(.95); }
.prof .btn { white-space: nowrap; padding: 10px 13px; }

/* music: little bouncing bars */
.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; margin: 0 4px; flex: none; }
.eq i { width: 3px; height: 30%; background: var(--accent2); border-radius: 2px; animation: eq 1s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.4s; } .eq i:nth-child(3) { animation-delay: -.7s; }
@keyframes eq { 0%, 100% { height: 30%; } 50% { height: 100%; } }
.songchip { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px; background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.12); text-align: left; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); margin: 8px 0; }
.songchip img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; }
.songchip > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.songchip b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .songchip span { font-size: 12px; color: var(--muted); }

/* notes row (top of Chats), Instagram style thought bubbles */
.notes { display: flex; gap: 14px; overflow-x: auto; padding: 46px 2px 8px; margin: 0 -16px 6px; padding-left: 16px; scrollbar-width: none; }
.notes::-webkit-scrollbar { display: none; }
.ncell { position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; width: 72px; flex: none; }
.ncell .av { width: 62px; height: 62px; }
.nname { font-size: 11px; color: var(--muted); max-width: 72px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nbub { position: absolute; bottom: calc(100% - 22px); left: 50%; transform: translateX(-50%); max-width: 104px; min-width: 56px; padding: 6px 9px; border-radius: 14px; background: var(--panel2); border: 1px solid var(--line); font-size: 11.5px; line-height: 1.25; text-align: center; box-shadow: 0 4px 14px rgba(0,0,0,.35); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; animation: nbIn .5s cubic-bezier(.2,.9,.3,1.3) both; z-index: 1; }
.nbub::after { content: ''; position: absolute; left: 50%; bottom: -5px; width: 8px; height: 8px; border-radius: 50%; background: var(--panel2); border: 1px solid var(--line); transform: translateX(-60%); }
.nbub.empty { color: var(--muted); font-weight: 700; }
.nsong { display: flex; align-items: center; justify-content: center; margin-top: 3px; font-size: 10.5px; color: var(--accent2); white-space: nowrap; overflow: hidden; }
@keyframes nbIn { from { opacity: 0; transform: translateX(-50%) translateY(6px) scale(.7); } }
.nbig { font-size: 22px; font-weight: 700; margin: 12px 0 4px; }
.nemoji { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.nemoji button { width: 40px; height: 40px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line); font-size: 20px; }
.nemoji button.on { border-color: var(--accent); box-shadow: 0 0 12px rgba(var(--acc-rgb,47,191,92), .4); }

/* stories row (top of Feed) */
.stories { display: flex; gap: 12px; overflow-x: auto; margin: 0 -16px 14px; padding: 2px 16px 4px; scrollbar-width: none; }
.stories::-webkit-scrollbar { display: none; }
.scell { display: flex; flex-direction: column; align-items: center; gap: 5px; width: 70px; flex: none; }
.scell span { font-size: 11px; color: var(--muted); max-width: 70px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sring { position: relative; padding: 3px; border-radius: 50%; background: var(--line); }
.sring.new { background: conic-gradient(from 210deg, var(--accent), var(--accent2), #fff, var(--accent)); animation: sspin 6s linear infinite; }
.sring .av { width: 60px; height: 60px; border: 3px solid var(--bg); }
.sring .av i { display: none; }
@keyframes sspin { to { filter: hue-rotate(0deg); } }
.splus { position: absolute; right: 0; bottom: 0; width: 22px; height: 22px; border-radius: 50%; background: var(--metal); color: #04130a; font-style: normal; font-weight: 900; display: grid; place-items: center; border: 2px solid var(--bg); font-size: 13px; }
.snew-prev { height: 300px; border-radius: 18px; display: grid; place-items: center; padding: 18px; margin-bottom: 10px; transition: background .3s; }
.snew-prev textarea { width: 100%; background: none; border: 0; outline: none; resize: none; text-align: center; font-size: 24px; font-weight: 800; color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,.4); }
.snew-prev textarea::placeholder { color: rgba(255,255,255,.65); }
.snew-prev.photo textarea { background: rgba(0,0,0,.35); border-radius: 12px; padding: 8px; font-size: 18px; }
.sbgs { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.sbgs button[data-i] { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; }
.sbgs button.on { border-color: #fff; }
/* story viewer */
#story { position: fixed; inset: 0; z-index: 25; background: #000; display: flex; flex-direction: column; opacity: 0; transform: scale(.94); transition: opacity .22s, transform .25s cubic-bezier(.2,.8,.2,1); }
#story.on { opacity: 1; transform: none; }
.sv-bars { display: flex; gap: 4px; padding: calc(var(--st) + 8px) 10px 6px; position: relative; z-index: 2; }
.sv-bars i { flex: 1; height: 3px; border-radius: 2px; background: rgba(255,255,255,.3); overflow: hidden; }
.sv-bars b { display: block; height: 100%; background: #fff; }
.sv-head { display: flex; align-items: center; gap: 9px; padding: 4px 12px; position: relative; z-index: 2; color: #fff; }
.sv-head span { color: rgba(255,255,255,.65); font-size: 13px; flex: 1; }
.sv-head button { font-size: 22px; color: #fff; width: 40px; height: 40px; }
.sv-body { position: absolute; inset: 0; display: grid; place-items: center; padding: 90px 22px 110px; }
.sv-body.in { animation: svIn .35s cubic-bezier(.2,.8,.2,1); }
@keyframes svIn { from { opacity: 0; transform: scale(1.04); } }
.sv-body img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.sv-text { position: relative; font-size: 28px; font-weight: 800; color: #fff; text-align: center; text-shadow: 0 2px 14px rgba(0,0,0,.45); white-space: pre-wrap; word-wrap: break-word; }
.sv-text.over { font-size: 20px; background: rgba(0,0,0,.45); padding: 8px 14px; border-radius: 14px; align-self: end; }
.sv-song { position: absolute; top: calc(var(--st) + 74px); left: 50%; transform: translateX(-50%); width: min(80%, 320px); }
.sv-song .songchip { color: #fff; }
.sv-tap { position: absolute; top: 90px; bottom: 90px; z-index: 1; } .sv-tap.l { left: 0; width: 33%; } .sv-tap.r { right: 0; width: 67%; }
.sv-foot { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; display: flex; gap: 8px; align-items: center; padding: 10px 12px calc(var(--sb) + 12px); background: linear-gradient(transparent, rgba(0,0,0,.6)); }
.sv-foot .field { margin: 0; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.3); color: #fff; border-radius: 22px; }
.sv-react { font-size: 26px; transition: transform .2s; } .sv-react.pop { animation: pop .4s; }
.notes { padding-top: 64px; }
.nbub { bottom: calc(100% - 12px); max-width: 112px; }
.nbub { min-width: 84px; }

/* message effects */
.bub { position: relative; }
.bfx { position: absolute; top: -9px; right: -9px; width: 22px; height: 22px; border-radius: 50%; font-size: 12px; background: var(--panel2); border: 1px solid var(--line); display: grid; place-items: center; }
.bub.me .bfx { right: auto; left: -9px; }
.fxgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fxgrid button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 6px; border-radius: 14px; background: var(--panel2); border: 1px solid var(--line); font-weight: 700; font-size: 13px; }
.fxgrid span { font-size: 28px; }
.fxgrid button:active { transform: scale(.94); }

/* ---------- bottom bar v2: floating glass capsule (replaces the flat strip) ---------- */
#app { bottom: 0; padding-bottom: calc(96px + var(--sb)); }
#app.full { padding-bottom: 0; }
#tabs { left: 0; right: 0; bottom: 0; height: auto; padding: 0 18px calc(var(--sb) + 10px); background: none; border: 0; backdrop-filter: none; -webkit-backdrop-filter: none; display: block; pointer-events: none; }
#tabs .tb { position: relative; display: flex; height: 62px; border-radius: 31px; pointer-events: auto;
  background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.02)), rgba(10,16,12,.72);
  border: 1px solid rgba(255,255,255,.09); box-shadow: 0 12px 34px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.08);
  backdrop-filter: blur(22px) saturate(1.6); -webkit-backdrop-filter: blur(22px) saturate(1.6); animation: tbIn .5s cubic-bezier(.2,.9,.3,1.2); }
@keyframes tbIn { from { transform: translateY(30px); opacity: 0; } }
#tabs .tb-pill { position: absolute; top: 7px; bottom: 7px; left: 7px; width: calc((100% - 14px) / 5); border-radius: 24px; pointer-events: none;
  background: radial-gradient(120% 140% at 50% 0%, rgba(var(--acc-rgb,47,191,92), .35), rgba(var(--acc-rgb,47,191,92), .12));
  box-shadow: inset 0 0 0 1px rgba(var(--acc-rgb,47,191,92), .35), 0 0 18px rgba(var(--acc-rgb,47,191,92), .25);
  transition: transform .45s cubic-bezier(.3,1.35,.5,1), opacity .2s; }
#tabs .tb { padding: 0 7px; }
#tabs button { flex: 1; position: relative; z-index: 1; display: grid; place-items: center; color: rgba(255,255,255,.45); font-size: 0; transition: color .25s; }
#tabs button svg { width: 26px; height: 26px; transition: transform .35s cubic-bezier(.3,1.4,.5,1); }
#tabs button.on { color: var(--accent2); }
#tabs button.on svg { transform: scale(1.12); filter: drop-shadow(0 0 6px rgba(var(--acc-rgb,47,191,92), .55)); }
#tabs button:active svg, #tabs button:active .tb-me { transform: scale(.86); }
.tb-me { width: 27px; height: 27px; border-radius: 50%; display: grid; place-items: center; font: 800 12px -apple-system, system-ui, sans-serif; color: #04130a; box-shadow: 0 0 0 1.5px rgba(255,255,255,.25); transition: transform .35s cubic-bezier(.3,1.4,.5,1), box-shadow .25s; }
#tabs button.on .tb-me { transform: scale(1.1); box-shadow: 0 0 0 2px var(--accent2), 0 0 12px rgba(var(--acc-rgb,47,191,92), .55); }
.tb-dot { position: absolute; top: 13px; left: 50%; margin-left: 9px; width: 8px; height: 8px; border-radius: 50%; background: #ff4d5e; box-shadow: 0 0 0 2px rgba(10,16,12,.9); transform: scale(0); transition: transform .3s cubic-bezier(.3,1.6,.5,1); }
.tb-dot.on { transform: scale(1); }
#tabs .dot { display: none; }
body.th-light #tabs .tb { background: rgba(255,255,255,.78); border-color: rgba(0,0,0,.06); }
body.th-light #tabs button { color: rgba(0,0,0,.4); }
/* things that sat above the old bar move up to clear the capsule */
.vbar { bottom: calc(84px + var(--sb)); }
body:has(#chat) .vbar { bottom: calc(76px + var(--sb)); }
/* sit the capsule just above the home bar line instead of a full safe-area gap higher */
#tabs { padding-bottom: max(8px, calc(var(--sb) - 18px)); }
#app { padding-bottom: calc(84px + max(8px, calc(var(--sb) - 18px))); }
.vbar { bottom: calc(76px + max(8px, calc(var(--sb) - 18px))); }
