/* ==========================================================================
   Apolo Podcasts — Apolo Energia identity × Fluent 2 × Spotify IA
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  /* Apolo brand ramp (Fluent-style numbering, 80 = logo blue #009AC8) */
  --brand-10: #001219;
  --brand-20: #00222e;
  --brand-30: #003142;
  --brand-40: #004056;
  --brand-50: #00506b;
  --brand-60: #006283;
  --brand-70: #007ba3; /* AA with white text (4.8:1) */
  --brand-80: #009ac8; /* logo */
  --brand-90: #1fa9d3;
  --brand-100: #42b7db;
  --brand-110: #66c5e3;
  --brand-120: #8cd4ea;
  --brand-130: #b1e2f1;
  --brand-140: #d3eff8;
  --brand-150: #eaf7fb;
  --brand-160: #f5fbfd;

  --font: "Segoe UI Variable Text", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;

  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;

  --ease: cubic-bezier(0.33, 0, 0.1, 1); /* Fluent "decelerate mid" */
  --ease-out: cubic-bezier(0.1, 0.9, 0.2, 1);
  --dur-fast: 120ms;
  --dur: 200ms;
  --dur-slow: 280ms;

  --sidebar-w: 256px;
  --player-h: 88px;
  --tabbar-h: 58px;
  --gutter: 32px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);

  /* Visible-viewport height for the mobile app shell (see the "Mobile app
     shell" section under Responsive, below). Progressive enhancement
     vh → svh → dvh; refined at runtime from the VisualViewport API by the
     --app-h listener in app.js for engines where dvh lags the real toolbar
     animation (e.g. mid-transition on some Android builds). */
  --app-h: 100vh;

  /* Light theme */
  color-scheme: light;
  --bg: #f4f7f9;
  --bg-blob-1: rgba(0, 154, 200, 0.14);
  --bg-blob-2: rgba(0, 123, 163, 0.08);
  --surface: #ffffff;
  --surface-2: #f3f6f8;
  --surface-3: #e8eef1;
  --surface-hover: rgba(0, 40, 60, 0.05);
  --surface-pressed: rgba(0, 40, 60, 0.09);
  --acrylic: rgba(255, 255, 255, 0.72);
  --acrylic-strong: rgba(250, 252, 253, 0.84);
  --stroke: #e1e7eb;
  --stroke-strong: #c5cfd6;
  --text: #0f1b22;
  --text-2: #43535d;
  --text-3: #5f6f79;
  --text-on-accent: #ffffff;
  --accent-text: var(--brand-70);
  --accent-fill: var(--brand-70);
  --accent-fill-hover: var(--brand-60);
  --accent-fill-pressed: var(--brand-50);
  --accent-icon: var(--brand-80);
  --accent-icon-hover: var(--brand-70);
  --accent-soft: var(--brand-150);
  --accent-soft-text: var(--brand-50);
  --danger: #c50f1f;
  --danger-hover: #a80d1a;
  --danger-soft: #fdf3f4;
  --success: #0e7a0d;
  --focus: #0f1b22;
  --focus-inner: #ffffff;
  --scrim: rgba(0, 18, 25, 0.38);

  --shadow-2: 0 0 2px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.14);
  --shadow-4: 0 0 2px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.14);
  --shadow-8: 0 0 2px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.14);
  --shadow-16: 0 0 2px rgba(0, 0, 0, 0.12), 0 8px 16px rgba(0, 0, 0, 0.14);
  --shadow-28: 0 0 8px rgba(0, 0, 0, 0.12), 0 14px 28px rgba(0, 0, 0, 0.14);
  --shadow-64: 0 0 8px rgba(0, 0, 0, 0.12), 0 32px 64px rgba(0, 0, 0, 0.14);
  --shadow-brand: 0 6px 18px rgba(0, 123, 163, 0.28);
}

@supports (height: 100svh) {
  :root { --app-h: 100svh; }
}
@supports (height: 100dvh) {
  :root { --app-h: 100dvh; }
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0b1216;
    --bg-blob-1: rgba(0, 154, 200, 0.16);
    --bg-blob-2: rgba(0, 98, 131, 0.14);
    --surface: #121b20;
    --surface-2: #172229;
    --surface-3: #1e2b33;
    --surface-hover: rgba(200, 235, 250, 0.06);
    --surface-pressed: rgba(200, 235, 250, 0.1);
    --acrylic: rgba(16, 25, 30, 0.72);
    --acrylic-strong: rgba(14, 22, 27, 0.86);
    --stroke: #223039;
    --stroke-strong: #34454f;
    --text: #eaf2f6;
    --text-2: #aebcc4;
    --text-3: #8d9da6;
    --text-on-accent: #001a24;
    --accent-text: #5cc6e8;
    --accent-fill: #3ab8e0;
    --accent-fill-hover: #5cc6e8;
    --accent-fill-pressed: #1fa9d3;
    --accent-icon: #3ab8e0;
    --accent-icon-hover: #5cc6e8;
    --accent-soft: rgba(0, 154, 200, 0.16);
    --accent-soft-text: #8cd4ea;
    --danger: #f1707b;
    --danger-hover: #f58b94;
    --danger-soft: rgba(241, 112, 123, 0.12);
    --success: #54b054;
    --focus: #ffffff;
    --focus-inner: #000000;
    --scrim: rgba(0, 0, 0, 0.55);

    --shadow-2: 0 0 2px rgba(0, 0, 0, 0.24), 0 1px 2px rgba(0, 0, 0, 0.28);
    --shadow-4: 0 0 2px rgba(0, 0, 0, 0.24), 0 2px 4px rgba(0, 0, 0, 0.28);
    --shadow-8: 0 0 2px rgba(0, 0, 0, 0.24), 0 4px 8px rgba(0, 0, 0, 0.28);
    --shadow-16: 0 0 2px rgba(0, 0, 0, 0.24), 0 8px 16px rgba(0, 0, 0, 0.28);
    --shadow-28: 0 0 8px rgba(0, 0, 0, 0.24), 0 14px 28px rgba(0, 0, 0, 0.28);
    --shadow-64: 0 0 8px rgba(0, 0, 0, 0.24), 0 32px 64px rgba(0, 0, 0, 0.28);
    --shadow-brand: 0 6px 18px rgba(0, 154, 200, 0.22);
  }
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-bottom: calc(var(--player-h) + 24px);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 14px;
  line-height: 20px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

h1, h2, h3, p, dl, dd, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
img, svg { display: block; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }

/* The single persistent <audio> element (SPEC: created once, never
   recreated) has no visual UI of its own. Hiding it keeps it out of the
   mobile app-shell's flex flow (see Responsive → Mobile app shell) without
   affecting playback, Media Session, or background/screen-off audio. */
audio#audio { display: none; }

::selection { background: var(--brand-130); color: var(--brand-20); }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--focus-inner);
  border-radius: var(--r-sm);
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.ic {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ic-lg { width: 24px; height: 24px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed;
  left: 12px; top: 12px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--surface);
  color: var(--text);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-16);
  transform: translateY(-200%);
  opacity: 0;
  transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.skip-link:focus-visible { transform: none; opacity: 1; }

/* Soft brand backdrop so acrylic surfaces have something to blur */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(900px 520px at 88% -8%, var(--bg-blob-1), transparent 70%),
    radial-gradient(700px 600px at -10% 105%, var(--bg-blob-2), transparent 70%),
    var(--bg);
}
.backdrop::after {
  /* Faint parallel strokes, same angle as the Apolo "A" */
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(63deg, transparent 0 46px, rgba(0, 154, 200, 0.035) 46px 47px);
  mask-image: linear-gradient(200deg, #000 0%, transparent 45%);
  -webkit-mask-image: linear-gradient(200deg, #000 0%, transparent 45%);
}

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

.sidebar {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 0;
  bottom: var(--player-h);
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px 12px 16px;
  background: var(--acrylic);
  -webkit-backdrop-filter: blur(30px) saturate(150%);
  backdrop-filter: blur(30px) saturate(150%);
  border-right: 1px solid var(--stroke);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px 22px;
  border-radius: var(--r-md);
}
.brand-mark { width: 38px; height: 35px; color: var(--brand-80); }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-name {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
}
.brand-sub {
  margin-top: 5px;
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.34em;
  color: var(--accent-text);
}

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-sep { height: 1px; margin: 10px 12px; background: var(--stroke); }

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--r-md);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item:active { background: var(--surface-pressed); }
.nav-item.is-active { background: var(--surface-hover); color: var(--text); font-weight: 600; }
.nav-item.is-active::before {
  /* Fluent selection indicator pill */
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 18px;
  margin-top: -9px;
  border-radius: 2px;
  background: var(--accent-icon);
}
.nav-item.is-active .ic { color: var(--accent-icon); }

.sidebar-foot { margin-top: auto; padding: 12px; }
.tagline {
  font-size: 11px;
  line-height: 16px;
  color: var(--text-3);
  letter-spacing: 0.02em;
}

.main {
  margin-left: var(--sidebar-w);
  padding: 28px var(--gutter) calc(var(--player-h) + 48px);
  min-height: 100vh;
}
.main:focus-visible { outline: none; box-shadow: none; }
.view { max-width: 1400px; margin: 0 auto; }
.view-enter { animation: view-in var(--dur-slow) var(--ease-out); }
@keyframes view-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Typography helpers ---------- */
.eyebrow {
  font-size: 11px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-text);
}
.eyebrow a:hover { text-decoration: underline; }

.page-head { margin-bottom: 24px; }
.page-head--row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-title {
  font-family: var(--font-display);
  font-size: 32px;
  line-height: 40px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 2px;
}
.page-title:focus-visible, .detail-title:focus-visible, .auth-title:focus-visible { outline: none; box-shadow: none; }
.page-sub { margin-top: 4px; color: var(--text-2); }

.section { margin-top: 40px; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.section-title {
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 28px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.section-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  border-radius: var(--r-sm);
}
.section-link .ic { width: 16px; height: 16px; }
.section-link:hover { color: var(--accent-text); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 32px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  user-select: none;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.btn .ic { width: 18px; height: 18px; }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn-lg { height: 40px; padding: 0 20px; font-size: 15px; border-radius: var(--r-md); }
.btn-block { width: 100%; }

.btn-primary { background: var(--accent-fill); color: var(--text-on-accent); box-shadow: var(--shadow-2); }
.btn-primary:hover:not(:disabled) { background: var(--accent-fill-hover); box-shadow: var(--shadow-brand); }
.btn-primary:active:not(:disabled) { background: var(--accent-fill-pressed); }

.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--stroke-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); border-color: var(--stroke-strong); }
.btn-secondary:active:not(:disabled) { background: var(--surface-3); }

