/* ============================================================
   StreamHub — design system
   Dark-first, red accent, YouTube-style layout with original UI.
   ============================================================ */

:root {
  --bg: #0b0d11;
  --bg-soft: #101319;
  --surface: #161a21;
  --surface-2: #1d222b;
  --line: #262c37;
  --line-soft: #1b2027;
  --ink: #eef1f6;
  --ink-2: #c3cad6;
  --muted: #8b95a5;
  --brand: #ff2d55;
  --brand-2: #ff6b3d;
  --brand-soft: rgba(255, 45, 85, 0.12);
  --ok: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --r-s: 8px;
  --r-m: 12px;
  --r-l: 16px;
  --r-xl: 22px;
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.75);
  --rail: 232px;
  --rail-collapsed: 76px;
  --topbar: 60px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

html[data-theme="light"] {
  --bg: #ffffff;
  --bg-soft: #f7f8fa;
  --surface: #f3f5f8;
  --surface-2: #ffffff;
  --line: #e2e6ec;
  --line-soft: #eef1f5;
  --ink: #0d1117;
  --ink-2: #333c48;
  --muted: #66707e;
  --brand: #e6213c;
  --brand-soft: rgba(230, 33, 60, 0.09);
  --shadow: 0 18px 40px -24px rgba(16, 24, 40, 0.28);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { color-scheme: dark; }
html[data-theme="light"] { color-scheme: light; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-y: scroll;
}
a { color: inherit; text-decoration: none; cursor: pointer; }
button { font-family: inherit; font-size: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; color: var(--ink); }
img { display: block; max-width: 100%; }
h1, h2, h3, h4, p { margin: 0; }
::selection { background: var(--brand); color: #fff; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; border: 2px solid var(--bg); }
*::-webkit-scrollbar-thumb:hover { background: var(--muted); }
*::-webkit-scrollbar-track { background: transparent; }

.ico { width: 20px; height: 20px; flex: none; }
.ico-xs { width: 14px; height: 14px; }
.ico-sm { width: 16px; height: 16px; }
.ico-lg { width: 26px; height: 26px; }
.ico-v { width: 13px; height: 13px; color: var(--muted); vertical-align: -1px; }

/* ---------- shell ---------- */
.app { min-height: 100vh; }

.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--topbar); z-index: 60;
  display: flex; align-items: center; gap: 8px; padding: 0 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line-soft);
}
.icon-btn {
  width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 50%;
  color: var(--ink); transition: background .15s;
}
.icon-btn:hover { background: var(--surface); }
.brand { display: flex; align-items: center; gap: 9px; padding: 4px 6px; border-radius: 10px; }
.brand:hover { background: var(--surface); }
.brand-mark {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--brand), var(--brand-2)); color: #fff;
  box-shadow: 0 6px 16px -6px var(--brand);
}
.brand-mark svg { width: 15px; height: 15px; fill: currentColor; }
.brand-name { font-size: 17px; font-weight: 800; letter-spacing: -0.03em; }
.brand-name span { color: var(--brand); }

