/* =============================================================================
   Кинозал — design tokens
   Neutral zinc scale, one restrained accent, hairline borders, system type.
   ========================================================================== */
:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable", Inter, system-ui, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", Inter, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-full: 999px;

  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;

  --dur-1: 150ms;
  --dur-2: 200ms;
  --dur-3: 250ms;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  --header-h: 56px;
  --tabbar-h: 0px;
  --maxw: 1600px;
  --gutter: 24px;

  --accent: #f43f5e;
  --accent-fg: #ffffff;
  --ok: #22c55e;
  --warn: #f59e0b;
  --danger: #f43f5e;
  --vk: #0077ff;
}

/* dark: default theme + every surface that always sits on artwork / video */
:root,
:root[data-theme="dark"],
.stage,
.cat-hero,
.pld-hero,
.rm-hero,
.drop-zone {
  color-scheme: dark;
  --bg: #09090b;
  --bg-elev: #0c0c0e;
  --surface: #131316;
  --surface-2: #18181b;
  --surface-3: #232327;
  --surface-4: #2e2e33;
  --popover: #141417;
  --input-bg: #0f0f12;
  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .14);
  --fg: #fafafa;
  --fg-2: #d4d4d8;
  --muted: #a1a1aa;
  --dim: #85858f;
  --ring: #d4d4d8;
  --ring-soft: rgba(212, 212, 216, .18);
  --seg-active: #2a2a2f;
  --header-bg: rgba(9, 9, 11, .72);
  --scrim: rgba(0, 0, 0, .6);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 8px 24px -8px rgba(0, 0, 0, .6);
  --shadow-lg: 0 24px 64px -16px rgba(0, 0, 0, .75), 0 0 0 1px rgba(255, 255, 255, .04);
  --shimmer-a: #141417;
  --shimmer-b: #1f1f23;
  --ok-fg: #4ade80;
  --hdr-fg: #c4b5fd;
  --gold: #fbbf24;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --bg-elev: #fafafa;
  --surface: #f4f4f5;
  --surface-2: #f1f1f3;
  --surface-3: #e9e9ec;
  --surface-4: #dedee2;
  --popover: #ffffff;
  --input-bg: #ffffff;
  --border: rgba(9, 9, 11, .08);
  --border-strong: rgba(9, 9, 11, .15);
  --fg: #09090b;
  --fg-2: #27272a;
  --muted: #52525b;
  --dim: #6b6b74;
  --ring: #18181b;
  --ring-soft: rgba(24, 24, 27, .12);
  --seg-active: #ffffff;
  --header-bg: rgba(255, 255, 255, .78);
  --scrim: rgba(0, 0, 0, .45);
  --shadow-sm: 0 1px 2px rgba(9, 9, 11, .08);
  --shadow-md: 0 8px 24px -10px rgba(9, 9, 11, .18);
  --shadow-lg: 0 24px 60px -18px rgba(9, 9, 11, .28), 0 0 0 1px rgba(9, 9, 11, .05);
  --shimmer-a: #f1f1f3;
  --shimmer-b: #e6e6ea;
  --accent: #e11d48;
  --danger: #e11d48;
  --ok-fg: #15803d;
  --hdr-fg: #6d28d9;
  --gold: #b45309;
}

/* =============================================================================
   Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: calc(var(--header-h) + 16px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--bg); color: var(--fg);
  font: 400 14.5px/1.5 var(--font); letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
  padding-bottom: var(--tabbar-h);
}
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; font-family: var(--font-display); letter-spacing: -0.022em; font-weight: 650; }
h2 { font-size: 20px; }
h3 { font-size: 15px; letter-spacing: -0.012em; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.tnum, time { font-variant-numeric: tabular-nums; }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }
* { scrollbar-width: thin; scrollbar-color: var(--surface-4) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-4); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* icons */
.ic { display: inline-flex; width: 18px; height: 18px; flex-shrink: 0; }
.ic svg { width: 100%; height: 100%; display: block; }

/* focus */
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }

/* =============================================================================
   Controls
   ========================================================================== */
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; opacity: .45; }

.btn, .primary, .secondary, .ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex-shrink: 0;
  height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  font: 550 14px/1 var(--font); letter-spacing: -0.01em; white-space: nowrap; text-decoration: none; user-select: none;
  transition: background-color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease),
    opacity var(--dur-1) var(--ease), transform var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.btn .ic, .primary .ic, .secondary .ic, .ghost .ic { width: 17px; height: 17px; }
.btn:active:not(:disabled), .primary:active:not(:disabled), .secondary:active:not(:disabled), .ghost:active:not(:disabled) { transform: scale(.98); }
.primary { background: var(--fg); color: var(--bg); box-shadow: var(--shadow-sm); }
.primary:hover:not(:disabled) { opacity: .88; }
.secondary { background: var(--surface-3); color: var(--fg); }
.secondary:hover:not(:disabled) { background: var(--surface-4); }
.ghost { background: transparent; color: var(--fg); border-color: var(--border-strong); }
.ghost:hover:not(:disabled) { background: var(--surface); }
.glass, .ghost.glass {
  background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .16); color: #fff;
  -webkit-backdrop-filter: blur(12px) saturate(1.4); backdrop-filter: blur(12px) saturate(1.4);
}
.glass:hover:not(:disabled), .ghost.glass:hover:not(:disabled) { background: rgba(255, 255, 255, .2); }
.danger { color: var(--danger); }
.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; gap: 6px; }
.sm .ic { width: 15px; height: 15px; }
.lg { height: 46px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.lg .ic { width: 19px; height: 19px; }
.block { width: 100%; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 36px; height: 36px; border-radius: 10px; color: var(--muted); border: 1px solid transparent;
  transition: background-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.icon-btn:hover:not(:disabled), .icon-btn[aria-expanded="true"] { background: var(--surface-3); color: var(--fg); }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 8px; }
.icon-btn.sm .ic { width: 16px; height: 16px; }
.icon-btn.glass { color: #fff; }
.icon-btn.glass:hover:not(:disabled) { background: rgba(255, 255, 255, .22); color: #fff; }
.icon-btn.danger:hover:not(:disabled) { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }

input, select, textarea {
  min-width: 0; height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--input-bg); color: var(--fg); font: 400 14px/1.3 var(--font);
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--dim); }
textarea { height: auto; padding: 10px 12px; resize: vertical; font: 13px/1.45 var(--mono); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px var(--ring-soft); }
input:focus, select:focus, textarea:focus { outline: none; }
select { cursor: pointer; }
select:disabled { opacity: .55; cursor: default; }
input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; }

.row { display: flex; gap: 8px; align-items: center; }
.row > input { flex: 1; }
.tb-spacer { flex: 1; }

.kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 6px; border: 1px solid var(--border-strong); background: var(--bg); color: var(--muted);
  font: 500 11px/1 var(--font); letter-spacing: 0;
}

.field-icon { position: relative; display: flex; align-items: center; flex: 1; min-width: 0; }
.field-icon > .ic { position: absolute; left: 12px; width: 16px; height: 16px; color: var(--dim); pointer-events: none; }
.field-icon > input { flex: 1; width: 100%; padding-left: 36px; }

/* segmented control */
.seg {
  display: inline-flex; align-items: center; gap: 2px; padding: 3px; max-width: 100%;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  overflow-x: auto; scrollbar-width: none; flex-shrink: 1; min-width: 0;
}
.seg::-webkit-scrollbar { display: none; }
.seg > a, .seg > button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex-shrink: 0;
  height: 30px; padding: 0 14px; border-radius: 9px; color: var(--muted);
  font: 500 13.5px/1 var(--font); white-space: nowrap; text-decoration: none;
  transition: background-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.seg > a:hover, .seg > button:hover:not(:disabled) { color: var(--fg); }
