/* yt2pod — Apple-style PWA. System font, grouped surfaces, translucent chrome, springs in JS. */

:root {
  --bg: #f2f2f7;
  --bg-elevated: #ffffff;
  --fill: rgba(120, 120, 128, 0.12);
  --fill-strong: rgba(120, 120, 128, 0.2);
  --label: #000000;
  --label-2: rgba(60, 60, 67, 0.62);
  --label-3: rgba(60, 60, 67, 0.36);
  --separator: rgba(60, 60, 67, 0.16);
  --accent: #7c3aed;
  --accent-soft: rgba(124, 58, 237, 0.12);
  --on-accent: #ffffff;
  --danger: #ff3b30;
  --success: #34c759;
  --warning: #ff9500;
  --chrome: rgba(249, 249, 251, 0.72);
  --chrome-heavy: rgba(242, 242, 247, 0.82);
  --chrome-edge: rgba(255, 255, 255, 0.5);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-2: 0 8px 30px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.06);
  --shadow-art: 0 18px 40px rgba(0, 0, 0, 0.22);
  --scrim: rgba(0, 0, 0, 0.32);
  /* Liquid Glass (phone tab bar and mini player) */
  --glass: rgba(255, 255, 255, 0.5);
  --glass-lens: rgba(120, 120, 128, 0.14);
  --glass-rim: rgba(255, 255, 255, 0.75);
  --glass-rim-low: rgba(255, 255, 255, 0.28);
  --glass-shadow: 0 10px 34px rgba(0, 0, 0, 0.14), 0 2px 8px rgba(0, 0, 0, 0.06);
  --radius: 14px;
  --radius-s: 10px;
  --tabbar-h: 50px;
  --mini-h: 64px;
  --sidebar-w: 248px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

/* Dark: follows the system unless the user picked a theme in Ajustes (data-theme on <html>). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --bg-elevated: #1c1c1e;
    --fill: rgba(120, 120, 128, 0.24);
    --fill-strong: rgba(120, 120, 128, 0.36);
    --label: #ffffff;
    --label-2: rgba(235, 235, 245, 0.62);
    --label-3: rgba(235, 235, 245, 0.32);
    --separator: rgba(84, 84, 88, 0.6);
    --accent: #a78bfa;
    --accent-soft: rgba(167, 139, 250, 0.16);
    --on-accent: #1a0b3d;
    --danger: #ff453a;
    --success: #30d158;
    --warning: #ff9f0a;
    --chrome: rgba(22, 22, 24, 0.72);
    --chrome-heavy: rgba(28, 28, 30, 0.86);
    --chrome-edge: rgba(255, 255, 255, 0.08);
    --shadow-1: none;
    --shadow-2: 0 10px 40px rgba(0, 0, 0, 0.6);
    --shadow-art: 0 18px 50px rgba(0, 0, 0, 0.6);
    --scrim: rgba(0, 0, 0, 0.55);
    --glass: rgba(42, 42, 46, 0.48);
    --glass-lens: rgba(255, 255, 255, 0.12);
    --glass-rim: rgba(255, 255, 255, 0.22);
    --glass-rim-low: rgba(255, 255, 255, 0.06);
    --glass-shadow: 0 10px 40px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000;
  --bg-elevated: #1c1c1e;
  --fill: rgba(120, 120, 128, 0.24);
  --fill-strong: rgba(120, 120, 128, 0.36);
  --label: #ffffff;
  --label-2: rgba(235, 235, 245, 0.62);
  --label-3: rgba(235, 235, 245, 0.32);
  --separator: rgba(84, 84, 88, 0.6);
  --accent: #a78bfa;
  --accent-soft: rgba(167, 139, 250, 0.16);
  --on-accent: #1a0b3d;
  --danger: #ff453a;
  --success: #30d158;
  --warning: #ff9f0a;
  --chrome: rgba(22, 22, 24, 0.72);
  --chrome-heavy: rgba(28, 28, 30, 0.86);
  --chrome-edge: rgba(255, 255, 255, 0.08);
  --shadow-1: none;
  --shadow-2: 0 10px 40px rgba(0, 0, 0, 0.6);
  --shadow-art: 0 18px 50px rgba(0, 0, 0, 0.6);
  --scrim: rgba(0, 0, 0, 0.55);
  --glass: rgba(42, 42, 46, 0.48);
  --glass-lens: rgba(255, 255, 255, 0.12);
  --glass-rim: rgba(255, 255, 255, 0.22);
  --glass-rim-low: rgba(255, 255, 255, 0.06);
  --glass-shadow: 0 10px 40px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--label);
  font: 100%/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  font-size: 1.0625rem; /* 17px, iOS body */
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
img { display: block; }
a { color: var(--accent); text-decoration: none; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; border-radius: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- type scale (tracking tightens as size grows) --- */
.t-large { font-size: 2.125rem; line-height: 1.12; font-weight: 700; letter-spacing: -0.025em; }
.t-title2 { font-size: 1.375rem; line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; }
.t-title3 { font-size: 1.25rem; line-height: 1.25; font-weight: 600; letter-spacing: -0.017em; }
.t-headline { font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.012em; }
.t-sub { font-size: 0.9375rem; line-height: 1.33; letter-spacing: -0.006em; }
.t-foot { font-size: 0.8125rem; line-height: 1.35; letter-spacing: 0; }
.t-cap { font-size: 0.75rem; line-height: 1.3; letter-spacing: 0.01em; }
.dim { color: var(--label-2); }
.dim3 { color: var(--label-3); }
.clamp1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.num { font-variant-numeric: tabular-nums; }

/* --- layout --- */
.shell { min-height: 100dvh; }
.main {
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 24px);
}
.main.has-player { padding-bottom: calc(var(--tabbar-h) + var(--mini-h) + var(--safe-b) + 28px); }
.page { max-width: 860px; margin: 0 auto; padding: 0 16px; animation: page-in 260ms cubic-bezier(.2,.8,.2,1); }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } }

