/* BrainRank — one stylesheet for every page.
   System fonts only: fast, and no third-party font requests (GDPR-friendly). */

:root {
  --bg: #0a1430;
  --bg-2: #0f1c3f;
  --surface: #13234a;
  --surface-2: #182b58;
  --border: #253a6b;
  --text: #eef2fb;
  --muted: #a3b1d1;
  --faint: #6f80a8;
  --accent: #f2b544;
  --accent-ink: #1a1405;
  --accent-soft: rgba(242, 181, 68, 0.14);
  --ok: #5fd39a;
  --bad: #ff8a80;
  --radius: 14px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
/* `hidden` must win over any display rule (e.g. .stem is flex). */
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  background-image: radial-gradient(1200px 600px at 50% -200px, #16295a 0%, transparent 70%);
  background-repeat: no-repeat;
  color: var(--text);
  font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.015em; margin: 0 0 0.5em; }
h1 { font-size: clamp(1.9rem, 5vw, 2.8rem); font-weight: 750; }
h2 { font-size: 1.4rem; font-weight: 700; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }

.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 16px; }
main { flex: 1; padding: 24px 0 56px; }

/* header / footer */
.site-header { border-bottom: 1px solid rgba(255,255,255,0.06); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 12px; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 750; font-size: 1.1rem; letter-spacing: -0.01em; }
.logo-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; color: var(--accent-ink); font-weight: 800; font-size: 0.95rem; }
.nav { display: flex; gap: 18px; font-size: 0.95rem; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover { color: var(--text); }
.site-footer { border-top: 1px solid rgba(255,255,255,0.06); padding: 24px 0 32px; color: var(--faint); font-size: 0.875rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer nav { display: flex; gap: 16px; flex-wrap: wrap; }

/* buttons */
.btn {
  appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 650;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border-radius: 12px; text-decoration: none;
  background: var(--accent); color: var(--accent-ink); transition: filter .15s, transform .05s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; filter: none; }
.btn.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.block { width: 100%; }
.btn:focus-visible, .option:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* cards & notes */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.note {
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
  background: var(--bg-2); border-radius: 10px; padding: 12px 14px; color: var(--muted); font-size: 0.9rem;
}
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 24px 0; }
.fact { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.fact b { display: block; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.fact span { color: var(--muted); font-size: 0.85rem; }
@media (max-width: 520px) { .facts { grid-template-columns: 1fr 1fr; } .facts .fact:last-child { grid-column: span 2; } }

/* ---------- test page ---------- */
.test-top {
  position: sticky; top: 0; z-index: 5; background: rgba(10, 20, 48, 0.92);
  backdrop-filter: blur(8px); border-bottom: 1px solid rgba(255,255,255,0.06);
}
.test-top .wrap { display: flex; align-items: center; gap: 14px; height: 56px; }
.progress { flex: 1; height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .25s ease; }
.qcount, .timer { font-variant-numeric: tabular-nums; font-size: 0.9rem; white-space: nowrap; }
.qcount { color: var(--muted); }
.timer { font-family: var(--mono); background: var(--surface); border: 1px solid var(--border); padding: 4px 10px; border-radius: 8px; }
.timer.low { color: var(--accent); border-color: var(--accent); }

.qtype { color: var(--faint); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 650; margin-bottom: 6px; }
.prompt { font-size: 1.15rem; font-weight: 650; margin: 0 0 16px; }
.stem { color: var(--text); margin: 0 auto 20px; display: flex; justify-content: center; }
.stem svg { width: 100%; height: auto; max-height: 46vh; }
.stem.single svg { max-width: 220px; }
.stem.row svg { max-width: 560px; }
.stem.matrix svg { max-width: 340px; }
.stem.text {
  font-family: var(--mono); font-size: clamp(1.25rem, 5vw, 1.8rem); font-weight: 600; letter-spacing: 0.02em;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 16px; text-align: center;
}

.options { display: grid; gap: 10px; grid-template-columns: repeat(3, 1fr); }
.options.text { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
@media (max-width: 420px) { .options.svg5 { grid-template-columns: repeat(3, 1fr); } }
.option {
  appearance: none; font: inherit; color: var(--text); cursor: pointer; position: relative;
  background: var(--surface); border: 2px solid var(--border); border-radius: 12px;
  padding: 10px; min-height: 56px; display: grid; place-items: center; transition: border-color .12s, background .12s;
}
.option:hover { border-color: #3a5290; }
.option svg { width: 100%; max-width: 110px; height: auto; display: block; }
.option .letter { position: absolute; top: 6px; left: 8px; font-size: 0.72rem; font-weight: 700; color: var(--faint); }
.option.text-opt { font-family: var(--mono); font-size: 1.25rem; font-weight: 650; padding: 14px 8px; }
.option[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.option[aria-pressed="true"] .letter { color: var(--accent); }

.test-nav { display: flex; gap: 10px; margin-top: 22px; }
.test-nav .btn { flex: 1; }
.test-nav .btn.secondary { flex: 0 0 auto; }

.screen[hidden] { display: none !important; }
.center { text-align: center; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.bar-list { display: grid; gap: 12px; margin: 16px 0; }
.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 0.95rem; }
.bar-row .bar { grid-column: span 2; height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar-row .bar i { display: block; height: 100%; background: var(--accent); }

/* ---------- completion page ---------- */
.done-badge { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 1.6rem; font-weight: 800; margin-bottom: 14px; }
.offer { margin-top: 8px; border-color: #3a4f85; }
.offer h2 { margin-bottom: 6px; }
.price { margin: 0 0 12px; }
.price b { font-size: 1.8rem; margin-right: 6px; }
.checks { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 8px; }
.checks li { padding-left: 28px; position: relative; }
.checks li::before { content: "✓"; position: absolute; left: 4px; color: var(--accent); font-weight: 800; }

/* ---------- leaderboard table ---------- */
.lb { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.lb th { text-align: left; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); font-weight: 650; padding: 0 10px 8px; }
.lb td { padding: 10px; border-top: 1px solid var(--border); }
.lb td:first-child, .lb th:first-child { width: 3em; color: var(--muted); }
.lb td.iq { font-weight: 700; }
.lb td.date { color: var(--muted); font-size: 0.9rem; }
.lb .r1 td:first-child { color: var(--accent); font-weight: 800; }
.empty { color: var(--muted); padding: 14px 0; }

/* ---------- result page ---------- */
.iq-hero { text-align: center; padding: 32px 20px; background: linear-gradient(180deg, var(--surface-2), var(--surface)); }
.eyebrow { color: var(--muted); font-weight: 650; margin: 0; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.8rem; }
.iq-num { font-size: clamp(4.5rem, 20vw, 7rem); font-weight: 800; line-height: 1; margin: 10px 0 12px; color: var(--accent); font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.iq-pct { font-size: 1.2rem; font-weight: 650; margin: 0 0 6px; }
.share-card { width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--border); display: block; margin: 8px 0 14px; }
.row-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.row-btns .input { flex: 1; min-width: 0; }
.input { font: inherit; color: var(--text); background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; min-height: 48px; padding: 0 14px; }
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.check { display: flex; gap: 10px; align-items: center; cursor: pointer; margin-bottom: 12px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
form label { display: block; margin-bottom: 6px; }

/* ---------- tabs ---------- */
.tabs { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 4px; margin: 8px 0 16px; }
.tab { appearance: none; border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600; padding: 8px 16px; border-radius: 9px; cursor: pointer; }
.tab[aria-selected="true"] { background: var(--surface-2); color: var(--text); }

/* ---------- landing ---------- */
.hero { padding: 24px 0 8px; }
.lede { color: var(--muted); font-size: 1.15rem; max-width: 580px; }
.hero-cta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 22px 0 22px; }
.section { margin-top: 48px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.steps { padding-left: 1.3em; display: grid; gap: 12px; margin: 0; }
.steps li::marker { color: var(--accent); font-weight: 800; }
.promises { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.promise { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.promise b { display: block; margin-bottom: 4px; }
.promise span { color: var(--muted); font-size: 0.93rem; }
@media (max-width: 560px) { .promises { grid-template-columns: 1fr; } }

/* ---------- prose pages (privacy, terms, about) ---------- */
.prose { max-width: 680px; }
.prose h2 { margin-top: 1.8em; font-size: 1.25rem; }
.prose h3 { margin-top: 1.4em; font-size: 1.05rem; }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: 6px; }
.prose .summary h2 { margin-top: 0; }
.prose .summary .checks { margin: 0; }
.todo { background: rgba(255, 138, 128, 0.18); color: var(--bad); border-radius: 4px; padding: 0 4px; font-weight: 600; }
details { border-bottom: 1px solid var(--border); padding: 4px 0; }
summary { cursor: pointer; font-weight: 650; padding: 12px 0; list-style-position: outside; }
summary::marker { color: var(--accent); }
details p { color: var(--muted); margin-top: 0; }

/* consent checkbox on the offer card */
.check.consent { align-items: flex-start; font-size: 0.9rem; color: var(--muted); margin: 0 0 14px; }
.check.consent input { margin-top: 3px; flex: 0 0 auto; }
