/* ONE KEY ONE USE. The page is one flight console screen.
   Palette and grammar read off his reference (art/ref/console.jpg) and his avatar (art/ref/avatar.jpg). */

@font-face {
  font-family: "FlexiVGA";
  src: url("/fonts/FlexiIBMVGATrue437.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --black: #000000;
  --ink: #f59201;          /* amber: lines, labels, borders */
  --ink-dim: #9c5c00;      /* amber at rest */
  --ink-deep: #4a2c00;     /* hairlines inside a module */
  --hot: #ffe606;          /* his yellow: live values, lit keys */
  --olive: #6b5200;        /* key at rest */
  --red: #d2301d;
  --white: #ffffff;

  --pad: 22px;             /* module body inset */
  --pad-title: 26px;
  --gap: 14px;
  --bezel: 26px;
  --strip: 96px;           /* height of the mode strip */

  --f-body: 21px;
  --f-lab: 22px;
  --f-small: 19px;
  --f-title: 24px;
  --f-val: 34px;
}

* { box-sizing: border-box; }

html {
  background: var(--black);
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  background: var(--black);
  color: var(--ink);
  font-family: "FlexiVGA", "Courier New", monospace;
  font-size: var(--f-body);
  line-height: 1.35;
  letter-spacing: 0.05em;
  font-synthesis: none;
  -webkit-font-smoothing: none;
}

h1, h2, p, dl, dd, dt, ol, li, figure { margin: 0; }
ol { padding: 0; list-style: none; }

a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 3px solid var(--hot);
  outline-offset: 2px;
}

.vis-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden; clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- the console body ---------- */

.bezel {
  min-height: 100vh;
  border: var(--bezel) solid transparent;
  border-image: url("/img/bezel.png") 32 fill / var(--bezel) / 0 stretch;
  background: var(--black);
}

.console {
  max-width: 1880px;
  margin: 0 auto;
  display: grid;
  gap: var(--gap);
  /* the mode strip is sticky and keeps its own place at the end of the grid: no extra room under it */
  padding-bottom: 0;
}

/* ---------- module plate (every panel is a generated frame, never a CSS box) ---------- */

.module {
  border: 18px solid transparent;
  border-image: url("/img/module.png") 40 fill / 18px / 0 stretch;
  padding: var(--pad);
  min-width: 0;
}

.module-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: calc(var(--pad) * -1 + 6px) calc(var(--pad) * -1) var(--pad);
  padding: 14px var(--pad-title);
  position: relative;
  font-size: var(--f-title);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
}

.module-title::after, .ident-hop::before, .trow::after, .bay-note::before,
.note::before, .wkey-top::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--ink-deep);
}
.module-title::after { bottom: 0; }
.module-title .dim { color: var(--ink-dim); letter-spacing: 0.1em; }
.mt-l { display: inline-flex; align-items: center; gap: 14px; }
.dim { color: var(--ink-dim); }
.lab {
  font-size: var(--f-lab);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
}

/* ---------- top band ---------- */

.band {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.75fr) minmax(0, 1fr) minmax(0, 2.6fr);
  gap: var(--gap);
  align-items: stretch;
}

.ident {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  gap: 6px 18px;
}

.ident-mark { grid-row: 1 / span 2; }
.ident-mark img { display: block; width: 72px; height: 72px; image-rendering: pixelated; }

.ident-name {
  font-size: 34px;
  text-wrap: balance;
  line-height: 1.05;
  color: var(--hot);
  letter-spacing: 0.04em;
}

.ident-ticker { font-size: var(--f-lab); color: var(--ink); letter-spacing: 0.18em; }

.ident-hop {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  gap: 14px;
  position: relative;
  padding-top: 14px;
  flex-wrap: wrap;
}

.ident-hop::before { top: 0; }
.ident-hop .lab { font-size: var(--f-small); }
.ident-hop .val { font-size: 32px; color: var(--hot); letter-spacing: 0.08em; }

.countdown {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 4px;
}

