/* 2MB Problems: design tokens and components (docs/trd/08-frontend.md §4.20).
   The palette, fonts and component rules come from the landing page (web/landing/landing.css) and
   keep its names; tokens.test.js compares them. Everything below the verbatim block is the app's
   own. Nothing is imported or loaded from a third party (CSP). */

@font-face { font-family: 'Press Start 2P'; font-style: normal; font-weight: 400; font-display: swap; src: url(/vendor/fonts/87ae5c63/press-start-2p-latin.woff2) format('woff2'); }
@font-face { font-family: 'VT323'; font-style: normal; font-weight: 400; font-display: swap; src: url(/vendor/fonts/87ae5c63/vt323-latin.woff2) format('woff2'); }
@font-face { font-family: 'IBM VGA'; font-style: normal; font-weight: 400; font-display: swap; src: url(/vendor/fonts/87ae5c63/ibm-vga-8x16.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url(/vendor/fonts/87ae5c63/ibm-plex-mono-latin1.woff2) format('woff2'); }

:root {
  --black: #000000; --blue: #0000AA; --green: #00AA00; --cyan: #00AAAA;
  --red: #AA0000; --magenta: #AA00AA; --brown: #AA5500; --lightgray: #AAAAAA;
  --darkgray: #555555; --lightblue: #5555FF; --lightgreen: #55FF55; --lightcyan: #55FFFF;
  --lightred: #FF5555; --lightmagenta: #FF55FF; --yellow: #FFFF55; --white: #FFFFFF;
  --blue-deep: #000055; /* the one off-palette colour: the editor's active line */
  --pixel: 'Press Start 2P', monospace;
  --term: 'VT323', ui-monospace, monospace;
  --page: var(--black); --screen: var(--blue); --panel: var(--black); --fg: var(--white);
  --fg-dim: var(--lightgray); --accent: var(--yellow); --link: var(--lightcyan);
  --ok: var(--lightgreen); --bad: var(--lightred); --warn: var(--yellow); --judge: var(--lightmagenta);
  --tier-green: var(--lightgreen); --tier-yellow: var(--yellow); --tier-red: var(--lightred); --tier-pending: var(--lightgray);
  --decor: var(--darkgray); --focus: var(--white);
  /* the editor and <pre> font: the player's pick (html[data-font]) */
  --code: 'VT323', ui-monospace, monospace; --code-size: 22px; --code-lh: 1.25; --code-note: normal;
  --hud-h: 56px;
}
html[data-font="vga"] { --code: 'IBM VGA', ui-monospace, monospace; --code-size: 16px; }
/* the outline font reads best a little larger and looser; only it takes a slanted comment (the bitmap fonts have no italic) */
html[data-font="plex"] { --code: 'IBM Plex Mono', ui-monospace, monospace; --code-size: 17px; --code-lh: 1.55; --code-note: italic; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; padding: 16px; background: var(--black); color: var(--white);
  font-family: var(--term); font-size: 22px; line-height: 1.25;
  -webkit-font-smoothing: none;
}
::selection { background: var(--yellow); color: var(--black); }
[id] { scroll-margin-top: 90px; }
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.screen {
  position: relative; max-width: 1280px; margin: 0 auto;
  background: var(--blue); border-radius: 28px;
  overflow: hidden; overflow: clip;
  box-shadow: inset 0 0 160px rgba(0,0,0,.55), 0 0 0 3px var(--darkgray);
}
.bezel {
  max-width: 1280px; margin: 10px auto 0; padding: 0 28px;
  display: flex; justify-content: flex-end; align-items: center; gap: 10px;
  font: 8px var(--pixel); color: var(--darkgray);
}
.led { width: 8px; height: 8px; background: var(--lightgreen); box-shadow: 0 0 6px var(--lightgreen); }
.hud {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 22px;
  padding: 12px 24px; background: var(--black);
  border-bottom: 4px solid var(--lightcyan);
  font: 10px var(--pixel);
}
.hud-logo {
  color: var(--yellow); font-size: 12px; text-decoration: none; white-space: nowrap;
  text-shadow: 2px 2px 0 var(--magenta);
}
.hud-stats { display: flex; align-items: center; gap: 22px; margin: 0 auto; color: var(--lightgray); }
.stat { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.meter { display: inline-flex; gap: 2px; }
.meter i { width: 8px; height: 12px; background: var(--darkgray); }
.meter i.on { background: var(--lightgreen); }
.hud-nav { display: flex; align-items: center; gap: 6px; }
.hud-nav a { color: var(--white); text-decoration: none; padding: 8px 10px; border: 2px solid transparent; white-space: nowrap; }
.hud-nav a:hover { color: var(--yellow); border-color: var(--yellow); }
.hud-nav a:focus-visible { outline: 3px dashed var(--white); outline-offset: 2px; }
.btn {
  --face: var(--yellow); --hi: var(--white); --lo: var(--brown); --drop: 8px;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  font: 15px/1.2 var(--pixel); color: var(--black); background: var(--face);
  text-decoration: none; text-transform: uppercase; cursor: pointer;
  border: 4px solid var(--black); border-radius: 0; padding: 18px 26px 16px;
  box-shadow: inset 0 4px 0 var(--hi), inset 0 -6px 0 var(--lo), 0 var(--drop) 0 var(--shadow, var(--black));
  transition: transform 60ms linear, box-shadow 60ms linear;
}
.btn:hover { color: var(--black); transform: translateY(-2px); box-shadow: inset 0 4px 0 var(--hi), inset 0 -6px 0 var(--lo), 0 calc(var(--drop) + 2px) 0 var(--shadow, var(--black)); }
.btn:active { transform: translateY(var(--drop)); box-shadow: inset 0 6px 0 var(--lo), inset 0 -2px 0 var(--hi), 0 0 0 var(--shadow, var(--black)); }
.btn:focus-visible { color: var(--black); outline: 4px dashed var(--white); outline-offset: 6px; }
.btn-secondary { --face: var(--lightcyan); --lo: var(--cyan); }
.btn-danger { --face: var(--lightred); --lo: var(--red); }
.hero {
  position: relative; text-align: center; padding: 40px 32px 52px;
  background-image:
    radial-gradient(circle, var(--white) 0 1px, transparent 1.6px),
    radial-gradient(circle, var(--lightcyan) 0 1px, transparent 1.6px),
    radial-gradient(circle, var(--lightmagenta) 0 1px, transparent 1.6px);
  background-size: 140px 110px, 220px 170px, 310px 240px;
  background-position: 10px 20px, 80px 60px, 150px 130px;
  animation: drift 60s linear infinite;
}
@keyframes drift { to { background-position: 10px 1120px, 80px 1760px, 150px 2530px; } }
.kicker { font: 11px/1.9 var(--pixel); color: var(--lightgreen); letter-spacing: 2px; margin: 0 0 16px; }
.title-logo { margin: 0 0 24px; }
.title-logo .big {
  display: block; font: clamp(48px, 11vw, 108px)/1 var(--pixel); color: var(--yellow);
  text-shadow: .03em .03em 0 var(--lightred), .06em .06em 0 var(--magenta), .09em .09em 0 var(--black);
}
.title-logo .small {
  display: block; margin-top: .5em; font: clamp(18px, 4.6vw, 40px)/1 var(--pixel); color: var(--lightcyan);
  letter-spacing: .08em; text-shadow: .1em .1em 0 var(--black);
}
.hero h1 {
  max-width: 920px; margin: 0 auto 18px; font: clamp(15px, 2.4vw, 24px)/1.6 var(--pixel);
  color: var(--white); text-shadow: 3px 3px 0 var(--black);
}
.hl { color: var(--yellow); }
.sub { max-width: 700px; margin: 0 auto 30px; font-size: 25px; color: var(--white); }
.hero-actions { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 24px; }
.btn-start { font-size: 18px; padding: 20px 32px 18px; }
.divider { height: 8px; margin: 0 32px; background: repeating-linear-gradient(90deg, var(--lightblue) 0 8px, transparent 8px 16px); }
.section { max-width: 1140px; margin: 0 auto; padding: 64px 32px; }
.section-kicker { margin: 0 0 12px; font: 10px/1.6 var(--pixel); color: var(--lightgreen); letter-spacing: 2px; }
.stage-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 0 0 12px; }
.stage-head .section-kicker { margin: 0; }
.diff-filter { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-left: auto; }
.diff-chip { font: 9px/1.4 var(--pixel); color: var(--lightgray); background: var(--black); border: 2px solid var(--darkgray); padding: 7px 9px 6px; min-height: 28px; cursor: pointer; }
.diff-chip:hover { color: var(--white); border-color: var(--lightcyan); }
.diff-chip[aria-pressed="true"] { color: var(--black); background: var(--yellow); border-color: var(--yellow); }
.section-title { margin: 0 0 14px; font: clamp(18px, 3vw, 28px)/1.4 var(--pixel); color: var(--yellow); text-shadow: 3px 3px 0 var(--black); }
.lede { margin: 0; font-size: 25px; color: var(--lightcyan); }
.worlds { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px 22px; align-items: start; margin-top: 36px; }
.cols-1 { grid-template-columns: minmax(0, 1fr); }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.world { min-width: 0; --wc: var(--lightcyan); }
.world-1 { --wc: var(--yellow); }
.world-2 { --wc: var(--lightgreen); }
.world-3 { --wc: var(--lightmagenta); }
.world-head { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.world-tag { font: 10px var(--pixel); color: var(--black); background: var(--yellow); padding: 6px 8px; }
.world-2 .world-tag { background: var(--lightgreen); }
.world-desc { margin: 12px 0 0; color: var(--lightgray); }
.lede-2 { margin-top: 6px; font-size: 22px; color: var(--white); }
.stages { list-style: none; margin: 14px 0 0; padding: 0 0 4px; display: grid; gap: 16px; }
.cols-1 .stages, .corner .stages { grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); }
.world-more { margin: 14px 0 0; padding: 8px 10px; border: 2px dashed var(--lightgray); color: var(--lightgray); font-size: 20px; line-height: 1.2; }
.stage, .series {
  position: relative; display: flex; flex-direction: column; gap: 8px; height: 100%; padding: 10px 12px 12px; color: var(--white);
  background: var(--black); border: 3px solid var(--lightcyan); border-left: 10px solid var(--wc, var(--lightcyan)); box-shadow: 5px 5px 0 var(--black);
}
.stage { transition: transform 80ms steps(2), box-shadow 80ms steps(2), border-color 80ms; }
.stage:hover, .stage:focus-within { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--black); border-color: var(--yellow); border-left-color: var(--wc, var(--lightcyan)); }
.stage-top, .series-kind { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; margin: 0; }
.stage-num { font: 11px var(--pixel); color: var(--black); background: var(--yellow); padding: 5px 7px; }
.world-2 .stage-num { background: var(--lightgreen); }
.world-3 .world-tag, .world-3 .stage-num { background: var(--lightmagenta); }
.world-4 .world-tag, .world-4 .stage-num { background: var(--lightcyan); }
.kind { font: 8px/1.4 var(--pixel); color: var(--lightgray); }
.diff { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font: 9px var(--pixel); }
.stage .diff, .series .diff { font-size: 8px; }
.diff-meter { display: inline-flex; gap: 3px; }
.diff-meter i { width: 10px; height: 12px; background: var(--darkgray); }
.diff-easy { color: var(--lightgreen); }
.diff-easy .diff-meter i:first-child { background: var(--lightgreen); }
.diff-medium { color: var(--yellow); }
.diff-medium .diff-meter i:nth-child(-n+2) { background: var(--yellow); }
.diff-hard { color: var(--lightred); }
.diff-hard .diff-meter i { background: var(--lightred); }
.diff-nightmare { color: var(--white); background: var(--magenta); padding: 3px 4px; }
.diff-nightmare .diff-meter i { background: var(--black); }
.stage-name, .series-name { margin: 0; font: 12px/1.6 var(--pixel); color: var(--white); text-shadow: 2px 2px 0 var(--blue); text-transform: uppercase; }
.stage:hover .stage-name, .stage:focus-within .stage-name { color: var(--yellow); }
.stage-link { color: inherit; text-decoration: none; }
.stage-link::after { content: ""; position: absolute; inset: 0; }
.stage-link:focus-visible { outline: none; }
.stage-link:focus-visible::after { outline: 3px dashed var(--white); outline-offset: 4px; }
.mem { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 0; }
.mem .lbl { font: 8px var(--pixel); color: var(--lightcyan); }
.mem .pill { font: 12px/1 var(--pixel); color: var(--black); background: var(--yellow); padding: 5px 7px 4px; box-shadow: 3px 3px 0 var(--brown); }
.mem .unit { font: 8px var(--pixel); color: var(--lightgray); }
.mem .badge { margin-left: auto; gap: 4px; font-size: 8px; padding: 4px 5px; }
.mem .badge .icon { width: 8px; height: 8px; }
.stage .tags { margin: 0; }
.series-note { margin: 0; color: var(--lightgray); font-size: 20px; line-height: 1.2; }
.series-kind .tagc-series { color: var(--black); background: var(--wc, var(--lightcyan)); border-color: var(--wc, var(--lightcyan)); padding: 3px 5px; }
.mini-stairs, .mini-nodes { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.mini-stairs { gap: 6px; align-items: end; }
.mini-stairs li { display: flex; }
.mini-step { display: flex; flex-direction: column; justify-content: flex-end; gap: 3px; width: 100%; min-height: 58px; padding: 6px 4px 7px; color: var(--white); text-decoration: none; background: var(--blue); border: 2px solid var(--lightcyan); border-top-width: 5px; }
.mini-stairs li:nth-child(2) .mini-step { min-height: 76px; }
.mini-stairs li:nth-child(3) .mini-step { min-height: 94px; }
.mini-stairs li:nth-child(n+4) .mini-step { min-height: 112px; }
.mini-step:hover { color: var(--yellow); border-color: var(--yellow); }
.mini-step:focus-visible { outline: 3px dashed var(--white); outline-offset: 2px; }
.mini-step b { font: 12px var(--pixel); font-weight: normal; color: var(--wc, var(--lightcyan)); }
.mini-step span { font: 7px/1.3 var(--pixel); white-space: nowrap; }
.mini-step.is-green { border-color: var(--lightgreen); }
.mini-step.is-green b { color: var(--lightgreen); }
.mini-step.is-yellow { border-color: var(--yellow); }
.mini-step.is-yellow b { color: var(--yellow); }
.mini-nodes li { position: relative; display: flex; justify-content: center; }
.mini-nodes li:not(:last-child)::after { content: ""; position: absolute; top: 20px; left: calc(50% + 18px); right: calc(-50% + 18px); height: 4px; background: var(--wc, var(--lightcyan)); }
.mini-nodes li.next-locked:not(:last-child)::after { background: repeating-linear-gradient(90deg, var(--lightgray) 0 4px, transparent 4px 8px); }
.nd { position: relative; z-index: 1; display: inline-grid; place-items: center; width: 40px; height: 40px; font: 12px var(--pixel); color: var(--black); background: var(--wc, var(--lightcyan)); border: 3px solid var(--black); text-decoration: none; box-shadow: 0 4px 0 var(--brown); }
a.nd:hover { background: var(--white); color: var(--black); }
a.nd:focus-visible { outline: 3px dashed var(--white); outline-offset: 3px; }
.nd.is-locked { color: var(--lightgray); background: var(--black); border: 3px dashed var(--lightgray); box-shadow: none; }
.nd .icon { width: 16px; height: 16px; }
a.nd.is-green { background: var(--lightgreen); }
a.nd.is-yellow { background: var(--yellow); }
.corner { --wc: var(--lightgray); margin: 28px 0 0; border: 3px dashed var(--lightgray); background: var(--black); }
.corner-h { margin: 0; }
.corner-btn { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; width: 100%; min-height: 52px; padding: 8px 14px; font: 11px/1.6 var(--pixel); color: var(--white); background: none; border: 0; text-align: left; cursor: pointer; }
.corner-btn::before { content: ""; flex: none; border: 7px solid transparent; border-left: 11px solid var(--lightgray); border-right: 0; }
.corner-btn[aria-expanded="true"]::before { border: 7px solid transparent; border-top: 11px solid var(--lightgray); border-bottom: 0; }
.corner-btn:hover { color: var(--yellow); }
.corner-btn:focus-visible { outline: 3px dashed var(--white); outline-offset: -6px; }
.corner-sum { font: 20px/1.2 var(--term); color: var(--lightgray); }
.corner-body { padding: 4px 14px 16px; }
.corner-body > p { margin: 0 0 14px; color: var(--lightgray); }
.pick {
  display: inline-block; margin-top: 14px; font: 10px/1.4 var(--pixel); color: var(--lightcyan);
  text-decoration: none;
}
.pick::after { content: ""; position: absolute; inset: 0; }
.pick:focus-visible { outline: none; }
.pick:focus-visible::after { outline: 3px dashed var(--white); outline-offset: 6px; }
.loading { display: inline-flex; gap: 3px; margin-right: 12px; vertical-align: -1px; }
.loading i { width: 8px; height: 12px; background: var(--darkgray); animation: load 1.5s steps(1) infinite; }
.loading i:nth-child(2) { animation-delay: .15s; }
.loading i:nth-child(3) { animation-delay: .3s; }
.loading i:nth-child(4) { animation-delay: .45s; }
.loading i:nth-child(5) { animation-delay: .6s; }
@keyframes load { 0% { background: var(--lightmagenta); } 60% { background: var(--darkgray); } }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.lang-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.lang { position: relative; display: block; cursor: pointer; }
.lang input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.lang span {
  position: relative; display: block; padding: 16px 8px; text-align: center;
  font: 13px var(--pixel); color: var(--white); background: var(--blue);
  border: 3px solid var(--lightcyan); box-shadow: 0 6px 0 var(--darkgray);
  transition: transform 60ms linear, box-shadow 60ms linear;
}
.lang:hover span { border-color: var(--yellow); }
.lang input:checked + span { color: var(--black); background: var(--yellow); border-color: var(--black); transform: translateY(6px); box-shadow: 0 0 0 var(--darkgray); }
.lang input:checked + span::after { content: "P1"; position: absolute; top: -12px; right: -8px; padding: 4px; font-size: 8px; color: var(--black); background: var(--lightred); border: 2px solid var(--black); }
.lang input:focus-visible + span { outline: 4px dashed var(--white); outline-offset: 4px; }
.form-error { min-height: 1em; margin: -10px 0 0; font: 10px/1.6 var(--pixel); color: var(--lightred); }
.btn:disabled { cursor: progress; }
.tag { display: inline-block; vertical-align: middle; margin-left: 10px; padding: 4px 6px; font-size: 8px; color: var(--black); background: var(--lightmagenta); }
.foot {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px 24px;
  padding: 22px 32px 28px; background: var(--black); border-top: 4px solid var(--lightcyan);
  font: 10px/1.6 var(--pixel); color: var(--lightgray);
}
.credits { color: var(--yellow); }
.foot-links { display: flex; gap: 8px; margin: -8px 0; }
.foot-links a { color: var(--white); text-decoration: none; padding: 8px 10px; border: 2px solid var(--darkgray); }
.foot-links a:hover { color: var(--yellow); border-color: var(--yellow); }
.foot-links a:focus-visible { outline: 3px dashed var(--white); outline-offset: 2px; }

.skip { position: absolute; left: 8px; top: -80px; z-index: 100; padding: 10px 14px; font: 10px var(--pixel); color: var(--black); background: var(--yellow); text-decoration: none; }
.skip:hover { color: var(--black); }
.skip:focus { top: 8px; outline: 3px dashed var(--black); outline-offset: 2px; }
main { display: block; }
main:focus { outline: none; }
a { color: var(--lightcyan); }
a:hover { color: var(--yellow); }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px dashed var(--focus); outline-offset: 2px; }
h1, h2, h3, h4 { overflow-wrap: anywhere; }
.boot, .noscript, .empty { padding: 48px 32px; margin: 0; }
.noscript { color: var(--lightred); background: var(--black); }
code { font-family: var(--code); font-size: .9em; background: var(--black); padding: 0 .15em; }
.dim { color: var(--lightgray); }

