/* How Wrong Are You? — exam paper, pencil guess, red-pen correction. */
@font-face { font-family: "Archivo"; src: url(/assets/fonts/archivo-wdth.woff2) format("woff2"); font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url(/assets/fonts/atkinson-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url(/assets/fonts/atkinson-700.woff2) format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --paper: #EAF0F4;
  --grid: #D5E0E8;
  --sheet: #FFFFFF;
  --ink: #14213D;
  --ink-soft: #3E4C66;
  --graphite: #5F6B7A;
  --red: #D7263D;
  --red-text: #B01730;
  --hi: #FFE347;
  --green: #1E7A46;
  --amber: #B7791F;
  --inset: 22px;
  --measure: 40rem;
  --display: "Archivo", "Arial Narrow", sans-serif;
  --body: "Atkinson", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--ink);
  font: 400 1.125rem/1.55 var(--body);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
}
/* The exam-paper margin line */
body::before {
  content: ""; position: fixed; top: 0; bottom: 0; left: max(12px, calc(50% - 25rem)); width: 2px;
  background: rgba(215, 38, 61, .35); pointer-events: none;
}
a { color: var(--ink); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--red-text); }
:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--sheet); padding: 8px 12px; z-index: 10; }

.site-head, main, .site-foot { max-width: 46rem; margin: 0 auto; padding: 0 20px 0 max(32px, 20px); }
@media (min-width: 52rem) { .site-head, main, .site-foot { padding-left: 48px; } }

/* Header */
.site-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 14px; padding-bottom: 14px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-mark { width: 34px; height: 34px; flex: none; color: var(--ink); }
.brand-name { display: block; font: 800 1.25rem/1 var(--display); font-stretch: 75%; letter-spacing: -.01em; }
.brand-by { display: block; font-size: .8rem; color: var(--ink-soft); }
.site-head nav { display: flex; gap: 18px; font-weight: 700; }
.site-head nav a { text-decoration: none; padding: 6px 0; }
.site-head nav a:hover { text-decoration: underline; }

/* Shared type */
h1, h2 { font-family: var(--display); font-stretch: 75%; line-height: 1.08; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 6.5vw, 3.25rem); font-weight: 800; margin: .6em 0 .4em; }
h2 { font-size: 1.6rem; font-weight: 750; margin: 1.6em 0 .4em; }
p, ul, ol { max-width: var(--measure); }
.lede { font-size: 1.25rem; color: var(--ink-soft); }
small { color: var(--graphite); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 10px 18px;
  font: 700 1.05rem/1.2 var(--body); color: var(--sheet); background: var(--ink); border: 2px solid var(--ink);
  border-radius: 4px; text-decoration: none; cursor: pointer;
}
.btn:hover { color: var(--sheet); background: var(--ink-soft); }
.btn.primary { box-shadow: 4px 4px 0 var(--red); }
.btn[disabled], button[disabled] { opacity: .45; cursor: not-allowed; }

/* Home */
.home-hero h1 { font-size: clamp(2.4rem, 8vw, 4rem); max-width: 14ch; }
.papers { display: grid; gap: 20px; margin: 28px 0; }
@media (min-width: 40rem) { .papers { grid-template-columns: 1fr 1fr; } }
.paper {
  display: flex; flex-direction: column; gap: 14px; padding: 18px 18px 20px; text-decoration: none;
  background: var(--sheet); border: 2px solid var(--ink); border-radius: 3px; box-shadow: 6px 6px 0 var(--ink);
  transition: transform .15s ease, box-shadow .15s ease;
}
.paper:hover { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 var(--ink); color: var(--ink); }
.paper-head { display: flex; justify-content: space-between; border-bottom: 2px dotted var(--ink-soft); padding-bottom: 8px; font-weight: 700; }
.paper-title { font: 800 1.9rem/1.05 var(--display); font-stretch: 70%; }
.paper-meta { color: var(--ink-soft); }
.paper-go { align-self: flex-start; font-weight: 700; color: var(--sheet); background: var(--ink); padding: 8px 16px; border-radius: 3px; }
.paper.done .paper-go::before { content: "✓ "; }
.how { padding-left: 1.3em; }
.how li { margin: .4em 0; }
.streak-note { font-weight: 700; }

