/* The Buy Menu look (docs/ui.md). The only place colors, fonts and metrics are defined; components
   use the tokens, never literal values. */

/* ==== Fonts ==== */

@font-face { font-family: "Menu UI"; src: url("/ui/valve/fonts/tahoma.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Menu UI"; src: url("/ui/fonts/tahomabd.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Menu Digits"; src: url("/ui/fonts/FiraSansCondensed-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

/* ==== Tokens ==== */

:root {
  --hud: #FFB21A;
  --hud-dim: #C98A12;
  --fg: #F2E6C8;
  --muted: #B9A988;
  --danger: #FF5A3C;
  --on-hud: #120D02;
  --glass: #000000A6;
  --glass-solid: #0A0905F2;
  --edge: #FFB21A38;
  --sel: #FFB21A26;
  --keycap: #FFFFFF40;
  --hud-wash: #FFB21A14; /* secondary button fill, amber 8% */
  --glow: #FFB21A54; /* digit glow, amber 33% */
  --backdrop-base: #1A1714; /* the backdrop art's average, dimmed as the art is: under it until it shows */

  --font-ui: "Menu UI", Tahoma, Verdana, sans-serif;
  --font-digits: "Menu Digits", "Fira Sans Condensed", "Arial Narrow", sans-serif;
  --font-mono: ui-monospace, Menlo, Consolas, monospace;

  /* Type roles at the 1280x720 reference; text never goes under 12 px. */
  --fs-label: max(12px, 0.75rem);
  --fs-key: max(12px, 0.6875rem);
  --fs-small: max(12px, 0.875rem);
  --fs-body: max(13px, 1.0625rem);
  --fs-item: max(15px, 1.375rem);
  --fs-title: max(17px, 1.625rem);
  --fs-display: max(26px, 3rem);
  --fs-digits: max(34px, 3.75rem);

  /* Spacing steps. */
  --s1: 0.25rem; --s2: 0.5rem; --s3: 0.75rem; --s4: 1rem; --s5: 1.25rem; --s6: 1.75rem; --s7: 2.5rem; --s8: 4rem;
  /* Screen margins: 80 px and 56 px at the reference, never wider than the screen allows. */
  --margin-x: max(16px, min(5rem, 6.25vw));
  --margin-y: max(16px, min(3.5rem, 7.8vh));
  --pad-x: max(16px, 1.75rem);

  --radius-panel: 4px;
  --radius-key: 3px;
  --fade: 120ms;
  --bar: 200ms;
  --art-fade: 400ms;
}

/* One rem is 16 px at 1280x720 and scales with the viewport. */
html { font-size: clamp(12px, min(1.25vw, 2.22vh), 24px); }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; }
body { font-family: var(--font-ui); color: var(--fg); -webkit-font-smoothing: antialiased; }
#canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; outline: none; }
button, input { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ==== Backdrop: the splash, dimmed and blurred, under a vignette ==== */

/* The art fades in over --backdrop-base once decoded, once per page: index.html and Backdrop put
   `art-ready` on <html>, and later backdrops start shown. */
.menu-root { position: fixed; inset: 0; z-index: 1; }
.backdrop { position: fixed; inset: 0; overflow: auto; background: var(--backdrop-base); isolation: isolate; }
.backdrop-art { position: fixed; inset: -12px; z-index: -2; width: calc(100% + 24px); height: calc(100% + 24px);
  object-fit: cover; filter: brightness(.55) blur(3px); opacity: 0; transition: opacity var(--art-fade) ease-out; pointer-events: none; }
.art-ready .backdrop-art { opacity: 1; }
.backdrop::after { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 35%, #000000AB 100%); }

/* ==== Panel ==== */

.panel { background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--edge); border-radius: var(--radius-panel); animation: fade-in var(--fade) ease-out; }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .panel { background: var(--glass-solid); }
}
@keyframes fade-in { from { opacity: 0; } }
.panel-title { margin: 0; padding: var(--s5) var(--pad-x) var(--s3); border-bottom: 1px solid var(--edge);
  font-size: var(--fs-label); font-weight: 700; text-transform: uppercase; letter-spacing: .18em; color: var(--hud); }
.panel-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--s3);
  padding: var(--s4) var(--pad-x); border-top: 1px solid var(--edge); }
.panel-footer .status { margin-right: auto; font-size: var(--fs-small); color: var(--muted); }
/* Create lobby's footer keeps one row on a desktop: the status shrinks and ellipsizes, the buttons stay whole. */
.create-settings .panel-footer { flex-wrap: nowrap; }
.create-settings .panel-footer .status { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.create-settings .panel-footer .btn { flex: none; white-space: nowrap; }

/* ==== Type ==== */

.wordmark { margin: 0; font-size: var(--fs-display); font-weight: 700; line-height: 1; text-transform: uppercase;
  color: var(--fg); text-shadow: 0 2px 8px #000; letter-spacing: .01em; }
.wordmark .accent { color: var(--hud); }
.digits { font-family: var(--font-digits); font-weight: 700; font-size: var(--fs-digits); line-height: 1;
  color: var(--hud); text-shadow: 0 0 18px var(--glow); font-variant-numeric: tabular-nums; }
.label { margin: 0; font-size: var(--fs-label); font-weight: 700; text-transform: uppercase; letter-spacing: .18em; color: var(--hud); }
.display { margin: 0; font-size: var(--fs-display); font-weight: 700; line-height: 1.1; color: var(--fg); text-shadow: 0 2px 8px #000; overflow-wrap: anywhere; }
.notice { margin: 0; font-size: var(--fs-small); color: var(--muted); }
.notice.danger { color: var(--danger); }

/* ==== Key caps and hints ==== */

.keycap { display: inline-block; min-width: 1.1em; padding: .05em .45em; border: 1px solid var(--keycap); border-radius: var(--radius-key);
  font-family: var(--font-ui); font-size: var(--fs-key); font-weight: 700; line-height: 1.4; text-align: center; color: var(--fg); }
.key-hints { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); margin: 0; padding: 0; list-style: none;
  font-size: var(--fs-small); color: var(--muted); }
.key-hints li { display: flex; align-items: center; gap: var(--s2); }

/* ==== Buttons ==== */

.btn { display: inline-flex; align-items: center; gap: var(--s2); min-height: 2.25rem; padding: var(--s2) var(--s4);
  border: 1px solid var(--hud-dim); border-radius: 0; background: var(--hud-wash); color: var(--hud);
  font-size: var(--fs-small); font-weight: 700; cursor: pointer; }
.btn .keycap { border-color: currentColor; color: inherit; }
.btn.primary { background: var(--hud); border-color: var(--hud); color: var(--on-hud); }
.btn:hover:not(:disabled), .btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.btn:active:not(:disabled) { background: var(--hud-dim); border-color: var(--hud-dim); color: var(--on-hud); }
.btn:disabled { color: var(--muted); border-color: var(--edge); background: none; opacity: .5; cursor: default; }
.btn[aria-busy="true"] { opacity: 1; color: var(--hud); border-color: var(--hud-dim); }
.key-button { padding: 0; border: 0; background: none; cursor: pointer; }
.key-button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ==== Menu list ==== */

.menu-list ol { margin: 0; padding: var(--s3) 0 var(--s4); list-style: none; }
.menu-item { display: flex; align-items: baseline; gap: var(--s4); width: 100%; padding: var(--s2) var(--pad-x);
  border: 0; background: none; text-align: left; cursor: pointer; outline: none; }
.menu-item .num { min-width: .8em; font-size: var(--fs-item); font-weight: 700; color: var(--hud); }
.menu-item .label { flex: 1; font-size: var(--fs-item); font-weight: 400; color: var(--fg); text-transform: none; letter-spacing: 0; }
.menu-item .detail { font-size: var(--fs-small); color: var(--muted); }
.menu-item:focus { background: var(--sel); box-shadow: inset 3px 0 0 var(--hud); }
.menu-item:focus .label { color: var(--hud); }
.menu-item:active:not(:disabled) { background: var(--hud-dim); }
.menu-item:active:not(:disabled) .label, .menu-item:active:not(:disabled) .num { color: var(--on-hud); }
.menu-item:disabled { cursor: default; opacity: .5; }
.menu-item:disabled .num, .menu-item:disabled .label { color: var(--muted); }

/* ==== Fields ==== */

.field { display: inline-flex; flex-direction: column; gap: var(--s1); }
.field-label { font-size: var(--fs-label); font-weight: 700; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
.text-field { padding: var(--s2) var(--s3); border: 1px solid var(--edge); border-radius: 0; background: #00000066;
  font-size: var(--fs-body); color: var(--fg); outline: none; }
.text-field:focus { border-color: var(--hud); }
.text-field[aria-invalid="true"] { border-color: var(--danger); }
.copy-field { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s4); padding: var(--s3) var(--s4); border: 1px dashed var(--edge); }
.copy-field .link { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: var(--fs-body); color: var(--fg); overflow-wrap: anywhere; }
.tag { display: inline-block; padding: 0 .4em; border: 1px solid var(--edge); font-size: max(11px, .6875rem); font-weight: 700;
  line-height: 1.5; text-transform: uppercase; letter-spacing: .1em; color: var(--hud); vertical-align: middle; }

/* ==== Name badge ==== */

/* One fixed box in the screen's corner: editing swaps the text for a field of the same height, and a
   refusal hangs under the box, so nothing around it ever moves. */
.corner { position: absolute; top: var(--margin-y); right: var(--margin-x); z-index: 2; display: flex; flex-direction: column;
  align-items: flex-end; gap: var(--s1); width: 22rem; max-width: calc(100% - 2 * var(--margin-x)); }
.corner > .notice { position: absolute; top: 3.5rem; right: 0; margin-top: var(--s1); text-align: right; }
.name-badge { position: relative; box-sizing: border-box; display: flex; align-items: center; gap: var(--s3); width: 100%; height: 3.5rem; padding: 0 var(--s5); }
.name-badge .caption { flex: none; font-size: var(--fs-small); color: var(--fg); }
.name-badge .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-item); font-weight: 700; color: var(--hud); }
.name-badge .name-edit { flex: 1; min-width: 0; display: flex; }
.name-badge .name-edit .field { flex: 1; min-width: 0; }
.name-badge .text-field { box-sizing: border-box; width: 100%; height: 2.25rem; padding: 0 var(--s2); font-size: var(--fs-item); font-weight: 700; line-height: 1; }
.name-badge .name-error { position: absolute; top: 100%; left: 0; right: 0; margin: var(--s1) 0 0; }

/* ==== Numbers ==== */

.hud-stat { display: inline-flex; flex-direction: column; align-items: flex-end; gap: var(--s2); }
.hud-stat .caption { font-size: var(--fs-label); font-weight: 700; text-transform: uppercase; letter-spacing: .18em; color: var(--muted); }
.bar { height: .875rem; padding: 2px; border: 1px solid var(--hud-dim); box-sizing: border-box; }
.bar .fill { height: 100%; max-width: 100%; transition: width var(--bar) linear;
  background: repeating-linear-gradient(90deg, var(--hud) 0 .625rem, transparent .625rem .8125rem); }
.bar.sub { height: .5rem; border-color: var(--keycap); }
.bar.sub .fill { background: repeating-linear-gradient(90deg, var(--muted) 0 .375rem, transparent .375rem .5625rem); }
.score-table { width: 100%; border-collapse: collapse; font-size: var(--fs-body); }
.score-table thead th { padding: var(--s3) var(--pad-x) var(--s2); font-size: var(--fs-label); font-weight: 700;
  text-transform: uppercase; letter-spacing: .14em; color: var(--muted); text-align: left; }
.score-table td, .score-table tbody th { padding: 7px var(--pad-x); font-weight: 400; text-align: left; }
.score-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.score-table tr.own { background: var(--sel); color: var(--hud); }
.score-table tr.bot { color: var(--muted); }

/* ==== Dialog ==== */

.dim { position: fixed; inset: 0; background: #00000080; }
.center { position: fixed; inset: 0; display: grid; place-items: center; padding: var(--margin-y) var(--margin-x); overflow: auto; }
.dialog { width: min(36rem, 100%); box-sizing: border-box; }
.dialog-title { margin: 0; padding: var(--s5) var(--pad-x) var(--s2); font-size: var(--fs-title); font-weight: 700; color: var(--hud); }
.dialog-title.danger { color: var(--danger); }
.dialog-body { margin: 0; padding: var(--s2) var(--pad-x) var(--s5); font-size: var(--fs-body); line-height: 1.45; white-space: pre-line; }
.dialog .notice { padding: 0 var(--pad-x) var(--s5); }
pre.error { margin: 0 var(--pad-x) var(--s4); padding: var(--s3); max-height: 40vh; overflow: auto; border: 1px solid var(--edge);
  background: #00000066; font-family: var(--font-mono); font-size: var(--fs-small); color: var(--fg); white-space: pre-wrap; overflow-wrap: anywhere; }

/* ==== Loading ==== */

.loading { display: flex; flex-direction: column; align-items: center; gap: var(--s5); width: min(47.5rem, 100%); }
.loading-head { display: flex; flex-direction: column; align-items: center; gap: var(--s3); text-align: center; }
.loading .notices { align-self: stretch; display: flex; flex-direction: column; gap: var(--s1); }
.loading-panel { align-self: stretch; display: flex; flex-direction: column; gap: var(--s3); padding: var(--s6) var(--pad-x) var(--s5); }
.loading-panel .step-row { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); }
.loading-panel .step { margin: 0; font-size: var(--fs-item); font-weight: 400; color: var(--fg); }
.loading-panel .detail-row, .loading-panel .foot-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
  gap: var(--s2) var(--s4); font-size: var(--fs-small); color: var(--muted); font-variant-numeric: tabular-nums; }
.loading-panel .detail-row { margin-bottom: var(--s2); }

/* ==== Download card ==== */

.download-card { width: min(23rem, 100%); box-sizing: border-box; }
.download-card .card-body { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s4) var(--pad-x) var(--s5); }
.download-card .step-row { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s3); }
.download-card .step { margin: 0; font-size: var(--fs-body); color: var(--fg); }
.download-card .digits { font-size: var(--fs-title); text-shadow: none; }
.download-card .detail-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s1) var(--s3);
  font-size: var(--fs-small); color: var(--muted); font-variant-numeric: tabular-nums; }
