/* ---------- themes ----------
   The theme (data-theme on <html>) sets the surface colours; the accent (data-accent)
   sets the brand colour. With no data-theme the system light/dark setting is followed.
   public/js/theme.js applies the saved choice before the page is drawn. */
:root {
  --radius: 12px;
  --topbar-h: 56px;
  --sidebar-w: 232px;
  --sidebar-w-collapsed: 72px;
  --live: #ff3b4e;
  --danger: #e5484d;

  /* Dark (default) */
  --bg: #0f0f13;
  --bg-elev: #17171d;
  --bg-hover: #25252e;
  --bg-input: #121217;
  --border: #2c2c36;
  --text: #f1f1f4;
  --muted: #a3a3b2;
  --shadow: rgba(0, 0, 0, .35);
  color-scheme: dark;

  /* Light blue accent (default). --accent fills buttons and bars, --on-accent is text on
     top of it, --accent-text is accent-coloured text on the page background (darker in
     light themes so it stays readable). */
  --accent: #38bdf8;
  --accent-hover: #0ea5e9;
  --on-accent: #04202e;
  --accent-text-dark: #7dd3fc;
  --accent-text-light: #0369a1;
  --accent-text: var(--accent-text-dark);
  --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
}

/* Light surfaces: the system setting when no theme is chosen, or the Light theme. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #ffffff;
    --bg-elev: #f4f6f9;
    --bg-hover: #e7ebf0;
    --bg-input: #ffffff;
    --border: #d9dee6;
    --text: #0f1419;
    --muted: #5b6573;
    --shadow: rgba(15, 20, 25, .12);
    --accent-text: var(--accent-text-light);
    --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-elev: #f4f6f9;
  --bg-hover: #e7ebf0;
  --bg-input: #ffffff;
  --border: #d9dee6;
  --text: #0f1419;
  --muted: #5b6573;
  --shadow: rgba(15, 20, 25, .12);
  --accent-text: var(--accent-text-light);
  --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
  color-scheme: light;
}
/* Pure black, for OLED screens and dark rooms. */
:root[data-theme="midnight"] {
  --bg: #000000;
  --bg-elev: #0c0c0e;
  --bg-hover: #1a1a1f;
  --bg-input: #050506;
  --border: #232329;
  --text: #ececef;
  --muted: #9a9aa6;
  --shadow: rgba(0, 0, 0, .6);
}
/* Deep navy. */
:root[data-theme="ocean"] {
  --bg: #0b1622;
  --bg-elev: #10202f;
  --bg-hover: #1a2e42;
  --bg-input: #0d1a28;
  --border: #22384e;
  --text: #e8f1f8;
  --muted: #93a8bb;
  --shadow: rgba(0, 8, 16, .45);
}

/* Accents */
:root[data-accent="purple"] { --accent: #7c4dff; --accent-hover: #6a3cf0; --on-accent: #ffffff; --accent-text-dark: #b39dff; --accent-text-light: #5b2fd6; }
:root[data-accent="green"] { --accent: #34d399; --accent-hover: #10b981; --on-accent: #03241a; --accent-text-dark: #6ee7b7; --accent-text-light: #047857; }
:root[data-accent="pink"] { --accent: #f472b6; --accent-hover: #ec4899; --on-accent: #2d0a1c; --accent-text-dark: #f9a8d4; --accent-text-light: #be185d; }
:root[data-accent="orange"] { --accent: #fb923c; --accent-hover: #f97316; --on-accent: #2a1204; --accent-text-dark: #fdba74; --accent-text-light: #c2410c; }
:root[data-accent="red"] { --accent: #f87171; --accent-hover: #ef4444; --on-accent: #2b0707; --accent-text-dark: #fca5a5; --accent-text-light: #b91c1c; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: none; }
.desc-body a, .comment-body a, .chat a, .muted a, p a { color: var(--accent-text); }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
img { display: block; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; }
.row.gap { gap: 10px; }
.row.between { justify-content: space-between; }
.row.center { justify-content: center; }
.row.end { justify-content: flex-end; }
.row.wrap { flex-wrap: wrap; gap: 10px; }
.clamp-1, .clamp-2 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-1 { -webkit-line-clamp: 1; }
.clamp-2 { -webkit-line-clamp: 2; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: 18px; border: 1px solid transparent;
  background: var(--bg-hover); cursor: pointer; font-weight: 600; white-space: nowrap;
  transition: background .15s, opacity .15s;
}
.btn svg { width: 20px; height: 20px; }
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); filter: none; }
.btn.outline { background: transparent; border-color: var(--border); color: var(--accent-text); }
.btn.outline:hover { background: var(--accent-soft); }
.btn.ghost { background: var(--bg-hover); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.live { background: var(--live); color: #fff; }
.btn.small { height: 30px; padding: 0 12px; font-size: 13px; }
.btn.block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: none; border: none; cursor: pointer;
}
.icon-btn:hover { background: var(--bg-hover); }
.icon-btn svg { width: 20px; height: 20px; }
.link-btn { background: none; border: none; padding: 0; cursor: pointer; font-weight: 600; color: var(--muted); }
.link-btn:hover { color: var(--text); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px;
  border-radius: 18px; border: none; background: var(--bg-hover); cursor: pointer; font-weight: 600;
}
.pill svg { width: 20px; height: 20px; }
.pill:hover { filter: brightness(1.15); }
.pill.on { background: var(--accent-soft); color: var(--accent-text); }
.pill-group { display: inline-flex; }
.pill-group .pill:first-child { border-radius: 18px 0 0 18px; border-right: 1px solid var(--border); }
.pill-group .pill:last-child { border-radius: 0 18px 18px 0; }

.avatar {
  display: inline-grid; place-items: center; flex-shrink: 0;
  width: var(--size); height: var(--size); border-radius: 50%;
  color: #fff; font-weight: 700; font-size: calc(var(--size) * .45); user-select: none;
}
.avatar-btn { background: none; border: none; padding: 0; cursor: pointer; border-radius: 50%; }
.live-ring .avatar { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--live); }

/* ---------- top bar ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--topbar-h); z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 16px; background: var(--bg);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-right { justify-content: flex-end; }
.logo { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 19px; letter-spacing: -.5px; }
.logo-mark { width: 32px; height: 24px; fill: var(--accent); stroke: none; }
.logo-mark path { stroke: none; fill: var(--on-accent); }
.logo-mark.big { width: 48px; height: 36px; margin: 0 auto 8px; display: block; }
.search { flex: 0 1 600px; display: flex; min-width: 0; }
.search input {
  flex: 1; min-width: 0; height: 40px; padding: 0 16px; border: 1px solid var(--border); border-right: none;
  border-radius: 20px 0 0 20px; background: var(--bg-input); outline: none;
}
.search input:focus { border-color: var(--accent); }
.search button {
  width: 64px; height: 40px; border: 1px solid var(--border); border-radius: 0 20px 20px 0;
  background: var(--bg-elev); cursor: pointer; display: grid; place-items: center;
}
.search button svg { width: 20px; height: 20px; }
.create-btn span { display: inline; }

.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; z-index: 60;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 0; box-shadow: 0 8px 30px var(--shadow);
}
.menu a, .menu button {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 16px;
  background: none; border: none; cursor: pointer; text-align: left;
}
.menu a:hover, .menu button:hover { background: var(--bg-hover); }
.menu svg { width: 20px; height: 20px; }
.menu-head { display: flex; gap: 12px; align-items: center; padding: 8px 16px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu-head small { display: block; color: var(--muted); }

/* ---------- sidebar ---------- */
.sidebar {
  position: fixed; top: var(--topbar-h); left: 0; bottom: 0; width: var(--sidebar-w);
  overflow-y: auto; padding: 8px 12px 24px; background: var(--bg); z-index: 40;
  scrollbar-width: thin;
}
.nav-section { padding: 8px 0; border-bottom: 1px solid var(--border); }
.nav-section:last-of-type { border-bottom: none; }
.nav-section h3 { font-size: 15px; margin: 6px 12px 4px; }
.nav-item {
  display: flex; align-items: center; gap: 20px; height: 40px; padding: 0 12px; border-radius: 10px;
  overflow: hidden; white-space: nowrap;
}
.nav-item span { overflow: hidden; text-overflow: ellipsis; }
.nav-item:hover { background: var(--bg-hover); }
.nav-item.active { background: var(--bg-hover); font-weight: 600; }
.nav-item svg { width: 22px; height: 22px; }
.signin-promo { padding: 12px; }
.signin-promo p { margin: 0 0 10px; }
.nav-footer { color: var(--muted); font-size: 12px; padding: 16px 12px; }
.scrim { display: none; }

main {
  margin-left: var(--sidebar-w); padding: calc(var(--topbar-h) + 16px) 24px 48px;
  min-height: 100vh; outline: none;
}

body.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); padding: 8px 4px; }
body.sidebar-collapsed .sidebar .nav-item { flex-direction: column; gap: 4px; height: auto; padding: 14px 0; font-size: 10px; }
body.sidebar-collapsed .sidebar .nav-section:not(:first-child),
body.sidebar-collapsed .nav-footer { display: none; }
body.sidebar-collapsed main { margin-left: var(--sidebar-w-collapsed); }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; width: var(--sidebar-w); z-index: 70; top: 0; padding-top: calc(var(--topbar-h) + 8px); }
  body.sidebar-open .sidebar { transform: none; box-shadow: 4px 0 20px rgba(0,0,0,.3); }
  body.sidebar-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 65; }
  main, body.sidebar-collapsed main { margin-left: 0; padding-left: 16px; padding-right: 16px; }
  .topbar { z-index: 80; }
}
@media (max-width: 600px) {
  .logo span, .create-btn span { display: none; }
  .search button { width: 48px; }
  .topbar { gap: 8px; padding: 0 8px; }
}

