:root {
  --river: #0C2530;      /* night river, page background */
  --deep: #081A22;       /* behind video */
  --surface: #143641;
  --line: #24505D;
  --text: #EDF2F1;
  --muted: #8FA9AE;
  --gold: #E0A845;       /* unlock / primary action only */
  --gold-ink: #2A1C04;
  --wine: #8C2A3C;       /* locked */
  --display: "Bodoni Moda", "Didot", Georgia, serif;
  --ui: "Instrument Sans", system-ui, -apple-system, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--river); color: var(--text); font: 400 16px/1.5 var(--ui); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- home ---------- */
.home { max-width: 1080px; margin: 0 auto; padding: 20px 20px calc(48px + var(--safe-b)); }
.masthead { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 28px; }
.wordmark { font: italic 500 28px/1 var(--display); text-decoration: none; letter-spacing: -0.01em; }
.masthead a.account { font-size: 14px; color: var(--muted); text-decoration: none; }

/* featured drama: title sits on the key art */
.hero { margin: 0 -20px 44px; }
.hero-art { position: relative; display: block; aspect-ratio: 9 / 14; max-height: 78vh; width: 100%; background: var(--surface) center 20% / cover no-repeat; text-decoration: none; overflow: hidden; }
.hero-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(12,37,48,0) 38%, rgba(12,37,48,.55) 62%, var(--river) 97%); }
.hero-copy { position: absolute; left: 20px; right: 20px; bottom: 18px; z-index: 1; }
.hero-copy h1 { font: 700 clamp(40px, 11vw, 84px)/0.92 var(--display); margin: 0 0 12px; letter-spacing: -0.02em; text-shadow: 0 2px 24px rgba(0,0,0,.45); }
.hero-copy p { color: #D5E0E2; max-width: 36ch; margin: 0; font-size: 16px; line-height: 1.45; }
.hero-art.titled { aspect-ratio: 9 / 16; background-position: center; }
.hero-art.titled::after { display: none; }
.logline { margin: 0; color: #C9D6D8; font-size: 16px; line-height: 1.45; max-width: 38ch; }
.hero-meta { padding: 18px 20px 0; display: grid; gap: 14px; justify-items: start; }
.facts { display: flex; flex-wrap: wrap; gap: 8px; }
.facts span { font-size: 13px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; }
.cta { display: inline-block; background: var(--gold); color: var(--gold-ink); border: 0; border-radius: 999px; padding: 15px 28px; font-weight: 600; font-size: 17px; text-decoration: none; }
.cta.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.meta { color: var(--muted); font-size: 14px; margin-top: 14px; }
@media (min-width: 760px) {
  .hero { margin: 0 0 56px; display: grid; grid-template-columns: minmax(300px, 420px) 1fr; gap: 0; align-items: end; border-radius: 18px; overflow: hidden; background: var(--surface); }
  .hero-art { aspect-ratio: 9 / 16; max-height: 80vh; }
  .hero-art::after { background: linear-gradient(180deg, rgba(12,37,48,0) 45%, rgba(20,54,65,.75) 78%, var(--surface) 100%); }
  .hero-copy h1 { font-size: clamp(40px, 4.2vw, 60px); }
  .hero-meta { padding: 32px 40px; align-self: center; }
}

.shelf h2 { font: 500 22px/1.2 var(--display); margin: 0 0 16px; }
.row { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.tile { text-decoration: none; }
.tile .poster { aspect-ratio: 9 / 16; border-radius: 10px; background: var(--surface) center / cover no-repeat; }
.tile span { display: block; margin-top: 8px; font-size: 15px; line-height: 1.3; }

/* ---------- player ---------- */
.player { position: fixed; inset: 0; background: var(--deep); display: grid; place-items: center; overflow: hidden; touch-action: pan-x; }
.player video { height: 100%; width: 100%; max-width: calc(100vh * 9 / 16); object-fit: contain; background: #000; }
.bar { position: absolute; left: 0; right: 0; display: flex; align-items: center; gap: 12px; padding: 14px 16px; pointer-events: none; }
.bar > * { pointer-events: auto; }
.bar.top { top: 0; padding-top: max(14px, env(safe-area-inset-top)); background: linear-gradient(rgba(8,26,34,.75), transparent); }
.bar.bottom { bottom: 0; padding-bottom: calc(18px + var(--safe-b)); background: linear-gradient(transparent, rgba(8,26,34,.85)); align-items: flex-end; }
.iconbtn { background: rgba(12,37,48,.7); border: 1px solid var(--line); border-radius: 999px; min-width: 44px; height: 44px; padding: 0 14px; display: inline-grid; place-items: center; }
.bar .title { flex: 1; min-width: 0; }
.bar .title b { display: block; font: 600 15px/1.2 var(--ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .title small { color: var(--muted); font-size: 13px; }
.bar.bottom { flex-direction: column; align-items: stretch; gap: 10px; }
.bar.bottom .row { display: flex; align-items: flex-end; gap: 10px; }
.ep-name { flex: 1; font: italic 500 22px/1.15 var(--display); }
.controls { display: flex; align-items: center; gap: 10px; }
.ctl { width: 44px; height: 44px; border-radius: 999px; border: 1px solid var(--line); background: rgba(12,37,48,.7); display: grid; place-items: center; flex: none; }
.time { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 34px; text-align: center; }
.seek { flex: 1; min-width: 0; accent-color: var(--gold); height: 28px; }
.dl-menu { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: var(--river); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.dl-menu span { flex-basis: 100%; font-size: 13px; color: var(--muted); }
.dl-menu a { text-decoration: none; background: var(--gold); color: var(--gold-ink); font-weight: 600; padding: 9px 16px; border-radius: 999px; font-size: 15px; }
.sound { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
.sound.cta { box-shadow: 0 8px 30px rgba(0,0,0,.4); }

/* episode drawer */
.drawer { position: absolute; inset: auto 0 0 0; max-height: 70vh; overflow: auto; background: var(--river); border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + var(--safe-b)); transform: translateY(100%); transition: transform .25s ease; }
.drawer.open { transform: none; }
.drawer h3 { font: 500 20px var(--display); margin: 0 0 12px; }
.eps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.eps button { height: 48px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; position: relative; }
.eps button.current { border-color: var(--gold); color: var(--gold); }
.eps button.locked { color: var(--muted); }
.eps button.locked::after { content: ""; position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--wine); }

/* paywall */
.paywall { position: absolute; inset: 0; display: grid; align-items: end; background: rgba(8,26,34,.55); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.sheet { background: var(--river); border-top: 1px solid var(--line); border-radius: 22px 22px 0 0; padding: 26px 20px calc(22px + var(--safe-b)); animation: rise .35s cubic-bezier(.2,.8,.2,1); max-width: 560px; width: 100%; margin: 0 auto; }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
.sheet h2 { font: 700 30px/1.05 var(--display); margin: 0 0 6px; }
.sheet .lead { color: var(--muted); margin: 0 0 20px; }
.plan { width: 100%; text-align: left; display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center; padding: 16px 18px; margin-bottom: 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); }
.plan strong { font-size: 17px; }
.plan .price { grid-row: span 2; font: 700 26px/1 var(--display); }
.plan small { color: var(--muted); font-size: 13px; }
.plan.primary { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }
.plan.primary small { color: #5a4413; }
.plan[disabled] { opacity: .6; }
.fine { color: var(--muted); font-size: 12px; margin: 12px 0 0; }
.linkbtn { display: block; background: none; border: 0; padding: 8px 0; color: var(--text); text-decoration: underline; font-size: 14px; }
.restore { display: flex; gap: 8px; margin-top: 8px; }
.restore input, .field { flex: 1; min-width: 0; height: 46px; border-radius: 10px; border: 1px solid var(--line); background: var(--deep); color: var(--text); padding: 0 12px; font: inherit; }
.restore button, .small-btn { height: 46px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); padding: 0 16px; font-weight: 600; }
.note { font-size: 14px; color: var(--muted); margin: 10px 0 0; }
.toast { position: fixed; left: 50%; top: calc(16px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); background: var(--gold); color: var(--gold-ink); font-weight: 600; padding: 10px 18px; border-radius: 999px; z-index: 10; }

/* ---------- pages ---------- */
.page { max-width: 640px; margin: 0 auto; padding: 20px 20px 60px; }
.page h1 { font: 700 40px/1.05 var(--display); margin: 24px 0 16px; }
.page h2 { font: 500 22px var(--display); margin: 32px 0 8px; }
.page p, .page li { color: #C9D6D8; }
.page table { width: 100%; border-collapse: collapse; font-size: 14px; }
.page td { border-top: 1px solid var(--line); padding: 10px 8px 10px 0; vertical-align: top; }
.page td:first-child { color: var(--muted); width: 38%; }
footer.site { max-width: 1080px; margin: 0 auto; padding: 0 20px 40px; font-size: 13px; color: var(--muted); }
footer.site a { color: var(--muted); margin-right: 16px; }

@media (prefers-reduced-motion: reduce) {
  .drawer, .sheet { transition: none; animation: none; }
}