.btn-subtle { background: transparent; color: var(--text-2); }
.btn-subtle:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }
.btn-subtle:active:not(:disabled) { background: var(--surface-pressed); }

.btn-glass {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.34);
  color: #fff;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.btn-glass:hover:not(:disabled) { background: rgba(255, 255, 255, 0.24); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); }
@media (prefers-color-scheme: dark) {
  .btn-danger { color: #1b0306; }
}

.btn.is-loading { position: relative; color: transparent !important; }
.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--text-on-accent);
  border-right-color: transparent;
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  color: var(--text-2);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.icon-btn:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }
.icon-btn:active:not(:disabled) { background: var(--surface-pressed); transform: scale(0.94); }
.icon-btn:disabled { opacity: 0.38; }
.icon-btn.is-active { color: var(--accent-text); }
.icon-btn-sm { width: 30px; height: 30px; }
.icon-btn-sm .ic { width: 18px; height: 18px; }
.icon-btn-lg { width: 48px; height: 48px; }
.icon-btn-lg .ic { width: 30px; height: 30px; }
.icon-btn-danger:hover:not(:disabled) { color: var(--danger); background: var(--danger-soft); }

.play-btn {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-icon);
  color: #fff;
  box-shadow: var(--shadow-4);
  transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), opacity var(--dur) var(--ease);
}
@media (prefers-color-scheme: dark) {
  .play-btn { color: var(--text-on-accent); }
}
.play-btn .ic { width: 18px; height: 18px; }
.play-btn:hover:not(:disabled) { background: var(--accent-icon-hover); transform: scale(1.05); box-shadow: var(--shadow-brand); }
.play-btn:active:not(:disabled) { transform: scale(0.96); }
.play-btn:disabled { opacity: 0.45; box-shadow: none; }
.play-btn:focus-visible { border-radius: 50%; }
.play-btn--sm { width: 34px; height: 34px; }
.play-btn--sm .ic { width: 16px; height: 16px; }
.play-btn--md { width: 46px; height: 46px; }
.play-btn--md .ic { width: 20px; height: 20px; }
.play-btn--xl { width: 56px; height: 56px; }
.play-btn--xl .ic { width: 24px; height: 24px; }
.play-btn.is-buffering::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--accent-icon);
  border-right-color: transparent;
  animation: spin 900ms linear infinite;
}
.play-btn { position: relative; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 16px;
  background: var(--surface-hover);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}
.chip:hover:not(:disabled) { background: var(--surface-pressed); color: var(--text); }
.chip:disabled { opacity: 0.45; }
.chip .ic { width: 18px; height: 18px; }
.chip.is-active { color: var(--accent-text); background: var(--accent-soft); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  vertical-align: middle;
}
.badge .ic { width: 12px; height: 12px; stroke-width: 2.2; }
.badge-done { background: var(--accent-soft); color: var(--accent-soft-text); }

.count-pill {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 22px;
  padding: 0 7px;
  margin-left: 6px;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent-soft-text);
  font-size: 12px;
  font-weight: 700;
  vertical-align: 3px;
}

/* ---------- Covers ---------- */
.cover {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--r-md);
  background: var(--surface-3);
  box-shadow: var(--shadow-4);
  container-type: inline-size;
  isolation: isolate;
}
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover--xs { width: 40px; border-radius: var(--r-sm); box-shadow: var(--shadow-2); }
.cover--sm { width: 56px; border-radius: var(--r-sm); box-shadow: var(--shadow-2); }
.cover--lg { box-shadow: var(--shadow-16); }
.cover--xl { box-shadow: var(--shadow-28); border-radius: var(--r-lg); }
.cover-empty { display: grid; place-items: center; color: var(--text-3); box-shadow: none; background: var(--surface-3); }
.cover-empty .ic { width: 22px; height: 22px; }

