/* Socialgram styles
   Layout: a fixed left sidebar with "New story" pinned at its exact middle,
   then a three-column home (trending + live | feed | people). */
:root {
  --bg: #F3F4F9;
  --surface: #FFFFFF;
  --surface-2: #ECEEF5;
  --line: #DDE0EA;
  --fg: #141826;
  --muted: #5E6578;
  --ink: #141826;
  --accent: #F2542D;
  --accent-2: #FFB020;
  --accent-ink: #FFFFFF;
  --accent-soft: #FFE8E0;
  --like: #2463EB;
  --dislike: #C2410C;
  --save: #B7791F;
  --danger: #D92D4B;
  --danger-soft: #FDE4E8;
  --ok: #12935A;
  --live: #E5254B;
  --name-l: 40%;
  --shadow: 0 1px 2px rgba(20, 24, 38, .05), 0 6px 18px rgba(20, 24, 38, .06);
  --radius: 16px;
  --radius-sm: 10px;
  --sb-w: 248px;
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D0F17; --surface: #161925; --surface-2: #202434; --line: #2B3042; --fg: #ECEEF5; --muted: #9AA1B7;
    --ink: #0A0C13; --accent: #FF6A45; --accent-soft: #3B1F18; --like: #6B9BFF; --dislike: #FF8A5B; --save: #F2C14E;
    --danger: #FF5C7A; --danger-soft: #3A1620; --ok: #34D399; --name-l: 70%;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0D0F17; --surface: #161925; --surface-2: #202434; --line: #2B3042; --fg: #ECEEF5; --muted: #9AA1B7;
  --ink: #0A0C13; --accent: #FF6A45; --accent-soft: #3B1F18; --like: #6B9BFF; --dislike: #FF8A5B; --save: #F2C14E;
  --danger: #FF5C7A; --danger-soft: #3A1620; --ok: #34D399; --name-l: 70%;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font: 15px/1.5 var(--font-body); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
input, textarea, select { font: inherit; color: inherit; }
img, video { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; text-wrap: balance; margin: 0; }
p { margin: 0; }
code { font-family: ui-monospace, Consolas, monospace; font-size: .9em; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.spacer { flex: 1; }
.pad { padding: 12px; }
.row-gap { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row-end { display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; justify-content: space-between; gap: 8px; }
.row-wrap { display: flex; gap: 8px; flex-wrap: wrap; }
.stack { display: grid; gap: 14px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 999px;
  background: var(--surface-2); color: var(--fg); font-weight: 600; font-size: 14px; border: 1px solid transparent; white-space: nowrap;
  transition: background .15s, transform .1s, filter .15s; }
.btn:hover { background: var(--line); }
.btn:active { transform: scale(.97); }
.btn .i { width: 18px; height: 18px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:hover { filter: brightness(1.08); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.sm .i { width: 16px; height: 16px; }
.btn.lg { height: 46px; font-size: 15px; padding: 0 20px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .6; cursor: default; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: var(--fg); position: relative; flex: none; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.tiny { width: 26px; height: 26px; color: var(--muted); }
.icon-btn.tiny .i { width: 14px; height: 14px; }
.icon-btn.danger, .icon-btn.off { color: var(--danger); }
.icon-btn.light { color: #fff; }
.icon-btn.light:hover { background: rgba(255, 255, 255, .15); }
.icon-btn.over { position: absolute; top: 10px; right: 10px; background: rgba(0, 0, 0, .55); color: #fff; z-index: 2; }
.link-btn { color: var(--accent); font-weight: 600; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--danger); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; background: var(--surface-2); font-size: 13px; font-weight: 600; white-space: nowrap; }
.chip:hover { background: var(--line); }
.chip.on { background: var(--fg); color: var(--bg); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-block: 12px; }
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
.field > span { color: var(--muted); }
input:not([type=radio]):not([type=range]):not([type=checkbox]), textarea, select {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); font-size: 15px; font-weight: 400; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; }
input[type=range] { accent-color: var(--accent); width: 100%; }
.pw { position: relative; }
.pw input { padding-right: 88px !important; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 10px;
  border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.pw-toggle:hover { background: var(--surface-2); color: var(--fg); }
.pw-toggle .i { width: 17px; height: 17px; }
.prefix { display: flex; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.prefix b { padding-left: 12px; color: var(--muted); font-weight: 600; }
.prefix input { border: 0 !important; box-shadow: none !important; padding-left: 4px !important; background: transparent !important; }
.prefix:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-error { color: var(--danger); background: var(--danger-soft); padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; }
.strength { display: grid; gap: 4px; font-size: 12px; color: var(--muted); margin-top: -8px; }
.strength i { display: block; height: 4px; border-radius: 2px; background: var(--surface-2); position: relative; overflow: hidden; }
.strength i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 0; background: var(--danger); transition: width .2s, background .2s; }
.strength[data-s="0"] i::after { width: 8%; }
.strength[data-s="1"] i::after { width: 25%; }
.strength[data-s="2"] i::after { width: 45%; background: var(--accent-2); }
.strength[data-s="3"] i::after { width: 65%; background: var(--accent-2); }
.strength[data-s="4"] i::after { width: 85%; background: var(--ok); }
.strength[data-s="5"] i::after { width: 100%; background: var(--ok); }
.radio-list { display: grid; gap: 6px; }
.radio { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); cursor: pointer; font-weight: 500; font-size: 14px; }
.radio:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio input { accent-color: var(--accent); margin: 0; }
.radio span { display: inline-flex; align-items: center; gap: 8px; }

/* ---------- Sign up / log in ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-brand { position: relative; overflow: hidden; background: var(--ink); color: #F4F2EE; padding: 56px clamp(24px, 5vw, 72px);
  display: flex; flex-direction: column; justify-content: center; gap: 28px; }
.auth-brand::before, .auth-brand::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.auth-brand::before { width: 560px; height: 560px; right: -200px; top: -180px; background: radial-gradient(circle, #F2542D 0, transparent 66%); opacity: .55; }
.auth-brand::after { width: 420px; height: 420px; left: -160px; bottom: -200px; background: radial-gradient(circle, #FFB020 0, transparent 66%); opacity: .35; }
.auth-logo { display: flex; align-items: center; gap: 14px; font-family: var(--font-display); font-weight: 800; font-size: 34px; letter-spacing: -.02em; position: relative; z-index: 1; }
.auth-tag { font-size: clamp(28px, 3.4vw, 46px); font-weight: 800; letter-spacing: -.025em; max-width: 17ch; position: relative; z-index: 1; }
.auth-feats { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; position: relative; z-index: 1; font-size: 16px; color: #D9DCE6; }
.auth-feats li { display: flex; align-items: center; gap: 12px; }
.auth-feats .i { width: 22px; height: 22px; color: #FFB020; }
.auth-card { display: grid; place-items: center; padding: 40px max(16px, env(safe-area-inset-right, 0px)) 40px max(16px, env(safe-area-inset-left, 0px)); }
.auth-form { width: min(400px, 100%); display: grid; gap: 16px; }
.auth-form h1 { font-size: 32px; font-weight: 800; letter-spacing: -.02em; }
.auth-form > .muted { margin-top: -8px; }
.auth-switch { text-align: center; color: var(--muted); }
.auth-icon { width: 56px; height: 56px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.auth-icon .i { width: 28px; height: 28px; }
.auth-icon.danger { background: var(--danger-soft); color: var(--danger); }
.code-inputs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.code-inputs input { height: 58px; text-align: center; font-size: 26px !important; font-weight: 700 !important; font-family: var(--font-display); padding: 0 !important; font-variant-numeric: tabular-nums; }
.demo-inbox { border: 1.5px dashed var(--line); border-radius: 14px; padding: 14px 16px; display: grid; gap: 4px; background: var(--surface); }
.inbox-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.inbox-head .i { width: 16px; height: 16px; }
.inbox-code { font-family: ui-monospace, Consolas, monospace; font-size: 30px; font-weight: 700; letter-spacing: .3em; color: var(--accent); }

/* ---------- App shell ---------- */
#app { display: grid; grid-template-columns: var(--sb-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; height: 100dvh; display: grid; grid-template-rows: 1fr auto 1fr; gap: 10px;
  padding: 16px 12px; border-right: 1px solid var(--line); background: var(--surface); overflow-y: auto; scrollbar-width: none; z-index: 20; }
.sb-half { display: flex; flex-direction: column; justify-content: space-between; gap: 8px; min-height: 0; }
.sb-nav { display: flex; flex-direction: column; gap: 2px; }
.logo { display: flex; align-items: center; gap: 10px; padding: 6px 10px; font-family: var(--font-display); font-weight: 800; font-size: 22px; letter-spacing: -.02em; }
.logo-mark { display: inline-grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 10px; transform: rotate(-6deg);
  background: linear-gradient(135deg, #FFB020, #F2542D); color: #fff; font-family: var(--font-display); font-weight: 800; font-size: 20px; line-height: 1;
  box-shadow: 0 4px 12px rgba(242, 84, 45, .35); }
.logo-mark.lg { width: 54px; height: 54px; font-size: 32px; border-radius: 16px; }
.nav-item { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-radius: 12px; font-weight: 600; font-size: 15px; color: var(--fg); position: relative; width: 100%; text-align: left; transition: background .15s; }
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item .i { width: 22px; height: 22px; }
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--live); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.sb-story { display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 10px; border-radius: 16px; color: #fff; font-weight: 700; font-size: 15px;
  background: linear-gradient(135deg, #FFB020, #F2542D); box-shadow: 0 6px 18px rgba(242, 84, 45, .3); transition: transform .15s, filter .15s; }
.sb-story:hover { filter: brightness(1.06); transform: translateY(-1px); }
.sb-story-plus { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: rgba(255, 255, 255, .25); }
.sb-story-plus .i { stroke-width: 2.6; }
.sb-foot { display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--line); padding-top: 8px; }
.sb-foot .nav-item { font-size: 14px; padding: 8px 12px; color: var(--muted); }
.sb-foot .nav-item.active { color: var(--accent); }
.sb-foot .nav-item .i { width: 20px; height: 20px; }
.topbar, .bottombar { display: none; }

.view { min-width: 0; padding-block: 24px 56px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.page { max-width: 1080px; margin: 0 auto; }
.page.narrow { max-width: 680px; }
.page.wide { max-width: 1180px; }
.page-title { font-size: 30px; font-weight: 800; letter-spacing: -.02em; display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.page-title .i { width: 28px; height: 28px; color: var(--accent); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head .page-title { margin: 0; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--muted); margin-bottom: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel { padding: 16px; display: grid; gap: 12px; }
.panel-title { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.panel-title .i { color: var(--accent); width: 18px; height: 18px; }
.sub { font-size: 18px; font-weight: 700; margin: 24px 0 12px; }
.empty { padding: 32px; text-align: center; color: var(--muted); display: grid; gap: 8px; justify-items: center; }
.empty .i { width: 36px; height: 36px; color: var(--accent); }
.empty-state { display: grid; place-items: center; gap: 10px; text-align: center; padding: 48px 24px; height: 100%; align-content: center; }
.empty-state .i { width: 44px; height: 44px; color: var(--accent); }
.empty-state p { max-width: 40ch; }
.note { background: var(--accent-soft); padding: 10px 14px; border-radius: 10px; font-size: 14px; }

/* ---------- Avatars + badges ---------- */
.av { display: inline-grid; place-items: center; flex: none; border-radius: 50%; overflow: hidden; background: hsl(var(--h, 220) 62% 50%); color: #fff;
  font-weight: 700; font-family: var(--font-display); position: relative; line-height: 1; }
.av img { width: 100%; height: 100%; object-fit: cover; }
.av-xs { width: 24px; height: 24px; font-size: 10px; }
.av-sm { width: 32px; height: 32px; font-size: 12px; }
.av-md { width: 42px; height: 42px; font-size: 15px; }
.av-lg { width: 60px; height: 60px; font-size: 21px; }
.av-xl { width: 84px; height: 84px; font-size: 28px; }
.av-xxl { width: 124px; height: 124px; font-size: 42px; }
.av.online { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ok); }
.av.live-ring { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--live); }
.badge { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; margin-left: 4px; vertical-align: -2px; }
.badge .i { width: 11px; height: 11px; stroke-width: 3; }
.badge.verified { background: var(--like); color: #fff; }
.badge.owner { background: #FFB020; color: #3A2500; }
.name-link { font-weight: 700; }
.name-link:hover { text-decoration: underline; }
.role-chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; margin-right: 6px; }
.role-chip.danger { background: var(--danger-soft); color: var(--danger); }
.role-chip.subtle { background: var(--surface-2); color: var(--muted); }
.sample { font-style: italic; }
.ok-dot { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); font-weight: 600; font-size: 13px; }
.ok-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }

/* ---------- Home ---------- */
.home { display: grid; grid-template-columns: 272px minmax(0, 600px) 300px; gap: 24px; justify-content: center; align-items: start; }
.rail { position: sticky; top: 24px; display: grid; gap: 16px; max-height: calc(100vh - 48px); overflow-y: auto; scrollbar-width: none; }
.feed-col, .feed { display: grid; gap: 16px; min-width: 0; }
.announce { display: flex; gap: 12px; padding: 14px 16px; background: var(--accent-soft); border-color: transparent; }
.announce .i { color: var(--accent); margin-top: 2px; }
.announce p { margin-top: 2px; }
.foot { padding: 0 8px; }
.foot a { color: var(--accent); }

.stories { display: flex; gap: 12px; padding: 14px 16px; overflow-x: auto; scrollbar-width: none; align-items: flex-start; }
.story-item { display: grid; justify-items: center; gap: 6px; position: relative; flex: none; width: 74px; }
.story-ring { padding: 3px; border-radius: 50%; background: conic-gradient(from 210deg, #FFB020, #F2542D, #E5254B, #FFB020); transition: transform .15s; }
.story-ring:hover { transform: scale(1.04); }
.story-ring .av { border: 3px solid var(--surface); }
.story-ring.seen { background: var(--line); }
.story-ring.none { background: transparent; }
.story-add { position: absolute; top: 48px; right: 2px; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; border: 2px solid var(--surface); display: grid; place-items: center; }
.story-add .i { width: 13px; height: 13px; stroke-width: 3.2; }
.story-name { font-size: 12px; max-width: 74px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stories-empty { align-self: center; }

.composer { padding: 14px 16px; display: grid; gap: 10px; }
.composer-row { display: flex; gap: 12px; align-items: flex-start; }
.composer textarea { border: 0 !important; background: transparent; padding: 9px 0; font-size: 16px; resize: none; box-shadow: none !important; }
.composer-bar { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 10px; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: 14px; }
.chip-btn:hover { background: var(--surface-2); color: var(--fg); }
.chip-btn .i { color: var(--accent); width: 18px; height: 18px; }
.composer-media { position: relative; border-radius: 12px; overflow: hidden; background: #000; }
.composer-media img, .composer-media video { width: 100%; max-height: 360px; object-fit: contain; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; margin-bottom: 16px; }
.tab { padding: 10px 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; margin-bottom: -1px; }
.tab:hover { color: var(--fg); }
.tab.on { color: var(--fg); border-bottom-color: var(--accent); }
.feed-col .tabs { margin-bottom: 0; }

.trend-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.trend-list a { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 7px 10px; border-radius: 10px; }
.trend-list a:hover { background: var(--surface-2); }
.live-row { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 10px; }
.live-row:hover { background: var(--surface-2); }
.live-row > span:nth-child(2) { flex: 1; min-width: 0; display: grid; }
.live-row .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-count { font-size: 12px; font-weight: 700; color: var(--live); font-variant-numeric: tabular-nums; }
.arcade-card canvas { width: 100%; border-radius: 10px; aspect-ratio: 4 / 1; display: block; }

/* People rows */
.person { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; }
.person-text { flex: 1; min-width: 0; display: grid; }
.person-text b, .person-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person.pick { padding: 8px; border-radius: 10px; }
.person.pick:hover { background: var(--surface-2); }
.sugg { display: flex; align-items: center; gap: 2px; }
.person-inline { display: flex; align-items: center; gap: 10px; }
.person-inline > span { display: grid; }
.rel-btn { flex: none; }
.feed-col, .feed, .post, .panel, .profile-body, #search-results, .stack, .modal-body, .comments, .rail { grid-template-columns: minmax(0, 1fr); }
.person-text > * { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail > *, .panel > * { min-width: 0; }
.sugg > .person { flex: 1; min-width: 0; }
.rail .rel-btn { width: 34px; height: 34px; padding: 0; }
.rail .rel-btn span { display: none; }
.act em.opt { display: none; }

/* ---------- Posts ---------- */
.post { padding: 16px; display: grid; gap: 12px; }
.post-head { display: flex; align-items: center; gap: 12px; }
.post-who { flex: 1; min-width: 0; }
.post-who .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-text { font-size: 15px; overflow-wrap: anywhere; }
.post-text a, .bio a, .comment-body a, .smsg-text a, .bubble a, .lmsg a, .announce a { color: var(--accent); font-weight: 500; }
.post-media { margin-inline: -16px; background: #000; }
.post-media img, .post-media video { width: 100%; max-height: 620px; object-fit: contain; }
img.broken { min-height: 160px; width: 100%; background: var(--surface-2); }
.news-card { display: grid; gap: 6px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.news-region { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--accent); }
.news-region .i { width: 14px; height: 14px; }
.news-card h3 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.post-actions { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 8px; margin-bottom: -6px; }
.act { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 9px; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums; }
.act:hover { background: var(--surface-2); color: var(--fg); }
.act em { font-style: normal; }
.act .i { width: 18px; height: 18px; }
.act.on { color: var(--fg); }
.act.like { color: var(--like); }
.act.like .i { fill: currentColor; fill-opacity: .18; }
.act.dislike { color: var(--dislike); }
.act.dislike .i { fill: currentColor; fill-opacity: .18; }
.act.save { color: var(--save); }
.act.save .i { fill: currentColor; }
.act-spacer { flex: 1; }
.owner-strip { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 13px; padding: 8px 12px; border-radius: 10px; background: var(--accent-soft); }
.owner-strip .i { width: 16px; height: 16px; color: var(--accent); }
.owner-strip > span { font-weight: 700; color: var(--accent); margin-left: -8px; }
.comments { display: grid; gap: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.comment { display: flex; gap: 10px; align-items: flex-start; }
.comment-body { background: var(--surface-2); padding: 8px 12px; border-radius: 14px; min-width: 0; overflow-wrap: anywhere; font-size: 14px; }
.comment-form { display: flex; gap: 8px; align-items: center; }
.comment-form input { border-radius: 999px !important; }
.level-card { border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.level-card canvas { width: 100%; display: block; aspect-ratio: 4 / 1; }
.level-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; flex-wrap: wrap; }
.level-card.missing { padding: 16px; color: var(--muted); }
.yt-card { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 14px; align-items: center; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.yt-thumb { position: relative; display: block; aspect-ratio: 16 / 9; background: #000; }
.yt-thumb img { width: 100%; height: 100%; object-fit: cover; }
.yt-play { position: absolute; inset: 0; margin: auto; width: 48px; height: 48px; border-radius: 50%; background: rgba(0, 0, 0, .6); color: #fff; display: grid; place-items: center; }
.yt-play .i { width: 20px; height: 20px; }
.yt-meta { display: grid; gap: 2px; padding-right: 12px; }

/* ---------- Friends ---------- */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.pcard { padding: 18px 14px; display: grid; gap: 12px; justify-items: center; text-align: center; }
.pcard-top { display: grid; justify-items: center; gap: 4px; }
.pcard-top b { margin-top: 6px; }
.pcard-actions { display: flex; gap: 2px; align-items: center; justify-content: center; flex-wrap: wrap; }
.page > .panel, .page > section.card { margin-bottom: 16px; }

/* ---------- Search ---------- */
.search-box { display: flex; align-items: center; gap: 10px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); height: 46px; }
.search-box input { border: 0 !important; box-shadow: none !important; padding: 0 !important; background: transparent !important; height: 100%; }
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-box .i { color: var(--muted); }
#search-results { display: grid; gap: 14px; }
#search-results .sub { margin: 8px 0 0; }
.explore-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.explore-tile { aspect-ratio: 1; overflow: hidden; border-radius: 8px; background: var(--surface-2); }
.explore-tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.explore-tile:hover img { transform: scale(1.05); }

/* ---------- Profile ---------- */
.cover { height: 180px; border-radius: var(--radius); background: linear-gradient(120deg, hsl(var(--h, 14) 78% 55%), hsl(calc(var(--h, 14) + 45) 85% 60%)); }
.small-cover { height: 40px; }
.profile-head { display: flex; align-items: flex-end; gap: 18px; padding: 0 20px; flex-wrap: wrap; }
.profile-head > .av { border: 5px solid var(--bg); margin-top: -58px; }
.profile-id { display: grid; gap: 4px; padding-bottom: 6px; min-width: 0; }
.profile-id h1 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.bio { padding: 0 20px; margin-top: 12px; max-width: 65ch; }
.stats { display: flex; gap: 20px; padding: 10px 20px; font-variant-numeric: tabular-nums; }
.profile-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 0 20px 16px; }
.profile-body { display: grid; gap: 16px; }
.reel-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.reel-tile { aspect-ratio: 9 / 16; position: relative; border-radius: 10px; overflow: hidden; background: #000; }
.reel-tile video { width: 100%; height: 100%; object-fit: cover; }
.reel-tile span { position: absolute; left: 8px; bottom: 8px; color: #fff; display: flex; align-items: center; gap: 4px; font-weight: 700; font-size: 13px; text-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
.reel-tile span .i { width: 14px; height: 14px; }
.ep-avatar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

/* ---------- Owner ---------- */
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.stat { padding: 14px 16px; display: grid; gap: 2px; }
.stat b { font-family: var(--font-display); font-size: 32px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat.warn { border-color: var(--danger); }
.stat.warn b { color: var(--danger); }
.owner-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; align-items: start; }
.owner > section.card { margin-bottom: 16px; }
.report { display: grid; gap: 8px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.report-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rep-target p { margin-top: 2px; font-size: 14px; overflow-wrap: anywhere; }
.cmd-list { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 14px; }
.panel-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.panel-row input { max-width: 260px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 680px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line); font-weight: 700; }
.table td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table td.row-end { display: table-cell; text-align: right; }
.table td.row-end .btn { margin-left: 4px; }

/* ---------- Modals ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(10, 12, 20, .55); display: grid; place-items: center; padding: 16px; z-index: 150; animation: fade .15s; }
.modal { background: var(--surface); color: var(--fg); border-radius: 18px; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 24px 60px rgba(0, 0, 0, .3); animation: pop .18s; }
.modal-sm { width: min(440px, 100%); }
.modal-cam { width: min(900px, 100%); }
.modal-post { width: min(640px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 12px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 3; }
.modal-head h2 { font-size: 18px; font-weight: 700; }
.modal-body { padding: 18px 20px 20px; display: grid; gap: 14px; }
.modal-post .modal-body { padding: 0; }
.modal-post .post { border: 0; }
.menu-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.menu-item { display: grid; justify-items: center; gap: 6px; padding: 14px 6px; border-radius: 12px; background: var(--surface-2); font-size: 13px; font-weight: 600; text-align: center; }
.menu-item .i { width: 24px; height: 24px; }
.create-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.create-opt { display: grid; justify-items: start; gap: 2px; padding: 16px; border-radius: 14px; background: var(--surface-2); text-align: left; transition: background .15s; }
.create-opt .i { width: 26px; height: 26px; color: var(--accent); margin-bottom: 8px; }
.create-opt span { font-size: 13px; color: var(--muted); }
.create-opt:hover { background: var(--accent-soft); }
.share-link { display: flex; gap: 8px; align-items: center; }
.share-list { display: grid; gap: 8px; max-height: 340px; overflow: auto; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 36px; height: 36px; border-radius: 10px; border: 3px solid transparent; }
.swatch.round { border-radius: 50%; }
.swatch.on { border-color: var(--fg); }
.story-preview { border-radius: 14px; overflow: hidden; aspect-ratio: 9 / 16; max-height: 50vh; margin: 0 auto; background: #000; display: grid; place-items: center; }
.story-preview img, .story-preview video { width: 100%; height: 100%; object-fit: cover; }
.story-preview.text { padding: 24px; color: #fff; text-align: center; font-family: var(--font-display); font-size: 24px; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.rec-preview { width: 100%; border-radius: 12px; background: #000; max-height: 60vh; }
.confirm-text { line-height: 1.55; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 8px; z-index: 400; width: min(480px, calc(100% - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; background: var(--fg); color: var(--bg); font-size: 14px; font-weight: 500; box-shadow: 0 12px 30px rgba(0, 0, 0, .25); animation: rise .2s; transition: opacity .3s, transform .3s; }
.toast.error { background: var(--danger); color: #fff; }
.toast span { flex: 1; }
.toast-btn { font-weight: 700; text-decoration: underline; }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---------- Camera ---------- */
.cam { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; }
.cam-stage { position: relative; background: #000; border-radius: 14px; overflow: hidden; aspect-ratio: 4 / 3; }
.cam-canvas { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-status { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: #fff; background: #000; }
.cam-status.err, .studio-status.err { color: #FFB4B4; }
.cam-rec { position: absolute; top: 12px; left: 12px; display: flex; gap: 6px; align-items: center; background: var(--live); color: #fff; padding: 4px 10px; border-radius: 999px; font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.cam-rec .i { width: 14px; height: 14px; }
.cam-review { position: absolute; inset: 0; background: #000; }
.cam-review img, .cam-review video { width: 100%; height: 100%; object-fit: contain; }
.cam-controls { display: grid; gap: 14px; align-content: start; min-width: 0; }
.cam-section { display: grid; gap: 8px; min-width: 0; }
.cam-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.cam .chip-row { flex-wrap: wrap; }
.cam-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Calls ---------- */
.overlay-full { position: fixed; inset: 0; z-index: 200; }
.call { background: radial-gradient(circle at 50% 35%, #2A2F45, #0B0D14 70%); color: #fff; display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto;
  padding-top: env(safe-area-inset-top, 0px); }
.call-top { display: flex; justify-content: center; gap: 8px; padding: 16px; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; background: rgba(255, 255, 255, .12); font-size: 13px; font-weight: 600; }
.pill .i { width: 16px; height: 16px; }
.pill.subtle { background: transparent; color: rgba(255, 255, 255, .55); }
.call-stage { position: relative; display: grid; place-items: center; min-height: 0; }
.call-remote { display: grid; justify-items: center; gap: 10px; text-align: center; }
.call-remote h2 { font-size: 28px; }
.call-ring { border-radius: 50%; padding: 6px; animation: ring 1.6s infinite; }
.call.connected .call-ring { animation: none; }
.call-status { color: rgba(255, 255, 255, .7); font-variant-numeric: tabular-nums; }
.call-screen { position: absolute; inset: 16px; width: calc(100% - 32px); height: calc(100% - 32px); object-fit: contain; background: #000; border-radius: 16px; }
.call-local { position: absolute; right: max(16px, env(safe-area-inset-right, 0px)); bottom: 120px; width: min(260px, 38vw); aspect-ratio: 4 / 3; border-radius: 14px; overflow: hidden; background: #222;
  box-shadow: 0 0 0 calc(var(--lvl, 0) * 4px) #34D399, 0 10px 30px rgba(0, 0, 0, .5); transition: box-shadow .08s; }
.call-local canvas { width: 100%; height: 100%; object-fit: cover; display: block; }
.call-local-off { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; color: rgba(255, 255, 255, .7); }
.call-fx { display: grid; gap: 8px; padding: 0 16px 8px; justify-items: center; }
.call-fx .chip-row { max-width: 100%; }
.call-fx .chip { background: rgba(255, 255, 255, .12); color: #fff; }
.call-fx .chip.on { background: #fff; color: #111; }
.call-bar { display: flex; justify-content: center; gap: 14px; padding: 16px 16px calc(24px + env(safe-area-inset-bottom, 0px)); }
.call-btn { width: 56px; height: 56px; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; display: grid; place-items: center; transition: background .15s; }
.call-btn:hover { background: rgba(255, 255, 255, .24); }
.call-btn .i { width: 24px; height: 24px; }
.call-btn.off { background: #fff; color: #111; }
.call-btn.on { background: #F2542D; }
.call-btn.end { background: #E5254B; }
.call-btn.end .i { transform: rotate(135deg); }
.rec-pill { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); top: calc(16px + env(safe-area-inset-top, 0px)); z-index: 250; display: flex; align-items: center; gap: 10px;
  padding: 6px 6px 6px 14px; border-radius: 999px; background: var(--fg); color: var(--bg); box-shadow: 0 10px 30px rgba(0, 0, 0, .3); font-weight: 700; font-variant-numeric: tabular-nums; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--live); animation: blink 1s infinite; }

/* ---------- Story viewer ---------- */
.story-view { background: rgba(5, 6, 10, .95); display: grid; place-items: center; padding: 16px; }
.story-frame { position: relative; height: min(92vh, 860px); aspect-ratio: 9 / 16; max-width: 100%; border-radius: 16px; overflow: hidden; background: #000; color: #fff; }
.story-bars { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; gap: 4px; z-index: 3; }
.story-bars i { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .35); overflow: hidden; }
.story-bars b { display: block; height: 100%; background: #fff; }
.story-head { position: absolute; top: 20px; left: 12px; right: 6px; display: flex; align-items: center; gap: 8px; z-index: 3; font-size: 14px; text-shadow: 0 1px 3px rgba(0, 0, 0, .5); }
.story-head > span:not(.av) { opacity: .8; }
.story-content { position: absolute; inset: 0; display: grid; place-items: center; }
.story-content img, .story-content video { width: 100%; height: 100%; object-fit: cover; }
.story-text { position: absolute; inset: 0; display: grid; place-items: center; padding: 32px; text-align: center; font-family: var(--font-display); font-size: 30px; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.story-cap { position: absolute; left: 16px; right: 16px; bottom: 90px; text-align: center; font-weight: 700; font-size: 18px; background: rgba(0, 0, 0, .45); padding: 8px 12px; border-radius: 10px; width: fit-content; margin: 0 auto; }
.story-nav { position: absolute; top: 70px; bottom: 80px; width: 35%; z-index: 2; }
.story-nav.prev { left: 0; }
.story-nav.next { right: 0; }
.story-reply { position: absolute; left: 12px; right: 12px; bottom: 14px; display: flex; gap: 8px; z-index: 3; }
.story-reply input { background: rgba(0, 0, 0, .35) !important; border: 1px solid rgba(255, 255, 255, .5) !important; color: #fff; border-radius: 999px !important; }
.story-reply input::placeholder { color: rgba(255, 255, 255, .75); }
.story-foot { position: absolute; left: 12px; right: 12px; bottom: 14px; display: flex; justify-content: space-between; align-items: center; z-index: 3; font-size: 14px; }
.story-foot span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Reels ---------- */
.view-reels { padding-block: 0; }
.reels-page { max-width: 600px; margin: 0 auto; display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100vh; height: 100dvh; }
.reels-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; gap: 12px; }
.reels-head h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.reels { overflow-y: auto; scroll-snap-type: y mandatory; scrollbar-width: none; min-height: 0; }
.reels::-webkit-scrollbar { display: none; }
.reel { height: 100%; scroll-snap-align: start; scroll-snap-stop: always; display: flex; gap: 12px; align-items: center; justify-content: center; padding-bottom: 16px; position: relative; }
.reel-frame { position: relative; height: 100%; aspect-ratio: 9 / 16; max-width: calc(100% - 72px); border-radius: 16px; overflow: hidden; background: #000; }
.reel-video { width: 100%; height: 100%; object-fit: cover; }
.reel-tap { position: absolute; inset: 0; }
.reel-paused { position: absolute; inset: 0; margin: auto; width: 72px; height: 72px; border-radius: 50%; background: rgba(0, 0, 0, .45); color: #fff; display: grid; place-items: center; pointer-events: none; }
.reel-paused .i { width: 30px; height: 30px; }
.reel-info { position: absolute; left: 0; right: 0; bottom: 0; padding: 56px 16px 16px; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, .72)); display: grid; gap: 6px; pointer-events: none; }
.reel-info a, .reel-info button { pointer-events: auto; }
.reel-info a { color: #fff; }
.reel-info p { font-size: 14px; }
.reel-who { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.reel-who > a { display: flex; align-items: center; gap: 8px; }
.reel-info .btn.ghost { color: #fff; border-color: rgba(255, 255, 255, .6); }
.reel-music { display: flex; align-items: center; gap: 6px; font-size: 13px; opacity: .9; }
.reel-music .i { width: 14px; height: 14px; }
.reel-rail { display: flex; flex-direction: column; gap: 8px; align-self: flex-end; padding-bottom: 6px; }
.rail-btn { display: grid; justify-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); width: 58px; font-variant-numeric: tabular-nums; }
.rail-btn .i { width: 42px; height: 42px; padding: 10px; border-radius: 50%; background: var(--surface-2); color: var(--fg); transition: transform .1s; }
.rail-btn:hover .i { transform: scale(1.06); }
.rail-btn.on.like .i { background: var(--like); color: #fff; }
.rail-btn.on.dislike .i { background: var(--dislike); color: #fff; }
.rail-btn.on.save .i { background: var(--save); color: #fff; }
.rail-btn.owner .i { background: var(--accent-soft); color: var(--accent); }

/* ---------- Messages ---------- */
.view-messages, .view-servers { padding: 0; }
.dm { display: grid; grid-template-columns: 340px minmax(0, 1fr); height: 100vh; height: 100dvh; }
.dm-list { border-right: 1px solid var(--line); display: grid; grid-template-rows: auto minmax(0, 1fr); min-height: 0; background: var(--surface); }
.dm-list-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 12px 10px 18px; }
.dm-list-head h1 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.dm-items { overflow-y: auto; padding: 4px 8px 12px; }
.dm-item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; }
.dm-item:hover { background: var(--surface-2); }
.dm-item.active { background: var(--accent-soft); }
.dm-item-text { flex: 1; min-width: 0; display: grid; }
.dm-item-text .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-item.unread .dm-item-text .small { color: var(--fg); font-weight: 600; }
.dm-item.unread::after { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); flex: none; }
.dm-thread { display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; min-height: 0; min-width: 0; }
.dm-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.dm-who { min-width: 0; }
.back-btn { display: none !important; }
.dm-msgs { overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.bubble-row { display: flex; align-items: flex-end; gap: 8px; max-width: min(75%, 560px); }
.bubble-row.mine { align-self: flex-end; flex-direction: row-reverse; }
.bubble { background: var(--surface-2); padding: 8px 12px; border-radius: 18px 18px 18px 6px; display: grid; gap: 2px; overflow-wrap: anywhere; min-width: 0; }
.bubble-row.mine .bubble { background: var(--accent); color: #fff; border-radius: 18px 18px 6px 18px; }
.bubble-row.mine .bubble a { color: #fff; text-decoration: underline; }
.bubble time { font-size: 11px; opacity: .65; justify-self: end; font-variant-numeric: tabular-nums; }
.bubble img, .bubble video { border-radius: 12px; max-height: 280px; }
.day-sep { align-self: center; font-size: 12px; color: var(--muted); margin: 10px 0 4px; font-weight: 600; }
.sys-msg { align-self: center; font-size: 13px; color: var(--muted); background: var(--surface-2); padding: 6px 12px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; max-width: 90%; text-align: center; margin: 4px 0; }
.sys-msg .i { width: 15px; height: 15px; }
.typing { padding: 0 16px 6px; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 3px; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: bounce 1s infinite; }
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; margin-right: 6px; }
.dm-form { display: flex; gap: 8px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface); }
.dm-form input { border-radius: 999px !important; }
.dm-form .btn { width: 42px; height: 42px; padding: 0; flex: none; }

/* ---------- Servers ---------- */
.srv { display: grid; grid-template-columns: 72px 240px minmax(0, 1fr) 230px; height: 100vh; height: 100dvh; }
.srv-rail { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px 0; background: var(--surface-2); overflow-y: auto; scrollbar-width: none; }
.srv-icon { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: hsl(var(--h, 220) 62% 50%); color: #fff; font-weight: 800; font-family: var(--font-display); transition: border-radius .2s; flex: none; font-size: 16px; }
.srv-icon:hover, .srv-icon.active { border-radius: 16px; }
.srv-icon.active { box-shadow: 0 0 0 3px var(--surface-2), 0 0 0 5px var(--accent); }
.srv-icon.add { background: var(--surface); color: var(--ok); }
.srv-icon.sm { width: 38px; height: 38px; font-size: 13px; }
.srv-side { background: var(--surface); border-right: 1px solid var(--line); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-height: 0; }
.srv-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 8px 12px 16px; border-bottom: 1px solid var(--line); font-family: var(--font-display); font-size: 16px; }
.srv-head b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srv-channels { overflow-y: auto; padding: 4px 8px 12px; }
.ch-group { display: flex; align-items: center; justify-content: space-between; padding: 14px 8px 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.ch { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px; color: var(--muted); font-weight: 500; width: 100%; text-align: left; }
.ch:hover { background: var(--surface-2); color: var(--fg); }
.ch.active { background: var(--surface-2); color: var(--fg); font-weight: 700; }
.ch .i { width: 18px; height: 18px; }
.ch:disabled { opacity: .55; cursor: default; }
.voice-users { padding-left: 30px; display: grid; gap: 4px; margin: 2px 0 6px; }
.voice-user { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.voice-user .i { width: 14px; height: 14px; color: var(--danger); }
.voice-user.me { color: var(--fg); }
.voice-user.me .av { box-shadow: 0 0 0 calc(var(--lvl, 0) * 5px) var(--ok); transition: box-shadow .08s; }
.voice-panel { display: flex; align-items: center; gap: 4px; padding: 10px 8px 10px 12px; border-top: 1px solid var(--line); background: var(--surface-2); }
.voice-panel > div { flex: 1; min-width: 0; }
.voice-panel .ok { color: var(--ok); display: flex; align-items: center; gap: 6px; font-size: 13px; }
.voice-panel .ok .i { width: 15px; height: 15px; }
.voice-panel .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.voice-panel .icon-btn.danger .i { transform: rotate(135deg); }
.srv-chat { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-height: 0; min-width: 0; }
.srv-chat-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--surface); min-width: 0; }
.srv-chat-head > .i { color: var(--muted); }
.srv-sub { margin-left: auto; white-space: nowrap; }
.srv-ch-select { display: none !important; width: auto !important; padding: 6px 10px !important; }
.srv-msgs { overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 2px; }
.smsg { display: flex; gap: 12px; padding: 6px 8px; border-radius: 8px; margin-top: 8px; }
.smsg:hover { background: var(--surface-2); }
.smsg.cont { margin-top: 0; padding-left: 62px; }
.smsg-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.smsg-text { overflow-wrap: anywhere; }
.join-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--accent-soft); flex-wrap: wrap; }
.srv-members { background: var(--surface); border-left: 1px solid var(--line); overflow-y: auto; padding: 4px 8px 12px; }
.mem { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; font-size: 14px; font-weight: 500; }
.mem:hover { background: var(--surface-2); }
.mem.off { opacity: .55; }
.mem .i { width: 14px; height: 14px; color: #E0A10E; }

/* ---------- Live ---------- */
.live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.live-card { overflow: hidden; display: grid; transition: transform .15s; }
.live-card:hover { transform: translateY(-2px); }
.live-thumb { position: relative; aspect-ratio: 16 / 9; background: #000; }
.live-thumb video { width: 100%; height: 100%; object-fit: cover; }
.live-you { display: grid; place-items: center; height: 100%; }
.live-badge { position: absolute; top: 10px; left: 10px; background: var(--live); color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .08em; padding: 3px 8px; border-radius: 6px; z-index: 2; }
.live-viewers { position: absolute; top: 10px; left: 62px; display: inline-flex; align-items: center; gap: 4px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 6px; font-variant-numeric: tabular-nums; z-index: 2; }
.live-viewers .i { width: 14px; height: 14px; }
.live-meta { display: flex; gap: 10px; padding: 12px; align-items: center; }
.live-watch { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; max-width: 1320px; margin: 0 auto; align-items: start; }
.live-player { position: relative; background: #000; border-radius: 14px; overflow: hidden; aspect-ratio: 16 / 9; }
.live-player video, .live-player canvas { width: 100%; height: 100%; object-fit: contain; display: block; }
.studio-status { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; text-align: center; padding: 24px; background: #000; }
.live-info { display: flex; align-items: center; gap: 12px; padding: 14px 0; flex-wrap: wrap; }
.live-title { flex: 1; min-width: 200px; display: grid; gap: 2px; }
.live-title h1 { font-size: 20px; }
.studio-fx { display: grid; gap: 8px; padding-top: 12px; }
.live-chat { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: min(80vh, 720px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.live-chat-head { padding: 14px 16px; font-weight: 700; border-bottom: 1px solid var(--line); }
.live-msgs { overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; overflow-wrap: anywhere; }
.lmsg b { color: hsl(var(--h, 220) 70% var(--name-l)); margin-right: 4px; }

/* ---------- Arcade ---------- */
.game-hero p { max-width: 70ch; margin-bottom: 8px; }
.k-pad { color: #0A9EBB; font-weight: 700; }
.k-orb { color: #D63A82; font-weight: 700; }
.level-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.level-tile { overflow: hidden; display: grid; }
.level-tile canvas { width: 100%; aspect-ratio: 4 / 1; display: block; }
.level-tile-body { padding: 12px 14px 14px; display: grid; gap: 6px; }
.level-tile-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.diff { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; padding: 2px 8px; border-radius: 6px; }
.d-easy { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.d-normal { background: color-mix(in srgb, var(--like) 16%, transparent); color: var(--like); }
.d-hard { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.best { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin-top: 4px; }
.best i { display: block; height: 100%; background: linear-gradient(90deg, #FFB020, #F2542D); }
.game-page { display: grid; gap: 10px; }
.sprint-host { width: 100%; }
.sprint { position: relative; border-radius: 16px; overflow: hidden; background: #000; user-select: none; -webkit-user-select: none; }
.sprint-canvas { width: 100%; aspect-ratio: 2 / 1; display: block; touch-action: none; cursor: pointer; }
.sprint-hud { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; align-items: center; gap: 8px; pointer-events: none; }
.sprint-btn { pointer-events: auto; width: 38px; height: 38px; border-radius: 10px; background: rgba(0, 0, 0, .45); color: #fff; font-size: 15px; font-weight: 700; }
.sprint-btn.off { opacity: .45; }
.sprint-progress { flex: 1; display: flex; align-items: center; gap: 10px; justify-content: center; color: #fff; font-weight: 700; font-variant-numeric: tabular-nums; text-shadow: 0 1px 3px rgba(0, 0, 0, .5); }
.sprint-bar { width: min(380px, 50%); height: 10px; border-radius: 5px; background: rgba(255, 255, 255, .2); overflow: hidden; }
.sprint-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #35E0FF, #FF5FA2); }
.sprint-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(5, 6, 12, .55); }
.sprint-card { background: #fff; color: #141826; border-radius: 16px; padding: 24px 28px; text-align: center; display: grid; gap: 8px; margin: 16px; }
.sprint-card h3 { font-size: 28px; }
.sprint-row { display: flex; gap: 8px; justify-content: center; margin-top: 8px; flex-wrap: wrap; }
.sprint-cta { height: 40px; padding: 0 18px; border-radius: 999px; background: #F2542D; color: #fff; font-weight: 700; }
.sprint-cta.ghost { background: #ECEEF5; color: #141826; }
.creator-card { padding: 14px; overflow: hidden; }
.creator { display: grid; gap: 12px; }
.creator-bar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.creator-name { max-width: 260px; font-weight: 700 !important; }
.creator-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.tool { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 10px; background: var(--surface-2); font-weight: 600; font-size: 13px; }
.tool.on { background: var(--fg); color: var(--bg); }
.tool-ico { width: 16px; height: 16px; display: inline-block; flex: none; }
.t-b { border: 2px solid #7AA8FF; background: #141A33; border-radius: 2px; }
.t-s { width: 0; height: 0; border-left: 8px solid transparent; border-right: 8px solid transparent; border-bottom: 15px solid currentColor; }
.t-p { height: 6px; background: #35E0FF; border-radius: 3px; }
.t-o { width: 12px; height: 12px; border-radius: 50%; background: #FF5FA2; box-shadow: 0 0 0 2px var(--surface-2), 0 0 0 4px #FF5FA2; margin: 2px; }
.t-x { background: linear-gradient(45deg, transparent 42%, var(--danger) 42% 58%, transparent 58%), linear-gradient(-45deg, transparent 42%, var(--danger) 42% 58%, transparent 58%); }
.creator-canvas { border-radius: 12px; cursor: crosshair; }
.creator-foot { display: flex; align-items: center; gap: 8px; }
.creator-info { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.creator-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.creator-hint { font-size: 13px; color: var(--muted); }

/* ---------- Watch ---------- */
.watch-bars { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.watch-bar { display: flex; gap: 8px; min-width: 0; }
.watch-bar .search-box { flex: 1; min-width: 0; }
.watch-bar .btn { height: 46px; }
.yt-player { aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: #000; max-width: 100%; }
.yt-player iframe { width: 100%; height: 100%; border: 0; display: block; }
.yt-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 0; }
.yt-actions b { font-size: 17px; }
.yt-empty { display: grid; place-items: center; gap: 8px; padding: 48px 16px; text-align: center; color: var(--muted); }
.yt-empty .i { width: 40px; height: 40px; color: var(--accent); }
.yt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.yt-tile { display: grid; gap: 6px; align-content: start; }
.yt-tile .yt-thumb { border-radius: 12px; overflow: hidden; }
.yt-tile b { font-size: 14px; line-height: 1.3; }

/* ---------- Animations ---------- */
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .35); } 100% { box-shadow: 0 0 0 34px rgba(255, 255, 255, 0); } }
@keyframes blink { 50% { opacity: .2; } }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1519px) {
  .home { grid-template-columns: 236px minmax(0, 540px) 264px; gap: 16px; }
}
@media (max-width: 1309px) {
  :root { --sb-w: 76px; }
  .sidebar { padding: 14px 10px; }
  .sb-label, .logo-word { display: none; }
  .sidebar .logo { justify-content: center; padding: 6px 0; }
  .nav-item { justify-content: center; padding: 11px 0; }
  .nav-item .nav-badge { position: absolute; top: 3px; right: 6px; margin: 0; min-width: 18px; height: 18px; font-size: 10px; }
  .sb-story { justify-content: center; padding: 10px 0; border-radius: 50%; width: 54px; height: 54px; justify-self: center; }
  .sb-story-plus { background: transparent; }
}
@media (max-width: 1199px) {
  .home { grid-template-columns: minmax(0, 580px) 280px; gap: 20px; }
  .rail-left { display: none; }
  .srv { grid-template-columns: 72px 230px minmax(0, 1fr); }
  .srv-members { display: none; }
}
@media (max-width: 1000px) {
  .home { grid-template-columns: minmax(0, 620px); }
  .rail-right { display: none; }
  .owner-grid { grid-template-columns: 1fr; }
  .live-watch { grid-template-columns: 1fr; }
  .live-chat { height: 420px; }
  .dm { grid-template-columns: 280px minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-brand { padding: 28px 20px; gap: 12px; }
  .auth-feats { display: none; }
  .auth-tag { font-size: 22px; }
  .auth-logo { font-size: 26px; }
  .cam { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  #app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar { display: flex; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50; align-items: center; justify-content: space-between; height: 56px;
    padding-left: max(12px, env(safe-area-inset-left, 0px)); padding-right: max(8px, env(safe-area-inset-right, 0px)); background: var(--surface); border-bottom: 1px solid var(--line); }
  body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 60; background: var(--surface); }
  .topbar .logo { padding: 0; font-size: 20px; }
  .topbar .logo-mark { width: 30px; height: 30px; font-size: 17px; }
  .topbar-actions { display: flex; gap: 2px; }
  .topbar .nav-badge { position: absolute; top: 2px; right: 0; margin: 0; min-width: 18px; height: 18px; font-size: 10px; }
  .bottombar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; justify-content: space-around; align-items: center;
    height: calc(64px + env(safe-area-inset-bottom, 0px)); padding: 0 max(8px, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(8px, env(safe-area-inset-left, 0px));
    background: var(--surface); border-top: 1px solid var(--line); }
  .bb-item { display: grid; place-items: center; width: 52px; height: 48px; border-radius: 12px; color: var(--muted); position: relative; }
  .bb-item.active { color: var(--accent); }
  .bb-item .i { width: 25px; height: 25px; }
  .bb-item .nav-badge { position: absolute; top: 4px; right: 4px; margin: 0; min-width: 18px; height: 18px; font-size: 10px; }
  .bb-story { width: 54px; height: 40px; border-radius: 14px; background: linear-gradient(135deg, #FFB020, #F2542D); color: #fff; display: grid; place-items: center; box-shadow: 0 4px 14px rgba(242, 84, 45, .35); }
  .bb-story .i { stroke-width: 2.8; }
  .view { padding-top: 16px; padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
  .view-reels, .view-messages, .view-servers { padding-top: 0; padding-bottom: 0; }
  #toasts { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
  .page-title { font-size: 24px; }
  .post { padding: 14px; }
  .post-media { margin-inline: -14px; }
  .act { padding: 0 8px; }
  .act em { display: none; }
  .yt-card { grid-template-columns: 1fr; }
  .yt-meta { padding: 0 12px 12px; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-head { padding: 0 8px; }
  .profile-head > .av { width: 96px; height: 96px; font-size: 32px; }
  .bio, .stats, .profile-actions { padding-left: 8px; padding-right: 8px; }
  .cover { height: 130px; }
  .watch-bars { grid-template-columns: 1fr; }
  .modal-back { align-items: end; padding: 0; }
  .modal { border-radius: 18px 18px 0 0; max-height: 92vh; width: 100% !important; }
  .modal-body { padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
  .create-grid, .menu-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .reels-page { height: calc(100dvh - 56px - 64px - env(safe-area-inset-bottom, 0px) - env(safe-area-inset-top, 0px)); max-width: none; margin-inline: calc(-1 * max(16px, env(safe-area-inset-left, 0px))); }
  .reels-head { padding: 10px 16px; }
  .reels-head h1 { font-size: 22px; }
  .reel { padding-bottom: 0; }
  .reel-frame { max-width: 100%; width: 100%; aspect-ratio: auto; border-radius: 0; }
  .reel-info { padding-right: 76px; }
  .reel-rail { position: absolute; right: 8px; bottom: 16px; gap: 4px; }
  .rail-btn { color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .7); width: 54px; }
  .rail-btn .i { background: rgba(0, 0, 0, .35); color: #fff; width: 40px; height: 40px; }

  .dm { grid-template-columns: minmax(0, 1fr); height: calc(100dvh - 56px - 64px - env(safe-area-inset-bottom, 0px) - env(safe-area-inset-top, 0px)); margin-inline: calc(-1 * max(16px, env(safe-area-inset-left, 0px))); }
  .dm .dm-thread { display: none; }
  .dm.has-thread .dm-list { display: none; }
  .dm.has-thread .dm-thread { display: grid; }
  .back-btn { display: inline-grid !important; }
  .bubble-row { max-width: 85%; }

  .srv { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); height: calc(100dvh - 56px - 64px - env(safe-area-inset-bottom, 0px) - env(safe-area-inset-top, 0px)); margin-inline: calc(-1 * max(16px, env(safe-area-inset-left, 0px))); }
  .srv-rail { flex-direction: row; padding: 8px 12px; overflow-x: auto; }
  .srv-icon { width: 42px; height: 42px; font-size: 14px; }
  .srv-side { display: none; }
  .srv-ch-select { display: block !important; }
  .srv-chat-head > b, .srv-chat-head > .i, .srv-sub { display: none; }
}
@media (max-height: 760px) and (min-width: 761px) {
  .nav-item { padding-top: 7px; padding-bottom: 7px; }
  .sb-foot .nav-item { padding-top: 6px; padding-bottom: 6px; }
  .sidebar { gap: 6px; padding-block: 10px; }
}