.count {
  font-size: clamp(54px, 6.2vw, 116px);
  line-height: 1;
  color: var(--hot);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.countdown .sub, .held .sub {
  font-size: var(--f-small);
  color: var(--ink-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.held {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 4px;
}

.held-val {
  font-size: clamp(34px, 3.4vw, 56px);
  line-height: 1.05;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* the one filled warning plate of the reference, carrying the project's own line */
.alarm {
  border: 13px solid transparent;
  border-image: url("/img/alarm.png") 12 fill / 13px / 0 stretch;
  background: var(--hot);
  padding: 26px 34px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  color: var(--black);
}

.alarm-line {
  font-size: clamp(22px, 1.6vw, 30px);
  line-height: 1.22;
  color: var(--black);
  letter-spacing: 0.04em;
}

.alarm-sub {
  font-size: var(--f-small);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #3a2a00;
}

.alarm[data-late="true"] { filter: saturate(1.35) brightness(1.08); }

/* ---------- trail ribbon ---------- */

.ribbon { padding-bottom: 14px; }

.ribbon-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
}

.ribbon-canvas {
  display: block;
  width: 100%;
  height: 84px;
  image-rendering: pixelated;
}

/* ---------- address bay ---------- */

.bay-body { display: grid; gap: 12px; }

.bay-row {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
}

.bay-lab {
  font-size: var(--f-lab);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
}

.bay-lab b { color: var(--hot); font-weight: 400; }

.slot {
  border: 9px 12px solid transparent;
  border-image: url("/img/slot.png") 6 4 fill / 9px 12px / 0 stretch;
  padding: 14px 22px;
  min-height: 56px;
  display: flex;
  align-items: center;
  font-size: 22px;
  letter-spacing: 0.06em;
  color: var(--hot);
  overflow-wrap: anywhere;
  min-width: 0;
  user-select: all;
}

.slot[data-empty="true"] {
  color: var(--ink-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: var(--f-lab);
  user-select: none;
}

.bay-keys { display: flex; gap: 10px; flex-wrap: wrap; }

.bay-note {
  position: relative;
  font-size: var(--f-small);
  color: var(--ink-dim);
  padding-top: 14px;
}
.bay-note::before { top: 0; }

/* ---------- keys (every button is the generated key plate) ---------- */

.key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 26px;
  border: 11px solid transparent;
  border-image: url("/img/key-rest.png") 26 fill / 11px / 0 stretch;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: var(--f-lab);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: filter 90ms linear, transform 90ms linear;
}

.key-wide { padding: 0 30px; }
.key-mark { padding: 0 18px; }
.key-mark img { display: block; width: 26px; height: 26px; }

.key:hover { filter: brightness(1.35); }
.key:active { transform: translateY(2px); }

.key[disabled], .key[aria-disabled="true"] {
  color: #85541f;
  cursor: not-allowed;
  filter: none;
}
.key[disabled] img, .key[aria-disabled="true"] img { opacity: 0.5; filter: saturate(0) brightness(0.8); }

.key[data-lit="true"] {
  border-image-source: url("/img/key-lit.png");
  color: var(--black);
}

/* ---------- lamps ---------- */

.lamps {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--gap);
}

.lampcell {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 66px;
  min-width: 0;
  padding: 10px 26px;
  line-height: 1.15;
  border: 11px solid transparent;
  border-image: url("/img/key-rest.png") 26 fill / 11px / 0 stretch;
  font-size: var(--f-small);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.lampcell:has(.lamp[data-on="true"]) { color: var(--ink); }

.lamp {
  flex: none;
  width: 30px;
  height: 30px;
  background-image: url("/img/lamp-off.png");
  background-size: 100% 100%;
  image-rendering: pixelated;
}

.lamp[data-on="true"] { background-image: url("/img/lamp-on.png"); }

/* ---------- main area ---------- */

.mode {
  display: grid;
  grid-template-columns: minmax(0, 53fr) minmax(0, 47fr);
  gap: var(--gap);
  align-items: stretch;
}

.mode[hidden] { display: none; }

.wide { grid-column: 1 / -1; }

/* the one big filled panel of the reference */
/* the left column of the console: the big filled panel, with the trail under it */
.display { display: flex; flex-direction: column; }
#mode-console { grid-template-areas: "display rail" "ribbon rail"; grid-template-rows: 1fr auto; }
#mode-console .display { grid-area: display; }
#mode-console .ribbon { grid-area: ribbon; }
#mode-console .rail { grid-area: rail; }

.display-face {
  position: relative;
  flex: 1;
  border: 11px solid transparent;
  border-image: url("/img/display.png") 8 fill / 11px / 0 stretch;
  background: var(--hot);
  min-height: 460px;
  padding: 10px;
}

.plot-canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 436px;
  image-rendering: pixelated;
}

.display-empty {
  position: absolute;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  color: #2a1f00;
  font-size: var(--f-small);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
}

.rail { display: grid; gap: var(--gap); align-content: start; }

/* digit cells */
.cells { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.cell {
  width: 108px;
  height: 104px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 8px solid transparent;
  border-image: url("/img/cell.png") 6 fill / 8px / 0 stretch;
  font-size: 44px;
  line-height: 1;
  color: var(--hot);
  font-variant-numeric: tabular-nums;
}

.cell-sep {
  width: 22px;
  text-align: center;
  font-size: 44px;
  color: var(--ink);
}

.readout-sub {
  margin-top: 18px;
  font-size: var(--f-small);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

/* value table */
.table { display: grid; }

.trow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 18px;
  position: relative;
  padding: 11px 0;
}

.trow::after { bottom: 0; }
.trow:last-child::after { display: none; }

.trow dt {
  font-size: var(--f-small);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.trow dd {
  font-size: 24px;
  color: var(--hot);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

/* the split */
.split-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }

.split-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 14px 12px;
  border: 11px solid transparent;
  border-image: url("/img/key-rest.png") 26 fill / 11px / 0 stretch;
}

.split-num { font-size: 52px; line-height: 1; color: var(--hot); }
.split-lab {
  font-size: var(--f-small);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
}

/* ---------- tables (trail, payouts) ---------- */

.tablewrap { width: 100%; }

.grid {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--f-small);
  font-variant-numeric: tabular-nums;
}

.grid th {
  text-align: left;
  padding: 14px 18px;
  font-weight: 400;
  font-size: var(--f-small);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--black);
  background: var(--ink);
}

.grid td {
  padding: 15px 18px;
  border-bottom: 1px solid var(--ink-deep);
  color: var(--ink);
  overflow-wrap: anywhere;
}

.grid tbody tr:nth-child(even) td { background: #140c00; }
.grid td.hot { color: var(--hot); }
.grid .s { display: none; }
.grid tr.empty td { color: var(--ink-dim); text-transform: uppercase; letter-spacing: 0.12em; }

.note {
  position: relative;
  margin-top: 22px;
  padding-top: 20px;
  font-size: var(--f-small);
  color: var(--ink-dim);
}
.note::before { top: 0; }

.note b { color: var(--ink); font-weight: 400; }

/* ---------- wall ---------- */

.verify {
  margin-bottom: var(--gap);
  padding: 22px var(--pad);
  border: 16px solid transparent;
  border-image: url("/img/module.png") 40 fill / 16px / 0 stretch;
}

.verify-head { margin-bottom: 14px; }

.verify-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
}

.field {
  min-height: 58px;
  padding: 12px 22px;
  border: 9px 12px solid transparent;
  border-image: url("/img/slot.png") 6 4 fill / 9px 12px / 0 stretch;
  background: transparent;
  color: var(--hot);
  font: inherit;
  font-size: var(--f-lab);
  letter-spacing: 0.05em;
  min-width: 0;
}

.field::placeholder { color: var(--ink-deep); text-transform: uppercase; letter-spacing: 0.1em; }

.verify-out {
  margin-top: 16px;
  font-size: var(--f-small);
  color: var(--ink-dim);
  min-height: 52px;
  overflow-wrap: anywhere;
}

.verify-out[data-state="good"] { color: var(--hot); }
.verify-out[data-state="bad"] { color: var(--red); }

.wallgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: var(--gap);
}

