/* ==========================================================================
   MediaForge — web client
   ========================================================================== */

:root {
  --bg: #07080c;
  --bg-2: #0b0d13;
  --surface: #11141c;
  --surface-2: #171b25;
  --surface-3: #1f2430;
  --surface-hover: #232937;
  --line: rgba(255, 255, 255, .07);
  --line-2: rgba(255, 255, 255, .13);
  --text: #eef1f7;
  --text-2: #a8b0c0;
  --text-3: #6c7487;
  --accent: #ff7a2f;
  --accent-2: #ff3d6e;
  --accent-soft: rgba(255, 122, 47, .14);
  --grad: linear-gradient(135deg, #ffb347 0%, #ff7a2f 42%, #ff3d6e 100%);
  --ok: #3ddc97;
  --ok-soft: rgba(61, 220, 151, .13);
  --warn: #ffc547;
  --warn-soft: rgba(255, 197, 71, .13);
  --bad: #ff5a6a;
  --bad-soft: rgba(255, 90, 106, .13);
  --info: #5ab0ff;
  --info-soft: rgba(90, 176, 255, .13);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow: 0 10px 40px rgba(0, 0, 0, .45);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, .6);
  --sidebar: 248px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
svg { width: 1em; height: 1em; flex: none; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
p { margin: 0; }
.hidden { display: none !important; }
body:not(.is-admin) .admin-only { display: none !important; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.stack { display: grid; gap: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

::selection { background: rgba(255, 122, 47, .35); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .1); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(255, 255, 255, .2); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Boot ---------- */
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 100; transition: opacity .4s; }
.boot.done { opacity: 0; pointer-events: none; }
.boot-logo { width: 64px; height: 64px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.88); opacity: .6; } }

/* ---------- Buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 10px;
  background: var(--surface-3); border: 1px solid var(--line-2);
  color: var(--text); font-weight: 600; font-size: 13.5px;
  cursor: pointer; white-space: nowrap; user-select: none;
  transition: background .15s, border-color .15s, transform .1s, box-shadow .2s, opacity .15s;
}
.btn:hover { background: var(--surface-hover); border-color: rgba(255, 255, 255, .2); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--grad); border: 0; color: #fff; box-shadow: 0 6px 24px rgba(255, 90, 60, .3); }
.btn-primary:hover { background: var(--grad); filter: brightness(1.08); box-shadow: 0 8px 30px rgba(255, 90, 60, .45); }
.btn-light { background: #fff; color: #0b0d13; border: 0; }
.btn-light:hover { background: #e9ecf2; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: rgba(255, 255, 255, .06); color: var(--text); border-color: transparent; }
.btn-glass { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .14); backdrop-filter: blur(12px); }
.btn-glass:hover { background: rgba(255, 255, 255, .2); }
.btn-danger { color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); border-color: rgba(255, 90, 106, .4); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { height: 48px; padding: 0 24px; font-size: 15px; border-radius: 12px; }
.btn-lg svg { width: 20px; height: 20px; }
.btn-block { width: 100%; }
.btn.loading { pointer-events: none; color: transparent !important; position: relative; }
.btn.loading::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  background: transparent; border: 0; color: var(--text-2); cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, .08); color: var(--text); }
.icon-btn svg { width: 20px; height: 20px; }

.input, .select, .field input, .field select, .field textarea {
  width: 100%; height: 42px; padding: 0 14px; border-radius: 10px;
  background: var(--bg-2); border: 1px solid var(--line-2); color: var(--text);
  outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
.field textarea { height: auto; padding: 10px 14px; resize: vertical; }
.input:focus, .select:focus, .field input:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.select, .field select { appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23a8b0c0' stroke-width='2' stroke-linecap='round' d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; }
.select option { background: var(--surface-2); }
.field { display: grid; gap: 7px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field small { color: var(--text-3); font-size: 12px; }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; color: var(--text-2); user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.switch { position: relative; display: inline-flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; }
.switch i { width: 40px; height: 23px; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--line-2); position: relative; transition: background .2s; flex: none; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); }
.switch input:checked + i { background: var(--accent); border-color: transparent; }
.switch input:checked + i::after { transform: translateX(17px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }

.segmented { display: inline-flex; padding: 3px; gap: 3px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 11px; }
.segmented button { border: 0; background: transparent; padding: 7px 14px; border-radius: 8px; color: var(--text-2); font-weight: 600; cursor: pointer; display: inline-flex; gap: 7px; align-items: center; }
.segmented button svg { width: 16px; height: 16px; }
.segmented button.active { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { height: 32px; padding: 0 14px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); font-weight: 600; font-size: 12.5px; cursor: pointer; transition: all .15s; }
.chip:hover { color: var(--text); border-color: var(--line-2); }
.chip.active { background: var(--text); color: var(--bg); border-color: transparent; }

.badge { display: inline-flex; align-items: center; gap: 5px; height: 21px; padding: 0 7px; border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: .03em; background: rgba(255, 255, 255, .1); color: var(--text); text-transform: uppercase; white-space: nowrap; }
.badge.outline { background: transparent; border: 1px solid rgba(255, 255, 255, .3); }
.badge.hdr { background: linear-gradient(120deg, #f7d774, #ff9a3d); color: #2a1600; }
.badge.k4 { background: #fff; color: #000; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--text-3); flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }
.dot.live { background: var(--accent); box-shadow: 0 0 0 0 rgba(255, 122, 47, .7); animation: ping 1.6s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 8px rgba(255, 122, 47, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 122, 47, 0); } }

.form-error { color: var(--bad); font-size: 13px; min-height: 0; }
.form-error:not(:empty) { padding: 10px 12px; border-radius: 10px; background: var(--bad-soft); }

/* ---------- Auth ---------- */
.auth { position: fixed; inset: 0; display: flex; padding: 24px; overflow: auto; }
.auth-bg { position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(900px 600px at 15% 10%, rgba(255, 122, 47, .22), transparent 60%),
    radial-gradient(800px 600px at 90% 90%, rgba(255, 61, 110, .18), transparent 60%),
    radial-gradient(600px 400px at 70% 20%, rgba(90, 120, 255, .12), transparent 60%),
    var(--bg); }
.auth-bg::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255, 255, 255, .06) 1px, transparent 1px); background-size: 28px 28px; mask-image: radial-gradient(circle at center, #000, transparent 75%); }
.auth-card { margin: auto; width: min(420px, 100%); display: grid; gap: 16px; padding: 36px 32px; border-radius: var(--radius-lg);
  background: rgba(17, 20, 28, .78); backdrop-filter: blur(24px); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg);
  animation: rise .5s var(--ease); }
.auth-card h1 { font-size: 26px; font-weight: 800; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-size: 20px; margin-bottom: 8px; }
.auth-brand svg { width: 38px; height: 38px; }
.auth-brand b, .brand b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 800; }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 22px 14px; gap: 26px;
  background: linear-gradient(180deg, var(--bg-2), var(--bg)); border-right: 1px solid var(--line); z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 10px; font-size: 19px; letter-spacing: -.02em; }