/* CRT FX: scanlines over the whole screen, and the starfield drift on the title screen. The pseudo-element used
   to have no content, so the toggle drew nothing; it is off for forced colours and more-contrast */
.screen::after { content: ""; display: none; position: absolute; inset: 0; z-index: 50; pointer-events: none; border-radius: inherit; background: repeating-linear-gradient(to bottom, transparent 0 2px, rgba(0,0,0,.1) 2px 3px); }
html[data-crt="on"] .screen::after { display: block; }
html[data-crt="off"] .hero { animation: none; }
@media (forced-colors: active), (prefers-contrast: more) { html[data-crt="on"] .screen::after { display: none; } }

.hud-user { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.hud-login { color: var(--white); max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud-user .btn-mini {
  color: var(--black); background: var(--yellow); border: 2px solid var(--black); font: 10px var(--pixel); padding: 8px 10px; cursor: pointer;
  box-shadow: inset 0 2px 0 var(--white), 0 4px 0 var(--brown);
  transition: transform 60ms linear, box-shadow 60ms linear;
}
.hud-user .btn-mini:hover { transform: translateY(-1px); box-shadow: inset 0 2px 0 var(--white), 0 5px 0 var(--brown); }
.hud-user .btn-mini:active { transform: translateY(4px); box-shadow: inset 0 2px 0 var(--brown), 0 0 0 var(--brown); }
.hud-nav a[aria-current="page"] { color: var(--yellow); border-color: var(--yellow); }
.avatar { width: 24px; height: 24px; image-rendering: pixelated; background: var(--darkgray); flex: none; }
.avatar-sm { width: 16px; height: 16px; }
.avatar-lg { width: 64px; height: 64px; }
.avatar-letter { display: inline-grid; place-items: center; font: 10px var(--pixel); color: var(--black); background: var(--lightcyan); }

.foot-btn { font: 10px/1.6 var(--pixel); color: var(--white); background: var(--black); border: 2px solid var(--darkgray); padding: 8px 10px; cursor: pointer; }
.foot-btn:hover { color: var(--yellow); border-color: var(--yellow); }
.foot-btn[aria-pressed="true"] { color: var(--lightgreen); }
.foot .credits { color: var(--yellow); }

.login-error { max-width: 640px; margin: 0 auto 24px; padding: 10px 14px; font: 11px/1.8 var(--pixel); color: var(--lightred); background: var(--black); border: 3px solid var(--lightred); }
.login-note { max-width: 640px; margin: 28px auto 0; color: var(--white); }
.hero .sub b { color: var(--yellow); font-weight: normal; word-break: break-all; }
.err-screen { display: grid; place-items: center; text-align: center; padding: 64px 24px 72px; min-height: 60vh; }
.err-screen .code { margin: 0 0 12px; font: 12px/1.8 var(--pixel); color: var(--lightgreen); letter-spacing: 2px; }
.err-screen h1 {
  margin: 0 0 24px; font: clamp(28px, 8vw, 72px)/1.1 var(--pixel); color: var(--lightred);
  text-shadow: .06em .06em 0 var(--magenta), .12em .12em 0 var(--black); outline: none;
}
.err-text { max-width: 34ch; margin: 0 auto 36px; font-size: 24px; line-height: 1.3; }
.err-detail { max-width: 48ch; margin: -20px auto 32px; color: var(--lightgray); }
.err-actions { display: flex; gap: 24px; justify-content: center; flex-wrap: wrap; }
.err-screen .btn { gap: 10px; }
.err-screen .btn small { font-size: 9px; letter-spacing: 1px; }
.btn small { font-size: 9px; letter-spacing: 1px; }
.btn-small { font-size: 11px; padding: 12px 16px 10px; border-width: 3px; --drop: 5px; }
.btn-mini-dark { display: inline-block; font: 9px/1 var(--pixel); color: var(--lightcyan); background: var(--black); border: 2px solid var(--lightcyan); padding: 8px 10px; cursor: pointer; text-decoration: none; min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; }
.btn-mini-dark:hover { color: var(--yellow); border-color: var(--yellow); }
.linkbtn { font: inherit; color: var(--lightcyan); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }
.linkbtn:hover { color: var(--yellow); }

.world-title { margin: 0; font: 12px/1.5 var(--pixel); color: var(--white); }
.tags { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 8px; }
.tagc { font: 8px/1.4 var(--pixel); color: var(--lightgray); border: 2px solid var(--darkgray); padding: 3px 5px; }
.tagc-unranked { color: var(--black); background: var(--lightmagenta); border-color: var(--lightmagenta); font-size: 10px; padding: 4px 7px; }


.badge { display: inline-flex; align-items: center; gap: 6px; font: 9px/1 var(--pixel); color: var(--black); padding: 5px 7px; border: 2px solid var(--black); vertical-align: middle; white-space: nowrap; }
.tier-green { background: var(--tier-green); }
.tier-yellow { background: var(--tier-yellow); }
.tier-red { background: var(--tier-red); }
.tier-pending, .tier-unknown { background: var(--tier-pending); }
.v-ok { background: var(--lightgreen); }
.v-bad { background: var(--lightred); }
.v-judge { background: var(--lightmagenta); }
.icon { width: 12px; height: 12px; flex: none; shape-rendering: crispEdges; }
.with-icon { display: inline-flex; align-items: center; gap: 0.6em; }

.panel { margin: 0 0 28px; background: var(--black); border: 3px solid var(--lightcyan); box-shadow: 6px 6px 0 var(--black); padding: 16px 18px 18px; }
.panel-title { margin: 0 0 14px; font: 12px/1.6 var(--pixel); color: var(--yellow); }
.term, pre.code { margin: 0 0 14px; padding: 10px 12px; font: var(--code-size)/var(--code-lh) var(--code); color: var(--white); background: var(--black); border: 3px solid var(--lightcyan); overflow: auto; max-height: 360px; white-space: pre; tab-size: 4; }
pre.code { border-color: var(--darkgray); }
pre code { background: none; padding: 0; font: inherit; }
.ctl { color: var(--black); background: var(--lightmagenta); }
.table-wrap { max-width: 100%; overflow-x: auto; margin: 0 0 18px; }
.table-wrap:focus-visible { outline: 3px dashed var(--focus); outline-offset: 2px; }
table { border-collapse: collapse; }
th { font: 9px/1.5 var(--pixel); color: var(--lightgray); text-align: left; font-weight: normal; padding: 6px 10px 6px 0; }
td { padding: 6px 10px 6px 0; }
.al-c { text-align: center; }
.al-r { text-align: right; }
table.kv { width: 100%; margin: 0 0 14px; background: var(--black); border: 3px solid var(--lightcyan); }
table.kv caption { text-align: left; font: 11px/1.6 var(--pixel); color: var(--yellow); padding: 8px 0 8px; }
table.kv th, table.kv td { padding: 6px 10px; border-top: 2px dashed var(--darkgray); vertical-align: top; }
table.kv th { color: var(--lightcyan); }
.callout { margin: 0 0 14px; padding: 10px 14px; background: var(--black); border-left: 6px solid var(--lightmagenta); }
.callout b { color: var(--yellow); font-weight: normal; }
.tl { margin: 0 0 8px; }
.tl-green { color: var(--tier-green); } .tl-yellow { color: var(--tier-yellow); } .tl-red { color: var(--tier-red); }
.gb { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 18px; margin: 0 0 14px; padding: 6px 12px; background: var(--black); border: 3px solid var(--lightgreen); }
.gb-title { margin: 0; font: 9px/1.6 var(--pixel); color: var(--lightgreen); }
.gb ul { list-style: none; margin: 0; padding: 0; display: contents; } /* the bounds flow with the title */
.gb li { font-size: 19px; line-height: 1.3; color: var(--lightgreen); overflow-wrap: anywhere; }
.foot-note { margin: 0; padding: 8px 16px; border-top: 2px dashed var(--darkgray); color: var(--lightgray); }
.note { margin: 0 0 14px; color: var(--lightgray); }
.tag { margin-left: 8px; }
.tag-prov { background: var(--lightmagenta); }
.tag-unranked { background: var(--lightmagenta); }
details.compare, details.hard { margin: 0 0 18px; }
summary { cursor: pointer; font: 10px/1.6 var(--pixel); color: var(--lightcyan); padding: 10px 0; min-height: 44px; }
summary:hover { color: var(--yellow); }

.problem { max-width: 1240px; margin: 0 auto; padding: 28px 24px 56px; }
.problem-head { margin: 0 0 26px; }
.crumbs { font: 9px/1.8 var(--pixel); color: var(--lightgray); margin: 0 0 10px; }
.crumbs a { color: var(--lightcyan); }
.crumbs span { color: var(--white); }
.problem-title { margin: 0 0 12px; font: clamp(18px, 3vw, 28px)/1.4 var(--pixel); color: var(--yellow); text-shadow: 3px 3px 0 var(--black); outline: none; }
.problem-head .tags { margin: 0 0 12px; align-items: center; }
.problem-head .kind { font: 8px/1.4 var(--pixel); color: var(--lightgray); }
.input-line { margin: 0 0 8px; }
.problem-links { display: flex; gap: 8px 22px; flex-wrap: wrap; margin: 0; }
.problem-links .pick { margin-top: 0; min-height: 44px; display: inline-flex; align-items: center; }
.problem-links .pick::after { display: none; }
.statement { margin: 0 0 28px; padding: 6px 20px 8px; background: var(--black); border: 3px solid var(--darkgray); font: 16px/1.7 'IBM Plex Mono', ui-monospace, monospace; }
.input-line { font: 16px/1.7 'IBM Plex Mono', ui-monospace, monospace; }
.statement h2 { margin: 24px 0 12px; font: 14px/1.5 var(--pixel); color: var(--yellow); }
.statement h3 { margin: 20px 0 10px; font: 12px/1.5 var(--pixel); color: var(--lightcyan); }
.statement h4 { margin: 18px 0 8px; font: 10px/1.5 var(--pixel); color: var(--lightgreen); }
.statement p, .statement li { margin: 0 0 12px; }
.statement ul, .statement ol { margin: 0 0 12px; padding-left: 28px; }
.statement ul ul, .statement ol ol, .statement ul ol, .statement ol ul { margin: 6px 0 0; }
.statement blockquote { margin: 0 0 12px; padding: 4px 16px; border-left: 6px solid var(--lightmagenta); color: var(--lightgray); }
.statement hr { border: 0; height: 8px; margin: 22px 0; background: repeating-linear-gradient(90deg, var(--lightblue) 0 8px, transparent 8px 16px); }
.statement table { margin: 0 0 12px; border: 3px solid var(--darkgray); }
.statement th, .statement td { padding: 6px 12px; border-bottom: 2px dashed var(--darkgray); }
.samples .sample { margin: 0 0 24px; }
.sample-name { margin: 0 0 8px; font: 11px/1.5 var(--pixel); color: var(--lightcyan); }
.sample-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 6px; }
.sample-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.run-label { margin: 8px 0 6px; font: 9px/1.5 var(--pixel); color: var(--lightgreen); }
.sample-row .run-label { margin: 0; }

.lang-tag { display: block; margin-top: 6px; font: 7px/1.4 var(--pixel); color: var(--black); background: var(--yellow); padding: 3px 4px; }
.lang-tag.tag-prov, .lang-tag.tag-unranked { background: var(--lightmagenta); }
.editor-fallback { display: block; width: 100%; height: 100%; margin: 0; padding: 8px 12px; font: var(--code-size)/var(--code-lh) var(--code); color: var(--white); background: var(--black); border: 0; resize: none; caret-color: var(--yellow); tab-size: 4; white-space: pre; overflow: auto; }
.editor-note, .hint { margin: 6px 0 0; font-size: 20px; color: var(--lightgray); }
.size.over { color: var(--lightred); background: var(--black); }
.notice { margin: 0 0 10px; padding: 8px 12px; background: var(--black); border: 3px solid var(--yellow); }
.custom-input { margin: 0 0 18px; }
.check { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font: 10px/1.6 var(--pixel); color: var(--lightcyan); cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--yellow); margin: 0; }
.stdin-box { margin: 6px 0 0; }
.stdin { display: block; width: 100%; padding: 8px 12px; font: var(--code-size)/var(--code-lh) var(--code); color: var(--white); background: var(--black); border: 3px solid var(--lightcyan); border-radius: 0; caret-color: var(--yellow); resize: vertical; min-height: 120px; }
.stdin-box .size { display: block; margin: 6px 0 0; font: 9px/1.8 var(--pixel); color: var(--lightgray); }
.btn:disabled { opacity: .55; transform: none; }
.keys ul { margin: 0 0 10px; padding-left: 24px; color: var(--lightgray); }
.form-error { min-height: 0; margin: 0 0 14px; font: 10px/1.6 var(--pixel); color: var(--lightred); }
.form-error p { margin: 0 0 8px; padding: 6px 10px; background: var(--black); }
.form-error .dim { font: 20px var(--term); }

