/* ==========================================================================
   SlideTube
   ========================================================================== */

:root {
  --bg: #ffffff;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #f2f2f2;
  --surface-3: #e5e5e5;
  --line: rgba(0, 0, 0, 0.08);
  --line-2: rgba(0, 0, 0, 0.14);
  --text: #0f0f0f;
  --text-2: #4a4a4a;
  --text-3: #6b6b6b;
  --accent: #2f6fde;
  --accent-ink: #ffffff;
  --accent-soft: rgba(47, 111, 222, 0.1);
  --accent-text: #1f5bc6;
  --logo: #2f6fde;
  --live: #d93025;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.16);
  --topbar-bg: rgba(255, 255, 255, 0.94);
  --sk: rgba(0, 0, 0, 0.06);
  --radius: 10px;
  --radius-sm: 8px;
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --top: 56px;
  --gutter: 24px;
  --guide-w: 0px;
  --cols: 4;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0f0f;
    --bg-elev: #1c1c1c;
    --surface: #161616;
    --surface-2: #272727;
    --surface-3: #3a3a3a;
    --line: rgba(255, 255, 255, 0.09);
    --line-2: rgba(255, 255, 255, 0.17);
    --text: #f1f1f1;
    --text-2: #c2c2c2;
    --text-3: #9a9a9a;
    --accent-soft: rgba(91, 140, 255, 0.16);
    --accent-text: #8ab0ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6);
    --topbar-bg: rgba(15, 15, 15, 0.94);
    --sk: rgba(255, 255, 255, 0.07);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f0f0f;
  --bg-elev: #1c1c1c;
  --surface: #161616;
  --surface-2: #272727;
  --surface-3: #3a3a3a;
  --line: rgba(255, 255, 255, 0.09);
  --line-2: rgba(255, 255, 255, 0.17);
  --text: #f1f1f1;
  --text-2: #c2c2c2;
  --text-3: #9a9a9a;
  --accent-soft: rgba(91, 140, 255, 0.16);
  --accent-text: #8ab0ff;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6);
  --topbar-bg: rgba(15, 15, 15, 0.94);
  --sk: rgba(255, 255, 255, 0.07);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; opacity: 0.4; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
code, kbd { font-family: var(--mono); font-size: 0.86em; }
kbd {
  display: inline-block; min-width: 1.6em; padding: 1px 6px; text-align: center;
  border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px;
  background: var(--surface); color: var(--text-2);
}
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--text-3); }

.i { width: 20px; height: 20px; fill: currentColor; flex: none; }
.ic-verified { width: 13px; height: 13px; margin-left: 4px; vertical-align: -1px; color: var(--text-3); }

.skip {
  position: absolute; left: 12px; top: -40px; z-index: 100; padding: 8px 12px;
  background: var(--accent); color: var(--accent-ink); border-radius: 8px; font-weight: 600;
}
.skip:focus { top: 12px; }

/* --------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 999px;
  background: var(--surface-2); color: var(--text); font-weight: 500;
  border: 1px solid transparent; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { background: var(--surface-3); }
.btn .i { width: 18px; height: 18px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-sm .i { width: 16px; height: 16px; }
.btn-ghost { background: transparent; border-color: var(--line-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-pill.on { background: var(--accent-soft); color: var(--accent-text); }
.btn-danger { color: var(--live); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-sub { background: var(--text); color: var(--bg); font-weight: 600; }
.btn-sub:hover { background: var(--text); opacity: 0.86; }
.btn-sub.on { background: var(--surface-2); color: var(--text); }
.btn-sub.on:hover { background: var(--surface-3); opacity: 1; }

.chip {
  display: inline-flex; align-items: center; height: 32px; padding: 0 12px;
  border-radius: 8px; background: var(--surface-2); color: var(--text);
  font-weight: 500; font-size: 13.5px; white-space: nowrap; transition: background 0.15s;
}
.chip:hover { background: var(--surface-3); }
.chip.on { background: var(--text); color: var(--bg); }

/* --------------------------------------------------------------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: grid; grid-template-columns: minmax(170px, 1fr) minmax(0, 640px) minmax(90px, 1fr);
  align-items: center; gap: 16px; height: var(--top); padding: 0 16px;
  background: var(--topbar-bg); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
}
.top-left { display: flex; align-items: center; gap: 8px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
.brand-mark { display: flex; }
.logo-mark { width: 28px; height: 28px; }

.search { position: relative; width: 100%; display: flex; gap: 8px; }
.search-box {
  flex: 1; display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 8px 0 14px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 999px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-ic { display: flex; color: var(--text-3); }
.search-box input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; font-size: 15px;
}
.search-box input::-webkit-search-cancel-button { display: none; }
.search-box input::placeholder { color: var(--text-3); }
.search-clear { display: flex; padding: 6px; border-radius: 999px; color: var(--text-2); }
.search-clear:hover { background: var(--surface-2); }
.search-kbd { margin-right: 4px; }
.search-box:focus-within .search-kbd { display: none; }
.search-go { display: none; }

.suggest {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; margin: 0; padding: 6px 0;
  list-style: none; background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 60;
}
.sug-head { padding: 6px 16px 4px; font-size: 12px; color: var(--text-3); font-weight: 600; }
.sug { display: flex; align-items: center; gap: 14px; padding: 0 10px 0 16px; height: 36px; cursor: pointer; color: var(--text); }
.sug .i { width: 18px; height: 18px; color: var(--text-3); }
.sug.link .i { color: var(--accent); }
.sug-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.sug-text b { font-weight: 600; }
.sug:hover, .sug.active { background: var(--surface-2); }
.sug-del { display: flex; padding: 6px; border-radius: 999px; color: var(--text-3); }
.sug-del:hover { background: var(--surface-3); color: var(--text); }

.top-nav { display: flex; justify-content: flex-end; gap: 4px; }
.top-btn {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 999px; color: var(--text);
  transition: background 0.15s;
}
.top-btn .i { width: 22px; height: 22px; }
.top-btn:hover { background: var(--surface-2); }
.top-btn.on { background: var(--surface-2); }

/* --------------------------------------------------------------- sidebar */
body[data-guide="full"] { --guide-w: 236px; }
body[data-guide="rail"] { --guide-w: 76px; }
body[data-guide="hidden"] { --guide-w: 0px; }

.guide {
  position: fixed; top: var(--top); left: 0; bottom: 0; z-index: 30; width: var(--guide-w);
  overflow-y: auto; overflow-x: hidden; padding: 8px 12px 24px; background: var(--bg); scrollbar-width: thin;
}
body[data-guide="hidden"] .guide { display: none; }
.g-sec { padding: 4px 0 8px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.g-sec:last-child { border-bottom: 0; }
.g-item {
  display: flex; align-items: center; gap: 20px; width: 100%; height: 40px; padding: 0 12px;
  border-radius: 10px; color: var(--text); font-size: 14px; text-align: left;
}
.g-item:hover { background: var(--surface-2); }
.g-item.on { background: var(--surface-2); font-weight: 600; }
.g-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-item .i { width: 22px; height: 22px; }
.g-head { padding: 8px 12px 4px; font-weight: 600; font-size: 15px; }
.g-chan img, .g-ph {
  width: 24px; height: 24px; border-radius: 50%; object-fit: cover; flex: none; background: var(--surface-3);
  display: grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--text-2);
}
.g-chan { gap: 18px; }
.g-none { padding: 4px 12px; color: var(--text-3); font-size: 13px; }
.g-railonly { display: none; }

