:root {
  --bg: #f4f2ee;
  --bg-2: #ebe7e0;
  --surface: #ffffff;
  --ink: #16181d;
  --muted: #5f646e;
  --line: #e2ded6;
  --accent: #4338ca;
  --accent-2: #6d5efc;
  --accent-ink: #ffffff;
  --accent-soft: #ecebfd;
  --good: #0f9f6e;
  --warn: #d9480f;
  --tile: #ffffff;
  --tile-ink: #16181d;
  --tile-line: #d7d9de;
  --shadow: 0 1px 2px rgba(20, 20, 40, .05), 0 8px 24px -8px rgba(20, 20, 40, .12);
  --radius: 16px;
  --display: "Fraunces", Georgia, serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1016;
    --bg-2: #161822;
    --surface: #181a24;
    --ink: #eceef4;
    --muted: #9a9fad;
    --line: #2a2d3a;
    --accent: #8b80ff;
    --accent-2: #b3a9ff;
    --accent-ink: #0f1016;
    --accent-soft: #242240;
    --good: #34d399;
    --warn: #fb923c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -10px rgba(0, 0, 0, .6);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
[hidden] { display: none !important; }

/* Header */
.brand { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand-inner { max-width: 1080px; margin: 0 auto; padding: 14px 20px; display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.01em; }
.logo { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); display: grid; place-items: center; }
.logo svg { width: 20px; height: 20px; fill: #fff; }
.logo .q { fill: none; stroke: #fff; stroke-width: 1.6; stroke-dasharray: 2 2; }

.screen { max-width: 720px; margin: 0 auto; padding: 24px 20px 80px; }
.screen.wide { max-width: 1080px; }
h1, h2, h3 { letter-spacing: -.02em; }
h1 { font-family: var(--display); font-size: clamp(34px, 5.5vw, 58px); line-height: 1.05; margin: 12px 0 18px; font-weight: 700; }
h1 em { font-style: normal; background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
h2 { font-size: 22px; margin: 0 0 16px; }
h3 { font-size: 17px; margin: 12px 0 6px; }
.lede { color: var(--muted); font-size: 18px; max-width: 54ch; margin: 0 0 24px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin: 20px 0; box-shadow: var(--shadow); }

/* Buttons */
.btn {
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 11px 18px; border-radius: 12px; transition: transform .12s, border-color .12s, box-shadow .12s, opacity .12s;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border: 0; padding: 15px 28px; font-size: 17px; box-shadow: 0 8px 20px -8px var(--accent); }
@media (prefers-color-scheme: dark) { .btn.primary { color: #0f1016; } }
.btn.primary:hover:not(:disabled) { box-shadow: 0 12px 26px -8px var(--accent); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); border-color: transparent; }
.btn.block { width: 100%; }

/* Landing: hero */
.hero { display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center; padding: 40px 0 56px; }
.kicker { display: inline-block; margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); padding: 5px 12px; border-radius: 999px; }
.facts { list-style: none; padding: 0; display: flex; gap: 28px; margin: 0 0 32px; }
.facts li { display: flex; flex-direction: column; }
.facts strong { font-family: var(--display); font-size: 30px; line-height: 1.1; }
.facts span { color: var(--muted); font-size: 14px; }

.hero-art { position: relative; }
.hero-art::before { content: ""; position: absolute; inset: -30px; background: radial-gradient(closest-side, color-mix(in srgb, var(--accent-2) 30%, transparent), transparent); filter: blur(10px); z-index: 0; }
.sample { position: relative; z-index: 1; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 22px; box-shadow: var(--shadow); transform: rotate(1.5deg); }
.sample-label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.sample-hint { margin-top: 12px; color: var(--muted); font-size: 14px; text-align: center; }
.sample .matrix { width: 100%; margin: 0; }

/* Landing: areas */
.areas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 56px; }
.area { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.area p { color: var(--muted); margin: 0; font-size: 15px; }
.area-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 18px; }

/* Landing: steps */
.steps { margin-bottom: 56px; }
.steps ol { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.steps li { display: flex; gap: 14px; }
.steps li > span { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--accent); color: var(--accent); display: grid; place-items: center; font-weight: 700; }
.steps p { margin: 4px 0 0; color: var(--muted); font-size: 15px; }

/* Landing: start panel */
.start-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; overflow: hidden; box-shadow: var(--shadow); scroll-margin-top: 90px; }
.start-rules { padding: 32px; background: var(--bg-2); }
.checks { list-style: none; padding: 0; margin: 0; }
.checks li { position: relative; padding-left: 30px; margin: 12px 0; color: var(--muted); }
.checks li::before { content: "✓"; position: absolute; left: 0; top: 1px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 800; display: grid; place-items: center; }
.start-box { padding: 32px; }
.price-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.price-big { font-family: var(--display); font-size: 44px; line-height: 1; font-weight: 700; }
.price-sub { color: var(--muted); font-size: 14px; margin-top: 6px; }
.free-tag { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); font-weight: 700; font-size: 13px; padding: 5px 10px; border-radius: 999px; white-space: nowrap; }
.price-text { color: var(--muted); font-size: 15px; margin: 18px 0; }
.ack { display: flex; gap: 12px; align-items: flex-start; margin: 0 0 18px; cursor: pointer; font-size: 15px; }
.ack input { margin-top: 3px; width: 18px; height: 18px; flex: none; accent-color: var(--accent); }
.foot { text-align: center; color: var(--muted); font-size: 13px; margin-top: 40px; }

/* Matrix figures */
.matrix {
  display: grid; grid-template-columns: repeat(3, 1fr);
  width: min(100%, 340px); margin: 0 auto 24px;
  background: var(--tile); border-radius: 12px; overflow: hidden;
  outline: 2px solid var(--tile-ink); outline-offset: -2px;
}
.matrix > div { aspect-ratio: 1; border: 1px solid var(--tile-line); display: grid; place-items: center; }
.matrix svg { width: 100%; height: 100%; display: block; }
.matrix .missing { font-family: var(--display); font-size: 42px; font-weight: 700; color: var(--accent); background: repeating-linear-gradient(45deg, #f3f2ff, #f3f2ff 8px, #ebe9ff 8px, #ebe9ff 16px); }

/* Test screen */
.test-head { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; margin-bottom: 4px; }
.q-count { font-weight: 700; font-size: 18px; margin-bottom: 8px; }
.q-count .of { color: var(--muted); font-weight: 500; }
.progress { height: 6px; background: var(--line); border-radius: 6px; overflow: hidden; }
#progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 6px; transition: width .3s; }
.ring { position: relative; width: 72px; height: 72px; display: grid; place-items: center; }
.ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 3.5; }
.ring-bg { stroke: var(--line); }
.ring-fg { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 119.4; transition: stroke-dashoffset .25s linear, stroke .3s; }
.ring span { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 16px; }
.ring.low .ring-fg { stroke: var(--warn); }
.ring.low span { color: var(--warn); }

.question { margin-top: 20px; animation: rise .25s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.q-type { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); padding: 4px 10px; border-radius: 999px; }
.prompt { font-size: 20px; font-weight: 600; margin: 12px 0 20px; line-height: 1.4; }
.series { font-family: var(--display); font-size: clamp(28px, 7vw, 42px); font-weight: 700; letter-spacing: .02em; text-align: center; padding: 28px 12px; background: var(--bg-2); border-radius: 14px; margin-bottom: 20px; font-variant-numeric: tabular-nums; }
.statement { font-size: 18px; background: var(--bg-2); border-left: 4px solid var(--accent); border-radius: 10px; padding: 18px 20px; margin-bottom: 20px; }

.options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.options.text { grid-template-columns: 1fr; }
@media (min-width: 560px) { .options.text { grid-template-columns: repeat(2, 1fr); } }
.opt {
  font: inherit; font-size: 17px; color: var(--ink); text-align: left;
  border: 2px solid var(--line); background: var(--surface); border-radius: 12px;
  cursor: pointer; padding: 14px 16px; display: flex; align-items: center; gap: 12px;
  transition: border-color .12s, background .12s, transform .12s;
}
.opt:hover { border-color: var(--accent); transform: translateY(-1px); }
.opt.selected { border-color: var(--accent); background: var(--accent-soft); }
.opt .letter { flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: 13px; font-weight: 700; color: var(--muted); background: var(--bg-2); }
.opt.selected .letter { background: var(--accent); color: #fff; }
.opt.figure { padding: 8px; flex-direction: column; gap: 6px; }
.opt.figure .tile { width: 100%; aspect-ratio: 1; background: var(--tile); border-radius: 8px; max-width: 120px; border: 1px solid var(--tile-line); }
.opt.figure svg { width: 100%; height: 100%; display: block; }

.nav { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.dots { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 28px 0 0; }
.dots button {
  width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; padding: 0;
}
.dots button.answered { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.dots button.current { outline: 2px solid var(--accent); outline-offset: 1px; color: var(--ink); }

/* Paywall */
.paywall { text-align: center; padding: 40px 28px; margin-top: 24px; }
.paywall h1 { font-size: clamp(30px, 5vw, 40px); margin: 16px 0 8px; }
.paywall .lede { margin: 0 auto 24px; }
.done-icon { width: 60px; height: 60px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good); font-size: 28px; font-weight: 800; }
.preview { position: relative; background: var(--bg-2); border-radius: 14px; padding: 20px; margin: 0 auto 24px; max-width: 420px; overflow: hidden; }
.preview-blur { filter: blur(8px); user-select: none; color: var(--accent); }
.preview-iq { font-family: var(--display); font-size: 64px; font-weight: 700; color: var(--ink); line-height: 1; }
.preview svg { width: 100%; height: 60px; }
.lock { position: absolute; inset: 0; display: grid; place-items: center; font-size: 34px; }
.includes { list-style: none; text-align: left; max-width: 420px; margin: 0 auto 24px; padding: 0; }
.includes li { position: relative; padding-left: 30px; margin: 10px 0; }
.includes li::before { content: "✓"; position: absolute; left: 0; top: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 800; display: grid; place-items: center; }
.paywall .btn.block { max-width: 420px; }
.fine { color: var(--muted); font-size: 14px; margin: 14px 0 0; }
.error { color: var(--warn); }

/* Results */
.result-hero { text-align: center; padding: 40px 20px 32px; border-radius: 22px; margin-top: 16px; color: #fff; background: radial-gradient(120% 120% at 20% 0%, #7c6dff 0%, #4338ca 55%, #2a1f8f 100%); box-shadow: var(--shadow); }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: 13px; font-weight: 600; margin: 0; opacity: .8; }
.iq-big { font-family: var(--display); font-size: clamp(88px, 22vw, 140px); font-weight: 700; line-height: 1; letter-spacing: -.03em; margin: 8px 0; font-variant-numeric: tabular-nums; }
.class-label { font-size: 22px; font-weight: 700; margin: 0; }
.band { margin: 6px 0 0; opacity: .85; }
#curve { width: 100%; height: auto; display: block; }
.pct { text-align: center; margin: 8px 0 0; font-size: 17px; }
.card > h2:first-child { margin-top: 0; }
.cat { margin: 18px 0; }
.cat-head { display: flex; justify-content: space-between; margin-bottom: 8px; font-weight: 600; }
.cat-head span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { height: 10px; background: var(--bg-2); border-radius: 10px; overflow: hidden; }
.bar > div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 10px; }
.meta { color: var(--muted); font-size: 14px; margin-bottom: 0; }
.disclaimer { color: var(--muted); font-size: 14px; }

/* Responsive */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 40px; padding: 24px 0 48px; }
  .hero-art { max-width: 380px; width: 100%; margin: 0 auto; }
  .areas, .steps ol { grid-template-columns: 1fr; }
  .start-panel { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .screen { padding: 16px 16px 64px; }
  .card { padding: 18px; }
  .facts { gap: 20px; }
  .options { gap: 8px; }
  .opt.figure { padding: 5px; }
  .start-rules, .start-box { padding: 24px; }
  .ring { width: 60px; height: 60px; }
  .ring span { font-size: 14px; }
}