.searchbar { display: flex; align-items: center; gap: 8px; flex: 1; max-width: 640px; margin: 0 auto; }
.search-field {
  display: flex; align-items: center; gap: 9px; width: 100%;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 99px; padding: 0 6px 0 14px; height: 40px;
  transition: border-color .15s, box-shadow .15s;
}
.search-field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.search-field input { flex: 1; border: 0; outline: 0; background: none; font-size: 14px; }
.search-field input::placeholder { color: var(--muted); }
.search-go { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.search-go:hover { background: var(--surface-2); color: var(--ink); }
.topbar-right { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.btn-create {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px;
  border-radius: 99px; background: var(--surface); font-weight: 600; font-size: 13px;
  border: 1px solid var(--line);
}
.btn-create:hover { background: var(--surface-2); }

/* avatar menu */
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center;
  font-weight: 700; font-size: 13px; color: #fff; flex: none;
  background: linear-gradient(140deg, var(--c, var(--brand)), color-mix(in srgb, var(--c, var(--brand)) 55%, #000));
}
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }
.avatar.lg { width: 74px; height: 74px; font-size: 26px; }
.avatar.xl { width: 106px; height: 106px; font-size: 36px; }
.avatar-btn { border-radius: 50%; padding: 2px; }
.avatar-btn:hover { outline: 2px solid var(--line); }
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 10px); min-width: 240px; z-index: 90;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-l);
  box-shadow: var(--shadow); padding: 6px; display: none;
}
.menu.open { display: block; animation: pop .14s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.menu-head { padding: 12px 12px 14px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-head strong { display: block; font-size: 14px; }
.menu-head span { font-size: 12px; color: var(--muted); }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 12px; border-radius: 10px; font-size: 13.5px; color: var(--ink-2);
}
.menu-item:hover { background: var(--surface); color: var(--ink); }
.menu-item.accent { color: var(--brand); }
.menu-sep { height: 1px; background: var(--line); margin: 6px 8px; }

/* ---------- layout ---------- */
.shell { display: flex; padding-top: var(--topbar); }
.rail {
  position: fixed; top: var(--topbar); bottom: 0; left: 0; width: var(--rail); z-index: 50;
  overflow-y: auto; padding: 10px 10px 20px; background: var(--bg);
  border-right: 1px solid var(--line-soft);
  transition: width .18s ease;
}
.rail-mini .rail { width: var(--rail-collapsed); }
.rail-mini .rail-label, .rail-mini .rail-section-title, .rail-mini .rail-foot { display: none; }
.rail-mini .rail-link { justify-content: center; padding: 10px 0; }
.rail-mini .rail-link .rail-count { display: none; }
.rail-mini .main { margin-left: var(--rail-collapsed); }
.main { margin-left: var(--rail); min-height: calc(100vh - var(--topbar)); transition: margin-left .18s ease; }
.wrap { max-width: 1720px; margin: 0 auto; padding: 18px 22px 90px; }
.rail-link {
  display: flex; align-items: center; gap: 14px; padding: 9px 12px; border-radius: 10px;
  font-size: 13.5px; color: var(--ink-2); font-weight: 500;
}
.rail-link:hover { background: var(--surface); color: var(--ink); }
.rail-link.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.rail-link.on .ico { color: var(--brand); }
.rail-count { margin-left: auto; font-size: 11px; color: var(--muted); background: var(--surface); padding: 1px 7px; border-radius: 99px; }
.rail-section-title { font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); padding: 16px 12px 8px; font-weight: 700; }
.rail-sep { height: 1px; background: var(--line-soft); margin: 10px 8px; }
.rail-foot { padding: 14px 12px; font-size: 11px; line-height: 1.7; color: var(--muted); }
.rail-foot b { color: var(--ink-2); display: block; margin-bottom: 2px; }

/* mobile bottom nav */
.bottom-nav { display: none; }
@media (max-width: 1100px) {
  .rail { width: var(--rail-collapsed); }
  .rail-label, .rail-section-title, .rail-foot { display: none; }
  .rail-link { justify-content: center; padding: 10px 0; }
  .rail-count { display: none; }
  .main { margin-left: var(--rail-collapsed); }
  .rail-mini .main { margin-left: 0; }
  .rail-mini .rail { width: 0; overflow: hidden; }
}
@media (max-width: 720px) {
  .rail { display: none; }
  .main { margin-left: 0; }
  .wrap { padding: 12px 12px 96px; }
  .topbar-right .btn-create span, .brand-name { display: none; }
  .searchbar { max-width: none; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
    background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(14px);
    border-top: 1px solid var(--line); padding: 6px 0 max(6px, env(safe-area-inset-bottom));
  }
  .bottom-nav a, .bottom-nav button {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    font-size: 10px; color: var(--muted); padding: 3px 0;
  }
  .bottom-nav .on { color: var(--brand); }
}

/* ---------- chips ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 18px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 7px 15px; border-radius: 99px; background: var(--surface);
  font-size: 13px; font-weight: 500; color: var(--ink-2); border: 1px solid transparent;
  white-space: nowrap; transition: .15s;
}
.chip:hover { background: var(--surface-2); color: var(--ink); }
.chip-on { background: var(--ink); color: var(--bg); font-weight: 700; }
.chip-on:hover { background: var(--ink); color: var(--bg); }

/* ---------- section ---------- */
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; margin: 26px 0 12px; }
.sec-head h2 { font-size: 18px; font-weight: 750; letter-spacing: -0.02em; display: flex; align-items: center; gap: 8px; }
.sec-head h2 .ico { color: var(--brand); }
.sec-link { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 2px; font-weight: 600; }
.sec-link:hover { color: var(--brand); }

