:root {
  --bg: #16030f;
  --panel: #250a1e;
  --panel-2: #321029;
  --line: rgba(227, 184, 72, 0.35);
  --ink: #fbeef5;
  --muted: #d9b4c8;
  --gold: #e9c25a;
  --gold-2: #b8871a;
  --mag: #e5329a;
  --mag-2: #a3105f;
  --ok: #57d39a;
  --warn: #ffb35c;
  --radius: 14px;
}
* { box-sizing: border-box; min-width: 0; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: radial-gradient(ellipse 80% 50% at 50% -10%, #5a0f48 0%, transparent 60%), var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font: 16px/1.55 Inter, system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}
a { color: var(--gold); }
h1, h2, h3 { line-height: 1.1; margin: 0 0 10px; text-wrap: balance; }
h1 { font-size: clamp(28px, 4vw, 40px); font-weight: 900; letter-spacing: -0.01em; }
h1 em, .brand-name em { font-style: normal; color: var(--mag); }
h2 { font-size: 22px; font-weight: 800; }
h3 { font-size: 17px; font-weight: 700; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 12px max(4vw, 16px);
  background: rgba(22, 3, 15, 0.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { text-decoration: none; display: flex; flex-direction: column; line-height: 1.1; }
.brand-small { font-size: 11px; color: var(--gold); letter-spacing: 0.08em; }
.brand-name { font-weight: 900; font-size: 19px; color: var(--ink); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.nav a { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 10px; font-weight: 600; font-size: 15px; }
.nav a.active, .nav a:hover { color: var(--ink); background: var(--panel-2); }
@media (max-width: 860px) {
  .topbar { position: static; gap: 10px; justify-content: space-between; }
  .nav { order: 3; flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex: none; }
}
.credit-pill {
  text-decoration: none; font-weight: 800; color: #1a0410;
  background: linear-gradient(180deg, #fff0b0, var(--gold) 55%, var(--gold-2));
  padding: 8px 14px; border-radius: 999px; white-space: nowrap;
}
.lowcredits { background: var(--mag-2); color: #fff; text-align: center; font-weight: 600; padding: 8px 16px; font-size: 15px; }
.lowcredits a { color: #fff0b0; font-weight: 800; }
.testmode { background: var(--warn); color: #2a1400; text-align: center; font-weight: 700; padding: 6px; font-size: 14px; }

/* Layout */
.app { max-width: 1180px; margin: 0 auto; padding: clamp(20px, 3vw, 40px) max(4vw, 16px) 80px; }
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.stack > * + * { margin-top: 14px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
}
.card.hero {
  background: linear-gradient(135deg, #5a0f48, #250a1e 70%);
  border-color: var(--gold);
}
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; margin: 28px 0 14px; }
.section-head:first-child { margin-top: 0; }

/* Buttons and inputs */
button, .btn {
  font: 700 16px Inter, sans-serif; min-height: 46px; padding: 10px 18px; border-radius: 12px; border: 0; cursor: pointer;
  color: #1a0410; background: linear-gradient(180deg, #fff0b0, var(--gold) 55%, var(--gold-2)); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
button.secondary, .btn.secondary { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
button.magenta { background: linear-gradient(180deg, #ff5db4, var(--mag) 50%, var(--mag-2)); color: #fff; }
button.danger { background: transparent; color: #ff8fb0; border: 1.5px solid rgba(255, 143, 176, 0.5); }
button:disabled { opacity: 0.55; cursor: wait; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, .chip:focus-visible { outline: 3px solid var(--mag); outline-offset: 2px; }
label { display: block; font-weight: 600; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], textarea, select {
  width: 100%; font: 16px Inter, sans-serif; color: var(--ink); background: #1b0616; border: 1.5px solid var(--line); border-radius: 10px; padding: 11px 12px;
}
textarea { min-height: 96px; resize: vertical; }
.field { margin-bottom: 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.check input { width: 22px; height: 22px; margin-top: 1px; flex: none; accent-color: var(--mag); }

/* Chips (answer options) */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  font: 600 15px Inter, sans-serif; min-height: 44px; padding: 10px 14px; border-radius: 999px; cursor: pointer;
  background: var(--panel-2); color: var(--ink); border: 1.5px solid var(--line);
}
.chip.on { background: var(--mag); border-color: var(--mag); color: #fff; }
.chip.random { border-style: dashed; color: var(--gold); }
.cast-chip.on::before { content: '✓ '; font-weight: 800; }

/* Auth */
.auth { display: grid; gap: 28px; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); align-items: center; min-height: 80vh; }
.auth .pitch h1 { font-size: clamp(34px, 5vw, 54px); }
.auth .pitch .kicker { color: var(--gold); font-weight: 700; letter-spacing: 0.08em; font-size: 13px; text-transform: uppercase; }
.auth ul { padding-left: 20px; color: var(--muted); }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.tabs button { flex: 1; }
@media (max-width: 760px) { .auth { grid-template-columns: 1fr; min-height: 0; } }

/* Wizard */
.progress { height: 8px; background: var(--panel-2); border-radius: 99px; overflow: hidden; margin: 6px 0 18px; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--mag), var(--gold)); }
.question { font-size: clamp(22px, 3vw, 28px); font-weight: 800; margin-bottom: 16px; }

/* Media */
.sheet { width: 100%; border-radius: 10px; border: 1px solid var(--line); background: #0e020a; display: block; aspect-ratio: 16 / 9; object-fit: contain; }
.frame { width: 100%; border-radius: 10px; border: 1px solid var(--line); background: #0e020a; display: block; object-fit: cover; }
.frame.v916 { aspect-ratio: 9 / 16; max-height: 420px; object-fit: contain; }
.frame.h169 { aspect-ratio: 16 / 9; }
.frame.sq { aspect-ratio: 1 / 1; }
.frame.book { aspect-ratio: 4 / 3; }
.placeholder { display: grid; place-items: center; text-align: center; color: var(--muted); padding: 18px; border: 1.5px dashed var(--line); border-radius: 10px; min-height: 160px; }
.lock { background: #1b0616; border-left: 3px solid var(--mag); padding: 10px 12px; border-radius: 0 8px 8px 0; font-size: 14px; }
pre.prompt, pre.script { white-space: pre-wrap; font: 14px/1.5 Inter, sans-serif; background: #1b0616; border-left: 3px solid var(--gold); padding: 12px; border-radius: 0 8px 8px 0; margin: 8px 0; max-height: 420px; overflow: auto; }
.clip { display: grid; gap: 16px; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); }
@media (max-width: 760px) { .clip { grid-template-columns: 1fr; } }
.clip dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0 0 8px; font-size: 14px; }
.clip dt { color: var(--gold); font-weight: 700; }
.clip dd { margin: 0; }
.tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--panel-2); color: var(--gold); border: 1px solid var(--line); }
.tag.mag { color: #fff; background: var(--mag-2); border-color: var(--mag); }
.price { font-weight: 800; color: var(--gold); }
.stat { font-size: 30px; font-weight: 900; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th, table.list td { text-align: left; padding: 8px; border-bottom: 1px solid rgba(227, 184, 72, 0.18); }
table.list td.num, table.list th.num { text-align: right; white-space: nowrap; }
.notice { border: 1.5px solid var(--gold); background: rgba(233, 194, 90, 0.08); border-radius: 12px; padding: 14px 16px; }
.notice.mag { border-color: var(--mag); background: rgba(229, 50, 154, 0.1); }
.busy { display: inline-block; width: 18px; height: 18px; border: 3px solid rgba(26, 4, 16, 0.3); border-top-color: #1a0410; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.notice .busy { border-color: rgba(255, 255, 255, 0.25); border-top-color: var(--gold); vertical-align: -4px; margin-right: 6px; }
video.frame { background: #0e020a; object-fit: contain; }
@media (prefers-reduced-motion: reduce) { .busy { animation: none; } }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #fff; color: #1a0410; padding: 12px 18px; border-radius: 12px; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); max-width: calc(100vw - 32px); z-index: 50; }
.toast.error { background: #ffd6e4; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.movie-card { border-color: var(--gold); background: linear-gradient(135deg, #3a0c30, #250a1e 70%); }
.movie-grid { display: grid; gap: 18px; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); align-items: start; }
@media (max-width: 760px) { .movie-grid { grid-template-columns: 1fr; } }
.movie-options .check { font-weight: 600; }