/* Edition landing */
.edition-hero .meta { color: var(--ink-soft); }

/* Game */
.play { padding-bottom: 40px; }
.play-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.paper-id { font-weight: 700; text-decoration: none; }
.paper-id span { color: var(--ink-soft); font-weight: 400; margin-left: 4px; }
.dots { display: flex; gap: 8px; list-style: none; margin: 0; padding: 0; }
.dots li a { display: block; width: 14px; height: 14px; border: 2px solid var(--ink); border-radius: 50%; background: var(--sheet); }
.dots li.now a { background: var(--ink); }
.dots li.g a { background: var(--green); border-color: var(--green); }
.dots li.y a { background: var(--amber); border-color: var(--amber); }
.dots li.r a { background: var(--red); border-color: var(--red); }
.question { font-size: clamp(1.75rem, 5.8vw, 2.6rem); font-weight: 750; max-width: 24ch; margin: .7em 0 .6em; }

.ruler-wrap { margin: 8px 0 18px; }
.readout { display: flex; align-items: baseline; gap: 18px; min-height: 1em; font: 800 clamp(4rem, 17vw, 6.5rem)/1 var(--display); font-stretch: 62%; letter-spacing: -.02em; margin-bottom: 10px; font-variant-numeric: tabular-nums; }
.marked .readout { margin-bottom: 40px; }
.readout .g { position: relative; color: var(--ink); }
.readout .r { display: none; color: var(--red); font-style: italic; transform: rotate(-4deg); transform-origin: left bottom; }
.marked .readout .g { color: var(--graphite); }
.marked .readout .g::after {
  content: ""; position: absolute; left: -4%; right: -4%; top: 52%; height: .09em; background: var(--red);
  transform: rotate(-6deg); border-radius: 4px;
}
.marked.close .readout .g::after { display: none; }
.marked .readout .r { display: inline-block; }
.marked.close .readout .g { color: var(--green); }

.ruler { position: relative; height: 76px; background: var(--sheet); border: 2px solid var(--ink); border-radius: 4px; --p: .5; }
/* Tick marks sit inside an inset so they line up with the slider's travel. */
.ruler::before {
  content: ""; position: absolute; top: 0; left: var(--inset); right: var(--inset); height: 30px;
  background-image:
    repeating-linear-gradient(to right, var(--ink) 0 2px, transparent 2px 10%),
    repeating-linear-gradient(to right, var(--ink-soft) 0 1px, transparent 1px calc(100% / var(--ticks, 50)));
  background-size: 100% 30px, 100% 16px; background-repeat: no-repeat;
}
.ruler::after { content: ""; position: absolute; top: 0; right: calc(var(--inset) - 2px); width: 2px; height: 30px; background: var(--ink); }
.ruler input[type="range"] {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; appearance: none; -webkit-appearance: none;
  background: transparent; cursor: grab; z-index: 3; touch-action: pan-y;
}
.ruler input[type="range"]:active { cursor: grabbing; }
.ruler input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 44px; height: 76px; background: transparent; border: 0; }
.ruler input[type="range"]::-moz-range-thumb { width: 44px; height: 76px; background: transparent; border: 0; }
.ruler input[type="range"]::-webkit-slider-runnable-track { height: 100%; background: transparent; }
.ruler input[type="range"]::-moz-range-track { background: transparent; }
.ruler input[type="range"]:focus-visible { outline: none; }
.ruler:has(input:focus-visible) { outline: 3px solid var(--red); outline-offset: 3px; }
.needle {
  position: absolute; top: -6px; bottom: -14px; width: 4px; margin-left: -2px; background: var(--ink); border-radius: 2px;
  left: calc(var(--inset) + (100% - 2 * var(--inset)) * var(--p)); z-index: 2; pointer-events: none;
}
.needle::after {
  content: ""; position: absolute; left: 50%; bottom: -12px; width: 26px; height: 26px; margin-left: -13px;
  background: var(--ink); border: 3px solid var(--sheet); border-radius: 50%; box-shadow: 0 0 0 2px var(--ink);
}
.untouched .needle::after { animation: nudge 1.6s ease-in-out 2; }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 30% { transform: translateX(-10px); } 60% { transform: translateX(10px); } }
.scale { display: flex; justify-content: space-between; padding: 22px calc(var(--inset) - 14px) 0; font-weight: 700; color: var(--ink-soft); font-size: .95rem; }