/* ---------- cards ---------- */
.grid { display: grid; gap: 26px 18px; grid-template-columns: repeat(auto-fill, minmax(262px, 1fr)); }
@media (max-width: 1350px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1000px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .grid { grid-template-columns: 1fr; } }

.card { cursor: pointer; }
.card .thumb { transition: transform .18s ease; }
.card:hover .thumb { transform: translateY(-2px); }
.card-body { display: flex; gap: 11px; margin-top: 10px; }
.card-title { font-size: 14.5px; font-weight: 650; line-height: 1.35; letter-spacing: -0.01em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-sub { font-size: 12.5px; color: var(--muted); margin-top: 5px; display: flex; align-items: center; gap: 4px; }
.card-sub:hover { color: var(--ink-2); }
.card-sub2 { font-size: 12.5px; color: var(--muted); }
.card-meta { min-width: 0; flex: 1; }

.thumb {
  position: relative; aspect-ratio: 16/9; border-radius: var(--r-m); overflow: hidden;
  background:
    radial-gradient(120% 90% at 15% 0%, hsl(var(--h) 60% 42% / .55), transparent 60%),
    linear-gradient(145deg, hsl(var(--h) 45% 22%), hsl(calc(var(--h) + 45) 50% 10%));
  isolation: isolate;
}
.thumb-grain {
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.14) 1px, transparent 1px);
  background-size: 14px 14px; opacity: .35; mix-blend-mode: overlay;
}
.thumb-play {
  position: absolute; inset: 0; display: grid; place-items: center; color: #fff;
  opacity: .5; transition: opacity .18s, transform .18s; transform: scale(.9);
  filter: drop-shadow(0 4px 14px rgba(0,0,0,.5));
}
.card:hover .thumb-play { opacity: 1; transform: scale(1); }
.card:hover .thumb-play { opacity: .95; transform: scale(1); }
.thumb-dur {
  position: absolute; right: 7px; bottom: 7px; background: rgba(0,0,0,.82); color: #fff;
  font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 6px; letter-spacing: .02em;
}
.badge-short {
  position: absolute; left: 7px; top: 7px; background: var(--brand); color: #fff;
  font-size: 9.5px; font-weight: 800; letter-spacing: .08em; padding: 3px 6px; border-radius: 5px;
}
.thumb-row { width: 168px; flex: none; }
@media (max-width: 640px) { .thumb-row { width: 140px; } }

.row-card { display: flex; gap: 11px; cursor: pointer; padding: 6px; border-radius: var(--r-m); }
.row-card:hover { background: var(--surface); }
.row-meta { min-width: 0; }
.row-meta h4 { font-size: 13.5px; font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row-meta p { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; align-items: center; gap: 4px; }

/* shorts shelf */
.shorts-shelf { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.shorts-shelf::-webkit-scrollbar { display: none; }
.short-card { flex: none; width: 176px; min-width: 176px; cursor: pointer; }
.short-fill {
  position: relative; aspect-ratio: 9/16; border-radius: var(--r-l); overflow: hidden;
  background:
    radial-gradient(110% 70% at 50% 105%, hsl(var(--h) 70% 45% / .75), transparent 60%),
    linear-gradient(165deg, hsl(var(--h) 50% 26%), hsl(calc(var(--h) + 40) 55% 9%));
  padding: 12px; display: flex; flex-direction: column; justify-content: space-between;
  transition: transform .18s;
}
.short-card:hover .short-fill { transform: translateY(-3px); }
.short-tag { font-size: 9.5px; font-weight: 800; letter-spacing: .1em; color: #fff;
  background: rgba(255,255,255,.16); backdrop-filter: blur(4px); padding: 3px 8px; border-radius: 99px; align-self: flex-start; }
.short-info p { color: #fff; font-size: 12.5px; font-weight: 650; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.short-info span { color: rgba(255,255,255,.72); font-size: 11px; }

/* ---------- watch ---------- */
.watch { display: grid; grid-template-columns: minmax(0, 1fr) 384px; gap: 26px; }
@media (max-width: 1240px) { .watch { grid-template-columns: 1fr; } }

.player {
  position: relative; aspect-ratio: 16/9; border-radius: var(--r-l); overflow: hidden;
  background: #000; box-shadow: var(--shadow);
}
.player-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(80% 70% at 50% 40%, hsl(var(--h) 55% 26%), hsl(calc(var(--h) + 30) 50% 7%) 70%),
    #05070a;
}
.player-bg::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(rgba(255,255,255,.05) 1px, transparent 1px); background-size: 16px 16px;
}
.player-center { position: absolute; inset: 0; display: grid; place-items: center; }
.play-btn {
  width: 78px; height: 78px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255,255,255,.13); backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,.22);
  color: #fff; transition: .18s;
}
.play-btn:hover { background: var(--brand); border-color: var(--brand); transform: scale(1.05); }
.play-btn svg { width: 30px; height: 30px; fill: currentColor; margin-left: 4px; }
.player-top { position: absolute; inset: 0 0 auto 0; display: flex; align-items: center; gap: 10px; padding: 14px; }
.player-top .tagline { font-size: 11.5px; color: rgba(255,255,255,.72); background: rgba(0,0,0,.4);
  backdrop-filter: blur(6px); padding: 4px 10px; border-radius: 99px; }
