:root {
  color-scheme: dark;
  --bg: #0e0f13;
  --panel: #171920;
  --panel-2: #20232c;
  --line: #2a2e39;
  --text: #ecedf1;
  --muted: #9a9fad;
  --accent: #e50914;
  --accent-2: #ff3b47;
  --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2 { margin: 0; line-height: 1.2; }
button, select, input { font: inherit; color: inherit; }

/* ---------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 12px clamp(16px, 4vw, 40px);
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  background: rgba(14, 15, 19, 0.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { white-space: nowrap; }
.wordmark {
  color: var(--accent); font-weight: 900; text-transform: uppercase; letter-spacing: 0.04em;
  font-size: 26px; display: inline-block; transform: scaleY(1.15);
}
.tabs { display: flex; gap: 4px; }
.tabs a { padding: 6px 12px; border-radius: 999px; color: var(--muted); }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); background: var(--panel-2); }
#search {
  flex: 1 1 220px; max-width: 460px; margin-left: auto;
  padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel); outline: none;
}
#search:focus { border-color: var(--muted); }
.link { background: none; border: 0; color: var(--muted); cursor: pointer; text-decoration: underline; padding: 0; }

main { padding: 24px clamp(16px, 4vw, 40px) 40px; min-height: 70vh; }
footer { padding: 16px clamp(16px, 4vw, 40px) 28px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }

.loading, .empty { padding: 60px 0; text-align: center; color: var(--muted); }

/* ---------- buttons & inputs */
.button {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-2); font-weight: 600; cursor: pointer; white-space: nowrap;
}
.button:hover { border-color: var(--muted); }
.button.primary, button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.button.primary:hover, button.primary:hover { background: var(--accent-2); }
.button.ghost { background: transparent; }
.button.disabled { opacity: 0.35; cursor: default; }
select {
  padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel);
}

/* ---------- cards & rows */
.row { margin-bottom: 34px; }
.row-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.row-head h2 { font-size: 19px; }
.row-head a { color: var(--muted); font-size: 14px; }
.row-items {
  display: grid; grid-auto-flow: column; grid-auto-columns: clamp(120px, 14vw, 170px);
  gap: 14px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity;
}
.row-items .card { scroll-snap-align: start; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 22px 16px; }

.card { display: block; min-width: 0; }
.poster {
  position: relative; aspect-ratio: 2 / 3; border-radius: var(--radius); overflow: hidden;
  background: var(--panel-2); transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card:hover .poster { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5); }