.cover-gen {
  position: absolute;
  inset: 0;
  color: #fff;
  overflow: hidden;
}
.cover-gen::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(90% 70% at 0% 0%, rgba(255, 255, 255, 0.22), transparent 60%),
    linear-gradient(0deg, rgba(0, 18, 25, 0.35), transparent 55%);
}
.cover-gen-lines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(63deg, transparent 0 6.5cqi, rgba(255, 255, 255, 0.07) 6.5cqi calc(6.5cqi + 1px));
  mask-image: linear-gradient(135deg, transparent 35%, #000 100%);
  -webkit-mask-image: linear-gradient(135deg, transparent 35%, #000 100%);
}
.cover-gen-mark {
  position: absolute;
  width: 92cqi;
  height: calc(92cqi * 304 / 334);
  right: -16cqi;
  bottom: -6cqi;
  opacity: 0.2;
  color: #fff;
}
.cover-gen--v1 .cover-gen-mark { width: 120cqi; height: calc(120cqi * 304 / 334); right: -46cqi; bottom: -22cqi; opacity: 0.16; }
.cover-gen--v2 .cover-gen-mark { width: 70cqi; height: calc(70cqi * 304 / 334); right: 8cqi; top: 10cqi; bottom: auto; opacity: 0.22; }
.cover-gen-label {
  position: absolute;
  left: 9cqi;
  top: 9cqi;
  font-size: max(6px, 5cqi);
  line-height: 1;
  font-weight: 600;
  letter-spacing: 0.28em;
  opacity: 0.9;
  white-space: nowrap;
}
.cover-gen-label::after {
  content: "";
  display: block;
  width: 9cqi;
  height: max(1px, 0.9cqi);
  margin-top: 3cqi;
  background: currentColor;
  opacity: 0.8;
}
.cover-gen-initials {
  position: absolute;
  left: 8cqi;
  bottom: 7cqi;
  font-family: var(--font-display);
  font-size: 30cqi;
  line-height: 0.9;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-shadow: 0 1cqi 4cqi rgba(0, 20, 30, 0.25);
}
.cover--xs .cover-gen-initials, .cover--sm .cover-gen-initials { font-size: 36cqi; left: 12cqi; bottom: 10cqi; }

/* ---------- Grid & cards ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  gap: 8px 12px;
}
.grid--compact { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }

.card {
  position: relative;
  padding: 12px 12px 14px;
  border-radius: var(--r-lg);
  transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.card:hover { background: var(--surface); box-shadow: var(--shadow-8); }
.card-art { position: relative; margin-bottom: 12px; }
.card-art .cover { transition: box-shadow var(--dur) var(--ease); }
.card-link {
  display: block;
  font-weight: 600;
  font-size: 14px;
  line-height: 20px;
  border-radius: var(--r-sm);
}
.card-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--r-lg); }
.card-link:focus-visible { outline: none; box-shadow: none; }
.card:has(.card-link:focus-visible) { outline: 2px solid var(--focus); outline-offset: 0; }
.card-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.card-sub {
  margin-top: 2px;
  font-size: 13px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-play {
  position: absolute;
  z-index: 2;
  right: 8px;
  bottom: 8px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease-out);
}
.card:hover .card-play,
.card:focus-within .card-play,
.card.is-current .card-play { opacity: 1; transform: none; }
.card-play .play-btn { box-shadow: var(--shadow-16); }
.card-progress {
  position: absolute;
  left: 8px; right: 8px; bottom: 8px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.4);
  overflow: hidden;
  z-index: 1;
}
.card-progress span { display: block; height: 100%; background: #fff; border-radius: 2px; }
.card:hover .card-progress, .card:focus-within .card-progress { opacity: 0; }
.card.is-current .card-title { color: var(--accent-text); }

@media (hover: none) {
  .card-play { opacity: 1; transform: none; }
  .card-play .play-btn { width: 38px; height: 38px; }
  .card-progress { right: 54px; }
  .card:hover .card-progress { opacity: 1; }
  .card:hover { background: transparent; box-shadow: none; }
}

/* Skeleton */
.skeleton:hover { background: transparent; box-shadow: none; }
.sk {
  border-radius: var(--r-md);
  background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 50%, var(--surface-3) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
.sk-art { aspect-ratio: 1; margin-bottom: 12px; }
.sk-line { height: 12px; margin-top: 8px; border-radius: 6px; }
.sk-short { width: 60%; }
.sk-title { width: 220px; height: 36px; margin: 20px 0 32px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: 232px 1fr;
  align-items: center;
  gap: 32px;
  padding: 28px;
  border-radius: var(--r-lg);
  overflow: hidden;
  color: #fff;
  background-image: linear-gradient(100deg, rgba(0, 20, 30, 0.62) 0%, rgba(0, 20, 30, 0.35) 55%, rgba(0, 20, 30, 0.1) 100%), var(--hero-grad);
  box-shadow: var(--shadow-16);
  isolation: isolate;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: repeating-linear-gradient(63deg, transparent 0 34px, rgba(255, 255, 255, 0.05) 34px 35px);
  mask-image: linear-gradient(90deg, transparent 30%, #000 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 30%, #000 100%);
}
.hero-deco { position: absolute; z-index: -1; right: -40px; bottom: -70px; pointer-events: none; }
.hero-mark { width: 380px; height: 346px; color: #fff; opacity: 0.1; }
.hero-art .cover { width: 232px; }
.hero-body { min-width: 0; }
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.9);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: #6fe3ff; box-shadow: 0 0 0 4px rgba(111, 227, 255, 0.22); }
.hero-title {
  margin-top: 10px;
  font-family: var(--font-display);
  font-size: clamp(26px, 3.2vw, 40px);
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.hero-title a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.hero-meta { margin-top: 8px; font-size: 14px; color: rgba(255, 255, 255, 0.85); }
.hero-meta a { font-weight: 600; color: #fff; }
.hero-meta a:hover { text-decoration: underline; }
.hero-desc {
  margin-top: 12px;
  max-width: 62ch;
  color: rgba(255, 255, 255, 0.86);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 20px; }
.hero .btn-primary { background: #fff; color: var(--brand-30); box-shadow: var(--shadow-8); }
.hero .btn-primary:hover:not(:disabled) { background: var(--brand-150); box-shadow: var(--shadow-16); }
.hero-remaining { font-size: 13px; color: rgba(255, 255, 255, 0.85); }
.hero :focus-visible { outline-color: #fff; box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.6); }

/* ---------- Continue listening tiles ---------- */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 10px;
}
.tile {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px 8px 8px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow-2);
  transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.tile:hover { box-shadow: var(--shadow-8); border-color: transparent; }
.tile-body { flex: 1; min-width: 0; }
.tile-title {
  display: block;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tile-title::after { content: ""; position: absolute; inset: 0; border-radius: var(--r-lg); }
.tile-title:focus-visible { outline: none; box-shadow: none; }
.tile:has(.tile-title:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }
.tile-progress { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; color: var(--text-3); }
.tile-play { position: relative; z-index: 1; }
.tile.is-current .tile-title { color: var(--accent-text); }

.mini-bar {
  position: relative;
  display: inline-block;
  flex: 0 0 64px;
  width: 64px;
  height: 4px;
  border-radius: 2px;
  background: var(--surface-3);
  overflow: hidden;
}
.mini-bar > span { position: absolute; inset: 0 auto 0 0; background: var(--accent-icon); border-radius: 2px; }
.mini-bar--wide { flex-basis: 120px; width: 120px; }

/* ---------- Browse tiles (search) ---------- */
.browse {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}
.browse-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 120px;
  padding: 16px;
  border-radius: var(--r-lg);
  color: #fff;
  overflow: hidden;
  box-shadow: var(--shadow-4);
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease);
}
.browse-tile::before { content: ""; position: absolute; inset: 0; background: linear-gradient(160deg, rgba(0, 20, 30, 0.45), transparent 70%); }
.browse-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-16); }
.browse-name { position: relative; font-family: var(--font-display); font-size: 19px; line-height: 24px; font-weight: 700; max-width: 80%; overflow-wrap: anywhere; }
.browse-count { position: relative; margin-top: 4px; font-size: 12px; opacity: 0.9; }
.browse-mark { position: absolute; right: -14px; bottom: -18px; width: 100px; height: 91px; color: #fff; opacity: 0.28; transform: rotate(8deg); }

/* ---------- Search ---------- */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 560px;
  height: 48px;
  margin-bottom: 8px;
  border-radius: 24px;
  background: var(--surface);
  border: 1px solid var(--stroke-strong);
  box-shadow: var(--shadow-2);
  transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.search-box:focus-within { border-color: var(--accent-icon); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-4); }
.search-icon { position: absolute; left: 16px; color: var(--text-3); pointer-events: none; }
.search-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 100%;
  padding: 0 44px 0 46px;
  border: 0;
  background: transparent;
  font-size: 16px;
  border-radius: 24px;
  -webkit-appearance: none;
  appearance: none;
}
.search-input::-webkit-search-cancel-button { display: none; }
.search-input::placeholder { color: var(--text-3); }
.search-input:focus-visible { outline: none; box-shadow: none; }
.search-clear { position: absolute; right: 8px; border-radius: 50%; }
.search-results[aria-busy="true"] { opacity: 0.6; transition: opacity var(--dur) var(--ease); }

/* ---------- Rows (episode lists) ---------- */
.rows { display: flex; flex-direction: column; gap: 2px; }
.row {
  position: relative;
  display: grid;
  grid-template-columns: 28px 56px minmax(0, 1fr) 128px 72px 40px;
  grid-template-areas: "idx art main meta dur act";
  align-items: center;
  gap: 16px;
  padding: 8px 12px;
  border-radius: var(--r-lg);
  transition: background var(--dur-fast) var(--ease);
}
.row:hover { background: var(--surface-hover); }
.row.is-current { background: var(--accent-soft); }
.row-index { grid-area: idx; position: relative; text-align: center; color: var(--text-3); font-variant-numeric: tabular-nums; }
.row-eq { display: none; }
.row.is-playing .row-num { display: none; }
.row.is-playing .row-eq { display: inline-flex; }
.row-art { grid-area: art; position: relative; }
.row-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  background: rgba(0, 18, 25, 0.35);
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease);
}
.row:hover .row-play, .row:focus-within .row-play, .row.is-current .row-play { opacity: 1; }
.row-play .play-btn { box-shadow: none; }
.row-main { grid-area: main; min-width: 0; }
.row-title {
  display: block;
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: var(--r-sm);
}
.row-title:hover { text-decoration: underline; }
.row.is-current .row-title { color: var(--accent-text); }
.row-sub {
  margin-top: 2px;
  font-size: 13px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-sub a { color: var(--text-2); font-weight: 500; }
.row-sub a:hover { text-decoration: underline; }
.row-progress { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; color: var(--text-3); }
.row-meta { grid-area: meta; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; font-size: 13px; color: var(--text-3); }
.row-dur { grid-area: dur; font-size: 13px; color: var(--text-3); text-align: right; font-variant-numeric: tabular-nums; }
.row-actions { grid-area: act; opacity: 0; transition: opacity var(--dur-fast) var(--ease); }
.row:hover .row-actions, .row:focus-within .row-actions { opacity: 1; }
@media (hover: none) {
  .row-actions { opacity: 1; }
  .row-play { opacity: 1; background: rgba(0, 18, 25, 0.22); }
}

/* Equalizer */
.row-eq, .q-eq { align-items: flex-end; justify-content: center; gap: 2px; height: 14px; }
.row-eq i, .q-eq i {
  display: block;
  width: 3px;
  height: 100%;
  border-radius: 1px;
  background: var(--accent-icon);
  transform-origin: bottom;
  animation: eq 900ms ease-in-out infinite;
}
.row-eq i:nth-child(2), .q-eq i:nth-child(2) { animation-delay: -300ms; }
.row-eq i:nth-child(3), .q-eq i:nth-child(3) { animation-delay: -600ms; }
@keyframes eq {
  0%, 100% { transform: scaleY(0.3); }
  50% { transform: scaleY(1); }
}

/* ---------- Detail header (show / episode) ---------- */
.page--detail { position: relative; }
.detail-head {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 32px;
  margin: -28px calc(var(--gutter) * -1) 0;
  padding: 56px var(--gutter) 28px;
  isolation: isolate;
}
.detail-head::before {
  content: "";
  position: absolute;
  inset: 0 0 -140px;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(180deg, color-mix(in srgb, var(--detail-tint) 34%, transparent) 0%, color-mix(in srgb, var(--detail-tint) 10%, transparent) 60%, transparent 100%);
}
.detail-art { flex: 0 0 232px; }
.detail-art .cover { width: 232px; }
.detail-body { min-width: 0; padding-bottom: 6px; }
.detail-title {
  margin-top: 6px;
  font-family: var(--font-display);
  font-size: clamp(32px, 5vw, 64px);
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}
.detail-title--ep { font-size: clamp(28px, 3.2vw, 44px); font-weight: 750; }
.detail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; color: var(--text-2); font-size: 14px; }

.action-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 20px 0 8px;
}
.action-progress { display: flex; align-items: center; gap: 10px; margin-left: 8px; font-size: 13px; color: var(--text-3); }

.prose-section { max-width: 820px; margin-top: 28px; }
.prose-section .section-title { margin-bottom: 10px; }
.prose { font-size: 15px; line-height: 24px; color: var(--text-2); white-space: pre-line; overflow-wrap: anywhere; }
.prose--muted { color: var(--text-3); font-style: italic; }
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 20px;
  padding: 16px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--stroke);
}
.facts dt { font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); }
.facts dd { margin-top: 2px; font-weight: 600; overflow-wrap: anywhere; }
.facts a { color: var(--accent-text); }
.facts a:hover { text-decoration: underline; }

/* ---------- Empty states ---------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 520px;
  margin: 48px auto;
  padding: 24px;
}
.empty--compact { margin: 24px auto; }
.empty-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-text);
}
.empty-icon .ic { width: 28px; height: 28px; }
.empty-art {
  position: relative;
  display: grid;
  place-items: center;
  width: 168px;
  height: 168px;
  margin-bottom: 24px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, var(--brand-100), var(--brand-70) 60%, var(--brand-50));
  box-shadow: var(--shadow-28), inset 0 -10px 30px rgba(0, 0, 0, 0.15);
}
.empty-mark { width: 84px; height: 77px; color: #fff; transform: translate(4px, -2px); }
.empty-wave {
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  border: 1.5px solid var(--brand-110);
  opacity: 0.55;
  animation: pulse 2.6s var(--ease) infinite;
}
.empty-wave--2 { animation-delay: 1.3s; }
@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.6; }
  100% { transform: scale(1.25); opacity: 0; }
}
.empty-title { font-family: var(--font-display); font-size: 22px; line-height: 28px; font-weight: 700; letter-spacing: -0.01em; }
.empty--compact .empty-title { font-size: 17px; line-height: 24px; }
.empty-text { margin-top: 8px; color: var(--text-2); font-size: 15px; line-height: 22px; }
.empty--compact .empty-text { font-size: 14px; line-height: 20px; }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 22px; }

/* ---------- Forms ---------- */
.label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--text); }
.req { color: var(--danger); }
.hint { margin-top: 6px; font-size: 12px; line-height: 16px; color: var(--text-3); }
.field + .field, .upload-form > .field { margin-top: 16px; }
.input {
  display: block;
  width: 100%;
  height: 36px;
  padding: 0 11px;
  border-radius: var(--r-sm);
  border: 1px solid var(--stroke-strong);
  border-bottom-color: color-mix(in srgb, var(--text) 45%, transparent);
  background: var(--surface);
  font-size: 14px;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.input:hover:not(:disabled) { border-color: color-mix(in srgb, var(--text) 30%, transparent); }
.input:focus, .input:focus-visible {
  outline: none;
  border-color: var(--stroke-strong);
  border-bottom-color: var(--accent-icon);
  box-shadow: inset 0 -1px 0 var(--accent-icon);
  border-radius: var(--r-sm);
}
.input:disabled { opacity: 0.6; }
.input::placeholder { color: var(--text-3); }
.textarea { height: auto; min-height: 104px; padding: 8px 11px; line-height: 20px; resize: vertical; }
.input-wrap { position: relative; }
.input-wrap .input { padding-left: 38px; padding-right: 42px; height: 40px; }
.input-icon { position: absolute; left: 11px; top: 10px; color: var(--text-3); pointer-events: none; }
.input-affix { position: absolute; right: 5px; top: 5px; }
.form-error {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
}

/* Auth */
.page--auth { display: grid; place-items: center; min-height: calc(100vh - var(--player-h) - 120px); }
.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 36px 32px 32px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow-16);
}
.auth-brand {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 20px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand-90), var(--brand-80) 55%, var(--brand-60));
  box-shadow: var(--shadow-brand);
}
.auth-mark { width: 30px; height: 27px; color: #fff; transform: translateX(1px); }
.auth-title { font-family: var(--font-display); font-size: 28px; line-height: 36px; font-weight: 700; letter-spacing: -0.02em; }
.auth-sub { margin-top: 6px; margin-bottom: 24px; color: var(--text-2); }
.auth-form .btn-block { margin-top: 20px; }

/* Upload */
.upload-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.panel {
  padding: 24px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow-2);
}
.panel-title { font-family: var(--font-display); font-size: 18px; line-height: 24px; font-weight: 650; margin-bottom: 18px; }

