/* RenTube — a calm, native-feeling media app. Neutral greys, one blue accent, hairlines, tabular numbers. */
:root {
  --bg: #f4f4f2; --surface: #ffffff; --surface-2: #ececea; --surface-3: #e2e2df;
  --ink: #1b1b1d; --ink-2: #47474b; --muted: #77777c; --line: #dededa; --line-strong: #cbcbc6;
  --accent: #0a62d0; --accent-ink: #ffffff; --accent-soft: #e3edfb;
  --danger: #c4372f; --ok: #1f8a4c;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.18);
  --r: 10px; --r-sm: 6px;
  --side: 236px; --top: 56px;
  --sb-sponsor: #00b35f; --sb-selfpromo: #e6b800; --sb-interaction: #b05ee6; --sb-intro: #00b7d4; --sb-outro: #2f5fe0;
  --sb-preview: #008fd6; --sb-music_offtopic: #ff9500; --sb-filler: #8a5cf5;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111113; --surface: #19191c; --surface-2: #222226; --surface-3: #2c2c31;
    --ink: #ededef; --ink-2: #c3c3c8; --muted: #8b8b92; --line: #2a2a2f; --line-strong: #3a3a40;
    --accent: #4b97ff; --accent-ink: #08121f; --accent-soft: #15253c;
    --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 12px 40px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111113; --surface: #19191c; --surface-2: #222226; --surface-3: #2c2c31;
  --ink: #ededef; --ink-2: #c3c3c8; --muted: #8b8b92; --line: #2a2a2f; --line-strong: #3a3a40;
  --accent: #4b97ff; --accent-ink: #08121f; --accent-soft: #15253c;
  --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 12px 40px rgba(0,0,0,.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.num, time { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* ---------- shell ---------- */
#app { display: grid; grid-template-columns: var(--side) 1fr; grid-template-rows: var(--top) 1fr; height: 100vh; }
body.side-collapsed #app { grid-template-columns: 64px 1fr; }
#top {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: var(--surface); border-bottom: 1px solid var(--line); z-index: 30;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; font-size: 16px; letter-spacing: -.01em; width: calc(var(--side) - 28px); }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--ink); color: var(--bg); display: grid; place-items: center; }
.brand-mark svg { width: 12px; height: 12px; fill: currentColor; stroke: none; margin-left: 2px; }
.icon-btn { width: 36px; height: 36px; border-radius: 8px; display: inline-grid; place-items: center; color: var(--ink-2); }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.on { color: var(--accent); background: var(--accent-soft); }

.search { position: relative; flex: 1; max-width: 680px; margin: 0 auto; }
.search-box {
  display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 6px 0 12px;
  background: var(--surface-2); border: 1px solid transparent; border-radius: 9px;
}
.search-box:focus-within { background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-box input { flex: 1; border: 0; outline: 0; background: none; height: 100%; min-width: 0; }
.kbd { font: 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; padding: 3px 5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; color: var(--muted); background: var(--surface); white-space: nowrap; }
.suggest {
  position: absolute; top: 44px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; max-height: 70vh; overflow: auto;
}
.suggest .row { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; cursor: pointer; }
.suggest .row.sel, .suggest .row:hover { background: var(--surface-2); }
.suggest .row .x { margin-left: auto; opacity: 0; color: var(--muted); }
.suggest .row:hover .x { opacity: 1; }
.suggest .label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px 4px; }
.top-right { display: flex; align-items: center; gap: 4px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; background: var(--surface-3); flex: none; }

#side { background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; padding: 10px 10px 24px; }
.nav a, .nav button.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 7px 10px; border-radius: 8px; color: var(--ink-2); width: 100%; text-align: left;
  white-space: nowrap; overflow: hidden;
}
.nav a:hover, .nav button.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 560; }
.nav .count { margin-left: auto; font-size: 12px; color: var(--muted); }
.nav-title { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 18px 10px 6px; display: flex; justify-content: space-between; }
.nav .sub img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; background: var(--surface-3); }
.nav .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-left: auto; flex: none; }
body.side-collapsed .nav span, body.side-collapsed .nav-title, body.side-collapsed .nav .count, body.side-collapsed .nav .dot { display: none; }
body.side-collapsed #side { padding: 10px 8px; }
body.side-collapsed .nav a { justify-content: center; padding: 9px 0; }