.download-card .source, .download-card .hint { margin: 0; font-size: var(--fs-small); color: var(--muted); font-variant-numeric: tabular-nums; }
.download-card .hint { color: var(--fg); }
.download-card[data-state="ready"] .step { color: var(--hud); }
.lobby-room .download-card { width: 100%; margin-top: var(--s2); }

/* ==== Screens ==== */

.screen { position: relative; box-sizing: border-box; min-height: 100%; padding: var(--margin-y) var(--margin-x); }
.screen.centered { display: grid; place-items: center; }
.main-menu { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto 1fr auto;
  grid-template-areas: "tl ." "ml ." "bl br"; gap: var(--s6) var(--s7); }
.main-menu .top-left { grid-area: tl; }
.main-menu .middle-left { grid-area: ml; align-self: center; width: min(26.875rem, 100%); }
.main-menu .bottom-left { grid-area: bl; align-self: end; }
.main-menu .bottom-right { grid-area: br; align-self: end; display: flex; flex-direction: column; align-items: flex-end; gap: var(--s5); }
.main-menu .hud-stats { display: flex; gap: var(--s7); }
.loading-screen { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.lobby-screen { display: grid; grid-template-rows: auto 1fr; gap: var(--s6); }
.lobby-room { width: min(56.25rem, 100%); align-self: center; justify-self: center; }
.room-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s2) var(--s5);
  padding: var(--s5) var(--pad-x) var(--s4); border-bottom: 1px solid var(--edge); }