.drop {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 148px;
  padding: 20px;
  border-radius: var(--r-lg);
  border: 1.5px dashed var(--stroke-strong);
  background: linear-gradient(135deg, var(--accent-soft), transparent 70%), var(--surface-2);
  cursor: pointer;
  text-align: center;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.drop:hover { border-color: var(--accent-icon); }
.drop.is-over { border-color: var(--accent-icon); border-style: solid; background: var(--accent-soft); transform: scale(1.01); }
.drop.is-disabled { pointer-events: none; opacity: 0.6; }
#up-audio:focus-visible + .drop { outline: 2px solid var(--focus); outline-offset: 2px; }
.drop-text { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.drop-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 4px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent-icon);
  box-shadow: var(--shadow-4);
}
.drop-icon .ic { width: 24px; height: 24px; }
.drop-title { font-size: 15px; }
.drop-sub { font-size: 13px; color: var(--text-3); }
.link-like { color: var(--accent-text); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.drop.has-file { justify-content: flex-start; min-height: 88px; border-style: solid; border-color: var(--stroke); background: var(--surface-2); }
.drop.has-file .drop-text { flex-direction: row; gap: 14px; width: 100%; text-align: left; }
.drop.has-file .drop-icon { margin: 0; background: var(--accent-soft); box-shadow: none; }
.drop-file { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.drop-file strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drop-file span { font-size: 12px; color: var(--text-3); }
.drop-change { pointer-events: none; }

.upload-grid { display: grid; grid-template-columns: 148px minmax(0, 1fr); gap: 20px; margin-top: 18px; }
.cover-pick-preview { position: relative; width: 148px; aspect-ratio: 1; border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow-4); container-type: inline-size; background: var(--surface-3); }
.cover-pick-preview img { width: 100%; height: 100%; object-fit: cover; }
.cover-pick-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.upload-fields .field:first-child { margin-top: 0; }
.form-actions { display: flex; justify-content: flex-end; margin-top: 20px; }

.upload-progress { margin-top: 18px; padding: 14px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--stroke); }
.progress-top, .progress-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.progress-top { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.progress-text { font-variant-numeric: tabular-nums; color: var(--accent-text); }
.progress-bottom { margin-top: 6px; font-size: 12px; color: var(--text-3); }
.progress { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.progress-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--brand-70), var(--brand-90));
  transition: width 160ms linear;
}

.manage-rows { display: flex; flex-direction: column; }
.manage-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--stroke);
}
.manage-row:last-child { border-bottom: 0; }
.manage-main { flex: 1; min-width: 0; }
.manage-title { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: var(--r-sm); }
.manage-title:hover { text-decoration: underline; }
.manage-sub { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.manage-actions { display: flex; gap: 2px; }

/* Dialog */
.dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  padding: 0;
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-64);
}
.dialog[open] { animation: dialog-in var(--dur-slow) var(--ease-out); }
.dialog::backdrop { background: var(--scrim); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 20px 4px 24px; }
.dialog-title { font-family: var(--font-display); font-size: 20px; line-height: 28px; font-weight: 650; }
.dialog-body { padding: 12px 24px 8px; }
.dialog-text { color: var(--text-2); font-size: 14px; line-height: 22px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px 24px; }

/* ---------- Player bar ---------- */
.player {
  position: fixed;
  z-index: 30;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--player-h);
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(360px, 1.6fr) minmax(200px, 1fr);
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  background: var(--acrylic-strong);
  -webkit-backdrop-filter: blur(30px) saturate(160%);
  backdrop-filter: blur(30px) saturate(160%);
  border-top: 1px solid var(--stroke);
  box-shadow: 0 -6px 24px rgba(0, 20, 30, 0.06);
}
.player-progress-mini { display: none; }
.player-now { display: flex; align-items: center; gap: 12px; min-width: 0; }
.player-cover-btn { flex-shrink: 0; border-radius: var(--r-sm); }
.player-cover-btn:hover .cover { box-shadow: var(--shadow-8); }
.player-cover .cover { width: 56px; }
.player-meta { display: flex; flex-direction: column; min-width: 0; }
.player-title {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: var(--r-sm);
}
.player-show { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: var(--r-sm); }
.player[data-state="ready"] .player-title:hover, .player[data-state="ready"] .player-show:hover { text-decoration: underline; }
.player[data-state="empty"] .player-title { color: var(--text-2); pointer-events: none; }
.player[data-state="empty"] .player-show { pointer-events: none; }

.player-center { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.player-controls { display: flex; align-items: center; gap: 6px; }
.player-controls .play-btn { width: 40px; height: 40px; margin: 0 6px; background: var(--text); color: var(--surface); box-shadow: var(--shadow-4); }
.player-controls .play-btn:hover:not(:disabled) { background: var(--text); box-shadow: var(--shadow-8); }
.player-controls .play-btn.is-buffering::after { border-color: var(--text); border-right-color: transparent; }
.speed-label { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mini-toggle { display: none; }

.scrub { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 620px; }
.time { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; min-width: 38px; }
.scrub .time:first-child { text-align: right; }

.player-side { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.range.range-volume { width: 110px; flex: 0 0 110px; }

/* Range (Fluent slider) */
.range {
  --fill: 0%;
  flex: 1;
  width: 100%;
  height: 20px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 10px;
}
.range:disabled { cursor: default; opacity: 0.5; }
.range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent-icon) 0 var(--fill), var(--stroke-strong) var(--fill) 100%);
}
.range::-moz-range-track { height: 4px; border-radius: 2px; background: var(--stroke-strong); }
.range::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent-icon); }
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--accent-icon);
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--stroke-strong), var(--shadow-2);
  transition: transform var(--dur-fast) var(--ease);
}
.range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-icon);
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--stroke-strong), var(--shadow-2);
}
.range:hover:not(:disabled)::-webkit-slider-thumb { transform: scale(1.2); }
.range:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; box-shadow: none; }

/* ---------- Tab bar (mobile) ---------- */
.tabbar { display: none; }

/* ---------- Now playing (full screen) ---------- */
.now {
  position: fixed;
  z-index: 60;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: calc(var(--safe-t) + 8px) 20px calc(var(--safe-b) + 20px);
  background: var(--bg);
  color: var(--text);
  transform: translateY(100%);
  transition: transform var(--dur-slow) var(--ease-out), visibility 0s linear var(--dur-slow);
  visibility: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.now.is-open { transform: none; visibility: visible; transition: transform var(--dur-slow) var(--ease-out), visibility 0s; }
.now-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, color-mix(in srgb, var(--now-tint, #009ac8) 42%, var(--bg)) 0%, var(--bg) 72%);
}
.now { isolation: isolate; }
.now-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 52px; }
.now-context { display: flex; flex-direction: column; align-items: center; min-width: 0; text-align: center; }
.now-context .eyebrow { color: var(--text-2); font-size: 10px; }
.now-context-show { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60vw; }
.now-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding-top: 12px;
}
.now-cover { width: min(100%, 46vh); margin: 0 auto; }
.now-cover .cover { width: 100%; }
.now-meta { margin-top: 28px; }
.now-title {
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 30px;
  font-weight: 700;
  letter-spacing: -0.015em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.now-show { display: inline-block; margin-top: 4px; color: var(--text-2); font-size: 15px; border-radius: var(--r-sm); }
.now-show:hover { text-decoration: underline; }
.now-scrub { margin-top: 20px; }
.now-scrub .range { height: 28px; }
.now-times { display: flex; justify-content: space-between; margin-top: 0; }
.now-controls { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.now-controls .icon-btn { color: var(--text); }
.play-btn-xl { width: 72px; height: 72px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-16); }
.play-btn-xl .ic { width: 30px; height: 30px; }
.play-btn-xl:hover:not(:disabled) { background: var(--text); }
.play-btn-xl.is-buffering::after { border-color: var(--text); border-right-color: transparent; }
.now-extra { display: flex; justify-content: center; gap: 10px; margin-top: 24px; }

/* ---------- Queue drawer ---------- */
.drawer {
  position: fixed;
  z-index: 40;
  top: 0;
  right: 0;
  bottom: var(--player-h);
  width: min(400px, 100vw);
  display: flex;
  flex-direction: column;
  background: var(--acrylic-strong);
  -webkit-backdrop-filter: blur(40px) saturate(160%);
  backdrop-filter: blur(40px) saturate(160%);
  border-left: 1px solid var(--stroke);
  box-shadow: var(--shadow-28);
  transform: translateX(104%);
  transition: transform var(--dur-slow) var(--ease-out);
}
.drawer.is-open { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px 8px 24px; }
.drawer-title { font-family: var(--font-display); font-size: 20px; font-weight: 650; }
.drawer-body { flex: 1; overflow-y: auto; padding: 4px 12px 24px; overscroll-behavior: contain; }
.scrim { position: fixed; z-index: 35; inset: 0; background: transparent; }

.q-heading { margin: 16px 12px 8px; font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); }
.q-heading-row { display: flex; align-items: center; justify-content: space-between; margin: 16px 0 8px; padding-right: 4px; }
.q-heading-row .q-heading { margin: 0 12px; }
.q-list { display: flex; flex-direction: column; gap: 2px; }
.q-row { display: flex; align-items: center; gap: 4px; padding-right: 4px; border-radius: var(--r-md); transition: background var(--dur-fast) var(--ease); }
.q-row:hover { background: var(--surface-hover); }
.q-row.is-now { background: var(--accent-soft); }
.q-main { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; padding: 8px; text-align: left; border-radius: var(--r-md); }
.q-cover { position: relative; flex-shrink: 0; }
.q-eq {
  position: absolute;
  inset: 0;
  display: none;
  padding-bottom: 12px;
  border-radius: var(--r-sm);
  background: rgba(0, 18, 25, 0.5);
  height: auto;
}
.q-eq i { background: #fff; height: 14px; }
.q-row.is-playing .q-eq { display: flex; }
.q-text { display: flex; flex-direction: column; min-width: 0; }
.q-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-row.is-now .q-title { color: var(--accent-text); }
.q-sub { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-list--played { opacity: 0.7; }
.q-empty { margin: 4px 12px; font-size: 13px; color: var(--text-3); }
.queue-page { max-width: 720px; }
.queue-page .q-heading:first-child { margin-top: 0; }
.page--narrow .q-main { padding: 10px; }
.page--narrow .cover--xs { width: 48px; }

/* ---------- Toasts ---------- */
.toasts {
  position: fixed;
  z-index: 80;
  left: 50%;
  bottom: calc(var(--player-h) + 16px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 32px);
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 16px 10px 12px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow-16);
  font-weight: 500;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease-out);
}
.toast.is-in { opacity: 1; transform: none; }
.toast-icon { color: var(--accent-icon); }
.toast--error .toast-icon { color: var(--danger); }
.toast--success .toast-icon { color: var(--success); }
.toast-action { margin-left: 6px; font-weight: 700; color: var(--accent-text); border-radius: var(--r-sm); }
.toast-action:hover { text-decoration: underline; }