body[data-guide="rail"] .guide { padding: 4px; }
body[data-guide="rail"] .g-full { display: none; }
body[data-guide="rail"] .g-railonly { display: flex; }
body[data-guide="rail"] .g-sec { border: 0; }
body[data-guide="rail"] .g-item { flex-direction: column; justify-content: center; gap: 6px; height: 74px; padding: 0 2px; font-size: 10px; }
body[data-guide="rail"] .g-item.on { font-weight: 500; }

body.g-drawer .guide {
  display: block; width: 236px; z-index: 70; top: 0; padding-top: calc(var(--top) + 8px);
  box-shadow: var(--shadow-lg); background: var(--bg-elev);
}
body.g-drawer .guide .g-full { display: block; }
body.g-drawer .guide .g-railonly { display: none; }
body.g-drawer .guide .g-sec { border-bottom: 1px solid var(--line); }
body.g-drawer .guide .g-item { flex-direction: row; justify-content: flex-start; gap: 20px; height: 40px; padding: 0 12px; font-size: 14px; }
body.g-drawer .topbar .top-left { position: relative; z-index: 71; }
.guide-scrim { position: fixed; inset: 0; z-index: 65; background: rgba(0, 0, 0, 0.4); }

/* --------------------------------------------------------------- pages */
#view { outline: none; margin-left: var(--guide-w); }
.page { max-width: 1760px; margin: 0 auto; padding: 16px var(--gutter) 96px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin: 8px 0 24px; }
.page-head h1 { margin: 0; font-size: 26px; letter-spacing: -0.02em; font-weight: 700; }
.page-head .btn { margin-left: auto; }

/* home */
.retro-only { display: none; }
[data-skin="retro"] .retro-only { display: flex; }
.chipbar {
  display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; padding: 4px 0 18px;
  position: sticky; top: var(--top); z-index: 6; background: var(--bg); margin-top: -4px;
}
.chipbar::-webkit-scrollbar { display: none; }
.shelf { margin: 8px 0 36px; }
.shelf > header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.shelf h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 20px; letter-spacing: -0.015em; font-weight: 700; }
.shelf h2 .i { color: var(--live); width: 22px; height: 22px; }
.shelf > header a { color: var(--text-2); font-weight: 500; font-size: 14px; padding: 6px 10px; border-radius: 999px; }
.shelf > header a:hover { background: var(--surface-2); }
.feed { margin-bottom: 36px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 36px 16px; }
.grid-row { grid-auto-rows: auto; }
.empty-inline { color: var(--text-3); margin: 0; grid-column: 1 / -1; }
html[data-fixed-cols] .grid:not(.grid-row) { grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); }
html[data-density="compact"] .grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 22px 12px; }
html[data-density="compact"] .card-title { font-size: 13.5px; }

/* --------------------------------------------------------------- cards */
.card { position: relative; min-width: 0; }
.thumb {
  position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: var(--radius); background: var(--surface-2);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.badge {
  position: absolute; right: 6px; bottom: 6px; padding: 1px 5px; border-radius: 4px;
  background: rgba(0, 0, 0, 0.8); color: #fff; font-size: 12px; font-weight: 600;
  font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; gap: 4px;
}
.badge-live { background: var(--live); }
.watched { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255, 255, 255, 0.35); }
.watched::after { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--p); background: var(--live); }
.thumb-actions {
  position: absolute; top: 6px; right: 6px; display: flex; flex-direction: column; gap: 6px;
  opacity: 0; transition: opacity 0.15s;
}
.card:hover .thumb-actions, .card:focus-within .thumb-actions { opacity: 1; }
@media (hover: none) { .thumb-actions { opacity: 1; } }
.ta { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: rgba(0, 0, 0, 0.75); color: #fff; }
.ta .i { width: 18px; height: 18px; }
.ta:hover { background: rgba(0, 0, 0, 0.92); }
.ta.on { color: #8ab0ff; }

.card-body { display: flex; gap: 12px; padding-top: 12px; }
.avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; overflow: hidden; background: var(--surface-2); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.card-text { min-width: 0; flex: 1; }
.card-title {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-weight: 600; font-size: 15px; line-height: 1.4;
}
.card-channel {
  display: inline-flex; align-items: center; margin-top: 4px; color: var(--text-2); font-size: 13.5px; max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-channel:hover { color: var(--text); }
.card-channel img { width: 24px; height: 24px; border-radius: 50%; margin-right: 8px; }
.card-sub { color: var(--text-2); font-size: 13.5px; }
.card-snippet {
  margin: 10px 0 0; color: var(--text-2); font-size: 12.5px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.card-row { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 16px; }
.card-row .card-body { padding-top: 0; }
.card-row .card-title { font-size: 18px; font-weight: 500; line-height: 1.35; }
.card-row .card-channel { margin: 12px 0 0; order: 3; font-size: 12.5px; }
.card-row .card-text { display: flex; flex-direction: column; }
.card-row .card-sub { order: 2; font-size: 12.5px; margin-top: 4px; }
.card-row .card-snippet { order: 4; }

.card-compact { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 8px; }
.card-compact .thumb { border-radius: 8px; }
.card-compact .card-body { padding: 0; }
.card-compact .card-title { font-size: 14px; }
.card-compact .card-channel, .card-compact .card-sub { font-size: 12px; }
.card-compact .badge { font-size: 11px; right: 4px; bottom: 4px; }
.card-compact .thumb-actions { top: 4px; right: 4px; gap: 4px; }
.card-compact .ta { width: 28px; height: 28px; }

.pl-overlay {
  position: absolute; inset: 0 0 0 auto; width: 38%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px; background: rgba(0, 0, 0, 0.72);
  color: #fff; font-size: 13px; font-weight: 600; text-align: center; padding: 0 6px;
}
.card-chan { display: flex; align-items: center; gap: 24px; padding: 12px 0; }
.card-chan img { width: 136px; height: 136px; border-radius: 50%; object-fit: cover; flex: none; margin: 0 clamp(0px, 6vw, 112px); }
.card-chan-text { flex: 1; min-width: 0; }
.card-chan b { font-size: 18px; font-weight: 500; display: flex; align-items: center; }
.card-chan small { color: var(--text-2); font-size: 12.5px; display: block; margin-top: 4px; }
.card-chan p { margin: 8px 0 0; color: var(--text-2); font-size: 12.5px; max-width: 560px; }

.shorts-shelf { padding: 4px 0 8px; }
.shorts-shelf h3 { display: flex; align-items: center; gap: 8px; margin: 8px 0 14px; font-size: 18px; }
.shorts-shelf h3 .i { color: var(--live); }
.shorts-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(170px, 210px); gap: 12px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: thin; }
.short { position: relative; display: block; aspect-ratio: 9 / 16; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.short img { width: 100%; height: 100%; object-fit: cover; }
.short-text {
  position: absolute; inset: auto 0 0 0; padding: 48px 10px 10px; color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.82));
}
.short-text b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 14px; line-height: 1.3; font-weight: 600; }
.short-text small { font-size: 12px; opacity: 0.85; }
.results-shorts { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px !important; }

/* skeletons */
.sk .thumb, .sk-block, .short.sk { background: var(--sk); animation: pulse 1.4s ease-in-out infinite; }
.sk .card-text i, .w-desc.loading i {
  display: block; height: 12px; border-radius: 6px; background: var(--sk); margin-top: 8px; animation: pulse 1.4s ease-in-out infinite;
}
.sk .card-text i:first-child { width: 90%; height: 14px; margin-top: 0; }
.sk .card-text i:nth-child(2) { width: 60%; }
.sk .card-text i:nth-child(3) { width: 40%; }
.sk-line { min-height: 1.2em; width: 60%; border-radius: 8px; background: var(--sk); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.5; } }