.room-head .title { margin: 0; font-size: var(--fs-title); font-weight: 700; color: var(--hud); overflow-wrap: anywhere; }
.room-head .facts { margin: 0; font-size: var(--fs-small); color: var(--muted); }
.room-body { display: flex; flex-direction: column; gap: var(--s3); padding: var(--s5) var(--pad-x); }
.room-body .hint { margin: 0; font-size: var(--fs-small); color: var(--muted); }
.lobby-setup { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s4) var(--pad-x) var(--s5);
  border: 1px solid var(--edge); background: var(--sel); }
.lobby-setup .setup-title { margin: 0; font-size: var(--fs-item); font-weight: 700; color: var(--hud); }
.lobby-setup .setup-title.danger { color: var(--danger); }
.lobby-setup .step { margin: 0; font-size: var(--fs-body); color: var(--fg); }
.lobby-setup .hint { margin: 0; }
.lobby-setup .notice { overflow-wrap: anywhere; }
.setup-actions { display: flex; justify-content: flex-end; }
.room-password { display: flex; flex-direction: column; gap: var(--s2); }
.room-password .text-field { width: min(16rem, 100%); }
/* Settings: label, control, hint per row (kit/settings.rs). */
.settings { width: min(40rem, 100%); }
.settings-rows { display: flex; flex-direction: column; padding: var(--s2) 0 var(--s4); }
.settings-section { margin: var(--s4) var(--pad-x) var(--s1); font-size: var(--fs-label); font-weight: 700; text-transform: uppercase;
  letter-spacing: .18em; color: var(--muted); }