/* ==========================================================================
   Responsive
   ========================================================================== */

/* Tablet: icon rail sidebar */
@media (max-width: 1023.98px) {
  :root { --sidebar-w: 76px; --gutter: 24px; }
  .sidebar { padding: 16px 10px; align-items: center; }
  .brand { padding: 6px 0 18px; }
  .brand-text, .sidebar-foot { display: none; }
  .nav-item span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .nav-item { justify-content: center; width: 52px; height: 48px; padding: 0; }
  .nav-item .ic { width: 22px; height: 22px; }
  .nav-sep { width: 36px; margin: 10px auto; }
  .player { grid-template-columns: minmax(180px, 1fr) minmax(300px, 1.6fr) auto; padding: 0 16px; }
  .range-volume { display: none; }
  .player-controls [data-action="speed"] { display: none; }
  .upload-layout { grid-template-columns: minmax(0, 1fr); }
  .hero { grid-template-columns: 180px 1fr; gap: 24px; }
  .hero-art .cover { width: 180px; }
  .row { grid-template-columns: 28px 56px minmax(0, 1fr) 72px 40px; grid-template-areas: "idx art main dur act"; }
  .row-meta { display: none; }
}

/* Mobile */
@media (max-width: 767.98px) {
  :root { --gutter: 16px; --player-h: 64px; }
  body { font-size: 14px; }

  /* ==========================================================================
     Mobile app shell
     --------------------------------------------------------------------------
     Root cause of the reported bug ("tab bar below the visible screen" on
     Android Firefox): the old layout let the whole document scroll and
     pinned `.tabbar` / `.player` with `position: fixed; bottom: 0`. Firefox
     Android's dynamic toolbar (which can dock at the bottom and show/hide as
     you scroll) resizes the *visible* area without necessarily resizing the
     `position: fixed` containing block the same way other engines do, so a
     `bottom: 0` element can end up parked below what's actually on screen.
     Any incidental horizontal overflow makes this worse on Firefox, because
     `overflow-x: hidden` on body does not clip the layout viewport the way
     it does on Chromium.

     Fix: the document itself never scrolls. `html`/`body` are pinned to the
     *visible* viewport height via `--app-h` (a vh → svh → dvh
     progressive-enhancement chain defined in :root, refined at runtime from
     `visualViewport` in app.js). `body` becomes the flex column for the
     whole shell: `.app` (sidebar + `.main`), the mini `.player`, then
     `.tabbar` — all normal-flow flex items now, never `position: fixed`, so
     they can never be pushed off-screen. `.main` is the ONLY scroll
     container on mobile — see the `getScroller()` convention documented at
     the top of app.js and in js/dom.js; any new scroll-position code must
     use it instead of `window.scrollTo` / `window.scrollY`.

     Overlays that used to be `position: fixed` (`.backdrop`, `.now`,
     `.drawer`, `.scrim`, `.toasts`) become `position: absolute` against
     `body`, which is itself `position: relative` and sized to `--app-h` —
     so they exactly fill the visible viewport instead of whatever
     (possibly taller, possibly mis-measured mid-toolbar-animation) box the
     browser uses as the fixed-position containing block.
     ========================================================================== */
  html, body { height: 100%; overflow: hidden; }
  body {
    display: flex;
    flex-direction: column;
    position: relative;
    height: var(--app-h);
  }
  .app { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  .backdrop, .now, .drawer, .scrim, .toasts { position: absolute; }

  .sidebar { display: none; }
  .main {
    flex: 1 1 auto;
    min-height: 0;
    margin-left: 0;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    scroll-padding-bottom: 24px;
    padding: calc(var(--safe-t) + 20px) var(--gutter) 24px;
    padding-left: max(var(--gutter), env(safe-area-inset-left));
    padding-right: max(var(--gutter), env(safe-area-inset-right));
  }

  .page-title { font-size: 28px; line-height: 34px; }
  .page-head { margin-bottom: 18px; }
  .section { margin-top: 32px; }
  .section-title { font-size: 19px; }

  /* Tab bar — normal-flow flex item (last child of body's flex column), not
     position: fixed. See the "Mobile app shell" note above. */
  .tabbar {
    position: static;
    flex: 0 0 auto;
    z-index: 32;
    display: flex;
    align-items: stretch;
    height: calc(var(--tabbar-h) + var(--safe-b));
    padding: 0 max(4px, env(safe-area-inset-left)) var(--safe-b) max(4px, env(safe-area-inset-right));
    background: var(--acrylic-strong);
    -webkit-backdrop-filter: blur(30px) saturate(160%);
    backdrop-filter: blur(30px) saturate(160%);
    border-top: 1px solid var(--stroke);
  }
  .tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-3);
    border-radius: var(--r-md);
  }
  .tab .ic { width: 22px; height: 22px; }
  .tab.is-active { color: var(--accent-text); }
  .tab:active { background: var(--surface-hover); }

  /* Mini player — normal-flow flex item between `.app` and `.tabbar`, not
     position: fixed. See the "Mobile app shell" note above. */
  .player {
    position: static;
    flex: 0 0 auto;
    margin: 0 max(8px, env(safe-area-inset-right)) 6px max(8px, env(safe-area-inset-left));
    height: var(--player-h);
    display: flex;
    gap: 10px;
    padding: 0 6px 0 6px;
    border: 1px solid var(--stroke);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-16);
    overflow: hidden;
    cursor: pointer;
  }
  .player[data-state="empty"] { display: none; }
  .player-center, .player-side { display: none; }
  .player-now { flex: 1; gap: 10px; }
  .player-cover .cover { width: 50px; }
  .player-progress-mini {
    display: block;
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 0;
    height: 2px;
    border-radius: 1px;
    background: var(--stroke);
    overflow: hidden;
  }
  .player-progress-mini-fill {
    display: block;
    height: 100%;
    background: var(--accent-icon);
    transform-origin: left;
    transform: scaleX(var(--progress, 0));
  }
  .mini-toggle {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: var(--text);
  }
  .mini-toggle .ic { width: 24px; height: 24px; }
  .mini-toggle:active { background: var(--surface-pressed); }

  .toasts { bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); }
  body.has-player .toasts { bottom: calc(var(--tabbar-h) + var(--player-h) + var(--safe-b) + 20px); }

  /* Queue as bottom sheet */
  .drawer {
    z-index: 70;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: min(calc(var(--app-h) * 0.86), 720px);
    border-left: 0;
    border-top: 1px solid var(--stroke);
    border-radius: 12px 12px 0 0;
    padding-bottom: var(--safe-b);
    transform: translateY(104%);
  }
  .drawer.is-open { transform: none; }
  .scrim { z-index: 65; background: var(--scrim); opacity: 0; transition: opacity var(--dur) var(--ease); }
  .scrim.is-open { opacity: 1; }

  /* Hero stacks */
  .hero { grid-template-columns: 1fr; gap: 18px; padding: 20px; }
  .hero-art .cover { width: 132px; }
  .hero-mark { width: 260px; height: 237px; }
  .hero-desc { -webkit-line-clamp: 3; }
  .hero-actions .btn-lg { height: 40px; }

  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 8px; }
  .card { padding: 8px 8px 12px; }

  /* Horizontal scroll-snap "shelf" — used for home-page rows (recent
     episodes, programs) instead of a cramped 2-column grid; full listing
     pages (Buscar, Programas) keep the wrapping .grid above. */
  .grid--shelf {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scroll-padding-left: var(--gutter);
    -webkit-overflow-scrolling: touch;
    margin: 0 calc(var(--gutter) * -1);
    padding: 2px var(--gutter) 6px;
    scrollbar-width: none;
  }
  .grid--shelf::-webkit-scrollbar { display: none; }
  .grid--shelf > .card {
    flex: 0 0 auto;
    width: 40vw;
    max-width: 168px;
    padding: 8px 8px 12px;
    scroll-snap-align: start;
  }

  .tiles { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .browse { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .browse-tile { min-height: 96px; padding: 12px; }
  .browse-name { font-size: 16px; line-height: 20px; }
  .browse-mark { width: 72px; height: 66px; }

  .row {
    grid-template-columns: 56px minmax(0, 1fr) 36px;
    grid-template-areas: "art main act" "art dur act";
    row-gap: 0;
    column-gap: 12px;
    padding: 8px;
  }
  .row-index { display: none; }
  .row-dur { text-align: left; font-size: 12px; margin-top: 2px; }
  .row-dur:empty { display: none; }
  .row-title { font-size: 14px; }

  .detail-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
    margin: calc((var(--safe-t) + 20px) * -1) calc(var(--gutter) * -1) 0;
    padding: calc(var(--safe-t) + 28px) var(--gutter) 8px;
  }
  .detail-art { flex: none; align-self: center; }
  .detail-art .cover { width: min(62vw, 240px); }
  .detail-title { font-size: 30px; }
  .detail-title--ep { font-size: 26px; }
  .action-bar { gap: 8px; }
  .action-bar > .btn { flex: 1 1 0; min-width: 0; padding: 0 10px; font-size: 14px; }
  .action-progress { width: 100%; margin: 4px 0 0; }

  .page-head--row { align-items: flex-start; }
  .panel { padding: 18px 16px; }
  .upload-grid { grid-template-columns: 1fr; }
  .cover-pick { display: grid; grid-template-columns: 96px 1fr; grid-template-areas: "label label" "prev actions" "prev hint"; column-gap: 14px; align-items: start; }
  .cover-pick .label { grid-area: label; }
  .cover-pick-preview { grid-area: prev; width: 96px; }
  .cover-pick-actions { grid-area: actions; margin-top: 0; }
  .cover-pick .hint { grid-area: hint; }
  .form-actions .btn { width: 100%; }
  .auth-card { padding: 28px 20px 24px; box-shadow: var(--shadow-8); }
  .page--auth { min-height: auto; padding-top: 12px; }
  .dialog-actions .btn { flex: 1; }
  .empty { margin: 24px auto; }

  /* Touch targets: bump the most-tapped, loosely-spaced controls to a
     comfortable ≥44px on touch screens. Icon buttons inside tight grid
     columns (row/queue actions) are left at their compact size on purpose —
     enlarging them there would overflow the column — but get extra reach
     from their row's own padding. */
  .btn-lg { height: 44px; }
  .form-actions .btn, .dialog-actions .btn { min-height: 44px; }
  .chip { height: 36px; padding: 0 14px; }
  .now-head .icon-btn,
  .drawer-head .icon-btn,
  .now-controls .icon-btn:not(.icon-btn-lg) {
    width: 44px;
    height: 44px;
  }
  .dialog-head .icon-btn-sm { width: 40px; height: 40px; }
}