#main { position: relative; overflow-y: auto; overflow-x: hidden; scroll-behavior: auto; }
#view { padding: 24px 28px 80px; max-width: 1680px; margin: 0 auto; min-height: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; letter-spacing: -.02em; margin: 0; font-weight: 680; }
.page-head .sub { color: var(--muted); }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
h2.section { font-size: 17px; font-weight: 650; margin: 30px 0 12px; display: flex; align-items: center; gap: 10px; letter-spacing: -.01em; }
h2.section a { font-size: 13px; font-weight: 500; color: var(--accent); margin-left: auto; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--line-strong); font-weight: 550; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.danger { color: var(--danger); }
.btn svg.i { width: 16px; height: 16px; }

/* segmented control */
.seg { display: inline-flex; background: var(--surface-2); padding: 3px; border-radius: 8px; gap: 2px; }
.seg button { padding: 4px 11px; border-radius: 6px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font-weight: 560; }

/* ---------- cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 28px 18px; align-items: start; }
.grid.dense { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.row-scroll { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 16px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.card { display: block; position: relative; min-width: 0; }
.thumb { display: block; position: relative; aspect-ratio: 16/9; border-radius: var(--r); overflow: hidden; background: var(--surface-3); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity .15s; }
.card.short .thumb { aspect-ratio: 9/16; }
.badge { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.78); color: #fff; font-size: 12px; font-weight: 600; padding: 1px 5px; border-radius: 4px; font-variant-numeric: tabular-nums; }
.badge.live { background: var(--danger); }
.badge.left { left: 6px; right: auto; }
.prog { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.35); }
.prog i { display: block; height: 100%; background: var(--accent); }
.card.watched .thumb img { opacity: .55; }
.card .hover-acts { position: absolute; top: 6px; right: 6px; display: flex; flex-direction: column; gap: 4px; opacity: 0; transition: opacity .12s; }
.card:hover .hover-acts, .card:focus-within .hover-acts { opacity: 1; }
.hover-acts button { width: 30px; height: 30px; border-radius: 7px; background: rgba(0,0,0,.72); color: #fff; display: grid; place-items: center; }
.hover-acts button:hover { background: #000; }
.hover-acts svg.i { width: 16px; height: 16px; }
.meta { display: flex; gap: 10px; margin-top: 9px; }
.meta .avatar { width: 32px; height: 32px; margin-top: 1px; }
.meta-text { min-width: 0; flex: 1; }
.title { font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; letter-spacing: -.005em; }
.byline { color: var(--muted); font-size: 13px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.byline a:hover { color: var(--ink); }
.card .more { position: absolute; right: -6px; top: calc(100% - 0px); }

.list { display: flex; flex-direction: column; gap: 14px; }
.list .card { display: grid; grid-template-columns: minmax(200px, 360px) 1fr; gap: 16px; }
.list .card .meta { margin-top: 0; }
.list .card .title { font-size: 17px; }
.list .snippet { color: var(--muted); font-size: 13px; margin-top: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.grid .chan-card { grid-column: 1 / -1; padding: 8px 0 18px; border-bottom: 1px solid var(--line); }
.chan-card { display: grid; grid-template-columns: 136px 1fr auto; gap: 20px; align-items: center; padding: 8px 0; }
.chan-card img { width: 136px; height: 136px; border-radius: 50%; object-fit: cover; background: var(--surface-3); }
.chan-card h3 { margin: 0 0 4px; font-size: 18px; }

.compact { display: grid; grid-template-columns: 168px 1fr; gap: 10px; padding: 4px; border-radius: 9px; }
.compact:hover { background: var(--surface-2); }
.compact .thumb { border-radius: 7px; }
.compact .title { font-size: 13.5px; }
.compact .byline { font-size: 12px; margin-top: 2px; }
.compact.now { background: var(--accent-soft); }

/* ---------- filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; padding: 10px 0 18px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.filters label { font-size: 12px; color: var(--muted); margin-right: 6px; }
.fgroup { display: flex; align-items: center; }
.chip { height: 30px; padding: 0 12px; border-radius: 8px; background: var(--surface-2); font-size: 13px; font-weight: 520; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.chip:hover { background: var(--surface-3); }
.chip.on { background: var(--ink); color: var(--bg); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
select.sel { height: 30px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 7px; padding: 0 8px; font-size: 13px; }

/* ---------- watch ---------- */
.watch { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 24px; }
.watch.theater { grid-template-columns: minmax(0, 1fr) 400px; }
.watch.theater .w-main { display: contents; }
.watch.theater .slot-wrap { grid-column: 1 / -1; }
.watch.theater .w-info { grid-column: 1; }
.slot-wrap { position: relative; }
#slot { width: 100%; aspect-ratio: 16/9; border-radius: 12px; background: #000; }
.watch.theater #slot { max-height: calc(100vh - var(--top) - 140px); aspect-ratio: auto; height: min(56.25vw, calc(100vh - var(--top) - 140px)); border-radius: 0; }
.watch.theater { margin-top: -24px; }
.watch.theater .slot-wrap { margin: 0 -28px; }
.watch.theater .strip, .watch.theater .toolbar { margin-left: 28px; margin-right: 28px; }

