/* =========================================================================
   The Millennium Prize Problems, Explained
   Single stylesheet. No frameworks.
   ========================================================================= */

/* ---------- tokens: light is the base, dark overrides below ---------- */
:root {
  --bg:            #f7f5f0;
  --bg-alt:        #efece4;
  --surface:       #ffffff;
  --surface-2:     #f2efe8;
  --line:          #ddd7ca;
  --line-soft:     #e8e3d8;
  --fg:            #14161d;
  --fg-soft:       #3c414f;
  --muted:         #6b7180;
  --grid:          #d9d3c6;
  --gold:          #a3761d;
  --warn:          #c07c0a;
  --warn-ink:      #8a5806;
  --ok:            #2f9e5a;
  --shadow:        0 1px 2px rgba(20,22,29,.05), 0 8px 24px rgba(20,22,29,.06);
  --shadow-lg:     0 2px 4px rgba(20,22,29,.06), 0 18px 48px rgba(20,22,29,.10);

  --accent:        #6d5ce7;
  --accent-deep:   #4b3bc4;
  --accent-text:   var(--accent-deep);
  --accent-wash:   color-mix(in srgb, var(--accent) 10%, transparent);

  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --maxw: 1240px;
  --radius: 14px;
  --topbar-h: 58px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:          #0a0c14;
    --bg-alt:      #0e111b;
    --surface:     #131725;
    --surface-2:   #1a1f30;
    --line:        #262d42;
    --line-soft:   #1d2334;
    --fg:          #eef1f8;
    --fg-soft:     #c3cadb;
    --muted:       #8891a8;
    --grid:        #232a3d;
    --gold:        #e9b44c;
    --warn:        #f0a92a;
    --warn-ink:    #ffc772;
    --ok:          #57d98a;
    --shadow:      0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.35);
    --shadow-lg:   0 2px 6px rgba(0,0,0,.45), 0 24px 60px rgba(0,0,0,.5);
    --accent-text: var(--accent);
  }
}

:root[data-theme="dark"] {
  --bg:          #0a0c14;
  --bg-alt:      #0e111b;
  --surface:     #131725;
  --surface-2:   #1a1f30;
  --line:        #262d42;
  --line-soft:   #1d2334;
  --fg:          #eef1f8;
  --fg-soft:     #c3cadb;
  --muted:       #8891a8;
  --grid:        #232a3d;
  --gold:        #e9b44c;
  --warn:        #f0a92a;
  --warn-ink:    #ffc772;
  --ok:          #57d98a;
  --shadow:      0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.35);
  --shadow-lg:   0 2px 6px rgba(0,0,0,.45), 0 24px 60px rgba(0,0,0,.5);
  --accent-text: var(--accent);
}

