/* ==========================================================================
   Black Movies Trivia — site styles
   Concept: an after-hours movie palace. Deep aubergine house lights, brass
   marquee gold, and a kente-weave stripe as the house signature.
   ========================================================================== */

:root {
  color-scheme: dark;
  --bg: #14111f;
  --bg-2: #1a1628;
  --surface: #1f1a31;
  --surface-2: #2a2342;
  --ink: #f4efe6;
  --muted: #b5adc7;
  --faint: #7d7593;
  --gold: #e5b65a;
  --gold-strong: #f2cb7b;
  --on-gold: #1b1407;
  --red: #d5573f;
  --green: #45a774;
  --line: rgba(229, 182, 90, 0.18);
  --line-soft: rgba(244, 239, 230, 0.08);
  --good: #4fc285;
  --good-bg: rgba(79, 194, 133, 0.13);
  --bad: #ef6b57;
  --bad-bg: rgba(239, 107, 87, 0.13);
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.6);

  --f-display: "DM Serif Display", "Iowan Old Style", Georgia, serif;
  --f-body: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;

  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.2rem;
  --step-2: 1.5rem;
  --step-3: clamp(1.75rem, 1.4rem + 1.5vw, 2.4rem);
  --step-4: clamp(2.4rem, 1.6rem + 3.6vw, 4.25rem);

  --radius: 14px;
  --radius-lg: 22px;
  --gutter: max(20px, env(safe-area-inset-left, 0px));
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f3f8;
  --bg-2: #ece8f3;
  --surface: #ffffff;
  --surface-2: #f0ecf6;
  --ink: #1b1630;
  --muted: #554e6b;
  --faint: #857d9c;
  --gold: #9a6912;
  --gold-strong: #7d540b;
  --on-gold: #ffffff;
  --red: #b33d28;
  --green: #2b7a51;
  --line: rgba(154, 105, 18, 0.22);
  --line-soft: rgba(27, 22, 48, 0.09);
  --good: #23824f;
  --good-bg: rgba(35, 130, 79, 0.1);
  --bad: #c0412c;
  --bad-bg: rgba(192, 65, 44, 0.09);
  --shadow: 0 24px 50px -28px rgba(40, 28, 70, 0.35);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f5f3f8;
    --bg-2: #ece8f3;
    --surface: #ffffff;
    --surface-2: #f0ecf6;
    --ink: #1b1630;
    --muted: #554e6b;
    --faint: #857d9c;
    --gold: #9a6912;
    --gold-strong: #7d540b;
    --on-gold: #ffffff;
    --red: #b33d28;
    --green: #2b7a51;
    --line: rgba(154, 105, 18, 0.22);
    --line-soft: rgba(27, 22, 48, 0.09);
    --good: #23824f;
    --good-bg: rgba(35, 130, 79, 0.1);
    --bad: #c0412c;
    --bad-bg: rgba(192, 65, 44, 0.09);
    --shadow: 0 24px 50px -28px rgba(40, 28, 70, 0.35);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 6px; }

.container {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 50;
  background: var(--gold); color: var(--on-gold);
  padding: 10px 16px; border-radius: 8px; font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: 12px; }