.setting-row { display: grid; grid-template-columns: minmax(8rem, 1fr) minmax(0, 15rem) minmax(0, 7rem); align-items: center; gap: var(--s4);
  padding: var(--s1) var(--pad-x); font-size: var(--fs-body); }
.setting-row:focus-within { background: var(--sel); box-shadow: inset 3px 0 0 var(--hud); }
.setting-row:focus-within .setting-label { color: var(--hud); }
.setting-hint { font-size: var(--fs-small); color: var(--muted); }
.setting-control { display: flex; }
.control { display: inline-flex; align-items: center; gap: var(--s3); min-height: 2.25rem; outline: none; cursor: pointer; }
.toggle { padding: 0; border: 0; background: none; }
.toggle .box { width: 18px; height: 18px; box-sizing: border-box; border: 1px solid var(--hud-dim); }
.toggle[aria-checked="true"] .box { background: var(--hud); border-color: var(--hud); }
.slider { flex: 1; touch-action: none; }
.slider .bar { display: block; flex: 1; cursor: pointer; }
.slider .fill { display: block; }
.slider .value, .select .value { min-width: 3.5em; font-variant-numeric: tabular-nums; text-align: right; }
.select .value { min-width: 6em; text-align: center; }
.setting-row:focus-within .value { color: var(--hud); }
.setting-row.disabled { opacity: .5; }
.setting-row.disabled .control, .setting-row.disabled .key-button { cursor: default; }
.number-field { display: inline-flex; align-items: center; gap: var(--s2); }
.number-field .text-field { width: 7.5rem; text-align: center; font-variant-numeric: tabular-nums; }
.number-field .text-field:disabled { cursor: default; }
.combo { flex: 1; min-width: 0; }
.browser-screen { display: grid; grid-template-rows: 1fr auto; gap: var(--s5); }
.browser { width: min(56.25rem, 100%); align-self: center; justify-self: center; }
.browser-search { display: flex; flex-wrap: wrap; gap: var(--s3) var(--s5); padding: var(--s4) var(--pad-x); border-bottom: 1px solid var(--edge); }
.browser-search .field { flex: 1 1 12rem; }
.browser-list { max-height: 50vh; overflow: auto; }
.browser-empty { margin: 0; padding: var(--s6) var(--pad-x); font-size: var(--fs-body); color: var(--muted); }
.browser-table tbody th { padding: 0; }
.row-open { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s1) var(--s2); width: 100%; padding: 7px var(--pad-x);
  border: 0; background: none; text-align: left; cursor: pointer; outline: none; }