/* ---------- common page bits ---------- */
.page-title { display: flex; align-items: center; gap: 10px; font-size: 22px; margin: 4px 0 20px; }
.page-loading { display: grid; place-items: center; min-height: 40vh; }
.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--bg-hover); border-top-color: var(--accent); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 64px 16px; }
.empty.small { padding: 24px 16px; color: var(--muted); }
.empty h2 { margin: 0 0 8px; }
.empty p { color: var(--muted); margin: 0 0 20px; }
.chips { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 16px; scrollbar-width: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border-radius: 8px;
  background: var(--bg-hover); font-weight: 600; white-space: nowrap;
}
.chip svg { width: 18px; height: 18px; }
.chip.active { background: var(--text); color: var(--bg); }
.shelf { margin-bottom: 28px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.shelf-title { display: flex; align-items: center; gap: 10px; font-size: 19px; margin: 8px 0 16px; }
.dot-live { width: 10px; height: 10px; border-radius: 50%; background: var(--live); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.card-panel { background: var(--bg-elev); border-radius: var(--radius); padding: 20px; margin: 16px 0; }
.card-panel h2 { margin: 0 0 12px; font-size: 18px; }
.narrow { max-width: 820px; margin: 0 auto; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-weight: 600; font-size: 13px; }
.field.inline { flex-direction: row; align-items: center; margin: 0; font-weight: 500; }
.field input, .field textarea, .field select, select {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-input);
  font-weight: 400; font-size: 14px; outline: none; resize: vertical;
}
.field.inline select { max-width: 220px; padding: 6px 8px; }
.field input:focus, .field textarea:focus, select:focus { border-color: var(--accent); }
.check { display: flex; gap: 8px; align-items: center; margin: 4px 0 16px; cursor: pointer; }
.error-text { color: var(--danger); min-height: 1em; margin: 0 0 10px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, calc(100% + 40px)); z-index: 100; visibility: hidden;
  background: var(--text); color: var(--bg); padding: 12px 20px; border-radius: 8px; font-weight: 600;
  transition: transform .25s, visibility .25s; max-width: calc(100vw - 32px); box-shadow: 0 6px 24px rgba(0,0,0,.3);
}
.toast.show { transform: translate(-50%, 0); visibility: visible; }
.toast.error { background: var(--danger); color: #fff; }

.progress { height: 6px; background: var(--bg-hover); border-radius: 3px; overflow: hidden; margin: 8px 0 12px; }
.progress .bar { height: 100%; width: 0; background: var(--accent); transition: width .2s; }

dialog {
  border: none; border-radius: var(--radius); background: var(--bg-elev); color: var(--text);
  width: min(560px, calc(100vw - 32px)); padding: 24px;
}
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog h2 { margin-top: 0; }

/* ---------- video grid & cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 32px 16px; }
.card { min-width: 0; }
.thumb {
  position: relative; display: block; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden;
  background: var(--bg-hover);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.card:hover .thumb img { transform: scale(1.03); }
.thumb-placeholder { display: grid; place-items: center; height: 100%; color: var(--muted); }
.thumb-placeholder svg { width: 48px; height: 48px; }
.duration {
  position: absolute; right: 8px; bottom: 8px; background: rgba(0,0,0,.8); color: #fff;
  font-size: 12px; font-weight: 600; padding: 1px 5px; border-radius: 4px;
}
.badge-live {
  display: inline-block; background: var(--live); color: #fff; font-size: 11px; font-weight: 800;
  padding: 2px 6px; border-radius: 4px; letter-spacing: .3px;
}
.thumb .badge-live { position: absolute; left: 8px; bottom: 8px; }
.badge-stream {
  position: absolute; left: 8px; top: 8px; background: rgba(0,0,0,.75); color: #fff;
  font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 4px;
}
.live-thumb { background: radial-gradient(circle at 30% 30%, var(--c), #111 85%); }
.live-thumb-inner { display: grid; place-items: center; height: 100%; }
.card-body { display: flex; gap: 12px; margin-top: 12px; }
.card-meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.card-title {
  font-weight: 600; font-size: 15px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-channel, .card-stats { color: var(--muted); font-size: 13px; }
.card-channel:hover { color: var(--text); }
.vis { text-transform: capitalize; background: var(--bg-hover); padding: 0 6px; border-radius: 4px; font-size: 12px; }

.list { display: flex; flex-direction: column; gap: 16px; max-width: 1100px; }
.card.horizontal { display: flex; gap: 16px; }
.card.horizontal .thumb { flex: 0 0 min(360px, 42%); }
.card.horizontal .card-body { margin-top: 0; }
.card.horizontal .card-title { font-size: 17px; }
.list.compact { gap: 8px; }
.list.compact .card.horizontal { gap: 8px; }
.list.compact .card.horizontal .thumb { flex-basis: 168px; border-radius: 8px; }
.list.compact .card-title { font-size: 14px; }
.list.compact .card-channel, .list.compact .card-stats { font-size: 12px; }

.channel-result { display: flex; align-items: center; gap: 24px; padding: 12px 0 24px; border-bottom: 1px solid var(--border); margin-bottom: 20px; max-width: 1100px; }
.channel-result > a { flex: 0 0 min(360px, 42%); display: grid; place-items: center; }
.channel-name { font-weight: 700; font-size: 16px; }

/* ---------- watch page ---------- */
.watch-layout, .live-layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 24px; max-width: 1760px; margin: 0 auto; }
.player-wrap {
  position: relative; background: #000; border-radius: var(--radius); overflow: hidden;
  aspect-ratio: 16 / 9; max-height: calc(100vh - 170px); width: 100%;
}
.player-wrap video { width: 100%; height: 100%; display: block; background: #000; }
.watch-title { font-size: 20px; margin: 12px 0 8px; word-break: break-word; }
.watch-actions { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.channel-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.channel-info { display: flex; flex-direction: column; min-width: 0; margin-right: 12px; }
.action-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.description { background: var(--bg-elev); border-radius: var(--radius); padding: 12px; margin-top: 12px; }
.description.collapsed .desc-body { max-height: 66px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.desc-body { margin-top: 6px; word-break: break-word; }
.tag { color: var(--accent-text); margin-left: 4px; }
.side-title { margin: 0 0 12px; font-size: 16px; }

.comments { margin-top: 24px; }
.comments-head { display: flex; align-items: center; gap: 24px; }
.comments-head h3 { font-size: 19px; }
.comments-head select { padding: 6px 8px; }
.comment-form { display: flex; gap: 14px; margin: 8px 0 24px; }
.comment-form.reply { margin: 10px 0; gap: 10px; }
.comment-form textarea {
  width: 100%; border: none; border-bottom: 1px solid var(--border); background: transparent; resize: none;
  padding: 6px 0; outline: none; overflow: hidden;
}
.comment-form textarea:focus { border-bottom: 2px solid var(--text); }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.comment { display: flex; gap: 14px; margin-bottom: 18px; }
.comment-main { min-width: 0; flex: 1; }
.comment-head { display: flex; gap: 8px; align-items: baseline; font-size: 13px; font-weight: 600; }
.creator-tag { background: var(--bg-hover); padding: 0 8px; border-radius: 10px; }
.comment-body { margin: 2px 0 4px; word-break: break-word; }
.comment-actions { display: flex; gap: 16px; font-size: 12px; }
.replies { margin-top: 8px; }
.replies summary { color: var(--accent-text); font-weight: 600; cursor: pointer; padding: 6px 0; list-style: none; }
.replies summary::before { content: '▾ '; }
.replies:not([open]) summary::before { content: '▸ '; }
.replies .comment { margin: 10px 0; }

@media (max-width: 1100px) {
  .watch-layout, .live-layout { grid-template-columns: 1fr; }
}

/* ---------- live ---------- */
.badge-live.on-player { position: absolute; left: 12px; top: 12px; font-size: 13px; }
.player-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: rgba(0,0,0,.72); color: #fff; text-align: center; padding: 24px;
}
.player-overlay a { color: #b9a2ff; }
.unmute { position: absolute; left: 50%; bottom: 60px; transform: translateX(-50%); }
.rec-timer { position: absolute; right: 12px; top: 12px; background: rgba(0,0,0,.7); color: #fff; padding: 2px 8px; border-radius: 4px; font-weight: 700; font-variant-numeric: tabular-nums; }
.studio-preview video { transform: none; }
.studio-controls { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.device-row { margin-top: 12px; }
.seg { display: inline-flex; background: var(--bg-hover); border-radius: 18px; padding: 3px; }
.seg-btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 14px; border: none; border-radius: 15px; background: none; cursor: pointer; font-weight: 600; }
.seg-btn svg { width: 18px; height: 18px; }
.seg-btn.active { background: var(--bg); box-shadow: 0 1px 4px rgba(0,0,0,.25); }

.chat {
  display: flex; flex-direction: column; background: var(--bg-elev); border-radius: var(--radius);
  height: min(720px, calc(100vh - var(--topbar-h) - 32px)); position: sticky; top: calc(var(--topbar-h) + 16px);
  overflow: hidden;
}
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.chat-log { flex: 1; overflow-y: auto; padding: 8px 16px; display: flex; flex-direction: column; gap: 8px; }
.chat-msg { display: flex; gap: 8px; align-items: flex-start; word-break: break-word; }
.chat-msg strong { color: var(--muted); margin-right: 4px; }
.chat-msg strong.owner { color: #111; background: #ffd23f; padding: 0 5px; border-radius: 3px; }
.chat-form { display: flex; gap: 8px; align-items: center; padding: 12px; border-top: 1px solid var(--border); }
.chat-form input { flex: 1; min-width: 0; height: 34px; padding: 0 12px; border-radius: 17px; border: 1px solid var(--border); background: var(--bg-input); outline: none; }
.chat-form input:focus { border-color: var(--accent); }
@media (max-width: 1100px) { .chat { position: static; height: 480px; } }

/* ---------- upload ---------- */
.dropzone {
  display: block; border: 2px dashed var(--border); border-radius: var(--radius); padding: 64px 16px;
  text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dz-inner { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.dz-inner svg { width: 56px; height: 56px; color: var(--accent-text); }
.upload-preview { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-bottom: 16px; }
.upload-preview video { width: 100%; aspect-ratio: 16/9; background: #000; border-radius: 8px; }
.upload-preview p { margin: 0 0 6px; }
#thumb-preview { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; background: var(--bg-hover); margin-bottom: 8px; }
#thumb-preview:not([src]) { visibility: hidden; }
@media (max-width: 700px) { .upload-preview { grid-template-columns: 1fr; } }

/* ---------- studio ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 28px; }
.stat { background: var(--bg-elev); border-radius: var(--radius); padding: 16px 20px; color: var(--muted); }
.stat span { display: block; font-size: 28px; font-weight: 800; color: var(--text); }
.table-wrap { overflow-x: auto; margin-bottom: 32px; }
.studio-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.studio-table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.studio-table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.studio-table select { padding: 4px 6px; text-transform: capitalize; }
.studio-video { display: flex; gap: 12px; align-items: center; max-width: 460px; }
.mini-thumb { flex: 0 0 120px; aspect-ratio: 16/9; border-radius: 6px; overflow: hidden; background: var(--bg-hover); display: grid; place-items: center; }
.mini-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- channel ---------- */
.channel-banner {
  height: clamp(100px, 16vw, 200px); border-radius: var(--radius); margin-bottom: 20px;
  background: linear-gradient(120deg, var(--c), color-mix(in srgb, var(--c) 30%, #000) 70%);
}
.channel-header { display: flex; gap: 24px; align-items: center; margin-bottom: 16px; }
.channel-header h1 { margin: 0 0 4px; font-size: 32px; }
.channel-header p { margin: 0 0 12px; }
@media (max-width: 600px) {
  .channel-header { flex-direction: column; align-items: flex-start; }
  .channel-header .avatar { --size: 80px !important; }
}
.tabs { display: flex; gap: 8px; border-bottom: 1px solid var(--border); margin-bottom: 24px; overflow-x: auto; }
.tab { padding: 12px 16px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--text); }
.about p { max-width: 800px; }

/* ---------- auth ---------- */
.auth-box { max-width: 420px; margin: 48px auto; text-align: center; padding: 36px 32px; }
.auth-box h1 { margin: 0 0 4px; font-size: 24px; }
.auth-box form { text-align: left; margin: 24px 0 12px; }

@media (max-width: 700px) {
  .card.horizontal { flex-direction: column; gap: 8px; }
  .card.horizontal .thumb { flex-basis: auto; }
  .list.compact .card.horizontal { flex-direction: row; }
  .channel-result { flex-direction: column; align-items: flex-start; gap: 8px; }
  .channel-result > a { flex-basis: auto; }
}

/* ---------- video editor ---------- */
body.editor-page main { padding-left: 16px; padding-right: 16px; padding-bottom: 16px; }
.ed-hidden-media { position: fixed; left: 0; top: 0; width: 2px; height: 2px; overflow: hidden; opacity: 0; pointer-events: none; }
.editor { display: flex; flex-direction: column; gap: 10px; height: calc(100vh - var(--topbar-h) - 32px); min-height: 620px; }
.editor.drop { outline: 2px dashed var(--accent); outline-offset: 4px; border-radius: var(--radius); }
.ed-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.ed-title { display: flex; align-items: center; color: var(--accent-text); }
.ed-title svg { width: 24px; height: 24px; }
.ed-top-left { min-width: 0; flex: 1; }
.ed-name {
  font: 700 18px/1.2 inherit; font-family: inherit; background: transparent; border: 1px solid transparent; border-radius: 8px;
  padding: 5px 8px; min-width: 120px; width: min(360px, 40vw); outline: none; color: var(--text);
}
.ed-name:hover { border-color: var(--border); }
.ed-name:focus { border-color: var(--accent); background: var(--bg-input); }
.ed-status { font-size: 12px; color: var(--muted); white-space: nowrap; }
.ed-status.ok::before { content: '✓ '; color: #3fb950; }
.ed-status.busy { color: var(--accent-text); }
.ed-status.error { color: var(--danger); }
.icon-btn:disabled { opacity: .35; cursor: default; background: none; }
.ed-main { flex: 1; min-height: 0; display: grid; grid-template-columns: 230px minmax(0, 1fr) 300px; gap: 10px; }
.ed-panel { background: var(--bg-elev); border-radius: var(--radius); padding: 12px; overflow-y: auto; scrollbar-width: thin; }
.ed-section { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 16px 0 8px; }
.ed-section:first-child, .ed-actions + .ed-section { margin-top: 4px; }
.ed-add-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 6px; }
.ed-add-row .btn svg { width: 16px; height: 16px; }
.btn.block { width: 100%; }
.ed-bin { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.ed-asset, .ed-pick-item {
  display: grid; grid-template-columns: 56px 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 5px; cursor: pointer; text-align: left;
}
.ed-asset:hover, .ed-pick-item:hover { border-color: var(--accent); }
.ed-asset-thumb { grid-row: span 2; width: 56px; aspect-ratio: 16/9; border-radius: 4px; overflow: hidden; background: var(--bg-hover); display: grid; place-items: center; }
.ed-asset-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ed-asset-thumb svg { width: 18px; height: 18px; }
.ed-asset-name { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-asset-meta { font-size: 11px; }
.ed-add-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ed-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; height: 58px;
  background: #1b1b24; color: #fff; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-size: 12px;
}
.ed-tile:hover { border-color: var(--accent); }
.ed-tile svg { width: 20px; height: 20px; }
.ed-tile .t-title { font: 22px Impact, "Arial Black", sans-serif; -webkit-text-stroke: 1px #000; letter-spacing: .5px; }
.ed-tile .t-caption { background: rgba(0,0,0,.6); padding: 1px 6px; border-radius: 3px; font-weight: 500; }
.ed-tile .t-lower { background: var(--accent); color: var(--on-accent); padding: 2px 8px; border-radius: 3px; }

.ed-stage { position: relative; background: #0a0a0d; border-radius: var(--radius); display: grid; place-items: center; min-height: 0; overflow: hidden; padding: 10px; }
.ed-stage canvas {
  display: block; touch-action: none;
  box-shadow: 0 0 0 1px #2a2a33; background: #000;
}
.ed-empty {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  color: #fff; background: rgba(10,10,13,.92); text-align: center; padding: 16px;
}
.ed-empty svg { width: 48px; height: 48px; color: var(--accent-text); }
.ed-empty .btn { margin-top: 8px; }

.ed-tabs { display: flex; gap: 4px; background: var(--bg); padding: 3px; border-radius: 10px; margin-bottom: 8px; position: sticky; top: -12px; z-index: 1; }
.ed-tab { flex: 1; height: 30px; border: none; background: none; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--muted); }
.ed-tab.active { background: var(--bg-hover); color: var(--text); }
.ed-field { display: flex; flex-direction: column; gap: 3px; margin-bottom: 9px; font-size: 12px; }
.ed-field > span { display: flex; justify-content: space-between; color: var(--muted); }
.ed-field output { color: var(--text); font-variant-numeric: tabular-nums; }
.ed-field.inline { flex-direction: row; align-items: center; justify-content: space-between; }
.ed-field.check { flex-direction: row; align-items: center; gap: 8px; cursor: pointer; }
.ed-field.check span { color: var(--text); }
.ed-field input[type=range] { width: 100%; accent-color: var(--accent); margin: 0; }
.ed-field input[type=color] { width: 44px; height: 26px; padding: 0 2px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-input); cursor: pointer; }
.ed-field input[type=number] { width: 90px; }
.ed-field select, .ed-field input[type=text], .ed-field input[type=number], .ed-field textarea {
  padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-input); font-size: 13px; outline: none;
}
.ed-field textarea { resize: vertical; font-family: inherit; }
.ed-field select:focus, .ed-field input:focus, .ed-field textarea:focus { border-color: var(--accent); }
.ed-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.ed-actions .btn { height: 28px; padding: 0 10px; font-size: 12px; }
.ed-actions .btn svg { width: 14px; height: 14px; }
.ed-hint { padding: 8px 4px; }
.ed-hint ul { padding-left: 18px; line-height: 1.9; }
kbd { background: var(--bg-hover); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; font-size: 11px; font-family: inherit; }

.ed-timeline { background: var(--bg-elev); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 170px; max-height: 38vh; }
.ed-tl-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.ed-tl-bar .btn svg { width: 16px; height: 16px; }
.ed-time { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 150px; }
.ed-zoom { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.ed-zoom input { width: 110px; accent-color: var(--accent); }
.ed-tl-scroll { flex: 1; overflow: auto; position: relative; scrollbar-width: thin; }
.ed-tl-inner { position: relative; min-height: 100%; padding-bottom: 8px; user-select: none; }
.ed-ruler { position: sticky; top: 0; height: 24px; background: var(--bg-elev); border-bottom: 1px solid var(--border); z-index: 2; cursor: ew-resize; }
.ed-tick { position: absolute; top: 0; height: 100%; border-left: 1px solid var(--border); padding: 3px 0 0 4px; font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ed-row { position: relative; height: 30px; margin-top: 4px; }
.ed-row.clips { height: 48px; margin-top: 8px; }
.ed-row-hint { position: absolute; left: 12px; top: 14px; color: var(--muted); font-size: 12px; }
.ed-bar {
  position: absolute; top: 0; bottom: 0; display: flex; align-items: center; gap: 5px; padding: 0 12px; min-width: 8px;
  border-radius: 6px; color: #fff; font-size: 12px; font-weight: 600; cursor: grab; overflow: hidden; white-space: nowrap;
  border: 2px solid transparent; box-sizing: border-box;
}
.ed-bar:active { cursor: grabbing; }
.ed-bar svg { width: 14px; height: 14px; flex-shrink: 0; }
.ed-bar .lbl { overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.ed-bar.text { background: #0e8a7e; }
.ed-bar.image { background: #c26a12; }
.ed-bar.shape { background: #b8367a; }
.ed-bar.clip {
  background: #4b2fb0 var(--thumb, none) left center / auto 100% repeat-x;
  box-shadow: inset 0 0 0 999px rgba(60, 30, 160, .55);
  border-right-color: #0a0a0d; align-items: flex-end; padding-bottom: 4px;
}
.ed-bar.selected { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }
.ed-bar.clip.selected { box-shadow: inset 0 0 0 999px color-mix(in srgb, var(--accent) 35%, transparent), 0 0 0 2px var(--accent); }
.ed-bar .h { position: absolute; top: 0; bottom: 0; width: 9px; cursor: ew-resize; z-index: 1; }
.ed-bar .h-l { left: 0; }
.ed-bar .h-r { right: 0; }
.ed-bar .h::after { content: ''; position: absolute; top: 30%; bottom: 30%; left: 3px; width: 3px; border-radius: 2px; background: rgba(255,255,255,.7); }
.ed-playhead { position: absolute; top: 0; bottom: 0; left: 0; width: 0; pointer-events: none; z-index: 3; }
.ed-playhead::before { content: ''; position: absolute; top: 0; bottom: 0; left: -1px; width: 2px; background: #ff3b4e; }
.ed-playhead span { position: absolute; top: 0; left: -6px; border: 6px solid transparent; border-top: 9px solid #ff3b4e; }

.ed-dialog { width: min(620px, calc(100vw - 32px)); }
.ed-result { width: 100%; max-height: 50vh; background: #000; border-radius: 8px; margin: 4px 0; }
.ed-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; max-height: 60vh; overflow-y: auto; margin-bottom: 12px; }
.ed-pick-item { grid-template-rows: auto; }
.ed-pick-item .ed-asset-thumb { grid-row: auto; width: 80px; }

@media (max-width: 1200px) {
  .ed-main { grid-template-columns: 200px minmax(0, 1fr) 260px; }
}
@media (max-width: 900px) {
  .editor { height: auto; }
  .ed-main { grid-template-columns: 1fr; }
  .ed-stage { order: -1; height: 56vw; max-height: 60vh; }
  .ed-panel { max-height: 50vh; }
  .ed-timeline { max-height: none; }
  .ed-zoom { margin-left: 0; }
}

.ed-add-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.ed-add-row.three .btn { padding: 0 4px; gap: 3px; font-size: 12px; min-width: 0; overflow: hidden; }
.ed-add-row.three .btn svg { width: 14px; height: 14px; }
.ed-asset-thumb.audio { background: #1f6f43; color: #fff; }
.ed-loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: #fff; background: rgba(10,10,13,.9); }
.ed-open-projects { margin-top: 18px; width: min(560px, 100%); }
.ed-open-projects > p { margin: 0 0 8px; }
.ed-proj-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.ed-proj {
  display: grid; grid-template-columns: 56px 1fr; column-gap: 8px; align-items: center; text-align: left;
  background: #17171d; border: 1px solid #2c2c36; border-radius: 8px; padding: 5px; color: #fff;
}
.ed-proj:hover { border-color: var(--accent); }
.ed-proj .ed-asset-thumb { background: #25252e; }
.ed-proj .ed-asset-meta { color: #a3a3b2; font-size: 11px; }

.ed-row.audio { height: 34px; }
.ed-bar.audio { background: #1f6f43; }
.ed-bar.audio svg { position: relative; }
.ed-bar.audio .lbl, .ed-bar.audio svg { z-index: 1; }
.ed-wave { position: absolute; left: 0; top: 50%; transform: translateY(-50%); height: 26px; pointer-events: none; opacity: .9; }
.ed-bar.missing { background: repeating-linear-gradient(45deg, #5a2a2a, #5a2a2a 8px, #6e3232 8px, #6e3232 16px) !important; }
.ed-bar.clip::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: var(--td, 0px);
  background: linear-gradient(90deg, rgba(255,255,255,.35), rgba(255,255,255,0)); pointer-events: none;
}
.ed-trans {
  position: absolute; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; z-index: 2; padding: 0;
  display: grid; place-items: center; border-radius: 50%; border: 2px solid var(--bg-elev); cursor: pointer;
  background: var(--bg-hover); color: var(--muted); opacity: .75;
}
.ed-trans svg { width: 12px; height: 12px; }
.ed-trans:hover { opacity: 1; color: var(--text); }
.ed-trans.on { background: var(--accent); color: var(--on-accent); opacity: 1; }
.ed-endline { position: absolute; top: 24px; bottom: 0; width: 0; border-left: 2px dashed var(--muted); opacity: .5; pointer-events: none; z-index: 1; }
.grid.projects { margin-bottom: 28px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid.projects .card-body { align-items: flex-start; }

/* ---------- live connection diagnostics ---------- */
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.checks li { position: relative; padding-left: 28px; }
.checks li::before { position: absolute; left: 0; top: 0; width: 20px; text-align: center; font-weight: 800; }
.checks li.ok::before { content: '✓'; color: #3fb950; }
.checks li.warn::before { content: '!'; color: #d29922; }
.checks li.bad::before { content: '✕'; color: var(--danger); }
.checks li.pending::before { content: '…'; color: var(--muted); }
.checks li span { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.live-health { margin: 6px 0 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.ok { background: #3fb950; }
.dot.warn { background: #d29922; }
.dot.bad { background: var(--danger); }
.warn-text { color: #d29922; }
.player-overlay p { max-width: 520px; }

/* ---------- watch page layout (theater mode moves the player above both columns) ---------- */
.watch-layout {
  grid-template-areas: "player side" "main side"; grid-template-rows: auto 1fr; row-gap: 0; align-items: start;
}
.watch-layout .player-area { grid-area: player; }
.watch-layout .watch-main { grid-area: main; }
.watch-layout .watch-side { grid-area: side; }
.watch-layout.theater { grid-template-areas: "player player" "main side"; }
.watch-layout.theater .player-wrap { aspect-ratio: auto; height: min(56.25vw, calc(100vh - 150px)); max-height: none; }
.watch-layout.theater .watch-side { margin-top: 12px; }
@media (max-width: 1100px) {
  .watch-layout, .watch-layout.theater { grid-template-columns: minmax(0, 1fr); grid-template-areas: "player" "main" "side"; grid-template-rows: none; }
}

/* ---------- video player ---------- */
.vp {
  position: absolute; inset: 0; background: #000; color: #fff; overflow: hidden; outline: none;
  user-select: none; -webkit-user-select: none; font-size: 13px; container-type: inline-size;
}
.vp:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.vp video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.vp:fullscreen, .vp.fullscreen { width: 100vw; height: 100vh; border-radius: 0; }
.vp-click { position: absolute; inset: 0; z-index: 1; cursor: pointer; }
.vp.idle, .vp.idle .vp-click { cursor: none; }
.vp .spinner { border-color: rgba(255,255,255,.25); border-top-color: #fff; width: 48px; height: 48px; }
.vp-spinner { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 2; }

.vp-controls {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; padding: 48px 12px 4px;
  background: linear-gradient(to top, rgba(0,0,0,.78), rgba(0,0,0,.35) 55%, transparent);
  transition: opacity .25s;
}
.vp.idle .vp-controls, .vp.idle .vp-chip { opacity: 0; pointer-events: none; }
.vp.paused .vp-controls { opacity: 1; pointer-events: auto; }

.vp-progress { position: relative; height: 18px; display: flex; align-items: center; cursor: pointer; touch-action: none; }
.vp-rail { position: relative; width: 100%; height: 4px; background: rgba(255,255,255,.25); border-radius: 2px; transition: height .12s; }
.vp-progress:hover .vp-rail, .vp.scrubbing .vp-rail { height: 6px; }
.vp-buffered, .vp-hoverfill, .vp-played { position: absolute; left: 0; top: 0; bottom: 0; border-radius: inherit; width: 0; }
.vp-buffered { background: rgba(255,255,255,.4); }
.vp-hoverfill { background: rgba(255,255,255,.35); }
.vp-played { background: var(--accent); }
.vp-chapters i { position: absolute; top: 0; bottom: 0; width: 3px; margin-left: -1px; background: #000; }
.vp-knob {
  position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%;
  background: var(--accent); transform: scale(0); transition: transform .12s; pointer-events: none;
}
.vp-progress:hover .vp-knob, .vp.scrubbing .vp-knob { transform: scale(1); }
.vp-tip {
  position: absolute; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 4px;
  pointer-events: none; text-shadow: 0 1px 3px rgba(0,0,0,.8);
}
.vp-tip canvas { width: 176px; height: 99px; border-radius: 6px; border: 2px solid rgba(255,255,255,.9); background: #111; }
.vp-tip-chapter { font-weight: 600; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vp-tip-chapter:empty { display: none; }
.vp-tip-time { font-weight: 700; font-variant-numeric: tabular-nums; }

.vp-bar { display: flex; align-items: center; gap: 2px; height: 44px; }
.vp-btn {
  position: relative; width: 42px; height: 42px; flex-shrink: 0; display: grid; place-items: center;
  background: none; border: none; color: #fff; cursor: pointer; opacity: .9; border-radius: 8px;
}
.vp-btn:hover { opacity: 1; background: rgba(255,255,255,.08); }
.vp-btn:focus-visible, .vp button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.vp-btn svg { width: 24px; height: 24px; stroke-width: 2; }
.vp-speedbadge { position: absolute; right: 2px; top: 6px; font-size: 9px; background: var(--accent); color: var(--on-accent); border-radius: 3px; padding: 0 2px; line-height: 1.3; }
.vp-volume { display: flex; align-items: center; }
.vp-vol {
  -webkit-appearance: none; appearance: none; width: 0; height: 4px; margin: 0; border-radius: 2px; opacity: 0; cursor: pointer;
  background: linear-gradient(to right, #fff var(--fill, 100%), rgba(255,255,255,.3) var(--fill, 100%));
  transition: width .2s, opacity .2s, margin .2s;
}
.vp-volume:hover .vp-vol, .vp-volume:focus-within .vp-vol { width: 72px; opacity: 1; margin: 0 8px 0 2px; }
.vp-vol::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: none; }
.vp-vol::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: none; }
.vp-time { margin: 0 8px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.vp-chapter { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; opacity: .9; }
.vp-spacer { flex: 1; }
.vp-livebadge { display: inline-flex; align-items: center; gap: 6px; margin: 0 8px; font-weight: 800; letter-spacing: .5px; }
.vp-livebadge span { width: 8px; height: 8px; border-radius: 50%; background: var(--live); animation: pulse 1.6s infinite; }
.vp-autoplay { position: relative; display: flex; align-items: center; padding: 0 8px; cursor: pointer; }
.vp-autoplay input { position: absolute; opacity: 0; pointer-events: none; }
.vp-switch { width: 30px; height: 14px; border-radius: 7px; background: rgba(255,255,255,.35); position: relative; transition: background .15s; }
.vp-switch::after {
  content: '▶'; position: absolute; left: -2px; top: -3px; width: 20px; height: 20px; border-radius: 50%; background: #ddd; color: #333;
  font-size: 8px; display: grid; place-items: center; transition: transform .15s;
}
.vp-autoplay input:checked + .vp-switch { background: var(--accent); }
.vp-autoplay input:checked + .vp-switch::after { transform: translateX(14px); background: #fff; }
.vp-autoplay input:focus-visible + .vp-switch { outline: 2px solid var(--accent); outline-offset: 2px; }

.vp-bigplay {
  position: absolute; left: 50%; top: 50%; width: 76px; height: 76px; margin: -38px 0 0 -38px; z-index: 2;
  border-radius: 50%; border: none; background: rgba(0,0,0,.55); color: #fff; cursor: pointer; display: none; place-items: center;
  transition: background .15s, transform .15s;
}
.vp-bigplay svg { width: 38px; height: 38px; margin-left: 4px; }
.vp-bigplay:hover { background: var(--accent); color: var(--on-accent); transform: scale(1.06); }
.vp.paused:not(.started) .vp-bigplay { display: grid; }
.vp-flash {
  position: absolute; left: 50%; top: 50%; z-index: 2; min-width: 64px; height: 64px; margin: -32px 0 0 -32px; padding: 0 16px;
  border-radius: 32px; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; gap: 6px;
  pointer-events: none; opacity: 0; font-weight: 700; font-size: 15px;
}
.vp-flash svg { width: 32px; height: 32px; }
.vp-flash.show { animation: vp-flash .6s ease-out; }
@keyframes vp-flash { 0% { opacity: .95; transform: scale(.85); } 100% { opacity: 0; transform: scale(1.25); } }
.vp-seekhint {
  position: absolute; top: 0; bottom: 0; width: 33%; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; font-weight: 700; pointer-events: none; opacity: 0; background: rgba(255,255,255,.06);
}
.vp-seekhint svg { width: 34px; height: 34px; }
.vp-seekhint.left { left: 0; border-radius: 0 50% 50% 0; }
.vp-seekhint.right { right: 0; border-radius: 50% 0 0 50%; }
.vp-seekhint.show { animation: vp-hint .7s ease-out; }
@keyframes vp-hint { 0%, 40% { opacity: 1; } 100% { opacity: 0; } }
.vp-unmute {
  position: absolute; left: 12px; top: 12px; z-index: 4; display: flex; align-items: center; gap: 6px; padding: 6px 12px 6px 8px;
  border: none; border-radius: 18px; background: rgba(255,255,255,.92); color: #111; font-weight: 700; cursor: pointer;
}
.vp-unmute svg { width: 20px; height: 20px; }
.vp-chip {
  position: absolute; left: 12px; bottom: 76px; z-index: 3; background: rgba(0,0,0,.7); padding: 6px 10px; border-radius: 6px;
  transition: opacity .25s;
}
.vp-chip button { margin-left: 8px; background: none; border: none; color: #b9a2ff; font-weight: 700; cursor: pointer; }
.vp-error {
  position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; padding: 24px; text-align: center; background: rgba(0,0,0,.85);
  font-size: 15px;
}
.vp-end { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; background: rgba(0,0,0,.72); }
.vp-end-replay, .vp-upnext-actions button {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border: none; border-radius: 22px; cursor: pointer;
  font-weight: 700; background: rgba(255,255,255,.15); color: #fff;
}
.vp-end-replay svg, .vp-upnext-actions svg { width: 20px; height: 20px; }
.vp-upnext { display: flex; flex-direction: column; gap: 12px; width: min(420px, 86%); }
.vp-upnext-label { color: #ccc; font-size: 14px; }
.vp-upnext-label b { color: #fff; }
.vp-upnext-card { display: flex; gap: 12px; align-items: center; }
.vp-upnext-card img { width: 160px; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; }
.vp-upnext-card strong { display: block; font-size: 16px; }
.vp-upnext-card span { color: #bbb; }
.vp-upnext-actions { display: flex; gap: 10px; }
.vp-upnext-actions .vp-playnow { background: #fff; color: #111; }
.vp-menu {
  position: absolute; right: 12px; bottom: 60px; z-index: 5; min-width: 250px; max-height: 70%; overflow-y: auto; padding: 6px 0;
  background: rgba(22, 22, 28, .95); border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.5);
}
.vp-menu button {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; padding: 9px 16px;
  background: none; border: none; color: #fff; cursor: pointer; text-align: left; font-size: 14px;
}
.vp-menu button:hover { background: rgba(255,255,255,.1); }
.vp-menu button b { font-weight: 500; color: #bbb; }
.vp-menu button[role=menuitemradio] { justify-content: flex-start; gap: 8px; }
.vp-check { width: 20px; display: inline-grid; }
.vp-check svg { width: 18px; height: 18px; }
.vp-menu-back { font-weight: 700; border-bottom: 1px solid rgba(255,255,255,.12) !important; margin-bottom: 4px; }
.vp-keys { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 6px 16px 10px; font-size: 13px; }
.vp-keys dt { font-weight: 700; white-space: nowrap; }
.vp-keys dd { margin: 0; color: #ccc; }
.vp .player-overlay { z-index: 2; }

@container (max-width: 480px) {
  .vp-btn { width: 36px; height: 36px; }
  .vp-chapter, .vp-autoplay { display: none; }
  .vp-upnext-card img { width: 110px; }
}
@media (hover: none) {
  .vp-vol { display: none; }
  .vp-knob { transform: scale(1); }
}
.desc-body a.ts, .comment-body a.ts { color: var(--accent-text); font-weight: 600; }

/* ---------- profile pictures & banners ---------- */
img.avatar { object-fit: cover; background: var(--bg-hover); display: inline-block; }
.channel-banner { position: relative; overflow: hidden; }
.channel-banner.has-image { background: var(--bg-hover); aspect-ratio: 6 / 1; height: auto; max-height: 240px; }
.channel-banner img { width: 100%; height: 100%; object-fit: cover; }
.banner-edit { position: absolute; right: 12px; bottom: 12px; background: rgba(0,0,0,.6); color: #fff; }
.banner-edit svg { width: 16px; height: 16px; }
.channel-avatar { position: relative; flex-shrink: 0; }
.avatar-edit {
  position: absolute; right: 2px; bottom: 2px; width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--bg);
  background: var(--accent); color: var(--on-accent); display: grid; place-items: center; cursor: pointer;
}
.avatar-edit svg { width: 18px; height: 18px; }
.channel-link-row { display: flex; align-items: center; gap: 6px; }
.channel-link-row svg { width: 16px; height: 16px; }
.channel-link-row a:first-of-type, .channel-links a { color: var(--accent-text); }
.channel-links { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.channel-links li { display: flex; align-items: center; gap: 8px; }
.channel-links svg { width: 18px; height: 18px; }
.customize-media { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.links-editor { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin: 0 0 12px; }
.links-editor legend { font-weight: 600; font-size: 13px; padding: 0 4px; }
.link-row { margin-bottom: 6px; }
.link-row input { flex: 1; min-width: 0; padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-input); }
.link-row input:first-child { flex: 0 0 34%; }
.cropper { width: auto; max-width: calc(100vw - 32px); }
.crop-stage { border-radius: 8px; overflow: hidden; margin: 8px 0 12px; touch-action: none; }
.crop-stage canvas { display: block; cursor: grab; }
.crop-stage canvas:active { cursor: grabbing; }
.cropper input[type=range] { accent-color: var(--accent); }

/* ---------- notices ---------- */
.announcement {
  margin: calc(var(--topbar-h) + 8px) 24px -8px calc(var(--sidebar-w) + 24px); padding: 10px 12px 10px 16px; border-radius: 10px;
  background: var(--accent-soft); border: 1px solid var(--accent); display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.announcement + main { padding-top: 16px; }
.announcement a { color: var(--accent-text); }
body.sidebar-collapsed .announcement { margin-left: calc(var(--sidebar-w-collapsed) + 24px); }
@media (max-width: 900px) { .announcement { margin-left: 16px; margin-right: 16px; } }
.notice { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; }
.notice svg { width: 20px; height: 20px; }
.notice.error { background: rgba(229, 72, 77, .12); border: 1px solid var(--danger); }
.removed-note { color: var(--danger); font-size: 12px; font-weight: 600; }

/* ---------- community posts ---------- */
.community { max-width: 760px; }
.post-list { display: flex; flex-direction: column; gap: 16px; }
.post { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; background: var(--bg); }
.post-head { display: flex; gap: 12px; align-items: flex-start; }
.post-head .grow { display: flex; flex-direction: column; }
.post-author { font-weight: 700; }
.post-body { margin: 10px 0 0 52px; word-break: break-word; white-space: normal; }
.post-body a, .post-page .comment-body a { color: var(--accent-text); }
.post-image { display: block; margin: 12px 0 0 52px; }
.post-image img { max-width: 100%; max-height: 520px; border-radius: 10px; object-fit: contain; background: var(--bg-hover); }
.post-actions { display: flex; gap: 8px; margin: 12px 0 0 52px; }
.post-menu { right: 0; left: auto; min-width: 180px; }
.poll { margin: 12px 0 0 52px; display: flex; flex-direction: column; gap: 8px; max-width: 520px; }
.poll-option {
  position: relative; display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--border); background: var(--bg-elev); cursor: pointer; text-align: left; font-weight: 600;
}
.poll-option:hover { border-color: var(--accent); }
.poll-option.result::before {
  content: ''; position: absolute; inset: 0 auto 0 0; width: var(--pct); background: var(--accent-soft); transition: width .4s; z-index: 0;
}
.poll-option.result.mine { border-color: var(--accent); }
.poll-option span { position: relative; z-index: 1; }
.poll-option b { color: var(--accent-text); }
.poll .muted { margin: 0; }
.composer { margin: 0 0 16px; }
.composer-top textarea {
  flex: 1; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: var(--bg-input); resize: vertical; outline: none;
}
.composer-top textarea:focus { border-color: var(--accent); }
.composer-image { position: relative; margin: 12px 0 0 52px; display: inline-block; }
.composer-image img { max-height: 240px; max-width: 100%; border-radius: 8px; display: block; }
.composer-image button { position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,.6); color: #fff; }
.composer-poll { margin: 12px 0 0 52px; display: flex; flex-direction: column; gap: 8px; }
.poll-inputs { display: flex; flex-direction: column; gap: 6px; }
.poll-input { padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-input); max-width: 420px; }
.composer .row.between { margin-top: 12px; }
.composer .btn svg { width: 16px; height: 16px; }
.post-page .post { margin-bottom: 8px; }

/* ---------- reports ---------- */
.report-reasons { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 16px; margin: 8px 0 12px; }
.report-reasons .check { margin: 4px 0; }
.report-form h2 { display: flex; align-items: center; gap: 8px; }
.report-form h2 svg { width: 22px; height: 22px; }
@media (max-width: 520px) { .report-reasons { grid-template-columns: 1fr; } }

/* ---------- admin ---------- */
.admin-tabs { margin-bottom: 20px; }
.admin-stat { display: block; color: var(--muted); }
a.admin-stat[href]:hover { outline: 1px solid var(--accent); }
.admin-stat small { display: block; font-size: 12px; margin-top: 2px; }
.admin-list { display: flex; flex-direction: column; gap: 10px; max-width: 900px; }
.admin-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.admin-search { margin-bottom: 16px; }
.admin-search input, .admin-search select { padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-input); }
.admin-search input { width: min(320px, 100%); }
.admin-table td { vertical-align: middle; }
.report-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.report-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.badge-type, .badge-reason, .badge-count { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 10px; text-transform: uppercase; letter-spacing: .3px; }
.badge-type { background: var(--accent-soft); color: var(--accent-text); }
.badge-reason { background: rgba(229, 72, 77, .14); color: var(--danger); }
.badge-count { background: rgba(210, 153, 34, .16); color: #d29922; }
.report-details { margin: 0; font-style: italic; }
.report-target { display: flex; gap: 12px; padding: 10px; border-radius: 8px; background: var(--bg-elev); }
.report-target img { width: 120px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.report-target p { margin: 4px 0; }
.report-target a { color: var(--accent-text); }
.narrow-left { max-width: 640px; }
code { background: var(--bg-hover); padding: 1px 5px; border-radius: 4px; font-size: 13px; }

/* ---------- processing / quality ---------- */
.processing-note { margin-top: 8px; padding: 8px 12px; border-radius: 8px; background: var(--accent-soft); font-size: 13px; }
.vp-qbadge { position: absolute; right: 0; top: 4px; font-size: 8px; font-weight: 900; background: var(--live); border-radius: 3px; padding: 0 2px; line-height: 1.35; }
.vp-speedbadge:not([hidden]) + .vp-qbadge { top: 20px; }
.vp-menu sup { font-size: 9px; font-weight: 800; color: var(--live); margin-left: 4px; }

/* ---------- skeleton loaders ---------- */
.skeleton-page { animation: sk-fade-in .2s ease-out 90ms both; }
@keyframes sk-fade-in { from { opacity: 0; } to { opacity: 1; } }
.sk {
  background: linear-gradient(90deg, var(--bg-hover) 0%, var(--bg-hover) 35%, var(--border) 50%, var(--bg-hover) 65%, var(--bg-hover) 100%);
  background-size: 300% 100%;
  animation: sk-shimmer 1.4s ease-in-out infinite;
  border-radius: 6px;
}
@keyframes sk-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
.sk-line { height: 12px; max-width: 100%; }
.sk-line.sm { height: 10px; }
.sk-line.lg { height: 18px; }
.sk-title { width: 200px; height: 24px; margin: 8px 0 24px; }
.sk-circle { width: var(--size); height: var(--size); border-radius: 50%; flex: none; }
.sk-lines { display: flex; flex-direction: column; gap: 9px; flex: 1; min-width: 0; padding-top: 2px; }
.sk-row { display: flex; gap: 12px; align-items: center; }
.sk-thumb { aspect-ratio: 16 / 9; border-radius: var(--radius); }
.card.horizontal .sk-thumb { flex: 0 0 min(360px, 42%); }
.list.compact .card.horizontal .sk-thumb { flex-basis: 168px; border-radius: 8px; }
.sk-player { aspect-ratio: 16 / 9; border-radius: var(--radius); }
.sk-channel { margin: 18px 0; }
.sk-box { height: 90px; border-radius: var(--radius); margin-bottom: 24px; }
.sk-box.tall { height: 240px; margin-top: 24px; }
.sk-banner { height: clamp(90px, 16vw, 200px); border-radius: var(--radius); }
.sk-channel-head { margin: 20px 0 28px; gap: 20px; }
.sk-chips { display: flex; gap: 10px; padding-bottom: 16px; }
.sk-chip { width: 72px; height: 32px; border-radius: 8px; }
.sk-post { display: flex; flex-direction: column; gap: 16px; margin-bottom: 16px; }
.sk-comments { margin-top: 8px; }
.sk-comments .comment { align-items: flex-start; }
.sk-generic { max-width: 700px; }
@media (prefers-reduced-motion: reduce) {
  .sk { animation: none; }
}

/* ---------- appearance picker ---------- */
.menu.appearance-menu { min-width: 280px; padding: 12px 14px 14px; }
.appearance-menu .menu-back { padding: 4px 6px 10px; margin: -4px 0 8px; border-bottom: 1px solid var(--border); font-weight: 600; width: auto; }
.appearance-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 6px 2px 8px; }
.theme-options { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px; }
.menu .theme-option, .theme-option {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; width: 100%;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text);
  cursor: pointer; font: inherit; text-align: left;
}
.menu .theme-option:hover, .theme-option:hover { background: var(--bg-hover); }
.theme-option[aria-checked="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.theme-swatch { width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--border); flex: none; }
.accent-options { display: flex; gap: 10px; flex-wrap: wrap; padding: 2px; }
.menu .accent-option, .accent-option {
  width: 32px; height: 32px; padding: 0; border-radius: 50%; border: 2px solid transparent;
  background: var(--swatch); display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 0 0 2px var(--bg-elev) inset;
}
.menu .accent-option:hover, .accent-option:hover { background: var(--swatch); transform: scale(1.08); }
.accent-option svg { width: 16px; height: 16px; stroke: #0b0b0e; stroke-width: 3; fill: none; opacity: 0; }
.accent-option[aria-checked="true"] { border-color: var(--text); }
.accent-option[aria-checked="true"] svg { opacity: 1; }
.menu-value { margin-left: auto; color: var(--muted); font-size: 13px; }
.theme-btn svg { width: 22px; height: 22px; }
.card-panel .theme-options { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

/* ---------- notifications ---------- */
.bell-btn { position: relative; }
.bell-btn svg { width: 22px; height: 22px; }
.bell-badge {
  position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--live); color: #fff; font-size: 11px; font-weight: 700;
  line-height: 18px; text-align: center; border: 2px solid var(--bg); box-sizing: content-box;
}
.menu.notif-menu { width: min(420px, calc(100vw - 24px)); padding: 0; right: -90px; }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--border); }
.notif-head strong { font-size: 16px; }
.menu .notif-head .icon-btn { width: 36px; padding: 0; justify-content: center; }
.notif-list { max-height: min(70vh, 560px); overflow-y: auto; overscroll-behavior: contain; }
.notif-loading { display: grid; place-items: center; padding: 40px 0; }
.menu .notif, .notif {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px 12px 8px; width: 100%;
  color: var(--text); text-decoration: none; border-radius: 0;
}
.menu .notif:hover, .notif:hover { background: var(--bg-hover); }
.notif-dot { width: 8px; height: 8px; margin-top: 16px; border-radius: 50%; flex: none; }
.notif.unread .notif-dot { background: var(--accent); }
.notif.unread { background: var(--accent-soft); }
.notif-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.notif-text {
  font-size: 14px; line-height: 1.4; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.notif-quote { color: var(--muted); }
.notif-time { font-size: 12px; color: var(--muted); }
.notif-thumb { flex: none; width: 86px; aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; background: var(--bg-hover); }
.notif-thumb img { width: 100%; height: 100%; object-fit: cover; }
.menu .notif-all, .notif-all { justify-content: center; border-top: 1px solid var(--border); padding: 12px; font-weight: 600; color: var(--accent-text); }
.notif-empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.notif-empty svg { width: 48px; height: 48px; opacity: .6; }
.notif-empty p { margin: 8px 0 4px; font-weight: 600; color: var(--text); }
.notif-error { padding: 24px; }
.notif-page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.notif-page-head .page-title svg { width: 26px; height: 26px; }
.notif-actions { display: flex; gap: 8px; }
.notif-page-list { padding: 6px 0; overflow: hidden; }
.notif-page .notif { padding-left: 12px; }
#load-more { margin-bottom: 20px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.switch-row:last-child { border-bottom: none; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch { flex: none; width: 40px; height: 22px; border-radius: 11px; background: var(--bg-hover); border: 1px solid var(--border); position: relative; transition: background .15s; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.switch-row input:checked + .switch { background: var(--accent); border-color: var(--accent); }
.switch-row input:checked + .switch::after { transform: translateX(18px); background: var(--on-accent); }
.switch-row input:focus-visible + .switch { outline: 2px solid var(--accent); outline-offset: 2px; }
.comment.highlight { background: var(--accent-soft); border-radius: var(--radius); padding: 8px; margin-left: -8px; animation: highlight-fade 4s ease-out 2s forwards; }
@keyframes highlight-fade { to { background: transparent; } }
.sk-notif { padding: 12px 14px; }
.sk-notif-thumb { width: 86px; aspect-ratio: 16 / 9; flex: none; }
@media (max-width: 600px) {
  .menu.notif-menu { position: fixed; top: calc(var(--topbar-h) + 4px); left: 12px; right: 12px; width: auto; }
}
.vp-menu-title { padding: 8px 14px 6px; font-weight: 700; border-bottom: 1px solid rgba(255,255,255,.12); margin-bottom: 4px; }

/* ---------- streaming software (OBS) ---------- */
.golive-tabs { margin-bottom: 20px; }
.golive-tabs .tab { display: inline-flex; align-items: center; gap: 8px; }
.golive-tabs .tab svg { width: 18px; height: 18px; }
.obs-preview { display: grid; place-items: center; background: #000; }
.obs-offline { color: #a3a3b2; text-align: center; padding: 24px; }
.obs-offline svg { width: 44px; height: 44px; opacity: .6; }
.obs-status { margin-top: 16px; }
.obs-state { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.obs-state .grow { flex: 1; min-width: 220px; }
.obs-state p { margin: 4px 0 0; }
.obs-state .dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 5px; background: var(--muted); flex: none; }
.obs-state.live .dot { background: var(--live); box-shadow: 0 0 0 4px color-mix(in srgb, var(--live) 25%, transparent); animation: pulse 1.6s ease-in-out infinite; }
.obs-state.live strong { color: var(--live); }
.obs-state.reconnecting .dot { background: #d29922; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px transparent; } }
.obs-urls { margin: 10px 0 0; }
.obs-urls a { color: var(--accent-text); }
.copy-row { display: flex; gap: 8px; margin-top: 6px; }
.copy-row input { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.obs-tips summary { cursor: pointer; font-weight: 600; margin-top: 8px; }
.obs-tips li { margin: 6px 0; }
.warning-panel { border-color: #d29922; }
.owner-note { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 12px; border-radius: var(--radius); background: var(--accent-soft); }
.owner-note svg { width: 18px; height: 18px; color: var(--live); }
.owner-note a { color: var(--accent-text); font-weight: 600; }
@media (max-width: 600px) {
  .copy-row { flex-wrap: wrap; }
  .copy-row input { flex-basis: 100%; }
}
.obs-player { position: absolute; inset: 0; }
.obs-preview { position: relative; }

/* ---------- categories ---------- */
.chip-sep { flex: none; width: 1px; height: 24px; align-self: center; background: var(--border); margin: 0 2px; }
.nav-emoji { width: 24px; text-align: center; font-size: 17px; line-height: 1; flex: none; }
.nav-more > summary { list-style: none; cursor: pointer; }
.nav-more > summary::-webkit-details-marker { display: none; }
.nav-more[open] > summary .nav-emoji { transform: rotate(180deg); }
.category-link { color: var(--accent-text); font-weight: 600; }
.category-head { display: flex; align-items: center; gap: 20px; margin: 8px 0 20px; }
.category-head h1 { margin: 0 0 4px; font-size: 28px; }
.category-head p { margin: 0; max-width: 700px; }
.category-icon {
  width: 72px; height: 72px; border-radius: 20px; display: grid; place-items: center; font-size: 38px; flex: none;
  background: var(--accent-soft);
}
.load-more { margin: 24px 0; }
.cat-admin-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.cat-admin-row:last-child { border-bottom: none; }
.cat-admin-row .category-icon { width: 40px; height: 40px; font-size: 22px; border-radius: 12px; }
.cat-admin-row .grow { min-width: 0; }
.cat-admin-row code { font-size: 12px; }
.cat-admin-form { display: grid; grid-template-columns: 90px 1fr; gap: 10px 12px; align-items: end; }
.cat-admin-form .full { grid-column: 1 / -1; }
.cat-admin-form input[name=icon] { text-align: center; font-size: 20px; }
.cat-edit { padding: 12px; background: var(--bg-hover); border-radius: var(--radius); margin: 4px 12px 12px; }
.admin-cat-select { max-width: 170px; }
.sys-info { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 14px; }
.sys-info dt { color: var(--muted); }
.sys-info dd { margin: 0; }

/* ---------- hover previews (storyboards) ---------- */
.sb-preview {
  position: absolute; inset: 0; z-index: 1; background-repeat: no-repeat; background-color: #000;
  animation: sb-in .15s ease-out;
}
@keyframes sb-in { from { opacity: 0; } to { opacity: 1; } }
.sb-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.25); }
.sb-bar i { display: block; height: 100%; width: 0; background: var(--live); transition: width .2s linear; }
.thumb .duration, .thumb .badge-stream { z-index: 2; }
.thumb.previewing .duration { bottom: 10px; }
.card:hover .thumb.previewing img { transform: none; }

/* ---------- footer ---------- */
body { display: flex; flex-direction: column; }
main { flex: 1 0 auto; min-height: calc(100vh - 200px); }
.site-footer {
  margin-left: var(--sidebar-w); padding: 28px 24px 24px; border-top: 1px solid var(--border);
  background: var(--bg-elev); font-size: 14px;
}
body.sidebar-collapsed .site-footer { margin-left: var(--sidebar-w-collapsed); }
body.editor-page .site-footer { display: none; }
.site-footer-inner { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: 24px; max-width: 1200px; }
.site-footer-brand .logo { font-size: 17px; }
.site-footer-brand p { margin: 8px 0 0; max-width: 240px; }
.site-footer-col { display: flex; flex-direction: column; gap: 7px; }
.site-footer-col h4 { margin: 0 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.site-footer-col a { color: var(--text); opacity: .85; }
.site-footer-col a:hover { opacity: 1; color: var(--accent-text); }
.site-footer-legal { margin: 24px 0 0; }
.nav-footer-links { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 8px; }
.nav-footer-links a { color: var(--muted); }
.nav-footer-links a:hover { color: var(--text); }
.nav-footer p { margin: 0; }
@media (max-width: 900px) {
  .site-footer, body.sidebar-collapsed .site-footer { margin-left: 0; padding: 24px 16px; }
  .site-footer-inner { grid-template-columns: repeat(2, 1fr); }
  .site-footer-brand { grid-column: 1 / -1; }
}

/* ---------- legal pages ---------- */
.legal-layout { display: grid; grid-template-columns: 220px minmax(0, 760px); gap: 32px; max-width: 1040px; margin: 0 auto; }
.legal-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: calc(var(--topbar-h) + 16px); align-self: start; }
.legal-nav a { padding: 9px 12px; border-radius: 8px; color: var(--text); }
.legal-nav a:hover { background: var(--bg-hover); }
.legal-nav a.active { background: var(--bg-hover); font-weight: 600; }
.legal-doc { line-height: 1.65; }
.legal-doc h1 { margin: 0 0 4px; font-size: 28px; }
.legal-doc h2 { margin: 28px 0 8px; font-size: 19px; }
.legal-doc h3 { margin: 20px 0 6px; font-size: 16px; }
.legal-doc ul { padding-left: 22px; }
.legal-doc li { margin: 4px 0; }
.legal-doc a { color: var(--accent-text); }
.legal-doc code { background: var(--bg-hover); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.dmca-form { margin-top: 32px; }
.dmca-form .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.dmca-form .check { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; line-height: 1.45; }
.dmca-form .check input { margin-top: 4px; flex: none; }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 20px; overflow: hidden; margin-bottom: 6px; }
.segmented label { padding: 7px 14px; cursor: pointer; font-size: 14px; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label:has(input:checked) { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.segmented label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
.turnstile-box { min-height: 65px; margin: 12px 0 4px; }
@media (max-width: 900px) {
  .legal-layout { grid-template-columns: 1fr; gap: 12px; }
  .legal-nav { position: static; flex-direction: row; overflow-x: auto; gap: 6px; }
  .legal-nav a { white-space: nowrap; background: var(--bg-elev); }
  .dmca-form .grid-2 { grid-template-columns: 1fr; }
}
.pre-wrap { white-space: pre-wrap; }

/* ---------- captions ---------- */
.vp-captions {
  position: absolute; left: 50%; bottom: 64px; transform: translateX(-50%); z-index: 3;
  width: max-content; max-width: 90%; display: flex; flex-direction: column; align-items: center; gap: 2px;
  pointer-events: none; text-align: center; transition: bottom .2s;
  font-size: clamp(13px, 2.6cqw, 34px); line-height: 1.3; font-weight: 500;
}
.vp-captions span { background: rgba(8, 8, 8, .78); color: #fff; padding: .08em .35em; border-radius: 3px; white-space: pre-wrap; }
.vp.idle .vp-captions { bottom: 5%; }
.vp-live .vp-captions { bottom: 56px; }
.vp-btn.vp-cc { position: relative; }
.vp-btn.vp-cc.on::after {
  content: ''; position: absolute; left: 25%; right: 25%; bottom: 5px; height: 3px; border-radius: 2px; background: var(--accent);
}

/* ---------- transcript panel ---------- */
.transcript {
  border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 16px;
  display: flex; flex-direction: column; max-height: min(560px, 70vh); background: var(--bg-elev);
}
.transcript-head { display: flex; align-items: center; gap: 10px; padding: 10px 8px 6px 14px; }
.transcript-head h3 { margin: 0; font-size: 16px; flex: 1; }
.transcript-lang { max-width: 180px; padding: 4px 6px; }
.transcript-search { margin: 0 12px 8px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); }
.transcript-list { overflow-y: auto; padding: 0 6px 8px; position: relative; overscroll-behavior: contain; }
.transcript-row {
  display: flex; gap: 12px; width: 100%; text-align: left; padding: 7px 8px; border: none; border-radius: 8px;
  background: none; color: var(--text); font: inherit; font-size: 14px; line-height: 1.4; cursor: pointer;
}
.transcript-row:hover { background: var(--bg-hover); }
.transcript-row.active { background: var(--bg-hover); box-shadow: inset 3px 0 0 var(--accent); }
.transcript-time {
  flex: none; min-width: 42px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--accent-text); padding-top: 2px;
}

/* ---------- Studio subtitles manager ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
dialog.captions-dialog { width: min(760px, calc(100vw - 24px)); max-height: calc(100vh - 32px); }
dialog.captions-dialog:has(.cap-editor) { width: min(1180px, calc(100vw - 24px)); }
.cap-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.cap-head h2 { margin: 0; font-size: 20px; }
.cap-head > .muted { flex: 1; min-width: 0; }
.cap-head .cap-close { margin-left: auto; }
.cap-editor .cap-head h2 { flex: 1; }
.cap-auto { display: flex; gap: 16px; align-items: center; margin-top: 0; }
.cap-auto p { margin: 4px 0; }
.cap-auto .progress { margin-top: 6px; }
.cap-tracks { display: flex; flex-direction: column; gap: 6px; }
.cap-track { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--radius); background: var(--bg-hover); flex-wrap: wrap; }
.cap-add h3, .captions-dialog section h3 { font-size: 15px; margin: 18px 0 8px; }
.cap-edit-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 18px; min-height: 0; }
.cap-preview { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.cap-video { position: relative; width: 100%; background: #000; border-radius: var(--radius); overflow: hidden; container-type: inline-size; }
.cap-video video { width: 100%; aspect-ratio: 16 / 9; display: block; }
.cap-live {
  position: absolute; left: 50%; bottom: 48px; transform: translateX(-50%); display: flex; flex-direction: column;
  align-items: center; gap: 2px; pointer-events: none; max-width: 90%; text-align: center; font-size: clamp(12px, 3.4cqw, 22px);
}
.cap-live span { background: rgba(8, 8, 8, .78); color: #fff; padding: 1px 6px; border-radius: 3px; white-space: pre-wrap; }
.cap-lines { max-height: min(62vh, 640px); overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 4px; }
.cap-line {
  display: grid; grid-template-columns: auto 74px 74px 1fr auto; gap: 6px; align-items: start;
  padding: 6px; border-radius: 8px; border: 1px solid transparent;
}
.cap-line.active { border-color: var(--accent); background: var(--bg-hover); }
.cap-line input, .cap-line textarea {
  padding: 6px 7px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); font: inherit; font-size: 13px;
}
.cap-line input { font-variant-numeric: tabular-nums; min-width: 0; }
.cap-line textarea { resize: vertical; min-height: 38px; }
.cap-jump { border: none; background: var(--bg-hover); color: var(--text); border-radius: 6px; width: 30px; height: 32px; cursor: pointer; }
.cap-line-actions { display: flex; flex-direction: column; }
.cap-line-actions .icon-btn { width: 28px; height: 28px; }
@media (max-width: 800px) {
  .cap-edit-body { grid-template-columns: 1fr; }
  .cap-line { grid-template-columns: auto 1fr 1fr auto; }
  .cap-line textarea { grid-column: 1 / -1; grid-row: 2; }
}
