/* FlickStory: "velvet curtain". One stylesheet for the public site and the admin panel. */

:root {
  /* Colour tokens. Text pairs are checked by tests/contrast.py. */
  --bg: #170E14;
  --surface: #22151D;
  --raised: #2E1D27;
  --line: #4B3541;
  --line-strong: #6A4456;
  --border: #8A7380;
  --text: #F7EFEC;
  --muted: #CDBAC1;
  --faint: #A8929C;
  --amber: #FFB84D;
  --ink: #170E14;
  --rose: #F2A7B8;
  --ok: #7FD6A2;
  --bad: #FF8A80;

  /* Curtain pleats and glow. Only the home hero and the video stage use these. */
  --pleat-a: #2B1220;
  --pleat-b: #3A1A2A;
  --pleat-c: #210D18;
  --glow: rgba(255, 184, 77, 0.15);

  --r-s: 14px;
  --r-m: 18px;
  --r-l: 22px;

  --font-head: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Arabic", "Helvetica Neue", Arial, sans-serif;

  --container: 1200px;
  --gutter: 24px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.6 var(--font-body); }
img, svg { max-width: 100%; }
h1, h2, h3, p, ul, ol, dl, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--rose); text-underline-offset: 3px; }
a:hover { color: var(--text); }

/* Generic form controls. :where() keeps specificity at zero so specific rules can override. */
:where(input, select, textarea) {
  width: 100%; min-height: 48px; padding: 10px 14px;
  background: var(--bg); color: var(--text);
  border: 1.5px solid var(--border); border-radius: 12px;
  font: inherit; line-height: 1.4;
}
:where(textarea) { min-height: 110px; resize: vertical; }
:where(input[type="checkbox"], input[type="radio"]) { width: 22px; min-height: 22px; height: 22px; padding: 0; accent-color: var(--amber); flex: none; }
:where(input[type="file"]) { padding: 9px 12px; }
:where(input, select, textarea)::placeholder { color: var(--faint); opacity: 1; }

:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; inset-inline-start: 16px; top: -80px; z-index: 50; padding: 12px 18px; border-radius: 12px; background: var(--amber); color: var(--ink); font-weight: 700; text-decoration: none; }
.skip:focus { top: 12px; }
.container { width: 100%; max-width: calc(var(--container) + var(--gutter) * 2); margin-inline: auto; padding-inline: var(--gutter); }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-fill { fill: currentColor; stroke: none; }