.brand svg { width: 32px; height: 32px; }
.nav { display: grid; gap: 3px; }
.nav a { display: flex; align-items: center; gap: 13px; height: 42px; padding: 0 12px; border-radius: 10px; color: var(--text-2); font-weight: 600; position: relative; transition: background .15s, color .15s; }
.nav a svg { width: 20px; height: 20px; }
.nav a:hover { background: rgba(255, 255, 255, .05); color: var(--text); }
.nav a.active { background: var(--surface-2); color: var(--text); }
.nav a.active::before { content: ""; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--grad); }
.nav a.active svg { color: var(--accent); }
.nav-label { margin: 18px 12px 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--grad); color: #fff; font-style: normal; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.sidebar-foot { margin-top: auto; }
.user-chip { width: 100%; display: flex; align-items: center; gap: 11px; padding: 9px; border-radius: 12px; background: transparent; border: 1px solid transparent; cursor: pointer; text-align: left; transition: background .15s; }
.user-chip:hover { background: var(--surface-2); border-color: var(--line); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; background: var(--grad); flex: none; text-transform: uppercase; }
.user-meta { display: grid; min-width: 0; }
.user-meta b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta small { color: var(--text-3); font-size: 12px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: 16px; height: 68px; padding: 0 36px;
  background: linear-gradient(180deg, rgba(7, 8, 12, .92), rgba(7, 8, 12, .6) 70%, transparent); backdrop-filter: blur(10px); }
.topbar.over-hero { background: linear-gradient(180deg, rgba(7, 8, 12, .7), transparent); backdrop-filter: none; }
.search { position: relative; flex: 1; max-width: 520px; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-3); pointer-events: none; }
.search input { width: 100%; height: 42px; padding: 0 44px; border-radius: 12px; background: rgba(255, 255, 255, .06); border: 1px solid var(--line); outline: none; transition: all .2s; }
.search input:focus { background: var(--surface-2); border-color: var(--line-2); box-shadow: 0 0 0 4px rgba(255, 255, 255, .04); }
.search input::-webkit-search-cancel-button { display: none; }
.search kbd { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font: 600 11px var(--font); color: var(--text-3); border: 1px solid var(--line-2); border-radius: 6px; padding: 2px 7px; }
.topbar-actions { margin-left: auto; display: flex; gap: 6px; }
#mobileUser { display: none; }

.view { padding: 8px 36px 60px; outline: none; flex: 1; animation: fade .35s var(--ease); }
.view.flush { padding: 0 0 60px; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }

.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 12px 0 26px; }
.page-head h1 { font-size: 32px; font-weight: 800; letter-spacing: -.025em; }
.page-head p { color: var(--text-2); margin-top: 6px; }
.page-head .actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.section-title { display: flex; align-items: baseline; gap: 12px; margin: 0 0 14px; }
.section-title h2 { font-size: 19px; font-weight: 700; }
.section-title a { margin-left: auto; color: var(--text-2); font-weight: 600; font-size: 13px; }
.section-title a:hover { color: var(--text); }

/* ---------- Hero ---------- */
.hero { position: relative; min-height: min(78vh, 720px); display: flex; align-items: flex-end; margin-top: -68px; padding: 140px 36px 70px; overflow: hidden; isolation: isolate; }
.hero-bg { position: absolute; inset: 0; z-index: -2; background-size: cover; background-position: center 30%; transform: scale(1.04); animation: kenburns 30s ease-in-out infinite alternate; }
.hero-bg.placeholder { animation: none; }
@keyframes kenburns { to { transform: scale(1.12) translate(-1.5%, -1%); } }
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(90deg, rgba(7, 8, 12, .95) 0%, rgba(7, 8, 12, .7) 35%, rgba(7, 8, 12, .1) 70%),
    linear-gradient(0deg, var(--bg) 0%, rgba(7, 8, 12, 0) 45%); }
.hero-content { max-width: 620px; display: grid; gap: 16px; animation: rise .7s var(--ease); }
.hero-kicker { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.hero h1 { font-size: clamp(34px, 5vw, 64px); font-weight: 800; letter-spacing: -.035em; line-height: 1.02; text-shadow: 0 4px 30px rgba(0, 0, 0, .5); }
.hero .meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; color: var(--text-2); font-weight: 500; }
.hero .actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.hero-stats { display: flex; gap: 28px; margin-top: 10px; }
.hero-stats div { display: grid; }
.hero-stats b { font-size: 22px; font-weight: 800; }
.hero-stats span { font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }

/* ---------- Rows & cards ---------- */
.rows { display: grid; grid-template-columns: minmax(0, 1fr); gap: 38px; padding: 0 36px; }
.shelf { position: relative; }
.shelf-track { display: grid; grid-auto-flow: column; grid-auto-columns: clamp(220px, 21vw, 300px); gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 6px 2px 14px; scrollbar-width: none; scroll-behavior: smooth; }
.shelf-track::-webkit-scrollbar { display: none; }
.shelf-track > * { scroll-snap-align: start; }
.shelf-nav { position: absolute; top: 36px; bottom: 50px; width: 46px; border: 0; z-index: 2; cursor: pointer; color: #fff; opacity: 0; transition: opacity .2s; display: grid; place-items: center; }
.shelf:hover .shelf-nav { opacity: 1; }
.shelf-nav.prev { left: -36px; background: linear-gradient(90deg, var(--bg), transparent); }
.shelf-nav.next { right: -36px; background: linear-gradient(-90deg, var(--bg), transparent); }
.shelf-nav svg { width: 26px; height: 26px; }
.shelf-nav.prev svg { transform: rotate(180deg); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 26px 18px; }
.grid.shows { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }

.card { display: grid; gap: 10px; cursor: pointer; min-width: 0; outline: none; }
.card-art { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: var(--surface-2);
  box-shadow: 0 4px 18px rgba(0, 0, 0, .35); transition: transform .3s var(--ease), box-shadow .3s; isolation: isolate; }
.card-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .4s, transform .5s var(--ease); }
.card-art img.loaded { opacity: 1; }
.card-art .ph { position: absolute; inset: 0; display: grid; place-items: center; padding: 14px; text-align: center; font-weight: 800; font-size: 18px; letter-spacing: -.01em; color: rgba(255, 255, 255, .9); text-shadow: 0 2px 10px rgba(0, 0, 0, .4); }
.card-art::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07); pointer-events: none; }
.card:hover .card-art, .card:focus-visible .card-art { transform: translateY(-4px) scale(1.02); box-shadow: 0 18px 40px rgba(0, 0, 0, .55), 0 0 0 2px rgba(255, 255, 255, .85); }
.card:hover .card-art img { transform: scale(1.06); }
.card-play { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .35); opacity: 0; transition: opacity .2s; z-index: 2; }
.card-play span { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .95); color: #000; transform: scale(.8); transition: transform .25s var(--ease); box-shadow: 0 6px 24px rgba(0, 0, 0, .5); }
.card-play svg { width: 22px; height: 22px; margin-left: 3px; }
.card:hover .card-play { opacity: 1; }
.card:hover .card-play span { transform: scale(1); }
.card-tags { position: absolute; top: 8px; left: 8px; display: flex; gap: 5px; z-index: 1; }
.card-tags .badge { backdrop-filter: blur(8px); background: rgba(0, 0, 0, .55); color: #fff; }
.card-tags .badge.k4 { background: rgba(255, 255, 255, .92); color: #000; }
.card-tags .badge.hdr { background: linear-gradient(120deg, #f7d774, #ff9a3d); color: #2a1600; }
.card-watched { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%; background: var(--ok); color: #04170e; display: grid; place-items: center; z-index: 1; box-shadow: 0 2px 10px rgba(0, 0, 0, .4); }
.card-watched svg { width: 14px; height: 14px; }
.card-count { position: absolute; top: 8px; right: 8px; min-width: 26px; height: 24px; padding: 0 8px; border-radius: 99px; background: var(--grad); color: #fff; font-weight: 800; font-size: 12px; display: grid; place-items: center; z-index: 1; }
.card-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255, 255, 255, .2); z-index: 1; }
.card-progress i { display: block; height: 100%; background: var(--grad); border-radius: 0 3px 3px 0; }
.card-time { position: absolute; right: 8px; bottom: 10px; z-index: 1; font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 5px; background: rgba(0, 0, 0, .65); }
.card-body { display: grid; gap: 2px; padding: 0 2px; min-width: 0; }
.card-title { font-weight: 700; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-sub { color: var(--text-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.skeleton { background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%); background-size: 300% 100%; animation: shimmer 1.4s infinite linear; border-radius: 12px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.skeleton.card-art { box-shadow: none; }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 26px; }
.toolbar .select { width: auto; min-width: 170px; height: 36px; font-weight: 600; font-size: 13px; }
.toolbar .count { margin-left: auto; color: var(--text-3); font-weight: 600; font-size: 13px; }

/* ---------- Empty states ---------- */
.empty { display: grid; place-items: center; text-align: center; gap: 14px; padding: 70px 20px; border-radius: var(--radius-lg); border: 1px dashed var(--line-2); background: radial-gradient(500px 240px at 50% 0%, rgba(255, 122, 47, .07), transparent); }
.empty .empty-icon { width: 70px; height: 70px; border-radius: 22px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line-2); }
.empty .empty-icon svg { width: 32px; height: 32px; color: var(--accent); }
.empty h2 { font-size: 22px; font-weight: 800; }
.empty p { max-width: 460px; color: var(--text-2); }

.welcome { display: grid; grid-template-columns: 1.2fr 1fr; gap: 28px; align-items: center; padding: 40px; border-radius: var(--radius-lg); border: 1px solid var(--line); margin-top: 20px;
  background: radial-gradient(600px 300px at 0% 0%, rgba(255, 122, 47, .16), transparent 70%), radial-gradient(500px 300px at 100% 100%, rgba(255, 61, 110, .12), transparent 70%), var(--surface); }
.welcome h1 { font-size: 34px; font-weight: 800; letter-spacing: -.03em; }
.welcome p { color: var(--text-2); margin: 12px 0 22px; font-size: 15px; }
.steps { display: grid; gap: 12px; }
.step { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 14px; background: rgba(0, 0, 0, .25); border: 1px solid var(--line); }
.step .num { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--surface-3); flex: none; }
.step.done .num { background: var(--ok); color: #04170e; }
.step b { display: block; }
.step small { color: var(--text-3); }

/* ---------- Panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.panel-head h3 { font-size: 16px; font-weight: 700; }
.panel-head .actions { margin-left: auto; display: flex; gap: 8px; }
.panel + .panel { margin-top: 18px; }
.panels { display: grid; gap: 18px; }
.panels.two { grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 18px; }
.stat { position: relative; overflow: hidden; padding: 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.stat::before { content: ""; position: absolute; width: 140px; height: 140px; right: -50px; top: -60px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 122, 47, .14), transparent 70%); }
.stat .label { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.stat .label svg { width: 16px; height: 16px; color: var(--accent); }
.stat .value { font-size: 30px; font-weight: 800; letter-spacing: -.03em; margin-top: 8px; }
.stat .sub { color: var(--text-3); font-size: 12.5px; margin-top: 2px; }

.bars { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 90px 1fr 50px; align-items: center; gap: 12px; font-size: 13px; }
.bar-row .track { height: 10px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar-row .track i { display: block; height: 100%; border-radius: 99px; background: var(--grad); transition: width .8s var(--ease); }
.bar-row b { text-align: right; font-variant-numeric: tabular-nums; }
.bar-row span { color: var(--text-2); font-weight: 600; text-transform: uppercase; font-size: 12px; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 10px 22px; font-size: 13.5px; }
.kv dt { color: var(--text-3); font-weight: 600; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.meter { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 99px; background: var(--grad); }

/* Sessions */
.session { display: grid; grid-template-columns: 112px 1fr auto; gap: 16px; align-items: center; padding: 14px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); }
.session + .session { margin-top: 12px; }
.session .thumb { aspect-ratio: 16/9; border-radius: 8px; overflow: hidden; background: var(--surface-3); }
.session .thumb img { width: 100%; height: 100%; object-fit: cover; }
.session h4 { font-size: 14.5px; font-weight: 700; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.session .facts { display: flex; gap: 14px; flex-wrap: wrap; color: var(--text-3); font-size: 12.5px; margin: 4px 0 10px; }
.session .facts b { color: var(--text-2); font-weight: 600; }
.progress-dual { position: relative; height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress-dual .buf { position: absolute; top: 0; bottom: 0; background: rgba(255, 255, 255, .22); border-radius: 99px; }
.progress-dual .pos { position: absolute; top: 0; bottom: 0; left: 0; background: var(--grad); border-radius: 99px; }
.cmd { margin-top: 10px; padding: 12px; border-radius: 10px; background: #05060a; border: 1px solid var(--line); font-family: var(--mono); font-size: 11.5px; color: #8fc8ff; white-space: pre-wrap; word-break: break-all; max-height: 160px; overflow: auto; }

/* Libraries */
.libs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 18px; }
.lib { position: relative; overflow: hidden; display: grid; gap: 16px; padding: 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); transition: border-color .2s, transform .2s; }
.lib:hover { border-color: var(--line-2); }
.lib { min-width: 0; }
.lib-head { display: flex; gap: 14px; align-items: center; min-width: 0; }
.lib-head .grow { min-width: 0; }
.lib-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.lib-icon svg { width: 24px; height: 24px; }
.lib-icon.tv { background: var(--info-soft); color: var(--info); }
.lib h3 { font-size: 17px; font-weight: 700; }
.lib .path { font-family: var(--mono); font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.lib-stats div { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-stats div { padding: 10px 12px; border-radius: 10px; background: var(--bg-2); }
.lib-stats b { display: block; font-size: 17px; font-weight: 800; }
.lib-stats span { font-size: 11.5px; color: var(--text-3); font-weight: 600; }
.lib-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.lib-actions .spacer { flex: 1; }
.lib-actions { align-items: center; }
.lib-actions .lib-delete { margin-left: auto; border-color: rgba(255, 90, 106, .45); }
.lib-actions .lib-delete:hover { border-color: var(--bad); }
.scanbox { display: grid; gap: 8px; padding: 12px; border-radius: 10px; background: var(--bg-2); font-size: 12.5px; }
.scanbox .meter i { transition: width .4s; }
.scanbox.running .meter i { background-size: 200% 100%; animation: barflow 1.2s linear infinite; background-image: linear-gradient(90deg, #ff7a2f, #ff3d6e, #ffb347, #ff7a2f); }
@keyframes barflow { to { background-position: -200% 0; } }

/* Folder browser */
.browser { border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; background: var(--bg-2); }
.browser-bar { display: flex; gap: 8px; padding: 10px; border-bottom: 1px solid var(--line); background: var(--surface); }
.browser-bar .input { height: 36px; font-family: var(--mono); font-size: 12.5px; }
.browser-list { height: 300px; overflow: auto; padding: 6px; }
.folder-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 0; border-radius: 8px; background: transparent; text-align: left; cursor: pointer; color: var(--text); }
.folder-row:hover { background: var(--surface-2); }
.folder-row:disabled { opacity: .4; cursor: not-allowed; }
.folder-row svg { width: 19px; height: 19px; color: var(--accent); }
.folder-row.up svg { color: var(--text-2); }
.folder-row .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-row small { color: var(--text-3); }
.browser-foot { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--text-2); }
.browser-empty { padding: 30px; text-align: center; color: var(--text-3); }

/* Settings */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 26px; overflow-x: auto; }
.tabs button { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 12px 16px; border: 0; background: transparent; color: var(--text-2); font-weight: 600; cursor: pointer; white-space: nowrap; }
.tabs button svg { width: 17px; height: 17px; }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--text); }
.tabs button.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--grad); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px 22px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.range-wrap { display: flex; align-items: center; gap: 12px; }
.range-wrap input[type=range] { flex: 1; accent-color: var(--accent); }
.range-wrap output { min-width: 34px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.hw-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.hw-option { position: relative; display: grid; gap: 4px; padding: 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg-2); cursor: pointer; transition: all .15s; }
.hw-option:hover { border-color: rgba(255, 255, 255, .25); }
.hw-option input { position: absolute; opacity: 0; }
.hw-option b { font-size: 14px; }
.hw-option small { color: var(--text-3); font-size: 11.5px; }
.hw-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-soft); }
.hw-option .avail { position: absolute; top: 12px; right: 12px; }
.tool { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
.tool-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.tool-icon svg { width: 20px; height: 20px; }
.tool-icon.ok { background: var(--ok-soft); color: var(--ok); }
.tool-icon.bad { background: var(--bad-soft); color: var(--bad); }
.tool b { display: block; }
.tool .mono { color: var(--text-3); overflow-wrap: anywhere; }
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; background: var(--info-soft); border: 1px solid rgba(90, 176, 255, .25); color: #cfe5ff; font-size: 13px; }
.callout svg { width: 18px; height: 18px; color: var(--info); margin-top: 1px; }
.callout.warn { background: var(--warn-soft); border-color: rgba(255, 197, 71, .25); color: #ffecc0; }
.callout.warn svg { color: var(--warn); }
.callout code { font-family: var(--mono); font-size: 12px; background: rgba(0, 0, 0, .3); padding: 1px 6px; border-radius: 5px; }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; color: var(--text-3); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; padding: 0 12px 10px; }
.table td { padding: 12px; border-top: 1px solid var(--line); }
.table td:last-child, .table th:last-child { text-align: right; }

/* ---------- Show page ---------- */
.show-hero { position: relative; padding: 120px 36px 40px; margin-top: -68px; overflow: hidden; isolation: isolate; }
.show-hero .bg { position: absolute; inset: 0; z-index: -2; background-size: cover; background-position: center 25%; filter: blur(2px) saturate(1.1); transform: scale(1.05); }
.show-hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(0deg, var(--bg) 4%, rgba(7, 8, 12, .55) 60%, rgba(7, 8, 12, .7)), linear-gradient(90deg, rgba(7, 8, 12, .9), transparent 70%); }
.show-hero h1 { font-size: clamp(32px, 4.5vw, 56px); font-weight: 800; letter-spacing: -.03em; }
.show-hero .meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; color: var(--text-2); margin: 12px 0 22px; font-weight: 500; }
.show-hero .actions { display: flex; gap: 12px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-weight: 600; margin-bottom: 18px; }
.back-link:hover { color: var(--text); }
.back-link svg { width: 18px; height: 18px; }
.season-tabs { padding: 0 36px; }
.episodes { display: grid; gap: 6px; padding: 0 36px; }
.episode { display: grid; grid-template-columns: 34px 220px 1fr auto; gap: 20px; align-items: center; padding: 14px; border-radius: 14px; cursor: pointer; transition: background .15s; }
.episode:hover, .episode:focus-visible { background: var(--surface); }
.episode .num { font-size: 22px; font-weight: 800; color: var(--text-3); text-align: center; }
.episode .card-art { box-shadow: none; }
.episode:hover .card-art { transform: none; box-shadow: 0 0 0 2px rgba(255, 255, 255, .7); }
.episode h3 { font-size: 15.5px; font-weight: 700; }
.episode .info { display: grid; gap: 6px; min-width: 0; }
.episode .tech { color: var(--text-3); font-size: 12.5px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(3, 4, 7, .72); backdrop-filter: blur(8px); display: grid; place-items: start center; padding: 6vh 20px; overflow-y: auto; animation: fadeIn .25s; }
.modal-backdrop.closing { animation: fadeOut .2s forwards; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
.modal { position: relative; width: min(920px, 100%); border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .35s var(--ease); }
.modal.sm { width: min(520px, 100%); }
.modal.md { width: min(680px, 100%); }
@keyframes pop { from { opacity: 0; transform: translateY(24px) scale(.97); } }
.modal-close { position: absolute; top: 14px; right: 14px; z-index: 5; width: 38px; height: 38px; border-radius: 50%; background: rgba(0, 0, 0, .55); backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, .12); color: #fff; display: grid; place-items: center; cursor: pointer; }
.modal-close:hover { background: rgba(0, 0, 0, .8); }
.modal-close svg { width: 18px; height: 18px; }
.modal-body { padding: 26px 28px 28px; }
.modal-title { font-size: 21px; font-weight: 800; margin-bottom: 6px; }
.modal-sub { color: var(--text-2); margin-bottom: 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 26px; }

.detail-hero { position: relative; aspect-ratio: 16 / 7.2; background: var(--surface-2) center 30% / cover no-repeat; display: flex; align-items: flex-end; }
.detail-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, var(--surface) 2%, rgba(17, 20, 28, .4) 55%, rgba(17, 20, 28, .1)); }
.detail-hero .inner { position: relative; z-index: 1; padding: 0 30px 18px; display: grid; gap: 12px; width: 100%; }
.detail-hero h2 { font-size: clamp(26px, 4vw, 40px); font-weight: 800; letter-spacing: -.03em; text-shadow: 0 2px 20px rgba(0, 0, 0, .6); }
.detail-hero .kicker { color: var(--accent); font-weight: 800; font-size: 12.5px; letter-spacing: .1em; text-transform: uppercase; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; color: var(--text-2); font-weight: 500; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.detail-progress { display: flex; align-items: center; gap: 12px; color: var(--text-2); font-size: 12.5px; }
.detail-progress .meter { width: 200px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 8px 30px 30px; }
.detail-grid .panel { padding: 18px; background: var(--bg-2); }
.detail-grid h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); margin-bottom: 12px; font-weight: 700; }
.track-list { display: grid; gap: 6px; }
.track-list div { display: flex; gap: 8px; align-items: center; font-size: 13px; }