.run-panel .status { padding: 0; border: 0; }
.status { background: var(--black); border: 3px solid var(--lightcyan); padding: 12px 14px; }
.status[data-tone="ok"] { border-color: var(--lightgreen); }
.status[data-tone="bad"] { border-color: var(--lightred); }
.status[data-tone="judge"] { border-color: var(--lightmagenta); }
.status-top { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; }
.status-headline { margin: 0; font: 13px/1.6 var(--pixel); color: var(--white); }
.status[data-tone="ok"] .status-headline { color: var(--lightgreen); }
.status[data-tone="bad"] .status-headline { color: var(--lightred); }
.status[data-tone="judge"] .status-headline { color: var(--lightmagenta); }
.status-lines { margin: 8px 0 0; }
.status-line { margin: 0 0 6px; }
.bound-lines { list-style: none; margin: 0 0 8px; padding: 0; font: 10px/1.8 var(--pixel); color: var(--yellow); }
.banner { margin: 8px 0; font: 9px/1.6 var(--pixel); color: var(--black); background: var(--lightred); padding: 6px 10px; }
.run-idle { margin: 0 0 18px; }
.run-body { margin: 10px 0 0; }
.run-numbers { margin: 0 0 8px; font: 10px/1.8 var(--pixel); color: var(--lightcyan); }
.run-card { margin: 0 0 12px; padding: 10px 12px; border: 3px dashed var(--darkgray); }
.run-card-title { margin: 0 0 8px; font: 10px/1.8 var(--pixel); color: var(--white); }
.run-cpu { color: var(--lightgray); }
.ie-box { padding: 10px 14px; margin: 0; font: 11px/1.8 var(--pixel); color: var(--black); background: var(--lightmagenta); }
.run-foot { margin: 10px 0 0; }
.run-foot .pick { margin-top: 0; }
.run-foot .pick::after { display: none; }
.progress { margin: 10px 0 0; }
.progress-label { margin: 0 0 8px; font: 10px/1.6 var(--pixel); color: var(--lightcyan); }
.progress-box { background: var(--black); border: 3px solid var(--lightcyan); padding: 6px; min-height: 36px; }
.cells { display: grid; grid-template-columns: repeat(20, minmax(0, 1fr)); gap: 3px; }
.cell { height: 18px; background: var(--decor); }
.cell.on { background: var(--lightgreen); animation: cellflash .25s steps(1) 1; }
.progress[data-kind="measuring"] .cell.on { background: var(--yellow); }
@keyframes cellflash { 0% { background: var(--white); } }
.progress-wait { margin-top: 6px; font: 9px var(--pixel); color: var(--lightgray); }
.progress-wait .loading { margin-right: 10px; }
.working { display: none; }
.progress-wait[hidden], .progress[hidden] { display: none; }