@media (min-width: 768px) {
  .now-cover { width: min(100%, 50vh); }
}

/* Short landscape phones */
@media (max-height: 520px) and (max-width: 1023.98px) {
  .now-body { flex-direction: column; }
  .now-cover { width: min(40vh, 200px); }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
  .row-eq i, .q-eq i { transform: scaleY(0.7); }
  .empty-wave { display: none; }
  .grid--shelf { scroll-snap-type: none; }
}

/* ---------- Forced colors (Windows high contrast) ---------- */
@media (forced-colors: active) {
  .play-btn, .btn-primary { border: 1px solid ButtonText; }
  .nav-item.is-active::before { background: Highlight; }
  .cover-gen { forced-color-adjust: none; }
}
/* ==========================================================================
   v2 — versions, summary, documents, staged uploads, publishing
   ========================================================================== */

/* ---------- Badges & hints ---------- */
.ep-badges { display: inline-flex; align-items: center; flex-wrap: nowrap; gap: 4px; vertical-align: middle; }
.lang-badge {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--r-sm);
  border: 1px solid var(--stroke-strong);
  color: var(--text-2);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
}
.meta-hint { font-size: 12px; font-weight: 600; color: var(--text-3); white-space: nowrap; }
.ep-badges .meta-hint { margin: 0 2px; }
.doc-hint { display: inline-flex; align-items: center; gap: 2px; color: var(--accent-text); font-size: 11px; font-weight: 700; }
.doc-hint .ic { width: 16px; height: 16px; }
.ep-badges--glass .lang-badge { border-color: rgba(255, 255, 255, 0.5); color: #fff; }
.ep-badges--glass .meta-hint { color: rgba(255, 255, 255, 0.85); }
.ep-badges--glass .doc-hint { color: #fff; }
.card-badges { display: flex; align-items: center; gap: 4px; margin-top: 6px; min-height: 18px; }
.row-sub .ep-badges { margin-right: 8px; vertical-align: -3px; }
.hero-meta .ep-badges { margin-left: 6px; vertical-align: -3px; }

.badge-ai {
  color: var(--accent-soft-text);
  background: linear-gradient(90deg, color-mix(in srgb, var(--brand-80) 16%, transparent), color-mix(in srgb, #7a5cff 14%, transparent));
  border: 1px solid color-mix(in srgb, var(--brand-80) 28%, transparent);
}
.badge-ai .ic { width: 13px; height: 13px; stroke-width: 1.8; }
.badge-ai.is-busy .ic { animation: sparkle 1.6s ease-in-out infinite; }
.badge-muted { background: var(--surface-3); color: var(--text-2); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
@keyframes sparkle { 0%, 100% { transform: scale(1) rotate(0); opacity: 1; } 50% { transform: scale(1.2) rotate(12deg); opacity: 0.7; } }

/* ---------- Player bar: version button + popover ---------- */
.player-sub { display: flex; align-items: center; gap: 6px; min-width: 0; }
.player-sub .player-show { min-width: 0; }
.ver-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  height: 22px;
  padding: 0 6px 0 5px;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent-soft-text);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.ver-btn .ic { width: 13px; height: 13px; stroke-width: 1.8; }
.ver-btn .ver-btn-chev { width: 12px; height: 12px; transition: transform var(--dur) var(--ease); }
.ver-btn[aria-expanded="true"] .ver-btn-chev { transform: rotate(180deg); }
.ver-btn:hover { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand-80) 45%, transparent); }
.ver-btn:focus-visible { border-radius: 11px; }

.ver-pop {
  position: absolute;
  z-index: 45;
  bottom: calc(100% + 8px);
  left: 20px;
  min-width: 240px;
  max-width: min(340px, calc(100vw - 16px));
  max-height: min(60vh, 420px);
  overflow-y: auto;
  padding: 6px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow-28);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease-out);
}
.ver-pop.is-open { opacity: 1; transform: none; }
.ver-pop-title { padding: 8px 10px 6px; font-size: 12px; font-weight: 600; color: var(--text-3); }
.ver-group { padding: 8px 10px 2px; font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); }
.ver-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 36px;
  padding: 0 10px 0 6px;
  border-radius: var(--r-md);
  text-align: left;
  font-size: 14px;
}
.ver-item:hover, .ver-item:focus-visible { background: var(--surface-hover); }
.ver-item:focus-visible { outline-offset: -2px; box-shadow: none; }
.ver-item-check { display: grid; place-items: center; width: 20px; color: var(--accent-icon); }
.ver-item-check .ic { width: 16px; height: 16px; stroke-width: 2; }
.ver-item-label { flex: 1; min-width: 0; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ver-item.is-selected .ver-item-label { font-weight: 700; color: var(--accent-text); }
.ver-item-dur { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ---------- Segmented control & length chips ---------- */
.segmented {
  display: inline-flex;
  align-items: stretch;
  gap: 2px;
  padding: 3px;
  border-radius: var(--r-lg);
  background: var(--surface-3);
  max-width: 100%;
}
.segmented-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 14px;
  border-radius: var(--r-md);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.segmented-btn .ic { width: 18px; height: 18px; }
.segmented-btn:hover:not(.is-selected) { color: var(--text); background: var(--surface-hover); }
.segmented-btn.is-selected { background: var(--surface); color: var(--text); box-shadow: var(--shadow-2); }
.segmented-btn.is-selected .ic { color: var(--accent-icon); }
.segmented-btn:focus-visible { outline-offset: 0; }

.len-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.len-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: 17px;
  border: 1px solid var(--stroke-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.len-chip:hover:not(.is-selected) { background: var(--surface-2); }
.len-chip.is-selected { background: var(--accent-soft); border-color: var(--accent-icon); color: var(--accent-soft-text); padding-left: 10px; }
.len-chip-check { width: 16px; height: 16px; stroke-width: 2.2; }
.len-chip-dur { font-weight: 400; color: var(--text-3); font-variant-numeric: tabular-nums; }
.len-chip.is-selected .len-chip-dur { color: inherit; opacity: 0.85; }
.len-chip-prog { position: absolute; left: 0; bottom: 0; height: 2px; width: var(--p, 0%); background: var(--accent-icon); }
.len-chip:focus-visible { border-radius: 17px; }

/* ---------- Episode page ---------- */
.detail-desc {
  margin-top: 10px;
  max-width: 68ch;
  font-size: 15px;
  line-height: 22px;
  color: var(--text-2);
  overflow-wrap: anywhere;
}
.detail-meta .ep-badges { margin-left: 2px; }

.version-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 28px;
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: var(--r-lg);
  background: var(--acrylic);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow-2);
  width: fit-content;
  max-width: min(820px, 100%);
}
.picker-row { display: flex; align-items: center; gap: 12px; min-width: 0; flex-wrap: wrap; }
.picker-label { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.picker-label .ic { width: 16px; height: 16px; }

.action-admin { display: flex; align-items: center; gap: 4px; margin-left: auto; }

.section-head .section-title { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.section-head .section-title .badge { font-family: var(--font); letter-spacing: 0; }
.section-action { margin-left: auto; align-self: center; }

.summary-section .section-head { align-items: center; margin-bottom: 12px; }
.summary-card {
  position: relative;
  padding: 18px 20px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow-2);
  overflow: hidden;
}
.summary-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, var(--brand-80), color-mix(in srgb, #7a5cff 70%, var(--brand-80)));
}
.summary-text { font-size: 15px; line-height: 24px; color: var(--text); overflow-wrap: anywhere; }
.summary-text p + p, .summary-text ul + p, .summary-text p + ul, .summary-text ul + ul { margin-top: 10px; }
.summary-text ul { display: flex; flex-direction: column; gap: 6px; }
.summary-text li { position: relative; padding-left: 20px; color: var(--text-2); }
.summary-text li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 9px;
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: var(--accent-icon);
  transform: rotate(45deg);
}
.summary-foot { display: flex; align-items: flex-start; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--stroke); font-size: 12px; line-height: 16px; color: var(--text-3); }
.summary-foot .ic { width: 14px; height: 14px; margin-top: 1px; color: var(--accent-icon); }
.summary-card--pending { display: flex; flex-direction: column; gap: 14px; }
.summary-pending-text { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--accent-soft-text); }
.summary-skeleton .sk-line { height: 11px; margin-top: 10px; }
.summary-skeleton .sk-line:first-child { margin-top: 0; }
.sk-bullet { height: 11px; margin: 12px 0 0 20px; border-radius: 6px; width: calc(90% - 20px); }
.summary-card--empty { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.summary-empty-text { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); }
.summary-empty-text .ic { color: var(--accent-icon); }

