/* Torrent Stream: cinematic dark glass.
   Smoky translucent panels over a blurred ambient backdrop, white pill
   primary actions, blue accent (play, progress, active nav). */
:root {
  --bg: #0e0f13;
  --glass: rgba(30, 31, 38, .58);
  --glass-strong: rgba(24, 25, 31, .82);
  --glass-soft: rgba(255, 255, 255, .06);
  --glass-hover: rgba(255, 255, 255, .1);
  --line: rgba(255, 255, 255, .09);
  --line-strong: rgba(255, 255, 255, .16);
  --text: #f4f4f6;
  --text-2: rgba(240, 240, 245, .82);
  --muted: rgba(235, 235, 245, .58);
  --faint: rgba(235, 235, 245, .38);
  --accent: #3b82f6;
  --accent-hover: #2f73e8;
  --accent-soft: rgba(59, 130, 246, .16);
  --accent-glow: 0 6px 24px rgba(59, 130, 246, .38);
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, .14);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, .14);
  --bad: #f87171;
  --bad-soft: rgba(248, 113, 113, .14);
  --radius: 20px;
  --radius-md: 14px;
  --radius-sm: 11px;
  --blur: saturate(1.4) blur(22px);
  --shadow: 0 10px 40px rgba(0, 0, 0, .35);
  --font: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  --sidebar: 236px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; color-scheme: dark; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
body { min-height: 100vh; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.015em; }
h1 { font-size: 28px; font-weight: 700; }
h2 { font-size: 19px; font-weight: 650; }
h3 { font-size: 12.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
a { color: var(--accent); text-decoration: none; }
code { font: 12.5px var(--mono); background: var(--glass-soft); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; }
.muted { color: var(--muted); font-weight: 500; }
.center { text-align: center; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- ambient backdrop (blurred art of the featured title) ---------- */
.ambient { position: fixed; inset: 0; z-index: -1; overflow: hidden; background:
  radial-gradient(1200px 700px at 12% -10%, rgba(132, 120, 108, .30), transparent 60%),
  radial-gradient(900px 600px at 95% 10%, rgba(59, 130, 246, .16), transparent 60%),
  radial-gradient(1000px 700px at 60% 110%, rgba(110, 96, 140, .22), transparent 60%),
  var(--bg); }
.ambient-img { position: absolute; inset: -80px; background-size: cover; background-position: center; filter: blur(70px) saturate(1.2) brightness(.55); opacity: 0; transition: opacity 1.2s ease; transform: scale(1.1); }
.ambient-img.on { opacity: .75; }
.ambient::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(14, 15, 19, .25), rgba(14, 15, 19, .78)); }

/* ---------- glass primitives ---------- */
.glass { background: var(--glass); border: 1px solid var(--line); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: var(--shadow); }
.glass-soft { background: var(--glass-soft); border: 1px solid var(--line); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 18px;
  border-radius: 999px; border: 1px solid transparent; font: 600 14px var(--font); cursor: pointer; white-space: nowrap;
  text-decoration: none; transition: background .15s, border-color .15s, box-shadow .15s, transform .1s, color .15s; color: var(--text); background: transparent;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; }
.btn .i { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); color: #fff; box-shadow: var(--accent-glow); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.white { background: #fff; color: #0e0f13; box-shadow: 0 6px 24px rgba(0, 0, 0, .3); }
.btn.white:hover { background: #e9e9ee; }
.btn.white .i { width: 15px; height: 15px; }
.btn.glass-btn { background: var(--glass-soft); border-color: var(--line-strong); }
.btn.glass-btn:hover { background: var(--glass-hover); }
.btn.small { min-height: 34px; padding: 0 14px; font-size: 13px; gap: 6px; }
.btn.block { width: 100%; }
.btn.lg { min-height: 48px; font-size: 15px; }
.btn.square { width: 38px; min-height: 38px; padding: 0; border-radius: 11px; background: var(--glass-soft); border-color: var(--line); }
.btn.square:hover { background: var(--glass-hover); }
.btn.square.on { background: var(--accent-soft); border-color: rgba(59, 130, 246, .5); color: #93c5fd; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading .i { opacity: 0; }
.btn.loading::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: spin .7s linear infinite; }
.btn.white.loading::after { border-color: rgba(0, 0, 0, .2); border-top-color: #000; }
.circle-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, .55); background: rgba(255, 255, 255, .06); color: #fff; cursor: pointer; transition: background .15s; }
.circle-btn:hover { background: rgba(255, 255, 255, .16); }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer; transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--glass-hover); color: var(--text); }