.wallgrid .empty {
  grid-column: 1 / -1;
  padding: 40px 0;
  text-align: center;
  color: var(--ink-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: var(--f-lab);
}

.wkey {
  border: 12px solid transparent;
  border-image: url("/img/wall-plate2.png") 10 fill / 12px / 0 stretch;
  padding: 22px 26px;
  display: grid;
  gap: 10px;
  min-width: 0;
}

.wkey-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  position: relative;
  padding-bottom: 12px;
}
.wkey-top::after { bottom: 0; }

.wkey-n { font-size: 28px; color: var(--hot); display: inline-flex; align-items: center; gap: 12px; }
.wkey-mark { width: 26px; height: 26px; image-rendering: pixelated; }
.wkey-held { font-size: var(--f-small); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink); }
.wkey-row { display: grid; gap: 4px; }
.wkey-lab { font-size: 16px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-dim); }
.wkey-val { font-size: var(--f-small); color: var(--ink); overflow-wrap: anywhere; user-select: all; }
.wkey-val.seed { color: var(--hot); }
.wkey-keys { display: flex; gap: 10px; flex-wrap: wrap; padding-top: 6px; }
.wkey-keys .key { min-height: 48px; font-size: var(--f-small); padding: 0 18px; }

/* ---------- payouts ---------- */