/* Navigation bar: invisible until content scrolls beneath it (scroll edge effect). */
.navbar {
  position: sticky; top: 0; z-index: 20;
  padding-top: var(--safe-t);
  margin: 0 -16px;
  transition: background-color 200ms ease, box-shadow 200ms ease;
}
.navbar.scrolled {
  background: var(--chrome);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 0.5px 0 var(--separator);
}
.navbar-row { height: 44px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 8px; }
.navbar-title { font-weight: 600; font-size: 1.0625rem; opacity: 0; transform: translateY(4px); transition: opacity 180ms ease, transform 180ms ease; text-align: center; max-width: 60vw; }
.navbar.always .navbar-title { opacity: 1; transform: none; }
.navbar-left { justify-self: start; display: flex; }
.navbar-right { justify-self: end; display: flex; gap: 4px; }
.large-title { padding: 2px 0 10px; }

.nav-btn {
  display: inline-flex; align-items: center; gap: 2px; height: 44px; min-width: 44px; padding: 0 8px;
  color: var(--accent); font-size: 1.0625rem; border-radius: 10px;
  transition: opacity 120ms ease;
}
.nav-btn:active { opacity: 0.45; transition: none; }
.nav-btn svg { width: 22px; height: 22px; }
.nav-btn.back svg { width: 13px; height: 22px; margin-right: 4px; }

/* --- tab bar (phone) / sidebar (desktop) --- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  padding-bottom: var(--safe-b);
  background: var(--chrome-heavy);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  box-shadow: 0 -0.5px 0 var(--separator);
  display: flex; justify-content: space-around;
}
.tab {
  flex: 1; height: var(--tabbar-h); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--label-3); font-size: 0.625rem; font-weight: 500; letter-spacing: 0.01em;
  transition: transform 100ms ease-out;
}
.tab svg { width: 26px; height: 26px; }
.tab.on { color: var(--accent); }
.tab:active { transform: scale(0.92); transition: none; }
.brand { display: none; }

@media (min-width: 900px) {
  .tabbar {
    top: 0; right: auto; width: var(--sidebar-w); flex-direction: column; justify-content: flex-start;
    padding: calc(20px + var(--safe-t)) 12px 12px; gap: 2px;
    box-shadow: 0.5px 0 0 var(--separator);
  }
  .brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 700; font-size: 1.25rem; letter-spacing: -0.02em; }
  .brand img { width: 30px; height: 30px; border-radius: 8px; }
  .tab {
    flex: none; height: 40px; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 12px;
    border-radius: 10px; font-size: 0.9375rem; color: var(--label); letter-spacing: -0.006em;
  }
  .tab svg { width: 22px; height: 22px; color: var(--accent); }
  .tab.on { background: var(--fill); color: var(--label); }
  .tab:hover:not(.on) { background: color-mix(in srgb, var(--fill) 50%, transparent); }
  .main { margin-left: var(--sidebar-w); padding-bottom: 32px; }
  .main.has-player { padding-bottom: calc(var(--mini-h) + 40px); }
  .page { padding: 0 32px; }
  .navbar { margin: 0 -32px; }
  .navbar-row { padding: 0 20px; }
}

/* --- grouped lists (Settings style) --- */
.section { margin: 26px 0 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 4px 8px; }
.section-head h2 { margin: 0; }
.group { background: var(--bg-elevated); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-1); }
.cell {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 10px 16px; position: relative;
  width: 100%; text-align: left; background: var(--bg-elevated);
}
.cell + .cell::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 0.5px; background: var(--separator); }
button.cell:active, .cell.tappable:active { background: var(--fill); transition: none; }
.cell .grow { flex: 1; min-width: 0; }
.cell-value { color: var(--label-2); }
.cell.pref { flex-direction: column; align-items: stretch; gap: 8px; }
.cell.pref .pref-label { color: var(--label-2); font-size: 0.8125rem; }
.foot-note { margin: 8px 16px 0; color: var(--label-2); font-size: 0.8125rem; line-height: 1.4; }
.chev { width: 8px; height: 14px; color: var(--label-3); flex: none; }