/* --------------------------------------------------------------- search page */
.filters {
  display: flex; gap: 10px; overflow-x: auto; padding: 4px 0 16px; margin-top: -4px; margin-bottom: 4px;
  scrollbar-width: none; position: sticky; top: var(--top); z-index: 5; background: var(--bg);
}
.filters::-webkit-scrollbar { display: none; }
.search-note { margin: 0 0 16px; color: var(--text-2); }
.search-note a { color: var(--accent-text); font-weight: 600; font-style: italic; }
.results { display: flex; flex-direction: column; gap: 16px; max-width: 1100px; }
.sentinel { display: grid; place-items: center; height: 80px; }
.spinner {
  width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--text-2);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 72px 16px; color: var(--text-2); grid-column: 1 / -1; }
.empty > .i { width: 40px; height: 40px; color: var(--text-3); margin-bottom: 4px; }
.empty h3 { margin: 0; color: var(--text); font-size: 17px; font-weight: 600; }
.empty p { margin: 0 0 8px; }

/* --------------------------------------------------------------- channel */
.ch-head { margin-bottom: 28px; }
.ch-head.sk-block { height: 220px; border-radius: 16px; }
.ch-banner { aspect-ratio: 6.2 / 1; border-radius: 14px; overflow: hidden; background: var(--surface-2); margin-bottom: 20px; }
.ch-banner img { width: 100%; height: 100%; object-fit: cover; }
.ch-info { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.ch-info > div { flex: 1; min-width: 220px; }
.ch-avatar { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; }
.ch-info h1 { margin: 0; font-size: 32px; letter-spacing: -0.02em; font-weight: 700; }
.ch-meta { margin: 6px 0 0; color: var(--text-2); }
.ch-desc { margin: 8px 0 0; color: var(--text-2); max-width: 640px; }

/* --------------------------------------------------------------- subscriptions */
.sub-strip { display: flex; gap: 18px; overflow-x: auto; padding: 0 0 22px; margin-bottom: 22px; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
.sub-strip a { display: grid; justify-items: center; gap: 8px; width: 76px; flex: none; font-size: 12px; color: var(--text-2); text-align: center; }
.sub-strip a span { width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub-strip img, .sub-strip .g-ph { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; font-size: 20px; }
.sub-strip a:hover { color: var(--text); }
.subs-manage { max-width: 760px; display: grid; }
.sub-row { display: flex; align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.sub-row img, .sub-row .g-ph { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; font-size: 18px; }
.sub-name { flex: 1; min-width: 0; }
.sub-name b { display: block; font-weight: 600; }
.sub-name small { color: var(--text-3); }

/* --------------------------------------------------------------- library / settings */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 10px; }
.tab { padding: 6px 14px; border-radius: 8px; font-weight: 500; color: var(--text-2); }
.tab:hover { color: var(--text); }
.tab.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.search-list { list-style: none; padding: 0; margin: 0; max-width: 640px; }
.search-list a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; }
.search-list a:hover { background: var(--surface-2); }
.search-list .i { color: var(--text-3); }

.settings .page-head { max-width: 720px; }
.set-col { max-width: 720px; display: grid; gap: 28px; }
.set-group h2 { margin: 0 0 8px 2px; font-size: 13px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.set-card { background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; }
.set-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 54px; padding: 8px 16px;
  border-top: 1px solid var(--line); font-weight: 500;
}
.set-row:first-child { border-top: 0; }
label.set-row { cursor: pointer; }
.set-input {
  width: min(260px, 50vw); height: 34px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--bg); outline: none; text-align: right; font-weight: 500;
}
.set-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); text-align: left; }
select {
  height: 34px; padding: 0 30px 0 12px; border-radius: 8px; border: 1px solid var(--line-2); font-weight: 500;
  background: var(--surface-2); appearance: none; cursor: pointer; max-width: 50vw;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%);
  background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px; background-size: 5px 5px; background-repeat: no-repeat;
}

.switch {
  appearance: none; flex: none; width: 40px; height: 24px; border-radius: 999px; margin: 0;
  background: var(--surface-3); position: relative; cursor: pointer; transition: background 0.2s;
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.2s;
}
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(16px); }
.switch-sm { width: 32px; height: 18px; }
.switch-sm::after { width: 14px; height: 14px; top: 2px; left: 2px; }
.switch-sm:checked::after { transform: translateX(14px); }

/* --------------------------------------------------------------- watch page */
.watch {
  display: grid; max-width: 1760px; margin: 0 auto; padding: 24px var(--gutter) 80px;
  grid-template-columns: minmax(0, 1fr) 402px; grid-template-areas: "player side" "main side";
  grid-template-rows: auto 1fr; gap: 0 24px;
}
.w-player { grid-area: player; min-width: 0; }
.w-main { grid-area: main; min-width: 0; padding-top: 12px; }
.w-side { grid-area: side; min-width: 0; }
.watch.theater { grid-template-areas: "player player" "main side"; }
.watch.theater .w-side { padding-top: 16px; }
.watch.theater #player { width: min(100%, calc((100vh - var(--top) - 64px) * 16 / 9)); margin: 0 auto; }
.watch.theater .w-player { background: #000; margin: -24px calc(var(--gutter) * -1) 0; padding: 0; }
.watch.theater:not(.mini) #player:not(.is-fs) { border-radius: 0; }

body:not(.watching) .watch:not(.mini) { display: none; }

.w-title { margin: 0 0 12px; font-size: 20px; line-height: 1.35; font-weight: 700; letter-spacing: -0.01em; }
.w-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.w-owner { display: flex; align-items: center; gap: 20px; min-width: 0; }
.w-channel { display: flex; align-items: center; gap: 12px; min-width: 0; }
.w-channel img, .w-avatar-ph { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--surface-2); flex: none; }
.w-channel b { display: flex; align-items: center; font-size: 16px; font-weight: 600; }
.w-channel small { display: block; color: var(--text-2); font-size: 12px; }
.w-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.w-playlist {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 16px; padding: 10px 14px;
  border-radius: 12px; border: 1px solid var(--line-2); color: var(--text-2);
}
.w-playlist > span { flex: 1; min-width: 120px; font-weight: 600; color: var(--text); }
.w-desc {
  position: relative; margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2);
  font-size: 14px; line-height: 1.55;
}
.w-desc:empty { display: none; }
.w-stats { font-weight: 600; margin-bottom: 4px; }
.w-desc-text { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 6.2em; overflow: hidden; color: var(--text); }
.w-desc.open .w-desc-text { max-height: none; }
.w-desc-text a { color: var(--accent-text); }
.w-desc-text a:hover { text-decoration: underline; }
.ts { color: var(--accent-text); font-weight: 600; font-variant-numeric: tabular-nums; }
.ts:hover { text-decoration: underline; }
.w-more { margin-top: 6px; font-weight: 600; color: var(--text); }

