/* LiveBall TV — eigen ontwerp
   Warme aardse basis, grasgroen accent, rood alleen voor "live".
   Inria Serif voor titels, Figtree voor interface en dichte data. */

:root {
  --bg: #f4efe6;
  --bg-deep: #ebe4d7;
  --surface: #fbf8f2;
  --surface-2: #efe8db;
  --surface-3: #e4dccc;
  --ink: #1f1b16;
  --ink-2: #3d362d;
  --muted: #6e6558;
  --faint: #9a9082;
  --line: #ddd3c2;
  --accent: #2f8a4c;
  --accent-hover: #28783f;
  --accent-ink: #ffffff;
  --accent-soft: #dcebd9;
  --accent-text: #22703b;
  --live: #d23a2a;
  --gold: #b9842a;
  --scrim: 31 27 22;
  --hero-fade: 244 239 230;
  --radius-s: 8px;
  --radius: 12px;
  --radius-l: 18px;
  --gutter: clamp(16px, 4vw, 56px);
  --font-display: 'Inria Serif', Georgia, serif;
  --font-ui: 'Figtree', 'Segoe UI', sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --nav-h: 68px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14120f;
    --bg-deep: #0f0d0b;
    --surface: #1c1915;
    --surface-2: #25211c;
    --surface-3: #312c25;
    --ink: #f3ede3;
    --ink-2: #ddd5c8;
    --muted: #a59b8c;
    --faint: #776e61;
    --line: #322d26;
    --accent: #45a862;
    --accent-hover: #52b86f;
    --accent-ink: #0f140f;
    --accent-soft: #1f3324;
    --accent-text: #6cc684;
    --live: #e5503f;
    --gold: #d9a54a;
    --scrim: 10 9 7;
    --hero-fade: 20 18 15;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #14120f;
  --bg-deep: #0f0d0b;
  --surface: #1c1915;
  --surface-2: #25211c;
  --surface-3: #312c25;
  --ink: #f3ede3;
  --ink-2: #ddd5c8;
  --muted: #a59b8c;
  --faint: #776e61;
  --line: #322d26;
  --accent: #45a862;
  --accent-hover: #52b86f;
  --accent-ink: #0f140f;
  --accent-soft: #1f3324;
  --accent-text: #6cc684;
  --live: #e5503f;
  --gold: #d9a54a;
  --scrim: 10 9 7;
  --hero-fade: 20 18 15;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
/* Lucide-iconen (lucide.dev): stroke 2, ronde uiteinden. .fill voor gevulde varianten (play/pause/ster). */
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ico.fill { fill: currentColor; }
.ico.sm { width: 16px; height: 16px; }
.ico.lg { width: 26px; height: 26px; }
:focus { outline: none; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 3px; border-radius: var(--radius-s); }

.serif { font-family: var(--font-display); }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Knoppen ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: 999px;
  font-weight: 600; font-size: 15px; letter-spacing: .01em; white-space: nowrap;
  transition: background .18s var(--ease), color .18s var(--ease), transform .18s var(--ease);
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface-3); color: var(--ink); }
.btn-secondary:hover { background: var(--line); }
.btn-ghost { color: var(--ink-2); padding: 0 14px; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-light { background: #fbf8f2; color: #1f1b16; }
.btn-light:hover { background: #fff; }
.btn-glass { background: rgb(255 255 255 / .16); color: #fff; }
.btn-glass:hover { background: rgb(255 255 255 / .26); }
.btn .ico { width: 18px; height: 18px; }
.btn[disabled] { opacity: .55; pointer-events: none; }

.icon-btn {
  width: 42px; height: 42px; border-radius: 999px; display: inline-grid; place-items: center;
  color: var(--ink-2); transition: background .15s var(--ease), color .15s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.active { color: var(--accent-text); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 16px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2); font-weight: 500; font-size: 14px; white-space: nowrap;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.chip:hover { background: var(--surface-3); color: var(--ink); }
.chip.active { background: var(--ink); color: var(--bg); }
.chip .count { color: inherit; opacity: .55; font-variant-numeric: tabular-nums; }

.badge-live {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 6px;
  background: var(--live); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.badge-live::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- Topnavigatie ---------- */

.topnav {
  position: fixed; inset: 0 0 auto; z-index: 40; height: var(--nav-h);
  display: flex; align-items: center; gap: 28px; padding: 0 var(--gutter);
  transition: background .25s var(--ease), border-color .25s var(--ease);
  border-bottom: 1px solid transparent;
}
.topnav.solid { background: var(--bg); border-bottom-color: var(--line); }
.topnav.on-hero:not(.solid) { color: #fff; }
.topnav.on-hero:not(.solid) .nav-link { color: rgb(255 255 255 / .8); }
.topnav.on-hero:not(.solid) .nav-link.active, .topnav.on-hero:not(.solid) .nav-link:hover { color: #fff; }
.topnav.on-hero:not(.solid) .icon-btn { color: #fff; }
.topnav.on-hero:not(.solid) .icon-btn:hover { background: rgb(255 255 255 / .14); }
.topnav.on-hero:not(.solid)::before {
  content: ''; position: absolute; inset: 0 0 -40px; z-index: -1; pointer-events: none;
  background: linear-gradient(rgb(var(--scrim) / .55), transparent);
}

.wordmark { display: inline-flex; align-items: baseline; gap: 2px; font-family: var(--font-display); font-weight: 700; font-size: 23px; letter-spacing: -.01em; white-space: nowrap; }
.wordmark .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; margin: 0 1px 0 2px; transform: translateY(-1px); }
.wordmark small { font-family: var(--font-ui); font-size: 12px; font-weight: 700; letter-spacing: .14em; margin-left: 6px; color: var(--accent-text); }
.topnav.on-hero:not(.solid) .wordmark small { color: #9ee0ae; }

.nav-links { display: flex; gap: 4px; }
.nav-link { position: relative; height: 40px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: 999px; color: var(--muted); font-weight: 600; transition: color .15s var(--ease); }
.nav-link:hover, .nav-link.active { color: var(--ink); }
.nav-link.active::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: 4px; height: 2px; border-radius: 2px; background: var(--accent); }
.nav-tools { margin-left: auto; display: flex; align-items: center; gap: 4px; }

.search-field { position: relative; display: flex; align-items: center; }
.search-field input {
  width: 0; opacity: 0; height: 40px; border: 0; border-radius: 999px; background: var(--surface-2);
  padding: 0 14px 0 40px; transition: width .25s var(--ease), opacity .2s var(--ease); color: var(--ink);
}
.search-field.open input { width: min(280px, 50vw); opacity: 1; }
.search-field .icon-btn { position: absolute; left: 0; }
.search-field.open .icon-btn { color: var(--muted); pointer-events: none; }
.search-field:not(.open) { width: 42px; }

/* Mobiele tabbar */
.tabbar {
  position: fixed; inset: auto 0 0; z-index: 40; display: none;
  background: var(--bg); border-top: 1px solid var(--line);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.tabbar a { flex: 1; display: grid; justify-items: center; gap: 2px; padding: 6px 0; font-size: 11px; font-weight: 600; color: var(--faint); }
.tabbar a.active { color: var(--accent-text); }
.tabbar .ico { width: 22px; height: 22px; }

@media (max-width: 860px) {
  .nav-links { display: none; }
  .tabbar { display: flex; }
  .view { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  :root { --nav-h: 60px; }
}

/* ---------- Views ---------- */

.view { min-height: 100vh; padding-top: var(--nav-h); padding-bottom: 64px; animation: viewIn .35s var(--ease); }
.view.flush { padding-top: 0; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } }

.page-head { padding: 28px var(--gutter) 10px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-title { font-family: var(--font-display); font-weight: 700; font-size: clamp(30px, 4vw, 44px); line-height: 1.05; margin: 0; letter-spacing: -.015em; }
.page-sub { color: var(--muted); margin: 6px 0 0; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 14px var(--gutter) 18px; scrollbar-width: none; scroll-padding: var(--gutter); }
.chips::-webkit-scrollbar { display: none; }
.sticky-bar { position: sticky; top: var(--nav-h); z-index: 20; background: var(--bg); }

.select {
  height: 38px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  padding: 0 34px 0 14px; appearance: none; font-weight: 500; font-size: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236e6558' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: 16px; background-position: right 12px center;
}

/* ---------- Hero ---------- */

.hero { position: relative; min-height: min(86vh, 760px); display: flex; align-items: flex-end; color: #fff; overflow: hidden; background: #1a1712; }
.hero-media { position: absolute; inset: 0; }
.hero-media img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; animation: heroIn 1.4s var(--ease); }
.hero-media.poster-mode img { object-fit: cover; filter: saturate(1.05); transform: scale(1.02); }
@keyframes heroIn { from { opacity: 0; transform: scale(1.04); } }
.hero::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(90deg, rgb(var(--scrim) / .82) 0%, rgb(var(--scrim) / .45) 38%, transparent 70%),
    linear-gradient(0deg, rgb(var(--hero-fade)) 0%, rgb(var(--hero-fade) / .0) 34%);
}
.hero-body { position: relative; z-index: 1; padding: 0 var(--gutter) clamp(56px, 9vh, 96px); max-width: 720px; }
.hero-eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: #a9e4b8; margin-bottom: 14px; }
.hero-title { font-family: var(--font-display); font-weight: 700; font-size: clamp(38px, 6.4vw, 78px); line-height: .98; letter-spacing: -.02em; margin: 0 0 16px; text-wrap: balance; text-shadow: 0 1px 30px rgb(0 0 0 / .25); }
.hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-weight: 600; font-size: 14px; color: rgb(255 255 255 / .85); margin-bottom: 14px; }
.hero-plot { font-size: 16.5px; line-height: 1.55; color: rgb(255 255 255 / .86); margin: 0 0 26px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; max-width: 600px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-actions .btn { height: 50px; padding: 0 26px; font-size: 16px; }
.hero-dots { position: absolute; z-index: 2; right: var(--gutter); bottom: clamp(60px, 9vh, 100px); display: flex; gap: 6px; }
.hero-dots button { width: 22px; height: 4px; border-radius: 4px; background: rgb(255 255 255 / .35); transition: background .2s, width .3s var(--ease); }
.hero-dots button.active { width: 38px; background: #fff; }
.rating { display: inline-flex; align-items: center; gap: 4px; color: var(--gold); font-weight: 700; }
.hero .rating { color: #f2c66b; }
.rating .ico { width: 15px; height: 15px; }
.sep { width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .5; }

/* ---------- Rijen (carrousels) ---------- */

.rows { position: relative; z-index: 2; margin-top: -36px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 34px; }
.rows > * { min-width: 0; }
.rows.no-hero { margin-top: 18px; }
.row-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 var(--gutter); margin-bottom: 12px; }
.row-title { font-family: var(--font-display); font-weight: 700; font-size: clamp(20px, 2.2vw, 26px); margin: 0; letter-spacing: -.01em; }
.row-link { font-weight: 600; font-size: 14px; color: var(--accent-text); display: inline-flex; align-items: center; gap: 2px; }
.row-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.row { position: relative; }
.row-track {
  display: grid; grid-auto-flow: column; gap: 14px; overflow-x: auto; overscroll-behavior-x: contain;
  padding: 4px var(--gutter) 10px; scroll-padding: 0 var(--gutter); scroll-snap-type: x proximity; scrollbar-width: none;
}
.row-track::-webkit-scrollbar { display: none; }
.row-track > * { scroll-snap-align: start; }
.row-track.posters { grid-auto-columns: clamp(132px, 14vw, 186px); }
.row-track.wide { grid-auto-columns: clamp(250px, 24vw, 340px); }
.row-track.channels { grid-auto-columns: clamp(150px, 13vw, 190px); }
.row-nav {
  position: absolute; top: 4px; bottom: 10px; width: var(--gutter); min-width: 44px; display: grid; place-items: center; z-index: 3;
  color: var(--ink); opacity: 0; transition: opacity .2s var(--ease);
}
.row-nav.prev { left: 0; background: linear-gradient(90deg, var(--bg) 30%, transparent); }
.row-nav.next { right: 0; background: linear-gradient(270deg, var(--bg) 30%, transparent); }
.row:hover .row-nav:not([disabled]) { opacity: 1; }
.row-nav[disabled] { pointer-events: none; }
@media (hover: none) { .row-nav { display: none; } }

/* ---------- Kaarten ---------- */

.card { position: relative; display: block; text-align: left; border-radius: var(--radius); outline-offset: 3px; }
.card-art { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); transition: transform .3s var(--ease); }
.card:hover .card-art, .card:focus-visible .card-art { transform: translateY(-4px); }
.card-art img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .4s var(--ease); }
.card-art img.loaded { opacity: 1; }
.poster .card-art { aspect-ratio: 2 / 3; }
.landscape .card-art { aspect-ratio: 16 / 9; }
.card-title { margin-top: 9px; font-weight: 600; font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-sub { color: var(--muted); font-size: 13px; margin-top: 2px; display: flex; gap: 8px; align-items: center; }
.card-fallback {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 14px; text-align: center;
  font-family: var(--font-display); font-weight: 700; font-size: 17px; line-height: 1.15; color: var(--ink-2);
  background: linear-gradient(160deg, var(--surface-2), var(--surface-3));
}
.card-badge { position: absolute; top: 8px; left: 8px; z-index: 2; }
.card-rating { position: absolute; top: 8px; right: 8px; z-index: 2; display: inline-flex; align-items: center; gap: 3px; padding: 3px 7px; border-radius: 6px; background: rgb(20 18 15 / .72); color: #f2c66b; font-size: 12px; font-weight: 700; }
.card-rating .ico { width: 12px; height: 12px; }
.progress { height: 4px; border-radius: 4px; background: rgb(255 255 255 / .3); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.card-art .progress { position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 2; }
.card-art .play-hint {
  position: absolute; inset: 0; display: grid; place-items: center; z-index: 1; opacity: 0;
  background: rgb(var(--scrim) / .35); color: #fff; transition: opacity .2s var(--ease);
}
.card:hover .play-hint, .card:focus-visible .play-hint { opacity: 1; }
.play-hint span { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: rgb(255 255 255 / .92); color: #1f1b16; }
.play-hint .ico { width: 22px; height: 22px; margin-left: 3px; }
.continue .card-art::after { content: ''; position: absolute; inset: 50% 0 0; background: linear-gradient(transparent, rgb(0 0 0 / .55)); }

/* Zendertegel */
.channel-tile .card-art { aspect-ratio: 16 / 10; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); }
.channel-tile .card-art img { width: 62%; height: 62%; object-fit: contain; }
.channel-tile .card-fallback { background: var(--surface); font-size: 15px; }

/* Grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(128px, 15vw, 182px), 1fr)); gap: 26px 16px; padding: 4px var(--gutter) 24px; }
.grid.channels-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.sentinel { height: 1px; }

/* ---------- Live TV ---------- */

.live-layout { display: grid; grid-template-columns: 240px minmax(320px, 1fr) minmax(360px, 1.15fr); height: calc(100vh - var(--nav-h)); border-top: 1px solid var(--line); }
.live-cats { overflow-y: auto; padding: 14px 10px 30px; border-right: 1px solid var(--line); background: var(--bg-deep); }
.live-cats h3 { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); margin: 12px 10px 8px; font-weight: 700; }
.cat-btn { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-s); color: var(--ink-2); font-weight: 500; font-size: 14px; text-align: left; }
.cat-btn:hover { background: var(--surface-2); }
.cat-btn.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.cat-btn span:first-of-type { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-btn .count { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.cat-btn.active .count { color: inherit; opacity: .7; }

.live-list { overflow-y: auto; border-right: 1px solid var(--line); }
.live-list-head { position: sticky; top: 0; z-index: 2; background: var(--bg); padding: 14px 16px 10px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.live-list-head h2 { font-family: var(--font-display); font-size: 22px; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-input { height: 36px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); padding: 0 14px; width: 150px; color: var(--ink); }
.channel-row {
  width: 100%; display: grid; grid-template-columns: 34px 56px 1fr auto; align-items: center; gap: 12px;
  padding: 10px 16px; text-align: left; border-bottom: 1px solid var(--line); transition: background .12s;
}
.channel-row:hover { background: var(--surface); }
.channel-row.active { background: var(--accent-soft); }
.channel-row.active .ch-name { color: var(--accent-text); }
.ch-num { font-variant-numeric: tabular-nums; color: var(--faint); font-size: 13px; font-weight: 600; text-align: right; }
.ch-logo { width: 56px; height: 40px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; }
.ch-logo img { max-width: 80%; max-height: 76%; object-fit: contain; }
.ch-logo b { font-family: var(--font-display); font-size: 13px; color: var(--muted); }
.ch-main { min-width: 0; }
.ch-name { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-now { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.ch-bar { height: 3px; border-radius: 3px; background: var(--surface-3); margin-top: 6px; overflow: hidden; max-width: 220px; }
.ch-bar i { display: block; height: 100%; background: var(--accent); }
.fav-toggle { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--faint); }
.fav-toggle:hover { color: var(--ink); background: var(--surface-2); }
.fav-toggle.on { color: var(--live); }
.fav-toggle.on .ico { fill: currentColor; }

.live-preview { overflow-y: auto; padding: 18px; background: var(--bg-deep); }
.preview-frame { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius-l); overflow: hidden; background: #0d0c0a; }
.preview-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: #b9b0a3; padding: 24px; }
.preview-empty .ico { width: 34px; height: 34px; margin: 0 auto 10px; color: #7d7568; }
.preview-info { padding: 18px 4px 0; }
.preview-info h2 { font-family: var(--font-display); font-size: 28px; line-height: 1.1; margin: 8px 0 6px; }
.preview-actions { display: flex; gap: 8px; margin: 14px 0 20px; flex-wrap: wrap; }
.epg-list { display: grid; gap: 2px; }
.epg-item { display: grid; grid-template-columns: 58px 1fr; gap: 12px; padding: 12px; border-radius: var(--radius-s); }
.epg-item.now { background: var(--surface); }
.epg-time { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--muted); font-size: 13.5px; padding-top: 1px; }
.epg-item.now .epg-time { color: var(--accent-text); }
.epg-title { font-weight: 600; }
.epg-desc { color: var(--muted); font-size: 13.5px; margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

@media (max-width: 1180px) {
  .live-layout { grid-template-columns: 210px 1fr; }
  .live-preview { display: none; }
}
@media (max-width: 860px) {
  .live-layout { display: block; height: auto; border-top: 0; }
  .live-cats { display: none; }
  .live-list { border-right: 0; overflow: visible; }
  .live-list-head { top: var(--nav-h); }
  .channel-row { grid-template-columns: 50px 1fr auto; padding: 10px var(--gutter); }
  .ch-num { display: none; }
}
.mobile-cats { display: none; }
@media (max-width: 860px) { .mobile-cats { display: flex; } }

/* ---------- Detail ---------- */

.detail { position: fixed; inset: 0; z-index: 60; overflow-y: auto; background: var(--bg); animation: sheetIn .38s var(--ease); overscroll-behavior: contain; }
@keyframes sheetIn { from { opacity: 0; transform: translateY(18px); } }
.detail-hero { position: relative; min-height: min(78vh, 680px); display: flex; align-items: flex-end; color: #fff; background: #1a1712; overflow: hidden; }
.detail-hero .hero-media img { animation: none; }
.detail-hero::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgb(var(--scrim) / .88) 0%, rgb(var(--scrim) / .5) 45%, rgb(var(--scrim) / .1) 80%), linear-gradient(0deg, rgb(var(--hero-fade)) 0%, transparent 30%);
}
.detail-close { position: absolute; top: 16px; left: var(--gutter); z-index: 3; }
.detail-body { position: relative; z-index: 1; display: grid; grid-template-columns: auto 1fr; gap: 34px; align-items: end; padding: 90px var(--gutter) 46px; width: 100%; }
.detail-poster { width: clamp(150px, 17vw, 240px); aspect-ratio: 2 / 3; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); box-shadow: 0 12px 40px rgb(0 0 0 / .3); }
.detail-poster img { width: 100%; height: 100%; object-fit: cover; }
.detail-info { max-width: 760px; }
.detail-info .hero-title { font-size: clamp(32px, 5vw, 62px); }
.detail-section { padding: 10px var(--gutter) 40px; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 48px; }
.facts { display: grid; gap: 14px; align-content: start; font-size: 14px; }
.facts dt { color: var(--faint); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.facts dd { margin: 3px 0 0; color: var(--ink-2); }
@media (max-width: 860px) {
  .detail-body { grid-template-columns: 1fr; padding-top: 120px; }
  .detail-poster { display: none; }
  .detail-section { grid-template-columns: 1fr; gap: 24px; }
}

.season-tabs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin-bottom: 16px; }
.episode {
  width: 100%; display: grid; grid-template-columns: 34px clamp(130px, 18vw, 200px) 1fr; gap: 16px; align-items: center;
  padding: 14px; border-radius: var(--radius); text-align: left; transition: background .15s;
}
.episode:hover { background: var(--surface); }
.ep-num { font-family: var(--font-display); font-size: 22px; color: var(--faint); text-align: center; }
.ep-thumb { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius-s); overflow: hidden; background: var(--surface-2); }
.ep-thumb img, .detail-poster img, .hero-media img { opacity: 0; transition: opacity .5s var(--ease); }
.ep-thumb img.loaded, .detail-poster img.loaded, .hero-media img.loaded { opacity: 1; }
.ep-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ep-thumb .progress { position: absolute; left: 8px; right: 8px; bottom: 8px; }
.ep-title { font-weight: 600; display: flex; justify-content: space-between; gap: 12px; }
.ep-title small { color: var(--muted); font-weight: 500; white-space: nowrap; }
.ep-plot { color: var(--muted); font-size: 13.5px; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 600px) {
  .episode { grid-template-columns: 120px 1fr; }
  .ep-num { display: none; }
}

/* ---------- Onboarding & instellingen ---------- */

.welcome { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.welcome-art { position: relative; overflow: hidden; background: #1b1914; color: #f3ede3; padding: 48px clamp(28px, 5vw, 72px); display: flex; flex-direction: column; justify-content: space-between; }
.welcome-art .wordmark { color: #f3ede3; }
.welcome-art .wordmark small { color: #9ee0ae; }
.welcome-art h1 { font-family: var(--font-display); font-size: clamp(40px, 5.4vw, 74px); line-height: .98; letter-spacing: -.02em; margin: 0 0 18px; max-width: 12ch; }
.welcome-art p { color: #c5bcae; font-size: 17px; max-width: 42ch; margin: 0; }
.welcome-art .pitch { position: relative; z-index: 1; }
.welcome-grid { position: absolute; inset: -10% -30% -10% 35%; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; transform: rotate(-8deg); opacity: .5; pointer-events: none; }
.welcome-grid i { aspect-ratio: 2 / 3; border-radius: 12px; background: linear-gradient(160deg, #2b2720, #1f1c17); border: 1px solid #39332a; }
.welcome-grid i:nth-child(3n) { background: linear-gradient(160deg, #23412c, #1d2b20); border-color: #2f5a3b; }
.welcome-grid i:nth-child(5n) { background: linear-gradient(160deg, #3a2f22, #241e17); }
.welcome-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, #1b1914 30%, rgb(27 25 20 / .2)); pointer-events: none; }
.welcome-feats { position: relative; z-index: 1; display: flex; gap: 22px; flex-wrap: wrap; color: #a59b8c; font-size: 14px; font-weight: 500; }
.welcome-feats span { display: inline-flex; align-items: center; gap: 8px; }
.welcome-feats .ico { color: #6cc684; }
.welcome-form { display: grid; place-items: center; padding: 40px var(--gutter); }
@media (max-width: 900px) {
  .welcome { grid-template-columns: 1fr; }
  .welcome-art { min-height: 46vh; gap: 40px; }
  .welcome-grid { inset: -20% -40% -20% 30%; }
}

.panel { width: 100%; max-width: 480px; }
.panel h2 { font-family: var(--font-display); font-size: 32px; margin: 0 0 6px; letter-spacing: -.01em; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); padding: 4px; border-radius: 999px; background: var(--surface-2); margin: 22px 0 22px; }
.segmented button { height: 40px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; gap: 7px; transition: background .2s var(--ease), color .2s var(--ease); }
.segmented button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / .08); }
.segmented .ico { width: 17px; height: 17px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: 13.5px; color: var(--ink-2); }
.field small { color: var(--faint); font-size: 12.5px; }
.input {
  height: 48px; width: 100%; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface);
  padding: 0 15px; color: var(--ink); transition: border-color .15s, background .15s;
}
.input:focus { border-color: var(--accent); background: var(--bg); outline: none; }
.input::placeholder { color: var(--faint); }
.form-error { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); background: color-mix(in srgb, var(--live) 12%, transparent); color: var(--live); font-weight: 500; font-size: 14px; margin-bottom: 14px; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }
.form-actions .btn { flex: 1; height: 50px; }
.fine { color: var(--faint); font-size: 12.5px; margin-top: 18px; line-height: 1.5; }

.settings { padding: 8px var(--gutter) 40px; display: grid; gap: 34px; max-width: 920px; }
.settings h3 { font-family: var(--font-display); font-size: 24px; margin: 0 0 12px; }
.list-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); overflow: hidden; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; }
.list-item .desc { color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); flex: none; }
.src-icon.on { background: var(--accent-soft); color: var(--accent-text); }
.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--accent-soft); color: var(--accent-text); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat b { display: block; font-family: var(--font-display); font-size: 24px; }
.stat span { color: var(--muted); font-size: 13px; }

.modal-back { position: fixed; inset: 0; z-index: 80; background: rgb(var(--scrim) / .5); display: grid; place-items: center; padding: 20px; animation: fade .2s; }
.modal { background: var(--bg); border-radius: var(--radius-l); padding: 28px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; animation: sheetIn .3s var(--ease); }
@keyframes fade { from { opacity: 0; } }

/* ---------- Leeg / laden ---------- */

.empty { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 80px var(--gutter); color: var(--muted); }
.empty .ico { width: 40px; height: 40px; color: var(--faint); }
.empty h3 { font-family: var(--font-display); font-size: 24px; color: var(--ink); margin: 6px 0 0; }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%); background-size: 200% 100%; animation: shimmer 1.4s infinite linear; border-radius: var(--radius); }
@keyframes shimmer { to { background-position: -200% 0; } }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgb(255 255 255 / .2); border-top-color: currentColor; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-page { min-height: 70vh; display: grid; place-items: center; color: var(--accent); }
.loading-page .spinner { border-color: var(--surface-3); border-top-color: var(--accent); }

.toast {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 200;
  background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: 999px; font-weight: 600; font-size: 14px;
  animation: toastIn .3s var(--ease); max-width: calc(100vw - 32px);
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } }
@media (max-width: 860px) { .toast { bottom: calc(90px + env(safe-area-inset-bottom)); } }

/* =========================================================
   LiveBall Player — onze eigen speler
   ========================================================= */

.lbp { position: fixed; inset: 0; z-index: 100; background: #000; color: #fff; overflow: hidden; user-select: none; font-family: var(--font-ui); }
.lbp.embedded { position: absolute; z-index: 1; }
.lbp video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.lbp.fill video { object-fit: cover; }
.lbp.idle { cursor: none; }

.lbp-shade { position: absolute; inset: 0; pointer-events: none; opacity: 1; transition: opacity .35s var(--ease);
  background: linear-gradient(rgb(0 0 0 / .6), transparent 22%, transparent 62%, rgb(0 0 0 / .78)); }
.lbp.idle .lbp-shade, .lbp.idle .lbp-top, .lbp.idle .lbp-bottom, .lbp.idle .lbp-center { opacity: 0; pointer-events: none; }

.lbp-top { position: absolute; inset: 0 0 auto; display: flex; align-items: center; gap: 14px; padding: 18px clamp(16px, 3vw, 36px); transition: opacity .35s var(--ease); }
.lbp-title { min-width: 0; flex: 1; }
.lbp-title b { display: block; font-family: var(--font-display); font-size: clamp(18px, 2vw, 24px); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lbp-title span { display: block; color: rgb(255 255 255 / .72); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lbp-btn { width: 46px; height: 46px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; transition: background .15s, transform .15s; flex: none; }
.lbp-btn:hover { background: rgb(255 255 255 / .14); }
.lbp-btn:active { transform: scale(.92); }
.lbp-btn .ico { width: 24px; height: 24px; }
.lbp-btn.on { color: #8fdca3; }
.lbp-btn:focus-visible { outline: 2.5px solid #8fdca3; outline-offset: 0; }

.lbp-center { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; transition: opacity .35s var(--ease); }
.lbp-center .lbp-big { pointer-events: auto; width: 84px; height: 84px; border-radius: 50%; background: rgb(255 255 255 / .16); display: grid; place-items: center; transition: transform .2s var(--ease), background .2s; }
.lbp-center .lbp-big:hover { background: rgb(255 255 255 / .26); transform: scale(1.05); }
.lbp-center .lbp-big .ico { width: 36px; height: 36px; }
.lbp-center .lbp-big .i-play { margin-left: 5px; }
.lbp.playing .lbp-big { opacity: 0; pointer-events: none; }
.lbp-spinner { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; opacity: 0; transition: opacity .25s; }
.lbp.buffering .lbp-spinner { opacity: 1; transition-delay: .25s; }
.lbp.buffering .lbp-big { opacity: 0; }
.lbp-spinner .spinner { width: 54px; height: 54px; border-width: 4px; border-color: rgb(255 255 255 / .18); border-top-color: #8fdca3; }

.lbp-bottom { position: absolute; inset: auto 0 0; padding: 0 clamp(16px, 3vw, 36px) clamp(14px, 2.4vw, 26px); transition: opacity .35s var(--ease); }
.lbp-now { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 14px; color: rgb(255 255 255 / .82); }
.lbp-now b { color: #fff; font-weight: 600; }
.lbp-seek { position: relative; height: 22px; display: flex; align-items: center; cursor: pointer; touch-action: none; }
.lbp-rail { position: relative; width: 100%; height: 4px; border-radius: 4px; background: rgb(255 255 255 / .22); transition: height .15s var(--ease); }
.lbp-seek:hover .lbp-rail, .lbp-seek.dragging .lbp-rail { height: 6px; }
.lbp-buffered { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: rgb(255 255 255 / .35); }
.lbp-played { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--accent, #45a862); }
.lbp-knob { position: absolute; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: #fff; transform: scale(0); transition: transform .15s var(--ease); }
.lbp-seek:hover .lbp-knob, .lbp-seek.dragging .lbp-knob, .lbp-seek:focus-visible .lbp-knob { transform: scale(1); }
.lbp-hover-time { position: absolute; bottom: 24px; transform: translateX(-50%); background: rgb(20 18 15 / .9); padding: 4px 8px; border-radius: 6px; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; opacity: 0; pointer-events: none; }
.lbp-seek:hover .lbp-hover-time, .lbp-seek.dragging .lbp-hover-time { opacity: 1; }
.lbp-bar { display: flex; align-items: center; gap: 4px; margin-top: 6px; }
.lbp-time { font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 600; color: rgb(255 255 255 / .9); margin: 0 10px; white-space: nowrap; }
.lbp-spacer { flex: 1; }
.lbp-vol { display: flex; align-items: center; }
.lbp-vol input { width: 0; opacity: 0; transition: width .2s var(--ease), opacity .2s; accent-color: #fff; }
.lbp-vol:hover input, .lbp-vol:focus-within input { width: 90px; opacity: 1; margin-right: 8px; }
.lbp-golive { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: rgb(255 255 255 / .75); }
.lbp-golive::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: rgb(255 255 255 / .5); }
.lbp-golive.at-live { color: #fff; }
.lbp-golive.at-live::before { background: var(--live, #e5503f); animation: pulse 1.6s infinite; }
.lbp-golive:hover { background: rgb(255 255 255 / .12); }
.lbp-quality { font-size: 11px; font-weight: 800; letter-spacing: .06em; padding: 3px 6px; border-radius: 5px; border: 1.5px solid rgb(255 255 255 / .7); margin: 0 6px; }

.lbp-menu { position: absolute; right: clamp(16px, 3vw, 36px); bottom: 86px; min-width: 240px; max-width: calc(100% - 32px); max-height: 60%; overflow-y: auto; background: rgb(24 22 18 / .96); border-radius: 14px; padding: 8px; animation: sheetIn .2s var(--ease); z-index: 5; }
.lbp-menu h4 { margin: 8px 12px 6px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: rgb(255 255 255 / .5); }
.lbp-menu button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; text-align: left; font-size: 14.5px; color: #fff; }
.lbp-menu button:hover, .lbp-menu button:focus-visible { background: rgb(255 255 255 / .1); outline: none; }
.lbp-menu button .ico { width: 18px; height: 18px; color: #8fdca3; visibility: hidden; }
.lbp-menu button.sel .ico { visibility: visible; }
.lbp-menu small { margin-left: auto; color: rgb(255 255 255 / .5); }

.lbp-error { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; background: rgb(0 0 0 / .78); z-index: 4; }
.lbp-error > div > .ico { width: 40px; height: 40px; color: #f2c66b; margin: 0 auto 12px; }
.lbp-error h3 { font-family: var(--font-display); font-size: 26px; margin: 0 0 6px; }
.lbp-error p { color: rgb(255 255 255 / .7); margin: 0 auto 20px; max-width: 46ch; }
.lbp-error .row-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.lbp-osd { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: rgb(20 18 15 / .78); padding: 14px 22px; border-radius: 14px; font-weight: 700; font-size: 18px; display: inline-flex; align-items: center; gap: 10px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.lbp-osd.show { opacity: 1; }

.lbp-zap { position: absolute; left: clamp(16px, 3vw, 36px); bottom: 110px; display: flex; align-items: center; gap: 14px; background: rgb(20 18 15 / .9); padding: 12px 18px 12px 12px; border-radius: 14px; animation: sheetIn .25s var(--ease); max-width: min(520px, calc(100% - 32px)); }
.lbp-zap .ch-logo { background: #26221c; border-color: #39332a; }
.lbp-zap b { display: block; font-size: 16px; }
.lbp-zap span { color: rgb(255 255 255 / .7); font-size: 13.5px; }

.lbp-next { position: absolute; right: clamp(16px, 3vw, 36px); bottom: 110px; width: min(340px, calc(100% - 32px)); background: rgb(20 18 15 / .94); border-radius: 14px; padding: 16px; animation: sheetIn .3s var(--ease); z-index: 4; }
.lbp-next small { color: rgb(255 255 255 / .55); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.lbp-next b { display: block; font-size: 16px; margin: 4px 0 12px; }
.lbp-next .btns { display: flex; gap: 8px; }
.lbp-next .btns .btn { height: 40px; flex: 1; }
.lbp-next-fill { position: absolute; inset: 0; background: rgb(255 255 255 / .18); transform-origin: left; border-radius: inherit; }

.lbp.embedded .lbp-top .lbp-back, .lbp.embedded .lbp-title, .lbp.embedded .lbp-hide-embedded { display: none; }
.lbp.embedded .lbp-bottom { padding: 0 14px 10px; }
.lbp.embedded .lbp-center .lbp-big { width: 64px; height: 64px; }
.lbp.embedded .lbp-btn { width: 40px; height: 40px; }
.lbp.embedded .lbp-btn .ico { width: 21px; height: 21px; }

@media (max-width: 600px) {
  .lbp-hide-sm { display: none !important; }
  .lbp-btn { width: 42px; height: 42px; }
}

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

/* Koppelcode */
.pair-input { font: 700 24px/1 var(--font-ui); letter-spacing: .18em; text-transform: uppercase; text-align: center; }
.pair-code {
  font: 700 clamp(36px, 9vw, 52px)/1.1 var(--font-ui); letter-spacing: .14em; text-align: center;
  color: var(--accent-text); background: var(--accent-soft); border-radius: var(--radius); padding: 18px 12px; margin: 16px 0;
  user-select: all;
}
.pair-steps { margin: 0 0 12px; padding-left: 22px; }
.pair-steps li { margin: 6px 0; }
.pair-switch {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 16px; padding: 6px 2px;
  background: none; border: 0; color: var(--accent-text); font: 600 15px/1.2 var(--font-ui); cursor: pointer; border-radius: 8px;
}
.pair-switch .ico, .pair-switch svg { width: 18px; height: 18px; }
.pair-switch:hover { text-decoration: underline; }
.pair-switch:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