#playerHost { position: absolute; z-index: 20; background: #000; border-radius: 12px; overflow: hidden; display: none; }
#playerHost.on { display: block; }
#playerHost iframe, #playerHost #ytp { width: 100%; height: 100%; display: block; border: 0; }
#playerHost.theater { border-radius: 0; }
#playerHost.mini {
  position: fixed; right: 20px; bottom: 20px; width: 400px; height: 225px; border-radius: 12px 12px 0 0;
  box-shadow: var(--shadow-lg); z-index: 60;
}
.mini-bar {
  position: fixed; right: 20px; bottom: -40px; width: 400px; height: 56px; z-index: 60; display: none;
  background: var(--surface); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 12px 12px; box-shadow: var(--shadow-lg);
  align-items: center; gap: 4px; padding: 0 8px 0 12px;
}
.mini-bar.on { display: flex; bottom: 20px; }
body.mini-on #playerHost.mini { bottom: 76px; }
.mini-bar .t { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.mini-bar .t small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.mini-prog { position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--line); }
.mini-prog i { display: block; height: 100%; background: var(--accent); width: 0; }

/* timeline strip */
.strip { position: relative; height: 26px; margin-top: 10px; cursor: pointer; user-select: none; }
.strip .track { position: absolute; left: 0; right: 0; top: 10px; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.strip .played { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ink-2); opacity: .55; }
.strip .seg-sb { position: absolute; top: 0; bottom: 0; opacity: .95; }
.strip .chap { position: absolute; top: 8px; width: 2px; height: 10px; background: var(--bg); }
.strip .loop { position: absolute; top: 6px; height: 14px; border: 2px solid var(--accent); border-radius: 4px; background: color-mix(in srgb, var(--accent) 14%, transparent); pointer-events: none; }
.strip .moment { position: absolute; top: 2px; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); }
.strip .head { position: absolute; top: 5px; width: 3px; height: 16px; margin-left: -1px; background: var(--accent); border-radius: 2px; }
.strip .hover-tip { position: absolute; bottom: 26px; transform: translateX(-50%); background: var(--ink); color: var(--bg); font-size: 12px; padding: 3px 7px; border-radius: 5px; white-space: nowrap; pointer-events: none; }

.toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 0 4px; }
.toolbar .sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.tool { height: 30px; padding: 0 9px; border-radius: 7px; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); font-weight: 520; }
.tool:hover { background: var(--surface-2); color: var(--ink); }
.tool.on { background: var(--accent-soft); color: var(--accent); }
.tool svg.i { width: 16px; height: 16px; }
.speed-wrap { display: inline-flex; align-items: center; gap: 6px; padding: 0 6px; }
.speed-wrap input[type=range] { width: 110px; accent-color: var(--accent); }
.speed-val { min-width: 42px; text-align: right; font-size: 13px; font-weight: 600; }

.w-info h1 { font-size: 21px; line-height: 1.3; margin: 14px 0 10px; letter-spacing: -.015em; font-weight: 680; }
.chan-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.chan-row .avatar { width: 42px; height: 42px; }
.chan-row .name { font-weight: 640; }
.chan-row .stats { margin-left: auto; display: flex; gap: 16px; color: var(--ink-2); font-size: 13px; align-items: center; flex-wrap: wrap; }
.chan-row .stats span { display: inline-flex; gap: 5px; align-items: center; }
.ratio { width: 90px; height: 4px; background: var(--danger); border-radius: 2px; overflow: hidden; }
.ratio i { display: block; height: 100%; background: var(--ok); }
.desc { margin-top: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; font-size: 13.5px; }
.desc .d-meta { font-weight: 600; margin-bottom: 6px; }
.desc .d-body { white-space: pre-wrap; word-break: break-word; max-height: 4.5em; overflow: hidden; }
.desc.open .d-body { max-height: none; }
.desc a { color: var(--accent); }
.desc .more-btn { color: var(--ink); font-weight: 600; margin-top: 6px; }

.w-side { min-width: 0; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 10px; position: sticky; top: 0; background: var(--bg); z-index: 5; }
.tabs button { padding: 9px 12px; font-size: 13px; font-weight: 560; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--ink); }
.panel { display: flex; flex-direction: column; gap: 4px; }
.queue-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 8px; margin-bottom: 14px; }
.queue-box .qh { display: flex; align-items: center; gap: 8px; padding: 2px 4px 8px; font-weight: 620; }
.queue-box .qh .muted { font-weight: 400; font-size: 12px; }
.queue-box .qh .acts { margin-left: auto; display: flex; gap: 2px; }
.q-item { display: grid; grid-template-columns: 16px 100px 1fr 26px; gap: 8px; align-items: center; padding: 4px; border-radius: 7px; cursor: grab; }
.q-item:hover { background: var(--surface-2); }
.q-item.now { background: var(--accent-soft); }
.q-item.drag { opacity: .4; }
.q-item.over { box-shadow: inset 0 2px 0 var(--accent); }
.q-item .thumb { border-radius: 5px; }
.q-item .title { font-size: 12.5px; }
.q-item .n { font-size: 11px; color: var(--muted); text-align: center; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 4px 10px; font-size: 13px; color: var(--ink-2); }