.side-sec { margin-bottom: 20px; }
.side-sec > header { display: flex; align-items: center; justify-content: space-between; margin: 0 0 12px; }
.side-sec h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 16px; font-weight: 600; }
.side-sec .count { font-size: 12px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); }
.queue-sec { padding: 14px; border: 1px solid var(--line-2); border-radius: 12px; }
.side-list { display: flex; flex-direction: column; gap: 10px; }
.mini-toggle { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; cursor: pointer; }

/* --------------------------------------------------------------- mini player */
.mini-bar { display: none; }
.watch.mini {
  position: fixed; right: 16px; bottom: 16px; z-index: 50; display: block; padding: 0; margin: 0;
  width: min(420px, calc(100vw - 32px)); background: var(--bg-elev); border-radius: 12px; overflow: hidden;
  box-shadow: var(--shadow-lg); border: 1px solid var(--line-2); animation: pop 0.22s ease;
}
@keyframes pop { from { transform: translateY(12px) scale(0.98); opacity: 0; } }
.watch.mini .w-main, .watch.mini .w-side { display: none; }
.watch.mini .w-player { margin: 0; background: none; }
.watch.mini #player { width: 100%; border-radius: 0; }
.watch.mini .mini-bar { display: flex; align-items: center; gap: 2px; padding: 8px 6px 8px 12px; }
.mini-info { flex: 1; min-width: 0; text-align: left; display: grid; }
.mini-title { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-sub { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-bar .pb { color: var(--text); }
.mini-bar .pb:hover { background: var(--surface-2); }
.mini-bar .ic-pause { display: none; }
.watch[data-playing="1"] .mini-bar .ic-pause { display: block; }
.watch[data-playing="1"] .mini-bar .ic-play { display: none; }

/* --------------------------------------------------------------- player */
.ply {
  position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; overflow: hidden;
  border-radius: var(--radius); color: #fff; user-select: none; -webkit-user-select: none;
  --ply-accent: var(--accent);
}
.ply.is-fs { border-radius: 0; aspect-ratio: auto; width: 100vw; height: 100vh; }
.ply-frame, .ply-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.ply-shield { position: absolute; inset: 0 0 0 0; z-index: 2; cursor: pointer; }
.ply.direct .ply-shield, .ply.native .ply-shield { display: none; }
.ply.native .ply-controls, .ply.native .ply-osd { display: none; }
.ply:not(.ui)[data-state="playing"] { cursor: none; }
.ply:not(.ui)[data-state="playing"] .ply-shield { cursor: none; }

.ply-poster { position: absolute; inset: 0; z-index: 4; cursor: pointer; background: #000; }
.ply-poster img { width: 100%; height: 100%; object-fit: cover; opacity: 0.92; }
.ply-poster::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at center, rgba(0,0,0,.05), rgba(0,0,0,.45)); }
.ply-bigplay {
  position: absolute; left: 50%; top: 50%; z-index: 1; width: 76px; height: 76px; margin: -38px 0 0 -38px;
  display: grid; place-items: center; border-radius: 50%; background: var(--ply-accent); color: var(--accent-ink);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45); transition: transform 0.18s ease;
}
.ply-bigplay .i { width: 34px; height: 34px; margin-left: 4px; }
.ply-poster:hover .ply-bigplay { transform: scale(1.07); }
.ply-poster-meta { position: absolute; left: 14px; top: 14px; z-index: 1; }
.ply-poster-meta .chip { background: rgba(0, 0, 0, 0.7); color: #fff; gap: 6px; }
.ply-poster-meta .i { width: 16px; height: 16px; }

.ply-spinner { position: absolute; inset: 0; display: none; place-items: center; z-index: 3; pointer-events: none; }
.ply-spinner span {
  width: 54px; height: 54px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, 0.2); border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}
.ply[data-state="loading"]:not(.poster):not(.native) .ply-spinner,
.ply[data-state="buffering"] .ply-spinner { display: grid; }

.ply-osd { position: absolute; left: 50%; top: 50%; z-index: 6; transform: translate(-50%, -50%); pointer-events: none; opacity: 0; }
.ply-osd.show { animation: osd 0.7s ease forwards; }
.osd-icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: rgba(0, 0, 0, 0.6); }
.osd-icon .i { width: 32px; height: 32px; }
.osd-text { display: block; padding: 8px 14px; border-radius: 10px; background: rgba(0, 0, 0, 0.72); font-weight: 600; font-size: 15px; white-space: nowrap; }
@keyframes osd { 0% { opacity: 0; transform: translate(-50%, -50%) scale(0.85); } 20% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.06); } }