.player-badge { margin-left: auto; display: flex; gap: 6px; }
.player-badge span { font-size: 10.5px; font-weight: 700; color: #fff; background: rgba(0,0,0,.45);
  backdrop-filter: blur(6px); padding: 4px 8px; border-radius: 6px; }
.player-controls {
  position: absolute; inset: auto 0 0 0; padding: 42px 14px 10px;
  background: linear-gradient(to top, rgba(0,0,0,.86), transparent);
}
.timeline { height: 4px; border-radius: 99px; background: rgba(255,255,255,.26); position: relative; cursor: pointer; }
.timeline:hover { height: 6px; }
.timeline-fill { position: absolute; inset: 0 auto 0 0; width: 32%; border-radius: 99px; background: var(--brand); }
.timeline-fill::after { content: ''; position: absolute; right: -5px; top: 50%; transform: translateY(-50%);
  width: 11px; height: 11px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px rgba(0,0,0,.4); }
.timeline-cue { position: absolute; top: -3px; bottom: -3px; width: 3px; background: rgba(255,255,255,.8); border-radius: 2px; }
.ctrl-row { display: flex; align-items: center; gap: 12px; margin-top: 9px; color: #fff; }
.ctrl-row .time { font-size: 11.5px; color: rgba(255,255,255,.85); font-variant-numeric: tabular-nums; }
.ctrl-row .ico-btn { color: #fff; opacity: .92; width: 32px; height: 32px; }
.ctrl-row .ico-btn:hover { opacity: 1; background: rgba(255,255,255,.14); }
.ctrl-spacer { flex: 1; }

.player-bar {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px; margin-top: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m);
  flex-wrap: wrap;
}
.servers-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 11px;
  border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2);
  font-size: 12.5px; font-weight: 650; position: relative;
}
.servers-btn:hover { border-color: var(--brand); color: var(--brand); }
.servers-btn .cnt { font-size: 10.5px; background: var(--brand-soft); color: var(--brand); padding: 2px 6px; border-radius: 99px; font-weight: 800; }
.servers-btn .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(34,197,94,.18); }
.server-panel {
  position: absolute; bottom: calc(100% + 10px); left: 0; width: 340px; z-index: 70;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-l);
  box-shadow: var(--shadow); overflow: hidden; display: none;
}
.server-panel.open { display: block; animation: pop .15s ease-out; }
.server-panel-head { padding: 11px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.server-panel-head strong { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.server-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line-soft); }
.server-item:last-child { border-bottom: 0; }
.server-item:hover { background: var(--surface); }
.server-item.on { background: var(--brand-soft); }
.server-item .name { font-size: 13px; font-weight: 600; }
.server-item .sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.server-item .radio { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: grid; place-items: center; }
.server-item.on .radio { border-color: var(--brand); }
.server-item.on .radio::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.server-latency { margin-left: auto; font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700;
  color: var(--pill); background: color-mix(in srgb, var(--pill) 16%, transparent); padding: 2px 8px; border-radius: 99px; }
.pill i { width: 5px; height: 5px; border-radius: 50%; background: var(--pill); }

