:root {
  color-scheme: light dark;
  --bg: #f6f5f0; --surface: #ffffff; --text: #16211b; --muted: #4c5a52; --line: #c9d0c9;
  --accent: #1d5c3a; --accent-text: #ffffff; --focus: #c26a00; --warn-bg: #fff4d6; --warn-text: #5a3b00; --ok-bg: #e3f2e7;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0d1712; --surface: #14231b; --text: #e8efe9; --muted: #a9b8ae; --line: #2f4438; --accent: #5fbf85; --accent-text: #08130d; --focus: #ffb04a; --warn-bg: #3b2d0c; --warn-text: #ffe2a6; --ok-bg: #173323; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
.skip { position: absolute; left: -9999px; top: 0; background: var(--accent); color: var(--accent-text); padding: 12px 16px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }
.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.brand { font-weight: 700; }
nav { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
nav a, button.link { color: var(--accent); text-decoration: underline; background: none; border: 0; font: inherit; padding: 10px 4px; min-height: 44px; display: inline-flex; align-items: center; cursor: pointer; }
nav a[aria-current="page"] { font-weight: 700; text-decoration: none; }
main { max-width: 760px; margin: 0 auto; padding: 16px 16px 48px; }
body.owner main { max-width: 1180px; }
main:focus { outline: none; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 8px 0 12px; }
h2 { font-size: 1.25rem; margin: 28px 0 8px; }
h3 { font-size: 1.05rem; margin: 20px 0 6px; }
p, li { max-width: 68ch; }
a { color: var(--accent); }
footer { max-width: 760px; margin: 0 auto; padding: 16px; border-top: 1px solid var(--line); }
footer a { display: inline-block; padding: 10px 0; min-height: 44px; }
.notice { background: var(--warn-bg); color: var(--warn-text); padding: 10px 12px; border-radius: 6px; }
.ok { background: var(--ok-bg); padding: 10px 12px; border-radius: 6px; }
.error { background: var(--warn-bg); color: var(--warn-text); padding: 10px 12px; border-radius: 6px; border-left: 4px solid var(--focus); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; margin: 12px 0; }
.muted { color: var(--muted); }
.inline { display: inline; margin: 0; }
button, .button { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 10px 20px; border-radius: 8px; border: 2px solid var(--accent); background: var(--accent); color: var(--accent-text); font: inherit; font-weight: 650; cursor: pointer; text-decoration: none; }
button.secondary, .button.secondary { background: transparent; color: var(--accent); }
button.danger { background: #9b1c1c; border-color: #9b1c1c; color: #fff; }
button.small { min-height: 44px; padding: 6px 12px; font-size: 0.95rem; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 16px 0; }
label { display: block; font-weight: 600; margin: 14px 0 4px; }
input[type="text"], input[type="email"], input[type="password"], select, textarea { width: 100%; max-width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); min-height: 48px; }
textarea { min-height: 120px; }
input[type="file"] { display: block; max-width: 100%; min-height: 48px; padding: 10px 0; font: inherit; }
input[type="file"]::file-selector-button { min-height: 44px; padding: 8px 14px; margin-right: 10px; border-radius: 8px; border: 2px solid var(--accent); background: transparent; color: var(--accent); font: inherit; font-weight: 650; cursor: pointer; }
textarea.json { min-height: 480px; font: 14px/1.4 ui-monospace, Menlo, monospace; }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 16px 0; padding: 8px 14px 14px; background: var(--surface); }
legend { font-weight: 650; padding: 0 6px; max-width: 100%; }
.choice { display: flex; align-items: center; gap: 10px; font-weight: 400; margin: 2px 0; min-height: 44px; }
.choice input { width: 22px; height: 22px; flex: none; margin: 0; }
.scale { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.hint { color: var(--muted); font-size: 0.95rem; margin: 2px 0 6px; }
.required { color: var(--muted); font-weight: 400; font-size: 0.9rem; }
.steps { padding-left: 1.3em; }
.steps li { margin-bottom: 10px; }
.table-wrap { overflow-x: auto; max-width: 100%; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; vertical-align: top; padding: 6px 8px; border-bottom: 1px solid var(--line); }
pre { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); padding: 10px; font-size: 13px; max-height: 70vh; }
code { overflow-wrap: anywhere; }
.link-box { display: block; overflow-wrap: anywhere; font: 15px ui-monospace, Menlo, monospace; background: var(--surface); border: 1px dashed var(--line); padding: 10px; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs a { padding: 10px 14px; min-height: 44px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; }
.tabs a[aria-current="page"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.terms { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 4px 16px; }
.terms h2 { margin-top: 12px; }

/* The tester pages wear the game's brand (prompt050, DEC-243): /static/brand.css is the game's own token sheet and   */
/* fonts, linked only on tester pages, and these rules point the portal's names at its tokens. The owner console     */
/* links neither and keeps the plain look above, except the playtest dashboard (prompt051, DEC-246): body.branded.  */
body.tester, body.branded {
  --bg: var(--background-primary); --surface: var(--surface-primary); --text: var(--text-primary); --muted: var(--text-muted);
  --line: var(--border-strong); --accent: var(--action-primary); --accent-text: var(--on-action-primary); --focus: var(--focus-ring);
  --warn-bg: var(--tint-warning); --warn-text: var(--text-primary); --ok-bg: var(--tint-success);
  font-family: var(--font-ui);
}
.tester a, .tester button.link, .branded a, .branded button.link { color: var(--action-link); }
.tester .skip, .branded .skip { color: var(--accent-text); }
.tester .bar, .branded .bar { --action-link: var(--header-accent); --focus-ring: var(--header-accent); --focus: var(--header-accent); border-bottom: 0; background: var(--header-scrim); color: var(--header-text); }
.tester .brand, .branded .brand { font-family: var(--font-display); font-size: 1.6rem; font-weight: 400; letter-spacing: .02em; line-height: 1; }
.tester .brand .amp, .branded .brand .amp { color: var(--mark-ampersand); }
.tester h1, .tester h2, .branded h1, .branded h2 { font-family: var(--font-display); font-weight: 400; letter-spacing: .01em; }
.tester h1, .branded h1 { font-size: 2.4rem; line-height: 1.05; }
.tester h2, .branded h2 { font-size: 1.6rem; line-height: 1.1; }
.tester .card, .tester fieldset, .tester .terms, .branded .card, .branded fieldset, .branded .terms { border-color: var(--border-subtle); border-radius: var(--radius-medium); }
.tester button, .tester .button, .branded button, .branded .button { border-radius: var(--radius-medium); }
.tester input[type="text"], .tester input[type="email"], .tester input[type="password"], .tester select, .tester textarea, .branded input[type="text"], .branded input[type="email"], .branded input[type="password"], .branded select, .branded textarea { background: var(--control-background); }
.tester .error, .branded .error { border-left-color: var(--state-danger); }
.tester .choice input, .branded .choice input { accent-color: var(--action-link); }
.tester footer, .branded footer { border-top-color: var(--border-subtle); }

/* The playtest dashboard (prompt051, DEC-246, DEC-248). Its chart series take the dataviz reference palette's first six */
/* slots, validated on the brand's surfaces in both themes (dark #173F33, light #FFFFFF; worst adjacent CVD ΔE 8.4 dark, */
/* 9.1 light). Some sit under 3:1 against the surface, so every chart prints its table and a legend beside it.         */
body.branded { --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #d55181; --series-6: #008300; --chart-ink: var(--text-secondary); --chart-grid: var(--border-subtle); }
@media (prefers-color-scheme: light) {
  body.branded { --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100; --series-5: #e87ba4; --series-6: #008300; }
}
.branded .lede { color: var(--text-secondary); max-width: 80ch; }
.branded h1.key { font-family: var(--font-ui); font-size: 1.4rem; font-weight: 700; letter-spacing: 0; overflow-wrap: anywhere; }
.dash-tabs { margin: 4px 0 12px; }
.crumbs ol { display: flex; flex-wrap: wrap; gap: 4px 0; list-style: none; padding: 0; margin: 4px 0 0; font-size: 0.95rem; }
.crumbs li { max-width: 100%; overflow-wrap: anywhere; }
.crumbs li + li::before { content: "›"; padding: 0 8px; color: var(--muted); }
.crumbs a { display: inline-block; padding: 10px 0; }
details.filters { background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-medium); padding: 0 14px; margin: 12px 0 16px; }
details.filters > summary { min-height: 44px; padding: 10px 0; cursor: pointer; font-weight: 600; overflow-wrap: anywhere; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; padding-bottom: 14px; }
.filter-row .field { flex: 1 1 150px; min-width: 0; }
.filter-row .field label { margin: 0 0 4px; font-size: 0.9rem; }
.filter-row input[type="date"] { width: 100%; font: inherit; min-height: 48px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--control-background); color: var(--text); }
.filter-row .actions-field { flex: 0 1 auto; display: flex; gap: 12px; align-items: center; }
.filter-row .actions-field a { display: inline-block; padding: 10px 4px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 16px; align-items: start; }
.tile { background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-medium); padding: 12px 16px 16px; min-width: 0; }
.tile.wide { grid-column: 1 / -1; }
.tile h2 { margin: 4px 0 10px; }
.tile h2 a { text-decoration: none; display: inline-block; padding: 6px 0; }
.tile h2 a::after { content: " ›"; }
.figures { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 0 0 8px; }
.figures dt { font-size: 0.9rem; color: var(--text-secondary); }
.figures dd { margin: 0; font-family: var(--font-display); font-size: 2.6rem; line-height: 1; }
.figures dd.word { font-family: var(--font-ui); font-size: 1.15rem; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 0 24px; }
caption { text-align: left; font-weight: 650; padding: 10px 0 6px; }
table.record td:last-child { width: 40%; min-width: 90px; }
.result-bar { display: block; width: 100%; height: 12px; margin-top: 5px; }
.result-bar .bar-win { fill: var(--series-1); }
.result-bar .bar-loss { fill: var(--series-2); }
.result-bar .bar-tie { fill: var(--series-4); }
.result-bar .bar-unread { fill: var(--border-subtle); }
figure.chart { margin: 8px 0 16px; min-width: 0; }
figure.chart figcaption { font-weight: 650; margin-bottom: 4px; }
.chart-canvas { width: 100%; min-height: 0; }
.readout { min-height: 1.5em; margin: 2px 0; font-size: 0.9rem; color: var(--text-secondary); }
figure.chart:not(.drawn) .chart-canvas { display: none; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; list-style: none; padding: 0; margin: 4px 0; font-size: 0.9rem; color: var(--text-secondary); }
.legend li { display: flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 14px; height: 4px; border-radius: 2px; }
.swatch.s1 { background: var(--series-1); } .swatch.s2 { background: var(--series-2); } .swatch.s3 { background: var(--series-3); }
.swatch.s4 { background: var(--series-4); } .swatch.s5 { background: var(--series-5); } .swatch.s6 { background: var(--series-6); }
figure.chart:not(.drawn) .legend { display: none; }
details > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }
dl.facts, dl.defs, dl.said { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 4px 16px; margin: 8px 0 16px; }
dl.facts > div, dl.defs > div, dl.said > div { display: contents; }
dl.facts dt, dl.defs dt, dl.said dt { font-weight: 650; color: var(--text-secondary); }
dl.facts dd, dl.defs dd, dl.said dd { margin: 0; overflow-wrap: anywhere; }
.members { padding-left: 1.3em; }
.members > li { margin-bottom: 18px; overflow-wrap: anywhere; }
.links li { margin: 4px 0; }
.links a { display: inline-block; padding: 8px 0; }
.panel-list { padding-left: 1.1em; }
.panel-list li { margin: 8px 0; }
/* A cell id has no spaces; a panel's cells not run, and its Spark cells pending, wrap on a phone (prompt052). */
.not-run li { overflow-wrap: anywhere; }
.columns { columns: 16rem; padding-left: 1.1em; }
.columns a { display: inline-block; padding: 6px 0; }
.shots { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; }
figure.shot { margin: 0; max-width: min(100%, 420px); }
figure.shot img { display: block; max-width: 100%; height: auto; border: 1px solid var(--border-subtle); border-radius: var(--radius-small); }
img.thumb { display: inline-block; width: 120px; height: auto; vertical-align: top; border: 1px solid var(--border-subtle); border-radius: var(--radius-small); }
.step-nav { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 8px 0; }
.step-nav a { display: inline-block; padding: 10px 0; }
pre.doc { white-space: pre-wrap; overflow-wrap: anywhere; max-height: none; font-size: 14px; }
.branded pre { background: var(--code-background); border-color: var(--border-subtle); white-space: pre-wrap; overflow-wrap: anywhere; }
.branded table th, .branded table td { border-bottom-color: var(--border-subtle); }
.branded .tabs a { border-color: var(--border-subtle); }
/* uPlot's own layout rules, restated here so the vendored file stays its single pinned script (DEC-248). */
.uplot, .uplot * { box-sizing: border-box; }
.uplot { width: min-content; font-family: var(--font-ui); line-height: 1.5; }
.u-wrap { position: relative; user-select: none; }
.u-over, .u-under, .u-axis { position: absolute; }
.u-under { overflow: hidden; }
.uplot canvas { display: block; position: relative; width: 100%; height: 100%; }
.u-select { position: absolute; pointer-events: none; background: var(--border-subtle); }
.u-cursor-x, .u-cursor-y { position: absolute; left: 0; top: 0; pointer-events: none; will-change: transform; }
.u-hz .u-cursor-x, .u-vt .u-cursor-y { height: 100%; border-right: 1px dashed var(--chart-ink); }
.u-hz .u-cursor-y, .u-vt .u-cursor-x { width: 100%; border-bottom: 1px dashed var(--chart-ink); }
.u-cursor-pt { position: absolute; top: 0; left: 0; border-radius: 50%; border: 0 solid; pointer-events: none; will-change: transform; background-clip: padding-box !important; }
.u-axis.u-off, .u-select.u-off, .u-cursor-x.u-off, .u-cursor-y.u-off, .u-cursor-pt.u-off { display: none; }
@media (max-width: 520px) {
  dl.facts, dl.defs, dl.said { grid-template-columns: 1fr; gap: 0; }
  dl.facts dd, dl.defs dd, dl.said dd { margin-bottom: 8px; }
}
