:root {
  --bg: #0e0b10; --panel: #19141c; --line: #2c2430; --ink: #f4eef4; --muted: #a99bab;
  --accent: #e8457a; --accent-ink: #fff; --gold: #f2c46d;
  --font: "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); }
body { padding-bottom: env(safe-area-inset-bottom, 0px); -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 12px; background: rgba(14,11,16,.92); backdrop-filter: blur(8px); }
.brand { color: var(--ink); text-decoration: none; font-weight: 800; font-size: 20px; letter-spacing: -.01em; }
.brand span { color: var(--accent); }

main { padding: 8px 16px 40px; max-width: 980px; margin: 0 auto; }
.loading, .empty { color: var(--muted); padding: 40px 0; text-align: center; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.card { background: none; border: 0; padding: 0; color: inherit; text-align: left; display: flex; flex-direction: column; gap: 8px; }
.poster { aspect-ratio: 2 / 3; width: 100%; border-radius: 10px; background: var(--panel) center / cover no-repeat; border: 1px solid var(--line); }
.card-title { font-weight: 700; font-size: 15px; line-height: 1.25; }
.card-meta { font-size: 12px; color: var(--muted); }

.series-head { display: grid; grid-template-columns: 120px 1fr; gap: 16px; align-items: start; margin: 8px 0 20px; }
.series-head .poster { border-radius: 8px; }
.series-head h1 { margin: 0 0 6px; font-size: 22px; line-height: 1.2; }
.series-head p { margin: 0 0 12px; color: var(--muted); line-height: 1.5; }
.eps { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.ep { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 8px; padding: 12px 0; font-weight: 700; position: relative; }
.ep.locked { color: var(--muted); }
.ep.locked::after { content: "🔒"; font-size: 10px; position: absolute; top: 3px; right: 5px; }
.ep.free::before { content: "FREE"; font-size: 9px; letter-spacing: .06em; color: var(--gold); position: absolute; top: 3px; left: 6px; }

.primary { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 999px; padding: 12px 20px; font-weight: 700; width: 100%; }
.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; padding: 8px 0; }
.back { margin: 4px 0 8px; }

.player { position: fixed; inset: 0; z-index: 20; background: #000; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px); }
.player-top, .player-bottom { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.player-top span:first-of-type { flex: 1; font-weight: 600; font-size: 14px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.badge { font-size: 11px; font-weight: 700; letter-spacing: .06em; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.frame { position: relative; flex: 1; min-height: 0; display: flex; justify-content: center; }
.frame iframe { border: 0; height: 100%; aspect-ratio: 9 / 16; max-width: 100%; background: #000; }
.mark { position: absolute; inset: 0; pointer-events: none; display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: rgba(255,255,255,.18); transform: rotate(-24deg); user-select: none; }
.player-bottom .primary { max-width: 420px; margin: 0 auto; }

.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 30; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; background: var(--panel); border-top: 1px solid var(--line);
  border-radius: 18px 18px 0 0; padding: 22px 18px calc(env(safe-area-inset-bottom, 0px) + 22px); max-width: 560px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 12px; }
.sheet h2 { margin: 0; font-size: 22px; }
.muted { color: var(--muted); margin: 0; line-height: 1.5; }
.fine { color: var(--muted); font-size: 12px; margin: 0; line-height: 1.5; }
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.plan { background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 14px 12px;
  display: flex; flex-direction: column; gap: 4px; text-align: left; }
.plan.featured { border-color: var(--accent); }
.plan-name { font-weight: 700; }
.plan-price { font-size: 20px; font-weight: 800; }
.plan-note { font-size: 12px; color: var(--muted); }
form { display: flex; flex-direction: column; gap: 8px; }
label { font-size: 13px; color: var(--muted); }
input[type=email] { background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 16px; }
.error { color: #ff8a9e; font-size: 13px; margin: 0; }

.banner { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 16px; background: #2a1a24;
  font-size: 13px; padding-top: calc(env(safe-area-inset-top, 0px) + 10px); }
.banner button { flex: none; background: var(--accent); color: #fff; border: 0; border-radius: 999px; padding: 6px 12px; font-weight: 700; }
.hint { position: fixed; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom, 0px) + 12px); z-index: 10; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 40px 12px 14px; font-size: 14px; }
.hint .x { position: absolute; top: 6px; right: 8px; background: none; border: 0; color: var(--muted); font-size: 20px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom, 0px) + 20px); z-index: 40;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: 14px; max-width: calc(100% - 32px); }

@media (max-width: 420px) { .series-head { grid-template-columns: 96px 1fr; } }
@media (prefers-reduced-motion: no-preference) { .sheet:not([hidden]) { animation: up .22s ease-out; } @keyframes up { from { transform: translateY(24px); opacity: .6; } } }