.watch-title { font-size: 20px; font-weight: 750; letter-spacing: -0.025em; line-height: 1.3; margin-top: 16px; }
@media (max-width: 640px) { .watch-title { font-size: 17px; } }
.watch-sub { color: var(--muted); font-size: 13px; margin-top: 6px; }
.channel-row { display: flex; align-items: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.channel-row .who strong { display: block; font-size: 14px; }
.channel-row .who span { font-size: 12px; color: var(--muted); }
.btn-sub { height: 38px; padding: 0 18px; border-radius: 99px; background: var(--ink); color: var(--bg);
  font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.btn-sub:hover { opacity: .88; }
.btn-sub.on { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }

.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.action {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--ink-2);
}
.action:hover { background: var(--surface-2); color: var(--ink); }
.action.on { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 40%, transparent); background: var(--brand-soft); }
.like-group { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 99px; overflow: hidden; }
.like-group .action { border: 0; border-radius: 0; background: none; height: 36px; }
.like-group .action + .action { border-left: 1px solid var(--line); }
.like-group .action.on { background: var(--brand-soft); }

.desc-box { margin-top: 16px; background: var(--surface); border-radius: var(--r-m); padding: 12px 14px; font-size: 13px; }
.desc-box .meta { font-weight: 650; font-size: 12.5px; }
.desc-box .txt { color: var(--ink-2); margin-top: 7px; white-space: pre-wrap; line-height: 1.6; }
.tags { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 11px; }
.tag { font-size: 11.5px; color: var(--brand); background: var(--brand-soft); padding: 3px 9px; border-radius: 99px; font-weight: 600; }

/* comments */
.cmts { margin-top: 26px; }
.cmts-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.cmts-head h3 { font-size: 16px; font-weight: 750; }
.sort-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 99px; overflow: hidden; }
.sort-toggle button { padding: 5px 12px; font-size: 12px; color: var(--muted); font-weight: 600; }
.sort-toggle button.on { background: var(--ink); color: var(--bg); }
.cmt-form { display: flex; gap: 11px; margin-bottom: 22px; }
.cmt-form input {
  width: 100%; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 8px 0; outline: 0; font-size: 13.5px;
}
.cmt-form input:focus { border-color: var(--brand); }
.cmt { display: flex; gap: 11px; margin-bottom: 20px; }
.cmt-body { min-width: 0; }
.cmt-top { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.cmt-top b { color: var(--ink); font-weight: 650; }
.cmt-top .pin { font-size: 10px; background: var(--brand-soft); color: var(--brand); padding: 1px 6px; border-radius: 5px; font-weight: 700; }
.cmt-text { font-size: 13.5px; line-height: 1.6; margin-top: 4px; color: var(--ink-2); }
.cmt-actions { display: flex; gap: 16px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.cmt-actions button:hover { color: var(--ink); }

/* sidebar / up next */
.upnext { display: flex; flex-direction: column; gap: 4px; }
.upnext-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.upnext-head h3 { font-size: 14px; font-weight: 700; }
.switch { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.switch .knob { width: 34px; height: 19px; border-radius: 99px; background: var(--line); position: relative; transition: .18s; }
.switch .knob::after { content: ''; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: #fff; transition: .18s; }
.switch.on .knob { background: var(--brand); }
.switch.on .knob::after { left: 17px; }

/* ---------- ads ---------- */
.ad {
  position: relative; display: grid; place-items: center; text-align: center; gap: 2px;
  border: 1px dashed var(--line); border-radius: var(--r-m); background:
    repeating-linear-gradient(135deg, var(--surface) 0 12px, var(--bg-soft) 12px 24px);
  padding: 18px; margin: 14px 0;
}
.ad-label { font-size: 9.5px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); font-weight: 700; }
.ad-zone { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10.5px; color: var(--muted); opacity: .8; }
.ad-tall { min-height: 250px; }
.ad-wide { min-height: 90px; }
.ad-strip { min-height: 62px; }

/* ---------- pages ---------- */
.page-title { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; }
.page-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.empty { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-l); padding: 44px 22px; text-align: center; }
.empty .em { font-size: 30px; }
.empty h3 { font-size: 16px; font-weight: 700; margin-top: 8px; }
.empty p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.btn-brand { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 18px; border-radius: 99px;
  background: linear-gradient(140deg, var(--brand), var(--brand-2)); color: #fff; font-weight: 700; font-size: 13px;
  box-shadow: 0 10px 24px -12px var(--brand); }
.btn-ghost { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 16px; border-radius: 99px;
  border: 1px solid var(--line); font-weight: 650; font-size: 13px; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface); color: var(--ink); }

/* channel */
.banner { height: 190px; border-radius: var(--r-xl); background:
  radial-gradient(90% 130% at 8% 0%, hsl(var(--h) 65% 38%), transparent 62%),
  linear-gradient(110deg, hsl(calc(var(--h) + 40) 55% 16%), hsl(var(--h) 40% 9%));
  position: relative; overflow: hidden; }
.banner::after { content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.09) 1px, transparent 1px); background-size: 18px 18px; }
.channel-head { display: flex; align-items: center; gap: 18px; margin-top: -38px; padding: 0 22px; position: relative; flex-wrap: wrap; }
.channel-head .avatar { box-shadow: 0 0 0 5px var(--bg); }
.channel-id strong { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; display: flex; align-items: center; gap: 6px; }
.channel-id p { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.tabs { display: flex; gap: 24px; margin: 22px 0 18px; border-bottom: 1px solid var(--line); }
.tabs button { padding: 9px 2px 11px; font-size: 13.5px; font-weight: 650; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--ink); border-color: var(--ink); }