.pay-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: var(--gap);
  margin-bottom: var(--gap);
  align-items: start;
}

.mine {
  padding: 22px var(--pad);
  border: 16px solid transparent;
  border-image: url("/img/module.png") 40 fill / 16px / 0 stretch;
  display: grid;
  gap: 14px;
}

/* ---------- manual ---------- */

.steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }

.steps li {
  display: grid;
  align-content: start; /* number, heading and text sit on the same lines in every card of a row */
  gap: 10px;
  padding: 26px var(--pad);
  border: 16px solid transparent;
  border-image: url("/img/module.png") 40 fill / 16px / 0 stretch;
}

.step-n { font-size: 44px; line-height: 1; color: var(--hot); }
.step-h { font-size: 26px; color: var(--ink); letter-spacing: 0.04em; }
.step-t { font-size: var(--f-body); color: var(--ink-dim); line-height: 1.45; }

.risk {
  margin-top: var(--gap);
  padding: 26px 34px;
  border: 13px solid transparent;
  border-image: url("/img/alarm.png") 12 fill / 13px / 0 stretch;
  background: var(--hot);
  color: var(--black);
  display: grid;
  gap: 10px;
}

.risk-h { font-size: 26px; letter-spacing: 0.12em; text-transform: uppercase; }
.risk-t { font-size: var(--f-body); line-height: 1.4; max-width: 110ch; }

/* ---------- mode strip ---------- */

.modes {
  position: sticky;
  bottom: var(--gap);
  z-index: 5;
  display: grid;
  grid-template-columns: auto repeat(5, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: stretch;
  padding: 12px 16px;
  border: 18px solid transparent;
  border-image: url("/img/module.png") 40 fill / 18px / 0 stretch;
  background: var(--black);
}

.modes-tag, .modes-clock {
  display: flex;
  align-items: center;
  padding: 0 18px;
  font-size: var(--f-small);
  letter-spacing: 0.16em;
  color: var(--ink-dim);
}

.mkey {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 60px;
  padding: 0 18px;
  border: 11px solid transparent;
  border-image: url("/img/key-rest.png") 26 fill / 11px / 0 stretch;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: var(--f-lab);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}

.mkey b { font-weight: 400; color: var(--ink-dim); }
.mkey:hover { filter: brightness(1.35); }

.mkey[aria-current="true"] {
  border-image-source: url("/img/key-lit.png");
  color: var(--black);
}

.mkey[aria-current="true"] b { color: #3a2a00; }

/* ---------- CRT over the whole screen ---------- */

.scan {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9;
  background-image: url("/img/grain.png");
  background-size: 256px 256px;
  opacity: 0.5;
  mix-blend-mode: screen;
  animation: flicker 5.2s steps(12) infinite;
}

@keyframes flicker {
  0%, 100% { opacity: 0.44; }
  40% { opacity: 0.52; }
  62% { opacity: 0.38; }
  78% { opacity: 0.5; }
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--strip) + 40px);
  transform: translateX(-50%) translateY(16px);
  z-index: 20;
  padding: 16px 30px;
  border: 11px solid transparent;
  border-image: url("/img/key-lit.png") 26 fill / 11px / 0 stretch;
  color: var(--black);
  font-size: var(--f-lab);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms linear, transform 140ms linear;
}