.ai-orb {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #fff;
  background: conic-gradient(from 0deg, var(--brand-80), #7a5cff, var(--brand-110), var(--brand-80));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-80) 14%, transparent);
}
.ai-orb .ic { width: 18px; height: 18px; stroke-width: 1.8; }
.summary-card--pending .ai-orb, .ai-bar[data-state="analyzing"] .ai-orb { animation: orb 2.4s linear infinite; }
.summary-card--pending .ai-orb .ic, .ai-bar[data-state="analyzing"] .ai-orb .ic { animation: orb-counter 2.4s linear infinite; }
@keyframes orb { to { transform: rotate(360deg); } }
@keyframes orb-counter { to { transform: rotate(-360deg); } }

.inline-hint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 8px 8px 8px 12px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  color: var(--accent-soft-text);
  font-size: 13px;
  font-weight: 600;
}
.inline-hint > span { flex: 1; min-width: 180px; }
.inline-hint .ic { width: 18px; height: 18px; }

/* Documents */
.doc-list { display: flex; flex-direction: column; gap: 8px; }
.doc-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow-2);
  transition: box-shadow var(--dur) var(--ease);
}
.doc-row:hover { box-shadow: var(--shadow-8); }
.doc-icon {
  position: relative;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 40px;
  height: 48px;
  border-radius: var(--r-sm);
  background: var(--danger-soft);
  color: var(--danger);
}
.doc-icon .ic { width: 20px; height: 20px; margin-top: -12px; }
.doc-ext { position: absolute; bottom: 6px; font-size: 9px; line-height: 1; font-weight: 800; letter-spacing: 0.06em; }
.doc-main { flex: 1; min-width: 0; }
.doc-title { display: block; font-weight: 600; overflow-wrap: anywhere; border-radius: var(--r-sm); }
.doc-title:hover { text-decoration: underline; }
.doc-meta { margin-top: 2px; font-size: 12px; color: var(--text-3); }
.doc-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ---------- Forms (v2) ---------- */
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 20px; margin-bottom: 6px; }
.label-row .label { margin-bottom: 0; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.field-grid > .field { margin-top: 16px; }
.select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 30px;
  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) 50%, calc(100% - 10px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}
.textarea--summary { min-height: 180px; font-size: 14px; line-height: 21px; }
.ai-mark {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 0 6px;
  height: 18px;
  border-radius: 9px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--accent-soft-text);
  background: var(--accent-soft);
}
.ai-mark .ic { width: 12px; height: 12px; stroke-width: 2; }
.input.is-ai, .input.is-ai-filled { border-color: color-mix(in srgb, var(--brand-80) 55%, var(--stroke-strong)); }
.input.is-ai-filled { animation: ai-fill 1.2s var(--ease-out); }
@keyframes ai-fill {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand-80) 40%, transparent); background-color: var(--accent-soft); }
  100% { box-shadow: 0 0 0 6px transparent; background-color: var(--surface); }
}
.field.is-ai-pending { position: relative; }
.field.is-ai-pending .input {
  background-image: linear-gradient(90deg, transparent 0%, color-mix(in srgb, var(--brand-80) 12%, transparent) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
}
.field.is-ai-pending .input::placeholder { color: transparent; }
.btn-danger-text { color: var(--danger); }
.btn-danger-text:hover:not(:disabled) { background: var(--danger-soft); color: var(--danger); }

.panel-head { margin-bottom: 18px; }
.panel-head .panel-title { margin-bottom: 4px; }
.panel-sub { color: var(--text-2); font-size: 13px; line-height: 19px; }
.step + .step, .ai-bar + .step { margin-top: 22px; }
.step-title { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 13px; font-weight: 700; letter-spacing: 0.02em; color: var(--text); }
.step-num {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-soft-text);
  font-size: 12px;
  font-weight: 700;
}
.step-title + .field { margin-top: 0; }
.form-actions--split { align-items: center; justify-content: space-between; gap: 16px; }
.flow-status { font-size: 13px; color: var(--text-3); min-width: 0; }
.add-flow .flow-status { margin-top: 10px; }