/* ---------- per-problem accents ---------- */
[data-accent="pnp"]       { --accent: #7c6bff; --accent-deep: #4b3bc4; }
[data-accent="riemann"]   { --accent: #e9b44c; --accent-deep: #8a5d06; }
[data-accent="yangmills"] { --accent: #ff6b6b; --accent-deep: #c02b2b; }
[data-accent="navier"]    { --accent: #35c4e8; --accent-deep: #0b7c99; }
[data-accent="hodge"]     { --accent: #4ecb71; --accent-deep: #1c7f3c; }
[data-accent="poincare"]  { --accent: #ffa94d; --accent-deep: #a2570a; }
[data-accent="bsd"]       { --accent: #e07ff0; --accent-deep: #9a2cb0; }

/* A custom property is substituted at the element that DECLARES it, so
   `--accent-text: var(--accent)` on :root would always resolve to the root
   indigo. Re-declaring both derived tokens on the accent-carrying element
   itself makes them pick up that element's own --accent / --accent-deep. */
[data-accent] {
  --accent-text: var(--accent-deep);
  --accent-wash: color-mix(in srgb, var(--accent) 10%, transparent);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) [data-accent] { --accent-text: var(--accent); }
}
:root[data-theme="dark"] [data-accent] { --accent-text: var(--accent); }

/* ---------- reset-ish ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-h) + 16px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; }
a { color: var(--accent-text); }

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.14; margin: 0; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip:focus { left: 0; }

/* ---------- scroll progress ---------- */
.progress {
  position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 60;
  background: transparent; pointer-events: none;
}
.progress i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, #7c6bff, #e9b44c, #ff6b6b, #35c4e8, #4ecb71, #ffa94d, #e07ff0);
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 18px;
  padding: 0 clamp(14px, 3vw, 28px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--fg); flex: none; }
.brand__mark {
  width: 26px; height: 26px; border-radius: 7px;
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 15px; font-weight: 700;
  background: var(--fg); color: var(--bg);
}
.brand__text { font-family: var(--serif); font-size: 16px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; }
@media (max-width: 780px) { .brand__text { display: none; } }

.topnav { display: flex; gap: 2px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a {
  display: flex; align-items: baseline; gap: 6px;
  padding: 6px 10px; border-radius: 8px;
  font-size: 12.5px; text-decoration: none; color: var(--muted);
  white-space: nowrap; transition: background .15s, color .15s;
}
.topnav a span { font-family: var(--mono); font-size: 10.5px; opacity: .65; }
.topnav a em { font-style: normal; font-weight: 500; }
.topnav a:hover { color: var(--fg); background: var(--surface-2); }
.topnav a.is-active { color: var(--accent-text); background: var(--accent-wash); }
.topnav a.is-active span { opacity: 1; }
@media (max-width: 1080px) { .topnav a em { display: none; } .topnav a { padding: 6px 8px; } }

.iconbtn {
  flex: none; width: 34px; height: 34px; border-radius: 9px; cursor: pointer;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--fg);
}
.iconbtn:hover { border-color: var(--muted); }
.theme-ico { width: 15px; height: 15px; border-radius: 50%; background: currentColor; box-shadow: inset -4px -4px 0 0 var(--surface-2); }
:root[data-theme="light"] .theme-ico { box-shadow: inset 0 0 0 0 transparent, 0 0 0 2px var(--surface-2), 0 0 0 3px currentColor; width: 9px; height: 9px; }

/* ---------- hero ---------- */
.hero {
  position: relative;
  padding: clamp(48px, 9vw, 110px) clamp(16px, 5vw, 40px) clamp(40px, 6vw, 76px);
  overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; inset: -30% -10% auto -10%; height: 120%;
  background:
    radial-gradient(46% 40% at 18% 12%, rgba(124,107,255,.16), transparent 70%),
    radial-gradient(40% 36% at 82% 6%, rgba(233,180,76,.14), transparent 70%),
    radial-gradient(48% 44% at 50% 92%, rgba(53,196,232,.10), transparent 72%);
  pointer-events: none;
}
.hero__inner { position: relative; max-width: var(--maxw); margin: 0 auto; }

.eyebrow {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .13em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 18px;
}
.hero h1 {
  font-size: clamp(40px, 8.2vw, 92px); letter-spacing: -.035em; margin: 0 0 24px;
}
.grad {
  background: linear-gradient(100deg, var(--gold), #ff6b6b 45%, #7c6bff 90%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lede { font-size: clamp(16.5px, 2vw, 20px); max-width: 62ch; color: var(--fg-soft); margin: 0 0 16px; }
.lede--sub { font-size: clamp(15px, 1.7vw, 17px); }
.lede strong { color: var(--fg); }

.hero__cards {
  display: grid; gap: 10px; margin: 36px 0 22px;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
}
.hcard {
  position: relative; display: block; text-decoration: none; color: inherit;
  padding: 15px 16px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
  overflow: hidden;
}
.hcard::after {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent);
  opacity: .85;
}
.hcard:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); box-shadow: var(--shadow); }
.hcard b { display: block; font-family: var(--mono); font-size: 11px; color: var(--accent-text); margin-bottom: 5px; }
.hcard span { display: block; font-family: var(--serif); font-size: 17px; font-weight: 600; letter-spacing: -.015em; }
.hcard i { display: block; font-style: normal; font-size: 13px; color: var(--muted); margin-top: 3px; line-height: 1.45; }
.hcard--solved span::after,
.hcard--live span::after {
  margin-left: 8px; vertical-align: middle;
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 20px; background: var(--accent-wash); color: var(--accent-text);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}
.hcard--solved span::after { content: 'solved'; }
/* Semantic amber, not the card's accent: this flags an unsettled claim. */
.hcard--live span::after {
  content: '2026 claim';
  background: color-mix(in srgb, var(--warn) 16%, transparent);
  color: var(--warn-ink);
  border-color: color-mix(in srgb, var(--warn) 45%, transparent);
}
.hero__note { font-size: 14px; color: var(--muted); max-width: 60ch; }

/* ---------- explainer strip ---------- */
.explainer { background: var(--bg-alt); border-block: 1px solid var(--line-soft); padding: clamp(32px,5vw,54px) clamp(16px,5vw,40px); }
.explainer__inner {
  max-width: var(--maxw); margin: 0 auto;
  display: grid; gap: clamp(24px, 4vw, 56px); grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}
.explainer h3 { font-size: 21px; margin-bottom: 10px; letter-spacing: -.02em; }
.explainer p { margin: 0; color: var(--fg-soft); font-size: 15.5px; }

/* ---------- problem sections ---------- */
.problem {
  position: relative;
  padding: clamp(48px, 7vw, 88px) clamp(16px, 5vw, 40px);
  border-bottom: 1px solid var(--line-soft);
}
.problem:nth-of-type(even) { background: var(--bg-alt); }

.problem__head { max-width: var(--maxw); margin: 0 auto clamp(28px, 4vw, 44px); }
.problem__title { max-width: 78ch; }
.problem__index {
  display: inline-block; font-family: var(--mono); font-size: 12px; letter-spacing: .18em;
  color: var(--accent-text); margin-bottom: 12px;
  padding-bottom: 6px; border-bottom: 2px solid var(--accent);
}
.problem h2 { font-size: clamp(30px, 5vw, 54px); letter-spacing: -.032em; margin-bottom: 14px; }
.hook { font-size: clamp(16px, 2.1vw, 21px); color: var(--fg-soft); margin: 0; max-width: 60ch; font-family: var(--serif); font-weight: 400; line-height: 1.42; }

.meta {
  list-style: none; margin: 26px 0 0; padding: 0;
  display: grid; gap: 1px; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: 10px; overflow: hidden;
}
.meta li { background: var(--bg); padding: 11px 14px; }
.problem:nth-of-type(even) .meta li { background: var(--bg-alt); }
.meta span { display: block; font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.meta b { display: block; font-size: 14px; font-weight: 600; margin-top: 2px; }
.meta b.open { color: var(--fg); }
.meta b.solved { color: var(--ok); }
.meta b.disputed { color: var(--warn-ink); }
:root[data-theme="dark"] .meta b.solved { color: #57d98a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .meta b.solved { color: #57d98a; } }

.problem__body {
  max-width: var(--maxw); margin: 0 auto;
  display: grid; gap: clamp(28px, 4vw, 56px);
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.02fr);
  align-items: start;
}
@media (max-width: 940px) { .problem__body { grid-template-columns: minmax(0, 1fr); } }

.prose h3 {
  font-size: 13px; font-family: var(--mono); font-weight: 600; text-transform: uppercase;
  letter-spacing: .13em; color: var(--accent-text); margin: 34px 0 10px;
}
.prose h3:first-child { margin-top: 0; }
.prose p { margin: 0 0 15px; color: var(--fg-soft); max-width: 68ch; }
.prose strong { color: var(--fg); font-weight: 600; }
.prose em { color: var(--fg); font-style: italic; }

.statement {
  border-left: 3px solid var(--accent);
  background: var(--accent-wash);
  padding: 14px 18px; border-radius: 0 10px 10px 0;
  font-family: var(--serif); font-size: 17px; line-height: 1.5;
  color: var(--fg) !important;
}
.statement b { font-weight: 700; }

.tryit {
  margin-top: 24px !important; padding: 13px 16px; border-radius: 10px;
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--line));
  font-size: 14.5px; color: var(--fg-soft) !important;
}
.tryit b { color: var(--accent-text); }

/* ---------- a dated development callout ---------- */
/* Used where a problem has live, unresolved news attached to it. The status
   pill uses a semantic amber, deliberately not the section accent, so
   "unverified" never reads as decoration. */
.devbox {
  margin: 0 0 22px;
  padding: 16px 18px 18px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-top: 3px solid var(--warn);
}
.devbox__top {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-bottom: 10px;
}
.devbox__date {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted);
}
.pill {
  font-family: var(--mono); font-size: 9.5px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 20px; white-space: nowrap;
  background: color-mix(in srgb, var(--warn) 16%, transparent);
  color: var(--warn-ink);
  border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent);
}
.devbox h4 {
  font-size: 19px; letter-spacing: -.02em; margin: 0 0 8px;
  text-wrap: balance;
}
.devbox p { margin: 0 0 10px; font-size: 14.5px; color: var(--fg-soft); }
.devbox p:last-child { margin-bottom: 0; }
.devbox strong { color: var(--fg); }
.devbox ul { margin: 10px 0 0; padding-left: 18px; }
.devbox li { font-size: 14.5px; color: var(--fg-soft); margin-bottom: 7px; }
.devbox li:last-child { margin-bottom: 0; }

/* ---------- primary source lists ---------- */
/* Deliberately a list with hairline dividers, not a grid of cards: these are
   references to follow, not objects to compare. */
.sources { margin: 14px 0 0; }
.sources__title {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  letter-spacing: .13em; text-transform: uppercase;
  color: var(--accent-text); margin: 30px 0 2px;
}
.sources__note { font-size: 13.5px; color: var(--muted); margin: 0 0 8px; }
.sources ul { list-style: none; margin: 0; padding: 0; }
.sources li { border-top: 1px solid var(--line-soft); }
.sources li:last-child { border-bottom: 1px solid var(--line-soft); }
.sources a {
  display: grid; gap: 2px 12px; align-items: baseline;
  grid-template-columns: 74px minmax(0, 1fr);
  padding: 10px 4px; text-decoration: none; color: inherit;
  transition: background .14s;
}
.sources a:hover { background: var(--accent-wash); }
.sources a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 6px; }
.sources .tag {
  font-family: var(--mono); font-size: 9.5px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); padding-top: 3px;
}
.sources .what { font-size: 14.5px; color: var(--fg); font-weight: 500; }
.sources a:hover .what { color: var(--accent-text); }
.sources .who { font-size: 12.5px; color: var(--muted); grid-column: 2; }
@media (max-width: 520px) {
  .sources a { grid-template-columns: minmax(0, 1fr); }
  .sources .tag { padding-top: 0; }
  .sources .who { grid-column: 1; }
}