dialog.dialog { max-width: min(480px, calc(100vw - 32px)); padding: 22px; color: var(--white); background: var(--black); border: 4px solid var(--lightmagenta); box-shadow: 10px 10px 0 var(--black); }
dialog.dialog::backdrop { background: rgba(0,0,0,.7); }
.dialog-title { margin: 0 0 14px; font: 12px/1.6 var(--pixel); color: var(--yellow); }
.dialog-text { margin: 0 0 20px; }
.dialog-list { margin: 0; padding-left: 20px; }
.dialog-list li + li { margin-top: 8px; }
.dialog-actions { display: flex; gap: 16px; flex-wrap: wrap; justify-content: flex-end; }

/* the wide container: .screen's copied rule stays; pages get up to 1920 px, their content 1600 */
.screen.app { max-width: 1920px; }
.screen.app ~ .bezel { max-width: 1920px; }
.app .section, .app .problem { max-width: 1600px; }

/* the problem workspace (docs/design/problem-workspace.md): bar, two panes, tabs, toolbar, console */
.ws-root { padding: 8px 8px 0; }
.ws-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; min-height: 44px; padding: 0 4px 8px; }
.ws-bar .crumbs { margin: 0; white-space: nowrap; }
.ws-bar .problem-title { margin: 0; font-size: clamp(12px, 3.4vw, 15px); text-shadow: 2px 2px 0 var(--black); overflow-wrap: anywhere; }
.ws-bar .tags { margin: 0; flex: 1 1 0; min-width: 0; align-items: center; }
.ws-bar .kind { font: 8px/1.4 var(--pixel); color: var(--white); }
.ws-bar .tagc { background: var(--black); }
.ws-bar .tagc-unranked { background: var(--lightmagenta); } /* the line above would make this black on black */
.pane { min-width: 0; background: var(--black); border: 3px solid var(--lightcyan); }
.pane-left, .pane-right { display: flex; flex-direction: column; }
.ws-panes { display: flex; flex-direction: column; gap: 12px; }
.tabs { display: flex; flex: none; flex-wrap: wrap; gap: 6px; padding: 6px 8px; border-bottom: 3px dashed var(--darkgray); }
.tab { flex: none; min-height: 36px; padding: 6px 10px; font: 9px/1.4 var(--pixel); color: var(--lightcyan); background: none; border: 2px solid var(--lightgray); cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--yellow); }
.tab[aria-selected="true"] { color: var(--yellow); border-color: var(--yellow); }
.tab:focus-visible, .tabpanel:focus-visible, .splitter:focus-visible { outline: 3px dashed var(--focus); outline-offset: -3px; }
.tabpanel { padding: 12px 16px 20px; }
.tabpanel .statement { margin: 0 0 24px; padding: 0; border: 0; }
.sub-links { margin: 0 0 10px; }
.pane-left table.history th, .pane-left table.history td, .pane-left table.board th, .pane-left table.board td { padding: 6px 4px; }
.pane-left table.board td { font-size: 10px; }
.pane-left table.history td { font-size: 17px; }
.pane-left table.board td:not(.player), .pane-left table.history td:first-child, .pane-left table.history td.al-r { white-space: nowrap; }
.pane-left table.history :is(th, td):nth-child(n+3):nth-child(-n+4) { display: none; }
.pane-left table.board .hide-s { display: none; }
.sub-links .pick, .problem-links .pick { margin: 0; min-height: 44px; display: inline-flex; align-items: center; }
.sub-links .pick::after { display: none; }
.splitter { display: none; touch-action: none; background: repeating-linear-gradient(180deg, var(--dash, var(--lightblue)) 0 8px, transparent 8px 16px); }
.splitter-y { background: repeating-linear-gradient(90deg, var(--dash, var(--lightblue)) 0 8px, transparent 8px 16px); cursor: row-resize; }
.splitter-x { cursor: col-resize; }
.splitter:hover, .splitter.drag { --dash: var(--yellow); }
.ws-toolbar { padding: 8px 12px 2px; border-bottom: 2px dashed var(--darkgray); }
.tb-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 6px; }
.tb-field { display: flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; }
.tb-lang { flex: 1 1 200px; }
.tb-field select { min-width: 0; flex: 1; }
.tb-field:not(.tb-lang) select { flex: 0 1 auto; }
.tb-label { font: 9px var(--pixel); color: var(--lightcyan); }
.ws-toolbar select { min-height: 36px; padding: 2px 6px; font-size: 18px; color-scheme: dark; }
#lang-select { max-width: min(30em, 100%); }
.lang-info { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; flex: 1 1 160px; min-width: 0; }
.chips { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.chips:not(:empty) { margin: 0 0 6px; }
.lang-tag { font: 8px/1.4 var(--pixel); color: var(--black); background: var(--yellow); padding: 3px 5px; }
.lang-tag.tag-prov, .lang-tag.tag-unranked { background: var(--lightmagenta); }
/* Where the browser can style the list (Chromium's appearance: base-select), the tag words in each option
   are chips like the ones beside the select; every other browser keeps the native select and plain option text. */
@supports (appearance: base-select) {
  #lang-select, #lang-select::picker(select) { appearance: base-select; }
  #lang-select::picker(select) { padding: 0; color-scheme: dark; background: var(--black); border: 3px solid var(--lightcyan); border-radius: 0; }
  #lang-select option { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 6px 10px; background: var(--black); color: var(--white); }
  #lang-select option:hover, #lang-select option:focus-visible { background: var(--blue); }
  #lang-select option:checked { color: var(--yellow); }
  #lang-select option::checkmark { display: none; }
  #lang-select::picker-icon { content: ""; border: 6px solid transparent; border-top-color: currentColor; margin-top: 6px; }
}
.lang-note { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; max-height: 2.5em; margin: 0 0 6px; overflow: hidden; font-size: 19px; line-height: 1.25; color: var(--lightmagenta); }
.lang-note:focus { display: block; overflow-y: auto; }
.ws-notices .notice { margin: 0; padding: 4px 12px; border-width: 0 0 2px; }
.editor-mount { position: relative; height: 60vh; min-height: 240px; }
.editor-box { position: absolute; inset: 0; background: var(--black); overflow: hidden; }
.editor-loading { display: grid; place-items: center; height: 100%; font: 11px var(--pixel); color: var(--lightgray); }
.editor-box[data-state="fallback"] { display: flex; flex-direction: column; }
.editor-box[data-state="fallback"] .editor-fallback { flex: 1; min-height: 0; }
.ws-status { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 16px; padding: 3px 12px; font: 9px/1.8 var(--pixel); color: var(--lightgray); border-top: 2px dashed var(--darkgray); }
.key-mode { margin-right: auto; color: var(--yellow); }
.console { display: flex; flex-direction: column; border-top: 3px solid var(--lightcyan); }
.console-bar { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 8px; background: var(--blue); }
.console-bar .tabs { padding: 0; border: 0; }
.console-toggle { display: none; min-height: 36px; padding: 0 10px; font: 9px var(--pixel); color: var(--white); background: none; border: 2px solid var(--lightgray); cursor: pointer; }
.console-toggle:hover { color: var(--yellow); border-color: var(--yellow); }
.console-actions { display: flex; gap: 12px; margin-left: auto; }
.btn-bar { flex-direction: row; gap: 6px; min-height: 36px; padding: 6px 14px 4px; font-size: 11px; border-width: 3px; --drop: 4px; }
.console-body { padding: 8px 12px; }
.console-err { padding: 0 12px; }
.console-err .form-error { margin: 6px 0 0; }
.console-err .form-error:empty { display: none; }
.console .run-panel { margin: 0; padding: 0; border: 0; box-shadow: none; }
.input-panel .hint { margin: 0 0 6px; }
.dock { position: sticky; bottom: 0; z-index: 30; margin: 0 -8px; padding: 8px; background: var(--black); border-top: 4px solid var(--lightcyan); }
.dock-row { display: flex; align-items: center; gap: 8px; }
.dock .console-actions { margin-left: auto; }
.dock .console-err { padding: 0; }

@media (min-width: 1024px) {
  body.ws { padding: 8px; }
  .screen.ws { border-radius: 16px; }
  body.ws .bezel { display: none; }
  .ws-root { display: flex; flex-direction: column; height: calc(100vh - var(--hud-h) - 16px); height: calc(100dvh - var(--hud-h) - 16px); min-height: 560px; padding: 8px; }
  .ws-bar { flex: none; flex-wrap: nowrap; height: 44px; }
  .ws-bar .problem-title, .ws-bar .tags { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ws-bar .tags { flex-wrap: nowrap; }
  .ws-panes { flex: 1; min-height: 0; display: grid; grid-template-columns: clamp(360px, var(--split, 42%), calc(100% - 528px)) 8px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 0; }
  .pane { overflow: hidden; }
  .splitter { display: block; }
  .tabpanel { flex: 1; min-height: 0; overflow: auto; }
  .ws-toolbar, .ws-status, .ws-notices { flex: none; }
  .editor-mount { flex: 1 1 0; height: auto; min-height: 200px; }
  .console { flex: 0 1 auto; min-height: 48px; }
  .console[data-open="true"] { height: var(--con, 36%); max-height: calc(100% - 430px); }
  .console[data-open="false"] { height: 48px; }
  .console[data-open="false"] .console-body { display: none; }
  .console-toggle { display: block; }
  .console-body { flex: 1; min-height: 0; overflow: auto; }
  .dock { display: none; }
  .ws-root.focus .pane-left, .ws-root.focus .splitter-x { display: none; }
  .ws-root.focus .ws-panes { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1023px) {
  .focus-btn { display: none; }
  .ws-bar .tags { flex-basis: 100%; }
  .editor-box { border: 3px solid var(--lightcyan); }
}
@media (max-width: 1180px) {
  .worlds.cols-3, .worlds.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .worlds[class] { grid-template-columns: minmax(0, 1fr); }
  .corner-btn { font-size: 10px; }
}
@media (max-width: 760px) {
  body { padding: 6px; }
  .screen { border-radius: 16px; }
  .hud { padding: 10px 12px; gap: 10px 12px; font-size: 9px; }
  .hud-stats { display: none; }
  .hud-nav { order: 3; width: 100%; justify-content: space-between; gap: 4px; }
  .hud-nav a { padding: 7px 6px; }
  .hud-user { margin-left: auto; }
  .hero { padding: 32px 16px 40px; }
  .sub { font-size: 23px; }
  .divider { margin: 0 16px; }
  .section { padding: 48px 16px; }
  .problem { padding: 20px 14px 40px; }
  .panel, .statement { padding-left: 12px; padding-right: 12px; }
  .foot { padding: 20px 16px 24px; }
  .boot, .noscript, .empty { padding: 32px 16px; }
}
@media (max-width: 520px) {
  .hero-actions { flex-direction: column; align-items: stretch; }
  .btn-start { font-size: 15px; }
  .err-actions .btn { width: 100%; }
  .cell { height: 14px; }
  .status-headline { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .progress-wait .loading { display: none; }
  .working { display: inline; }
}
@media (forced-colors: active) {
  .badge, .btn, .stage, .series, .corner, .panel, .status, .term, .editor-box, .pane, .console, dialog.dialog { border-color: CanvasText; }
  .splitter { --dash: CanvasText; }
  .tab[aria-selected="true"] { border-color: Highlight; color: Highlight; }
  .cell.on { background: Highlight; }
  .cell { background: Canvas; border: 1px solid CanvasText; }
  .icon { fill: currentColor; }
}
.stage-name { text-transform: uppercase; }

[hidden] { display: none !important; }
.bezel { color: var(--lightgray); } /* the TRD keeps dark grey for decoration, never text */
.sub-meta { margin: 0 0 12px; color: var(--lightcyan); }
.sub-status { margin: 0 0 20px; }
.sub-status .status { border-width: 4px; }
.sub-status .status-headline { font-size: 15px; }
.numbers { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 0 0 12px; }
.num { min-height: 78px; padding: 10px 12px; background: var(--black); border: 3px solid var(--lightcyan); }
.num dt { margin: 0 0 8px; font: 9px var(--pixel); color: var(--lightcyan); }
.num dd { margin: 0; font: 14px/1.4 var(--pixel); color: var(--white); }
/* ≤ and ≥ come from the fallback font, which draws them small next to the pixel digits: size them up */
.num .sign, .sub-status .bound-lines .sign { font-size: 1.5em; line-height: 0; vertical-align: -.1em; }
.sub-status .status-top .badge { font-size: 12px; padding: 7px 10px; }
.sub-status .bound-lines { margin: 10px 0 12px; }
.sub-status .bound-lines li { margin: 0 0 8px; padding: 10px 12px; font-size: 14px; line-height: 1.7; border: 3px solid var(--yellow); border-left-width: 10px; }
.num.flash { animation: picked 1s steps(1) 1; }
@keyframes picked { 0% { border-color: var(--yellow); } 50% { border-color: var(--lightmagenta); } }
.num-note { margin: 0 0 6px; color: var(--lightgray); }
.num-notes { margin: 0 0 20px; }
.standing-line { margin: 0 0 10px; }
.standing b { font-weight: normal; color: var(--yellow); }
.standing-link .pick, .more .pick { margin: 0; min-height: 44px; display: inline-flex; align-items: center; }
.standing-link .pick::after { display: none; }
.problem-links .pick:focus-visible, .standing-link .pick:focus-visible, .run-foot .pick:focus-visible, .more .pick:focus-visible { outline: 3px dashed var(--focus); outline-offset: 2px; }
.charts .chart-title { margin: 18px 0 8px; font: 11px var(--pixel); color: var(--lightgreen); }
.chart { margin: 0 0 18px; }
.chart-svg { display: block; width: 100%; height: auto; background: var(--black); border: 3px solid var(--darkgray); }
.chart-summary { margin: 8px 0 4px; }
.c-green { fill: var(--tier-green); }
.c-yellow { fill: var(--black); stroke: var(--tier-yellow); stroke-width: 2; }
.c-ybar { stroke: var(--tier-yellow); stroke-width: 1; }
.c-hatch-bg { fill: var(--black); }
.c-hatch-bar { fill: var(--tier-yellow); }
.c-me { fill: var(--white); stroke: var(--black); stroke-width: 2; }
.c-you-mark, .c-you { fill: var(--white); }
.c-ref { stroke: var(--lightcyan); stroke-width: 2; }
.c-bound { stroke: var(--tier-yellow); stroke-width: 2; }
.c-axis { stroke: var(--white); stroke-width: 2; }
.c-this, .c-this-text { fill: var(--lightmagenta); }
.chart-legend { display: flex; gap: 18px; flex-wrap: wrap; margin: 6px 0 0; font-size: 14px; }
.legend-you { color: var(--white); }
.legend-this { color: var(--lightmagenta); }
.c-ref-text { fill: var(--lightcyan); }
.c-bound-text { fill: var(--tier-yellow); }
.c-label, .c-tick, .c-count, .c-axis-title { font-family: var(--pixel); font-size: 9px; fill: var(--white); }
.c-count { font-size: 8px; }
.c-axis-title { fill: var(--lightgray); }
.chart-table { margin: 6px 0 0; }
.chart-table .table-wrap { margin: 0; }
.tests { margin: 0 0 24px; }
.tests table.kv, table.history, table.board { width: 100%; background: var(--black); border: 3px solid var(--lightcyan); }
table.history caption, table.board caption, .tests table.kv caption { text-align: left; font: 11px/1.6 var(--pixel); color: var(--yellow); padding: 8px 10px; }
table.history th, table.board th, .tests table.kv th { padding: 8px 10px; font: 9px/1.5 var(--pixel); color: var(--lightgray); text-align: left; }
table.history td, table.board td, .tests table.kv td { padding: 8px 10px; border-top: 2px dashed var(--darkgray); vertical-align: middle; }
table.board td { font: 11px/1.5 var(--pixel); }
table.board .player { word-break: break-word; }
.board tr.r1 { color: var(--yellow); }
.board tr.r2 { color: var(--lightcyan); }
.board tr.r3 { color: var(--lightgreen); }
.board tr.you { color: var(--yellow); background: var(--blue); }
.board td.rank a { color: inherit; }
.board-div th { padding: 12px 10px; font: 10px var(--pixel); color: var(--tier-yellow); border-top: 4px solid var(--tier-yellow); }
.board .avatar { vertical-align: middle; }
/* a windowed board (boardTable in js/views/board.js): every row ROW_H = 44 px so the spacer rows can be arithmetic */
.board-wrap.virtual { max-height: min(70vh, 640px); overflow-y: auto; }
table.board.virtual thead th { position: sticky; top: 0; z-index: 1; background: var(--black); }
table.board.virtual tbody tr { height: 44px; }
table.board.virtual td, table.board.virtual .player, table.board.virtual .board-div th { white-space: nowrap; }
table.board.virtual tr.board-gap { height: auto; }
table.board.virtual .board-gap td { padding: 0; border: 0; }
.test-detail summary { min-height: 0; padding: 4px 0; }
.source { margin: 0 0 24px; }
.source .code { margin: 8px 0 12px; }
.me-head { display: flex; align-items: center; gap: 18px; margin: 0 0 24px; }
.me-login { margin: 0 0 6px; font: 14px var(--pixel); color: var(--lightgreen); }
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; margin: 0 0 14px; }
.field label, .board-label { display: block; margin: 0 0 6px; font: 9px var(--pixel); color: var(--lightcyan); }
.board-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; }
.board-form .board-label { margin: 0; align-self: center; }
select, input[type="text"], input[type="number"] { min-height: 44px; max-width: 100%; padding: 6px 10px; font: 20px var(--term); color: var(--white); background: var(--black); border: 3px solid var(--lightcyan); border-radius: 0; }
.more { margin: 16px 0 0; }
.admin-sec { margin: 0 0 24px; }
.kvgrid { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; margin: 0 0 16px; }
.kvgrid > div { display: contents; }
.kvgrid dt { font: 9px/1.8 var(--pixel); color: var(--lightcyan); }
.kvgrid dd { margin: 0; overflow-wrap: anywhere; }
.kvlist { list-style: none; margin: 0; padding: 0; }
.bad { color: var(--lightred); }
.mono { font-family: var(--code); font-size: var(--code-size); overflow-wrap: anywhere; }
.admin-result { min-height: 1.25em; margin: 8px 0 0; }
.admin-result[data-state="ok"] { color: var(--lightgreen); }
.admin-result[data-state="bad"] { color: var(--lightred); }
.admin-problem { margin: 14px 0 0; padding-top: 12px; border-top: 2px dashed var(--darkgray); }
@media (max-width: 520px) {
  .hide-s, .tick-opt { display: none; }
  .c-label, .c-tick, .c-axis-title { font-size: 18px; }
  .c-count { font-size: 16px; }
  .board .badge-word { font-size: 0; }
  .board .badge-word::first-letter { font-size: 9px; }
  .me-head { flex-direction: column; align-items: flex-start; }
  .numbers { grid-template-columns: 1fr 1fr; }
  .filters .field, .filters .btn, .board-form select, .filters select, .filters input { width: 100%; }
}
@media (forced-colors: active) {
  .c-green, .c-me, .c-you, .c-you-mark, .c-this, .c-hatch-bar { fill: CanvasText; }
  .c-yellow, .c-ybar, .c-hatch-bg { fill: Canvas; stroke: CanvasText; }
  .c-ref, .c-bound, .c-axis { stroke: CanvasText; }
  .c-label, .c-tick, .c-count, .c-axis-title, .c-ref-text, .c-bound-text, .c-this-text { fill: CanvasText; }
  .num, .chart-svg, table.history, table.board { border-color: CanvasText; }
}


.reading section { margin-bottom: 24px; }
.reading details { border: 1px solid var(--darkgray); padding: 10px; margin: 10px 0; }
.reading summary { cursor: pointer; color: var(--lightcyan); }
.reading summary:focus-visible { outline: 2px solid var(--white); outline-offset: 3px; }
.reading-meta { display: block; color: var(--lightgray); }
.reading-body { overflow-wrap: anywhere; }
.reading-body pre { max-width: 100%; overflow: auto; }
.reading-pointer { margin-top: 20px; }

/* ===== admin: PROBLEM ORDER (own block; web/js/views/admin.js) ===== */
.order-world { margin: 14px 0 0; }
.order-list { list-style: none; margin: 8px 0 0; padding: 0; }
.order-row { display: grid; grid-template-columns: 3ch minmax(0, 1fr) auto auto; align-items: center; gap: 4px 12px; padding: 6px 8px; border-top: 2px dashed var(--darkgray); }
.order-num { color: var(--lightgray); text-align: right; }
.order-title { overflow-wrap: anywhere; }
.order-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.order-btns { display: flex; gap: 6px; }
.order-btns .btn-mini-dark[disabled] { opacity: .45; cursor: default; }
.order-btns .btn-mini-dark[disabled]:hover { color: var(--lightcyan); border-color: var(--lightcyan); }
@media (max-width: 760px) {
  .order-row { grid-template-columns: 3ch minmax(0, 1fr); }
  .order-chips, .order-btns { grid-column: 2; }
}

.language-request { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 0; }
.language-request input { min-width: 0; max-width: 100%; }
.language-request .hint { flex-basis: 100%; margin: 0; }