.seg > [aria-selected="true"], .seg > [aria-pressed="true"] { background: var(--seg-active); color: var(--fg); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.seg .cnt { color: var(--dim); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.seg .ic { width: 15px; height: 15px; }
.seg-search { max-width: 260px; }
.seg-q { overflow: hidden; text-overflow: ellipsis; }

/* chips */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips:empty { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: var(--r-full);
  border: 1px solid var(--border-strong); color: var(--muted); font: 500 13px/1 var(--font); white-space: nowrap;
  transition: background-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
.chip:hover { color: var(--fg); background: var(--surface); }
.chip[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.chip .cnt { opacity: .6; font-size: 11.5px; font-variant-numeric: tabular-nums; }

.meta-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; color: var(--muted); font-size: 13.5px; }
.meta-item { white-space: nowrap; }
.meta-item + .meta-item::before { content: "·"; margin: 0 8px; opacity: .6; }
.rating-pill { display: inline-flex; align-items: center; gap: 4px; margin-right: 10px; color: var(--gold); font-weight: 650; font-variant-numeric: tabular-nums; }
.rating-pill .ic { width: 14px; height: 14px; }
.eyebrow { font: 600 11.5px/1 var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* =============================================================================
   Header
   ========================================================================== */
.top {
  position: sticky; top: 0; z-index: 50; padding-top: env(safe-area-inset-top);
  background: var(--header-bg); border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: saturate(1.8) blur(18px); backdrop-filter: saturate(1.8) blur(18px);
}
.top-row {
  display: flex; align-items: center; gap: 16px; height: var(--header-h); max-width: var(--maxw); margin: 0 auto;
  padding: 0 max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; border-radius: 8px; }
.brand-name { font: 650 15.5px/1 var(--font-display); letter-spacing: -0.02em; }
.logo-mark {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px;
  background: var(--fg); color: var(--bg); flex-shrink: 0;
}
.logo-mark .ic { width: 20px; height: 20px; }
.logo-mark.xl { width: 64px; height: 64px; border-radius: 18px; box-shadow: var(--shadow-lg); }
.logo-mark.xl .ic { width: 44px; height: 44px; }
.nav-seg { margin-left: 4px; }
.search-trigger {
  display: inline-flex; align-items: center; gap: 8px; margin-left: auto; height: 36px; width: clamp(200px, 22vw, 300px);
  padding: 0 6px 0 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--dim);
  font: 400 13.5px/1 var(--font); transition: border-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.search-trigger:hover { border-color: var(--border-strong); color: var(--muted); }
.search-trigger .ic { width: 16px; height: 16px; }
.st-text { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-right { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; max-width: 240px; padding: 0 11px; border-radius: var(--r-full);
  border: 1px solid var(--border); color: var(--muted); font: 500 12.5px/1 var(--font); white-space: nowrap;
  transition: background-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.chip-btn:hover { background: var(--surface); color: var(--fg); }
.chip-btn .ic { width: 14px; height: 14px; }
.chip-sep { width: 1px; height: 12px; background: var(--border-strong); margin: 0 2px; }
.now-pill { color: var(--fg); max-width: 200px; }
.now-pill .ic { color: var(--accent); }
.now-pill-text { overflow: hidden; text-overflow: ellipsis; min-width: 0; }

.auth {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; max-width: var(--maxw); margin: 0 auto;
  padding: 0 var(--gutter) 12px; animation: slide-down var(--dur-2) var(--ease-out);
}
.auth input { flex: 1; min-width: 200px; }
.auth-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--warn); }
.auth-msg { width: 100%; font-size: 13px; color: var(--muted); }
.auth-msg:empty { display: none; }

main { max-width: var(--maxw); margin: 0 auto; padding: 20px max(var(--gutter), env(safe-area-inset-right)) 48px max(var(--gutter), env(safe-area-inset-left)); }
.tab { animation: fade-up var(--dur-3) var(--ease-out); }
.sec-head { display: flex; align-items: center; justify-content: space-between; margin: 36px 0 14px; }
.sec-head h2 { font-size: 19px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 8px 0 20px; }
.page-title { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; margin-bottom: 4px; }
.status { min-height: 1.3em; margin: 10px 0; color: var(--muted); font-size: 13.5px; overflow-wrap: anywhere; }
.status:empty { margin: 0; min-height: 0; }
.status.err { color: var(--danger); }
.foot { color: var(--dim); font-size: 12px; margin-top: 48px; text-align: center; }

/* =============================================================================
   Player
   ========================================================================== */
.player-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; }
.player-layout.with-queue { grid-template-columns: minmax(0, 1fr) 368px; }
.stage-wrap { border-radius: var(--r-lg); overflow: hidden; background: #000; box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .55); }
.stage {
  --sub-scale: 1; --sub-color: #fff; --sub-bottom: 10%; --sub-px: 24px; --vid-bright: 1; --hud-h: 92px;
  position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: calc(100vh - 230px); min-height: 220px; background: #000; color: #fff;
  overflow: hidden; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
body.theater .stage { max-height: calc(100vh - 130px); }
.stage:fullscreen { width: 100vw; height: 100vh; max-height: none; min-height: 0; aspect-ratio: auto; border-radius: 0; }
.stage:-webkit-full-screen { width: 100vw; height: 100vh; max-height: none; min-height: 0; aspect-ratio: auto; border-radius: 0; }
.stage.hud-hidden { cursor: none; }
video { display: block; width: 100%; height: 100%; background: #000; outline: none; object-fit: contain; transition: transform var(--dur-2) var(--ease); }
video::cue { background: rgba(0, 0, 0, .7); color: #fff; font-size: 1.05em; line-height: 1.3; }
.stage[data-fit="cover"] video { object-fit: cover; }
.stage[data-fit="zoom"] video { transform: scale(1.15); }
.stage.bright video { filter: brightness(var(--vid-bright)); }

.stage-empty {
  position: absolute; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 24px; text-align: center; user-select: text; -webkit-user-select: text;
  background: radial-gradient(60% 70% at 50% 35%, #1c1c21 0%, #09090b 70%);
}
.stage-empty p { max-width: 460px; color: var(--muted); font-size: 14.5px; }
.hero-title { font: 700 30px/1.1 var(--font-display); letter-spacing: -0.03em; margin-top: 6px; }
.hero-actions { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; justify-content: center; }
.stage-loading {
  position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: rgba(0, 0, 0, .35); pointer-events: none; text-align: center; padding: 20px;
}
.spinner { width: 40px; height: 40px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .16); border-top-color: #fff; animation: spin .8s linear infinite; }
.spin-sm { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--fg); animation: spin .7s linear infinite; flex-shrink: 0; }
.loading-text { color: #e4e4e7; font-size: 13.5px; text-shadow: 0 1px 4px #000; max-width: 80%; font-variant-numeric: tabular-nums; }
.next-overlay {
  position: absolute; right: 18px; bottom: calc(var(--hud-h) + 10px); z-index: 9; width: min(360px, calc(100% - 36px)); padding: 16px;
  background: rgba(20, 20, 23, .82); border: 1px solid rgba(255, 255, 255, .1); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: blur(20px) saturate(1.4); backdrop-filter: blur(20px) saturate(1.4); animation: pop-in var(--dur-2) var(--ease-out);
}
.next-cap { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.next-title { font-weight: 650; margin: 4px 0 12px; overflow-wrap: anywhere; }
.next-actions { display: flex; gap: 8px; }
.next-actions .primary, .next-actions .ghost { height: 34px; padding: 0 14px; font-size: 13.5px; }

/* subtitles: own overlay, styled by --sub-* and data-sub-bg; lifted above the visible control bar */
.sub-overlay {
  position: absolute; left: 4%; right: 4%; bottom: var(--sub-bottom); z-index: 3;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none; text-align: center; transition: bottom var(--dur-3) var(--ease);
}
.stage:not(.hud-hidden) .sub-overlay { bottom: max(var(--sub-bottom), calc(var(--hud-h) + 10px)); }
.sub-box {
  max-width: 100%; color: var(--sub-color); overflow-wrap: anywhere; letter-spacing: 0;
  font: 600 calc(var(--sub-px) * var(--sub-scale)) / 1.34 var(--font);
}
.sub-line { padding: .06em .42em .1em; border-radius: .2em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.stage[data-sub-bg="box"] .sub-line { background: rgba(0, 0, 0, .78); }
.stage[data-sub-bg="dim"] .sub-line { background: rgba(0, 0, 0, .42); text-shadow: 0 1px 3px rgba(0, 0, 0, .9); }
.stage[data-sub-bg="outline"] .sub-line {
  background: none;
  text-shadow: -.06em -.06em 0 #000, .06em -.06em 0 #000, -.06em .06em 0 #000, .06em .06em 0 #000,
    0 -.07em 0 #000, 0 .07em 0 #000, -.07em 0 0 #000, .07em 0 0 #000, 0 .1em .25em rgba(0, 0, 0, .8);
}
.sub-note { padding: 6px 12px; border-radius: var(--r-full); background: rgba(0, 0, 0, .66); color: #e4e4e7; font: 550 13px/1.3 var(--font); }

/* gesture feedback */
.seek-ind { position: absolute; top: 0; bottom: 0; z-index: 4; width: 38%; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.seek-ind[data-side="left"] { left: 0; background: radial-gradient(farthest-side at 0% 50%, rgba(255, 255, 255, .14), transparent); }
.seek-ind[data-side="right"] { right: 0; background: radial-gradient(farthest-side at 100% 50%, rgba(255, 255, 255, .14), transparent); }
.seek-ind-text {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: var(--r-full); white-space: nowrap;
  background: rgba(20, 20, 23, .6); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  font: 650 14.5px/1 var(--font); font-variant-numeric: tabular-nums;
}
.seek-ind-text .ic { width: 18px; height: 18px; }
.seek-ind.pop .seek-ind-text { animation: pop-in var(--dur-3) var(--ease-out); }
.speed-badge {
  position: absolute; top: 16px; left: 50%; z-index: 6; transform: translateX(-50%); pointer-events: none;
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 15px; border-radius: var(--r-full); white-space: nowrap;
  background: rgba(20, 20, 23, .62); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  font: 650 13.5px/1 var(--font); animation: fade-in var(--dur-2) var(--ease-out);
}
.speed-badge .ic { width: 16px; height: 16px; }
.osd {
  position: absolute; top: 16%; left: 50%; z-index: 7; transform: translateX(-50%); pointer-events: none; max-width: 80%;
  padding: 10px 16px; border-radius: var(--r-md); background: rgba(20, 20, 23, .72); text-align: center;
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); font: 600 14px/1.3 var(--font); font-variant-numeric: tabular-nums;
}
.osd.pop { animation: osd 1.5s var(--ease) forwards; }

/* ---- HUD ---- */
.hud { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; transition: opacity var(--dur-3) var(--ease); }
.stage.hud-hidden .hud { opacity: 0; }
.stage.hud-hidden .hud * { pointer-events: none !important; }
.hud .ic { width: 22px; height: 22px; }
.hud-top {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 14px max(18px, env(safe-area-inset-right)) 36px max(18px, env(safe-area-inset-left));
  background: linear-gradient(180deg, rgba(0, 0, 0, .66), rgba(0, 0, 0, 0));
}
.hud-titles { min-width: 0; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.hud-title { font: 650 15.5px/1.3 var(--font-display); letter-spacing: -0.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-sub { font-size: 12.5px; color: rgba(255, 255, 255, .72); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-sub:empty { display: none; }
.hud-badges { display: flex; gap: 6px; flex-shrink: 0; }
.hud-bt, .hud-remux {
  padding: 5px 10px; border-radius: var(--r-full); font: 600 11.5px/1 var(--font); white-space: nowrap; font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .14); color: rgba(255, 255, 255, .86);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.hud-remux { letter-spacing: .08em; font-weight: 700; }

.hud-center {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: clamp(24px, 7vw, 64px); pointer-events: none;
}
.hc-btn {
  position: relative; pointer-events: auto; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; color: #fff; background: rgba(28, 28, 32, .42); border: 1px solid rgba(255, 255, 255, .12);
  -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4); box-shadow: 0 8px 32px rgba(0, 0, 0, .3);
  transition: background-color var(--dur-1) var(--ease), transform var(--dur-1) var(--ease);
}
.hc-btn:hover { background: rgba(255, 255, 255, .22); }
.hc-btn:active { transform: scale(.94); }
.hc-main { width: 76px; height: 76px; }
.hc-main .ic { width: 34px; height: 34px; }
.hc-side { width: 58px; height: 58px; }
.hc-side .ic { width: 32px; height: 32px; }
.hc-fwd .ic { transform: scaleX(-1); }
.hc-side small { position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); font: 700 9.5px/1 var(--font); font-variant-numeric: tabular-nums; }
.stage[data-input="mouse"] .hc-side { display: none; }
.stage[data-input="mouse"]:not(.paused) .hc-main { display: none; }
.stage-loading:not([hidden]) ~ .hud .hud-center { display: none; }

.hud-bottom {
  pointer-events: auto; padding: 32px max(14px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  background: linear-gradient(0deg, rgba(0, 0, 0, .78), rgba(0, 0, 0, .38) 58%, rgba(0, 0, 0, 0));
}
.hud-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hud-group { display: flex; align-items: center; gap: 2px; min-width: 0; }
.hud-right { justify-content: flex-end; gap: 4px; }
.hb {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 40px; height: 40px; border-radius: var(--r-full); color: #fff; font-size: 13px;
  transition: background-color var(--dur-1) var(--ease), transform var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.hb:hover { background: rgba(255, 255, 255, .14); }
.hb:active { transform: scale(.92); }
.hb[aria-pressed="true"], .hb[aria-expanded="true"] { background: rgba(255, 255, 255, .2); }
.hb.pill {
  width: auto; height: 34px; padding: 0 13px 0 10px; gap: 7px; font-weight: 600; font-size: 13px;
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .14);
  -webkit-backdrop-filter: blur(12px) saturate(1.4); backdrop-filter: blur(12px) saturate(1.4);
}
.hb.pill:hover { background: rgba(255, 255, 255, .18); }
.hb.pill .ic { width: 18px; height: 18px; }
.hb.pill.on { background: #fff; color: #09090b; border-color: #fff; }
.pill-label { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-time { width: auto; padding: 0 10px; font: 550 13px/1 var(--font); font-variant-numeric: tabular-nums; white-space: nowrap; color: rgba(255, 255, 255, .9); }
.stage[data-input="touch"] .hb.h-time, .stage.narrow .hb.h-time { width: auto; }
.stage[data-input="touch"] .vol-range { display: none; }
.hud-vol { display: flex; align-items: center; }
.vol-range {
  -webkit-appearance: none; appearance: none; width: 0; height: 24px; margin: 0; padding: 0; border: 0; border-radius: 0;
  background: transparent; opacity: 0; cursor: pointer; transition: width var(--dur-2) var(--ease), opacity var(--dur-2) var(--ease), margin var(--dur-2) var(--ease);
}
.vol-range:focus { box-shadow: none; border: 0; }
.hud-vol:hover .vol-range, .vol-range:focus-visible { width: 84px; opacity: 1; margin-right: 6px; }
.vol-range::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: linear-gradient(90deg, #fff var(--v, 100%), rgba(255, 255, 255, .28) var(--v, 100%)); }
.vol-range::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; margin-top: -4.5px; border: 0; border-radius: 50%; background: #fff; }
.vol-range::-moz-range-track { height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .28); }
.vol-range::-moz-range-progress { height: 3px; border-radius: 3px; background: #fff; }
.vol-range::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: #fff; }

/* unified scrubber: thin, grows on hover / drag */
.scrub { --hover: 0%; position: relative; height: 22px; margin: 0 8px 4px; cursor: pointer; touch-action: none; outline-offset: 4px; }
.scrub-rail {
  position: absolute; left: 0; right: 0; top: 50%; height: 3px; margin-top: -1.5px; border-radius: 3px; overflow: hidden;
  background: rgba(255, 255, 255, .22); transition: height var(--dur-1) var(--ease), margin-top var(--dur-1) var(--ease);
}
.scrub-rail::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: var(--hover); background: rgba(255, 255, 255, .16); opacity: 0; transition: opacity var(--dur-1) var(--ease); }
.scrub:hover .scrub-rail::before { opacity: 1; }
.scrub:hover .scrub-rail, .scrub.dragging .scrub-rail { height: 6px; margin-top: -3px; }
.scrub-buf { position: absolute; top: 0; bottom: 0; left: 0; width: 0; background: rgba(255, 255, 255, .34); }
.scrub-played { position: absolute; top: 0; bottom: 0; left: 0; width: 0; background: #fff; }
.scrub-thumb {
  position: absolute; top: 50%; left: 0; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; pointer-events: none;
  background: #fff; box-shadow: 0 1px 6px rgba(0, 0, 0, .5); transform: scale(0); transition: transform var(--dur-1) var(--ease);
}
.scrub:hover .scrub-thumb, .scrub.dragging .scrub-thumb, .scrub:focus-visible .scrub-thumb { transform: scale(1); }
.scrub.disabled { cursor: default; opacity: .5; }
.scrub.disabled .scrub-thumb { display: none; }
.scrub-bubble {
  position: absolute; bottom: 26px; transform: translateX(-50%); padding: 6px 9px; border-radius: 8px; pointer-events: none; white-space: nowrap;
  background: rgba(20, 20, 23, .88); border: 1px solid rgba(255, 255, 255, .12); font: 600 12.5px/1 var(--font); font-variant-numeric: tabular-nums;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: var(--shadow-md);
}

/* settings / audio / subtitles popover inside the stage */
.settings-menu {
  position: absolute; right: 12px; bottom: calc(var(--hud-h) + 4px); z-index: 8;
  width: min(380px, calc(100% - 24px)); max-height: calc(100% - var(--hud-h) - 20px); overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch; padding: 0 12px 12px; border-radius: var(--r-lg); cursor: auto; text-align: left;
  background: rgba(22, 22, 26, .86); border: 1px solid rgba(255, 255, 255, .1); box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: blur(24px) saturate(1.5); backdrop-filter: blur(24px) saturate(1.5); animation: pop-in var(--dur-1) var(--ease-out);
}
.mhead { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 6px; padding: 12px 0 8px; background: rgba(22, 22, 26, .96); }
.mtitle { flex: 1; font: 650 15px/1.2 var(--font-display); letter-spacing: -0.015em; }
.mnav { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: rgba(255, 255, 255, .08); color: #fff; }
.mnav:hover { background: rgba(255, 255, 255, .16); }
.mnav .ic { width: 16px; height: 16px; }
.mgroup { margin: 18px 0 0; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .08); font: 650 14px/1 var(--font-display); }
.msec { margin-top: 14px; }
.msec-h { margin-bottom: 8px; font: 600 11px/1 var(--font); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.mchips { display: flex; flex-wrap: wrap; gap: 6px; }
.mchip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 6px 12px; border-radius: var(--r-full);
  font: 500 13px/1.2 var(--font); color: #fff; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .1);
  transition: background-color var(--dur-1) var(--ease);
}
.mchip:hover { background: rgba(255, 255, 255, .14); }
.mchip[aria-pressed="true"] { background: #fff; border-color: #fff; color: #09090b; }
.mchip:disabled { opacity: .4; cursor: default; }
.mchip .ic { width: 15px; height: 15px; }
.mchip.mlink { width: 100%; margin-top: 16px; justify-content: space-between; border-radius: var(--r-md); }
.swatch { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .5); }
.mlist { display: flex; flex-direction: column; gap: 2px; }
.mitem {
  display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  width: 100%; min-height: 42px; padding: 9px 10px; border-radius: 10px; color: #fff; text-align: left; font-size: 14px;
  transition: background-color var(--dur-1) var(--ease);
}
.mitem:hover { background: rgba(255, 255, 255, .08); }
.mitem[aria-pressed="true"] { background: rgba(255, 255, 255, .1); }
.mitem:disabled { opacity: .45; cursor: default; }
.mitem-check { display: inline-flex; color: #fff; }
.mitem-check .ic { width: 16px; height: 16px; }
.mitem-label { overflow-wrap: anywhere; }
.mitem-note { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.mnote { margin: 8px 2px 0; color: var(--muted); font-size: 13px; }

/* touch (iPad): bigger targets */
.stage[data-input="touch"] { --hud-h: 104px; }
.stage[data-input="touch"] .hb { width: 46px; height: 46px; }
.stage[data-input="touch"] .hb.pill { height: 42px; }
.stage[data-input="touch"] .scrub { height: 34px; }
.stage[data-input="touch"] .scrub-rail { height: 5px; margin-top: -2.5px; }
.stage[data-input="touch"] .scrub-thumb { transform: scale(1); }
.stage[data-input="touch"] .scrub.dragging .scrub-rail { height: 8px; margin-top: -4px; }
.stage[data-input="touch"] .scrub.dragging .scrub-thumb { transform: scale(1.3); }
.stage[data-input="touch"] .mchip { min-height: 44px; padding: 8px 14px; }
.stage[data-input="touch"] .mitem { min-height: 48px; }
.stage[data-input="touch"] .mnav { width: 40px; height: 40px; }
@media (hover: none) {
  .vol-range { display: none; }
  /* no sticky hover after a tap */
  .hb:hover:not([aria-pressed="true"]):not([aria-expanded="true"]) { background: transparent; }
  .hb.pill:hover:not(.on) { background: rgba(255, 255, 255, .1); }
  .hb.pill.on:hover { background: #fff; }
  .hc-btn:hover { background: rgba(28, 28, 32, .42); }
  .mchip:hover:not([aria-pressed="true"]) { background: rgba(255, 255, 255, .07); }
  .mitem:hover:not([aria-pressed="true"]) { background: transparent; }
}
/* fullscreen: roomier HUD */
.stage.is-fs { --hud-h: 108px; }
.stage.is-fs .hud-top { padding-top: max(20px, env(safe-area-inset-top)); }
.stage.is-fs .hud-title { font-size: 19px; }
.stage.is-fs .hud-sub { font-size: 14px; }
.stage.is-fs .hb .ic { width: 26px; height: 26px; }
.stage.is-fs .hb.pill .ic { width: 20px; height: 20px; }
/* small player: compact HUD */
.stage.narrow { --hud-h: 80px; }
.stage.narrow .hud-top { padding-bottom: 20px; }
.stage.narrow .hud-title { font-size: 13.5px; }
.stage.narrow .hud-badges .hud-bt { display: none; }
.stage.narrow .hb { width: 36px; height: 36px; }
.stage.narrow .hb .ic { width: 20px; height: 20px; }
.stage.narrow .hb.pill { height: 32px; padding: 0 8px; }
.stage.narrow .pill-label, .stage.narrow .hide-narrow { display: none; }
.stage.narrow .h-time { padding: 0 4px; font-size: 11.5px; }
.stage.narrow .hc-main { width: 62px; height: 62px; }
.stage.narrow .hc-side { width: 50px; height: 50px; }
.stage.narrow .stage-empty { gap: 8px; padding: 16px; }
.stage.narrow .stage-empty .logo-mark, .stage.narrow .stage-empty p { display: none; }
.stage.narrow .hero-title { font-size: 22px; margin-top: 0; }
.stage.narrow .hero-actions { gap: 8px; margin-top: 4px; }
.stage.narrow .hero-actions .btn, .stage.narrow .hero-actions .ghost { height: 36px; padding: 0 12px; font-size: 13px; }
.stage.narrow .hero-actions > :nth-child(3) { display: none; }

/* title block under the stage */
.now { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-top: 18px; }
.now-text { min-width: 0; }
.now-title { font-size: 24px; font-weight: 700; letter-spacing: -0.028em; overflow-wrap: anywhere; }
.now-sub { color: var(--muted); font-size: 14px; margin-top: 4px; overflow-wrap: anywhere; }
.now-sub:empty { display: none; }
.bt-stats { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; flex-shrink: 0; padding-top: 4px; }
.stat-chip {
  --p: 0%;
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: var(--r-full);
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); font: 500 12.5px/1 var(--font); white-space: nowrap;
}
.stat-chip .ic { width: 14px; height: 14px; }
.stat-chip.prog { color: var(--fg); background: linear-gradient(90deg, var(--surface-3) var(--p), var(--surface) var(--p)); }
.stat-chip.done { color: var(--ok-fg); }
.stat-chip.warn { color: var(--warn); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex-shrink: 0; }
.dot.pulse { background: var(--warn); animation: pulse 1.2s ease-in-out infinite; }

.toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.ctl {
  position: relative; display: inline-flex; align-items: center; gap: 0; height: 36px; border-radius: 10px;
  border: 1px solid var(--border); color: var(--muted); transition: background-color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
.ctl:hover { background: var(--surface); border-color: var(--border-strong); }
.ctl > .ic { position: absolute; left: 10px; width: 16px; height: 16px; pointer-events: none; }
.ctl select {
  -webkit-appearance: none; appearance: none; height: 34px; max-width: 240px; padding: 0 28px 0 34px; border: 0; border-radius: 10px;
  background: transparent; color: var(--fg); font: 500 13px/1 var(--font); text-overflow: ellipsis;
}
.ctl select:focus-visible { box-shadow: 0 0 0 2px var(--ring); }
.ctl:not(.sync)::after {
  content: ""; position: absolute; right: 12px; top: 50%; width: 6px; height: 6px; pointer-events: none;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-70%) rotate(45deg);
}
.ctl.sync { gap: 2px; padding: 0 3px; }
.tb-mini { height: 28px; padding: 0 8px; border-radius: 7px; font: 550 12px/1 var(--font); color: var(--fg); font-variant-numeric: tabular-nums; }
.tb-mini:hover { background: var(--surface-3); }
.sync-val { min-width: 44px; text-align: center; font: 600 12.5px/1 var(--font); color: var(--fg); font-variant-numeric: tabular-nums; }
.tb-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px; border-radius: 10px; color: var(--muted);
  font: 500 13px/1 var(--font); white-space: nowrap; transition: background-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.tb-btn:hover { background: var(--surface-3); color: var(--fg); }
.tb-btn .ic { width: 17px; height: 17px; }
.tb-btn[aria-pressed="true"] { background: var(--surface-3); color: var(--fg); }

/* item previews: duration badge + watch progress over the thumbnail */
.dur-badge {
  position: absolute; right: 6px; bottom: 6px; z-index: 1; padding: 2px 6px; border-radius: 6px;
  background: rgba(0, 0, 0, .72); color: #fff; font: 600 11px/1.3 var(--font); font-variant-numeric: tabular-nums;
}
.thumb-prog { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; height: 3px; background: rgba(255, 255, 255, .25); }
.thumb-prog i { display: block; height: 100%; background: var(--accent); }
.thumb-prog ~ .dur-badge { bottom: 9px; }

/* queue */
.queue {
  display: flex; flex-direction: column; max-height: calc(100vh - var(--header-h) - 40px); position: sticky; top: calc(var(--header-h) + 20px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden;
}
.queue-head { padding: 16px 16px 12px; border-bottom: 1px solid var(--border); }
.queue-head h2 { font-size: 16px; }
.queue-head .muted { margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.queue-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; position: relative; }
.q-item { display: flex; gap: 10px; align-items: center; padding: 6px; border-radius: 10px; cursor: pointer; transition: background-color var(--dur-1) var(--ease); }
.q-item:hover { background: var(--surface-3); }
.q-item.active { background: var(--surface-3); }
.q-num { width: 22px; display: inline-flex; justify-content: center; color: var(--dim); font: 550 12px/1 var(--font); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.q-item.active .q-num { color: var(--accent); }
.q-thumb { width: 112px; flex-shrink: 0; border-radius: 8px; }
.q-thumb .dur-badge { right: 4px; bottom: 4px; font-size: 10px; padding: 1px 4px; }
.q-thumb .thumb-prog ~ .dur-badge { bottom: 7px; }
.q-text { min-width: 0; flex: 1; }
.q-title { font-size: 13.5px; font-weight: 550; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.q-sub { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.q-prog, .cw-bar { height: 3px; border-radius: 3px; background: var(--surface-4); overflow: hidden; margin-top: 6px; }
.q-prog i, .cw-bar i { display: block; height: 100%; background: var(--accent); }
body.theater .player-layout.with-queue { grid-template-columns: minmax(0, 1fr); }
body.theater .queue { position: static; max-height: 420px; }

/* equalizer "now playing" mark */
.eq { display: inline-flex; align-items: flex-end; gap: 2px; width: 12px; height: 12px; }
.eq i { flex: 1; background: var(--accent); border-radius: 1px; animation: eq 1s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.4s; }
.eq i:nth-child(3) { animation-delay: -.7s; }

/* continue watching */
.cw-row {
  display: grid; grid-auto-flow: column; grid-auto-columns: 288px; gap: 18px; overflow-x: auto; padding: 4px 4px 12px; margin: -4px -4px 0;
  scroll-snap-type: x mandatory; scroll-padding: 4px; overscroll-behavior-x: contain;
}
.cw { cursor: pointer; scroll-snap-align: start; min-width: 0; border-radius: var(--r-md); }
.cw-thumb { position: relative; border-radius: var(--r-md); overflow: hidden; box-shadow: inset 0 0 0 1px var(--border); transition: transform var(--dur-2) var(--ease); }
.cw-thumb .poster { aspect-ratio: 16 / 9; border-radius: 0; }
.cw-thumb .cw-bar { position: absolute; left: 10px; right: 10px; bottom: 10px; margin: 0; height: 3px; background: rgba(255, 255, 255, .3); z-index: 2; }
.cw-thumb::after { content: ""; position: absolute; inset: 50% 0 0; background: linear-gradient(to top, rgba(0, 0, 0, .55), transparent); pointer-events: none; }
.cw-play { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity var(--dur-2) var(--ease); }
.play-disc {
  display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 50%; color: #fff;
  background: rgba(28, 28, 32, .5); border: 1px solid rgba(255, 255, 255, .16); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.play-disc .ic { width: 22px; height: 22px; }
.cw:hover .cw-play, .cw:focus-visible .cw-play, .cw.playing .cw-play { opacity: 1; }
.cw-src {
  position: absolute; left: 8px; top: 8px; z-index: 2; padding: 3px 7px; border-radius: 6px;
  font: 600 10.5px/1.2 var(--font); letter-spacing: .02em; color: #fff; background: rgba(0, 0, 0, .55);
}
.cw.playing .cw-src { background: var(--accent); }
.cw-x {
  position: absolute; right: 8px; top: 8px; z-index: 3; display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%; color: #fff; background: rgba(0, 0, 0, .55); opacity: 0;
  transition: opacity var(--dur-1) var(--ease), background-color var(--dur-1) var(--ease);
}
.cw-x .ic { width: 15px; height: 15px; }
.cw-x:hover { background: rgba(0, 0, 0, .8); }
.cw:hover .cw-x, .cw-x:focus-visible { opacity: 1; }
.cw-title { font-weight: 600; font-size: 14px; margin-top: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.01em; }
.cw-meta { display: flex; gap: 8px; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.cw-sub { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cw-time { flex-shrink: 0; }
.cw-sub + .cw-time::before { content: "·"; margin-right: 8px; opacity: .6; }

.hint { margin-top: 36px; color: var(--dim); font-size: 12.5px; }
.hint summary { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; padding: 6px 10px; margin-left: -10px; border-radius: 8px; user-select: none; }
.hint summary::-webkit-details-marker { display: none; }
.hint summary:hover { color: var(--fg); background: var(--surface); }
.hint summary .ic { width: 16px; height: 16px; }
.hint p { max-width: 900px; margin-top: 8px; line-height: 1.6; }

/* =============================================================================
   Posters
   ========================================================================== */
.poster {
  --h1: 220; --h2: 280;
  position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center;
  aspect-ratio: 2 / 3; border-radius: var(--r-md);
  background: linear-gradient(145deg, hsl(var(--h1) 32% 28%), hsl(var(--h2) 38% 12%));
}
.poster.wide { aspect-ratio: 16 / 9; }
.poster-initials { font: 700 28px/1 var(--font-display); color: rgba(255, 255, 255, .8); letter-spacing: .02em; }
.poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity var(--dur-3) var(--ease); }
.poster.loaded img { opacity: 1; }

/* =============================================================================
   Catalog
   ========================================================================== */
.cat-hero {
  position: relative; overflow: hidden; border-radius: var(--r-xl); margin-bottom: 28px; isolation: isolate;
  min-height: clamp(320px, 38vw, 500px); display: flex; align-items: flex-end; background: #0c0c0e; color: var(--fg);
}
.cat-hero.no-art { min-height: 0; }
.hero-skel { position: absolute; inset: 0; }
.hero-bg { position: absolute; inset: 0; z-index: -1; }
.hero-bg img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .5s var(--ease); }
.hero-bg.loaded img { opacity: 1; }
.hero-bg.wide img { object-position: center 25%; }
.hero-bg.blur img { filter: blur(48px) saturate(1.5); transform: scale(1.3); }
.hero-bg.blur.loaded img { opacity: .75; }
.hero-bg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(9, 9, 11, .9) 0%, rgba(9, 9, 11, .62) 42%, rgba(9, 9, 11, .1) 78%),
    linear-gradient(0deg, rgba(9, 9, 11, .85) 0%, rgba(9, 9, 11, 0) 55%);
}
.hero-content { display: flex; align-items: flex-end; gap: 28px; width: 100%; padding: clamp(24px, 4vw, 48px); }
.hero-poster { width: clamp(120px, 14vw, 190px); flex-shrink: 0; }
.hero-poster .poster { box-shadow: var(--shadow-lg); border-radius: var(--r-md); }
.hero-text { min-width: 0; max-width: 680px; display: flex; flex-direction: column; gap: 10px; }
.hero-h { font: 750 clamp(30px, 4.2vw, 52px)/1.04 var(--font-display); letter-spacing: -0.035em; text-wrap: balance; }
.hero-orig { color: var(--muted); font-size: 15px; margin-top: -4px; }
.hero-desc { color: var(--fg-2); font-size: 15px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; max-width: 600px; }
.cat-hero .hero-actions { justify-content: flex-start; margin-top: 8px; }
.cat-hero .primary { background: #fff; color: #09090b; }

.cat-head { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 4px; }
.search-field { position: relative; display: flex; align-items: center; width: min(320px, 100%); }
.search-field > .ic { position: absolute; left: 12px; width: 16px; height: 16px; color: var(--dim); pointer-events: none; }
.search-field input { flex: 1; width: 100%; height: 38px; padding-left: 36px; background: var(--surface); border-color: var(--border); }
.poster-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); gap: 26px 18px; margin-top: 20px; }
/* content-visibility clips descendants to the padding box: the padding leaves room for the hover lift */
.card {
  position: relative; cursor: pointer; min-width: 0; padding: 6px 6px 16px; margin: -6px -6px -16px; border-radius: 16px;
  content-visibility: auto; contain-intrinsic-size: auto 290px;
}
.card .poster { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06), var(--shadow-sm); transition: transform var(--dur-3) var(--ease-out), box-shadow var(--dur-3) var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .card:hover .poster { transform: translateY(-4px) scale(1.02); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1), 0 12px 20px -10px rgba(0, 0, 0, .55); }
}
.card:focus-visible, .pl-card:focus-visible { outline-offset: -2px; }
.card-overlay {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; padding: 48px 12px 12px; color: #fff;
  background: linear-gradient(to top, rgba(0, 0, 0, .9) 0%, rgba(0, 0, 0, .55) 50%, rgba(0, 0, 0, 0) 100%);
}
.card-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.q-chip { padding: 2px 6px; border-radius: 5px; font: 650 10.5px/1.3 var(--font); letter-spacing: .02em; background: rgba(255, 255, 255, .92); color: #09090b; }
.q-chip.hdr { background: rgba(196, 181, 253, .92); }
.q-chip.vo-chip { background: rgba(255, 255, 255, .16); color: #fff; font-weight: 550; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-title { font: 650 14px/1.25 var(--font); letter-spacing: -0.012em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; text-wrap: balance; }
.card-sub { margin-top: 3px; font-size: 11.5px; color: rgba(255, 255, 255, .7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-sub:empty { display: none; }
.badge {
  display: inline-flex; align-items: center; gap: 3px; padding: 3px 7px; border-radius: 6px;
  font: 650 11px/1.2 var(--font); color: #fff; background: rgba(0, 0, 0, .62); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.badge .ic { width: 11px; height: 11px; }
.poster .badge { position: absolute; z-index: 1; }
.badge.rating { top: 8px; left: 8px; color: #fde68a; }
.badge.kind { top: 8px; right: 8px; }
.skeleton { cursor: default; }
.skeleton .poster { box-shadow: none; }
.skeleton .sk-line { height: 11px; border-radius: 6px; margin-top: 10px; }
.skeleton .sk-line.short { width: 55%; }
.shimmer { background: linear-gradient(90deg, var(--shimmer-a) 0%, var(--shimmer-b) 50%, var(--shimmer-a) 100%); background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite; }

/* empty / error states */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  grid-column: 1 / -1; padding: 56px 20px; color: var(--muted); font-size: 13.5px;
  border: 1px dashed var(--border-strong); border-radius: var(--r-lg);
}
.empty-ic { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-bottom: 6px; border-radius: 12px; background: var(--surface-3); color: var(--fg); }
.empty-ic .ic { width: 22px; height: 22px; }
.empty-title { color: var(--fg); font-weight: 600; font-size: 15px; letter-spacing: -0.012em; }
.empty-text { max-width: 420px; }

/* =============================================================================
   Dialogs (shared), sheets on mobile
   ========================================================================== */
dialog.modal {
  padding: 0; border: 1px solid var(--border); border-radius: var(--r-xl); background: var(--popover); color: var(--fg);
  width: min(540px, 94vw); max-height: 90vh; max-height: 90dvh; box-shadow: var(--shadow-lg); overflow: hidden;
}
dialog.modal.wide { width: min(1000px, 96vw); }
dialog.modal::backdrop { background: rgba(0, 0, 0, .55); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
dialog.modal[open] { animation: dialog-in var(--dur-3) var(--ease-out); }
dialog.modal[open]::backdrop { animation: fade-in var(--dur-2) var(--ease-out); }
.modal-body { position: relative; padding: 24px; max-height: 90vh; max-height: 90dvh; overflow-y: auto; overscroll-behavior: contain; }
.modal-x { position: absolute; right: 14px; top: 14px; z-index: 3; }
.modal-title { font-size: 18px; padding-right: 40px; }

/* command palette */
dialog.cmdk { margin: 12vh auto auto; width: min(640px, 94vw); border-radius: var(--r-lg); max-height: 76vh; display: none; flex-direction: column; }
dialog.cmdk[open] { display: flex; animation: cmdk-in var(--dur-2) var(--ease-out); }
.cmdk-bar { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 12px 0 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.cmdk-bar > .ic { width: 18px; height: 18px; color: var(--dim); }
.cmdk-bar input { flex: 1; height: 100%; padding: 0; border: 0; background: transparent; font-size: 16px; box-shadow: none; }
.cmdk-bar input:focus-visible { box-shadow: none; }
.cmdk-list { flex: 1; min-height: 0; max-height: min(440px, 60vh); overflow-y: auto; overscroll-behavior: contain; padding: 6px; scroll-padding: 6px; }
.cmdk-group { padding: 10px 10px 6px; font: 600 11px/1 var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--dim); }
.cmdk-item {
  display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 8px 10px; border-radius: 10px; cursor: pointer;
  color: var(--fg-2); font-size: 14px; user-select: none;
}
.cmdk-item .ic { width: 17px; height: 17px; color: var(--muted); }
.cmdk-item[aria-selected="true"] { background: var(--surface-3); color: var(--fg); }
.cmdk-item[aria-selected="true"] .ic { color: var(--fg); }
.cmdk-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-hint { flex-shrink: 0; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.cmdk-empty { padding: 28px 12px; text-align: center; color: var(--muted); font-size: 13.5px; }
.cmdk-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--border); color: var(--dim); font-size: 12px; flex-shrink: 0; }
.cmdk-foot span { display: inline-flex; align-items: center; gap: 4px; }

/* popover menu («…», theme) */
.pop-menu {
  position: fixed; z-index: 1200; min-width: 210px; max-width: min(320px, calc(100vw - 16px)); padding: 4px;
  background: var(--popover); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  animation: pop-in var(--dur-1) var(--ease-out); transform-origin: top right;
}
.pop-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 0 10px; border-radius: 8px;
  color: var(--fg-2); font-size: 13.5px; text-align: left; white-space: nowrap;
}
.pop-item:hover:not(:disabled), .pop-item:focus-visible { background: var(--surface-3); color: var(--fg); outline: none; }
.pop-item .ic { width: 16px; height: 16px; color: var(--muted); }
.pop-item.danger, .pop-item.danger .ic { color: var(--danger); }
.pop-label { flex: 1; }
.pop-check { color: var(--fg) !important; }
.pop-hint { color: var(--dim); font-size: 12px; }
.pop-sep { height: 1px; margin: 4px 6px; background: var(--border); }

/* release picker */
.rm-body { padding: 0; }
.rm-hero { position: relative; isolation: isolate; overflow: hidden; padding: 32px 32px 28px; background: #0c0c0e; color: var(--fg); }
.rm-backdrop { position: absolute; inset: 0; z-index: -1; }
.rm-backdrop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(48px) saturate(1.5); transform: scale(1.35); opacity: 0; transition: opacity .5s var(--ease); }
.rm-backdrop.loaded img { opacity: .6; }
.rm-backdrop::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(9, 9, 11, .25) 0%, rgba(9, 9, 11, .8) 100%); }
.rm-head { display: flex; gap: 24px; align-items: flex-end; }
.rm-poster { width: 150px; flex-shrink: 0; }
.rm-poster .poster { box-shadow: var(--shadow-lg); }
.rm-info { min-width: 0; flex: 1; padding-right: 40px; display: flex; flex-direction: column; gap: 8px; }
.rm-info h2 { font: 700 clamp(22px, 3vw, 32px)/1.1 var(--font-display); letter-spacing: -0.03em; }
.rm-orig { color: var(--muted); font-size: 14px; margin-top: -4px; }
.rm-orig:empty { display: none; }
.rm-desc { color: var(--fg-2); font-size: 13.5px; line-height: 1.55; max-height: 7.8em; overflow-y: auto; }
.rm-desc:empty { display: none; }
.rm-desc p { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.rm-cast { margin-top: 6px; color: var(--muted); font-size: 12.5px; }
.rm-content { padding: 20px 32px 32px; scroll-margin-top: 0; }
.rm-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.rm-form .field-icon { min-width: 200px; }
.rm-episode { display: inline-flex; gap: 8px; align-items: center; }
.rm-episode label { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; }
.rm-episode input { width: 70px; padding: 0 10px; font-variant-numeric: tabular-nums; }
.rm-filters { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-top: 16px; }
.rm-filters .chips { align-self: stretch; }
.rm-filters .seg:empty { display: none; }
.releases { display: flex; flex-direction: column; margin-top: 12px; border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; transition: opacity var(--dur-2) var(--ease); }
.releases:empty { border: 0; }
.releases.loading { opacity: .55; }
.releases > .empty { border: 0; border-radius: 0; }
.rel {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) auto auto; gap: 14px; align-items: center;
  padding: 12px 14px; transition: background-color var(--dur-1) var(--ease);
}
.rel + .rel { border-top: 1px solid var(--border); }
.rel:hover { background: var(--surface-2); }
.rel-q { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.rel-title { font-weight: 550; font-size: 13.5px; line-height: 1.35; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rel-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; align-items: center; }
.vo { padding: 2px 8px; border-radius: var(--r-full); font: 500 11.5px/1.4 var(--font); background: var(--surface-3); color: var(--fg-2); }
.vo.type { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--border-strong); }
.vo.dub { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--fg); }
.q-badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 46px; padding: 3px 6px; border-radius: 6px;
  font: 700 11px/1.2 var(--font); letter-spacing: .02em; color: var(--fg); box-shadow: inset 0 0 0 1px var(--border-strong); font-variant-numeric: tabular-nums;
}
.q-badge.k4 { background: var(--fg); color: var(--bg); box-shadow: none; }
.q-badge.hdr { color: var(--hdr-fg); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hdr-fg) 45%, transparent); }
.q-badge.muted { color: var(--dim); }
.rel-src { font-size: 11.5px; color: var(--dim); }
.rel-stats { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 13px; white-space: nowrap; }
.rel-size { color: var(--fg-2); }
.seeds { display: inline-flex; align-items: center; gap: 6px; color: var(--ok-fg); font-weight: 600; }
.seeds.none { color: var(--dim); }
.seeds.none .dot { background: var(--dim); }
.seeds .peers { color: var(--dim); font-weight: 400; }
.rel-actions { display: flex; gap: 6px; }

/* add to playlist */
.pick-what { margin: 6px 0 14px; overflow-wrap: anywhere; font-size: 13.5px; }
.pick-list { display: flex; flex-direction: column; gap: 2px; margin: 0 -8px 14px; max-height: 46vh; overflow-y: auto; }
.pick-row {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px; border-radius: 10px; text-align: left;
  transition: background-color var(--dur-1) var(--ease);
}
.pick-row:hover:not(:disabled) { background: var(--surface-3); }
.pick-thumb { width: 72px; flex-shrink: 0; border-radius: 6px; }
.pick-thumb .poster-initials { font-size: 13px; }
.pick-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.pick-title { font-weight: 550; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-meta { color: var(--muted); font-size: 12.5px; }
.pick-plus { color: var(--muted); width: 18px; height: 18px; }
.pick-loading, .pick-empty { display: flex; align-items: center; gap: 10px; padding: 12px 8px; color: var(--muted); font-size: 13.5px; }
#pick-torrent { margin-top: 10px; }

/* editor */
.ed-grid { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 18px; margin-top: 16px; align-items: start; }
.ed-preview .poster { border-radius: 10px; box-shadow: var(--shadow-md); }
.ed-fields { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-cap { font-size: 12.5px; font-weight: 550; color: var(--muted); }
.ed-actions { margin-top: 12px; }

/* =============================================================================
   Playlists
   ========================================================================== */
.panels3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 24px; animation: fade-up var(--dur-2) var(--ease-out); }
.panel {
  display: flex; flex-direction: column; gap: 10px; padding: 18px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--border);
}
.panel h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.panel h3 .ic { color: var(--muted); }
.panel .row > button { flex-shrink: 0; }
.panel .primary { align-self: flex-start; }
.panel .row .primary { align-self: auto; }
.vk-mark { display: inline-flex; align-items: center; justify-content: center; height: 18px; padding: 0 5px; border-radius: 5px; background: var(--vk); color: #fff; font: 700 10px/1 var(--font); letter-spacing: .02em; }

.pl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 28px 20px; }
.pl-card {
  position: relative; cursor: pointer; min-width: 0; padding: 6px 6px 16px; margin: -6px -6px -16px; border-radius: 16px;
  content-visibility: auto; contain-intrinsic-size: auto 240px;
}
.pl-cover { position: relative; border-radius: var(--r-md); overflow: hidden; box-shadow: inset 0 0 0 1px var(--border), var(--shadow-sm); transition: transform var(--dur-3) var(--ease-out), box-shadow var(--dur-3) var(--ease-out); }
.pl-cover .poster { border-radius: 0; }
@media (hover: hover) and (pointer: fine) {
  .pl-card:hover .pl-cover { transform: translateY(-3px); box-shadow: inset 0 0 0 1px var(--border), 0 12px 20px -10px rgba(0, 0, 0, .5); }
}
.kind-badge {
  position: absolute; left: 10px; top: 10px; z-index: 1; padding: 3px 7px; border-radius: 6px;
  font: 650 10.5px/1.2 var(--font); letter-spacing: .03em; color: #fff; background: rgba(0, 0, 0, .58);
}
.kind-badge.vk { background: var(--vk); }
.kind-badge.inline { position: static; display: inline-flex; margin-right: 10px; color: var(--fg); background: rgba(255, 255, 255, .14); }
.kind-badge.inline.vk { background: var(--vk); color: #fff; }
.new-dot {
  position: absolute; right: 10px; top: 10px; z-index: 2; min-width: 22px; padding: 3px 7px; border-radius: var(--r-full);
  font: 700 11px/1.2 var(--font); text-align: center; color: var(--accent-fg); background: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, .25); animation: pop-in var(--dur-3) var(--ease-out); font-variant-numeric: tabular-nums;
}
.pl-syncing {
  position: absolute; left: 10px; bottom: 10px; z-index: 2; display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%; background: rgba(0, 0, 0, .55);
}
.pl-syncing .spin-sm { border-color: rgba(255, 255, 255, .25); border-top-color: #fff; width: 12px; height: 12px; }
.pl-play {
  position: absolute; right: 10px; bottom: 10px; z-index: 2; display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%; background: #fff; color: #09090b; box-shadow: var(--shadow-md);
  opacity: 0; transform: translateY(6px); transition: opacity var(--dur-2) var(--ease), transform var(--dur-2) var(--ease-out);
}
.pl-play .ic { width: 20px; height: 20px; margin-left: 2px; }
.pl-card:hover .pl-play, .pl-play:focus-visible { opacity: 1; transform: none; }
.pl-body { padding: 12px 2px 0; }
.pl-title { font-weight: 600; font-size: 15px; letter-spacing: -0.012em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* detail: Apple Music-style header */
.pld-hero {
  position: relative; isolation: isolate; overflow: hidden; border-radius: var(--r-xl); padding: 18px clamp(18px, 3vw, 32px) clamp(22px, 3vw, 32px);
  background: #0c0c0e; color: var(--fg); margin-bottom: 20px;
}
.pld-backdrop {
  --h1: 220;
  position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(80% 120% at 20% 0%, hsl(var(--h1) 35% 26%), transparent 70%), radial-gradient(70% 100% at 90% 100%, hsl(calc(var(--h1) + 60) 30% 18%), transparent 70%);
}
.pld-backdrop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(60px) saturate(1.6); transform: scale(1.4); opacity: 0; transition: opacity .5s var(--ease); }
.pld-backdrop.loaded img { opacity: .7; }
.pld-backdrop::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(9, 9, 11, .2), rgba(9, 9, 11, .75)); }
.back-btn { padding-left: 8px; }
.pld-head { display: flex; gap: clamp(18px, 3vw, 32px); align-items: flex-end; margin-top: 18px; }
.pld-cover { width: clamp(220px, 28vw, 340px); flex-shrink: 0; }
.pld-cover .poster { border-radius: var(--r-md); box-shadow: var(--shadow-lg); }
.pld-info { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.pld-title { font: 750 clamp(26px, 3.6vw, 44px)/1.06 var(--font-display); letter-spacing: -0.035em; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pld-desc { color: var(--fg-2); font-size: 14.5px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; max-width: 720px; }
.pld-desc:empty { display: none; }
.pld-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; color: var(--muted); font-size: 13.5px; }
.meta-link { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; color: var(--fg-2); }
.meta-link:hover { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; }
.meta-link .ic { width: 13px; height: 13px; }
.pld-sync { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; animation: fade-in var(--dur-2) var(--ease-out); }
.pld-sync .spin-sm { border-color: rgba(255, 255, 255, .2); border-top-color: #fff; }
.pld-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.pld-hero .primary { background: #fff; color: #09090b; }
.pld-actions .icon-btn { width: 38px; height: 38px; }
#pld-refresh.spinning .ic { animation: spin .9s linear infinite; }

.add-row { display: flex; gap: 8px; align-items: center; margin: 0 0 12px; }
.pld-items { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; }
.pld-items > li:only-child > .empty { margin-top: 8px; }
.pli {
  display: grid; grid-template-columns: 32px 168px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 8px 10px 8px 6px; border-radius: var(--r-md); cursor: pointer; transition: background-color var(--dur-1) var(--ease);
  content-visibility: auto; contain-intrinsic-size: auto 110px;
}
.pli:hover, .pli:focus-within { background: var(--surface); }
.pli.active { background: var(--surface-2); }
.pli-num { display: inline-flex; justify-content: center; color: var(--dim); font: 550 13px/1 var(--font); }
.pli.active .pli-num { color: var(--accent); }
.pli-thumb-wrap { position: relative; border-radius: 8px; overflow: hidden; }
.pli-thumb { width: 168px; border-radius: 8px; }
.pli-thumb .poster-initials, .q-thumb .poster-initials { font-size: 15px; }
.pli-hover-play {
  position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; color: #fff;
  background: rgba(0, 0, 0, .35); opacity: 0; transition: opacity var(--dur-1) var(--ease);
}
.pli-hover-play .ic { width: 26px; height: 26px; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .5)); }
.pli:hover .pli-hover-play { opacity: 1; }
.pli-text { min-width: 0; }
.pli-title { font-weight: 550; font-size: 14.5px; line-height: 1.35; letter-spacing: -0.01em; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pli-sub { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; margin-top: 4px; min-width: 0; }
.pli-sub-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pli-actions { display: flex; gap: 2px; opacity: 0; transition: opacity var(--dur-1) var(--ease); }
.pli:hover .pli-actions, .pli:focus-within .pli-actions { opacity: 1; }
.pli-actions .icon-btn:disabled { opacity: .3; }
.new-badge {
  display: inline-flex; align-items: center; height: 18px; padding: 0 7px; margin-right: 8px; border-radius: var(--r-full); vertical-align: 1px;
  font: 700 10.5px/1 var(--font); letter-spacing: .02em; color: var(--accent-fg); background: var(--accent); flex-shrink: 0;
}
.src-tag { flex-shrink: 0; padding: 1px 6px; border-radius: 5px; font: 600 10.5px/1.4 var(--font); letter-spacing: .02em; color: var(--muted); box-shadow: inset 0 0 0 1px var(--border-strong); }

/* =============================================================================
   Torrents
   ========================================================================== */
.panel.disk { gap: 12px; margin-bottom: 16px; }
.disk-top { display: flex; align-items: center; gap: 10px; font-weight: 550; font-variant-numeric: tabular-nums; }
.disk-ic { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 9px; background: var(--surface-3); color: var(--fg); }
.disk-ic .ic { width: 17px; height: 17px; }
.meter { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--fg); border-radius: inherit; transition: width .4s var(--ease); }
.meter i.warn { background: var(--warn); }
.meter i.ok { background: var(--ok); }
.meter.thin { height: 3px; margin-top: 12px; }
.meter.thin i { background: var(--accent); }
.meter.thin i.ok { background: var(--ok); }
.bt-list { display: flex; flex-direction: column; gap: 10px; }
.bt { padding: 14px 16px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); transition: border-color var(--dur-1) var(--ease); }
.bt.playing { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.bt-head { display: flex; gap: 12px; align-items: center; }
.bt-ic { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex-shrink: 0; border-radius: 10px; background: var(--surface-3); color: var(--muted); }
.bt-ic.done { color: var(--ok-fg); }
.bt-main { flex: 1; min-width: 0; }
.bt-name { font-weight: 600; font-size: 14.5px; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bt-info { display: flex; flex-wrap: wrap; gap: 2px 16px; margin-top: 3px; font-size: 12.5px; color: var(--muted); }
.bt-info > span { display: inline-flex; align-items: center; gap: 5px; }
.bt-info .ic { width: 13px; height: 13px; }
.now-tag { color: var(--accent); font-weight: 600; }
.bt-actions { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }
.bt-details { margin-top: 10px; }
.bt-details summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; list-style: none; color: var(--muted); font-size: 13px; user-select: none; padding: 4px 8px 4px 4px; border-radius: 8px; }
.bt-details summary::-webkit-details-marker { display: none; }
.bt-details summary:hover { color: var(--fg); background: var(--surface-3); }
.bt-chev { width: 15px; height: 15px; transition: transform var(--dur-2) var(--ease); transform: rotate(-90deg); }
.bt-details[open] .bt-chev { transform: none; }
.bt-files { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; max-height: 360px; overflow-y: auto; }
.btf { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto auto 30px; gap: 12px; align-items: center; min-height: 38px; padding: 4px 6px 4px 8px; border-radius: 8px; font-size: 13px; }
.btf:hover { background: var(--surface-3); }
.btf-ic { width: 16px; height: 16px; color: var(--dim); }
.btf-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btf-size, .btf-pct { color: var(--muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* =============================================================================
   Bottom tab bar (iPad portrait / phones)
   ========================================================================== */
.bottom-tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: none;
  grid-template-columns: repeat(5, 1fr); align-items: stretch; height: calc(60px + env(safe-area-inset-bottom));
  padding: 0 max(8px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(8px, env(safe-area-inset-left));
  background: var(--header-bg); border-top: 1px solid var(--border);
  -webkit-backdrop-filter: saturate(1.8) blur(18px); backdrop-filter: saturate(1.8) blur(18px);
}
.bottom-tabs > a, .bottom-tabs > button {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 44px;
  color: var(--dim); text-decoration: none; font: 550 10.5px/1 var(--font); letter-spacing: 0; -webkit-tap-highlight-color: transparent;
  transition: color var(--dur-1) var(--ease);
}
.bottom-tabs .ic { width: 23px; height: 23px; }
.bottom-tabs > [aria-selected="true"] { color: var(--fg); }
.bottom-tabs > a.live::after { content: ""; position: absolute; top: 8px; left: calc(50% + 9px); width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--bg); }

/* =============================================================================
   Toasts (sonner-style)
   ========================================================================== */
.toasts {
  position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 1000;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; width: min(380px, calc(100vw - 32px));
}
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 12px 12px 12px 14px;
  border-radius: var(--r-md); background: var(--popover); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  color: var(--fg); font-size: 13.5px; line-height: 1.4; overflow-wrap: anywhere;
  animation: toast-in var(--dur-3) var(--ease-out); transition: opacity var(--dur-2) var(--ease), transform var(--dur-2) var(--ease);
}
.toast-ic { width: 17px; height: 17px; margin-top: 1px; color: var(--muted); }
.toast.ok .toast-ic { color: var(--ok); }
.toast.err .toast-ic { color: var(--danger); }
.toast-text { flex: 1; min-width: 0; }
.toast-x { display: inline-flex; width: 22px; height: 22px; align-items: center; justify-content: center; border-radius: 6px; color: var(--dim); opacity: 0; transition: opacity var(--dur-1) var(--ease); }
.toast-x .ic { width: 14px; height: 14px; }
.toast:hover .toast-x, .toast-x:focus-visible { opacity: 1; }
.toast-x:hover { background: var(--surface-3); color: var(--fg); }
.toast.out { opacity: 0; transform: translateY(8px) scale(.98); }

.drop-zone {
  position: fixed; inset: 0; z-index: 900; display: flex; align-items: center; justify-content: center; pointer-events: none;
  background: rgba(9, 9, 11, .6); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); animation: fade-in var(--dur-2) var(--ease-out);
}
.drop-card {
  display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 40px 48px; border-radius: var(--r-xl);
  border: 2px dashed rgba(255, 255, 255, .35); color: #fff; font: 600 17px/1.3 var(--font); background: rgba(255, 255, 255, .06);
}
.drop-card .ic { width: 32px; height: 32px; }

/* =============================================================================
   Motion
   ========================================================================== */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes slide-down { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes cmdk-in { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: none; } }
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes eq { 0%, 100% { height: 30%; } 50% { height: 100%; } }
@keyframes osd { 0% { opacity: 0; transform: translate(-50%, 6px); } 10%, 75% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, 0); } }

/* =============================================================================
   Touch: 44px targets, actions always visible
   ========================================================================== */
@media (hover: none), (pointer: coarse) {
  .pli-actions { opacity: 1; }
  .cw-x { opacity: 1; }
  .pl-play { opacity: 1; transform: none; }
  .toast-x { opacity: 1; }
}
@media (pointer: coarse) {
  .icon-btn, .icon-btn.sm, .tb-btn, .ctl, .ctl select, .chip-btn { min-height: 44px; }
  .icon-btn, .icon-btn.sm { min-width: 44px; }
  .btn, .primary, .secondary, .ghost { min-height: 44px; }
  .seg > a, .seg > button { height: 38px; }
  .chip { height: 38px; }
  .pop-item { min-height: 44px; }
  .cmdk-item { min-height: 48px; }
  .search-trigger { height: 40px; }
  .pick-row { min-height: 56px; }
  input, select { height: 44px; }
  .btf { min-height: 44px; }
  .pli-hover-play { display: none; }
}

/* =============================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1280px) {
  .tb-label { display: none; }
  .tb-btn { padding: 0 10px; }
  .player-layout.with-queue { grid-template-columns: minmax(0, 1fr) 320px; }
  .q-thumb { width: 96px; }
}
@media (max-width: 1100px) {
  .player-layout.with-queue { grid-template-columns: minmax(0, 1fr); }
  .queue { position: static; max-height: 460px; }
  .panels3 { grid-template-columns: minmax(0, 1fr); }
  .search-trigger { width: 220px; }
  .hdr-stats { display: none; }
}
@media (max-width: 820px) {
  :root { --gutter: 16px; --tabbar-h: calc(60px + env(safe-area-inset-bottom)); }
  .bottom-tabs { display: grid; }
  .nav-seg, .top-right { display: none; }
  .search-trigger { width: 40px; height: 40px; padding: 0; justify-content: center; border-radius: 12px; background: transparent; border-color: transparent; color: var(--fg); }
  .search-trigger .ic { width: 20px; height: 20px; }
  .st-text, .search-trigger .kbd { display: none; }
  main { padding-top: 14px; }
  .stage { max-height: none; min-height: 0; }
  .stage-wrap { border-radius: var(--r-md); }
  .now { flex-direction: column; gap: 10px; }
  .now-title { font-size: 20px; }
  .bt-stats { justify-content: flex-start; }
  .toolbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: calc(var(--gutter) * -1); padding-right: var(--gutter); }
  .toolbar::-webkit-scrollbar { display: none; }
  .toolbar > * { flex-shrink: 0; }
  .tb-spacer { display: none; }
  .cat-hero { border-radius: var(--r-lg); min-height: 0; }
  .hero-content { flex-direction: column; align-items: flex-start; gap: 16px; padding: 22px; padding-top: 120px; }
  .hero-poster { display: none; }
  .hero-desc { -webkit-line-clamp: 2; font-size: 14px; }
  .cat-head { flex-direction: column; align-items: stretch; }
  .search-field { width: 100%; }
  .poster-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 20px 12px; }
  .pl-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 22px 14px; }
  .pld-head { flex-direction: column; align-items: flex-start; }
  .pld-cover { width: min(320px, 100%); }
  .pli { grid-template-columns: 24px 120px minmax(0, 1fr); gap: 10px; padding-right: 6px; }
  .pli-thumb { width: 120px; }
  .pli-actions { grid-column: 3; justify-content: flex-start; margin-left: -6px; }
  .page-title { font-size: 26px; }
  .cw-row { grid-auto-columns: 240px; gap: 14px; }
  .toasts { left: 50%; right: auto; bottom: calc(var(--tabbar-h) + 12px); transform: translateX(-50%); align-items: center; }

  /* dialogs become bottom sheets */
  dialog.modal.sheet {
    width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 20px 20px 0 0; border-bottom: 0;
    max-height: calc(100dvh - 16px - env(safe-area-inset-top));
  }
  dialog.modal.sheet[open] { animation: sheet-in var(--dur-3) var(--ease-out); }
  dialog.modal.sheet .modal-body { max-height: calc(100dvh - 16px - env(safe-area-inset-top)); padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  dialog.modal.wide.sheet { height: calc(100dvh - 16px - env(safe-area-inset-top)); }
  dialog.modal.wide.sheet .modal-body { height: 100%; }
  dialog.modal.sheet::before { content: ""; position: absolute; left: 50%; top: 8px; z-index: 4; width: 36px; height: 4px; margin-left: -18px; border-radius: 4px; background: var(--border-strong); }
  dialog.modal.wide.sheet::before { background: rgba(255, 255, 255, .35); }
  dialog.cmdk { margin: 0 auto auto; width: 100vw; max-width: 100vw; max-height: 100dvh; border-radius: 0 0 20px 20px; border-top: 0; padding-top: env(safe-area-inset-top); }
  .cmdk-list { max-height: calc(100dvh - 120px); }
  .cmdk-foot { display: none; }
  .rm-hero { padding: 28px 20px 22px; }
  .rm-head { gap: 16px; }
  .rm-poster { width: 96px; }
  .rm-info { padding-right: 44px; }
  .rm-content { padding: 16px 20px calc(24px + env(safe-area-inset-bottom)); }
  .rm-filters .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: -20px; padding-right: 20px; }
  .rm-filters .chips::-webkit-scrollbar { display: none; }
  .rel { grid-template-columns: 50px minmax(0, 1fr); row-gap: 10px; }
  .rel-stats { grid-column: 2; flex-direction: row; gap: 14px; align-items: center; }
  .rel-actions { grid-column: 1 / -1; }
  .rel-actions .primary { flex: 1; }
  .ed-grid { grid-template-columns: minmax(0, 1fr); }
  .ed-preview { max-width: 240px; }
}
@media (max-width: 640px) {
  .hide-sm { display: none; }
  .brand-name { font-size: 15px; }
  .hero-h { font-size: 28px; }
  .hero-actions .lg { height: 44px; padding: 0 18px; flex: 1; }
  .cat-hero .hero-actions { width: 100%; }
  .poster-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pl-grid { grid-template-columns: minmax(0, 1fr); }
  .pli { grid-template-columns: 96px minmax(0, 1fr); }
  .pli-num { display: none; }
  .pli-thumb { width: 96px; }
  .pli-actions { grid-column: 2; }
  .add-row { flex-wrap: wrap; }
  .add-row .field-icon { flex-basis: 100%; }
  .add-row > button { flex: 1; }
  .btf { grid-template-columns: 16px minmax(0, 1fr) auto 36px; }
  .btf-pct { display: none; }
  .bt-info > span:nth-child(n + 3):not(.now-tag) { display: none; }
  .page-head { align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