/* --- buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 44px; padding: 0 20px; border-radius: 12px; font-weight: 600; font-size: 1.0625rem;
  background: var(--accent); color: var(--on-accent);
  transition: transform 100ms ease-out, opacity 150ms ease, background-color 200ms ease;
}
.btn:active { transform: scale(0.97); transition: none; }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.block { width: 100%; }
.btn.tinted { background: var(--accent-soft); color: var(--accent); }
.btn.gray { background: var(--fill); color: var(--label); }
.btn.small { height: 32px; padding: 0 14px; font-size: 0.9375rem; border-radius: 999px; }
.btn.pill { border-radius: 999px; }
.btn.danger { color: var(--danger); }
.btn.tinted.danger { background: color-mix(in srgb, var(--danger) 14%, transparent); }
.link-btn { color: var(--accent); font-size: 1.0625rem; padding: 6px 2px; transition: opacity 120ms; }
.link-btn:active { opacity: 0.45; transition: none; }
.link-btn.small { font-size: 0.9375rem; }

.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  color: var(--accent); transition: transform 100ms ease-out, background-color 150ms;
}
.icon-btn:active { transform: scale(0.9); background: var(--fill); transition: none; }
.icon-btn svg { width: 24px; height: 24px; }

/* --- inputs --- */
.field {
  width: 100%; height: 48px; padding: 0 14px; border-radius: 12px; border: 0;
  background: var(--fill); outline: none; font-size: 1.0625rem;
  transition: box-shadow 150ms ease;
}
.field:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.searchbar { position: relative; display: flex; align-items: center; gap: 8px; }
.searchbar .field { height: 40px; padding-left: 36px; padding-right: 36px; border-radius: 11px; }
.searchbar .glass { position: absolute; left: 10px; width: 18px; height: 18px; color: var(--label-2); pointer-events: none; }
.searchbar .clear { position: absolute; right: 8px; width: 22px; height: 22px; color: var(--label-3); display: grid; place-items: center; }
.field::-webkit-search-cancel-button { display: none; }