/* ---------- inputs ---------- */
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select {
  min-height: 44px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: rgba(0, 0, 0, .25); color: var(--text); font: 15px var(--font); width: 100%; transition: border-color .15s, box-shadow .15s, background .15s;
}
input::placeholder { color: var(--faint); }
input:hover, select:hover { border-color: rgba(255, 255, 255, .24); }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59, 130, 246, .25); background: rgba(0, 0, 0, .35); }
input[type=search]::-webkit-search-cancel-button { filter: invert(1); opacity: .5; }
.btn:focus-visible, .icon-btn:focus-visible, .circle-btn:focus-visible, .ctl:focus-visible, .seek:focus-visible, .nav a:focus-visible, .tile:focus-visible, .chips button:focus-visible, .seg button:focus-visible, .poster:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
input[type=checkbox] { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .lead { position: absolute; left: 14px; color: var(--faint); pointer-events: none; width: 17px; height: 17px; }
.input-wrap input { padding-left: 42px; }
.input-wrap:has(.reveal) input { padding-right: 46px; }
.reveal { position: absolute; right: 5px; width: 36px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; }
.reveal:hover { background: var(--glass-hover); color: var(--text); }
.field { display: grid; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.field .unit { font-weight: 400; color: var(--faint); font-size: 12.5px; margin-top: -4px; }
.check { display: inline-flex; gap: 10px; align-items: center; font-size: 14px; color: var(--text-2); cursor: pointer; user-select: none; }
.error { color: var(--bad); font-size: 13.5px; margin: 0; }
.error:empty { display: none; }
.hint { color: var(--muted); font-size: 13px; margin: 0; }
.stack { display: grid; gap: 14px; }

/* ---------- auth ---------- */
.auth-view { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(410px, 100%); border-radius: 26px; padding: 40px 34px 34px; display: grid; justify-items: center; text-align: center; }
.auth-card h1 { margin-top: 22px; font-size: 26px; }
.auth-sub { color: var(--muted); margin: 8px 0 26px; font-size: 14.5px; }
.auth-form { width: 100%; display: grid; gap: 16px; text-align: left; }
.auth-blocked { text-align: left; display: grid; gap: 10px; color: var(--text-2); background: var(--warn-soft); border: 1px solid rgba(251, 191, 36, .3); border-radius: var(--radius-sm); padding: 14px 16px; font-size: 14px; }
.auth-blocked p { margin: 0; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); gap: 18px; padding: 18px; min-height: 100vh; max-width: 1680px; margin: 0 auto; }
.sidebar { position: sticky; top: 18px; height: calc(100vh - 36px); border-radius: 24px; padding: 22px 14px 16px; display: flex; flex-direction: column; gap: 26px; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 10px; color: var(--text); font-size: 18px; font-weight: 600; letter-spacing: -.02em; }
.brand-name b { color: #60a5fa; font-weight: 700; }
.logo-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(140deg, #60a5fa, #2563eb); color: #fff; box-shadow: 0 4px 16px rgba(59, 130, 246, .45); flex: none; }
.logo-mark .i { width: 15px; height: 15px; margin-left: 2px; }
.logo-mark.lg { width: 60px; height: 60px; border-radius: 18px; }
.logo-mark.lg .i { width: 24px; height: 24px; margin-left: 3px; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav a { display: flex; align-items: center; gap: 13px; padding: 11px 14px; border-radius: 13px; color: var(--text-2); font-weight: 550; font-size: 15px; transition: background .15s, color .15s; }
.nav a:hover { background: var(--glass-hover); color: var(--text); }
.nav a.on { background: var(--accent); color: #fff; box-shadow: var(--accent-glow); }
.nav a .i { width: 20px; height: 20px; }
.nav .count { margin-left: auto; font-style: normal; font-size: 12px; font-weight: 700; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; display: inline-grid; place-items: center; background: rgba(255, 255, 255, .14); }
.nav a.on .count { background: rgba(255, 255, 255, .25); }
.nav-settings { margin-top: auto; }
.side-status { display: grid; gap: 8px; padding: 14px; border-radius: 16px; background: rgba(0, 0, 0, .22); border: 1px solid var(--line); font-size: 12.5px; }
.ss-row { display: flex; align-items: center; gap: 9px; color: var(--muted); }
.ss-row .i { width: 14px; height: 14px; }
.ss-row b { margin-left: auto; color: var(--text-2); font-weight: 600; font-variant-numeric: tabular-nums; }

.main { min-width: 0; display: flex; flex-direction: column; gap: 18px; padding-bottom: 24px; }
.topbar { display: flex; align-items: center; gap: 12px; }
.search { flex: 1; max-width: 460px; display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 16px; border-radius: 999px; color: var(--muted); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); background: rgba(40, 41, 48, .5); }
.search input { border: 0; background: transparent; min-height: 0; height: 100%; padding: 0; box-shadow: none; }
.search input:focus, .search input:hover { background: transparent; box-shadow: none; }
.search:focus-within { border-color: var(--accent); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 999px; font-size: 12.5px; font-weight: 650; white-space: nowrap; }
.pill .i { width: 14px; height: 14px; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border: 1px solid rgba(251, 191, 36, .3); }
.pill.ok { background: var(--ok-soft); color: var(--ok); border: 1px solid rgba(52, 211, 153, .3); }

.banner { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--radius-md); background: var(--glass); border: 1px solid var(--line); color: var(--text-2); font-size: 14px; backdrop-filter: var(--blur); }
.banner.warn { background: var(--warn-soft); border-color: rgba(251, 191, 36, .3); color: var(--warn); }
.dot-spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; }

.view { display: grid; gap: 28px; animation: fade .25s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-sub { color: var(--muted); margin: 6px 0 0; font-size: 14.5px; max-width: 640px; }

/* ---------- hero ---------- */
.hero { position: relative; border-radius: 26px; overflow: hidden; min-height: 420px; display: flex; align-items: flex-end; border: 1px solid var(--line); background: #15161b; box-shadow: var(--shadow); }
.hero-bg { position: absolute; inset: 0; background-size: cover; background-position: center 30%; }
.hero-bg.placeholder { background: radial-gradient(800px 400px at 80% 20%, rgba(59, 130, 246, .35), transparent 60%), radial-gradient(600px 400px at 10% 90%, rgba(168, 85, 247, .25), transparent 60%), linear-gradient(135deg, #1c1d24, #101116); }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(10, 11, 14, .92) 0%, rgba(10, 11, 14, .62) 42%, rgba(10, 11, 14, .08) 78%), linear-gradient(0deg, rgba(10, 11, 14, .7), transparent 50%); }
.hero-body { position: relative; z-index: 1; padding: 44px 46px; max-width: 660px; display: grid; gap: 14px; }
.hero-chip { justify-self: start; display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 14px; border-radius: 999px; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .18); backdrop-filter: blur(10px); font-size: 13px; font-weight: 600; }
.hero-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: #60a5fa; box-shadow: 0 0 10px #60a5fa; }
.hero h1 { font-size: clamp(28px, 4vw, 46px); font-weight: 750; letter-spacing: -.025em; text-shadow: 0 2px 20px rgba(0, 0, 0, .4); overflow-wrap: anywhere; }
.hero-meta { font-size: 15px; font-weight: 600; color: var(--text-2); white-space: pre-wrap; }
.hero-desc { color: var(--text-2); font-size: 14.5px; margin: 0; max-width: 520px; }
.hero-progress { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); max-width: 440px; }
.hero-progress .bar { flex: 1; }
.hero-actions { display: flex; align-items: center; gap: 12px; margin-top: 6px; flex-wrap: wrap; }
.hero-actions .btn.white { min-height: 46px; padding: 0 24px; font-size: 15px; }

/* ---------- rows & tiles ---------- */
.row { display: grid; gap: 14px; }
.row-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.see-all { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 14px; font-weight: 600; }
.see-all:hover { color: var(--text); }
.see-all .i { width: 15px; height: 15px; }
.rail { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 16px; overflow-x: auto; padding: 4px 2px 14px; scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .15) transparent; }
.rail.few { grid-auto-columns: minmax(240px, 300px); }
.rail > * { scroll-snap-align: start; }
.tile { display: grid; gap: 9px; color: var(--text); cursor: pointer; border: 0; background: none; padding: 0; text-align: left; font: inherit; min-width: 0; align-content: start; }
.tile-art { position: relative; aspect-ratio: 16 / 10; border-radius: 16px; overflow: hidden; background: #1b1c22; border: 1px solid var(--line); box-shadow: 0 6px 22px rgba(0, 0, 0, .3); transition: transform .2s, box-shadow .2s, border-color .2s; }
.tile:hover .tile-art { transform: translateY(-3px); box-shadow: 0 14px 32px rgba(0, 0, 0, .45); border-color: var(--line-strong); }
.tile-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); background: linear-gradient(135deg, #24252e, #15161b); }
.ph .i { width: 32px; height: 32px; stroke-width: 1.4; }
.ph .ph-title { position: absolute; left: 12px; right: 12px; bottom: 10px; font-size: 13px; font-weight: 700; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-art .play-hover { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .35); opacity: 0; transition: opacity .2s; }
.tile:hover .play-hover, .tile:focus-visible .play-hover { opacity: 1; }
.play-hover span { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: rgba(255, 255, 255, .92); color: #0e0f13; box-shadow: 0 6px 20px rgba(0, 0, 0, .4); }
.play-hover .i { width: 20px; height: 20px; margin-left: 3px; }
.tile-badge { position: absolute; top: 10px; left: 10px; backdrop-filter: blur(8px); background: rgba(0, 0, 0, .5) !important; }
.tile-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255, 255, 255, .15); }
.tile-bar i { display: block; height: 100%; background: var(--accent); }
.tile-title { font-weight: 650; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-sub { color: var(--muted); font-size: 12.5px; margin-top: -6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.genre-strip { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0 6px; }
.genre-strip::-webkit-scrollbar { display: none; }
.genre-pill { flex: none; height: 36px; display: inline-flex; align-items: center; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--glass); color: var(--text-2); font: 600 13.5px var(--font); text-decoration: none; white-space: nowrap; }
.genre-pill:hover { background: var(--glass-hover); color: var(--text); }
.genre-pill:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.genre-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.genre-bar h1 { margin: 0; }
.genre-bar .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.genre-select { width: auto; min-width: 190px; min-height: 40px; height: 40px; border-radius: 999px; padding: 0 36px 0 16px; background-color: var(--glass); font-weight: 600; cursor: pointer; }

/* ---------- badges & bars ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 8px; font-size: 12px; font-weight: 650; white-space: nowrap; background: rgba(255, 255, 255, .1); color: var(--text-2); flex: none; }
.badge:empty { display: none; }
.badge.ok { color: var(--ok); background: var(--ok-soft); }
.badge.active { color: #93c5fd; background: var(--accent-soft); }
.badge.warn { color: var(--warn); background: var(--warn-soft); }
.badge.bad { color: var(--bad); background: var(--bad-soft); }
.bar { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width .6s ease; }
.bar.done i { background: #22c55e; }
.bar.warn i { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.bar.paused i { background: rgba(255, 255, 255, .35); }
.bar.live i { background-image: repeating-linear-gradient(-45deg, rgba(255, 255, 255, .22) 0 8px, transparent 8px 16px), linear-gradient(90deg, #2563eb, #60a5fa); background-size: 22px 22px, 100% 100%; animation: stripes 1s linear infinite; }
@keyframes stripes { to { background-position: 22px 0, 0 0; } }

/* ---------- downloads ---------- */
.seg { display: inline-flex; padding: 4px; gap: 2px; border-radius: 14px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: var(--blur); flex-wrap: wrap; }
.seg button { border: 0; background: transparent; color: var(--muted); font: 600 13.5px var(--font); height: 34px; padding: 0 14px; border-radius: 10px; cursor: pointer; }
.seg button:hover { color: var(--text); }
.seg button.on { background: rgba(255, 255, 255, .12); color: var(--text); }
.dl-list { display: grid; gap: 14px; }
.dl { border-radius: var(--radius); padding: 14px; background: var(--glass-strong); border: 1px solid var(--line); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: 0 6px 26px rgba(0, 0, 0, .28); transition: border-color .3s, box-shadow .3s; }
.dl.flash { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(59, 130, 246, .2); }
.dl-main { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 16px; }
.poster { position: relative; width: 96px; aspect-ratio: 2 / 3; border-radius: 12px; overflow: hidden; background: #1c1d24; border: 1px solid var(--line); cursor: pointer; padding: 0; align-self: start; }
.poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dl-info { min-width: 0; display: grid; gap: 7px; align-content: start; padding-top: 2px; }
.dl-title { text-transform: none; color: var(--text); font-size: 16.5px; font-weight: 700; letter-spacing: -.01em; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-tags { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.dl-spec { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.dl-line { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; font-variant-numeric: tabular-nums; }
.dl-line b { font-weight: 650; color: var(--text); }
.dl-line .right { color: var(--muted); text-align: right; }
.dl-line .right.ok { color: var(--ok); }
.dl-stats { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.dl-stats .live { color: #93c5fd; font-weight: 600; }
.dl-error { color: var(--bad); font-size: 13px; padding: 8px 12px; background: var(--bad-soft); border-radius: 10px; }
.dl-error.soft { color: var(--warn); background: var(--warn-soft); }
.dl-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.dl-note { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
.dl-note .i { width: 16px; height: 16px; }
.dl-note.ok { color: var(--ok); }
.dl-note.live { color: #93c5fd; }
.dl-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.files { margin-top: 12px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: rgba(0, 0, 0, .2); }
.file-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; padding: 11px 14px; border-top: 1px solid var(--line); align-items: center; }
.file-row:first-child { border-top: 0; }
.file-row:hover { background: rgba(255, 255, 255, .03); }
.file-row > .i { color: var(--faint); }
.file-row.primary > .i { color: #93c5fd; }
.file-name { font-size: 14px; font-weight: 550; overflow-wrap: anywhere; }
.file-sub { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.file-sub .resume { color: #93c5fd; font-weight: 600; }
.file-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; }
.keep { display: inline-flex; gap: 7px; align-items: center; font-size: 13px; color: var(--text-2); cursor: pointer; white-space: nowrap; padding: 0 6px; user-select: none; }
.files-note { color: var(--muted); font-size: 12.5px; padding: 10px 14px; border-top: 1px solid var(--line); }
.files-note:first-child { border-top: 0; }

.empty { border-radius: var(--radius); text-align: center; padding: 48px 24px; display: grid; justify-items: center; gap: 10px; }
.empty-icon { display: grid; place-items: center; width: 66px; height: 66px; border-radius: 20px; background: var(--glass-soft); border: 1px solid var(--line); color: var(--muted); margin-bottom: 6px; }
.empty-icon .i { width: 30px; height: 30px; stroke-width: 1.5; }
.empty p { color: var(--muted); margin: 0; max-width: 440px; }
.empty-actions { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; justify-content: center; }

/* ---------- menu ---------- */
.menu { position: fixed; z-index: 60; min-width: 230px; padding: 6px; border-radius: 16px; background: rgba(28, 29, 36, .94); display: grid; gap: 2px; animation: pop .14s ease-out; }
.menu button, .menu a { display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--text); font: 500 14px var(--font); cursor: pointer; text-align: left; }
.menu button:hover, .menu a:hover, .menu button:focus-visible { background: var(--glass-hover); outline: none; }
.menu .i { width: 17px; height: 17px; color: var(--muted); }
.menu .danger, .menu .danger .i { color: var(--bad); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 6px; }
@keyframes pop { from { opacity: 0; transform: translateY(4px) scale(.98); } }

/* ---------- browse ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips button { height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--glass); backdrop-filter: var(--blur); color: var(--text-2); font: 600 13.5px var(--font); cursor: pointer; }
.chips button:hover { background: var(--glass-hover); color: var(--text); }
.chips button.on { background: #fff; color: #0e0f13; border-color: #fff; }
.browse-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 22px 18px; }
.film { display: grid; gap: 10px; align-content: start; }
.film .tile-art { aspect-ratio: 4 / 3; }
.film-meta { color: var(--muted); font-size: 12.5px; margin-top: -6px; }
.film-desc { color: var(--muted); font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 0; }
.film .btn { justify-self: start; }
.skeleton { border-radius: 16px; aspect-ratio: 4 / 3; background: linear-gradient(90deg, rgba(255, 255, 255, .04), rgba(255, 255, 255, .09), rgba(255, 255, 255, .04)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- settings ---------- */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.settings-grid > :first-child { grid-row: span 2; }
.card { border-radius: var(--radius); padding: 22px 24px 24px; display: grid; gap: 16px; }
.card h3:not(:first-child) { margin-top: 8px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.auth-status { display: flex; gap: 12px; align-items: flex-start; padding: 13px 15px; border-radius: 14px; background: rgba(0, 0, 0, .2); border: 1px solid var(--line); font-size: 14px; color: var(--text-2); }
.auth-status .i { margin-top: 2px; }
.auth-status.warn { background: var(--warn-soft); border-color: rgba(251, 191, 36, .3); }
.auth-status.warn .i { color: var(--warn); }
.auth-status.ok .i { color: var(--ok); }
.auth-status b { color: var(--text); }
.auth-status p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.lan { display: grid; gap: 8px; }
.lan-urls { display: grid; gap: 6px; }
.lan-url { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border-radius: 12px; background: rgba(0, 0, 0, .25); border: 1px solid var(--line); font: 14px var(--mono); }
.lan-url span { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.server-info { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 9px 18px; font-size: 14px; }
.server-info dt { color: var(--muted); }
.server-info dd { margin: 0; color: var(--text-2); font-weight: 600; }
.install { display: grid; gap: 10px; justify-items: start; padding-top: 14px; border-top: 1px solid var(--line); }

/* ---------- dialog ---------- */
.dialog { color: var(--text); border-radius: 24px; padding: 0; width: min(520px, calc(100% - 24px)); background: rgba(26, 27, 34, .9); }
.dialog[open] { animation: pop .16s ease-out; }
.dialog::backdrop { background: rgba(5, 6, 9, .55); backdrop-filter: blur(4px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 20px 6px 26px; }
.dialog-body { padding: 14px 26px 6px; display: grid; gap: 14px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 26px 24px; }
.drop { position: relative; display: grid; justify-items: center; gap: 8px; padding: 26px 16px; border-radius: 16px; border: 1.5px dashed var(--line-strong); background: rgba(0, 0, 0, .18); color: var(--muted); text-align: center; cursor: pointer; transition: border-color .15s, background .15s; font-size: 14px; }
.drop:hover, .drop.drag { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.drop.has-file { border-style: solid; border-color: var(--accent); color: var(--text); }
.drop b { color: var(--text); }
.drop .i { width: 24px; height: 24px; }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------- player ---------- */
.player-view { display: grid; gap: 14px; }
.player { position: relative; background: #000; width: 100%; aspect-ratio: 16 / 9; max-height: calc(100vh - 110px); overflow: hidden; user-select: none; -webkit-user-select: none; border-radius: 22px; border: 1px solid var(--line); box-shadow: 0 20px 60px rgba(0, 0, 0, .55); color: #fff; }
.player:fullscreen { max-height: none; height: 100%; aspect-ratio: auto; border-radius: 0; border: 0; }
.player video { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; }
.player video::cue { background: rgba(0, 0, 0, .72); font-size: 1.05em; }
.player-top, .controls { position: absolute; left: 0; right: 0; transition: opacity .25s; z-index: 2; }
.player-top { top: 0; display: flex; gap: 12px; align-items: center; padding: 14px 16px; background: linear-gradient(rgba(0, 0, 0, .72), transparent); }
.player-title { color: #fff; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; font-size: 16px; text-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
.controls { bottom: 0; padding: 40px 16px max(12px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0, 0, 0, .85)); }
.player.idle .player-top, .player.idle .controls { opacity: 0; pointer-events: none; }
.player.idle { cursor: none; }
.player .badge { background: rgba(0, 0, 0, .55); color: #fff; backdrop-filter: blur(6px); border: 1px solid rgba(255, 255, 255, .18); }
.player .badge.ok { color: #6ee7b7; }
.player .badge.active { color: #93c5fd; }
.player .badge.warn { color: #fcd34d; }
.seek { position: relative; height: 20px; display: flex; align-items: center; cursor: pointer; touch-action: none; }
.seek-track { position: relative; width: 100%; height: 4px; border-radius: 999px; background: rgba(255, 255, 255, .22); overflow: hidden; transition: height .12s; }
.seek:hover .seek-track, .seek.dragging .seek-track { height: 6px; }
.seek-buffered { position: absolute; inset: 0; }
.seek-buffered span { position: absolute; top: 0; bottom: 0; background: rgba(255, 255, 255, .38); }
.seek-played { position: absolute; top: 0; bottom: 0; left: 0; width: 0; background: var(--accent); }
.seek-thumb { position: absolute; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: #fff; left: 0; pointer-events: none; box-shadow: 0 1px 4px rgba(0, 0, 0, .4); transform: scale(0); transition: transform .12s; }
.seek:hover .seek-thumb, .seek.dragging .seek-thumb, .seek:focus-visible .seek-thumb { transform: scale(1); }
.seek-tooltip { position: absolute; bottom: 24px; transform: translateX(-50%); padding: 3px 8px; border-radius: 6px; background: rgba(0, 0, 0, .85); font-size: 12px; pointer-events: none; font-variant-numeric: tabular-nums; }
.controls-row { display: flex; align-items: center; gap: 2px; margin-top: 4px; flex-wrap: nowrap; }
.ctl { position: relative; min-width: 40px; height: 40px; padding: 0 9px; border: 0; border-radius: 11px; gap: 6px; background: transparent; color: #fff; font: 600 14px var(--font); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; }
.ctl:hover { background: rgba(255, 255, 255, .14); }
.ctl .i { width: 20px; height: 20px; }
.ctl input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.ctl .plus { font-size: 13px; margin-left: -4px; }
.ctl-back { background: rgba(255, 255, 255, .12); backdrop-filter: blur(6px); padding: 0 14px 0 10px; border-radius: 999px; }
#btn-play[data-state=paused] .on-playing, #btn-play[data-state=playing] .on-paused { display: none; }
#btn-mute[data-state=on] .on-off, #btn-mute[data-state=off] .on-on { display: none; }
.ctl-select { width: auto; max-width: 170px; min-height: 32px; height: 32px; background: rgba(255, 255, 255, .12); color: #fff; border: 1px solid rgba(255, 255, 255, .18); font-size: 13px; padding: 0 8px; border-radius: 9px; }
.ctl-select option { color: #fff; background: #1b1c22; }
.volume { width: 84px; accent-color: #fff; }
.time { font-size: 13px; padding: 0 8px; font-variant-numeric: tabular-nums; white-space: nowrap; color: rgba(255, 255, 255, .92); }
.spacer { flex: 1; }
.player-stats { color: rgba(255, 255, 255, .75); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; margin-right: 6px; }
.player-overlay { position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; text-align: center; background: rgba(0, 0, 0, .55); pointer-events: none; }
.player-overlay.error { background: rgba(10, 11, 14, .9); }
.overlay-actions { display: flex; gap: 8px; margin-top: 12px; pointer-events: auto; flex-wrap: wrap; justify-content: center; }
.overlay-actions .btn:not(.primary) { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .22); color: #fff; }
.overlay-title { margin: 0; font-size: 17px; font-weight: 650; }
.overlay-detail { margin: 0; color: rgba(255, 255, 255, .75); font-size: 14px; max-width: 560px; }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .2); border-top-color: #fff; animation: spin .9s linear infinite; margin-bottom: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }
.shortcuts { color: var(--muted); font-size: 12.5px; text-align: center; margin: 0; line-height: 2.1; }
kbd { font: 600 11px var(--mono); display: inline-block; min-width: 20px; padding: 1px 6px; margin: 0 1px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px; background: var(--glass-soft); color: var(--text-2); }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 80; background: rgba(250, 250, 252, .96); color: #0e0f13; padding: 12px 20px; border-radius: 14px; max-width: calc(100% - 32px); box-shadow: 0 12px 40px rgba(0, 0, 0, .45); font-size: 14px; font-weight: 600; animation: rise .2s ease-out; }
.toast.bad { background: #ef4444; color: #fff; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- profiles ---------- */
.profile-btn { display: inline-flex; align-items: center; gap: 9px; height: 42px; padding: 0 14px 0 5px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--glass-soft); color: var(--text); font: 600 14px var(--font); cursor: pointer; }
.profile-btn:hover { background: var(--glass-hover); }
.profile-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.avatar { --c: #e0a458; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: linear-gradient(140deg, color-mix(in srgb, var(--c) 82%, #fff), color-mix(in srgb, var(--c) 70%, #000)); color: #17120b; font-weight: 800; font-size: 15px; flex: none; box-shadow: 0 4px 14px color-mix(in srgb, var(--c) 40%, transparent); }
.avatar.xl { width: 128px; height: 128px; border-radius: 30px; font-size: 52px; }
.avatar.add { background: var(--glass-soft); border: 2px dashed var(--line-strong); color: var(--muted); box-shadow: none; }
.avatar.add .i { width: 40px; height: 40px; }
.overlay-screen { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 24px; background: radial-gradient(900px 600px at 20% 0%, rgba(224, 164, 88, .18), transparent 60%), radial-gradient(900px 600px at 90% 100%, rgba(59, 130, 246, .14), transparent 60%), rgba(10, 11, 14, .97); overflow-y: auto; animation: fade .2s ease-out; }
.profile-wrap { display: grid; justify-items: center; gap: 34px; width: min(1000px, 100%); text-align: center; }
.profile-wrap h1 { font-size: clamp(28px, 4vw, 44px); }
.profile-grid { display: flex; flex-wrap: wrap; gap: 26px; justify-content: center; }
.profile-pick { display: grid; justify-items: center; gap: 12px; padding: 10px; border: 0; border-radius: 26px; background: transparent; color: var(--text-2); font: 600 17px var(--font); cursor: pointer; transition: transform .15s; }
.profile-pick:hover, .profile-pick:focus-visible { transform: scale(1.06); color: var(--text); outline: none; }
.profile-pick:focus-visible .avatar { outline: 4px solid #fff; outline-offset: 4px; }
.profile-pick.current .profile-name { color: var(--text); }
.profile-edit { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.profile-edit .i { width: 14px; height: 14px; }
.profile-foot { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
body.picking .shell { visibility: hidden; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { --c: #e0a458; width: 36px; height: 36px; border-radius: 11px; border: 2px solid transparent; background: var(--c); cursor: pointer; }
.swatch.on { border-color: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, .2); }
.swatch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- bring your own media ---------- */
.byo { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 18px 22px; align-items: center; padding: 22px 24px; border-radius: var(--radius); background: linear-gradient(120deg, rgba(224, 164, 88, .16), rgba(30, 31, 38, .6) 45%); border-color: rgba(224, 164, 88, .28); }
.byo-icon { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 16px; background: linear-gradient(140deg, #f2c27b, #c77d2e); color: #1c1308; box-shadow: 0 6px 20px rgba(224, 164, 88, .35); }
.byo-icon .i { width: 26px; height: 26px; }
.byo-text h2 { font-size: 20px; }
.byo-text p { margin: 4px 0 0; color: var(--text-2); font-size: 14.5px; max-width: 560px; }
.byo-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.byo.compact { padding: 14px 18px; }
.byo.compact .byo-icon { width: 42px; height: 42px; border-radius: 13px; }
.byo.compact .byo-text h2 { font-size: 16px; }
.byo.compact .byo-text p { font-size: 13px; }
.home-catalog { display: grid; gap: 28px; }
.home-catalog:empty { display: none; }

/* ---------- grids (large catalogues) ---------- */
.grid-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 22px 18px; }
/* The browser skips layout/paint for off-screen tiles: keeps grids of thousands smooth. */
.grid-tiles > *, .browse-grid > * { content-visibility: auto; contain-intrinsic-size: auto 220px; }
.sentinel { height: 1px; }
.skeleton.short { aspect-ratio: auto; height: 120px; }
.tile-wrap { display: grid; gap: 8px; align-content: start; }
.tile-remove { justify-self: start; }
.see-all.back { margin-bottom: 6px; }
.art-btn { padding: 0; cursor: pointer; display: block; width: 100%; }
.mylist-btn.on { border-color: rgba(52, 211, 153, .4); color: var(--ok); }
.btn.danger { color: var(--bad); }

/* ---------- details ---------- */
.detail { display: grid; grid-template-columns: minmax(200px, 300px) minmax(0, 1fr); gap: 28px; padding: 24px; border-radius: 26px; align-items: start; }
.detail-art { position: relative; aspect-ratio: 2 / 3; border-radius: 18px; overflow: hidden; background: #1b1c22; border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0, 0, 0, .4); }
.detail-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-body { display: grid; gap: 14px; align-content: start; min-width: 0; }
.detail-body h1 { font-size: clamp(26px, 3.4vw, 40px); overflow-wrap: anywhere; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.folder-select { width: auto; min-height: 40px; border-radius: 999px; background: var(--glass-soft); }
.streams { display: grid; gap: 8px; }
.tracks { display: flex; gap: 6px; flex-wrap: wrap; }
.audio-info { display: grid; gap: 8px; }
.compat-note { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--warn-soft); border: 1px solid rgba(251, 191, 36, .28); color: var(--text-2); font-size: 13px; }
.compat-note .i { color: var(--warn); width: 16px; height: 16px; margin-top: 2px; }
.cat-desc { color: var(--text-2); font-size: 14.5px; margin: 0; }
.credit { color: var(--faint); font-size: 12px; margin: 0; }
.episodes { display: grid; gap: 10px; }
.ep { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 14px; border-radius: 16px; background: var(--glass-strong); border: 1px solid var(--line); }
.ep.next { border-color: rgba(59, 130, 246, .5); box-shadow: 0 0 0 3px rgba(59, 130, 246, .12); }
.ep.watched .ep-title { color: var(--text-2); }
.ep-play { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; border: 0; background: #fff; color: #0e0f13; cursor: pointer; }
.ep-play .i { width: 18px; height: 18px; margin-left: 3px; }
.ep-play:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.ep-body { min-width: 0; display: grid; gap: 4px; }
.ep-title { font-weight: 650; font-size: 15px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; overflow-wrap: anywhere; }
.ep-sub { color: var(--muted); font-size: 12.5px; }
.ep-desc { margin: 2px 0 0; color: var(--text-2); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ep .bar { height: 4px; max-width: 320px; }
.ep-actions { display: flex; gap: 6px; }
.season-tabs { margin-bottom: 4px; }

/* ---------- folders ---------- */
.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.folder-card { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 14px; align-items: center; padding: 12px; border-radius: 18px; color: var(--text); transition: transform .15s, border-color .15s; }
.folder-card:hover, .folder-card:focus-visible { transform: translateY(-2px); border-color: var(--line-strong); outline: none; }
.folder-card:focus-visible { box-shadow: 0 0 0 3px var(--accent); }
.folder-card b { display: block; }
.folder-card .muted { font-size: 13px; }
.folder-art { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 14px; overflow: hidden; background: rgba(224, 164, 88, .14); color: #e0a458; }
.folder-art img { width: 100%; height: 100%; object-fit: cover; }
.folder-art .i { width: 28px; height: 28px; }

/* ---------- catalogue / fix dialogs ---------- */
.dialog.wide { width: min(760px, calc(100% - 24px)); }
.cat-body { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 22px; padding: 4px 26px 26px; }
.cat-art { border-radius: 16px; overflow: hidden; background: #1b1c22; aspect-ratio: 3 / 4; }
.cat-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cat-info { display: grid; gap: 12px; align-content: start; }
.cat-info h2 { font-size: 24px; }
.dialog-error { padding: 0 26px; }
.fix-list { display: grid; gap: 6px; max-height: 46vh; overflow-y: auto; padding-right: 4px; }
.fix-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 6px 10px; border-radius: 10px; background: rgba(0, 0, 0, .2); font-size: 13px; }
.fix-row label { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-weight: 600; }
.fix-file { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
input.num { width: 72px; min-height: 36px; padding: 0 8px; }
.add-tabs { justify-self: start; }

/* ---------- downloads extras ---------- */
.dl-tools { display: flex; gap: 8px; }
.storage-head { display: flex; justify-content: space-between; align-items: center; }
.storage-nums { display: flex; gap: 22px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.storage-nums b { color: var(--text); font-size: 17px; }
.storage-bar { margin-top: 10px; }
.storage-list { display: grid; gap: 2px; max-height: 420px; overflow-y: auto; }
.storage-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 9px 10px; border-radius: 10px; }
.storage-row:hover { background: rgba(255, 255, 255, .03); }
.storage-name { min-width: 0; display: grid; }
.storage-name b, .storage-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.storage-name span { font-size: 12.5px; }
.storage-size { font-variant-numeric: tabular-nums; font-weight: 650; }
.conv-list { display: grid; gap: 8px; }
.conv { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; background: rgba(0, 0, 0, .2); border: 1px solid var(--line); }
.conv-main { display: grid; gap: 6px; min-width: 0; }
.local-list { display: grid; gap: 8px; }
.local-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; background: rgba(0, 0, 0, .2); border: 1px solid var(--line); }
.local-row > .i { color: #e0a458; }
.local-name { display: grid; min-width: 0; }
.local-name span { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.net-test { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.schedule-fields.dim { opacity: .45; }
.settings-grid select { cursor: pointer; }

/* ---------- nav extras ---------- */
.nav { overflow-y: auto; scrollbar-width: none; }
.nav-more { display: none; }
@media (max-height: 820px) and (min-width: 761px) { .side-status { display: none; } .nav a { padding: 9px 14px; } }

/* ---------- focus (keyboard, remote) ---------- */
.tile:focus-visible { outline: none; }
.tile:focus-visible .tile-art { outline: 3px solid var(--accent); outline-offset: 3px; transform: translateY(-3px); }
.film .art-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
select:focus-visible, input[type=checkbox]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- manage (select many) ---------- */
.manage-bar { position: fixed; z-index: 55; left: 50%; transform: translateX(-50%); bottom: max(18px, env(safe-area-inset-bottom)); width: min(920px, calc(100% - 24px)); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px 10px 18px; border-radius: 20px; background: rgba(24, 25, 31, .94); box-shadow: 0 16px 50px rgba(0, 0, 0, .55); animation: rise .18s ease-out; }
.manage-count { font-weight: 700; font-size: 14.5px; min-width: 96px; }
.btn.danger-solid { background: #dc2626; color: #fff; }
.btn.danger-solid:hover { background: #b91c1c; }
body.managing .main { padding-bottom: 96px; }
@media (min-width: 761px) {
  /* Centre over the content, not the whole window (the sidebar sits on the left). */
  .manage-bar { left: calc(50% + (var(--sidebar) + 18px) / 2); width: min(920px, calc(100% - var(--sidebar) - 72px)); }
}
.link-btn { border: 0; background: none; cursor: pointer; font: inherit; padding: 4px 8px; border-radius: 8px; }
.link-btn:focus-visible { outline: 2px solid var(--accent); }
.select-mark { position: absolute; top: 10px; right: 10px; z-index: 3; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .85); background: rgba(0, 0, 0, .45); color: transparent; backdrop-filter: blur(4px); pointer-events: none; }
.select-mark .i { width: 16px; height: 16px; stroke-width: 3; }
.select-mark.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.selecting .tile-art, .selecting .dl { cursor: pointer; }
.selecting .play-hover { display: none; }
.tile.selected .tile-art { outline: 3px solid var(--accent); outline-offset: 3px; }
.dl { position: relative; }
.dl.selected { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59, 130, 246, .25); }
.dl .select-mark { top: 14px; right: 14px; }
.selecting .dl-actions, .selecting .dl .files { pointer-events: none; opacity: .4; }
#dl-manage[aria-pressed=true], #continue-manage.on { color: #93c5fd; }
body.tv .manage-bar { width: min(1200px, calc(100% - 48px)); padding: 14px 18px; }
body.tv .select-mark { width: 40px; height: 40px; }

/* ---------- live TV ---------- */
.player.live .seek { pointer-events: none; opacity: .35; }
.player.live #btn-back10, .player.live #btn-fwd10 { display: none; }
.live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.channel { display: grid; gap: 10px; padding: 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--glass-strong); color: var(--text); cursor: pointer; text-align: left; font: inherit; transition: transform .15s, border-color .15s; }
.channel:hover, .channel:focus-visible { transform: translateY(-2px); border-color: var(--line-strong); outline: none; }
.channel:focus-visible { box-shadow: 0 0 0 3px var(--accent); }
.channel-logo { display: grid; place-items: center; aspect-ratio: 16 / 9; border-radius: 12px; background: linear-gradient(135deg, #24252e, #15161b); overflow: hidden; color: var(--muted); font-weight: 800; font-size: 26px; }
.channel-logo img { max-width: 80%; max-height: 80%; object-fit: contain; }
.channel b { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel .muted { font-size: 12.5px; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 8px #ef4444; margin-right: 6px; }
.live-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.live-tools input { max-width: 320px; }
.live-sources { display: grid; gap: 8px; }
body.tv .live-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* ---------- TV (10-foot) layout ---------- */
body.tv { font-size: 18px; --sidebar: 280px; }
body.tv .shell { max-width: none; padding: 28px 40px; gap: 28px; }
body.tv .nav a { font-size: 18px; padding: 14px 18px; }
body.tv .nav a .i { width: 24px; height: 24px; }
body.tv h1 { font-size: 34px; }
body.tv h2 { font-size: 24px; }
body.tv .btn { min-height: 52px; padding: 0 24px; font-size: 17px; }
body.tv .btn.small { min-height: 44px; font-size: 15px; }
body.tv .btn.square { width: 52px; min-height: 52px; padding: 0; }
body.tv .rail, body.tv .rail.few { grid-auto-columns: minmax(300px, 22%); gap: 22px; padding: 10px 6px 18px; }
body.tv .grid-tiles { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 28px 22px; }
body.tv .tile-title { font-size: 18px; }
body.tv .tile-sub { font-size: 15px; }
body.tv :focus-visible, body.tv :focus { outline: 4px solid #fff !important; outline-offset: 4px; }
body.tv .tile:focus, body.tv .tile:focus-visible { outline: none !important; }
body.tv .tile:focus .tile-art, body.tv .tile:focus-visible .tile-art { outline: 4px solid #fff; outline-offset: 4px; transform: scale(1.05); box-shadow: 0 18px 44px rgba(0, 0, 0, .6); }
body.tv .tile:focus .play-hover { opacity: 1; }
body.tv .nav a:focus { background: rgba(255, 255, 255, .16); }
body.tv .search { height: 54px; }
body.tv .ctl { min-width: 56px; height: 56px; }
body.tv .ctl .i { width: 28px; height: 28px; }
body.tv .ctl-select { height: 44px; min-height: 44px; font-size: 16px; max-width: 220px; }
body.tv .player { max-height: calc(100vh - 60px); }
body.tv .time { font-size: 17px; }
body.tv .player-title { font-size: 22px; }
body.tv .shortcuts { display: none; }
body.tv .ep-play { width: 58px; height: 58px; }
body.tv .hero { min-height: 52vh; }
body.tv .hero h1 { font-size: 56px; }
body.tv .profile-btn { height: 52px; font-size: 17px; }
body.tv .avatar.xl { width: 160px; height: 160px; font-size: 64px; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  :root { --sidebar: 76px; }
  .brand-name, .nav a span, .side-status { display: none; }
  .nav a { justify-content: center; padding: 12px; position: relative; }
  .nav .count { position: absolute; top: 3px; right: 3px; min-width: 18px; height: 18px; font-size: 10.5px; padding: 0 5px; }
  .brand { justify-content: center; padding: 0; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-grid > :first-child { grid-row: auto; }
}
@media (max-width: 760px) {
  .hide-sm { display: none !important; }
  .shell { grid-template-columns: 1fr; padding: 12px 12px calc(88px + env(safe-area-inset-bottom)); gap: 12px; }
  .sidebar { position: fixed; z-index: 40; left: 10px; right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); top: auto; height: auto; padding: 6px; border-radius: 22px; flex-direction: row; background: rgba(22, 23, 29, .9); }
  .sidebar .brand { display: none; }
  .nav { flex-direction: row; }
  .nav a { flex: 1; flex-direction: column; gap: 3px; padding: 8px 4px; font-size: 11px; }
  .nav a span { display: block; }
  .nav-settings { margin-top: 0; }
  .nav a.nav-extra { display: none; }
  .nav-more { display: flex; flex: 1; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px; border: 0; border-radius: 13px; background: transparent; color: var(--text-2); font: 550 11px var(--font); cursor: pointer; }
  .nav-more .i { width: 20px; height: 20px; }
  .nav { overflow: visible; }
  .byo { grid-template-columns: auto minmax(0, 1fr); }
  .byo-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .detail { grid-template-columns: 1fr; padding: 16px; }
  .detail-art { aspect-ratio: 16 / 10; }
  .cat-body { grid-template-columns: 1fr; }
  .cat-art { aspect-ratio: 16 / 10; }
  .ep { grid-template-columns: auto minmax(0, 1fr); }
  .ep-actions { grid-column: 1 / -1; }
  .profile-btn span { display: none; }
  .profile-btn { padding: 0 5px; }
  .avatar.xl { width: 96px; height: 96px; font-size: 40px; border-radius: 24px; }
  .grid-tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px 12px; }
  .manage-bar { bottom: calc(86px + env(safe-area-inset-bottom)); padding: 10px; }
  .manage-bar .manage-count { width: 100%; }
  body.managing .shell { padding-bottom: calc(190px + env(safe-area-inset-bottom)); }
  .storage-row { grid-template-columns: minmax(0, 1fr) auto; }
  .storage-row > :last-child { grid-column: 1 / -1; justify-self: start; }
  .conv, .local-row { grid-template-columns: minmax(0, 1fr); }
  .local-row > .i { display: none; }
  .hero { min-height: 360px; border-radius: 22px; }
  .hero-body { padding: 26px 22px; }
  .hero::after { background: linear-gradient(0deg, rgba(10, 11, 14, .95) 0%, rgba(10, 11, 14, .55) 55%, rgba(10, 11, 14, .15) 100%); }
  .rail, .rail.few { grid-auto-columns: 74%; }
  .player { aspect-ratio: auto; height: 56.25vw; min-height: 210px; border-radius: 16px; }
  .dl-main { grid-template-columns: 72px minmax(0, 1fr); gap: 12px; }
  .poster { width: 72px; }
  .file-row { grid-template-columns: auto minmax(0, 1fr); }
  .file-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .grid-2 { grid-template-columns: 1fr; }
  h1 { font-size: 24px; }
}
@media (max-width: 480px) {
  .hide-xs { display: none !important; }
  .search { height: 42px; }
  .topbar .btn.primary { width: 42px; min-height: 42px; padding: 0; }
  .browse-grid { grid-template-columns: 1fr 1fr; gap: 16px 12px; }
  .ctl { min-width: 36px; padding: 0 6px; }
  .ctl-select { max-width: 104px; }
  #speed-select { max-width: 64px; }
  .byo-actions .btn { flex: 1; }
  .card { padding: 18px; }
  .dl-foot .dl-note { width: 100%; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .player { height: 100vh; max-height: none; aspect-ratio: auto; border-radius: 0; }
  body.playing .sidebar, body.playing .shortcuts { display: none; }
  body.playing .shell { padding: 0; }
}
body.playing .topbar, body.playing .banner { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
.genre-bar.tight { margin-bottom: 0; }

/* ---------- Accounts (AUTH_MODE=accounts): sign-in, paywall, account, admin ---------- */
.auth-foot { margin-top: 20px; font-size: 13.5px; color: var(--muted); }
.auth-foot .link-btn { color: var(--text); font-weight: 600; padding: 2px 4px; }
.auth-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.auth-row .link-btn { font-size: 13.5px; color: var(--muted); }
.auth-form .check { align-items: flex-start; line-height: 1.45; }
.auth-form .check a { color: #93c5fd; }
.warn-text { color: var(--warn); }
.paywall { width: min(470px, 100%); }
.perks { list-style: none; padding: 0; margin: 0 0 22px; display: grid; gap: 10px; text-align: left; width: 100%; }
.perks li { display: flex; gap: 10px; align-items: center; color: var(--text-2); font-size: 14.5px; }
.perks .i { color: var(--ok); width: 18px; height: 18px; flex: none; }
.paywall .btn + .btn { margin-top: 10px; }
#trial-pill { text-decoration: none; cursor: pointer; }
#trial-pill b { margin-left: 4px; padding-left: 8px; border-left: 1px solid rgba(251, 191, 36, .4); }
.pill.bad { background: var(--bad-soft); color: var(--bad); border: 1px solid rgba(248, 113, 113, .35); }
.acc-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--text-2); }
.small { font-size: 12.5px; }
.admin-search { max-width: 360px; }
.table-wrap { border-radius: var(--radius); overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); }
.admin-table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table .num { text-align: right; }
.admin-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
#view-account .settings-grid > :first-child { grid-row: auto; }

/* ---------- Live TV directory ---------- */
.live-tabs { margin: 4px 0 16px; }
.live-tabs button .i { width: 15px; height: 15px; margin-right: 4px; vertical-align: -2px; }
.live-tools .live-select { width: auto; max-width: 230px; min-height: 40px; border-radius: 999px; padding: 0 30px 0 14px; background-color: var(--glass); cursor: pointer; }
.live-tools input[type=search] { max-width: 300px; min-height: 40px; border-radius: 999px; }
.live-only { height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--glass); }
.channel.dir { padding: 0; gap: 0; cursor: default; display: flex; flex-direction: column; }
.channel.dir:hover { transform: none; }
.channel-main { display: grid; gap: 7px; padding: 14px; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: 18px; }
.channel-main:hover .channel-logo { filter: brightness(1.15); }
.channel-main:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.channel.dir.offline .channel-logo { opacity: .55; }
.ch-now { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-now b { color: var(--text); font-weight: 650; }
.ch-ok { font-size: 13px; color: var(--ok); font-weight: 600; }
.ch-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; min-height: 24px; }
.channel .small { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guide-btn { align-self: flex-start; margin: -6px 0 10px 8px; color: var(--muted); font-size: 12.5px; display: inline-flex; align-items: center; gap: 5px; }
.guide-btn .i { width: 14px; height: 14px; }
.guide-dialog { width: min(560px, 94vw); max-height: 86vh; border: 1px solid var(--line-strong); border-radius: 22px; padding: 22px 24px; color: var(--text); background: #15161c; }
.guide-dialog::backdrop { background: rgba(0, 0, 0, .6); }
.guide-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.guide-head h2 { margin: 0; font-size: 20px; }
.guide-list { max-height: 62vh; overflow-y: auto; display: grid; gap: 2px; margin-bottom: 14px; }
.guide-day { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 12px 0 4px; }
.guide-row { display: grid; grid-template-columns: 104px 1fr; gap: 12px; padding: 9px 10px; border-radius: 10px; }
.guide-row.on { background: var(--accent-soft); }
.guide-row b { font-weight: 650; margin-right: 8px; }
.guide-row p { margin: 4px 0 0; }
.guide-time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13.5px; }

