@font-face { font-family: "Poster Sans"; src: local("Verdana"), local("Verdana Regular"); font-weight: 400; }
@font-face { font-family: "Poster Sans"; src: local("Verdana Bold"), local("Verdana-Bold"); font-weight: 700 800; }

:root {
  /* Palette sampled from the CRAX poster */
  --bg: #e3feff;      /* poster background */
  --panel: #cdf0f9;
  --surface: #ffffff;
  --surface-2: #effbfe;
  --text: #13253a;
  --muted: #46647c;
  --line: #a9dceb;
  --heading: #2f5ba6;      /* title blue */
  --banner: #4178b3;       /* section banner */
  --banner-ink: #ffffff;
  --accent: #c95b21;       /* poster orange */
  --accent-ink: #ffffff;
  --safe: #3dc0e4;         /* poster cyan */
  --good: #2f9e44;
  --cost: #d9452f;
  --code-bg: #ffffff;
  --code-text: #13253a;
  --shadow: 0 1px 0 rgb(19 37 58 / .04), 0 6px 18px rgb(65 120 179 / .10);
  --radius: 6px;
  --maxw: 1120px;
  --font: "Poster Sans", Verdana, "DejaVu Sans", Geneva, system-ui, sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #071a29;
  --panel: #0f2c43;
  --surface: #143651;
  --surface-2: #0b2337;
  --text: #e3feff;
  --muted: #9cc4d8;
  --line: #22506f;
  --heading: #8fc3f2;
  --banner: #4178b3;
  --accent: #ea7a3c;
  --safe: #3dc0e4;
  --good: #51cf66;
  --cost: #ff6b55;
  --code-bg: #04121e;
  --code-text: #e3feff;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.7 var(--font);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration-color: color-mix(in srgb, var(--accent) 60%, transparent); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
img, video { display: block; max-width: 100%; }
code, pre, kbd { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; }
:not(pre) > code { white-space: nowrap; font-size: .88em; background: var(--surface-2); padding: .1em .35em; border-radius: 5px; }
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -.01em; margin: 0; color: var(--heading); }
h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); font-weight: 800; }
h3 { font-size: 1.2rem; font-weight: 700; margin: 2.6rem 0 .6rem; }
h4 { font-size: .95rem; font-weight: 700; margin: 1.2rem 0 .4rem; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 24px;
  padding: 12px max(16px, calc((100vw - var(--maxw)) / 2));
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; letter-spacing: .08em; text-decoration: none; display: flex; align-items: center; gap: 8px; }
.brand::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.topbar nav { display: flex; gap: 20px; overflow-x: auto; scrollbar-width: none; font-size: .92rem; }
.topbar nav a { text-decoration: none; color: var(--muted); white-space: nowrap; }
.topbar nav a:hover { color: var(--text); }

main { padding: 0 16px; }
.section { max-width: var(--maxw); margin: 0 auto; padding: 72px 0 8px; }
.section.narrow { max-width: 780px; }
.section-head { max-width: 780px; margin-bottom: 28px; }
.section-head p, .lead { color: var(--muted); margin: .6rem 0 0; }
.lead { max-width: 780px; margin-bottom: 1.2rem; }
.caption { color: var(--muted); font-size: .88rem; margin-top: .6rem; }
#abstract p { font-size: 1.06rem; }

/* ---------------------------------------------------------------- hero */
.hero { max-width: var(--maxw); margin: 0 auto; padding: 64px 0 0; text-align: center; }
.eyebrow { text-transform: uppercase; letter-spacing: .16em; font-size: .78rem; font-weight: 600; color: var(--accent); margin: 0 0 14px; }
.hero h1 { font-size: clamp(2rem, 5.2vw, 3.6rem); font-weight: 800; letter-spacing: -.035em; max-width: 900px; margin: 0 auto; text-wrap: balance; }
.authors { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 22px; margin: 26px 0 4px; font-size: 1.05rem; font-weight: 500; }
.affiliation { color: var(--muted); margin: 0; }
.links { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 26px 0 40px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: 700 .9rem/1 var(--font); text-decoration: none; cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--text) 30%, var(--line)); color: var(--text); }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn-primary:hover { color: var(--bg); background: color-mix(in srgb, var(--text) 85%, var(--accent)); }
.btn-lg { padding: 13px 22px; font-size: 1rem; }