.ply-msg { position: absolute; inset: 0; z-index: 7; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, 0.82); }
.ply-msg-card { max-width: 460px; text-align: center; display: grid; justify-items: center; gap: 6px; }
.ply-msg-card > .i { width: 36px; height: 36px; color: var(--accent); }
.ply-msg-card p { margin: 0 0 8px; font-size: 15px; line-height: 1.5; }
.ply-msg-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.ply-msg .btn { background: rgba(255, 255, 255, 0.14); color: #fff; }
.ply-msg .btn:hover { background: rgba(255, 255, 255, 0.24); }
.ply-msg .btn-ghost { background: transparent; border-color: rgba(255, 255, 255, 0.3); }

.ply-controls {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; padding: 40px 12px 6px;
  /* solid bottom band: covers the embed's own logo / "More videos" overlays under our buttons */
  background: linear-gradient(to top, rgba(10, 10, 12, 0.97) 0, rgba(10, 10, 12, 0.97) 52px, rgba(10, 10, 12, 0.55) 74px, transparent);
  opacity: 0; transform: translateY(4px); transition: opacity 0.22s, transform 0.22s; pointer-events: none;
}
.ply.ui .ply-controls, .ply:not([data-state="playing"]):not(.poster) .ply-controls, .ply.dragging .ply-controls {
  opacity: 1; transform: none; pointer-events: auto;
}
.ply.poster .ply-controls { display: none; }

.ply-seek { position: relative; height: 18px; display: flex; align-items: center; cursor: pointer; touch-action: none; }
.ply-rail { position: relative; width: 100%; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.24); transition: height 0.12s; }
.ply-seek:hover .ply-rail, .ply.dragging .ply-rail { height: 6px; }
.ply-rail > div { position: absolute; left: 0; top: 0; bottom: 0; border-radius: inherit; }
.ply-buf { background: rgba(255, 255, 255, 0.36); }
.ply-hover { background: rgba(255, 255, 255, 0.28); opacity: 0; }
.ply-seek:hover .ply-hover { opacity: 1; }
.ply-prog { background: var(--ply-accent); z-index: 1; }
.ply-clip { z-index: 2; height: 100%; background: transparent; box-shadow: inset 0 0 0 1.5px #fff; border-radius: 2px !important; opacity: 0.75; }
.ply-knob {
  position: absolute; top: 50%; z-index: 3; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%;
  background: var(--ply-accent); transform: scale(0); transition: transform 0.12s;
}
.ply-seek:hover .ply-knob, .ply.dragging .ply-knob { transform: scale(1); }
.ply-tip {
  position: absolute; bottom: 22px; transform: translateX(-50%); padding: 3px 8px; border-radius: 6px;
  background: rgba(0, 0, 0, 0.85); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums;
  opacity: 0; pointer-events: none; white-space: nowrap;
}
.ply-seek:hover .ply-tip, .ply.dragging .ply-tip { opacity: 1; }

.ply-row { display: flex; align-items: center; gap: 2px; height: 46px; }
.pb {
  display: grid; place-items: center; min-width: 40px; height: 40px; padding: 0 8px; border-radius: 10px; color: #fff;
  transition: background 0.12s, color 0.12s;
}
.pb:hover { background: rgba(255, 255, 255, 0.14); }
.pb .i { width: 24px; height: 24px; }
.pb.on { color: var(--ply-accent); }
.pb-text { font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.pb-main .i { width: 28px; height: 28px; }
.pb-main .ic-pause, .pb-main .ic-replay { display: none; }
.ply[data-state="playing"] .pb-main .ic-play, .ply[data-state="buffering"] .pb-main .ic-play { display: none; }
.ply[data-state="playing"] .pb-main .ic-pause, .ply[data-state="buffering"] .pb-main .ic-pause { display: block; }
.ply[data-state="ended"] .pb-main .ic-play { display: none; }
.ply[data-state="ended"] .pb-main .ic-replay { display: block; }
.ply .ic-vlow, .ply .ic-voff { display: none; }
.ply[data-vol="low"] .ic-vhigh, .ply[data-vol="off"] .ic-vhigh { display: none; }
.ply[data-vol="low"] .ic-vlow, .ply[data-vol="off"] .ic-voff { display: block; }
.ply .ic-fsx, .ply.is-fs .ic-fs { display: none; }
.ply.is-fs .ic-fsx { display: block; }

.ply-vol { display: flex; align-items: center; }
.ply-vol input {
  -webkit-appearance: none; appearance: none; width: 0; height: 4px; border-radius: 4px; margin: 0; opacity: 0;
  background: linear-gradient(to right, #fff var(--v, 100%), rgba(255, 255, 255, 0.3) var(--v, 100%));
  transition: width 0.18s, opacity 0.18s, margin 0.18s; cursor: pointer;
}
.ply-vol:hover input, .ply-vol:focus-within input { width: 72px; opacity: 1; margin: 0 10px 0 4px; }
.ply-vol input::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: #fff; }
.ply-vol input::-moz-range-thumb { width: 13px; height: 13px; border: 0; border-radius: 50%; background: #fff; }
.ply-time { padding: 0 8px; font-size: 13.5px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; color: rgba(255, 255, 255, 0.92); }
.ply-time .sep { opacity: 0.6; }
.live-pill { display: none; align-items: center; gap: 4px; margin-left: 8px; font-weight: 700; font-size: 12px; }
.live-pill .i { width: 16px; height: 16px; color: var(--live); }
.ply.is-live .live-pill { display: inline-flex; }
.ply.is-live .ply-time .sep, .ply.is-live .ply-time .dur { display: none; }
.ply-spacer { flex: 1; }

.ply-menu {
  position: absolute; right: 12px; bottom: 64px; z-index: 8; min-width: 200px; max-height: calc(100% - 80px); overflow: auto;
  padding: 8px; border-radius: 14px; background: rgba(22, 22, 24, 0.94); backdrop-filter: blur(12px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); border: 1px solid rgba(255, 255, 255, 0.1); animation: pop 0.16s ease;
}
.menu-title { padding: 6px 10px 8px; font-weight: 600; font-size: 13.5px; }
.menu-title .muted { color: rgba(255, 255, 255, 0.5); font-weight: 500; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; text-align: left; color: #fff; }
.menu-item:hover { background: rgba(255, 255, 255, 0.1); }
.menu-item .ic-check { width: 18px; height: 18px; visibility: hidden; color: var(--ply-accent); }
.menu-item.on .ic-check { visibility: visible; }

.ply-options { width: min(380px, calc(100% - 24px)); padding: 10px 12px 12px; }
.opt-group { margin: 6px 0 12px; }
.opt-label { font-size: 12px; color: rgba(255, 255, 255, 0.6); margin: 0 0 6px 2px; font-weight: 500; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px; border-radius: 10px; background: rgba(255, 255, 255, 0.08); }
.seg-3 { grid-template-columns: repeat(3, 1fr); }
.seg button { height: 30px; border-radius: 8px; font-size: 13px; font-weight: 500; color: rgba(255, 255, 255, 0.8); }
.seg button:hover { color: #fff; }
.seg button.on { background: #fff; color: #111; }
.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.opt-field { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 6px; }
.opt-field > span { grid-column: 1 / -1; font-size: 12px; color: rgba(255, 255, 255, 0.6); margin-left: 2px; }
.opt-field input {
  min-width: 0; height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06); color: #fff; font-family: var(--mono); font-size: 13px; outline: none;
}
.opt-field input:focus { border-color: var(--ply-accent); }
.mini-btn { height: 32px; padding: 0 9px; border-radius: 8px; background: rgba(255, 255, 255, 0.1); color: #fff; font-size: 12px; font-weight: 600; display: grid; place-items: center; }
.mini-btn:hover { background: rgba(255, 255, 255, 0.18); }
.mini-btn .i { width: 16px; height: 16px; }
.opt-check { display: flex; align-items: center; gap: 10px; padding: 6px 2px; font-size: 13.5px; cursor: pointer; }
.opt-check input { width: 16px; height: 16px; accent-color: var(--ply-accent); margin: 0; }
.opt-url { display: flex; gap: 6px; align-items: center; margin: 4px 0 12px; }
.opt-url code {
  flex: 1; min-width: 0; padding: 7px 9px; border-radius: 8px; background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.7); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.opt-actions { display: flex; justify-content: flex-end; gap: 8px; }
.ply-options .btn-ghost { color: #fff; border-color: rgba(255, 255, 255, 0.25); }
.ply-options .btn-ghost:hover { background: rgba(255, 255, 255, 0.1); }

/* mini player trims the control bar */
.watch.mini .ply .hide-mini, .watch.mini .ply [data-act="direct"], .watch.mini .ply [data-act="cc"],
.watch.mini .ply [data-act="speed"], .watch.mini .ply [data-act="options"], .watch.mini .ply .ply-vol input { display: none; }
.watch.mini .ply-controls { padding: 30px 6px 2px; background: linear-gradient(to top, rgba(10, 10, 12, 0.97) 0, rgba(10, 10, 12, 0.97) 40px, rgba(10, 10, 12, 0.5) 58px, transparent); }
.watch.mini .ply-msg-card p { font-size: 13px; }
.watch.mini .ply-msg-card > .i { width: 26px; height: 26px; }
.watch.mini .ply-row { height: 38px; }
.watch.mini .pb { min-width: 34px; height: 34px; padding: 0 5px; }
.watch.mini .pb .i { width: 20px; height: 20px; }
.watch.mini .ply-time { font-size: 12px; padding: 0 4px; }
.watch.mini .ply-bigplay { width: 56px; height: 56px; margin: -28px 0 0 -28px; }
.watch.mini .ply-bigplay .i { width: 26px; height: 26px; }

/* --------------------------------------------------------------- shorts */
.shorts-page {
  position: relative; height: calc(100vh - var(--top)); display: flex; align-items: center; justify-content: center;
  padding: 12px 16px 20px; overflow: hidden; overscroll-behavior: contain;
}
.sh-stage { display: flex; align-items: flex-end; gap: 14px; height: 100%; max-height: 920px; }
.sh-frame { position: relative; height: 100%; aspect-ratio: 9 / 16; max-width: calc(100vw - 120px); border-radius: 14px; overflow: hidden; background: #000; }
.sh-player { position: absolute; inset: 0; }
.ply.ply-short { position: absolute; inset: 0; aspect-ratio: auto; width: 100%; height: 100%; border-radius: 0; }
.sh-info {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; padding: 64px 14px 22px; color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.78)); pointer-events: none;
}
.sh-info a, .sh-info button { pointer-events: auto; }
.sh-channel { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.sh-chlink { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; }
.sh-chlink span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.sh-info .btn-sub { background: #fff; color: #0f0f0f; height: 30px; }
.sh-info .btn-sub.on { background: rgba(255, 255, 255, 0.2); color: #fff; }
.sh-title { font-size: 14px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sh-actions { display: flex; flex-direction: column; gap: 14px; padding-bottom: 6px; }
.sh-act { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--surface-2); color: var(--text); }
.sh-act:hover { background: var(--surface-3); }
.sh-act.on { color: var(--accent-text); }
.sh-act .i { width: 24px; height: 24px; }
.sh-nav { position: absolute; right: 24px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 14px; }
.sh-navbtn { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--surface-2); color: var(--text); }
.sh-navbtn:hover:not(:disabled) { background: var(--surface-3); }
.sh-navbtn .i { width: 28px; height: 28px; }
.sh-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; background: var(--bg); z-index: 8; }
.sh-empty .i { width: 40px; height: 40px; color: var(--text-3); }
.sh-empty h3 { margin: 0; }

/* the shorts player: tap to pause, thin progress line, nothing else */
.ply-short .ply-row, .ply-short .ply-menu, .ply-short .ply-tip { display: none !important; }
.ply-short .ply-controls { opacity: 1; transform: none; pointer-events: auto; padding: 0; background: none; z-index: 7; }
.ply-short .ply-seek { height: 10px; }
.ply-short .ply-rail { height: 3px; border-radius: 0; background: rgba(255, 255, 255, 0.3); }
.ply-short .ply-seek:hover .ply-rail { height: 5px; }
.ply-short .ply-prog { background: #fff; }
.ply-short .ply-knob { background: #fff; }
.ply-short .ply-poster img { object-fit: cover; }

/* --------------------------------------------------------------- toasts & dialog */
.toasts { position: fixed; left: 50%; bottom: 20px; z-index: 90; transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast {
  display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 16px; border-radius: 8px;
  background: #202020; color: #f1f1f1; box-shadow: var(--shadow-lg); pointer-events: auto;
  font-weight: 500; animation: toast-in 0.2s ease; max-width: 100%;
}
.toast > span { padding-right: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60vw; }
.toast.out { animation: toast-out 0.2s ease forwards; }
.toast-btn { padding: 6px 10px; border-radius: 6px; color: #8ab0ff; font-weight: 600; white-space: nowrap; }
.toast-btn:hover, .toast-x:hover { background: rgba(255, 255, 255, 0.1); }
.toast-x { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 6px; color: #aaa; }
.toast-x .i { width: 18px; height: 18px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px); } }

.keys-dialog {
  width: min(560px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line-2); border-radius: 14px;
  background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow-lg);
}
.keys-dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
.keys-inner { padding: 16px 20px 20px; }
.keys-inner header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.keys-inner h2 { margin: 0; font-size: 17px; }
.keys-inner .pb { color: var(--text); }
.keys-inner .pb:hover { background: var(--surface-2); }
.keys-inner dl { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 24px; margin: 0; }
.keys-inner dl div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.keys-inner dt { display: flex; gap: 4px; flex: none; }
.keys-inner dd { margin: 0; color: var(--text-2); text-align: right; font-size: 13px; }

/* --------------------------------------------------------------- access gate */
body.locked .search, body.locked .top-nav, body.locked .guide-btn { visibility: hidden; }
body.locked .guide { display: none; }
body.locked #view { margin-left: 0; }
body.locked .brand { pointer-events: none; }
.gate { display: grid; place-items: center; min-height: calc(100vh - var(--top)); padding: 24px var(--gutter); }
.gate-card {
  width: min(360px, 100%); display: grid; gap: 12px; padding: 28px; text-align: center;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow);
}
.gate-mark { display: flex; justify-content: center; margin-bottom: 4px; }
.gate-mark .logo-mark { width: 40px; height: 40px; }
.gate-card h1 { margin: 0 0 4px; font-size: 20px; }
.gate-card input {
  height: 42px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--bg); font-size: 15px; outline: none; text-align: center; letter-spacing: 0.04em;
}
.gate-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.gate-card .btn { height: 42px; border-radius: 10px; }
.gate-err { color: var(--live); font-size: 13px; margin: 0; }

/* --------------------------------------------------------------- console */
.dbg {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 200;
  width: min(920px, calc(100vw - 24px)); height: min(440px, 62vh); display: flex; flex-direction: column;
  background: #0b0d10; color: #d0d7de; border: 1px solid #2b3038; border-radius: 10px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55); font: 12.5px/1.55 var(--mono);
}
.dbg-bar { display: flex; align-items: center; justify-content: space-between; height: 30px; padding: 0 6px 0 12px; border-bottom: 1px solid #1f242b; color: #6e7681; }
.dbg-x { width: 26px; height: 24px; border-radius: 5px; color: #8b949e; font-size: 18px; line-height: 1; }
.dbg-x:hover { background: #1f242b; color: #f0f6fc; }
.dbg-out { flex: 1; overflow: auto; padding: 10px 14px; white-space: pre-wrap; overflow-wrap: anywhere; scrollbar-width: thin; scrollbar-color: #30363d transparent; }
.dbg-out pre { margin: 0; white-space: pre-wrap; }
.dbg-line.cmd { color: #f0f6fc; margin-top: 6px; }
.dbg-line.ok { color: #7ee787; }
.dbg-line.err { color: #ff7b72; }
.dbg-line.dim { color: #7d8590; }
.dbg-line.hl { color: #79c0ff; }
.dbg-line.head { color: #e3b341; font-weight: 600; margin-top: 8px; }
.dbg-line.mono { white-space: pre; overflow-x: auto; }
.dbg-line.row { display: flex; gap: 16px; }
.dbg-usage { color: #79c0ff; flex: 0 0 min(52ch, 60%); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dbg-sum { color: #8b949e; }
.dbg-in { display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 14px; border-top: 1px solid #1f242b; }
.dbg-in input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: #f0f6fc; font: inherit; caret-color: #7ee787; }
.dbg-prompt { color: #7ee787; }
.dbg-fps, .dbg-stats {
  position: fixed; right: 10px; z-index: 199; padding: 6px 10px; border-radius: 6px; pointer-events: none;
  background: rgba(0, 0, 0, 0.82); color: #7ee787; font: 12px/1.45 var(--mono); white-space: pre;
}
.dbg-fps { top: calc(var(--top) + 8px); }
.dbg-stats { top: calc(var(--top) + 40px); }
html[data-outline] * { outline: 1px solid rgba(255, 0, 90, 0.35) !important; outline-offset: -1px; }
html[data-nomotion] *, html[data-nomotion] *::before, html[data-nomotion] *::after { animation: none !important; transition: none !important; }

/* --------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .watch, .watch.theater { grid-template-columns: minmax(0, 1fr); grid-template-areas: "player" "main" "side"; }
  .w-side { padding-top: 24px; }
  .watch.theater .w-player { margin: 0; background: none; }
  .watch.theater #player { width: 100%; }
  .watch.theater:not(.mini) #player:not(.is-fs) { border-radius: var(--radius); }
  .ply [data-act="theater"] { display: none; }
}
@media (max-width: 760px) {
  :root { --gutter: 12px; --top: 52px; }
  .topbar { grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; padding: 0 8px; }
  .brand-name { display: none; }
  .search-kbd { display: none; }
  .top-nav { gap: 0; }
  .top-btn { width: 36px; height: 36px; }
  #theme-btn { display: none; }
  .card-row { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .card-row .card-body { padding-top: 10px; }
  .card-row .card-title { font-size: 15px; font-weight: 600; }
  .card-row .card-snippet { display: none; }
  .card-chan { gap: 12px; flex-wrap: wrap; }
  .card-chan img { width: 72px; height: 72px; margin: 0; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 24px 12px; }
  .watch { padding-top: 0; }
  .watch:not(.mini) .w-player { margin: 0 calc(var(--gutter) * -1); position: sticky; top: var(--top); z-index: 20; }
  .watch:not(.mini) #player:not(.is-fs) { border-radius: 0; }
  .w-title { font-size: 17px; }
  .w-owner { width: 100%; justify-content: space-between; }
  .w-actions { width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .ply-time { font-size: 12.5px; padding: 0 4px; }
  .ply .pb { min-width: 36px; padding: 0 6px; }
  .ply [data-act="mini"], .ply [data-act="direct"], .ply [data-act="prev"] { display: none; }
  .ply-vol input { display: none; }
  .ch-info h1 { font-size: 24px; }
  .ch-avatar { width: 72px; height: 72px; }
  .keys-inner dl { grid-template-columns: 1fr; }
  .page-head .btn { margin-left: 0; }
  .watch.mini { left: 8px; right: 8px; bottom: 8px; width: auto; }
  .shorts-page { padding: 0; height: calc(100dvh - var(--top)); }
  .sh-stage { gap: 0; max-height: none; }
  .sh-frame { border-radius: 0; max-width: 100vw; height: 100%; }
  .sh-actions { position: absolute; right: 8px; bottom: 96px; z-index: 8; }
  .sh-act { background: rgba(0, 0, 0, 0.45); color: #fff; }
  .sh-nav { display: none; }
  .set-row { min-height: 50px; }
}
@media (max-width: 420px) {
  .ply [data-act="cc"] { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ==========================================================================
   Retro theme
   ========================================================================== */
:root:root[data-skin="retro"] {
  --bg: #ffffff;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #eeeeee;
  --surface-3: #dddddd;
  --line: #e2e2e2;
  --line-2: #cccccc;
  --text: #333333;
  --text-2: #666666;
  --text-3: #999999;
  --accent: #cc181e;
  --accent-ink: #ffffff;
  --accent-soft: rgba(51, 102, 204, 0.12);
  --accent-text: #0033cc;
  --logo: #3a6fb5;
  --shadow: none;
  --shadow-lg: 0 2px 8px rgba(0, 0, 0, 0.3);
  --topbar-bg: #ffffff;
  --sk: #eeeeee;
  --radius: 0px;
  --font: Arial, Helvetica, sans-serif;
  color-scheme: light;
}
[data-skin="retro"] body { font: 13px/1.4 Arial, Helvetica, sans-serif; color: #333; }
[data-skin="retro"] a:hover { text-decoration: underline; }

/* buttons & chips: grey gradients */
[data-skin="retro"] .btn, [data-skin="retro"] .chip, [data-skin="retro"] .search-go, [data-skin="retro"] .tab {
  height: 26px; padding: 0 10px; border-radius: 3px; border: 1px solid #c6c6c6;
  background: linear-gradient(#fefefe, #e5e5e5); color: #333; font: bold 12px Arial, sans-serif;
  box-shadow: inset 0 1px 0 #fff; text-decoration: none;
}
[data-skin="retro"] .btn:hover, [data-skin="retro"] .chip:hover, [data-skin="retro"] .search-go:hover { background: linear-gradient(#fff, #d8d8d8); border-color: #aaa; }
[data-skin="retro"] .chip.on, [data-skin="retro"] .tab.on { background: linear-gradient(#dedede, #f0f0f0); box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25); color: #000; }
[data-skin="retro"] .btn-sub { background: linear-gradient(#fffde4, #ffe066 50%, #fdd23a); border-color: #e2b300; color: #333; }
[data-skin="retro"] .btn-sub.on { background: linear-gradient(#fefefe, #e5e5e5); border-color: #c6c6c6; }
[data-skin="retro"] .btn-pill.on { background: linear-gradient(#dedede, #f0f0f0); color: #000; }
[data-skin="retro"] .btn .i { width: 15px; height: 15px; }

/* header */
[data-skin="retro"] .topbar { height: 64px; background: linear-gradient(#ffffff, #f1f1f1); border-bottom: 1px solid #cfcfcf; backdrop-filter: none; -webkit-backdrop-filter: none; }
[data-skin="retro"] { --top: 64px; }
[data-skin="retro"] .brand { font: bold 26px Arial, sans-serif; letter-spacing: -1px; color: #222; text-shadow: 0 1px 0 #fff; }
[data-skin="retro"] .logo-mark { width: 30px; height: 30px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.3)); }
[data-skin="retro"] .search-box { height: 28px; border-radius: 0; border: 1px solid #999; border-top-color: #777; box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15); padding: 0 4px; }
[data-skin="retro"] .search-box:focus-within { box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15); border-color: #6c8fd0; }
[data-skin="retro"] .search-box input { font-size: 14px; }
[data-skin="retro"] .search-ic, [data-skin="retro"] .search-kbd { display: none; }
[data-skin="retro"] .search-go { display: inline-flex; align-items: center; height: 28px; padding: 0 14px; }
[data-skin="retro"] .suggest { border-radius: 0; border-color: #999; padding: 0; }
[data-skin="retro"] .sug { height: 24px; font-size: 13px; }
[data-skin="retro"] .sug-text { font-size: 13px; }
[data-skin="retro"] .sug:hover, [data-skin="retro"] .sug.active { background: #d6e3f7; }
[data-skin="retro"] .sug .i { display: none; }
[data-skin="retro"] .top-btn { border-radius: 3px; color: #555; }
[data-skin="retro"] #theme-btn { display: none; }

/* sidebar as a classic module box */
[data-skin="retro"] .guide { background: #fff; border-right: 1px solid #ddd; }
[data-skin="retro"] .g-item { height: 26px; border-radius: 0; color: #0033cc; font-size: 12px; gap: 10px; }
[data-skin="retro"] .g-item .i { width: 16px; height: 16px; color: #666; }
[data-skin="retro"] .g-item:hover { background: #eef3fb; text-decoration: underline; }
[data-skin="retro"] .g-item.on { background: #e1e8f4; color: #000; font-weight: bold; }
[data-skin="retro"] .g-head, [data-skin="retro"] .set-group h2 {
  margin: 4px 0; padding: 4px 8px; background: linear-gradient(#fafafa, #e4e4e4); border: 1px solid #ccc;
  font: bold 12px Arial, sans-serif; color: #333; text-transform: none; letter-spacing: 0;
}
[data-skin="retro"] .g-sec { border-bottom-color: #e5e5e5; }
[data-skin="retro"] .g-chan img, [data-skin="retro"] .g-ph { width: 18px; height: 18px; border-radius: 0; border: 1px solid #ccc; }
[data-skin="retro"] body[data-guide="rail"] .g-item { height: 60px; font-size: 10px; }

/* content */
[data-skin="retro"] .page { max-width: 1040px; }
[data-skin="retro"] .page-head h1 { font: bold 20px Arial, sans-serif; letter-spacing: 0; }
[data-skin="retro"] .chipbar, [data-skin="retro"] .filters { gap: 6px; background: #fff; border-bottom: 1px solid #e5e5e5; margin-bottom: 12px; }
[data-skin="retro"] .shelf > header, [data-skin="retro"] .feed-head {
  display: flex; align-items: center; justify-content: space-between; padding: 5px 10px; margin-bottom: 12px;
  background: linear-gradient(#fafafa, #e6e6e6); border: 1px solid #ccc;
}
[data-skin="retro"] .feed-head h2 { margin: 0; font: bold 14px Arial, sans-serif; color: #333; }
[data-skin="retro"] .shelf h2 { font: bold 14px Arial, sans-serif; color: #333; letter-spacing: 0; }
[data-skin="retro"] .shelf h2 .i { width: 16px; height: 16px; color: #cc181e; }
[data-skin="retro"] .shelf > header a { color: #0033cc; font-size: 12px; padding: 0; }
[data-skin="retro"] .shelf > header a:hover { background: none; text-decoration: underline; }
[data-skin="retro"] .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px 14px; }

[data-skin="retro"] .thumb { border-radius: 0; border: 1px solid #999; padding: 1px; background: #fff; }
[data-skin="retro"] .thumb img { border: 0; }
[data-skin="retro"] .badge { border-radius: 0; right: 3px; bottom: 3px; padding: 0 3px; background: #000; font: bold 11px Arial, sans-serif; opacity: 0.85; }
[data-skin="retro"] .watched::after { background: #cc181e; }
[data-skin="retro"] .avatar { display: none; }
[data-skin="retro"] .card-body { padding-top: 5px; gap: 6px; }
[data-skin="retro"] .card-title { font: bold 12px/1.3 Arial, sans-serif; color: #0033cc; }
[data-skin="retro"] .card-title:hover { text-decoration: underline; }
[data-skin="retro"] .card-channel { font-size: 11px; color: #0033cc; margin-top: 2px; }
[data-skin="retro"] .card-channel img { display: none; }
[data-skin="retro"] .card-channel::before { content: 'From: '; color: #666; margin-right: 3px; }
[data-skin="retro"] .card-sub, [data-skin="retro"] .card-snippet { font-size: 11px; color: #666; }
[data-skin="retro"] .card-row { grid-template-columns: minmax(0, 200px) minmax(0, 1fr); padding-bottom: 12px; border-bottom: 1px dotted #ccc; }
[data-skin="retro"] .card-row .card-title { font-size: 14px; }
[data-skin="retro"] .card-compact { grid-template-columns: 120px minmax(0, 1fr); }
[data-skin="retro"] .card-compact .card-title { font-size: 12px; }
[data-skin="retro"] .card-chan img, [data-skin="retro"] .ch-avatar, [data-skin="retro"] .w-channel img, [data-skin="retro"] .sub-strip img, [data-skin="retro"] .sub-row img { border-radius: 0; border: 1px solid #999; padding: 1px; }
[data-skin="retro"] .short { border-radius: 0; border: 1px solid #999; }
[data-skin="retro"] .ta { border-radius: 2px; }

/* watch page */
[data-skin="retro"] .watch { max-width: 1040px; }
[data-skin="retro"] .w-title { font: bold 18px Arial, sans-serif; color: #000; letter-spacing: 0; }
[data-skin="retro"] .w-channel b { font-size: 13px; color: #0033cc; }
[data-skin="retro"] .w-channel img { width: 36px; height: 36px; }
[data-skin="retro"] .w-desc { border-radius: 0; background: #f3f3f3; border: 1px solid #ddd; font-size: 12px; }
[data-skin="retro"] .w-desc-text a, [data-skin="retro"] .ts { color: #0033cc; }
[data-skin="retro"] .side-sec h3 { font: bold 13px Arial, sans-serif; }
[data-skin="retro"] .queue-sec, [data-skin="retro"] .w-playlist { border-radius: 0; }

/* player: the glossy dark bar */
[data-skin="retro"] .ply { border-radius: 0; --ply-accent: #cc181e; }
[data-skin="retro"] .ply-controls { padding: 0; background: linear-gradient(#4a4a4a, #1c1c1c); border-top: 1px solid #666; }
[data-skin="retro"] .ply-seek { height: 12px; padding: 0 6px; }
[data-skin="retro"] .ply-rail { height: 6px; border-radius: 0; background: #555; box-shadow: inset 0 1px 2px #000; }
[data-skin="retro"] .ply-seek:hover .ply-rail { height: 6px; }
[data-skin="retro"] .ply-buf { background: #8a8a8a; }
[data-skin="retro"] .ply-knob { border-radius: 2px; width: 10px; height: 12px; margin: -6px 0 0 -5px; background: linear-gradient(#fff, #bbb); transform: scale(1); }
[data-skin="retro"] .ply-row { height: 32px; }
[data-skin="retro"] .pb { min-width: 30px; height: 28px; border-radius: 2px; padding: 0 5px; }
[data-skin="retro"] .pb .i { width: 18px; height: 18px; }
[data-skin="retro"] .ply-time { font: 11px Arial, sans-serif; color: #ddd; }
[data-skin="retro"] .ply-bigplay { border-radius: 8px; background: linear-gradient(#555, #111); color: #fff; width: 70px; height: 50px; margin: -25px 0 0 -35px; border: 1px solid #000; }
[data-skin="retro"] .ply-menu { border-radius: 0; }

/* settings, library, misc */
[data-skin="retro"] .set-card { border-radius: 0; border-color: #ccc; }
[data-skin="retro"] .set-row { min-height: 40px; font-weight: normal; }
[data-skin="retro"] select, [data-skin="retro"] .set-input { border-radius: 0; height: 24px; font: 12px Arial, sans-serif; background-color: #fff; border-color: #999; }
[data-skin="retro"] .switch { border-radius: 0; width: 34px; height: 18px; border: 1px solid #999; }
[data-skin="retro"] .switch::after { border-radius: 0; width: 14px; height: 14px; top: 1px; left: 1px; }
[data-skin="retro"] .switch:checked { background: #6c8fd0; }
[data-skin="retro"] .tabs { background: none; border-bottom: 1px solid #ccc; border-radius: 0; padding: 0; gap: 2px; }
[data-skin="retro"] .tab { border-radius: 3px 3px 0 0; border-bottom: 0; }
[data-skin="retro"] .toast { border-radius: 0; background: #ffffcc; color: #333; border: 1px solid #e5dd9b; box-shadow: none; }
[data-skin="retro"] .toast-btn { color: #0033cc; }
[data-skin="retro"] .toast-x { color: #666; }
[data-skin="retro"] .watch.mini { border-radius: 0; border-color: #999; }
[data-skin="retro"] .sh-frame { border-radius: 0; }
[data-skin="retro"] .sh-act, [data-skin="retro"] .sh-navbtn { border-radius: 3px; border: 1px solid #c6c6c6; background: linear-gradient(#fefefe, #e5e5e5); }
[data-skin="retro"] .ch-banner { border-radius: 0; }
[data-skin="retro"] .ch-info h1 { font: bold 24px Arial, sans-serif; letter-spacing: 0; }
[data-skin="retro"] .empty h3 { font: bold 14px Arial, sans-serif; }