/* Buttons: 52 px tall, 48 px inside panels. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 24px; border: 1.5px solid transparent; border-radius: var(--r-s);
  font: 700 16px/1 var(--font-body); text-decoration: none; cursor: pointer; text-align: center;
  transition: background-color .15s, border-color .15s, transform .15s;
}
.btn-primary { background: var(--amber); color: var(--ink); }
.btn-primary:hover { background: #FFC56E; color: var(--ink); }
.btn-ghost { background: var(--raised); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: #3A2531; color: var(--text); }
.btn-danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn-danger:hover { background: rgba(255, 138, 128, .12); color: var(--bad); }
.btn-sm { min-height: 44px; padding: 0 16px; font-size: 14px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.panel .btn, .editor .btn { min-height: 48px; }

/* Header */
.site-header { border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; gap: 12px 16px; padding-block: 12px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; color: var(--text); text-decoration: none; }
.brand:hover { color: var(--text); }
.logo { width: 38px; height: 38px; flex: none; }
.brand-name { font: 700 28px/1 var(--font-head); letter-spacing: -.01em; }
.brand-tag { font-size: 12px; line-height: 1.25; font-weight: 600; color: var(--muted); max-width: 6.5em; }
.main-nav ul { display: flex; gap: 6px; }
.main-nav a { display: flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 999px; color: var(--muted); font-size: 15px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.main-nav a:hover { background: var(--surface); color: var(--text); }
.main-nav a[aria-current="page"] { background: var(--raised); color: var(--text); box-shadow: inset 0 -3px 0 var(--amber); }
.search { position: relative; margin-inline-start: auto; }
.search input { width: 200px; min-height: 44px; border-radius: 999px; padding-inline: 44px 16px; background: var(--surface); border-color: var(--line-strong); }
.search .icon { position: absolute; inset-inline-start: 15px; top: 50%; margin-top: -10px; color: var(--muted); pointer-events: none; }

/* Sections */
main { display: block; }
.section { padding-top: 48px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-title { font: 600 28px/1.2 var(--font-head); text-wrap: balance; }
.more { font-weight: 700; font-size: 15px; }
.crumbs { padding-block: 20px 4px; font-size: 14px; color: var(--muted); }
.crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; }
.crumbs li { display: flex; align-items: center; min-height: 44px; }
.crumbs li + li::before { content: "/" / ""; margin-inline-end: 8px; color: var(--faint); }
.crumbs a { color: var(--muted); display: inline-block; padding-block: 10px; }
.crumbs a:hover { color: var(--text); }

/* Curtain: only behind the home hero and the video stage. */
.curtain {
  background:
    radial-gradient(ellipse 55% 75% at 75% 0%, var(--glow), transparent 70%),
    linear-gradient(to bottom, transparent 60%, var(--bg) 100%),
    repeating-linear-gradient(90deg, var(--pleat-c) 0, var(--pleat-b) 22px, var(--pleat-a) 44px, var(--pleat-c) 64px);
}

/* Home hero */
.hero { border-bottom: 1px solid var(--line); }
.hero-inner { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 56px; align-items: center; padding-block: 56px 64px; }
.eyebrow { display: inline-block; margin-bottom: 14px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: rgba(23, 14, 20, .6); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.hero-title { font: 700 60px/1.05 var(--font-head); letter-spacing: -.015em; text-wrap: balance; }
.hero-text { max-width: 56ch; margin-top: 18px; font-size: 18px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line-strong); color: var(--rose); font-size: 14px; font-weight: 700; text-decoration: none; }
.chip:hover { background: var(--raised); color: var(--text); }
.hero .chips { margin-top: 20px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero-poster { box-shadow: 0 24px 60px rgba(0, 0, 0, .5); }

/* Posters and cards */
.poster { position: relative; aspect-ratio: 2 / 3; overflow: hidden; border-radius: var(--r-s); border: 1px solid var(--line); background: var(--raised); }
.poster img { display: block; width: 100%; height: 100%; object-fit: cover; }
.poster-gen { display: flex; align-items: flex-end; padding: 14px; }
.poster-gen::before { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(23, 14, 20, .78), rgba(23, 14, 20, 0) 62%); }
.poster-gen::after { content: ""; position: absolute; top: -10%; bottom: -10%; inset-inline-start: 62%; width: 2px; background: rgba(247, 239, 236, .28); transform: rotate(24deg); }
.poster-gen .pt { position: relative; z-index: 1; font: 700 19px/1.15 var(--font-head); text-wrap: balance; color: var(--text); }
.g0 { background: linear-gradient(155deg, #0F4C4F, #1B6F66); }
.g1 { background: linear-gradient(155deg, #3B2150, #5B3A78); }
.g2 { background: linear-gradient(155deg, #1E2A5A, #364A8E); }
.g3 { background: linear-gradient(155deg, #1F3D2B, #38724A); }
.g4 { background: linear-gradient(155deg, #5A3A12, #8F5E1B); }
.g5 { background: linear-gradient(155deg, #5C2418, #8E3F26); }
.g6 { background: linear-gradient(155deg, #1B3A4B, #316A86); }
.g7 { background: linear-gradient(155deg, #3E3A12, #6C6720); }
.badge { position: absolute; z-index: 2; top: 10px; inset-inline-start: 10px; padding: 2px 10px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line-strong); font-size: 12px; font-weight: 700; color: var(--text); }
.cards { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 28px 20px; }
.card { display: block; color: var(--text); text-decoration: none; border-radius: var(--r-s); }
.card:hover { color: var(--text); }
.card:focus-visible { outline-offset: 5px; }
.card .poster { transition: transform .18s, border-color .18s; }
.card:hover .poster { transform: translateY(-3px); border-color: var(--line-strong); }
.card-title { margin-top: 10px; font-size: 15px; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
.card-meta { font-size: 13px; line-height: 1.4; color: var(--muted); }
.card-wide { color: var(--text); text-decoration: none; display: flex; gap: 14px; align-items: center; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); }
.card-wide .poster { width: 64px; flex: none; border-radius: 10px; }
.card-wide .poster-gen { padding: 6px; }
.card-wide .pt, .cover-now .pt { display: none; }
.card-wide .card-title { margin-top: 0; }
.rank { position: absolute; z-index: 2; top: 10px; inset-inline-start: 10px; min-width: 34px; padding: 1px 9px; border-radius: 999px; background: var(--amber); color: var(--ink); font: 700 14px/1.6 var(--font-body); text-align: center; }

/* Continue watching */
.resume-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.meter { height: 6px; margin-top: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--amber); }
.card-wide:hover { background: var(--raised); }
.text-block { max-width: 72ch; color: var(--muted); }
.text-block h2 { margin-bottom: 10px; font: 600 22px/1.3 var(--font-head); color: var(--text); }
.text-block p + p { margin-top: 12px; }

/* Drama page */
.drama-head { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 40px; padding-top: 12px; }
.drama-head h1 { font: 700 44px/1.1 var(--font-head); letter-spacing: -.01em; text-wrap: balance; }
.drama-head .chips { margin-top: 16px; }
.meta-line { margin-top: 14px; font-size: 14px; color: var(--muted); }
.synopsis { max-width: 68ch; margin-top: 18px; }
.drama-head .actions { margin-top: 24px; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tabs a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted); font-size: 14px; font-weight: 700; text-decoration: none; }
.tabs a[aria-current="true"] { background: var(--raised); color: var(--text); box-shadow: inset 0 -3px 0 var(--amber); }
.ep-grid { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 8px; }
.ep { display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 48px; padding: 0 4px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line-strong); color: var(--text); font-weight: 700; text-decoration: none; }
.ep:hover { background: var(--raised); color: var(--text); }
.ep .icon { width: 16px; height: 16px; }
.ep.is-seen { background: transparent; border-style: dashed; color: var(--muted); }
.ep[aria-current="true"] { background: var(--amber); border-color: var(--amber); color: var(--ink); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; font-size: 13px; color: var(--muted); }

/* Watch page */
.watch { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; padding-top: 8px; }
.stage { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 32px 16px 20px; border: 1px solid var(--line); border-radius: var(--r-l); }
.player { position: relative; width: min(100%, 360px); aspect-ratio: 9 / 16; overflow: hidden; border-radius: var(--r-m); background: #000; box-shadow: 0 24px 64px rgba(0, 0, 0, .6), 0 0 0 1px var(--line-strong); }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player .poster { position: absolute; inset: 0; aspect-ratio: auto; border: 0; border-radius: 0; }
.player-play { position: absolute; z-index: 3; inset-inline: 0; top: 50%; transform: translateY(-50%); display: flex; justify-content: center; }
.player-play .btn { box-shadow: 0 8px 28px rgba(0, 0, 0, .55); }
.stage-note { max-width: 360px; text-align: center; font-size: 13px; line-height: 1.5; color: var(--muted); background: rgba(23, 14, 20, .72); padding: 6px 12px; border-radius: 10px; }
.panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); }
.panel h2 { font: 700 13px/1.3 var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.servers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.servers a { display: flex; align-items: center; justify-content: center; min-height: 48px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--raised); color: var(--text); font-weight: 700; text-decoration: none; }
.servers a[aria-current="true"] { background: var(--amber); border-color: var(--amber); color: var(--ink); }
.picker { position: relative; max-height: 236px; overflow-y: auto; padding: 4px; margin: -4px; }
.picker .ep-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.prevnext { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.prevnext .btn { padding: 0 12px; }
details.report { border: 1px solid var(--line-strong); border-radius: var(--r-s); background: var(--bg); }
details.report > summary { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 16px; font-weight: 700; cursor: pointer; list-style: none; border-radius: var(--r-s); }
details.report > summary::-webkit-details-marker { display: none; }
details.report[open] > summary { border-bottom: 1px solid var(--line); border-end-start-radius: 0; border-end-end-radius: 0; }
details.report form { display: grid; gap: 14px; padding: 16px; }
.watch-info { padding-top: 36px; max-width: 760px; }
.watch-info h1 { font: 700 38px/1.15 var(--font-head); letter-spacing: -.01em; text-wrap: balance; }
.watch-info h2.ep-title { margin-top: 8px; font: 600 22px/1.3 var(--font-head); color: var(--muted); }
.watch-info .summary { margin-top: 16px; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 14px; font-size: 14px; color: var(--muted); }
.upnext { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

/* Forms and messages */
.field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; align-content: start; }
.field > label, .field > .label, fieldset > legend { font-size: 14px; font-weight: 700; color: var(--muted); }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.hint { font-size: 13px; line-height: 1.45; color: var(--faint); }
.hint-row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: 12px; min-height: 44px; color: var(--text); font-weight: 500; }
.check label { font-size: 15px; font-weight: 500; color: var(--text); }
.choices { display: grid; gap: 2px; }
.error { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; font-weight: 600; color: var(--bad); }
.error .icon { margin-top: 2px; width: 18px; height: 18px; }
.has-error :where(input, select, textarea) { border-color: var(--bad); }
.flash { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-s); border: 1px solid; font-weight: 600; }
.flash-ok { background: rgba(127, 214, 162, .1); border-color: var(--ok); }
.flash-ok .icon { color: var(--ok); }
.flash-bad { background: rgba(255, 138, 128, .1); border-color: var(--bad); }
.flash-bad .icon { color: var(--bad); }
.flash ul { margin-top: 6px; padding-inline-start: 18px; list-style: disc; font-weight: 500; }
.warn { display: flex; gap: 8px; font-size: 13px; font-weight: 600; color: var(--amber); }
.warn .icon { width: 18px; height: 18px; }

/* Footer */
.site-footer { margin-top: 80px; padding-block: 40px 48px; border-top: 1px solid var(--line); background: var(--surface); }
.footer-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 40px; align-items: start; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0 22px; max-width: 560px; }
.footer-links a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); font-weight: 600; text-decoration: none; }
.footer-links a:hover { color: var(--text); }
.footer-note { margin-top: 12px; max-width: 60ch; font-size: 14px; color: var(--muted); }
.copy { margin-top: 20px; font-size: 13px; color: var(--faint); }

/* Pills: a status is always a word. */
.pill { display: inline-flex; align-items: center; padding: 1px 10px; border-radius: 999px; border: 1px solid currentColor; font-size: 12px; font-weight: 700; line-height: 1.7; white-space: nowrap; }
.pill-ok { color: var(--ok); }
.pill-warn { color: var(--amber); }
.pill-bad { color: var(--bad); }
.pill-mute { color: var(--muted); }

/* Admin */
.admin { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { display: flex; flex-direction: column; gap: 22px; padding: 22px 14px; background: var(--surface); border-inline-end: 1px solid var(--line); }
.sidebar .brand-name { font-size: 24px; }
.side-nav { display: grid; gap: 4px; }
.side-nav a { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 12px; color: var(--muted); font-weight: 600; text-decoration: none; }
.side-nav a:hover { background: var(--raised); color: var(--text); }
.side-nav a[aria-current="page"] { background: var(--raised); color: var(--text); box-shadow: inset 3px 0 0 var(--amber); }
.count { min-width: 26px; padding: 0 8px; border-radius: 999px; background: var(--amber); color: var(--ink); font-size: 12px; font-weight: 700; line-height: 1.75; text-align: center; }
.side-foot { margin-top: auto; font-size: 13px; color: var(--muted); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; padding: 12px 32px; border-bottom: 1px solid var(--line); }
.topbar-user { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.topbar form { margin: 0; }
.admin-main { padding: 28px 32px 56px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-content: start; }
.admin-main > h1, .page-title { font: 700 32px/1.2 var(--font-head); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.box { padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); }
.box > h2 { margin-bottom: 14px; font: 600 20px/1.3 var(--font-head); }
.box > .sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: -8px 0 14px; font-size: 14px; color: var(--muted); }
.note { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat { padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); }
.stat b { display: block; font: 600 40px/1.1 var(--font-head); font-variant-numeric: tabular-nums; }
.stat span { display: block; margin-top: 4px; font-size: 14px; color: var(--muted); }
.cols { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.bars { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; height: 210px; padding-top: 6px; border-bottom: 1px solid var(--line-strong); }
.bar { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; height: 100%; font-variant-numeric: tabular-nums; }
.bar b { font-size: 13px; }
.bar i { display: block; width: 100%; max-width: 54px; border-radius: 8px 8px 0 0; background: var(--amber); }
.bar-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; margin-top: 8px; text-align: center; font-size: 13px; color: var(--muted); }
.table-wrap { position: relative; overflow-x: auto; }
table { width: 100%; min-width: 520px; border-collapse: collapse; }
th { text-align: start; padding: 10px 12px; font-size: 13px; font-weight: 700; color: var(--muted); border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td a { font-weight: 700; }
td.num, th.num { text-align: end; font-variant-numeric: tabular-nums; }
.health { display: grid; }
.health li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.health li:last-child { border-bottom: 0; }
.health strong { font-weight: 700; }
.health p { grid-column: 1; font-size: 14px; color: var(--muted); }
.health .pill { grid-column: 2; grid-row: 1; align-self: start; }
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.genre-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.serp { padding: 14px 16px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; }
.serp .u { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.serp .t { margin-top: 2px; font-size: 19px; line-height: 1.3; color: var(--rose); }
.serp .d { margin-top: 2px; font-size: 14px; color: var(--muted); }
.cover-now { display: flex; gap: 14px; align-items: center; }
.cover-now .poster { width: 72px; flex: none; }
.sticky-save { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* Tablet */
@media (max-width: 1023px) {
  .cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .resume-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-inner { grid-template-columns: minmax(0, 1fr) 200px; gap: 32px; }
  .hero-title { font-size: 48px; }
  .ep-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .watch { grid-template-columns: minmax(0, 1fr); }
  .panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel > * { min-width: 0; }
  .panel > .span { grid-column: 1 / -1; }
  .picker .ep-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols, .editor { grid-template-columns: minmax(0, 1fr); }
  .admin { grid-template-columns: minmax(0, 1fr); }
  .sidebar { border-inline-end: 0; border-bottom: 1px solid var(--line); padding-block: 16px; }
  .side-nav { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .side-foot { margin-top: 0; }
  .topbar, .admin-main { padding-inline: 24px; }
}

/* Phone */
@media (max-width: 639px) {
  :root { --gutter: 16px; }
  .header-row { gap: 8px 12px; }
  .brand-name { font-size: 24px; }
  .search { order: 3; flex: 1 1 100%; margin-inline-start: 0; }
  .search input { width: 100%; }
  .main-nav { order: 4; flex: 1 1 100%; margin-inline: calc(var(--gutter) * -1); overflow-x: auto; scrollbar-width: none; }
  .main-nav ul { width: max-content; padding-inline: var(--gutter); }
  .section { padding-top: 36px; }
  .section-title { font-size: 24px; }
  .hero-inner { grid-template-columns: minmax(0, 1fr); gap: 24px; padding-block: 32px 40px; }
  .hero-poster { order: -1; width: 150px; }
  .hero-title { font-size: 34px; }
  .hero-text { font-size: 16px; }
  .actions .btn { flex: 1 1 100%; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 14px; }
  .resume-list { grid-template-columns: minmax(0, 1fr); }
  .drama-head { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .drama-head .poster { width: 160px; }
  .drama-head h1 { font-size: 32px; }
  .ep-grid, .picker .ep-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .stage { padding: 20px 12px 16px; border-radius: var(--r-m); }
  .panel { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .watch-info h1 { font-size: 30px; }
  .upnext { grid-template-columns: minmax(0, 1fr); }
  .footer-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stat b { font-size: 32px; }
  .bars, .bar-days { gap: 6px; }
  .topbar, .admin-main { padding-inline: 16px; }
  .admin-main > h1, .page-title { font-size: 28px; }
  .form-grid.two, .genre-list { grid-template-columns: minmax(0, 1fr); }
  .side-nav { display: flex; flex-wrap: wrap; gap: 6px; }
  .side-nav a { border: 1px solid var(--line); }
}

/* Pages, forms, pagination and small states */
.page-h1 { font: 700 40px/1.15 var(--font-head); letter-spacing: -.01em; text-wrap: balance; }
.list-intro { max-width: 68ch; margin-bottom: 28px; color: var(--muted); }
.empty { padding: 32px 0; color: var(--muted); }
.notice { padding-block: 64px; max-width: 700px; }
.notice p { margin-top: 12px; color: var(--muted); }
.form-page { max-width: 760px; }
.form-page .list-intro { margin-top: 12px; }
.form-page .stack { margin-top: 24px; }
.prose { max-width: 760px; }
.prose h2 { margin: 32px 0 10px; font: 600 24px/1.3 var(--font-head); }
.prose p, .prose ul, .prose ol { margin-top: 12px; color: var(--muted); }
.prose ul { list-style: disc; padding-inline-start: 22px; }
.prose ol { list-style: decimal; padding-inline-start: 22px; }
.starter-banner { margin: 18px 0 8px; padding: 14px 16px; border: 1px solid var(--amber); border-radius: var(--r-s); background: rgba(255, 184, 77, .08); color: var(--text) !important; }
.pagination { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 12px 16px; margin-top: 40px; }
.pagination-now { color: var(--muted); font-weight: 600; }
.hp { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.player-msg { position: absolute; z-index: 3; inset: 0; display: grid; place-content: center; justify-items: center; gap: 16px; padding: 28px; text-align: center; background: rgba(23, 14, 20, .84); font-weight: 600; }
.stage-note { overflow-wrap: anywhere; }
@media (max-width: 639px) { .page-h1 { font-size: 32px; } }

/* Admin extras */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 420px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); }
.login-card .page-title { font: 700 32px/1.2 var(--font-head); }
.filter { display: flex; flex-wrap: wrap; align-items: end; gap: 12px 16px; }
.filter .field { min-width: 200px; flex: 1 1 200px; }
.inline-form { display: flex; flex-wrap: wrap; align-items: end; gap: 12px 16px; }
.inline-form .field { flex: 1 1 220px; min-width: 0; }
.inline-form .field.narrow { flex: 0 1 110px; }
.inline-form .hint { align-self: center; }
.genre-row { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 20px; }
.genre-row > form:first-child { flex: 1 1 520px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.row-actions form { margin: 0; }
.section-legend { font: 600 20px/1.3 var(--font-head); color: var(--text); text-transform: none; letter-spacing: 0; margin-bottom: 4px; }
.facts-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin: 6px 0 16px; }
.facts-list dt { font-size: 13px; font-weight: 700; color: var(--muted); }
.facts-list dd { margin: 0; overflow-wrap: anywhere; }
.pre { white-space: pre-wrap; }
code { padding: 1px 6px; border-radius: 6px; background: var(--bg); border: 1px solid var(--line); font-size: .92em; }
.hint .warn, .hint-row .warn { display: inline-flex; align-items: center; gap: 6px; }

.install-wrap { max-width: 760px; padding-block: 56px 80px; display: grid; gap: 24px; }
.install-wrap .stack { margin-top: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .card:hover .poster { transform: none; }
}