/* --- switch & segmented control --- */
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--fill-strong); transition: background-color 250ms ease; pointer-events: none; }
.switch span::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 1px 1px rgba(0,0,0,.16);
  transition: transform 300ms cubic-bezier(.3,1.3,.5,1), width 150ms ease;
}
.switch input:checked + span { background: var(--success); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:active + span::after { width: 33px; }
.switch input:checked:active + span::after { transform: translateX(14px); }

.segmented { display: flex; background: var(--fill); border-radius: 9px; padding: 2px; position: relative; }
.segmented button {
  flex: 1; height: 30px; font-size: 0.8125rem; font-weight: 500; border-radius: 7px; position: relative; z-index: 1;
  transition: color 150ms;
}
.segmented .thumb {
  position: absolute; top: 2px; bottom: 2px; border-radius: 7px; background: var(--bg-elevated);
  box-shadow: 0 3px 8px rgba(0,0,0,.12), 0 3px 1px rgba(0,0,0,.04);
  transition: transform 320ms cubic-bezier(.2,.9,.25,1), width 320ms cubic-bezier(.2,.9,.25,1);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .segmented .thumb { background: #636366; } }
:root[data-theme="dark"] .segmented .thumb { background: #636366; }
.segmented button.on { font-weight: 600; }

/* --- chips --- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 12px; border-radius: 999px;
  background: var(--fill); font-size: 0.9375rem; transition: transform 100ms ease-out;
}
.chip:active { transform: scale(0.95); transition: none; }
.chip.on { background: var(--label); color: var(--bg-elevated); }
.chip .x { width: 16px; height: 16px; opacity: 0.6; }
.chip-input { height: 32px; border-radius: 999px; background: transparent; border: 1px dashed var(--label-3); padding: 0 12px; outline: none; font-size: 0.9375rem; width: 150px; }
.chip-input:focus { border-style: solid; border-color: var(--accent); }

/* --- images --- */
.thumb16 { position: relative; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: var(--fill); flex: none; }
.thumb16 img { width: 100%; height: 100%; object-fit: cover; }
.thumb16 .dur {
  position: absolute; right: 4px; bottom: 4px; padding: 1px 5px; border-radius: 5px;
  background: rgba(0, 0, 0, 0.72); color: #fff; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.thumb16 .bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.35); }
.thumb16 .bar i { display: block; height: 100%; background: var(--accent); }
.avatar { border-radius: 50%; overflow: hidden; background: var(--fill); flex: none; display: grid; place-items: center; font-weight: 600; color: #fff; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.placeholder-art { width: 100%; height: 100%; display: grid; place-items: center; color: rgba(255,255,255,.9); }
.placeholder-art svg { width: 34%; height: 34%; }
img.fade { opacity: 0; transition: opacity 250ms ease; }
img.fade.loaded { opacity: 1; }

/* --- episode rows --- */
.ep-list { display: flex; flex-direction: column; }
.ep {
  display: grid; grid-template-columns: 112px 1fr auto; gap: 12px; align-items: center;
  padding: 10px 0; position: relative; text-align: left; width: 100%;
  border-radius: 12px; transition: background-color 150ms;
}
.ep + .ep::before { content: ""; position: absolute; top: 0; left: 124px; right: 0; height: 0.5px; background: var(--separator); }
.ep .body { min-width: 0; display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.ep .body:active { opacity: 0.6; transition: none; }
.ep .kicker { font-size: 0.75rem; font-weight: 600; color: var(--label-2); text-transform: uppercase; letter-spacing: 0.03em; }
.ep .title { font-size: 0.9375rem; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; }
.ep.played .title { color: var(--label-2); font-weight: 500; }
.ep .meta { font-size: 0.8125rem; color: var(--label-2); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
/* Items separated by dots; a dot that would start a wrapped line is pushed out of view. */
.ep .meta.dots { display: flex; flex-wrap: wrap; gap: 0 16px; overflow: hidden; }
.ep .meta.dots > span { margin-left: -10px; }
.ep .meta.dots > span::before { content: "·"; display: inline-block; width: 4px; margin-right: 6px; }
.ep .meta .warn { color: var(--danger); }
.ep .meta .note { color: var(--label-3); }
.ep .trail { display: flex; align-items: center; gap: 0; }
.ep.selecting { grid-template-columns: 28px 112px 1fr; cursor: pointer; }
.ep.selecting + .ep.selecting::before { left: 164px; }
.ep.dimmed .thumb16, .ep.dimmed .body { opacity: 0.55; }
@media (min-width: 900px) {
  .ep { grid-template-columns: 160px 1fr auto; padding: 12px 8px; margin: 0 -8px; }
  .ep + .ep::before { left: 180px; right: 8px; }
  .ep:hover { background: color-mix(in srgb, var(--fill) 45%, transparent); }
  .ep.selecting { grid-template-columns: 28px 160px 1fr; }
  .ep .title { font-size: 1rem; }
}
.check {
  width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--label-3); display: grid; place-items: center;
  transition: background-color 150ms, border-color 150ms, transform 200ms cubic-bezier(.3,1.5,.5,1);
}
.check svg { width: 14px; height: 14px; color: #fff; opacity: 0; transform: scale(.6); transition: opacity 120ms, transform 200ms cubic-bezier(.3,1.5,.5,1); }
.check.on { background: var(--accent); border-color: var(--accent); }
.check.on svg { opacity: 1; transform: none; }

/* round action: play / add / progress ring */
.round {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; position: relative;
  background: var(--fill); color: var(--accent); flex: none; margin-left: 4px;
  transition: transform 100ms ease-out, background-color 200ms;
}
.round:active { transform: scale(0.88); transition: none; }
.round svg.glyph { width: 15px; height: 15px; }
.round.add svg.glyph { width: 17px; height: 17px; }
.round.done { background: var(--accent-soft); }
.round .ring { position: absolute; inset: 0; transform: rotate(-90deg); }
.round .ring circle { fill: none; stroke-width: 2.5; }
.round .ring .track { stroke: var(--fill-strong); }
.round .ring .val { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 400ms ease; }
.round .ring.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(270deg); } }
.round .stopsq { width: 9px; height: 9px; border-radius: 2px; background: var(--accent); }
.more-btn { width: 36px; height: 36px; display: grid; place-items: center; color: var(--label-2); border-radius: 50%; }
.more-btn:active { background: var(--fill); transition: none; }
.more-btn svg { width: 20px; height: 20px; }

/* --- continue listening shelf --- */
.shelf { display: grid; grid-auto-flow: column; grid-auto-columns: min(72%, 300px); gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 2px 16px 6px; scrollbar-width: none; }
.shelf::-webkit-scrollbar { display: none; }
.card { scroll-snap-align: start; display: flex; flex-direction: column; gap: 8px; text-align: left; transition: transform 120ms ease-out; }
.card:active { transform: scale(0.97); transition: none; }
.card .thumb16 { border-radius: 12px; box-shadow: var(--shadow-1); }
.card .play-chip {
  position: absolute; left: 10px; bottom: 12px; display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 10px 0 8px; border-radius: 999px; font-size: 0.8125rem; font-weight: 600; color: #fff;
  background: rgba(30, 30, 30, 0.45); -webkit-backdrop-filter: blur(16px) saturate(160%); backdrop-filter: blur(16px) saturate(160%);
}
.card .play-chip svg { width: 12px; height: 12px; }
@media (min-width: 900px) { .shelf { margin: 0 -32px; padding: 2px 32px 6px; grid-auto-columns: 280px; } }

/* --- channels grid --- */
.ch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 22px 14px; padding-top: 6px; }
.ch-tile { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; transition: transform 120ms ease-out; position: relative; }
.ch-tile:active { transform: scale(0.95); transition: none; }
.ch-tile .avatar { width: 88px; height: 88px; font-size: 1.75rem; box-shadow: var(--shadow-1); }
.ch-tile .name { font-size: 0.875rem; font-weight: 500; line-height: 1.25; max-width: 100%; }
.badge {
  position: absolute; top: 0; right: calc(50% - 50px); min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  background: var(--accent); color: var(--on-accent); font-size: 0.75rem; font-weight: 700; display: grid; place-items: center;
  box-shadow: 0 0 0 3px var(--bg);
}

/* --- search results --- */
.result { display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 12px; padding: 10px 0; position: relative; width: 100%; text-align: left; }
.result + .result::before { content: ""; position: absolute; top: 0; left: 64px; right: 0; height: 0.5px; background: var(--separator); }
.result .avatar { width: 52px; height: 52px; font-size: 1.25rem; }
.result .info { min-width: 0; cursor: pointer; }
.result .info:active { opacity: 0.6; transition: none; }
.verified { width: 14px; height: 14px; color: var(--label-2); display: inline-block; vertical-align: -1px; margin-left: 3px; }
.results.loading { opacity: 0.5; transition: opacity 200ms ease 150ms; }
.skel { background: var(--fill); border-radius: 6px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.5; } }

/* --- channel header --- */
.ch-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 8px 0 4px; }
.ch-hero .avatar { width: 112px; height: 112px; font-size: 2.5rem; box-shadow: var(--shadow-2); margin-bottom: 8px; }
.ch-hero .actions { display: flex; gap: 10px; margin-top: 12px; }
.ch-desc { color: var(--label-2); font-size: 0.9375rem; max-width: 560px; margin: 6px auto 0; }
@media (min-width: 900px) {
  .ch-hero { flex-direction: row; text-align: left; gap: 24px; align-items: center; padding-top: 16px; }
  .ch-hero .avatar { margin: 0; width: 128px; height: 128px; }
  .ch-hero .actions { margin-top: 14px; }
  .ch-desc { margin: 6px 0 0; }
}
.rules { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 12px; border-top: 0.5px solid var(--separator); }
.load-older { display: flex; justify-content: center; margin: 18px 0 6px; }
.load-older .btn { gap: 8px; }
.rules label.t-foot { color: var(--label-2); display: block; margin-bottom: 6px; }

/* --- floating selection bar --- */
.selbar {
  position: fixed; z-index: 45; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px);
  display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 18px; border-radius: 999px;
  background: var(--chrome-heavy); -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  box-shadow: var(--shadow-2), inset 0 0.5px 0 var(--chrome-edge);
  animation: rise 320ms cubic-bezier(.2,.9,.25,1);
  max-width: calc(100vw - 24px); white-space: nowrap;
}
@keyframes rise { from { transform: translate(-50%, 24px) scale(.96); opacity: 0; } }
@media (min-width: 900px) { .selbar { left: calc(50% + var(--sidebar-w) / 2); bottom: 24px; } }
.main.has-player ~ .selbar { bottom: calc(var(--tabbar-h) + var(--mini-h) + var(--safe-b) + 16px); }
@media (min-width: 900px) { .main.has-player ~ .selbar { bottom: calc(var(--mini-h) + 28px); } }

/* --- mini player --- */
.mini {
  position: fixed; z-index: 41; left: 8px; right: 8px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 8px);
  height: var(--mini-h); border-radius: 16px; overflow: hidden;
  display: flex; align-items: center; gap: 12px; padding: 0 6px 0 8px;
  background: var(--chrome-heavy); -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%);
  box-shadow: var(--shadow-2), inset 0 0.5px 0 var(--chrome-edge);
}
.mini .art { width: 84px; flex: none; cursor: pointer; }
.mini .art .thumb16 { border-radius: 8px; }
.mini .txt { flex: 1; min-width: 0; cursor: pointer; }
.mini .txt:active { opacity: 0.6; transition: none; }
.mini .prog { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--fill); }
.mini .prog i { display: block; height: 100%; background: var(--accent); }
.mini .ctl { color: var(--label); }
.mini .ctl svg { width: 26px; height: 26px; }
.mini .scrub, .desk-only { display: none; }
@media (min-width: 900px) {
  .mini { left: calc(var(--sidebar-w) + 16px); right: 16px; bottom: 16px; padding: 0 14px 0 8px; gap: 14px; }
  .mini .txt { flex: 0 1 300px; }
  .mini .desk-only { display: inline-grid; }
  .mini .scrub { display: flex; flex: 1; align-items: center; gap: 10px; min-width: 200px; }
  .mini .prog { display: none; }
}