/* ---------- Menus ---------- */
.menu { position: fixed; z-index: 70; min-width: 220px; padding: 6px; border-radius: 14px; background: rgba(23, 27, 37, .96); backdrop-filter: blur(20px); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); animation: pop .2s var(--ease); }
.menu-head { padding: 10px 12px 8px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-head b { display: block; }
.menu-head small { color: var(--text-3); }
.menu button { width: 100%; display: flex; align-items: center; gap: 11px; padding: 10px 12px; border: 0; border-radius: 9px; background: transparent; cursor: pointer; text-align: left; color: var(--text); font-weight: 500; }
.menu button:hover { background: rgba(255, 255, 255, .07); }
.menu button svg { width: 18px; height: 18px; color: var(--text-2); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 22px; bottom: 22px; z-index: 90; display: grid; gap: 10px; width: min(380px, calc(100vw - 44px)); }
.toast { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; background: rgba(23, 27, 37, .97); backdrop-filter: blur(20px); border: 1px solid var(--line-2); box-shadow: var(--shadow); animation: toastIn .35s var(--ease); font-size: 13.5px; }
.toast.out { animation: toastOut .25s forwards; }
.toast .ticon { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--info-soft); color: var(--info); }
.toast .ticon svg { width: 15px; height: 15px; }
.toast.ok .ticon { background: var(--ok-soft); color: var(--ok); }
.toast.bad .ticon { background: var(--bad-soft); color: var(--bad); }
.toast b { display: block; margin-bottom: 1px; }
.toast p { color: var(--text-2); overflow-wrap: anywhere; }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }

/* ==========================================================================
   Player
   ========================================================================== */
.player { position: fixed; inset: 0; z-index: 80; background: #000; color: #fff; overflow: hidden; user-select: none; animation: fadeIn .3s; }
.player video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.player.idle { cursor: none; }
.player-top, .player-bottom { position: absolute; left: 0; right: 0; z-index: 3; transition: opacity .35s, transform .35s var(--ease); }
.player-top { top: 0; display: flex; align-items: center; gap: 16px; padding: 22px 28px 60px; background: linear-gradient(180deg, rgba(0, 0, 0, .75), transparent); }
.player-bottom { bottom: 0; padding: 70px 28px 22px; background: linear-gradient(0deg, rgba(0, 0, 0, .85), rgba(0, 0, 0, .4) 60%, transparent); }
.player.idle .player-top { opacity: 0; transform: translateY(-14px); pointer-events: none; }
.player.idle .player-bottom { opacity: 0; transform: translateY(14px); pointer-events: none; }
.player-title { display: grid; min-width: 0; }
.player-title b { font-size: 18px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-title small { color: rgba(255, 255, 255, .65); font-size: 13px; }
.player .pbtn { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; border: 0; background: transparent; color: #fff; cursor: pointer; transition: background .15s, transform .1s; flex: none; }
.player .pbtn:hover { background: rgba(255, 255, 255, .14); }
.player .pbtn:active { transform: scale(.92); }
.player .pbtn svg { width: 24px; height: 24px; }
.player .pbtn.big svg { width: 30px; height: 30px; }
.player .pbtn.active { color: var(--accent); }
.player-mode { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.player-mode .badge { background: rgba(255, 255, 255, .14); backdrop-filter: blur(10px); }

.timeline { position: relative; height: 22px; display: flex; align-items: center; cursor: pointer; margin-bottom: 10px; touch-action: none; }
.timeline .rail { position: relative; width: 100%; height: 5px; border-radius: 99px; background: rgba(255, 255, 255, .22); transition: height .15s; }
.timeline:hover .rail, .timeline.drag .rail { height: 8px; }
.timeline .avail { position: absolute; top: 0; bottom: 0; background: rgba(255, 255, 255, .3); border-radius: 99px; }
.timeline .played { position: absolute; top: 0; bottom: 0; left: 0; background: var(--grad); border-radius: 99px; }
.timeline .knob { position: absolute; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .5); transform: scale(0); transition: transform .15s; }
.timeline:hover .knob, .timeline.drag .knob { transform: scale(1); }
.timeline .hover-time { position: absolute; bottom: 26px; padding: 4px 8px; border-radius: 6px; background: rgba(0, 0, 0, .85); font-size: 12px; font-weight: 700; transform: translateX(-50%); pointer-events: none; opacity: 0; transition: opacity .15s; white-space: nowrap; }
.timeline:hover .hover-time { opacity: 1; }
.controls { display: flex; align-items: center; gap: 4px; }
.controls .time { font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 600; margin: 0 10px; white-space: nowrap; }
.controls .time span { color: rgba(255, 255, 255, .6); }
.controls .spacer { flex: 1; }
.volume { display: flex; align-items: center; }
.volume input { width: 0; opacity: 0; transition: width .25s, opacity .25s; accent-color: #fff; }
.volume:hover input, .volume input:focus { width: 90px; opacity: 1; margin-right: 8px; }

.player-center { position: absolute; inset: 0; display: grid; place-items: center; z-index: 2; pointer-events: none; }
.spinner { width: 64px; height: 64px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, .15); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.player-status { position: absolute; left: 50%; top: calc(50% + 56px); transform: translateX(-50%); z-index: 2; color: rgba(255, 255, 255, .75); font-weight: 600; font-size: 14px; text-align: center; pointer-events: none; text-shadow: 0 1px 6px #000; }
.flash { position: absolute; left: 50%; top: 50%; z-index: 2; width: 90px; height: 90px; margin: -45px 0 0 -45px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .5); backdrop-filter: blur(6px); pointer-events: none; animation: flash .6s forwards; }
.flash svg { width: 40px; height: 40px; }
.flash.side-l { left: 22%; }
.flash.side-r { left: 78%; }
@keyframes flash { 0% { opacity: 1; transform: scale(.7); } 100% { opacity: 0; transform: scale(1.3); } }

.subtitle-layer { position: absolute; left: 6%; right: 6%; bottom: 8%; z-index: 2; text-align: center; pointer-events: none; transition: bottom .35s var(--ease); }
.player:not(.idle) .subtitle-layer { bottom: 150px; }
.subtitle-layer span { display: inline; padding: 3px 10px; line-height: 1.55; font-size: clamp(18px, 2.6vw, 34px); font-weight: 600; background: rgba(0, 0, 0, .72); border-radius: 6px; box-decoration-break: clone; -webkit-box-decoration-break: clone; text-shadow: 0 1px 3px rgba(0, 0, 0, .8); white-space: pre-line; }

.player-panel { position: absolute; right: 28px; bottom: 110px; z-index: 4; width: 320px; max-height: 60vh; overflow: auto; padding: 8px; border-radius: 16px; background: rgba(18, 20, 28, .94); backdrop-filter: blur(20px); border: 1px solid rgba(255, 255, 255, .12); box-shadow: var(--shadow-lg); animation: pop .2s var(--ease); }
.player-panel h5 { margin: 10px 12px 6px; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: rgba(255, 255, 255, .5); }
.player-panel button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 0; border-radius: 9px; background: transparent; color: #fff; cursor: pointer; text-align: left; font-size: 13.5px; }
.player-panel button:hover { background: rgba(255, 255, 255, .08); }
.player-panel button .tick { width: 18px; height: 18px; color: var(--accent); visibility: hidden; flex: none; }
.player-panel button.on .tick { visibility: visible; }
.player-panel button small { margin-left: auto; color: rgba(255, 255, 255, .5); font-size: 12px; }
.player-panel .kv { padding: 8px 12px 12px; font-size: 12.5px; gap: 7px 16px; }

.upnext { position: absolute; right: 28px; bottom: 120px; z-index: 4; width: 360px; padding: 14px; border-radius: 16px; display: grid; grid-template-columns: 130px 1fr; gap: 14px; align-items: center; background: rgba(18, 20, 28, .94); backdrop-filter: blur(20px); border: 1px solid rgba(255, 255, 255, .12); box-shadow: var(--shadow-lg); animation: rise .4s var(--ease); }
.upnext .card-art { box-shadow: none; }
.upnext small { color: var(--accent); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: 11px; }
.upnext b { display: block; margin: 2px 0 10px; font-size: 14px; }
.upnext .row { gap: 8px; }
.upnext .ring { position: relative; }

.player-error { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; background: rgba(0, 0, 0, .75); padding: 20px; }
.player-error .box { max-width: 480px; text-align: center; display: grid; gap: 14px; justify-items: center; }
.player-error h3 { font-size: 22px; }
.player-error p { color: rgba(255, 255, 255, .7); overflow-wrap: anywhere; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1100px) {
  :root { --sidebar: 78px; }
  .brand span, .nav a span, .nav-label, .user-meta, .nav-badge { display: none; }
  .brand { justify-content: center; padding: 0; }
  .nav a { justify-content: center; padding: 0; }
  .nav-label { display: block; height: 1px; margin: 12px 8px; background: var(--line); font-size: 0; }
  .user-chip { justify-content: center; }
  .welcome { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; flex-direction: row; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); gap: 0; border-right: 0; border-top: 1px solid var(--line); background: rgba(11, 13, 19, .96); backdrop-filter: blur(16px); }
  .brand, .sidebar-foot, .nav-label { display: none !important; }
  .nav { display: flex; width: 100%; justify-content: space-around; gap: 0; }
  .nav a { flex-direction: column; gap: 3px; height: 54px; padding: 0 6px; flex: 1; justify-content: center; font-size: 10.5px; }
  .nav a span { display: block; }
  .nav a.active::before { display: none; }
  .nav a.active { background: transparent; }
  #mobileUser { display: inline-grid; }
  .topbar { padding: 0 16px; height: 60px; gap: 8px; }
  .search kbd { display: none; }
  .view { padding: 4px 16px 100px; }
  .view.flush { padding-bottom: 100px; }
  .hero { padding: 110px 16px 40px; min-height: 64vh; margin-top: -60px; }
  .hero::after { background: linear-gradient(0deg, var(--bg) 8%, rgba(7, 8, 12, .55) 60%, rgba(7, 8, 12, .3)); }
  .hero-stats { gap: 18px; }
  .rows, .episodes, .season-tabs { padding: 0 16px; }
  .shelf-track { grid-auto-columns: 72vw; }
  .shelf-nav { display: none; }
  .show-hero { padding: 96px 16px 26px; margin-top: -60px; }
  .page-head h1 { font-size: 26px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 18px 12px; }
  .grid.shows { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  .episode { grid-template-columns: 120px 1fr; gap: 12px; padding: 10px 0; }
  .episode .num, .episode > .actions { display: none; }
  .detail-grid { grid-template-columns: 1fr; padding: 0 18px 22px; }
  .detail-hero { aspect-ratio: 4 / 3; }
  .detail-hero .inner { padding: 0 18px 14px; }
  .modal-backdrop { padding: 0; place-items: end center; }
  .modal { border-radius: 20px 20px 0 0; }
  .modal-body { padding: 22px 18px; }
  .panels.two { grid-template-columns: 1fr; }
  .libs { grid-template-columns: 1fr; }
  .session { grid-template-columns: 1fr; }
  .session .thumb { display: none; }
  .welcome { padding: 24px; }
  .player-top { padding: 14px 14px 50px; }
  .player-bottom { padding: 50px 12px 14px; }
  .controls .hide-sm { display: none; }
  .player-panel, .upnext { right: 12px; left: 12px; width: auto; bottom: 100px; }
  .toasts { right: 12px; bottom: 84px; width: calc(100vw - 24px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Brand wordmark ---------- */
.brand-text { display: grid; line-height: 1.05; min-width: 0; }
.brand-text b { font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.brand-text small { font-size: 9.5px; font-weight: 700; letter-spacing: .32em; color: var(--text-2); margin-top: 3px; }
.auth-brand .brand-text b { font-size: 21px; }
.auth-brand .brand-text small { font-size: 10.5px; }
.brand img.logo { width: 40px; height: 40px; object-fit: contain; flex: none; filter: drop-shadow(0 2px 8px rgba(0, 40, 140, .45)); }
.auth-brand img.logo { width: 64px; height: 64px; object-fit: contain; filter: drop-shadow(0 4px 16px rgba(0, 40, 140, .5)); }
.boot-logo { width: 96px; height: 96px; object-fit: contain; }

/* ---------- Posters & metadata ---------- */
.grid.posters { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 28px 18px; }
.shelf-track.posters { grid-auto-columns: clamp(150px, 13vw, 200px); }
.card-art.poster { aspect-ratio: 2 / 3; border-radius: 10px; }
.poster-ph { display: flex !important; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 16px !important; font-size: 17px !important; line-height: 1.15; }
.poster-ph b { font-weight: 800; }
.poster-ph small { font-size: 12px; font-weight: 600; opacity: .7; }
/* No poster: a frame from the video is cropped in, with the title over a gradient. */
.card-art.framed::before { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(0deg, rgba(0, 0, 0, .85) 0%, rgba(0, 0, 0, .2) 45%, transparent 70%); pointer-events: none; }
.card-art.framed .poster-ph { z-index: 1; justify-content: flex-end; align-items: flex-start; text-align: left; }
.card-art.framed img { object-position: center; }
.chip.static { cursor: default; height: 26px; padding: 0 11px; font-size: 12px; display: inline-flex; align-items: center; }
.hero-overview { color: var(--text-2); font-size: 15px; line-height: 1.6; max-width: 620px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.detail-about { display: flex; gap: 22px; padding: 6px 30px 18px; align-items: flex-start; }
.detail-poster { width: 150px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 12px; box-shadow: 0 12px 34px rgba(0, 0, 0, .55); flex: none; position: relative; z-index: 2; border: 1px solid var(--line-2); }
.tagline { font-style: italic; color: var(--text-2); font-size: 15px; }
.overview { line-height: 1.65; color: var(--text); font-size: 14.5px; }

.show-head { display: flex; gap: 28px; align-items: flex-end; }
.show-poster { width: 190px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 14px; box-shadow: 0 20px 50px rgba(0, 0, 0, .6); border: 1px solid var(--line-2); flex: none; }
.ep-overview { color: var(--text-3); font-size: 13px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.match-results { display: grid; gap: 8px; margin-top: 18px; max-height: 52vh; overflow: auto; }
.match-item { display: flex; gap: 14px; align-items: flex-start; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-2); text-align: left; cursor: pointer; color: var(--text); transition: border-color .15s, background .15s; }
.match-item:hover { border-color: var(--accent); background: var(--surface-2); }
.match-item img, .match-noart { width: 62px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 6px; flex: none; background: var(--surface-3); }
.match-noart { display: grid; place-items: center; color: var(--text-3); }
.match-item p { color: var(--text-3); font-size: 12.5px; margin-top: 4px; line-height: 1.45; }
.match-item.loading-row { opacity: .5; pointer-events: none; }

.gpu { padding: 12px 14px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }

@media (max-width: 760px) {
  .grid.posters { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 18px 10px; }
  .shelf-track.posters { grid-auto-columns: 38vw; }
  .detail-about { padding: 4px 18px 14px; }
  .detail-poster { width: 96px; }
  .show-poster { width: 110px; }
  .show-head { gap: 16px; }
}

/* ---------- Hardware options: detected / tested / selected ---------- */
.hw-option { padding: 16px 16px 14px 46px; min-height: 104px; align-content: start; }
.hw-option .hw-check { position: absolute; left: 14px; top: 16px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; color: transparent; transition: all .15s; }
.hw-option .hw-check svg { width: 13px; height: 13px; }
.hw-option.selected, .hw-option:has(input:checked) { border-color: var(--accent); background: linear-gradient(135deg, rgba(255, 122, 47, .16), rgba(255, 61, 110, .08)); box-shadow: 0 0 0 3px var(--accent-soft), 0 8px 24px rgba(255, 90, 60, .15); }
.hw-option.selected .hw-check, .hw-option:has(input:checked) .hw-check { background: var(--grad); border-color: transparent; color: #fff; }
.hw-option.unavailable { opacity: .45; cursor: not-allowed; filter: grayscale(.6); }
.hw-option.unavailable:hover { border-color: var(--line-2); }
.hw-option .hw-status { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.hw-option .avail { display: none; }
.hw-msg { display: block; margin-top: 6px; line-height: 1.4; }
.hw-msg.bad { color: #ffb3bb !important; }

/* ---------- Device profiles ---------- */
.device-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.device-card { padding: 16px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); }
.device-card .row svg { width: 18px; height: 18px; color: var(--accent); }
.chip-toggle { position: relative; cursor: pointer; }
.chip-toggle input { position: absolute; opacity: 0; }
.chip-toggle span { display: inline-flex; align-items: center; height: 28px; padding: 0 11px; border-radius: 99px; font-size: 12px; font-weight: 700; border: 1px solid var(--line-2); color: var(--text-3); text-decoration: line-through; transition: all .15s; }
.chip-toggle input:checked + span { background: var(--ok-soft); color: var(--ok); border-color: rgba(61, 220, 151, .35); text-decoration: none; }
.chip-toggle input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.table td .row svg { width: 18px; height: 18px; color: var(--text-2); }

/* ---------- Cast & people ---------- */
.cast-row { display: flex; gap: 14px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: thin; }
.cast { flex: none; width: 92px; display: grid; justify-items: center; text-align: center; gap: 4px; color: var(--text); }
.cast-photo { position: relative; width: 72px; height: 72px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; border: 2px solid var(--line-2); transition: border-color .15s, transform .2s var(--ease); }
.cast-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cast-photo i { font-style: normal; font-weight: 800; font-size: 20px; color: rgba(255, 255, 255, .85); }
.cast:hover .cast-photo { border-color: var(--accent); transform: translateY(-2px); }
.cast b { font-size: 12px; font-weight: 700; line-height: 1.25; }
.cast small { font-size: 11px; color: var(--text-3); line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.person-link { color: var(--text); font-weight: 600; }
.person-link:hover { color: var(--accent); }
a.chip.static:hover { color: var(--text); border-color: var(--accent); }

/* ---------- Library access picker ---------- */
.lib-picker { display: grid; gap: 12px; padding: 14px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
.lib-picker-list { display: grid; gap: 8px; padding-left: 4px; transition: opacity .15s; }
.lib-picker-list.disabled { opacity: .45; }
.lib-picker-list .check span { display: inline-flex; align-items: center; gap: 8px; color: var(--text); }
.lib-picker-list .check svg { width: 16px; height: 16px; color: var(--accent); }
.lib-access span { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }

/* Only the round ▶ button plays; the rest of the artwork opens the details. */
.card-play { pointer-events: none; }
.card-play span { pointer-events: auto; cursor: pointer; }
.card-play span:hover { transform: scale(1.08) !important; background: #fff; }
.hw-fix { margin-top: 10px; justify-self: start; }

/* ---------- Person page ---------- */
.person-head { display: flex; gap: 32px; align-items: flex-start; margin-top: 8px; }
.person-photo { position: relative; flex: none; width: 220px; aspect-ratio: 2 / 3; border-radius: 18px; overflow: hidden; display: grid; place-items: center; box-shadow: var(--shadow-lg); border: 1px solid var(--line-2); }
.person-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.person-photo i { font-style: normal; font-size: 48px; font-weight: 800; color: rgba(255, 255, 255, .8); }
.person-name { font-size: clamp(30px, 4vw, 48px); font-weight: 800; letter-spacing: -.03em; }
.person-bio { color: var(--text-2); line-height: 1.7; max-width: 820px; white-space: pre-line; }
.person-bio.clamp { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
a.credit-external { color: inherit; }
a.credit-external .card-art { opacity: .92; }
@media (max-width: 760px) { .person-head { flex-direction: column; align-items: center; text-align: center; } .person-photo { width: 160px; } }

/* ---------- Live dashboard ---------- */
.live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.live-tile { padding: 14px 14px 10px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); min-width: 0; }
.live-head { display: flex; align-items: baseline; gap: 10px; }
.live-label { font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-2); }
.live-value { margin-left: auto; font-size: 24px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--text); }
.live-sub { font-size: 12px; margin: 2px 0 6px; min-height: 16px; }
.live-chart { position: relative; }
.live-chart svg { display: block; width: 100%; overflow: visible; }
.live-chart .grid { stroke: rgba(255, 255, 255, .06); stroke-width: 1; }
.live-chart .axis { fill: var(--text-3); font-size: 10px; font-family: var(--font); }
.live-chart .cap { stroke-width: 1.5; stroke-dasharray: 4 4; opacity: .8; }
.live-chart .xhair line { stroke: rgba(255, 255, 255, .35); stroke-width: 1; }
.chart-tip { position: absolute; top: 0; z-index: 3; pointer-events: none; padding: 8px 10px; border-radius: 10px; background: rgba(23, 27, 37, .97); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-size: 12px; white-space: nowrap; }
.chart-tip b { display: block; margin-bottom: 4px; color: var(--text-2); font-weight: 600; }
.chart-tip div { display: flex; align-items: center; gap: 6px; color: var(--text-2); }
.chart-tip div span { margin-left: auto; padding-left: 12px; color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.chart-tip i, .live-legend i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }
.live-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-top: 4px; min-height: 16px; }
.live-legend span { display: inline-flex; align-items: center; gap: 6px; }
.live-legend b { color: var(--text); font-variant-numeric: tabular-nums; }
.input-unit { position: relative; }
.input-unit em { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--text-3); font-size: 12px; font-weight: 600; pointer-events: none; }

/* ---------- Folder browser: network ---------- */
.browser-section { display: flex; align-items: center; gap: 6px; padding: 14px 12px 6px; margin-top: 6px; border-top: 1px solid var(--line); }
.browser-section span { flex: 1; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.browser-signin { display: grid; gap: 12px; padding: 14px; }
.browser-signin p { font-size: 12.5px; }

/* ---------- TV remotes (tv.js adds .tv on LG webOS / Samsung Tizen) ---------- */
.tv :focus { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
.tv .card:focus, .tv .episode:focus, .tv .player:focus, .tv #view:focus { outline: none; }
.tv .card:focus .card-art { transform: translateY(-4px) scale(1.04); box-shadow: 0 18px 40px rgba(0, 0, 0, .55), 0 0 0 4px var(--accent); }
.tv .card:focus .card-play { opacity: 1; }
.tv .episode:focus { background: var(--surface); box-shadow: 0 0 0 3px var(--accent); }
.tv .nav a:focus { background: rgba(255, 255, 255, .08); color: var(--text); }
.tv .shelf-nav, .tv .search kbd, .tv .volume input, .tv [data-a="pip"], .tv a[download] { display: none; }
.tv .shelf-track { scroll-behavior: auto; scroll-snap-type: none; }
.tv .player .pbtn:focus { background: rgba(255, 255, 255, .22); outline: 3px solid var(--accent); }
.tv .timeline:focus .rail { height: 8px; }
.tv .timeline:focus .knob { transform: scale(1); }
.tv ::-webkit-scrollbar { display: none; }

/* ---------- Home: genre strip ---------- */
.genre-strip .chips { gap: 10px; }
.genre-chip { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; font-size: 13.5px; color: var(--text);
  background: linear-gradient(135deg, hsl(var(--h) 55% 24% / .9), hsl(calc(var(--h) + 40) 50% 14% / .9)); border-color: hsl(var(--h) 60% 50% / .35); }
.genre-chip small { font-size: 11px; color: var(--text-2); font-weight: 700; }
.genre-chip:hover { border-color: hsl(var(--h) 70% 60% / .8); color: #fff; }

/* ---------- Search & browse ---------- */
.search-layout { display: grid; gap: 30px; }
.search-layout.with-kb { grid-template-columns: 380px 1fr; align-items: start; }
.search-main { min-width: 0; display: grid; gap: 22px; align-content: start; }
.search-big { display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 18px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line-2); }
.search-big svg { width: 20px; height: 20px; color: var(--text-3); flex: none; }
.search-big input { flex: 1; height: 100%; background: none; border: 0; outline: none; color: var(--text); font: inherit; font-size: 17px; }
.search-big:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.filters { display: grid; gap: 12px; }
.filter-row { display: flex; align-items: flex-start; gap: 14px; }
.filter-label { flex: none; width: 64px; padding-top: 7px; font-size: 11.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.filter-row .chips { flex: 1; }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.tile-grid.decades { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.browse-tile { position: relative; display: grid; align-content: end; gap: 2px; min-height: 96px; padding: 16px 18px; border-radius: 14px; text-align: left; cursor: pointer; overflow: hidden; color: #fff;
  border: 1px solid hsl(var(--h) 60% 55% / .25); background: linear-gradient(135deg, hsl(var(--h) 60% 34%), hsl(calc(var(--h) + 45) 55% 16%)); transition: transform .15s var(--ease), box-shadow .15s; }
.browse-tile::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: hsl(var(--h) 80% 70% / .18); }
.browse-tile b { font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.browse-tile small { font-size: 12px; color: rgba(255, 255, 255, .7); font-weight: 600; }
.browse-tile:hover, .browse-tile:focus-visible { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(0, 0, 0, .45); }
.kb-panel { position: sticky; top: 20px; display: grid; gap: 16px; padding: 20px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.kb-text { min-height: 54px; padding: 12px 16px; border-radius: 12px; background: var(--surface-2); font-size: 22px; font-weight: 700; word-break: break-word; }
.kb-text .caret { display: inline-block; width: 2px; height: 24px; margin-left: 2px; vertical-align: -4px; background: var(--accent); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.kb { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.kb-key { height: 50px; border-radius: 10px; border: 0; background: var(--surface-2); color: var(--text); font: inherit; font-size: 18px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.kb-key.wide { grid-column: span 2; font-size: 14px; }
.kb-key svg { width: 16px; height: 16px; }
.kb-key:hover { background: var(--surface-hover); }

/* ---------- TV: home with a spotlight on the selected title ---------- */
.tv .topbar { display: none; }
.tv .hero { margin-top: 0; }
.tv .view.tvhome-view { padding: 0; animation: none; }
.tvhome { position: relative; height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.tv-bg { position: absolute; inset: 0; z-index: 0; }
.tv-bg-img { position: absolute; inset: 0 0 25% 25%; background-size: cover; background-position: center 25%; opacity: 0; transition: opacity .6s ease; }
.tv-bg-img.on { opacity: 1; }
.tv-bg::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--bg) 22%, rgba(7, 8, 12, .75) 45%, rgba(7, 8, 12, .1) 75%), linear-gradient(0deg, var(--bg) 42%, rgba(7, 8, 12, .6) 62%, transparent 85%); }
.tv-spot { position: relative; z-index: 1; height: 44vh; flex: none; box-sizing: border-box; padding: 54px 48px 18px; display: grid; align-content: end; gap: 12px; max-width: 980px; }
.tv-spot h1 { font-size: 52px; font-weight: 800; letter-spacing: -.03em; line-height: 1.05; text-shadow: 0 4px 30px rgba(0, 0, 0, .5); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tv-spot .meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; color: var(--text-2); font-size: 17px; font-weight: 600; }
.tv-spot .meta i { font-style: normal; color: var(--text-3); }
.tv-spot .rating { color: #ffd166; }
.tv-spot .hero-overview { font-size: 17px; max-width: 820px; }
.tv-genres { color: var(--text-3); font-size: 14px; font-weight: 700; letter-spacing: .04em; }
.tv-rows { position: relative; z-index: 1; flex: 1; overflow-y: auto; padding: 8px 48px 60px; scrollbar-width: none; gap: 30px; align-content: start; }
.tv .shelf-track { overflow-y: visible; padding: 10px 6px 14px; }
.tv .genre-chip:focus, .tv .browse-tile:focus { outline: 3px solid #fff; outline-offset: 3px; transform: scale(1.04); }
.tv .kb-key:focus { background: var(--accent); color: #fff; outline: none; transform: scale(1.06); }
.tv .chip:focus { outline: 3px solid var(--accent); outline-offset: 2px; }
.tv-rows { scroll-padding-top: 52px; -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 36px); mask-image: linear-gradient(180deg, transparent 0, #000 36px); }
.tv .tv-rows .shelf-track { grid-auto-columns: 290px; }
.tv .tv-rows .shelf-track.posters { grid-auto-columns: 158px; }
.tv .tv-rows .section-title { margin-bottom: 6px; }
.tv .tv-rows .section-title h2 { font-size: 21px; }
.tv .tv-rows .section-title a { display: none; }

/* ---------- TV: dialogs centred and always inside the screen ---------- */
.tv .modal-backdrop { place-items: center; padding: 4vh 4vw; overflow: hidden; }
.tv .modal { max-height: 92vh; overflow-y: auto; scrollbar-width: none; }
.tv .modal::-webkit-scrollbar { display: none; }
.tv .modal.detail { width: min(1280px, 100%); }
.tv .modal.detail .detail-hero { aspect-ratio: auto; height: 46vh; }
.tv .modal.detail .detail-hero .inner { padding: 0 40px 22px; }
.tv .modal.detail .detail-about { padding: 8px 40px 26px; }
.tv .modal.detail .overview { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
/* Codec, bitrate, file path and admin tools are for the web app; episode buttons stay. */
.tv .modal.detail .detail-grid .panel { display: none; }
.tv .modal.detail .detail-grid { grid-template-columns: 1fr; gap: 0; padding: 0 40px; }
.tv .modal.detail .detail-grid > .row-wrap { padding-bottom: 26px; }
.tv .modal.detail a[href*="imdb.com"] { display: none; }

/* ---------- Paging (50 per page) ---------- */
.pager { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 30px; flex-wrap: wrap; }
.pager .btn:disabled { opacity: .35; cursor: default; }
.pager small { color: var(--text-3); }
.tv .pager .btn { height: 52px; padding: 0 26px; font-size: 17px; }
.tv .pager .btn:focus { outline: 3px solid var(--accent); outline-offset: 3px; background: var(--surface-hover); }