.toast[data-show="true"] { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- widths ---------- */

@media (max-width: 1500px) {
  .modes-clock { display: none; }
  .band {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.6fr) minmax(0, 1fr);
  }
  .alarm { grid-column: 1 / -1; }
  .lamps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1250px) {
  .bay .module-title .dim { display: none; }
  .cell { width: 92px; height: 94px; font-size: 36px; }
}

@media (max-width: 1150px) {
  :root { --pad: 24px; --gap: 12px; }
  .mode { grid-template-columns: minmax(0, 1fr); }
  #mode-console { grid-template-areas: "display" "ribbon" "rail"; grid-template-rows: auto auto auto; }
  .steps { grid-template-columns: minmax(0, 1fr); }
  .pay-top { grid-template-columns: minmax(0, 1fr); }
  .display-face { min-height: 380px; }
  .plot-canvas { min-height: 356px; }
}

@media (max-width: 820px) {
  :root { --f-val: 28px; --strip: 132px; --pad: 18px; }
  .module { border-width: 12px; border-image-width: 12px; }
  .band { grid-template-columns: minmax(0, 1fr); }
  .ident { grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; }
  .ident-mark img { width: 60px; height: 60px; }
  .ident-name { font-size: 22px; }
  .ident-hop { padding-top: 8px; }
  .ident-hop .val { font-size: 26px; }
  .countdown, .held {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    text-align: left;
    gap: 2px 18px;
    padding-top: 14px;
    padding-bottom: 14px;
  }
  .countdown .lab, .held .lab { grid-column: 1; grid-row: 1; }
  .countdown .sub, .held .sub { grid-column: 1; grid-row: 2; }
  .count, .held-val { grid-column: 2; grid-row: 1 / span 2; text-align: right; }
  .alarm { padding: 20px 22px; }
  .lamps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bay-row { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  /* the keys of a row become a grid of equal plates: two a row, pump.fun across the top */
  .bay-keys { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .bay-keys .key { width: 100%; padding: 0 10px; }
  .bay-keys #linkPump { grid-column: 1 / -1; order: -1; }
  .bay-keys #copyMint { order: 0; }
  .bay-keys #linkScan { order: 1; }
  .bay-keys #linkX { order: 2; }
  .bay-keys #linkDex { order: 3; }
  .bay-lab { font-size: var(--f-small); }
  .verify-row { grid-template-columns: minmax(0, 1fr); }
  .verify-row .key { width: 100%; }
  .modes { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 10px 12px; }
  .modes-clock { display: none; }
  .modes-tag { justify-content: center; padding: 0; font-size: 16px; letter-spacing: 0.1em; }
  .mkey { gap: 8px; min-height: 52px; padding: 0 8px; font-size: 16px; letter-spacing: 0.02em; }
  .modes { border-width: 12px; border-image-width: 12px; padding: 8px; gap: 6px; }
  .lamps { grid-template-columns: minmax(0, 1fr); }
  /* one plate, the digits inside it: a per digit cell has no room for its padding on a phone */
  .cells {
    display: inline-flex;
    gap: 0;
    border: 8px solid transparent;
    border-image: url("/img/cell.png") 6 fill / 8px / 0 stretch;
    padding: 18px 32px;
  }
  .cell { width: auto; height: auto; border: 0; font-size: 40px; letter-spacing: 0.08em; }
  .cell-sep { width: auto; font-size: 36px; }
  .mkey b { display: none; }
  .modes-tag { display: none; }
  .modes-clock { display: flex; justify-content: center; padding: 0; font-size: 16px; letter-spacing: 0.06em; }
  .ident { grid-template-columns: auto minmax(0, 1fr); }
  .count { font-size: clamp(38px, 10.5vw, 54px); }
  .held-val { font-size: clamp(28px, 8vw, 42px); }
  .alarm-line { font-size: 22px; }
  .wallgrid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 560px) {
  /* the phone band is drawn, not squeezed: two readouts side by side, the explanation on the lamps */
  .band { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .ident { grid-column: 1 / -1; }
  .alarm { grid-column: 1 / -1; }
  .countdown, .held {
    grid-template-columns: minmax(0, 1fr);
    text-align: center;
    justify-items: center;
    align-content: center;
  }
  .countdown .lab, .held .lab { grid-row: 1; }
  .count, .held-val { grid-column: 1; grid-row: 2; text-align: center; }
  .countdown .sub, .held .sub { display: none; }
  .count, .held-val { font-size: clamp(24px, 7.6vw, 34px); }
  .ident-mark img { width: 48px; height: 48px; }
  .ident-name { font-size: 20px; }
  .ident-ticker { font-size: var(--f-small); }
  .ident-hop .val { font-size: 22px; }
}

@media (max-width: 560px) {
  /* both readouts give their label two lines, so the two numbers sit on one line side by side */
  .countdown .lab, .held .lab { min-height: 2.7em; display: flex; align-items: flex-end; justify-content: center; text-align: center; }
  /* the strip is one row of five equal keys with short names, so it never eats the phone screen */
  :root { --strip: 76px; }
  .modes { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; padding: 6px; }
  .modes-clock, .modes-tag { display: none; }
  .mkey { min-height: 46px; padding: 0 2px; border-width: 8px; border-image-width: 8px; letter-spacing: 0; }
  .mkey span { display: none; }
  .mkey::after { content: attr(data-short); }
  /* the status lamps are the desk console's furniture; on a phone they would stand between the
     visitor and the point, and the countdown already says when the keeper is silent */
  .lamps { display: none; }
  /* a module title stacks: the name, then its note under it, never two squeezed columns */
  .module-title { flex-direction: column; align-items: flex-start; gap: 4px; }
  .module-title .dim { font-size: 16px; letter-spacing: 0.06em; }
  /* the trail and payout tables drop the columns a phone has no room for, instead of scrolling sideways */
  .grid .opt { display: none; }
  .grid { table-layout: fixed; font-size: 16px; }
  .grid th { font-size: 16px; letter-spacing: 0.04em; }
  .grid th, .grid td { padding: 12px 8px; }
  .grid td, .grid td a { word-break: break-all; }
  .grid .l { display: none; }
  .grid .s { display: inline; }
}

@media (max-width: 380px) {
  .band { grid-template-columns: minmax(0, 1fr); }
  /* one readout a row, the label on the left and the number on the right: two short plates, not two tall ones */
  .countdown, .held {
    grid-template-columns: minmax(0, 1fr) auto;
    justify-items: stretch;
    text-align: left;
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .countdown .lab, .held .lab { min-height: 0; justify-content: flex-start; align-items: center; text-align: left; grid-column: 1; grid-row: 1; }
  .count, .held-val { grid-column: 2; grid-row: 1; text-align: right; font-size: 36px; }
}

@media (max-width: 420px) {
  :root { --bezel: 14px; --pad: 20px; --pad-title: 18px; }
  .module-title { font-size: var(--f-small); letter-spacing: 0.1em; }
  .mkey { font-size: 16px; }
  .cells { padding: 14px 22px; }
  .cell { font-size: 34px; }
  .split-row { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .scan { animation: none; opacity: 0.44; }
  .key, .toast { transition: none; }
}