.hero-media { margin: 0; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: #000; aspect-ratio: 2 / 1; }
.hero-media video { width: 100%; height: 100%; object-fit: cover; }

.stats { list-style: none; padding: 0; margin: 28px 0 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stats li { background: var(--surface); padding: 20px 18px; text-align: left; }
.stats strong { display: block; font-size: 1.7rem; font-weight: 800; letter-spacing: -.03em; }
.stats span { color: var(--muted); font-size: .9rem; line-height: 1.4; display: block; }

.tag { display: inline-block; font-size: .8rem; font-weight: 600; padding: 1px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.tag-cost { color: var(--cost); border-color: color-mix(in srgb, var(--cost) 40%, transparent); background: color-mix(in srgb, var(--cost) 10%, transparent); }

/* ---------------------------------------------------------------- player */
.player { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.player-toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button {
  font: 700 .84rem/1 var(--font); color: var(--muted); background: transparent;
  border: 0; border-radius: 7px; padding: 8px 13px; cursor: pointer;
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / .12); }
.seg-actions { margin-left: auto; }
.player:not(.is-running) .seg-actions { opacity: .45; pointer-events: none; }

.player-body { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 14px; }
.player-stage {
  position: relative; aspect-ratio: 16 / 10; max-height: 76vh; border-radius: 10px; overflow: hidden;
  background: #0b0d12; outline: none; touch-action: none;
  box-shadow: inset 0 0 0 1px var(--line);
}
.player.is-focused .player-stage { box-shadow: 0 0 0 2px var(--accent); }
.player-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.player-flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; box-shadow: inset 0 0 90px 10px var(--cost); }

.player-overlay { position: absolute; inset: 0; display: grid; place-items: center; }
.player.is-running .player-overlay { display: none; }
.player-poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(2px) brightness(.55); transform: scale(1.03); }
.player-cta { position: relative; text-align: center; color: #fff; padding: 16px; }
.player-cta .btn-primary { background: #fff; color: #111; border-color: #fff; }
.player-status { margin: 14px auto 0; max-width: 360px; font-size: .88rem; color: rgb(255 255 255 / .8); }
.player.is-loading .player-cta .btn { opacity: .5; pointer-events: none; }
.player-cta .btn:disabled { opacity: .5; pointer-events: none; }
.player-status code { background: rgb(255 255 255 / .15); color: #fff; }
.player.is-loading .player-status::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px; vertical-align: -1px; border: 2px solid rgb(255 255 255 / .3); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
.player.is-switching .player-stage::after { content: "Loading…"; position: absolute; top: 12px; left: 12px; color: #fff; font-size: .8rem; background: rgb(0 0 0 / .5); padding: 3px 9px; border-radius: 999px; }
@keyframes spin { to { transform: rotate(360deg); } }

.player-paused, .player-focus-hint {
  position: absolute; left: 50%; transform: translateX(-50%); pointer-events: none;
  background: rgb(0 0 0 / .6); color: #fff; font-size: .85rem; font-weight: 600;
  padding: 6px 14px; border-radius: 999px; display: none;
}
.player-paused { top: 12px; }
.player-focus-hint { bottom: 12px; }
.player.is-running.is-paused .player-paused { display: block; }
.player.is-running:not(.is-focused) .player-focus-hint { display: block; }

.pad { position: absolute; right: 12px; bottom: 12px; display: none; grid-template: repeat(3, 38px) / repeat(3, 38px); gap: 3px; opacity: .85; }
.pad button { background: rgb(255 255 255 / .18); color: #fff; border: 1px solid rgb(255 255 255 / .3); border-radius: 10px; font-size: 1rem; touch-action: none; user-select: none; -webkit-user-select: none; }
.pad button:active { background: rgb(255 255 255 / .4); }
.pad-up { grid-area: 1 / 2; } .pad-left { grid-area: 2 / 1; } .pad-right { grid-area: 2 / 3; } .pad-down { grid-area: 3 / 2; }
@media (pointer: coarse) {
  .player.is-running .pad { display: grid; }
  .player-focus-hint { display: none !important; }
}

.player-side { display: flex; flex-direction: column; gap: 14px; font-size: .9rem; }
.hud { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 0; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.hud > div { background: var(--surface-2); padding: 8px 10px; }
.hud dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.hud dd { margin: 0; font: 600 1rem/1.3 "JetBrains Mono", monospace; font-variant-numeric: tabular-nums; }
.hud-wide { grid-column: 1 / -1; }
.hud-return dd { color: var(--good); }
.hud-cost dd { color: var(--cost); }
.player.is-costly .hud-cost { background: color-mix(in srgb, var(--cost) 18%, var(--surface-2)); }

.keys { display: grid; gap: 6px; color: var(--muted); }
kbd { display: inline-block; min-width: 1.8em; text-align: center; font-size: .78rem; font-weight: 600; color: var(--text); padding: 2px 6px; margin-right: 2px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; background: var(--surface); }
.env-info h4 { margin: 0 0 4px; }
.env-info p { margin: 0; color: var(--muted); line-height: 1.5; }
.player-note { color: var(--muted); font-size: .84rem; margin: 12px 2px 0; }

/* ---------------------------------------------------------------- environments */
.env-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.env-grid figure { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.env-grid img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.env-grid figcaption { padding: 10px 12px 12px; font-size: .86rem; color: var(--muted); line-height: 1.4; }
.env-grid figcaption b { display: block; color: var(--text); font-size: .95rem; margin-bottom: 2px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { padding: 8px 12px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
th { font-weight: 600; color: var(--muted); font-size: .82rem; }
td:first-child, th:first-child { text-align: left; font-weight: 600; color: var(--text); }
.matrix td.y { color: color-mix(in srgb, var(--text) 35%, transparent); }
.matrix td.s { color: var(--accent); font-size: 1.1rem; }
.matrix .grp { text-transform: uppercase; letter-spacing: .1em; font-size: .72rem; }
.matrix .grp-3d { background: color-mix(in srgb, #8e6bd8 12%, transparent); }
.matrix .grp-2d { background: color-mix(in srgb, #3b8fd9 12%, transparent); }
.matrix .grp-fixed { background: color-mix(in srgb, #e1b12c 16%, transparent); }

.levels .seg { margin-bottom: 14px; }
.level-row, .views { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.level-row figure, .views figure { margin: 0; }
.level-row img { border-radius: 10px; aspect-ratio: 4 / 3; object-fit: cover; width: 100%; border: 1px solid var(--line); }
.level-row figcaption, .views figcaption { text-align: center; color: var(--muted); font-size: .86rem; margin-top: 6px; }
.view-clip { position: relative; border-radius: 10px; overflow: hidden; background: #000; aspect-ratio: 2 / 1; }
.view-clip video { width: 100%; height: 100%; object-fit: cover; }
.view-clip::after { content: ""; position: absolute; top: 0; bottom: 0; left: calc(50% - 2px); width: 4px; background: var(--panel); }
.view-tag { position: absolute; bottom: 6px; left: 6px; font-size: .68rem; font-weight: 700; color: #fff; background: rgb(0 0 0 / .5); padding: 1px 7px; border-radius: 999px; }
.view-tag-allo { left: calc(50% + 6px); }

/* ---------------------------------------------------------------- results */
.result { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 32px; align-items: center; margin-bottom: 40px; }
.result-stack { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); }
.result-speed { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); row-gap: 20px; }
.result-wide { grid-column: 1 / -1; }
.result-wide p { margin: 0; }
.result-text h3 { margin-top: 0; }
.result-text p { color: var(--muted); }
.result-text b { color: var(--text); }
.result-fig { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.result-fig-sm { width: 100%; max-width: 520px; justify-self: center; }
.result-more { margin-top: 48px; }
.curriculum h3 { margin-top: 0; }
.curr-demo { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 3fr); gap: 14px; align-items: stretch; margin-top: 18px; }
.curr-group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px 14px; }
.curr-group-default { border-top: 4px solid var(--accent); }
.curr-group-curriculum { border-top: 4px solid var(--good); }
.curr-kicker { margin: 0 0 10px; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.curr-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.curr-clip { margin: 0; position: relative; }
.curr-steps .curr-clip:not(:last-child)::after { content: "\2192"; position: absolute; right: -18px; top: 30%; font-weight: 800; color: var(--banner); font-size: 1.1rem; }
.curr-video { border-radius: 6px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
.curr-video video { width: 100%; height: 100%; object-fit: cover; }
.curr-clip figcaption { margin-top: 7px; font-size: .8rem; line-height: 1.4; color: var(--muted); }
.curr-clip figcaption b { display: block; color: var(--heading); font-size: .86rem; }
.curr-steps-tag { font: 600 .72rem "JetBrains Mono", monospace; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; margin-left: 4px; vertical-align: 1px; }
.curr-final .curr-video { box-shadow: 0 0 0 3px var(--good); }
.curr-vs { align-self: center; font-weight: 800; color: var(--banner); font-size: 1.1rem; }
.curriculum-results { margin-top: 28px; }
.bound-demo { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) 200px; max-width: 980px; }
.bound-hopper { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-top: 96px; }
.hopper-smug { position: relative; z-index: 1; width: 84px; margin-bottom: 0; }
.hopper-smug img { display: block; width: 100%; height: auto; }
.bound-hopper .thought { left: 50%; bottom: 100%; translate: -62% -6px; white-space: normal; width: 170px; text-align: center; border-radius: 20px; line-height: 1.3; }
.bound-hopper .thought::before { left: 62%; bottom: -14px; }
.bound-hopper .thought::after { left: 66%; bottom: -26px; }
.cost-pop { position: absolute; z-index: 2; left: calc(50% + 36px); bottom: 40px; font-weight: 800; font-size: .85rem; color: var(--cost); white-space: nowrap; text-shadow: 0 0 3px var(--panel), 0 0 3px var(--panel); animation: cost-pop 1.8s ease-out infinite; }
@keyframes cost-pop { 0% { opacity: 0; transform: translateY(6px); } 20% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-22px); } }
@media (prefers-reduced-motion: reduce) { .cost-pop { animation: none; } }
.hazard-disc { width: 275px; max-width: none; height: auto; display: block; margin-top: -50px; pointer-events: none; }
@media (max-width: 900px) {
  .bound-demo { grid-template-columns: 1fr; }
  .bound-hopper { padding-top: 90px; }
}
.bound-tight { border-top: 4px solid var(--safe); }
.bound-loose { border-top: 4px solid var(--accent); }
@media (max-width: 900px) {
  .curr-demo { grid-template-columns: 1fr; }
  .curr-vs { justify-self: center; }
}
@media (max-width: 560px) {
  .curr-steps { grid-template-columns: 1fr; }
  .curr-steps .curr-clip:not(:last-child)::after { content: "\2193"; right: auto; left: 50%; top: auto; bottom: -20px; }
}
.result-pixels { margin-top: 56px; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); }
.pixel-scene { display: flex; align-items: flex-end; justify-content: center; gap: 8px; margin: 36px auto 0; }
.pixel-scene .char-point-puzzled { position: relative; width: 140px; flex: none; }
.char-point-puzzled img { display: block; width: 100%; height: auto; animation: char-puzzle 3s ease-in-out infinite; transform-origin: 50% 90%; }
.char-point-puzzled .thought { left: auto; right: 62%; bottom: 104%; }
.char-point-puzzled .thought::before { left: auto; right: -14px; bottom: -14px; }
.char-point-puzzled .thought::after { left: auto; right: -28px; bottom: -28px; width: 8px; height: 8px; }
.pixel-hazards { width: min(462px, 100%); height: auto; }
@keyframes char-puzzle { 0%, 60%, 100% { transform: rotate(0); } 70% { transform: rotate(-6deg); } 85% { transform: rotate(4deg); } }
.seed-compare { display: grid; grid-template-columns: minmax(0, 360px) 170px minmax(0, 360px); justify-content: center; gap: 20px; align-items: stretch; margin: 8px 0 48px; }
.seed-card { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 10px; }
.seed-head { display: flex; align-items: center; gap: 10px; min-height: 40px; font-size: 1.05rem; color: var(--heading); }
.seed-time { margin-left: auto; font: 600 .85rem "JetBrains Mono", monospace; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 1px 10px; }
.seed-row { display: inline-flex; flex-wrap: wrap; gap: 3px; }
.seed-row img { width: 18px; height: auto; }
.seed-row-many { gap: 2px 3px; max-width: 150px; }
.seed-row-many img { width: 12px; }
.seed-plot { margin-top: auto; width: 100%; height: auto; aspect-ratio: 674 / 618; object-fit: contain; background: #fff; border-radius: 4px; }
.seed-card figcaption { display: flex; align-items: center; justify-content: center; text-align: center; gap: 10px; color: var(--muted); font-size: .9rem; }
.seed-verdict { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: #fff; font-weight: 800; background: var(--cost); }
.seed-good .seed-verdict { background: var(--good); }
.seed-bad { border-top: 4px solid var(--cost); }
.seed-good { border-top: 4px solid var(--good); }
.seed-mid { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-height: 300px; padding-bottom: 120px; }
.seed-arrow { position: relative; width: 100%; padding: 8px 18px 8px 10px; background: var(--banner); color: #fff; text-align: center; font-size: .95rem; clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 50%, calc(100% - 16px) 100%, 0 100%); }
.seed-arrow b { font-size: 1.2rem; }
.seed-scatter img { position: absolute; width: 20px; height: auto; }
.seed-scatter img:nth-child(1) { left: 4px; bottom: 182px; transform: rotate(-30deg); width: 20px; }
.seed-scatter img:nth-child(2) { left: 30px; bottom: 196px; transform: rotate(40deg); width: 16px; }
.seed-scatter img:nth-child(3) { left: 18px; bottom: 214px; transform: rotate(-75deg); width: 14px; }
.seed-scatter img:nth-child(4) { left: 44px; bottom: 178px; transform: rotate(95deg); width: 15px; }
.seed-scatter img:nth-child(5) { right: 8px; bottom: 186px; transform: rotate(-70deg); width: 20px; }
.seed-scatter img:nth-child(6) { right: 34px; bottom: 200px; transform: rotate(15deg); width: 15px; }
.seed-scatter img:nth-child(7) { right: 20px; bottom: 222px; transform: rotate(60deg); width: 13px; }
.seed-scatter img:nth-child(8) { right: 50px; bottom: 178px; transform: rotate(-20deg); width: 14px; }
.seed-scatter img:nth-child(9) { left: 8px; bottom: 236px; transform: rotate(25deg); width: 12px; }
.seed-mid .char-walker { position: relative; width: 74px; margin-bottom: 16px; }
.char-walker img { display: block; width: 100%; height: auto; transform: rotate(8deg); transform-origin: 50% 100%; }
.char-walker .thought { left: 50%; bottom: 100%; translate: -42% 0; white-space: normal; width: 150px; text-align: center; border-radius: 20px; line-height: 1.3; }
.char-walker .thought::before { left: 52%; bottom: -14px; }
.char-walker .thought::after { left: 58%; bottom: -26px; }
.summary caption { caption-side: bottom; text-align: left; padding: 10px 12px; color: var(--muted); font-size: .84rem; }
.summary td.full { color: var(--good); font-weight: 700; }
.summary tbody td:nth-child(2n+2) { border-left: 1px solid var(--line); }
.summary thead tr:first-child th:not(:first-child) { border-left: 1px solid var(--line); }
.summary thead tr:last-child th:nth-child(2n+1) { border-left: 1px solid var(--line); }

/* ---------------------------------------------------------------- algorithms */
.algo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.algo { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.algo code { font-size: .78rem; color: var(--accent); background: none; padding: 0; }
.algo span { color: var(--muted); font-size: .88rem; line-height: 1.45; }
.algo-off code { color: #3b8fd9; }

/* ---------------------------------------------------------------- code */
.code-grid { display: grid; grid-template-columns: 1fr 1.25fr; gap: 28px; }
.code-grid > div { min-width: 0; }
.code-grid h4:first-child { margin-top: 0; }
pre { margin: 0; background: var(--code-bg); color: var(--code-text); padding: 16px 18px; border-radius: 12px; overflow-x: auto; font-size: .84rem; line-height: 1.6; }
pre .k { color: var(--accent); font-weight: 700; } pre .s { color: #2f8a3e; } pre .n { color: var(--banner); } pre .c { color: #7b93a6; font-style: italic; }
.bibtex { position: relative; margin-top: 18px; }
.copy { position: absolute; top: 10px; right: 10px; font: 700 .76rem var(--font); background: var(--banner); color: #fff; border: 1px solid var(--banner); border-radius: 7px; padding: 5px 10px; cursor: pointer; }
.copy:hover { background: var(--heading); }

.footer { max-width: var(--maxw); margin: 80px auto 0; padding: 28px 16px 48px; border-top: 1px solid var(--line); color: var(--muted); font-size: .86rem; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 900px) {
  .player-body { grid-template-columns: 1fr; }
  .player-side { display: grid; grid-template-columns: 1fr 1fr; }
  .hud { grid-column: 1 / -1; grid-template-columns: repeat(4, 1fr); }
  .env-grid { grid-template-columns: repeat(2, 1fr); }
  .result, .result-stack, .seed-compare, .code-grid { grid-template-columns: 1fr; }
  .seed-mid { min-height: 0; padding-bottom: 0; }
  .seed-mid .char-walker, .seed-scatter { display: none; }
  .pixel-scene { margin-top: 28px; }
  .pixel-scene .char-point-puzzled { width: 100px; }
  .pixel-hazards { width: min(300px, 60%); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .seg-actions { margin-left: 0; }
}
@media (max-width: 560px) {
  .topbar nav { display: none; }
  .player { padding: 10px; }
  .player-side { grid-template-columns: 1fr; }
  .hud { grid-template-columns: 1fr 1fr; }
  .keys { display: none; }
  .level-row, .views { grid-template-columns: 1fr; }
  .stats li { padding: 14px; }
  .stats strong { font-size: 1.35rem; }
}

/* ---------------------------------------------------------------- leaderboard */
.eyebrow-left { text-align: left; margin-bottom: 8px; }
.player-body { position: relative; }
.player-results {
  position: absolute; inset: 0; z-index: 3; overflow-y: auto; border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px) saturate(1.2);
  display: grid; place-items: start center; padding: 22px 16px; outline: none;
}
.player-results[hidden] { display: none; }
.results-card { width: min(640px, 100%); }
.results-kicker { margin: 0; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 600; }
.results-title { margin: 6px 0 6px; font-size: clamp(1.4rem, 3vw, 1.9rem); font-weight: 800; }
.player-results[data-tone="great"] .results-title { color: var(--good); }
.player-results[data-tone="warn"] .results-title { color: #d97706; }
.results-message { margin: 0 0 16px; color: var(--text); line-height: 1.55; }
.results-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin: 0 0 14px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.results-stats > div { background: var(--surface-2); padding: 8px 12px; }
.results-stats dt { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.results-stats dd { margin: 0; font: 600 1.05rem/1.3 "JetBrains Mono", monospace; }
.results-stats small { color: var(--muted); font-weight: 400; }
[data-result="safety"][data-safe="true"] { color: var(--good); }
[data-result="safety"][data-safe="false"] { color: var(--cost); }
.results-table { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.results-board th, .results-board td { padding: 6px 10px; font-size: .86rem; }
.results-board td:nth-child(n+3), .results-board th:nth-child(n+3) { text-align: right; font-variant-numeric: tabular-nums; }
.results-board td:first-child { color: var(--muted); font-weight: 500; width: 2.5em; }
.results-board td:nth-child(2) { text-align: left; font-weight: 600; }
.results-board th:nth-child(2) { text-align: left; }
.results-board tr.is-player td { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.results-board tr.is-player td:nth-child(2) { color: var(--accent); }
.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.badge[data-safe="true"] { color: var(--good); background: color-mix(in srgb, var(--good) 14%, transparent); }
.badge[data-safe="false"] { color: var(--cost); background: color-mix(in srgb, var(--cost) 12%, transparent); }
.results-note { color: var(--muted); font-size: .8rem; margin: 10px 0 16px; line-height: 1.5; }
.results-card .btn kbd { background: transparent; color: inherit; border-color: currentColor; opacity: .7; margin-left: 4px; }
@media (max-width: 560px) {
  .results-stats { grid-template-columns: 1fr 1fr; }
  .results-board th:last-child, .results-board td:last-child { display: none; }
}

/* ---------------------------------------------------------------- poster look */
/* Sections are light-blue panels with a slanted blue banner, as on the poster. */
.section {
  --pad: clamp(16px, 3.2vw, 36px);
  position: relative;
  margin: 56px auto 0;
  padding: 26px var(--pad) 34px;
  background: var(--panel);
  border-radius: var(--radius);
}
.section > h2, .section-head h2 {
  display: inline-block;
  margin: 0 0 18px calc(-1 * var(--pad));
  padding: .3em 1.7em .3em var(--pad);
  background: var(--banner);
  color: var(--banner-ink);
  text-transform: uppercase;
  letter-spacing: .02em;
  font-size: clamp(1.35rem, 2.6vw, 1.9rem);
  clip-path: polygon(0 0, 100% 0, calc(100% - .9em) 100%, 0 100%);
}
.section-head h2 { margin-bottom: 4px; }
.section-head p, .lead, .caption { color: var(--muted); }
.section h3 { color: var(--heading); font-size: 1.25rem; }
.section-head { margin-bottom: 22px; }
.eyebrow { color: var(--accent); font-weight: 700; }
.eyebrow-acronym { font-weight: 400; font-size: 1.05rem; text-transform: none; letter-spacing: .03em; }
.eyebrow-acronym b { font-weight: 800; font-size: 1.15em; color: var(--heading); }
.eyebrow-left { margin-top: 2px; }

/* Top bar: solid poster blue. */
.topbar { background: var(--banner); border-bottom: 0; backdrop-filter: none; color: #fff; }
.topbar nav a { color: rgb(255 255 255 / .82); font-weight: 700; }
.topbar nav a:hover { color: #fff; }
.brand { color: #fff; font-size: 1.1rem; }
.brand:hover { color: #fff; }
.brand::before { display: none; }
.brand img { width: 30px; height: auto; margin: -6px 0; }

/* Hero */
.hero { position: relative; padding-top: 56px; }
.hero h1 { color: var(--heading); font-size: clamp(1.9rem, 4.6vw, 3.3rem); letter-spacing: -.01em; line-height: 1.12; }
.authors { font-style: italic; color: var(--heading); font-weight: 400; font-size: 1.08rem; }
.affiliation { font-weight: 700; color: var(--muted); }
.hero-media { border-radius: var(--radius); border: 4px solid var(--banner); }

/* Buttons: blue pills like the poster callouts, orange primary. */
.btn { border-radius: var(--radius); border: 2px solid var(--banner); background: var(--surface); color: var(--banner); }
.btn:hover { color: var(--banner); border-color: var(--heading); background: var(--surface-2); }
.btn-primary { background: var(--banner); color: #fff; border-color: var(--banner); }
.btn-primary:hover { color: #fff; background: var(--heading); }

/* Stats: white tiles, orange figures. */
.stats { background: transparent; border: 0; gap: 12px; }
.stats li { border-radius: var(--radius); box-shadow: var(--shadow); border-top: 5px solid var(--safe); }
.stats strong { color: var(--accent); }

/* Cards and tables sit on white like the poster's figures. */
.env-grid figure, .table-wrap, .algo, .result-fig, .player { border-color: var(--line); border-radius: var(--radius); }
.env-grid figcaption b { background: var(--banner); color: #fff; margin: -10px -12px 8px; padding: 5px 12px; font-style: italic; }
.algo { border-left: 5px solid var(--banner); }
.algo code { color: var(--accent); }
.algo-off { border-left-color: var(--safe); }
.algo-off code { color: var(--banner); }
.tag { background: var(--surface); border-color: var(--line); }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--banner); color: #fff; box-shadow: none; }
.seg { background: var(--surface); }
.summary td.full { color: var(--banner); }
.matrix td.s { color: var(--accent); }
pre { border-radius: var(--radius); border: 1px solid var(--line); border-left: 5px solid var(--safe); }
:not(pre) > code { background: var(--surface); }
.footer { border-top: 0; text-align: center; }

/* ---------------------------------------------------------------- hand-drawn agents */
.char { position: absolute; pointer-events: none; user-select: none; z-index: 2; height: auto; }
.char-point { width: clamp(84px, 11vw, 150px); top: 18px; right: max(0px, calc(50% - 600px)); transform: rotate(-8deg); animation: char-fly 3.2s ease-in-out infinite; }
.char-humanoid { width: 100px; right: 48px; top: 28px; }
.char-humanoid img { display: block; width: 100%; height: auto; }
.char-humanoid .thought { left: auto; right: 96%; bottom: auto; top: -4px; }
.char-ant { width: 360px; right: 4px; top: -20px; }
.char-ant img { display: block; width: 100%; height: auto; }
.char-ant .thought { left: 15%; bottom: 94%; }
.result-speed .result-fig { position: relative; }
.char-ant-run { width: clamp(150px, 18vw, 230px); left: 6%; bottom: calc(100% - 14px); }
.char-ant-run img { display: block; width: 100%; height: auto; }
.thought { position: absolute; left: 76%; bottom: 94%; white-space: nowrap; padding: 8px 16px; border-radius: 999px; background: var(--surface); color: var(--text); border: 2px solid var(--banner); font-weight: 700; font-size: .9rem; animation: thought-bob 2.4s ease-in-out infinite; }
.thought::before, .thought::after { content: ""; position: absolute; border-radius: 50%; background: var(--surface); border: 2px solid var(--banner); }
.thought::before { width: 12px; height: 12px; left: -10px; bottom: -12px; }
.thought::after { width: 7px; height: 7px; left: -22px; bottom: -22px; }
@keyframes thought-bob { 50% { transform: translateY(-4px); } }
.thought-left::before { left: auto; right: -10px; }
.thought-left::after { left: auto; right: -22px; }
.level-hard { position: relative; }
.char-point-tired { width: clamp(100px, 11vw, 140px); right: 10px; bottom: calc(100% - 26px); }
.char-point-tired img { display: block; width: 100%; height: auto; aspect-ratio: auto; border: 0; border-radius: 0; transform-origin: 50% 100%; animation: char-pant 1.8s ease-in-out infinite; }
.char-point-tired .thought { left: auto; right: 104%; bottom: 74%; }
@keyframes char-pant { 50% { transform: scale(1.03, .95) rotate(4deg); } }
.section-head { position: relative; z-index: 3; }

@keyframes char-fly { 50% { transform: translate(-6px, -10px) rotate(-4deg); } }
@media (prefers-reduced-motion: reduce) { .char { animation: none !important; } }

@media (max-width: 1180px) {
}
@media (max-width: 900px) {
  .char-point { position: static; display: block; margin: 0 auto 10px; }
  .char-ant { width: 190px; top: -54px; right: 10px; }
  .char-humanoid, .char-ant-run, .char-point-tired { display: none; }
}
@media (max-width: 560px) {
  .char-ant { width: 140px; top: -38px; }
  .section > h2, .section-head h2 { padding-right: 1.4em; }
}

/* ---------------------------------------------------------------- theme switch */
:root[data-theme="dark"] .btn:not(.btn-primary) { color: var(--heading); }
:root[data-theme="dark"] pre .s { color: #7ed99a; }
:root[data-theme="dark"] pre .n { color: #8fc3f2; }
:root[data-theme="dark"] pre .c { color: #7f9bb0; }
:root[data-theme="dark"] .algo-off code, :root[data-theme="dark"] .summary td.full { color: var(--heading); }

.theme-toggle {
  margin-left: auto; flex: none;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 2px; background: none; border: 0; cursor: pointer; color: #fff;
}
.theme-icon { width: 16px; height: 16px; opacity: .55; transition: opacity .2s; }
.theme-track {
  position: relative; width: 40px; height: 22px; border-radius: 999px;
  background: rgb(255 255 255 / .28); box-shadow: inset 0 0 0 1px rgb(255 255 255 / .35);
  transition: background .2s;
}
.theme-knob {
  position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .3); transition: transform .2s ease;
}
.theme-toggle[aria-checked="true"] .theme-knob { transform: translateX(18px); }
.theme-toggle[aria-checked="true"] .theme-track { background: #12304a; }
.theme-toggle[aria-checked="true"] .theme-moon,
.theme-toggle[aria-checked="false"] .theme-sun { opacity: 1; }
.theme-toggle:focus-visible { outline: 2px solid #fff; outline-offset: 3px; border-radius: 999px; }
@media (prefers-reduced-motion: reduce) { .theme-knob, .theme-track { transition: none; } }