/* --- sheets --- */
.scrim { position: fixed; inset: 0; z-index: 60; background: var(--scrim); opacity: 0; }
.sheet {
  position: fixed; z-index: 61; left: 0; right: 0; bottom: 0; top: calc(var(--safe-t) + 10px);
  border-radius: 14px 14px 0 0; background: var(--bg-elevated); overflow: hidden;
  display: flex; flex-direction: column; will-change: transform;
  box-shadow: 0 -10px 40px rgba(0,0,0,.18);
}
.sheet .grabber { flex: none; height: 24px; display: grid; place-items: center; cursor: grab; touch-action: none; }
.sheet .grabber i { width: 36px; height: 5px; border-radius: 3px; background: var(--label-3); }
.sheet-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
@media (min-width: 900px) {
  .sheet { left: 50%; width: 560px; margin-left: -280px; top: 40px; bottom: 40px; border-radius: 20px; box-shadow: var(--shadow-2); }
}

/* full player */
.player { padding: 8px 28px calc(28px + var(--safe-b)); display: flex; flex-direction: column; gap: 22px; max-width: 520px; margin: 0 auto; width: 100%; }
.player .art-wrap { padding: 8px 0 4px; }
.player .art {
  border-radius: 14px; box-shadow: var(--shadow-art);
  transition: transform 500ms cubic-bezier(.25,1.2,.4,1), box-shadow 400ms ease;
}
.player .art.paused { transform: scale(0.86); box-shadow: var(--shadow-1); }
.player .art .thumb16 { border-radius: 14px; }
.player .who { display: flex; align-items: flex-end; gap: 12px; }
.player .who .grow { min-width: 0; flex: 1; }
.player .who .title { font-size: 1.1875rem; font-weight: 700; line-height: 1.25; letter-spacing: -0.017em; }
.player .who .chan { color: var(--accent); font-size: 1rem; margin-top: 2px; display: inline-block; }
.player .times { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--label-2); margin-top: 6px; font-variant-numeric: tabular-nums; font-weight: 500; }
.player .controls { display: flex; align-items: center; justify-content: space-evenly; }
.player .controls button { color: var(--label); border-radius: 50%; display: grid; place-items: center; transition: transform 120ms ease-out, background-color 150ms; }
.player .controls button:active { transform: scale(0.86); background: var(--fill); transition: none; }
.player .controls .skip { width: 64px; height: 64px; }
.player .controls .skip svg { width: 36px; height: 36px; }
.player .controls .big { width: 84px; height: 84px; }
.player .controls .big svg { width: 48px; height: 48px; }
.player .bottom { display: flex; justify-content: space-between; align-items: center; }
.player .desc { color: var(--label-2); font-size: 0.9375rem; white-space: pre-wrap; overflow-wrap: anywhere; border-top: 0.5px solid var(--separator); padding-top: 18px; }
.rate-btn { min-width: 52px; height: 32px; padding: 0 10px; border-radius: 8px; background: var(--fill); font-weight: 600; font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
.rate-btn:active { transform: scale(0.94); }
.sleep-btn { display: inline-flex; align-items: center; gap: 6px; color: var(--label); }
.sleep-btn svg { width: 17px; height: 17px; }
.sleep-btn.on { background: var(--accent-soft); color: var(--accent); }

/* scrubber */
.scrubber { position: relative; height: 28px; display: flex; align-items: center; cursor: pointer; touch-action: none; flex: 1; }
.scrubber .track { position: relative; width: 100%; height: 6px; border-radius: 3px; background: var(--fill-strong); overflow: hidden; transition: height 200ms cubic-bezier(.2,.9,.25,1); }
.scrubber .track i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--label-2); }
.scrubber.active .track { height: 12px; border-radius: 6px; }
.scrubber.active .track i { background: var(--label); }
.mini .scrubber .track { height: 4px; }
.mini .scrubber.active .track { height: 8px; }

