/* KeDrama: a dark cinema in Synara navy and gold. Phone first; every screen works at 320px. */
:root {
  --night: #000d3a; --deep: #001a67; --navy: #002b83; --blue: #0a5fd6; --sky: #009af3;
  --gold: #d99a1e; --gold-hi: #f3c55a; --gold-lo: #a8720c;
  --ink: #f4f7ff; --soft: #b9c6e8; --dim: #7f8fbd; --line: rgba(185, 198, 232, .14);
  --card: rgba(255, 255, 255, .05); --card-hi: rgba(255, 255, 255, .09);
  --ok: #3ccf8e; --bad: #ff6b5e;
  --radius: 16px;
  --ui: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --title: "Anton", "Impact", "Arial Narrow", sans-serif;
  --tabbar: 64px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; background: var(--night); }
body { margin: 0; min-height: 100vh; font: 16px/1.5 var(--ui); color: var(--ink);
  background: radial-gradient(120% 60% at 50% -10%, #06307f 0%, var(--deep) 35%, var(--night) 75%) fixed; }
a { color: var(--gold-hi); text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0 0 .4rem; line-height: 1.12; letter-spacing: -.01em; }
.title { font-family: var(--title); font-weight: 400; letter-spacing: .01em; }
h1 { font-size: clamp(1.7rem, 6vw, 2.4rem); }
h2 { font-size: 1.25rem; font-weight: 800; }
p { margin: 0 0 1rem; }
.muted { color: var(--soft); } .dim { color: var(--dim); } .small { font-size: .86rem; } .tiny { font-size: .76rem; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.center { text-align: center; }
:focus-visible { outline: 3px solid var(--gold-hi); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- top bar and tabs ---------- */
.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  background: linear-gradient(to bottom, rgba(0, 13, 58, .96), rgba(0, 13, 58, .75)); backdrop-filter: blur(10px); }
.top .logo { height: 34px; width: auto; }
.top .spacer { flex: 1; }
.coins { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  background: var(--card-hi); color: var(--ink); font-weight: 700; font-size: .9rem; }
.coins .dot { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, var(--gold-hi), var(--gold-lo)); }
.coins.pass { background: linear-gradient(135deg, var(--gold-hi), var(--gold)); color: #241500; }
main { padding-bottom: calc(var(--tabbar) + 24px + env(safe-area-inset-bottom)); }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; justify-content: space-around;
  height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: rgba(0, 10, 45, .96); border-top: 1px solid var(--line); backdrop-filter: blur(12px); }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--dim); font-size: .72rem; font-weight: 700; }
.tabs a svg { width: 24px; height: 24px; }
.tabs a.on { color: var(--gold-hi); }

/* ---------- buttons, forms, flash ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px;
  padding: 12px 22px; border-radius: 999px; border: 0; font: 800 1rem var(--ui); cursor: pointer;
  background: linear-gradient(135deg, var(--gold-hi), var(--gold)); color: #241500; transition: transform .1s, filter .15s; }
.btn:hover { filter: brightness(1.06); } .btn:active { transform: scale(.98); }
.btn.ghost { background: var(--card-hi); color: var(--ink); }
.btn.blue { background: var(--blue); color: #fff; }
.btn.block { width: 100%; } .btn.small { min-height: 36px; padding: 7px 14px; font-size: .88rem; }
.btn[disabled] { opacity: .5; pointer-events: none; }
label { display: block; font-weight: 700; margin-bottom: 6px; color: var(--soft); font-size: .92rem; }
.field { margin-bottom: 16px; }
input, select, textarea { width: 100%; font: inherit; color: var(--ink); background: rgba(255, 255, 255, .06);
  border: 2px solid var(--line); border-radius: 12px; padding: 13px 14px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); background: rgba(255, 255, 255, .09); }
input.pin { letter-spacing: .6em; text-align: center; font-size: 1.4rem; font-weight: 800; }
.flash { margin: 12px 16px; padding: 12px 16px; border-radius: 12px; font-weight: 700; }
.flash.success { background: rgba(60, 207, 142, .15); color: #8ef0c2; }
.flash.error { background: rgba(255, 107, 94, .15); color: #ffb1a9; }
.flash.info { background: rgba(243, 197, 90, .14); color: var(--gold-hi); }
.announce { background: linear-gradient(90deg, var(--gold-lo), var(--gold)); color: #241500; font-weight: 800;
  text-align: center; padding: 8px 16px; font-size: .9rem; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.narrow { max-width: 440px; margin: 28px auto; }

/* ---------- home ---------- */
.hero { position: relative; margin: 8px 16px 24px; border-radius: 22px; overflow: hidden; min-height: 420px;
  display: flex; align-items: flex-end; background: var(--deep); }