.mark { position: absolute; top: 0; bottom: 0; left: calc(var(--inset) + (100% - 2 * var(--inset)) * var(--at)); width: 0; z-index: 1; pointer-events: none; }
.mark span { position: absolute; left: 0; transform: translateX(-50%); font: 700 .85rem/1 var(--body); white-space: nowrap; padding: 3px 6px; border-radius: 3px; }
.mark-you::before { content: ""; position: absolute; top: 0; bottom: 0; left: -2px; width: 4px; background: var(--graphite); }
.mark-you span { bottom: -30px; color: var(--sheet); background: var(--graphite); }
.mark-real::before { content: ""; position: absolute; top: 0; bottom: 0; left: -2px; width: 4px; background: var(--red); }
.mark-real span { top: -30px; color: var(--sheet); background: var(--red); }
.mark-real svg { position: absolute; width: 92px; height: 64px; left: -46px; top: 6px; overflow: visible; }
.mark-real path { fill: none; stroke: var(--red); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.revealed .mark-real path { animation: draw .7s .45s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.mark-crowd { width: auto; }
.mark-crowd::before { content: ""; position: absolute; top: 34px; bottom: 6px; left: -9px; width: 18px; background: var(--hi); opacity: .9; border-radius: 2px; }
.mark-crowd span { top: 40px; color: var(--ink); background: var(--hi); }
.gap {
  position: absolute; top: 0; bottom: 0; z-index: 0;
  left: calc(var(--inset) + (100% - 2 * var(--inset)) * var(--from));
  width: calc((100% - 2 * var(--inset)) * (var(--to) - var(--from)));
  background: repeating-linear-gradient(135deg, rgba(215, 38, 61, .28) 0 5px, transparent 5px 10px);
  transform-origin: var(--origin, left); animation: grow .5s ease-out;
}
@keyframes grow { from { transform: scaleX(0); } }
.revealed .needle { display: none; }

.controls { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; margin-top: 30px; }
.type-in { display: flex; flex-direction: column; gap: 4px; font-size: .95rem; color: var(--ink-soft); }
.type-in input { width: 8.5rem; min-height: 48px; font: 700 1.2rem var(--body); color: var(--ink); padding: 6px 10px; border: 2px solid var(--ink); border-radius: 4px; background: var(--sheet); }
.lock { min-height: 56px; padding: 12px 24px; font: 700 1.15rem var(--body); color: var(--sheet); background: var(--ink); border: 2px solid var(--ink); border-radius: 4px; box-shadow: 4px 4px 0 var(--red); cursor: pointer; }
.lock:not([disabled]):hover { background: var(--ink-soft); }
.revealed .controls { display: none; }

.reveal { margin-top: 44px; padding-top: 6px; }
.verdict { font: 800 clamp(1.6rem, 5vw, 2.2rem)/1.15 var(--display); font-stretch: 75%; margin: 0 0 .3em; }
.verdict .tile { margin-right: .3em; }
.answer { font-size: 1.25rem; }
.answer strong { color: var(--red-text); font-size: 1.5rem; }
.crowd { padding: 10px 14px; background: var(--hi); border-radius: 3px; display: inline-block; }
.context { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.why { font-size: 1.2rem; }
.src { font-size: .95rem; color: var(--ink-soft); }
.next-row { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; margin-top: 28px; }
.next { display: inline-flex; align-items: center; min-height: 56px; padding: 12px 26px; color: var(--sheet); background: var(--ink); border-radius: 4px; text-decoration: none; font-weight: 700; font-size: 1.15rem; box-shadow: 4px 4px 0 var(--red); }
.next:hover { color: var(--sheet); background: var(--ink-soft); }
.ad { margin: 28px 0; min-height: 100px; }

/* Result */
.score-line { font-size: clamp(2.2rem, 7vw, 3.4rem); max-width: 16ch; }
.tiles { display: flex; gap: 10px; list-style: none; padding: 0; margin: 0 0 12px; }
.tiles li { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 4px; color: var(--sheet); font: 800 1.1rem var(--display); border: 2px solid var(--ink); }
.tiles .g { background: var(--green); } .tiles .y { background: var(--amber); } .tiles .r { background: var(--red); } .tiles .n { background: var(--sheet); color: var(--ink); }
.rank { font-size: 1.2rem; font-weight: 700; }
.share { margin: 28px 0; padding: 18px; background: var(--sheet); border: 2px solid var(--ink); border-radius: 4px; }
.share h2 { margin-top: 0; font-size: 1.4rem; }
.share-buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.btn.wa { background: #1F7A4D; border-color: #1F7A4D; }
.btn.fb { background: #1E4DB7; border-color: #1E4DB7; }
.btn.copy, .btn.card { background: var(--sheet); color: var(--ink); }
.btn.copy:hover, .btn.card:hover { background: var(--paper); color: var(--ink); }
.copied { min-height: 1.5em; font-weight: 700; margin: 8px 0 0; }
.review { padding-left: 1.3em; }
.review li { margin: .7em 0; }
.review .yours { color: var(--graphite); }
.review .real { color: var(--red-text); font-weight: 700; }

/* Archive */
.archive-list { list-style: none; padding: 0; columns: 2 12rem; }
.archive-list li { padding: 4px 0; break-inside: avoid; }
.archive-list li span { color: var(--graphite); font-size: .9rem; margin-left: 6px; }
.archive-list li.done a::before { content: "✓ "; color: var(--green); }

/* Facts */
.crumbs { font-size: .95rem; color: var(--ink-soft); margin-top: 18px; }
.fact-q { font-size: 1.2rem; color: var(--ink-soft); }
.fact-a { font: 800 clamp(3.5rem, 14vw, 5.5rem)/1 var(--display); font-stretch: 62%; margin: .2em 0; color: var(--red-text); }
.fact-a span { font: 400 1.2rem var(--body); color: var(--ink-soft); }
.trend { margin: 18px 0; padding: 12px; background: var(--sheet); border: 2px solid var(--ink); border-radius: 4px; max-width: var(--measure); }
.trend svg { width: 100%; height: auto; display: block; }
.trend .axis { stroke: var(--ink); stroke-width: 2; }
.trend .line { fill: none; stroke: var(--red); stroke-width: 3.5; stroke-linejoin: round; stroke-linecap: round; }
.trend .dot { fill: var(--red); }
.trend .tick { font: 700 15px var(--body); fill: var(--ink-soft); }
.trend figcaption { font-size: .95rem; color: var(--ink-soft); margin-top: 6px; }
.bars { list-style: none; padding: 0; max-width: var(--measure); }
.bars li { display: grid; grid-template-columns: 8rem 1fr 5.5rem; align-items: center; gap: 10px; margin: 8px 0; }
.bar-track { height: 18px; background: var(--sheet); border: 2px solid var(--ink); border-radius: 3px; overflow: hidden; }
.bar { display: block; height: 100%; background: var(--ink-soft); }
.bars li.self .bar { background: var(--red); }
.bars li.self .bar-label { font-weight: 700; }
.bar-value { font-weight: 700; white-space: nowrap; text-align: right; }
.bar-value small { display: block; font-weight: 400; font-size: .8rem; }
.bar-label { overflow-wrap: anywhere; }
.related, .fact-list { padding-left: 1.2em; }
.fact-list { columns: 2 16rem; }
.fact-list li { break-inside: avoid; margin: 4px 0; }
.cta { margin: 32px 0; }

.prose { padding-bottom: 32px; }

/* Footer */
.site-foot { margin-top: 48px; padding-top: 20px; padding-bottom: 40px; border-top: 2px solid var(--ink); font-size: .95rem; color: var(--ink-soft); }
.site-foot a { margin-right: 14px; }
.fine { font-size: .85rem; }

@media (max-width: 30rem) {
  .site-head nav { gap: 14px; font-size: .95rem; }
  .bars li { grid-template-columns: 7.9rem 1fr 4.6rem; gap: 8px; font-size: 1.05rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .mark-real path { stroke-dashoffset: 0; }
}