.switch { position: relative; width: 36px; height: 21px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; background: var(--surface-3); border-radius: 11px; transition: .15s; cursor: pointer; }
.switch i::after { content: ""; position: absolute; left: 2px; top: 2px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: .15s; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { left: 17px; }

.chapter { display: grid; grid-template-columns: 96px 1fr; gap: 10px; padding: 5px; border-radius: 8px; cursor: pointer; align-items: center; }
.chapter:hover { background: var(--surface-2); }
.chapter.on { background: var(--accent-soft); }
.chapter img { width: 96px; aspect-ratio: 16/9; object-fit: cover; border-radius: 5px; background: var(--surface-3); }
.chapter time { font-size: 12px; color: var(--accent); font-weight: 600; }
.chapter .ct { font-size: 13px; font-weight: 560; }

.tx-tools { display: flex; gap: 6px; margin-bottom: 8px; }
.tx-tools input { flex: 1; height: 32px; border: 1px solid var(--line-strong); border-radius: 7px; padding: 0 10px; background: var(--surface); min-width: 0; }
.tx { max-height: calc(100vh - 230px); overflow-y: auto; scroll-behavior: smooth; }
.tx-line { display: grid; grid-template-columns: 52px 1fr; gap: 8px; padding: 5px 6px; border-radius: 6px; cursor: pointer; font-size: 13.5px; }
.tx-line:hover { background: var(--surface-2); }
.tx-line time { color: var(--muted); font-size: 12px; padding-top: 1px; }
.tx-line.on { background: var(--accent-soft); }
.tx-line.on time { color: var(--accent); }
.tx-line mark { background: #ffe58a; color: #000; border-radius: 2px; }

.comments { margin-top: 26px; }
.comment { display: grid; grid-template-columns: 36px 1fr; gap: 12px; padding: 10px 0; }
.comment .avatar { width: 36px; height: 36px; }
.comment .who { font-size: 13px; font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.comment .who .muted { font-weight: 400; }
.comment .tag { font-size: 11px; background: var(--surface-3); padding: 0 6px; border-radius: 4px; font-weight: 600; }
.comment .tag.creator { background: var(--ink); color: var(--bg); }
.comment .body { white-space: pre-wrap; word-break: break-word; margin-top: 2px; font-size: 13.5px; }
.comment .body a { color: var(--accent); }
.comment .acts { display: flex; gap: 14px; color: var(--muted); font-size: 12px; margin-top: 4px; align-items: center; }
.comment .acts button { color: var(--accent); font-weight: 600; }
.replies { margin-top: 4px; }

.moment-row { display: grid; grid-template-columns: 120px 1fr auto; gap: 12px; padding: 8px; border-radius: 9px; align-items: center; }
.moment-row:hover { background: var(--surface-2); }
.moment-row .thumb { border-radius: 6px; }
.moment-row textarea { width: 100%; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); padding: 6px 8px; resize: vertical; min-height: 34px; font-size: 13px; }

/* ---------- misc ---------- */
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty h3 { color: var(--ink); font-size: 18px; margin: 12px 0 6px; }
.empty svg.i { width: 36px; height: 36px; stroke-width: 1.4; }
.skel { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--r); }
@keyframes sk { to { background-position: -200% 0; } }
.skel-card .thumb { animation: sk 1.2s infinite; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; }
.skel-line { height: 12px; margin-top: 10px; width: 80%; }
.skel-line.s { width: 50%; }
.sentinel { height: 40px; }
.spinner { width: 22px; height: 22px; border: 2.5px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 20px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.menu {
  position: fixed; z-index: 90; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg);
  padding: 5px; min-width: 210px; max-height: 70vh; overflow-y: auto;
}
.menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px; text-align: left; font-size: 13.5px; }
.menu button:hover { background: var(--surface-2); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.menu .mlabel { font-size: 11px; color: var(--muted); padding: 6px 10px 2px; text-transform: uppercase; letter-spacing: .06em; }

.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 100; display: grid; place-items: start center; padding-top: 12vh; }
.modal { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); width: min(560px, calc(100vw - 32px)); border: 1px solid var(--line); overflow: hidden; }
.modal-head { display: flex; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); font-weight: 650; }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 16px; max-height: 64vh; overflow-y: auto; }
.palette input { width: 100%; border: 0; outline: 0; padding: 16px 18px; font-size: 17px; background: none; border-bottom: 1px solid var(--line); }
.palette .list-p { max-height: 52vh; overflow-y: auto; padding: 6px; }
.palette .item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 8px; cursor: pointer; }
.palette .item.sel { background: var(--accent); color: var(--accent-ink); }
.palette .item .hint { margin-left: auto; font-size: 12px; opacity: .7; }
.palette .group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 12px 4px; }
.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; }
.keys div { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 3px 0; border-bottom: 1px dashed var(--line); }