.hero img.bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0, 10, 45, .97) 8%, rgba(0, 10, 45, .55) 45%, rgba(0, 10, 45, .05) 75%); }
.hero .copy { position: relative; z-index: 1; padding: 24px 20px; width: 100%; }
.hero h1 { font-size: clamp(2rem, 9vw, 3rem); }
.tag { display: inline-block; padding: 4px 10px; border-radius: 999px; background: rgba(243, 197, 90, .16);
  color: var(--gold-hi); font-weight: 800; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px; }
.hero .row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.shelf { margin: 0 0 28px; }
.shelf h2 { padding: 0 16px; display: flex; align-items: baseline; gap: 8px; }
.rail { display: grid; grid-auto-flow: column; grid-auto-columns: 42%; gap: 12px; overflow-x: auto;
  padding: 4px 16px 8px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
@media (min-width: 640px) { .rail { grid-auto-columns: 22%; } }
.poster { scroll-snap-align: start; position: relative; display: block; border-radius: 14px; overflow: hidden;
  aspect-ratio: 9 / 14; background: var(--navy); color: var(--ink); }
.poster img { width: 100%; height: 100%; object-fit: cover; }
.poster .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 30px 10px 10px;
  background: linear-gradient(to top, rgba(0, 10, 45, .95), transparent); font-weight: 800; font-size: .92rem; line-height: 1.2; }
.poster .cap small { display: block; color: var(--gold-hi); font-weight: 700; font-size: .74rem; margin-top: 3px; }
.poster .bar { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--gold); }
.soon { display: flex; gap: 12px; align-items: center; padding: 12px; margin: 0 16px 10px; }
.soon .time { min-width: 64px; text-align: center; font-weight: 900; font-size: 1.1rem; color: var(--gold-hi); }

/* ---------- series page ---------- */
.s-head { display: grid; grid-template-columns: 120px 1fr; gap: 16px; padding: 16px; align-items: end; }
.s-head img { border-radius: 14px; aspect-ratio: 9 / 14; object-fit: cover; width: 100%; }
.eps { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; padding: 0 16px; }
.ep { position: relative; display: flex; align-items: center; justify-content: center; aspect-ratio: 1;
  border-radius: 12px; background: var(--card-hi); color: var(--ink); font-weight: 900; font-size: 1.05rem; }
.ep.free { box-shadow: inset 0 0 0 2px rgba(60, 207, 142, .5); }
.ep.locked { color: var(--dim); background: var(--card); }
.ep.watched { background: rgba(217, 154, 30, .22); }
.ep .lock { position: absolute; top: 5px; right: 6px; width: 13px; height: 13px; opacity: .75; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; padding: 10px 16px; font-size: .8rem; color: var(--soft); }