.poster img { width: 100%; height: 100%; object-fit: cover; }
.poster-title {
  position: absolute; inset: auto 0 0; padding: 30px 10px 10px; font-weight: 700; font-size: 14px; line-height: 1.25;
  background: linear-gradient(transparent, rgba(0, 0, 0, .85)); text-shadow: 0 1px 2px #000;
}
.noposter { display: grid; place-items: center; height: 100%; padding: 12px; text-align: center; color: var(--muted); font-size: 13px; }
.badge, .rating {
  position: absolute; top: 6px; padding: 2px 7px; border-radius: 6px; font-size: 11px; font-weight: 700;
  background: rgba(0, 0, 0, 0.72);
}
.badge { left: 6px; }
.badge.cinema { left: auto; right: 6px; color: #ffb3b8; }
.cinema-note { flex-basis: 100%; margin: 4px 0 0; color: #ffb3b8; font-size: 14px; }
.badge.tv { color: #7cc4ff; }
.badge.movie { color: #ffd27c; }
.rating { left: 6px; top: auto; bottom: 6px; }
.remove {
  position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%;
  border: 0; background: rgba(0, 0, 0, 0.75); cursor: pointer; font-size: 16px; line-height: 1;
}
.card-title { margin-top: 8px; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-sub { color: var(--muted); font-size: 12px; }

/* ---------- browse filters */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 24px; }
.filters h1 { font-size: 24px; margin-right: auto; flex-basis: 100%; margin-bottom: 6px; }
.segmented { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.segmented button { border: 0; background: none; padding: 5px 12px; border-radius: 6px; cursor: pointer; color: var(--muted); }
.segmented button.active { background: var(--panel-2); color: var(--text); }
.more { min-height: 40px; }

/* ---------- details */
.hero { position: relative; margin: -24px calc(-1 * clamp(16px, 4vw, 40px)) 28px; overflow: hidden; }
.backdrop {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.28;
  mask-image: linear-gradient(to bottom, #000 40%, transparent);
}
.hero-body {
  position: relative; display: flex; gap: 32px; align-items: flex-start;
  padding: 48px clamp(16px, 4vw, 40px) 24px;
}
.hero-poster { width: clamp(140px, 22vw, 260px); border-radius: var(--radius); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6); }
.hero-text { flex: 1; max-width: 760px; }
.hero-text h1 { font-size: clamp(26px, 4vw, 42px); }
.original { color: var(--muted); margin-top: 4px; }
.facts { color: var(--muted); margin: 10px 0 14px; }
.tagline { font-style: italic; color: var(--muted); }
.overview { font-size: 16px; }
.cast { color: var(--muted); font-size: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

.season-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.season-tabs button {
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); cursor: pointer;
}
.season-tabs button.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.episodes { display: grid; gap: 10px; }
.episode {
  display: flex; gap: 16px; padding: 10px; border-radius: var(--radius); background: var(--panel);
  border: 1px solid transparent;
}
a.episode:hover { border-color: var(--line); background: var(--panel-2); }
.episode.current { border-color: var(--accent); }
.episode.unaired { opacity: 0.45; }
.still { position: relative; flex: 0 0 clamp(120px, 22vw, 220px); aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; background: var(--panel-2); }
.still img { width: 100%; height: 100%; object-fit: cover; }
.play {
  position: absolute; inset: 0; display: grid; place-items: center; font-size: 28px;
  background: rgba(0, 0, 0, 0.35); opacity: 0; transition: opacity 0.15s;
}
a.episode:hover .play { opacity: 1; }
.ep-text { min-width: 0; }
.ep-title { font-weight: 600; }
.ep-meta { color: var(--muted); font-size: 13px; }
.ep-text p { margin: 6px 0 0; color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.button.done { border-color: #2e7d4f; color: #7ee2a8; background: rgba(46, 125, 79, 0.15); }
.button.small { padding: 6px 12px; font-size: 13px; font-weight: 500; }
.up-next { display: contents; }
.season-actions { display: flex; justify-content: flex-end; }
.episode { position: relative; }
.episode.seen .still img { opacity: 0.55; }
.seen-badge {
  position: absolute; left: 6px; bottom: 6px; padding: 2px 7px; border-radius: 6px;
  font-size: 11px; font-weight: 700; background: rgba(0, 0, 0, 0.75); color: #7ee2a8;
}
.check {
  align-self: center; flex: 0 0 auto; width: 34px; height: 34px; margin-left: auto; border-radius: 50%;
  border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; font-size: 15px;
}
.check:hover { border-color: var(--muted); color: var(--text); }
.check.on { background: #2e7d4f; border-color: #2e7d4f; color: #fff; }

/* ---------- player */
.watch-bar { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.back { font-size: 22px; padding: 2px 10px; border-radius: 8px; background: var(--panel-2); }
.watch-title { flex: 1; min-width: 0; }
.watch-title span { color: var(--muted); }
.watch-title .ch, .watch-title .live-dot { color: #fff; }
.stage { display: flex; flex-direction: column; gap: 12px; }
.player {
  position: relative; width: 100%; max-height: calc(100vh - 230px); aspect-ratio: 16 / 9;
  background: #000; border-radius: var(--radius); overflow: hidden; margin: 0 auto;
}
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.controls-main, .controls-side { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.button.next { font-size: 16px; padding: 12px 22px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.button.next.ready { animation: glow 1.6s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 6px rgba(229, 9, 20, 0.35); } }
.next-name { font-weight: 500; opacity: 0.9; }
.source-pick { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.source-pick select { color: var(--text); font-weight: 600; }
.keys { color: var(--muted); font-size: 12px; margin: 10px 0 0; }

/* Our fullscreen: the page itself, with the control bar under the video. */
body.theater .topbar, body.theater footer, body.theater .watch-bar, body.theater .keys { display: none; }
body.theater main { padding: 0; min-height: 0; }
body.theater .stage { height: 100vh; gap: 0; background: #000; }
body.theater .player { flex: 1; max-height: none; aspect-ratio: auto; border-radius: 0; }
body.theater .controls { padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); background: #0b0b0d; }

/* ---------- mediathek */
.ch { display: inline-block; padding: 1px 7px; border-radius: 5px; font-size: 11px; font-weight: 800; letter-spacing: .02em; color: #fff; background: #555; white-space: nowrap; }
.ch-ard { background: #1d4f91; } .ch-zdf { background: #f07d00; } .ch-arte { background: #e3471c; }
.ch-srf { background: #af001e; } .ch-3sat { background: #6b8e23; } .ch-orf { background: #c8102e; }
.msearch { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 8px 0 18px; }
.msearch input { flex: 1 1 280px; padding: 10px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 0; cursor: pointer; padding: 6px 12px; font-size: 13px; opacity: .35; }
.chip.on { opacity: 1; }
.mheading { font-size: 19px; margin-bottom: 12px; }
.mlist { display: grid; gap: 8px; }
.mrow { display: block; padding: 12px 14px; border-radius: var(--radius); background: var(--panel); border: 1px solid transparent; }
.mrow:hover { border-color: var(--line); background: var(--panel-2); }
.mrow-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mrow-topic { color: var(--muted); font-size: 13px; }
.region { margin-left: auto; font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 0 6px; }
.mrow-title { font-weight: 600; margin-top: 4px; }
.mrow-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.mrow p { margin: 6px 0 0; color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mtile { display: flex; flex-direction: column; gap: 6px; min-height: 120px; padding: 12px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.mtile .ch { align-self: flex-start; }
.mtile-topic { color: var(--muted); font-size: 12px; }
.mtile-title { font-weight: 600; font-size: 14px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.progress { margin-top: auto; height: 4px; border-radius: 2px; background: var(--panel-2); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); }
.live-tile { display: flex; flex-direction: column; gap: 6px; padding: 14px; min-height: 96px; border-radius: var(--radius); background: linear-gradient(135deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); }
.live-tile strong { font-size: 18px; }
.live-tile small { color: var(--muted); font-size: 12px; }
.live-dot { align-self: flex-start; font-size: 10px; font-weight: 800; letter-spacing: .08em; color: #fff; background: var(--accent); padding: 1px 6px; border-radius: 4px; }
.player video { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; }
video::cue { background: rgba(0, 0, 0, .65); color: #fff; font-size: 1.05em; line-height: 1.35; }
.media-status { margin: 0; color: var(--muted); font-size: 14px; }
.via-de { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.media-info { margin-top: 16px; max-width: 860px; }
.media-info p { color: var(--muted); }
.media-info a { text-decoration: underline; color: var(--muted); font-size: 13px; }

/* ---------- sources settings */
.settings { max-width: 860px; }
.settings h1 { font-size: 24px; margin-bottom: 8px; }
.hint { color: var(--muted); }
code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.source-list { display: grid; gap: 12px; margin: 18px 0; }
.source { display: grid; gap: 10px; padding: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.source-head { display: flex; gap: 8px; }
.source-head input { flex: 1; font-weight: 600; }
.source label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; }
.source input { width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); }
.button:disabled { opacity: 0.35; cursor: default; }
.logout { margin-top: 40px; }
.form-msg { margin: 0; align-self: center; color: var(--muted); }

/* ---------- birthday */
.birthday {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px;
  background: rgba(8, 8, 10, 0.82); backdrop-filter: blur(6px); animation: fade-in 0.5s ease;
  transition: opacity 0.4s;
}
.birthday.leaving { opacity: 0; }
.confetti { position: absolute; inset: 0; pointer-events: none; }
.birthday-card {
  position: relative; max-width: 460px; text-align: center; padding: 36px 32px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); animation: pop-in 0.6s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.birthday-card h1 { font-size: clamp(28px, 6vw, 38px); margin-bottom: 14px; }
.birthday-card .wordmark { font-size: inherit; transform: none; }
.birthday-card p { color: var(--muted); margin: 8px 0; }
.birthday-card .signature { color: var(--text); font-style: italic; margin: 18px 0 22px; }
.cake { font-size: 64px; line-height: 1; margin-bottom: 10px; animation: bounce 1.6s ease-in-out infinite; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { transform: scale(0.6); opacity: 0; } }
@keyframes bounce { 50% { transform: translateY(-8px); } }

/* ---------- login */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: min(360px, 100%); display: grid; gap: 14px; padding: 32px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
}
.login-card h1 { font-size: 34px; text-align: center; margin-bottom: 8px; }
.login-card label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
.login-card input { padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); }
.login-card button { padding: 11px; border: 0; border-radius: 8px; font-weight: 700; cursor: pointer; }
.error { margin: 0; padding: 10px 12px; border-radius: 8px; background: rgba(229, 9, 20, 0.15); color: #ff9aa0; font-size: 14px; }

.gift-card { text-align: center; }
.gift-card .cake { font-size: 56px; line-height: 1; margin: 6px 0; }
.gift-card h1:not(.wordmark) { font-size: 24px; }
.gift-card p { color: var(--muted); margin: 0; }
.gift-card form, .gift-card .button { display: grid; margin-top: 6px; }
.gift-card .button { justify-content: center; padding: 14px; font-size: 16px; }

@media (max-width: 700px) {
  .topbar { gap: 10px; }
  .tabs { order: 3; width: 100%; }
  #search { order: 2; margin-left: 0; }
  .hero-body { flex-direction: column; padding-top: 24px; }
  .hero-poster { width: 120px; }
  .episode { flex-direction: column; }
  .still { flex-basis: auto; width: 100%; }
  .player { max-height: none; }
  .controls, .controls-main { width: 100%; }
  .controls-main .button.next { flex: 1 1 100%; justify-content: center; order: -1; }
}