/* action sheet */
.actions-sheet {
  position: fixed; z-index: 61; left: 8px; right: 8px; bottom: calc(8px + var(--safe-b));
  display: flex; flex-direction: column; gap: 8px; will-change: transform;
}
.actions-sheet .group { border-radius: 14px; background: var(--chrome-heavy); -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%); box-shadow: none; }
.actions-sheet .head { padding: 14px 16px; text-align: center; font-size: 0.8125rem; color: var(--label-2); }
.actions-sheet .act { display: block; width: 100%; height: 56px; font-size: 1.25rem; color: var(--accent); text-align: center; position: relative; background: transparent; }
.actions-sheet .head + .act::before, .actions-sheet .act + .act::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 0.5px; background: var(--separator); }
.actions-sheet .act:active { background: var(--fill); transition: none; }
.actions-sheet .act.destructive { color: var(--danger); }
.actions-sheet .act.cancel { font-weight: 600; background: var(--bg-elevated); border-radius: 14px; }
@media (min-width: 900px) { .actions-sheet { left: 50%; width: 400px; margin-left: -200px; bottom: 40px; } }

/* --- toast --- */
.toast {
  position: fixed; z-index: 80; left: 50%; top: calc(var(--safe-t) + 12px);
  display: flex; align-items: center; gap: 14px; padding: 10px 10px 10px 18px; border-radius: 999px;
  background: var(--chrome-heavy); -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  box-shadow: var(--shadow-2), inset 0 0.5px 0 var(--chrome-edge); font-size: 0.9375rem; font-weight: 500;
  transform: translateX(-50%); animation: drop 420ms cubic-bezier(.2,1.1,.3,1);
  width: max-content; max-width: calc(100vw - 32px);
}
.toast:not(:has(button)) { padding-right: 18px; }
@keyframes drop { from { transform: translate(-50%, -16px) scale(.94); opacity: 0; } }