/* shorts feed */
.shorts-feed { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 18px; }
.short-tile { position: relative; aspect-ratio: 9/16; border-radius: var(--r-l); overflow: hidden; cursor: pointer;
  background: radial-gradient(110% 70% at 50% 100%, hsl(var(--h) 70% 45% / .8), transparent 62%),
  linear-gradient(165deg, hsl(var(--h) 50% 24%), hsl(calc(var(--h) + 40) 55% 8%)); }
.short-tile:hover { transform: translateY(-3px); }
.short-tile .st-post { position: absolute; inset: 0; padding: 14px; display: flex; flex-direction: column; justify-content: space-between; }
.short-tile .st-top { display: flex; justify-content: space-between; align-items: center; }
.short-tile .st-title { color: #fff; font-size: 14px; font-weight: 700; line-height: 1.35; }
.short-tile .st-meta { color: rgba(255,255,255,.75); font-size: 11.5px; margin-top: 4px; }
.short-side { position: absolute; right: 10px; bottom: 18px; display: flex; flex-direction: column; gap: 12px; }
.short-side button { color: #fff; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; }
.short-side .rd { width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,.16); backdrop-filter: blur(6px); display: grid; place-items: center; }

/* search results header */
.result-line { display: flex; align-items: center; gap: 10px; margin: 4px 0 18px; color: var(--muted); font-size: 13px; }
.result-line b { color: var(--ink); }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.filter-row .chip { font-size: 12px; }

/* library lists */
.list { border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--surface); }
.list-row .thumb { width: 150px; }
.list-row .lmeta { min-width: 0; flex: 1; }
.list-row .lmeta h4 { font-size: 14px; font-weight: 650; }
.list-row .lmeta p { font-size: 12px; color: var(--muted); margin-top: 3px; }
.list-row .lright { color: var(--muted); font-size: 12px; text-align: right; }

/* playlist grid */
.pl-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.pl-card { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-l); padding: 14px; cursor: pointer; }
.pl-card:hover { border-color: var(--muted); }
.pl-thumb { height: 116px; border-radius: var(--r-m); margin-bottom: 11px;
  background: radial-gradient(100% 120% at 20% 0%, hsl(var(--h) 60% 40%), transparent 60%),
  linear-gradient(140deg, hsl(var(--h) 40% 18%), hsl(calc(var(--h) + 40) 45% 9%)); position: relative; }
.pl-thumb .stack { position: absolute; right: 8px; bottom: 8px; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; }
.pl-card h4 { font-size: 14px; font-weight: 650; }
.pl-card p { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* auth */
.auth { max-width: 420px; margin: 60px auto; padding: 0 20px; }
.auth h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; }
.auth p.sub { color: var(--muted); font-size: 13px; margin-top: 6px; }
.auth form { margin-top: 24px; display: flex; flex-direction: column; gap: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 650; margin-bottom: 6px; color: var(--ink-2); }
.field input, .field select, .field textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 13px; outline: 0; font-size: 13.5px; transition: .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.hint { font-size: 12px; color: var(--muted); margin-top: 14px; }
.hint code { background: var(--surface); padding: 2px 6px; border-radius: 5px; font-size: 11.5px; color: var(--brand); }