/* ---------- glossary terms ---------- */
.term {
  border-bottom: 1.5px dotted var(--accent);
  cursor: help; color: var(--fg);
}
.term:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

.tooltip {
  position: absolute; z-index: 80; max-width: 300px;
  background: var(--surface); color: var(--fg);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 13px; font-size: 13.5px; line-height: 1.5;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
}
.tooltip[hidden] { display: none; }

/* ---------- the interactive lab panel ---------- */
.lab { position: sticky; top: calc(var(--topbar-h) + 20px); }
@media (max-width: 940px) { .lab { position: static; } }

.lab__head { margin-bottom: 12px; }
.lab__head h4 { font-size: 19px; letter-spacing: -.02em; }
.lab__head p { margin: 4px 0 0; font-size: 13.5px; color: var(--muted); }

.viz {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.viz-body { padding: 14px; }
.mp-canvas { display: block; width: 100%; border-radius: 9px; background: var(--surface-2); touch-action: none; }

/* tabs */
.mp-tabs { display: flex; gap: 2px; padding: 8px 8px 0; border-bottom: 1px solid var(--line-soft); background: var(--surface-2); }
.mp-tabs button {
  flex: 1; padding: 9px 10px 10px; cursor: pointer; font-family: var(--sans);
  font-size: 12.5px; font-weight: 500; color: var(--muted);
  background: transparent; border: 0; border-bottom: 2px solid transparent; border-radius: 7px 7px 0 0;
}
.mp-tabs button:hover { color: var(--fg); }
.mp-tabs button[aria-selected="true"] { color: var(--accent-text); border-bottom-color: var(--accent); background: var(--surface); }

/* controls */
.mp-controls { display: grid; gap: 12px; margin-top: 13px; }
.mp-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.mp-field { display: grid; gap: 5px; }
.mp-field > label {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  font-size: 12px; color: var(--muted); font-weight: 500;
}
.mp-field > label b { font-family: var(--mono); font-size: 12px; color: var(--accent-text); font-weight: 600; }

input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 20px;
  background: transparent; cursor: pointer; margin: 0;
}
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 3px; background: var(--line); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 3px; background: var(--line); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 15px; height: 15px; border-radius: 50%;
  background: var(--accent); margin-top: -5.5px; border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--accent);
}
input[type="range"]::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%; background: var(--accent);
  border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--accent);
}
input[type="range"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.mp-btn {
  font-family: var(--sans); font-size: 13px; font-weight: 500; cursor: pointer;
  padding: 8px 14px; border-radius: 9px;
  background: var(--surface-2); color: var(--fg); border: 1px solid var(--line);
  transition: background .15s, border-color .15s, transform .1s;
}
.mp-btn:hover { border-color: var(--accent); }
.mp-btn:active { transform: translateY(1px); }
.mp-btn[data-variant="primary"] { background: var(--accent); border-color: var(--accent); color: #0a0c14; font-weight: 600; }
.mp-btn[data-variant="primary"]:hover { filter: brightness(1.08); }
.mp-btn:disabled { opacity: .45; cursor: not-allowed; }
.mp-btn.is-on { background: var(--accent-wash); border-color: var(--accent); color: var(--accent-text); }

.mp-seg { display: inline-flex; flex-wrap: wrap; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; }
.mp-seg button {
  cursor: pointer; border: 0; background: transparent; color: var(--muted);
  font-family: var(--sans); font-size: 12px; font-weight: 500; padding: 6px 11px; border-radius: 7px;
}
.mp-seg button[aria-pressed="true"] { background: var(--accent); color: #0a0c14; font-weight: 600; }

.mp-readout {
  display: grid; gap: 1px; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: 10px; overflow: hidden;
}
.mp-readout div { background: var(--surface); padding: 8px 10px; }
.mp-readout dt, .mp-readout .k {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.mp-readout .v { font-family: var(--mono); font-size: 14px; font-weight: 600; margin-top: 2px; color: var(--fg); }
.mp-readout .v.accent { color: var(--accent-text); }

.mp-note {
  font-size: 13px; color: var(--muted); line-height: 1.55;
  padding: 10px 12px; background: var(--surface-2); border-radius: 9px;
}
.mp-note b { color: var(--fg); font-weight: 600; }
.mp-note.is-good { border-left: 3px solid #3ecf7e; }
.mp-note.is-bad  { border-left: 3px solid #ff6b6b; }

.mp-scroll { overflow-x: auto; }
.mp-mono { font-family: var(--mono); font-size: 12px; }

/* tile grid for the subset-sum game */
.mp-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 7px; }
.mp-tile {
  aspect-ratio: 1.35; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--fg);
  font-family: var(--mono); font-size: 15px; font-weight: 600;
  transition: transform .12s, background .12s, border-color .12s;
}
.mp-tile:hover { border-color: var(--accent); }
.mp-tile[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #0a0c14; transform: translateY(-2px); }
.mp-tile.is-scan { background: color-mix(in srgb, var(--accent) 32%, var(--surface-2)); border-color: var(--accent); }

/* hodge diamond */
.mp-diamond { display: grid; justify-content: center; gap: 5px; margin: 4px 0 2px; }
.mp-diamond .drow { display: flex; gap: 5px; justify-content: center; }
.mp-dcell {
  width: 46px; height: 40px; border-radius: 9px; cursor: pointer;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 13px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--fg-soft);
}
.mp-dcell.is-hodge { background: var(--accent-wash); border-color: var(--accent); color: var(--accent-text); }
.mp-dcell.is-sel { outline: 2px solid var(--accent); outline-offset: 2px; }
.mp-dcell:hover { border-color: var(--accent); }
@media (max-width: 400px) { .mp-dcell { width: 38px; height: 34px; font-size: 12px; } }

/* ---------- outro + footer ---------- */
.outro { padding: clamp(52px, 8vw, 96px) clamp(16px, 5vw, 40px); }
.outro__inner { max-width: 760px; margin: 0 auto; }
.outro h2 { font-size: clamp(30px, 5vw, 46px); letter-spacing: -.03em; margin-bottom: 20px; }
.outro p { color: var(--fg-soft); font-size: 17px; margin: 0 0 16px; }
.outro__links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.btn {
  display: inline-block; text-decoration: none; padding: 11px 18px; border-radius: 10px;
  background: var(--fg); color: var(--bg); font-size: 14px; font-weight: 600;
  border: 1px solid var(--fg); transition: opacity .15s;
}
.btn:hover { opacity: .85; }
.btn--ghost { background: transparent; color: var(--fg); border-color: var(--line); }

.foot { border-top: 1px solid var(--line-soft); background: var(--bg-alt); padding: clamp(32px,5vw,52px) clamp(16px,5vw,40px); }
.foot__inner { max-width: 760px; margin: 0 auto; }
.foot p { color: var(--fg-soft); font-size: 14.5px; margin: 0 0 12px; }
.foot__small { font-size: 13px !important; color: var(--muted) !important; }

.noscript-note {
  position: fixed; inset: auto 16px 16px 16px; z-index: 90;
  background: var(--surface); border: 1px solid var(--accent); border-radius: 12px;
  padding: 14px 16px; font-size: 14px; box-shadow: var(--shadow-lg);
}

/* ---------- motion ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .hcard:hover { transform: none; }
}

@media print {
  .topbar, .progress, .lab, .tooltip { display: none !important; }
  body { background: #fff; color: #000; }
}