/* ---------- player ---------- */
body.watching { background: #000; }
body.watching .top, body.watching .tabs { display: none; }
body.watching main { padding: 0; }
.stage { position: fixed; inset: 0; background: #000; display: flex; align-items: center; justify-content: center; }
.stage video { width: 100%; height: 100%; object-fit: contain; background: #000; }
@media (min-aspect-ratio: 3/4) { .stage video { max-width: 56.25vh; } }
.hud { position: fixed; left: 0; right: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.hud.top-hud { top: 0; padding-top: calc(12px + env(safe-area-inset-top));
  background: linear-gradient(to bottom, rgba(0, 0, 0, .7), transparent); }
.hud.bottom-hud { bottom: 0; flex-direction: column; align-items: stretch; gap: 8px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(to top, rgba(0, 0, 0, .85), transparent); }
.hud .round { width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .14);
  color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.hud .round svg { width: 22px; height: 22px; }
.hud .ttl { flex: 1; min-width: 0; font-weight: 800; line-height: 1.2; }
.hud .ttl small { display: block; color: var(--gold-hi); font-weight: 700; }
.scrub { width: 100%; height: 4px; -webkit-appearance: none; appearance: none; background: rgba(255, 255, 255, .25);
  border-radius: 4px; padding: 0; border: 0; }
.scrub::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--gold-hi); }
.scrub::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--gold-hi); }
.hud .row { display: flex; gap: 8px; align-items: center; }
.hud .row .grow { flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, .14); color: #fff; font-size: .8rem; font-weight: 700; border: 0; cursor: pointer; }
.chip.on { background: var(--gold); color: #241500; }
.bigplay { position: fixed; z-index: 4; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 84px; height: 84px; border-radius: 50%; border: 0;
  background: rgba(0, 26, 103, .7); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.bigplay svg { width: 40px; height: 40px; margin-left: 6px; }
.upnext { position: fixed; z-index: 6; left: 16px; right: 16px; bottom: calc(110px + env(safe-area-inset-bottom));
  padding: 14px; border-radius: 16px; background: rgba(0, 26, 103, .92); display: flex; gap: 12px; align-items: center; }
.toast { position: fixed; z-index: 60; left: 50%; top: 18px; transform: translateX(-50%); padding: 10px 16px;
  border-radius: 999px; background: rgba(0, 26, 103, .95); color: #fff; font-weight: 700; font-size: .9rem; }

/* ---------- paywall sheet ---------- */
.sheet-bg { position: fixed; inset: 0; z-index: 20; background: rgba(0, 6, 30, .7); backdrop-filter: blur(3px); }
.sheet { position: fixed; z-index: 21; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow-y: auto;
  border-radius: 24px 24px 0 0; padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, #02236f, var(--night)); box-shadow: 0 -12px 40px rgba(0, 0, 0, .5); }
@media (min-width: 640px) { .sheet { left: 50%; right: auto; width: 480px; transform: translateX(-50%); bottom: 24px; border-radius: 24px; } }
.sheet .grab { width: 44px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .25); margin: -8px auto 14px; }
.offer { display: flex; align-items: center; gap: 12px; width: 100%; padding: 16px; margin-bottom: 10px; text-align: left;
  border-radius: 16px; border: 2px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; font: inherit; }
.offer.best { border-color: var(--gold); background: rgba(217, 154, 30, .12); }
.offer .what { flex: 1; } .offer .what b { display: block; font-size: 1.05rem; }
.offer .price { font-weight: 900; font-size: 1.15rem; white-space: nowrap; }
.offer .badge { display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 999px; background: var(--gold);
  color: #241500; font-size: .7rem; font-weight: 900; vertical-align: 2px; }
.offer input { width: auto; accent-color: var(--gold); }

/* ---------- lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.dl-thumb { width: 54px; aspect-ratio: 9 / 14; border-radius: 8px; object-fit: cover; background: var(--navy); }
.prompt { position: fixed; z-index: 45; left: 12px; right: 12px; bottom: calc(var(--tabbar) + 12px + env(safe-area-inset-bottom));
  display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 16px; background: #022a85;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45); }
.prompt img { width: 44px; height: 44px; border-radius: 11px; }
.prompt .x { background: none; border: 0; color: var(--soft); font-size: 1.4rem; cursor: pointer; padding: 4px 8px; }
.net { position: fixed; z-index: 70; top: 0; left: 0; right: 0; text-align: center; padding: 6px; font-weight: 800;
  font-size: .82rem; background: var(--gold); color: #241500; }