/* ---------- admin ---------- */
.admin { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.admin-side { background: var(--bg-soft); border-right: 1px solid var(--line); padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.admin-brand { display: flex; align-items: center; gap: 9px; padding: 6px 10px 18px; font-weight: 800; font-size: 15px; letter-spacing: -0.02em; }
.admin-brand small { display: block; font-size: 10px; color: var(--muted); font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.admin-main { padding: 22px 26px 80px; min-width: 0; }
@media (max-width: 960px) { .admin { grid-template-columns: 1fr; } .admin-side { position: static; height: auto; } }
.admin-nav-title { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 800; padding: 14px 10px 6px; }
.admin-link { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 9px; font-size: 13px; color: var(--ink-2); font-weight: 550; }
.admin-link:hover { background: var(--surface); color: var(--ink); }
.admin-link.on { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.admin-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.admin-top h1 { font-size: 21px; font-weight: 800; letter-spacing: -0.025em; }
.admin-top p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.admin-search { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 99px; height: 36px; padding: 0 14px; min-width: 220px; }
.admin-search input { background: none; border: 0; outline: 0; font-size: 12.5px; width: 100%; }

.kpis { display: grid; gap: 12px; grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1200px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .kpis { grid-template-columns: 1fr; } }
.kpi { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-l); padding: 14px; }
.kpi .k-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 750; }
.kpi .k-val { font-size: 25px; font-weight: 800; letter-spacing: -0.03em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .k-delta { font-size: 11.5px; font-weight: 700; margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.kpi .k-delta.up { color: var(--ok); }
.kpi .k-delta.down { color: var(--bad); }
.kpi .spark { width: 100%; height: 38px; margin-top: 10px; }

.panel { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-l); padding: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-head h2 { font-size: 14px; font-weight: 750; }
.panel-head span { font-size: 11.5px; color: var(--muted); }
.two-col { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; margin-top: 14px; }
@media (max-width: 1100px) { .two-col { grid-template-columns: 1fr; } }
.bars { display: flex; align-items: flex-end; gap: 5px; height: 130px; }
.bars span { flex: 1; border-radius: 3px 3px 0 0; opacity: .85; animation: grow .5s ease-out backwards; animation-delay: calc(var(--i) * 22ms); min-height: 4px; }
@keyframes grow { from { transform: scaleY(.1); transform-origin: bottom; } }
.bars span:hover { opacity: 1; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 800; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 10px; border-bottom: 1px solid var(--line-soft); }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.cell-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-main .ct { font-weight: 650; font-size: 13px; }
.cell-main .cs { font-size: 11.5px; color: var(--muted); }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 99px;
  background: color-mix(in srgb, var(--b, var(--muted)) 15%, transparent); color: var(--b, var(--muted)); }
.mini-btn { height: 28px; padding: 0 10px; border-radius: 7px; border: 1px solid var(--line); font-size: 11.5px; font-weight: 650; color: var(--ink-2); }
.mini-btn:hover { background: var(--surface-2); color: var(--ink); }
.mini-btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.mini-btn.danger:hover { background: color-mix(in srgb, var(--bad) 12%, transparent); }
.progress { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 99px; background: var(--brand); }
.toggle { width: 38px; height: 21px; border-radius: 99px; background: var(--line); position: relative; transition: .18s; flex: none; }
.toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%; background: #fff; transition: .18s; }
.toggle.on { background: var(--ok); }
.toggle.on::after { left: 19px; }
.note { font-size: 12px; color: var(--muted); }

/* toast */
.toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--ink); color: var(--bg); font-size: 12.5px; font-weight: 650; padding: 10px 16px; border-radius: 99px;
  box-shadow: var(--shadow); animation: toast-in .2s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 26px 0 40px; color: var(--muted); font-size: 12px; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 10px; }
.footer-links a:hover { color: var(--ink); }

.skeleton { background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%; animation: sh 1.3s infinite; border-radius: var(--r-m); }
@keyframes sh { to { background-position: -200% 0; } }

.fade-in { animation: fade .22s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- admin full-screen mode ---------- */
body.admin-mode .rail { display: none; }
body.admin-mode .main { margin-left: 0; }
body.admin-mode .topbar { position: sticky; }
body.admin-mode .bottom-nav { display: none; }
body.admin-mode .admin-side { position: sticky; top: var(--topbar); height: calc(100vh - var(--topbar)); }