.row-open .row-name { font-weight: 700; }
.row-open .row-players { flex-basis: 100%; font-size: var(--fs-small); color: var(--muted); overflow-wrap: anywhere; }
.browser-row:focus-within { background: var(--sel); box-shadow: inset 3px 0 0 var(--hud); }
.browser-row:focus-within .row-name { color: var(--hud); }
.browser-row:active { background: var(--hud-dim); }
.browser-row td { vertical-align: top; }
.room-members { border-top: 1px solid var(--edge); padding-bottom: var(--s3); }
.dialog-invite { padding: 0 var(--pad-x) var(--s5); }
/* Create lobby (create/mod.rs): the game modes left, the settings right, one footer. */
.create-screen { display: grid; grid-template-columns: minmax(15rem, 22rem) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "head head" "side main"; gap: var(--s5) var(--s6); height: 100%; }
.create-head { grid-area: head; display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s2) var(--s5); max-width: calc(100% - 24rem); }
.create-head .title { margin: 0; font-size: var(--fs-display); font-weight: 700; line-height: 1; color: var(--fg); text-shadow: 0 2px 8px #000; }
.create-head .facts { margin: 0; font-size: var(--fs-small); color: var(--muted); text-shadow: 0 1px 4px #000; }
.create-side { grid-area: side; display: flex; flex-direction: column; gap: var(--s4); min-height: 0; overflow: auto; }
.create-settings { grid-area: main; display: flex; flex-direction: column; min-height: 0; }
.create-body { flex: 1; min-height: 0; overflow: auto; padding: var(--s2) 0 var(--s4); }
.create-notices { display: flex; flex-direction: column; gap: var(--s1); padding: 0 var(--pad-x); }
.create-modes .menu-item[aria-pressed="true"] { background: var(--sel); box-shadow: inset 3px 0 0 var(--hud); }
.create-modes .menu-item[aria-pressed="true"] .label { color: var(--hud); }
.mode-row { display: flex; align-items: center; gap: var(--s2); padding-right: var(--pad-x); }
.mode-row .menu-item { flex: 1; min-width: 0; }
.mode-row .label { overflow-wrap: anywhere; }
.mode-empty { padding: var(--s2) var(--pad-x); font-size: var(--fs-small); color: var(--muted); }
.btn.small { min-height: 0; padding: var(--s1) var(--s2); }
.setting-control .text-field { flex: 1; min-width: 0; }
.dialog-form { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s2) var(--pad-x) var(--s4); }
.dialog-form .field { display: flex; }
.dialog-form .notice { padding: 0; }
select.text-field { appearance: none; }
select.text-field option { background: var(--backdrop-base); color: var(--fg); }

/* Phones and narrow windows: one column. */
@media (max-width: 40rem), (max-width: 640px) {
  .main-menu { grid-template-columns: minmax(0, 1fr); grid-template-areas: "tl" "ml" "br" "bl"; align-content: start; }
  .main-menu .bottom-right { justify-self: start; }
  .corner { position: static; width: auto; max-width: none; padding: var(--margin-y) var(--margin-x) 0; align-items: stretch; }
  .corner > .notice { position: static; margin-top: 0; text-align: left; }
  .name-badge .name-error { position: static; }
  .corner + .screen { padding-top: var(--s4); }
  .main-menu .bottom-right { align-items: stretch; }
  .main-menu .middle-left { width: 100%; }
  .create-screen { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; grid-template-areas: "head" "side" "main"; height: auto; }
  .create-head { max-width: 100%; }
  .create-side { overflow: visible; }
  .create-body { overflow: visible; }
  .create-settings .panel-footer { flex-wrap: wrap; }
  .create-settings .panel-footer .status { flex: 1 1 100%; white-space: normal; }
  .browser-table .col-map { display: none; }
  .setting-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
  .setting-hint { grid-column: 2; }
}

/* ==== First paint (index.html, before the wasm runs) ==== */

.first-paint { display: grid; grid-template-rows: auto 1fr; }
.first-paint .label { align-self: end; justify-self: center; }

/* ==== The ?ui-kit review page ==== */

.review { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s4); padding: var(--margin-y) var(--margin-x); }
.review-head { margin: var(--s5) 0 0; font-size: var(--fs-label); font-weight: 700; text-transform: uppercase; letter-spacing: .18em; color: var(--muted); }
.review-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s4); }
.review-type { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s5) var(--pad-x); }
.review-type p { margin: 0; }
.type-label { font-size: var(--fs-label); font-weight: 700; text-transform: uppercase; letter-spacing: .18em; color: var(--hud); }
.type-small { font-size: var(--fs-small); color: var(--muted); }
.type-body { font-size: var(--fs-body); }
.type-item { font-size: var(--fs-item); }
.type-title { font-size: var(--fs-title); font-weight: 700; color: var(--hud); }
.type-display { font-size: var(--fs-display); font-weight: 700; text-shadow: 0 2px 8px #000; }
.type-digits { font-family: var(--font-digits); font-weight: 700; font-size: var(--fs-digits); color: var(--hud); text-shadow: 0 0 18px var(--glow); font-variant-numeric: tabular-nums; }
.type-mono { font-family: var(--font-mono); font-size: var(--fs-body); }
.swatch { display: flex; flex-direction: column; gap: var(--s1); font-size: var(--fs-small); color: var(--muted); }
.swatch .chip { width: 4.5rem; height: 2.5rem; border: 1px solid var(--keycap); }
.review-menu { width: min(26.875rem, 100%); }
.review-bar { width: min(24rem, 60vw); }
.review-cards { align-items: flex-start; }
.review-bars { display: flex; flex-direction: column; gap: var(--s3); width: min(24rem, 100%); }
.review-table, .review .copy-field, .review-settings { width: min(56.25rem, 100%); box-sizing: border-box; }
.review-stage { position: relative; width: min(56.25rem, 100%); height: 18rem; overflow: hidden; border: 1px dashed var(--edge); }
.review-stage.tall { height: auto; display: flex; justify-content: center; padding: var(--s5); box-sizing: border-box; }
.review-stage .dim, .review-stage .center { position: absolute; }