.eyebrow {
  font-family: var(--f-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}
.accent { color: var(--gold); }

/* Kente-weave signature stripe */
.kente {
  height: 6px;
  background:
    repeating-linear-gradient(90deg,
      var(--gold) 0 28px, #111 28px 32px, var(--red) 32px 52px, #111 52px 56px,
      var(--green) 56px 76px, #111 76px 80px, var(--gold) 80px 92px, var(--red) 92px 100px);
  opacity: 0.95;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px;
  padding: 12px 24px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: background-color .18s, border-color .18s, transform .18s, color .18s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--gold); color: var(--on-gold); }
.btn-primary:hover { background: var(--gold-strong); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.icon-btn {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: 50%;
}
.icon-btn svg { width: 18px; height: 18px; stroke: var(--muted); stroke-width: 2.2; fill: none; stroke-linecap: round; }
.icon-btn:hover svg { stroke: var(--ink); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
}
.header-inner { display: flex; align-items: center; gap: 24px; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; margin-right: auto; }
.brand-mark { width: 30px; height: 30px; color: var(--gold); }
.brand-name { font-family: var(--f-display); font-size: 1.3rem; letter-spacing: 0.01em; white-space: nowrap; }
.brand-name em { font-style: italic; color: var(--gold); }
.site-nav { display: flex; gap: 4px; }
.site-nav a {
  text-decoration: none; font-weight: 600; font-size: 0.95rem; color: var(--muted);
  padding: 8px 12px; border-radius: 8px;
}
.site-nav a:hover { color: var(--ink); background: var(--surface); }
.theme-toggle {
  width: 40px; height: 40px; display: grid; place-items: center;
  background: transparent; border: 1px solid var(--line-soft); border-radius: 50%;
}
.theme-toggle svg { width: 18px; height: 18px; fill: var(--gold); }

@media (max-width: 760px) {
  .header-inner { flex-wrap: wrap; gap: 0 12px; min-height: 60px; padding-top: 8px; }
  .site-nav {
    order: 3; width: 100%;
    overflow-x: auto; scrollbar-width: none;
    margin: 0 -8px; padding-bottom: 6px;
  }
  .site-nav::-webkit-scrollbar { display: none; }
  .site-nav a { white-space: nowrap; font-size: 0.9rem; padding: 6px 8px; }
}

/* ---------- Hero ---------- */
.hero {
  padding-block: clamp(48px, 8vw, 96px) clamp(48px, 7vw, 88px);
  background:
    radial-gradient(60% 80% at 85% 0%, color-mix(in srgb, var(--gold) 12%, transparent), transparent 70%),
    radial-gradient(50% 60% at 0% 100%, color-mix(in srgb, var(--red) 10%, transparent), transparent 70%);
}
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(32px, 5vw, 72px); align-items: center; }
.hero-copy { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.hero h1 { font-family: var(--f-display); font-weight: 400; font-size: var(--step-4); line-height: 1.04; letter-spacing: -0.01em; }
.lede { font-size: var(--step-1); color: var(--muted); max-width: 34em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-facts { display: flex; flex-wrap: wrap; gap: 12px 36px; margin: 8px 0 0; padding-top: 22px; border-top: 1px solid var(--line-soft); }
.hero-facts div { display: flex; flex-direction: column; }
.hero-facts dt { font-family: var(--f-mono); font-weight: 700; font-size: 1.25rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.hero-facts dd { margin: 0; font-size: var(--step--1); color: var(--faint); }

/* Daily challenge "ticket" */
.ticket-card {
  display: grid; grid-template-columns: minmax(0, 1fr) 84px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.ticket-main { padding: 28px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ticket-kicker { font-family: var(--f-mono); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold); }
.ticket-title { font-family: var(--f-display); font-weight: 400; font-size: var(--step-3); line-height: 1.1; }
.ticket-date { font-family: var(--f-mono); font-size: 0.85rem; color: var(--muted); }
.ticket-desc { color: var(--muted); margin-bottom: 8px; }
.ticket-status { font-size: 0.9rem; color: var(--muted); text-align: center; }
.ticket-status strong { color: var(--gold); font-family: var(--f-mono); }
.ticket-stub {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: var(--gold); color: var(--on-gold);
  border-left: 2px dashed color-mix(in srgb, var(--on-gold) 35%, transparent);
  font-family: var(--f-mono); text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.7rem;
  writing-mode: vertical-rl; transform: rotate(180deg);
}
.ticket-stub strong { font-family: var(--f-display); font-size: 1.8rem; letter-spacing: 0.04em; text-transform: none; }
.ticket-stub .stub-no { margin-top: 10px; opacity: 0.75; }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Sections ---------- */
.section { padding-block: clamp(56px, 8vw, 96px); }
.section-alt { background: var(--bg-2); border-block: 1px solid var(--line-soft); }
.section-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 36px; max-width: 640px; }
.section-head h2 { font-family: var(--f-display); font-weight: 400; font-size: var(--step-3); line-height: 1.1; }
.section-sub { color: var(--muted); }

/* Category cards */
.category-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.category-grid .featured { grid-column: 1 / -1; }
.category-grid .featured h3 { font-size: clamp(1.7rem, 1.3rem + 1.4vw, 2.3rem); }
.category-grid .featured p { max-width: 46ch; }
@media (max-width: 900px) { .category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .category-grid { grid-template-columns: minmax(0, 1fr); } }
.cat-card {
  position: relative;
  display: flex; flex-direction: column; gap: 10px;
  text-align: left;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  transition: border-color .2s, transform .2s, box-shadow .2s;
  min-width: 0;
}
.cat-card:hover { border-color: var(--line); transform: translateY(-3px); box-shadow: var(--shadow); }
.cat-card .cat-num { font-family: var(--f-mono); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.16em; color: var(--faint); text-transform: uppercase; }
.cat-card h3 { font-family: var(--f-display); font-weight: 400; font-size: 1.55rem; line-height: 1.15; }
.cat-card p { color: var(--muted); font-size: 0.95rem; }
.cat-card .cat-foot { margin-top: auto; padding-top: 14px; display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line-soft); font-size: 0.85rem; color: var(--faint); }
.cat-card .cat-go { color: var(--gold); font-weight: 700; }
.cat-card.featured { background: linear-gradient(150deg, color-mix(in srgb, var(--gold) 16%, var(--surface)), var(--surface) 60%); border-color: var(--line); }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1px; margin: 0; background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); overflow: hidden; }
.stats-grid div { background: var(--surface); padding: 22px; display: flex; flex-direction: column; gap: 4px; }
.stats-grid dt { font-family: var(--f-mono); font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.stats-grid dd { margin: 0; color: var(--muted); font-size: 0.9rem; }

/* How to play */
.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 28px; }
.steps li { counter-increment: step; display: flex; flex-direction: column; gap: 8px; padding-top: 18px; border-top: 2px solid var(--line); }
.steps li::before { content: counter(step, decimal-leading-zero); font-family: var(--f-mono); font-weight: 700; color: var(--gold); font-size: 0.85rem; }
.steps h3 { font-size: 1.15rem; }
.steps p { color: var(--muted); }

/* ---------- Game ---------- */
.game { max-width: 760px; padding-block: 28px 64px; display: flex; flex-direction: column; gap: 16px; }
.game-top { display: flex; align-items: center; gap: 14px; }
.game-meta { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.game-cat { font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.game-count { color: var(--muted); font-size: 0.95rem; }
.game-count strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.game-score { display: flex; align-items: baseline; gap: 4px; padding: 8px 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.game-score span { font-family: var(--f-mono); font-weight: 700; font-size: 1.2rem; color: var(--gold); font-variant-numeric: tabular-nums; }
.game-score small { color: var(--faint); font-size: 0.8rem; }

.filmstrip { display: flex; gap: 4px; padding: 6px; background: #0b0911; border-radius: 6px; }
.filmstrip i { flex: 1; height: 10px; border-radius: 2px; background: rgba(255, 255, 255, 0.12); }
.filmstrip i.now { background: var(--gold); }
.filmstrip i.ok { background: var(--good); }
.filmstrip i.no { background: var(--bad); }

.timer { height: 4px; background: var(--line-soft); border-radius: 2px; overflow: hidden; }
.timer-bar { height: 100%; background: var(--gold); transform-origin: left center; }
.timer-bar.low { background: var(--bad); }

.q-card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  padding: clamp(22px, 4vw, 36px);
  display: flex; flex-direction: column; gap: 22px;
  box-shadow: var(--shadow);
}
.q-tags { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tag { font-size: 0.8rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.tag-diff { text-transform: capitalize; }
.q-clock { margin-left: auto; font-family: var(--f-mono); font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.q-text { font-family: var(--f-display); font-weight: 400; font-size: clamp(1.4rem, 1.1rem + 1.4vw, 2rem); line-height: 1.25; }

.options { display: grid; gap: 10px; }
.option {
  display: flex; align-items: center; gap: 14px;
  width: 100%;
  min-height: 58px;
  padding: 12px 16px;
  text-align: left;
  background: var(--bg-2);
  border: 1.5px solid var(--line-soft);
  border-radius: var(--radius);
  font-weight: 600;
  transition: border-color .15s, background-color .15s;
}
.option:hover:not(:disabled) { border-color: var(--gold); }
.option .key {
  flex: none; width: 30px; height: 30px; display: grid; place-items: center;
  font-family: var(--f-mono); font-size: 0.85rem; font-weight: 700;
  border-radius: 8px; background: var(--surface-2); color: var(--muted);
}
.option:disabled { cursor: default; }
.option.correct { border-color: var(--good); background: var(--good-bg); }
.option.correct .key { background: var(--good); color: #fff; }
.option.wrong { border-color: var(--bad); background: var(--bad-bg); }
.option.wrong .key { background: var(--bad); color: #fff; }
.option.dim { opacity: 0.5; }

.reveal { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; padding-top: 20px; border-top: 1px dashed var(--line); }
.verdict { font-weight: 800; font-size: 1.05rem; }
.verdict.ok { color: var(--good); }
.verdict.no { color: var(--bad); }
.fact { color: var(--muted); max-width: 62ch; }

.confirm {
  display: flex; flex-direction: column; gap: 14px;
  padding: 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--bad);
}
.confirm-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- Results ---------- */
.results { max-width: 760px; padding-block: 40px 72px; display: flex; flex-direction: column; gap: 24px; }
.result-ticket {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow);
}
.result-main { padding: clamp(24px, 4vw, 36px); display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.result-rank { font-family: var(--f-display); font-weight: 400; font-size: var(--step-3); line-height: 1.1; }
.result-line { color: var(--muted); }
.result-stats { display: flex; flex-wrap: wrap; gap: 12px 32px; margin: 10px 0 0; }
.result-stats div { display: flex; flex-direction: column; }
.result-stats dt { font-family: var(--f-mono); font-weight: 700; font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.result-stats dd { margin: 0; font-size: 0.85rem; color: var(--faint); }
.result-stub {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px clamp(20px, 4vw, 36px);
  background: var(--gold); color: var(--on-gold);
  border-left: 2px dashed color-mix(in srgb, var(--on-gold) 35%, transparent);
}
.result-stub strong { font-family: var(--f-mono); font-size: clamp(2rem, 1.5rem + 2vw, 2.8rem); line-height: 1; font-variant-numeric: tabular-nums; }
.result-stub span { font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase; }
.kente-bottom { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.share-note { color: var(--good); font-weight: 600; min-height: 1.5em; }

.review h3 { font-family: var(--f-display); font-weight: 400; font-size: 1.6rem; margin-bottom: 14px; }
.review-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.review-list li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; padding: 16px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); }
.review-list .mark { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 0.9rem; }
.review-list .mark.ok { background: var(--good-bg); color: var(--good); }
.review-list .mark.no { background: var(--bad-bg); color: var(--bad); }
.review-list .rq { font-weight: 600; }
.review-list .ra { color: var(--muted); font-size: 0.92rem; }

@media (max-width: 560px) {
  .result-ticket { grid-template-columns: minmax(0, 1fr); }
  .result-stub { flex-direction: row; gap: 10px; border-left: 0; border-top: 2px dashed color-mix(in srgb, var(--on-gold) 35%, transparent); padding-bottom: 28px; }
  .ticket-card { grid-template-columns: minmax(0, 1fr) 64px; }
  .ticket-main { padding: 22px; }
}

/* ---------- Content pages ---------- */
.page { padding-block: clamp(48px, 7vw, 88px); }
.page-inner { max-width: 720px; display: flex; flex-direction: column; gap: 18px; }
.page h1 { font-family: var(--f-display); font-weight: 400; font-size: var(--step-4); line-height: 1.05; }
.page h2 { font-family: var(--f-display); font-weight: 400; font-size: var(--step-2); margin-top: 18px; }
.page p, .page li { color: var(--muted); max-width: 65ch; }
.page a { color: var(--gold); }
.page ul { padding-left: 1.2em; margin: 0; display: flex; flex-direction: column; gap: 6px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--bg-2); border-top: 1px solid var(--line-soft); }
.footer-inner { padding-block: 40px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px 32px; align-items: start; }
.footer-brand { display: flex; flex-direction: column; gap: 6px; }
.footer-brand p { color: var(--muted); font-size: 0.92rem; }
.footer-nav { display: flex; gap: 20px; flex-wrap: wrap; }
.footer-nav a { color: var(--muted); text-decoration: none; font-weight: 600; }
.footer-nav a:hover { color: var(--gold); }
.footer-copy { grid-column: 1 / -1; color: var(--faint); font-size: 0.82rem; padding-top: 18px; border-top: 1px solid var(--line-soft); }
@media (max-width: 640px) { .footer-inner { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Motion ---------- */
.view { animation: fadeUp .35s ease both; }
@keyframes fadeUp { from { opacity: 0.4; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .view { animation: none; }
  .btn, .cat-card, .option { transition: none; }
}