/* --- empty states / auth --- */
.empty { text-align: center; padding: 56px 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .icon { width: 64px; height: 64px; color: var(--label-3); margin-bottom: 6px; }
.empty p { margin: 0; max-width: 340px; }
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.auth form { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.auth .appicon { width: 88px; height: 88px; border-radius: 20px; margin: 0 auto 10px; box-shadow: var(--shadow-2); }
.auth .err { color: var(--danger); font-size: 0.9375rem; min-height: 1.3em; }
.banner {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--warning) 14%, var(--bg-elevated)); font-size: 0.9375rem;
}
.banner svg { width: 20px; height: 20px; color: var(--warning); flex: none; margin-top: 1px; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid var(--fill-strong); border-top-color: var(--label-2); animation: spin2 0.8s linear infinite; }
@keyframes spin2 { to { transform: rotate(360deg); } }

/* --- accessibility preferences --- */
@media (prefers-reduced-motion: reduce) {
  .tab-lens { transition: none; }
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 120ms !important; }
  .round .ring.spin, .spinner { animation: none !important; }
  .player .art.paused { transform: none; }
}
/* --- Liquid Glass dock (phone): the tab bar and the mini player float as glass capsules --- */
@media (max-width: 899px) {
  :root { --tabbar-h: 62px; --mini-h: 56px; --dock-b: max(12px, calc(var(--safe-b) - 10px)); }
  .main { padding-bottom: calc(var(--tabbar-h) + var(--dock-b) + 28px); }
  .main.has-player { padding-bottom: calc(var(--tabbar-h) + var(--mini-h) + var(--dock-b) + 40px); }
  /* Content fades out under the dock, like iOS's scroll edge effect. */
  .shell::after {
    content: ""; position: fixed; left: 0; right: 0; bottom: 0; z-index: 39; pointer-events: none;
    height: calc(var(--tabbar-h) + var(--dock-b) + 30px);
    background: linear-gradient(to top, color-mix(in srgb, var(--bg) 78%, transparent), transparent);
  }
  .tabbar, .mini {
    background: var(--glass);
    -webkit-backdrop-filter: blur(16px) saturate(190%) brightness(1.04);
    backdrop-filter: blur(16px) saturate(190%) brightness(1.04);
    box-shadow: var(--glass-shadow), inset 0 1px 0.5px var(--glass-rim), inset 0 -1px 0.5px var(--glass-rim-low),
      inset 0 0 0 0.5px var(--glass-rim-low);
  }
  /* Specular sheen: light catching the top-left curve of the glass. */
  .tabbar::before, .mini::before {
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    background: radial-gradient(120% 90% at 18% -20%, var(--glass-rim-low), transparent 55%),
      radial-gradient(80% 70% at 100% 130%, var(--glass-rim-low), transparent 60%);
  }
  .tabbar {
    left: 16px; right: 16px; bottom: var(--dock-b); height: var(--tabbar-h);
    padding: 5px; border-radius: 999px; justify-content: stretch;
  }
  .tab { position: relative; z-index: 1; height: 100%; border-radius: 999px; color: var(--label); font-size: 0.625rem; font-weight: 600; }
  .tab svg { width: 24px; height: 24px; }
  .tab.on { color: var(--accent); }
  .tab:active { transform: scale(0.9); }
  /* The lens: a drop of glass that slides to the selected tab with a little overshoot. */
  .tab-lens {
    position: absolute; z-index: 0; top: 5px; bottom: 5px; left: 5px; width: calc((100% - 10px) / 4);
    border-radius: 999px; background: var(--glass-lens);
    box-shadow: inset 0 1px 0.5px var(--glass-rim-low), inset 0 0 0 0.5px var(--glass-rim-low);
    transition: transform 460ms cubic-bezier(.3, 1.35, .5, 1);
  }
  .tabbar:active .tab-lens { transition-duration: 300ms; }
  .mini {
    left: 16px; right: 16px; bottom: calc(var(--tabbar-h) + var(--dock-b) + 8px);
    border-radius: 999px; overflow: visible; padding: 0 8px 0 6px; gap: 10px;
  }
  .mini .art { width: 44px; height: 44px; }
  .mini .art .thumb16 { width: 44px; height: 44px; aspect-ratio: auto; border-radius: 50%; }
  .mini .prog { left: 22px; right: 22px; bottom: 3px; height: 2px; border-radius: 1px; overflow: hidden; background: transparent; }
  .mini .ctl { position: relative; z-index: 1; }
  .main.has-player ~ .selbar { bottom: calc(var(--tabbar-h) + var(--mini-h) + var(--dock-b) + 18px); }
  .selbar { bottom: calc(var(--tabbar-h) + var(--dock-b) + 14px); }
}
@media (min-width: 900px) { .tab-lens { display: none; } }

@media (prefers-reduced-transparency: reduce) {
  .navbar.scrolled, .tabbar, .mini, .selbar, .toast, .actions-sheet .group, .card .play-chip { background: var(--bg-elevated); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .tabbar::before, .mini::before, .shell::after { display: none; }
}
@media (prefers-contrast: more) {
  :root { --separator: rgba(60, 60, 67, 0.5); --label-2: rgba(60, 60, 67, 0.85); }
  .tabbar, .mini, .selbar, .toast { border: 1px solid var(--label-3); }
}