.mode-bar { margin: -6px 0 20px; }
.segmented--mode .segmented-btn { min-height: 38px; padding: 0 16px; }
.upload-main { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.panel--manage { position: sticky; top: 24px; }

/* ---------- Stager (multi-file drop zone) ---------- */
.stager { position: relative; }
.stager-drop { flex-direction: column; gap: 8px; min-height: 164px; }
.stager-drop .drop-icon { margin: 0; }
.drop-copy { display: flex; flex-direction: column; align-items: center; gap: 4px; max-width: 46ch; }
.drop-btn { margin-top: 6px; pointer-events: none; }
.stager-input:focus-visible + .drop { outline: 2px solid var(--focus); outline-offset: 2px; }
.stager.has-items .stager-drop {
  flex-direction: row;
  justify-content: flex-start;
  gap: 12px;
  min-height: 0;
  padding: 10px 12px;
  text-align: left;
}
.stager.has-items .drop-icon { width: 36px; height: 36px; box-shadow: none; background: var(--surface); }
.stager.has-items .drop-icon .ic { width: 20px; height: 20px; }
.stager.has-items .drop-copy { align-items: flex-start; flex: 1; min-width: 0; gap: 0; }
.stager.has-items .drop-title { font-size: 14px; }
.stager.has-items .drop-sub { display: none; }
.stager.has-items .drop-btn { margin: 0; }
.stager .drop.is-over { transform: none; box-shadow: 0 0 0 4px var(--accent-soft); }

.stage-list { display: flex; flex-direction: column; gap: 8px; }
.stage-list:not(:empty) { margin-top: 10px; }
.stage-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 6px 10px 10px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--stroke);
  animation: row-in var(--dur-slow) var(--ease-out);
}
@keyframes row-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.stage-row[data-status="error"] { border-color: color-mix(in srgb, var(--danger) 40%, var(--stroke)); background: var(--danger-soft); }
.stage-art {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  color: var(--accent-icon);
  overflow: hidden;
}
.stage-row[data-kind="document"] .stage-art { background: var(--danger-soft); color: var(--danger); }
.stage-row[data-status="error"] .stage-art { background: transparent; color: var(--danger); }
.stage-art--img img { width: 100%; height: 100%; object-fit: cover; }
.stage-main { flex: 1; min-width: 0; }
.stage-top { display: flex; align-items: baseline; gap: 10px; min-width: 0; min-height: 20px; }
.stage-name { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-meta { display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.stage-ok { width: 14px; height: 14px; stroke-width: 2.2; color: var(--success); }
.stage-progress { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.stage-bar { flex: 1; height: 4px; }
.stage-status { flex-shrink: 0; min-width: 96px; font-size: 12px; color: var(--text-3); text-align: right; font-variant-numeric: tabular-nums; }
.progress.is-indeterminate .progress-fill {
  width: 40% !important;
  animation: indeterminate 1.2s var(--ease) infinite;
}
@keyframes indeterminate { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.stage-error { margin-top: 4px; font-size: 12px; color: var(--danger); font-weight: 500; }
.stage-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.stage-controls .input { height: 32px; font-size: 13px; }
.stage-controls--audio .stage-field { position: relative; flex: 0 1 220px; min-width: 150px; }
.stage-field .input { padding-left: 32px; }
.stage-field-ic { position: absolute; left: 9px; top: 7px; width: 18px; height: 18px; color: var(--text-3); pointer-events: none; }
.stage-controls--audio .stage-label { flex: 1 1 140px; min-width: 120px; }
.stage-controls .stage-title { flex: 1; }
.stage-controls--note { margin-top: 2px; }
.stage-controls--note .hint { margin: 0; }
.stage-remove { flex-shrink: 0; margin-top: 4px; }

/* ---------- AI bar ---------- */
.ai-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  padding: 12px 12px 12px 14px;
  border-radius: var(--r-lg);
  border: 1px solid var(--stroke);
  background: var(--surface-2);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.ai-bar .ai-orb { width: 30px; height: 30px; }
.ai-bar[data-state="idle"] .ai-orb, .ai-bar[data-state="waiting"] .ai-orb { background: var(--surface-3); color: var(--text-3); box-shadow: none; }
.ai-bar[data-state="analyzing"] {
  border-color: color-mix(in srgb, var(--brand-80) 35%, var(--stroke));
  background: linear-gradient(100deg, color-mix(in srgb, var(--brand-80) 10%, var(--surface)) 0%, color-mix(in srgb, #7a5cff 7%, var(--surface)) 100%);
}
.ai-bar[data-state="done"] { border-color: color-mix(in srgb, var(--brand-80) 30%, var(--stroke)); background: var(--accent-soft); }
.ai-bar[data-state="fallback"] .ai-orb, .ai-bar[data-state="error"] .ai-orb { background: var(--surface-3); color: var(--text-2); box-shadow: none; }
.ai-bar[data-state="error"] { border-color: color-mix(in srgb, var(--danger) 35%, var(--stroke)); }
.ai-body { flex: 1; min-width: 0; }
.ai-line { display: flex; align-items: baseline; gap: 8px; }
.ai-title { font-size: 14px; }
.ai-elapsed { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.ai-text { display: block; margin-top: 2px; font-size: 12.5px; line-height: 17px; color: var(--text-2); }
.ai-progress { display: none; height: 3px; margin-top: 8px; border-radius: 2px; background: color-mix(in srgb, var(--brand-80) 15%, transparent); overflow: hidden; }
.ai-bar[data-state="analyzing"] .ai-progress { display: block; }
.ai-progress-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--brand-80), #7a5cff, var(--brand-80));
  background-size: 200% 100%;
  animation: shimmer 2s linear infinite;
  transition: width 1s linear;
}
.ai-run { flex-shrink: 0; }

/* ---------- Add to existing ---------- */
.ep-picker { display: flex; flex-direction: column; gap: 8px; }
.search-box--sm { max-width: none; height: 40px; margin: 0; border-radius: var(--r-md); }
.search-box--sm .search-input { font-size: 14px; padding-left: 42px; border-radius: var(--r-md); }
.search-box--sm .search-icon { left: 13px; }
.ep-pick-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 292px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px;
  border-radius: var(--r-lg);
  border: 1px solid var(--stroke);
  background: var(--surface-2);
}
.ep-pick {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 8px;
  border-radius: var(--r-md);
  text-align: left;
}
.ep-pick:hover { background: var(--surface-hover); }
.ep-pick:focus-visible { outline-offset: -2px; box-shadow: none; }
.ep-pick-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ep-pick-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ep-pick-sub { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ep-pick-empty { padding: 14px; text-align: center; color: var(--text-3); font-size: 13px; }

.target-ep {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: var(--r-lg);
  background: var(--surface-2);
  border: 1px solid var(--stroke);
}
.target-ep .cover--sm { width: 52px; }
.target-ep-main { flex: 1; min-width: 0; }
.target-ep-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.target-ep-sub { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ver-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.ver-chip { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 10px; background: var(--surface-3); color: var(--text-2); font-size: 11px; font-weight: 600; white-space: nowrap; }
.dialog-body > .target-ep { margin-bottom: 14px; }
.add-body.is-disabled { opacity: 0.5; pointer-events: none; }
.add-result:not(:empty) { margin-top: 16px; }
.success-card {
  display: flex;
  gap: 12px;
  padding: 14px;
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--success) 9%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--success) 30%, var(--stroke));
}
.success-icon { width: 22px; height: 22px; color: var(--success); stroke-width: 2; }
.success-main { flex: 1; min-width: 0; }
.success-title { font-weight: 700; overflow-wrap: anywhere; }
.success-text { margin-top: 2px; font-size: 13px; color: var(--text-2); }
.success-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }

/* Manage list (v2) */
.manage-sub { display: flex; align-items: center; gap: 6px; }
.manage-sub > span:not(.ep-badges):not(.badge) { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.manage-sub .ep-badges, .manage-sub .badge { flex-shrink: 0; }

/* ---------- Dialog (v2) ---------- */
.dialog { display: none; }
.dialog[open] { display: flex; flex-direction: column; overflow: hidden; max-height: min(calc(100dvh - 48px), calc(var(--app-h) - 32px)); }
.dialog-form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.dialog-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.dialog-head-text { min-width: 0; }
.dialog-sub { margin-top: 2px; font-size: 13px; color: var(--text-3); overflow-wrap: anywhere; }
.dialog-actions { align-items: center; border-top: 1px solid transparent; }
.dialog--wide .dialog-actions { border-top-color: var(--stroke); padding-top: 14px; padding-bottom: 16px; }
.dialog-actions-start { margin-right: auto; display: flex; gap: 8px; }
.dialog--wide { width: min(760px, calc(100vw - 32px)); }
.dialog--wide .dialog-head { padding-bottom: 12px; border-bottom: 1px solid var(--stroke); }
.dialog--wide .dialog-body { padding-top: 16px; padding-bottom: 16px; }
.dlg-section + .dlg-section { margin-top: 26px; }
.dlg-section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.dlg-section-title { font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); }
.dlg-section-tools { display: flex; align-items: center; gap: 8px; }
.dlg-section-head + .field { margin-top: 0; }
.summary-status { display: inline-flex; }

.edit-list { display: flex; flex-direction: column; gap: 6px; }
.edit-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 6px 8px 8px;
  border-radius: var(--r-lg);
  border: 1px solid var(--stroke);
  background: var(--surface);
  transition: opacity var(--dur) var(--ease), background var(--dur) var(--ease);
}
.edit-row.is-removed { background: var(--surface-2); border-style: dashed; }
.edit-row.is-removed .edit-main { opacity: 0.55; }
.edit-row.is-removed .edit-meta { color: var(--danger); opacity: 1; }
.edit-idx {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 26px;
  height: 32px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.edit-default { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-fill); color: var(--text-on-accent); font-size: 12px; }
.edit-idx--doc { color: var(--danger); }
.edit-main { flex: 1; min-width: 0; }
.edit-fields { display: grid; grid-template-columns: minmax(150px, 0.9fr) minmax(0, 1fr); gap: 8px; }
.edit-main .input { height: 32px; font-size: 13px; }
.edit-meta { margin-top: 4px; font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.edit-actions { display: flex; align-items: center; gap: 0; flex-shrink: 0; }
.edit-empty { padding: 10px; font-size: 13px; color: var(--text-3); }

.cover-edit { display: flex; gap: 16px; align-items: flex-start; }
.cover-pick-preview--sm { width: 96px; flex-shrink: 0; }
.cover-edit-side { flex: 1; min-width: 0; }
.cover-edit-side .cover-pick-actions { margin-top: 0; }

.toast-action { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; cursor: pointer; }
.toast { max-width: calc(100vw - 32px); }

@media (prefers-color-scheme: dark) {
  .badge-ai { border-color: color-mix(in srgb, var(--brand-80) 40%, transparent); }
  .lang-badge { border-color: var(--stroke-strong); }
}

@media (max-width: 1023.98px) {
  .panel--manage { position: static; }
  .action-admin { margin-left: 0; }
}

@media (max-width: 767.98px) {
  /* Player: the version switcher lives in the full-screen sheet on phones. */
  .ver-btn, .ver-pop { display: none !important; }

  .now-versions { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-top: 14px; }
  .now-versions .segmented { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .now-versions .segmented::-webkit-scrollbar { display: none; }
  .now-versions .segmented-btn { min-height: 34px; }
  .now-versions .len-chips { gap: 6px; }
  .now-versions .len-chip { height: 34px; }

  .card-badges { margin-top: 4px; }
  .card-badges .meta-hint { display: none; }

  .detail-desc { font-size: 14px; line-height: 21px; margin-top: 8px; }
  .version-picker { flex-direction: column; align-items: stretch; gap: 12px; margin-top: 16px; padding: 12px; }
  .picker-row { flex-direction: column; align-items: flex-start; gap: 6px; }
  .picker-row .segmented { width: 100%; }
  .picker-row .segmented-btn { flex: 1 1 0; min-width: 0; min-height: 36px; padding: 0 8px; }
  .len-chips { width: 100%; }
  .len-chip { height: 38px; }
  .action-admin { width: 100%; margin: 4px 0 0; }
  .action-admin .btn { flex: 1; min-width: 0; }
  .action-admin .btn span { overflow: hidden; text-overflow: ellipsis; }

  .summary-card { padding: 14px 14px 14px 16px; }
  .summary-text { font-size: 14px; line-height: 22px; }
  .section-head { flex-wrap: wrap; }

  .doc-row { flex-wrap: wrap; gap: 10px 12px; padding: 12px; }
  .doc-icon { width: 36px; height: 44px; }
  .doc-actions { width: 100%; padding-left: 48px; }
  .doc-actions .btn { flex: 1; height: 36px; }

  .mode-bar { margin: -4px calc(var(--gutter) * -1) 16px; padding: 0 var(--gutter); }
  .segmented--mode { display: flex; width: 100%; }
  .segmented--mode .segmented-btn { flex: 1 1 0; min-width: 0; min-height: 44px; padding: 4px 8px; white-space: normal; line-height: 16px; font-size: 13px; text-align: center; }
  .segmented--mode .segmented-btn .ic { display: none; }

  .field-grid { grid-template-columns: minmax(0, 1fr); }
  .stager-drop { min-height: 132px; padding: 16px; }
  .drop-copy .drop-sub { font-size: 12px; }
  .stager.has-items .drop-sub { display: none; }
  .stager.has-items .drop-btn span { display: none; }
  .stager.has-items .drop-btn { width: 36px; padding: 0; }
  .version-picker { width: auto; }
  .stage-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) 36px; align-items: start; gap: 0 10px; padding: 10px 4px 10px 10px; }
  .stage-main { display: contents; }
  .stage-art { grid-column: 1; grid-row: 1; width: 34px; height: 34px; }
  .stage-remove { grid-column: 3; grid-row: 1; margin-top: 0; }
  .stage-top { grid-column: 2; grid-row: 1; flex-direction: column; gap: 0; align-self: center; }
  .stage-progress, .stage-error, .stage-controls { grid-column: 1 / -1; padding-right: 6px; }
  .stage-name { width: 100%; }
  .stage-status { min-width: 0; }
  .stage-controls--audio .stage-field, .stage-controls--audio .stage-label { flex: 1 1 100%; min-width: 0; }
  .stage-controls .input { height: 38px; font-size: 16px; }
  .stage-field-ic { top: 10px; }
  .ai-bar { flex-wrap: wrap; gap: 10px 12px; }
  .ai-bar .ai-body { flex: 1 1 calc(100% - 44px); }
  .ai-run { width: 100%; height: 36px; }
  .form-actions--split { flex-direction: column-reverse; align-items: stretch; gap: 8px; }
  .form-actions--split .flow-status { text-align: center; }
  .target-ep { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: start; gap: 10px; }
  .target-ep .cover--sm { width: 44px; }
  .target-ep-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .target-ep .btn { margin: -2px -4px 0 0; }
  .ep-pick .ep-badges { display: none; }
  .search-box--sm .search-input { font-size: 16px; }

  /* Wide dialogs become bottom sheets on phones. */
  .dialog--wide[open] {
    width: 100%;
    max-width: 100%;
    margin: auto 0 0;
    max-height: calc(var(--app-h) - 12px);
    border-radius: 12px 12px 0 0;
    border-bottom: 0;
    padding-bottom: var(--safe-b);
  }
  .dialog--wide .dialog-head { padding: 14px 12px 10px 16px; }
  .dialog--wide .dialog-body { padding: 14px 16px; }
  .dialog--wide .dialog-actions { padding: 10px 16px 12px; flex-wrap: wrap; }
  .dialog-actions-start { order: 2; width: 100%; margin: 0; }
  .dialog-actions-start .btn { flex: 1; }
  .dialog .input, .dialog .textarea { font-size: 16px; }
  .edit-fields { grid-template-columns: minmax(0, 1fr); }
  .edit-row { display: grid; grid-template-columns: 26px minmax(0, 1fr); grid-template-areas: "idx act" "main main"; gap: 2px 8px; padding: 6px 8px 10px; }
  .edit-idx { grid-area: idx; }
  .edit-actions { grid-area: act; justify-content: flex-end; }
  .edit-main { grid-area: main; }
  .hero-meta .ep-badges { display: flex; width: fit-content; margin: 8px 0 0; }
  .edit-main .input { height: 38px; }
  .cover-edit { gap: 12px; }
  .manage-sub .ep-badges { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ai-orb, .ai-orb .ic, .badge-ai.is-busy .ic { animation: none !important; }
  .progress.is-indeterminate .progress-fill { animation: none; width: 100% !important; opacity: 0.5; }
}

.tile-ver { display: block; margin-top: 1px; font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-ver + .tile-progress { margin-top: 4px; }
