:root {
  --bg: #0b0d12;
  --bg-2: #12151d;
  --bg-3: #1a1e29;
  --line: #262b38;
  --text: #eef0f5;
  --muted: #9aa1b2;
  --accent: #ff4f5e;
  --accent-2: #ff8a3d;
  --accent-3: #ff3d6e;
  --grad: linear-gradient(135deg, var(--accent-2), var(--accent-3));
  --header-bg: linear-gradient(to bottom, rgba(11,13,18,.95), rgba(11,13,18,.75));
  --btn-bg: rgba(255,255,255,.08);
  --btn-bg-hover: rgba(255,255,255,.14);
  --edge: rgba(255,255,255,.04);
  --radius: 12px;
  --gutter: clamp(16px, 4vw, 48px);
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
/* Light theme (Settings → Theme). The hero banner stays dark because its text sits on the picture. */
:root[data-theme="light"] {
  --bg: #f5f6fa; --bg-2: #ffffff; --bg-3: #e9ecf3; --line: #d9dde7; --text: #12141b; --muted: #5d6576;
  --header-bg: linear-gradient(to bottom, rgba(245,246,250,.96), rgba(245,246,250,.82));
  --btn-bg: rgba(0,0,0,.05); --btn-bg-hover: rgba(0,0,0,.09); --edge: rgba(0,0,0,.06);
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="light"] .hero { --text: #eef0f5; --muted: #c9cedb; --btn-bg: rgba(255,255,255,.12); --btn-bg-hover: rgba(255,255,255,.2); --line: rgba(255,255,255,.2); color: var(--text); }
:root[data-theme="light"] .hero::after { background: linear-gradient(to top, rgba(11,13,18,.85) 2%, transparent 55%), linear-gradient(to right, rgba(11,13,18,.9), transparent 70%); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 Inter, system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
img { display: block; }
[hidden] { display: none !important; }

/* header */
.top {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 28px;
  padding: 14px var(--gutter);
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--edge);
}
.logo { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 21px; letter-spacing: -.02em; }
.logo svg { width: 32px; height: 32px; }
.logo span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo.small { font-size: 17px; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { padding: 7px 13px; border-radius: 999px; color: var(--muted); font-weight: 500; white-space: nowrap; transition: .15s; }
.nav a:hover { color: var(--text); }
.nav a.on { color: var(--text); background: var(--bg-3); }
.top-right { display: flex; gap: 8px; }
.icon-btn {
  display: grid; place-items: center; width: 38px; height: 38px;
  border-radius: 50%; border: 1px solid var(--line); background: var(--bg-2);
}
.icon-btn:hover { background: var(--bg-3); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

@media (max-width: 720px) {
  .top { flex-wrap: wrap; gap: 10px 14px; }
  .nav { order: 3; flex-basis: 100%; }
  .top-right { margin-left: auto; }
}

/* hero */
.hero { position: relative; min-height: min(78vh, 640px); display: flex; align-items: flex-end; overflow: hidden; }
.hero-bg { position: absolute; inset: -40px; background-size: cover; background-position: center; filter: blur(34px) saturate(1.2) brightness(.55); transform: scale(1.1); }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, var(--bg) 2%, transparent 55%), linear-gradient(to right, rgba(11,13,18,.9), transparent 70%); }
.hero-inner { position: relative; z-index: 1; display: flex; gap: 40px; align-items: flex-end; padding: 0 var(--gutter) 56px; width: 100%; }
.hero-poster { width: 230px; flex: none; aspect-ratio: 2/3; border-radius: var(--radius); object-fit: cover; box-shadow: 0 30px 60px rgba(0,0,0,.6); background: var(--bg-3); }
.hero-text { max-width: 640px; }
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; background: rgba(255,79,94,.15); color: #ff8b94; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.hero h1 { font-size: clamp(30px, 5vw, 54px); line-height: 1.05; margin: 14px 0 10px; letter-spacing: -.03em; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 14px; }
.meta .star { color: #ffc24b; font-weight: 600; }
.hero p { color: #c8ccd6; margin: 14px 0 22px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.btns { display: flex; flex-wrap: wrap; gap: 10px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 22px; border-radius: 999px; border: 1px solid var(--line); background: var(--btn-bg); font-weight: 600; transition: .15s; }
.btn:hover { background: var(--btn-bg-hover); }
.btn.primary { background: var(--grad); border: 0; color: #fff; box-shadow: 0 10px 30px rgba(255,79,94,.3); }
.btn.primary:hover { filter: brightness(1.08); }
.btn svg { width: 16px; height: 16px; fill: currentColor; }
@media (max-width: 720px) {
  .hero-poster { display: none; }
  .hero-inner { padding-bottom: 32px; }
}

/* rows */
.page { padding: 28px var(--gutter) 40px; }
.section { margin: 34px 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head h2 { font-size: 20px; margin: 0; letter-spacing: -.01em; }
.section-head a { color: var(--muted); font-size: 14px; }
.section-head a:hover { color: var(--text); }
.row-wrap { position: relative; }
.row { display: grid; grid-auto-flow: column; grid-auto-columns: clamp(130px, 15vw, 180px); gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding-bottom: 4px; }
.row::-webkit-scrollbar { display: none; }
.row > * { scroll-snap-align: start; }
.row.wide { grid-auto-columns: clamp(220px, 26vw, 320px); }
.arrow { position: absolute; top: 35%; z-index: 2; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(0,0,0,.7); font-size: 20px; opacity: 0; transition: .15s; }
.row-wrap:hover .arrow { opacity: 1; }
.arrow.l { left: -12px; } .arrow.r { right: -12px; }
@media (hover: none) { .arrow { display: none; } }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 22px 14px; }
@media (max-width: 480px) { .grid { grid-template-columns: repeat(2, 1fr); } }

/* cards */
.card { display: block; min-width: 0; }
.poster { position: relative; aspect-ratio: 2/3; border-radius: var(--radius); overflow: hidden; background: var(--bg-3); transition: transform .2s, box-shadow .2s; }
.card:hover .poster { transform: translateY(-4px); box-shadow: 0 16px 30px rgba(0,0,0,.5), 0 0 0 2px var(--accent); }
.poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.wide .poster, .poster.wide { aspect-ratio: 16/9; }
.gen { position: absolute; inset: 0; display: flex; align-items: flex-end; padding: 12px; font-weight: 700; font-size: 15px; line-height: 1.2; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.gen.over { z-index: 1; background: linear-gradient(to top, rgba(0,0,0,.8), transparent 60%); }
.pill, .play-ico, .bar { z-index: 2; }
.pill { position: absolute; top: 8px; left: 8px; padding: 2px 8px; border-radius: 999px; background: rgba(0,0,0,.72); font-size: 11px; font-weight: 600; }
.pill.r { left: auto; right: 8px; color: #ffc24b; }
.play-ico { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; background: rgba(0,0,0,.35); transition: .15s; }
.play-ico span { width: 48px; height: 48px; border-radius: 50%; background: var(--grad); display: grid; place-items: center; }
.play-ico svg { width: 18px; fill: #fff; margin-left: 3px; }
.card:hover .play-ico { opacity: 1; }
.bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255,255,255,.2); }
.bar i { display: block; height: 100%; background: var(--accent); }
.card-title { margin-top: 9px; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-sub { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-2); color: var(--muted); font-size: 13.5px; font-weight: 500; }
.chip:hover { color: var(--text); }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin: 6px 0 22px; }
select { background: var(--bg-2); color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; font: inherit; font-size: 14px; }
h1.page-title { font-size: clamp(26px, 4vw, 36px); margin: 4px 0 18px; letter-spacing: -.02em; }
.more { display: flex; justify-content: center; margin-top: 28px; }

/* title page */
.detail { position: relative; overflow: hidden; }
.detail .hero-bg { filter: blur(40px) brightness(.4); }
.detail-inner { position: relative; z-index: 1; display: grid; grid-template-columns: 260px 1fr; gap: 40px; padding: 48px var(--gutter) 30px; }
.detail-inner .hero-poster { width: 100%; display: block; }
.detail h1 { font-size: clamp(28px, 4.5vw, 46px); margin: 0 0 10px; line-height: 1.08; letter-spacing: -.02em; }
.desc { color: #c8ccd6; max-width: 760px; margin: 16px 0 22px; white-space: pre-line; }
.desc.clamp { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.link-btn { background: none; border: 0; color: var(--accent); padding: 0; font-weight: 600; }
.small-muted { color: var(--muted); font-size: 13px; }
@media (max-width: 720px) {
  .detail-inner { grid-template-columns: 1fr; gap: 20px; }
  .detail-inner .hero-poster { width: 150px; }
}

.episodes { display: grid; gap: 10px; }
.ep { display: grid; grid-template-columns: 34px 180px 1fr; gap: 16px; align-items: center; padding: 10px; border-radius: var(--radius); background: var(--bg-2); border: 1px solid transparent; text-align: left; width: 100%; }
.ep:hover { border-color: var(--line); background: var(--bg-3); }
.ep .n { color: var(--muted); font-weight: 700; font-size: 18px; text-align: center; }
.ep .poster { border-radius: 8px; }
.ep .t { font-weight: 600; }
@media (max-width: 560px) { .ep { grid-template-columns: 120px 1fr; } .ep .n { display: none; } }

/* empty / setup */
.empty { text-align: center; padding: 70px 20px; color: var(--muted); max-width: 560px; margin: 0 auto; }
.empty h2 { color: var(--text); font-size: 24px; margin: 14px 0 8px; }
.empty .btns { justify-content: center; margin-top: 20px; }
.empty-ico { width: 64px; height: 64px; margin: 0 auto; border-radius: 18px; display: grid; place-items: center; background: var(--bg-3); font-size: 28px; }
.note { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--muted); font-size: 14px; }
.spinner { width: 36px; height: 36px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 90px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* overlays */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(5,6,9,.88); backdrop-filter: blur(8px); overflow-y: auto; }
.search-box { max-width: 1100px; margin: 0 auto; padding: 24px var(--gutter) 60px; }
.search-head { display: flex; gap: 10px; margin-bottom: 14px; }
.search-head input { flex: 1; min-width: 0; padding: 14px 20px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-2); color: var(--text); font: inherit; font-size: 17px; outline: none; }
.search-head input:focus { border-color: var(--accent); }
.search-head .icon-btn { width: 50px; height: 50px; }
#searchResults { margin-top: 22px; }

/* player */
.player { position: fixed; inset: 0; z-index: 60; background: #000; display: flex; flex-direction: column; }
.player video { flex: 1; width: 100%; min-height: 0; background: #000; }
.player-top { position: absolute; top: 0; left: 0; right: 0; z-index: 2; display: flex; align-items: center; gap: 14px; padding: 16px 20px; background: linear-gradient(to bottom, rgba(0,0,0,.85), transparent); transition: opacity .3s; }
.player.idle .player-top, .player.idle .next-up { opacity: 0; pointer-events: none; }
.player-top .t { font-weight: 700; }
.player-top .s { color: var(--muted); font-size: 13px; }
.player-top .grow { flex: 1; min-width: 0; }
.player-top select { max-width: 200px; }
.next-up { position: absolute; right: 24px; bottom: 90px; z-index: 2; transition: opacity .3s; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 70; background: var(--bg-3); border: 1px solid var(--line); padding: 11px 18px; border-radius: 999px; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.5); max-width: calc(100% - 32px); }

.foot { padding: 30px var(--gutter) 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.foot a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }

/* series */
.hero-bg.sharp, .detail .hero-bg.sharp { inset: 0; filter: brightness(.55); transform: none; }
.detail .hero-bg.sharp { filter: brightness(.3) blur(2px); }
label.small-muted { display: inline-flex; align-items: center; gap: 8px; }
.prov-group { margin: 0 0 18px; }
.prov-label { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px; }
.prov-label.free { color: #5be39a; }
.prov-list { display: flex; flex-wrap: wrap; gap: 10px; }
.prov { display: flex; align-items: center; gap: 10px; padding: 6px 14px 6px 6px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); font-weight: 600; font-size: 14px; }
.prov:hover { border-color: var(--accent); }
.prov img { width: 34px; height: 34px; border-radius: 50%; }
.row.cast { grid-auto-columns: 120px; }
.face { width: 120px; height: 120px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; font-size: 36px; font-weight: 700; }
.face img { width: 100%; height: 100%; object-fit: cover; }
.person { text-align: center; }
.ep-desc { color: var(--muted); font-size: 13.5px; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
iframe.yt { flex: 1; width: 100%; border: 0; }

/* calendar */
.cal-nav { display: flex; align-items: center; gap: 10px; }
.cal-month { font-weight: 700; font-size: 17px; min-width: 150px; text-align: center; }
.cal-day { margin: 0 0 34px; scroll-margin-top: 90px; }
.cal-day.past { opacity: .55; }
.day-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 0 0 12px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.day-name { font-size: 20px; font-weight: 700; }
.cal-day.today .day-name { color: var(--accent); }
.rel-list { display: grid; gap: 8px; }
.rel { display: grid; grid-template-columns: 130px 140px 1fr auto; gap: 12px; align-items: center; padding: 12px 16px; border-radius: var(--radius); background: var(--bg-2); font-size: 14px; }
.rel-date { font-weight: 600; }
.rel-type { color: var(--muted); }
.rel-when { font-size: 12px; font-weight: 700; color: var(--muted); }
.rel.up .rel-when { color: #5be39a; }
@media (max-width: 560px) { .rel { grid-template-columns: 1fr auto; } .rel-note:empty { display: none; } }
.svc-chips { margin: -6px 0 22px; }
.chip.svc::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--svc); margin-right: 7px; vertical-align: 1px; }
.chip.svc.on { background: var(--svc); border-color: var(--svc); color: #fff; }
.chip.svc.on::before { background: #fff; }
/* placeholder art when a title has no poster, or its poster fails to load */
.gen::before { content: ''; position: absolute; left: 50%; top: 38%; width: 34px; height: 34px; transform: translate(-50%, -50%); opacity: .35;
  background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.6'%3E%3Crect x='3' y='5' width='18' height='14' rx='2'/%3E%3Cpath d='M3 9h18M8 5v4M16 5v4'/%3E%3C/svg%3E"); }
.gen { overflow: hidden; overflow-wrap: anywhere; }

/* account and settings */
.acct-btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px; background: var(--grad); color: #fff; font-weight: 700; font-size: 14px; border: 0; white-space: nowrap; }
.acct-btn.in { padding: 0; width: 38px; height: 38px; justify-content: center; font-size: 16px; text-transform: uppercase; }
.top-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.panel { max-width: 520px; margin: 0 auto; background: var(--bg-2); border: 1px solid var(--line); border-radius: 18px; padding: 28px; }
.panel h1 { margin: 0 0 6px; font-size: 26px; }
.panel + .panel { margin-top: 18px; }
.tabs { display: flex; gap: 6px; background: var(--bg-3); padding: 4px; border-radius: 999px; margin: 18px 0 20px; }
.tabs button { flex: 1; border: 0; background: none; padding: 9px; border-radius: 999px; font-weight: 600; color: var(--muted); }
.tabs button.on { background: var(--bg-2); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.field { display: grid; gap: 6px; margin-bottom: 14px; font-size: 13.5px; font-weight: 600; }
.field input, .field select, .set-row select { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; font-weight: 400; }
.field input:focus { outline: none; border-color: var(--accent); }
.form-error { color: #ff6b6b; font-size: 14px; min-height: 20px; margin: 4px 0 10px; }
.btn.wide { width: 100%; justify-content: center; }
.btn.danger { color: #ff6b6b; }
.fine { color: var(--muted); font-size: 13px; margin: 14px 0 0; }
.settings { max-width: 720px; }
.set-group { background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px; padding: 6px 20px; margin-bottom: 18px; }
.set-group h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 0 4px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.set-group h2 + .set-row { border-top: 0; }
.set-row .lbl { font-weight: 600; }
.set-row .hint { color: var(--muted); font-size: 13px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 3px solid transparent; outline: 1px solid var(--line); }
.swatch.on { border-color: var(--bg-2); outline: 2px solid var(--text); }
.toggle { position: relative; width: 46px; height: 26px; flex: none; }
.toggle input { opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; position: absolute; z-index: 1; }
.toggle span { position: absolute; inset: 0; border-radius: 999px; background: var(--bg-3); border: 1px solid var(--line); transition: .15s; }
.toggle span::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .15s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.toggle input:checked + span { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + span::after { transform: translateX(20px); }
@media (max-width: 560px) { .set-row { flex-wrap: wrap; } .panel { padding: 22px 18px; } .acct-btn:not(.in) { padding: 7px 12px; font-size: 13px; } }