#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 120; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: 9px 14px; border-radius: 9px; font-size: 13.5px; display: flex; gap: 14px; align-items: center; box-shadow: var(--shadow-lg); pointer-events: auto; animation: tin .18s ease-out; }
.toast button { color: var(--accent); font-weight: 650; filter: brightness(1.3); }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }

/* channel page */
.banner { height: 180px; border-radius: 14px; background: var(--surface-3) center/cover; margin-bottom: 20px; }
.chan-head { display: flex; gap: 22px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.chan-head img.big { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; background: var(--surface-3); }
.chan-head h1 { margin: 0; font-size: 30px; letter-spacing: -.02em; }
.chan-head .sub { color: var(--muted); margin-top: 4px; }
.chan-head .about { max-width: 640px; color: var(--ink-2); margin-top: 8px; font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chan-head .actions { margin-left: auto; display: flex; gap: 8px; }

/* settings */
.settings { max-width: 760px; }
.set-group { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 22px; }
.set-group h3 { margin: 0; padding: 14px 16px 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.set-row { display: flex; align-items: center; gap: 16px; padding: 12px 16px; border-top: 1px solid var(--line); }
.set-row:first-of-type { border-top: 0; }
.set-row .l { flex: 1; }
.set-row .l small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.sb-swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 8px; }

/* insights */
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 26px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.tile .v { font-size: 28px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile .k { color: var(--muted); font-size: 13px; }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 180px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 16px 30px; }
.bars .b { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; position: relative; }
.bars .b i { display: block; width: 100%; max-width: 46px; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.bars .b.today i { background: var(--ink); }
.bars .b span { position: absolute; bottom: -22px; font-size: 12px; color: var(--muted); }
.bars .b em { font-style: normal; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.top-chan { display: grid; grid-template-columns: 28px 1fr 160px 70px; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.top-chan .bar { height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.top-chan .bar i { display: block; height: 100%; background: var(--accent); }

.day-head { font-size: 13px; font-weight: 650; color: var(--muted); margin: 22px 0 10px; text-transform: uppercase; letter-spacing: .05em; }
.hist-tools { display: flex; gap: 8px; }
.hist-tools input { height: 34px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 12px; background: var(--surface); width: 260px; }
.welcome { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 36px; display: grid; grid-template-columns: 1.3fr 1fr; gap: 32px; align-items: center; }
.welcome h1 { font-size: 30px; margin: 0 0 10px; letter-spacing: -.02em; }
.welcome p { color: var(--ink-2); margin: 0 0 18px; max-width: 520px; }
.welcome ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.welcome li { display: flex; gap: 10px; align-items: center; color: var(--ink-2); font-size: 13.5px; }
.welcome li svg.i { color: var(--accent); }
.starter { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.drop-hint { font-size: 12px; color: var(--muted); margin-top: 10px; }
.foot { color: var(--muted); font-size: 12px; text-align: center; margin-top: 60px; }

@media (max-width: 1180px) {
  .watch, .watch.theater { grid-template-columns: 1fr; }
  .welcome { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  :root { --side: 0px; }
  #app { grid-template-columns: 1fr; }
  #side { display: none; position: fixed; top: var(--top); bottom: 0; left: 0; width: 260px; z-index: 40; box-shadow: var(--shadow-lg); }
  body.side-open #side { display: block; }
  .brand { width: auto; }
  .brand .word { display: none; }
  #view { padding: 16px 16px 80px; }
  .list .card { grid-template-columns: 1fr; }
  .watch.theater .slot-wrap { margin: 0 -16px; }
  #playerHost.mini, .mini-bar { width: calc(100vw - 32px); right: 16px; }
  #playerHost.mini { height: calc((100vw - 32px) * .5625); }
  .top-right .kbd, .search .kbd { display: none; }
  .keys { grid-template-columns: 1fr; }
  .chan-card { grid-template-columns: 72px 1fr; }
  .chan-card img { width: 72px; height: 72px; }
  .chan-card > :last-child { grid-column: 1 / -1; }
}
