:root {
  --bg: #0d0e10;
  --ink: #e9e7e1;
  --dim: #8d8b84;
  --line: #3a3b3f;
  --green: #35ff3f;
  --red: #ff3d3d;
  --beige: #d9c8a8;
  --tobacco: #6b3f1d;
  --mono: "Workbench", "Courier New", monospace;
  --stamp: "Anton", Impact, "Arial Narrow Bold", sans-serif;
  --type: "Courier Prime", "Courier New", monospace;
  --ink-card: #1c1610;
  --ink-card-dim: #6a5a44;
  --rule-card: #8a7658;
  --gutter: 16px;
}
* { box-sizing: border-box; }
html { background: var(--bg); color-scheme: dark; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 17px;
  line-height: 1.45;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; height: auto; image-rendering: pixelated; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input { font: inherit; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, h3 { font-weight: 400; margin: 0; }

/* ---------- the glass (first screen) ---------- */
.glass {
  position: relative;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  overflow: hidden;
}
.glass-top {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 16px;
  padding: 14px var(--gutter) 0;
}
.recording {
  display: inline-grid;
  justify-items: center;
  gap: 4px;
  text-decoration: none;
  width: 132px;
  transition: transform .08s;
}
.recording:active { transform: translateY(2px); }
.recording[aria-disabled="true"] { opacity: .42; pointer-events: none; }
.plate { position: relative; display: block; width: 118px; }
.plate .xmark { position: absolute; left: 50%; top: 58%; width: 30px; height: auto; transform: translate(-50%, -50%); filter: invert(1); image-rendering: auto; }
.plate-label { font-size: 16px; color: var(--dim); text-align: center; line-height: 1.2; }
.title { grid-column: 2; text-align: center; padding-top: 6px; }
.title h1 { font-size: clamp(30px, 5.4vw, 64px); letter-spacing: .06em; line-height: 1; }
.state-line { margin: 8px 0 0; color: var(--dim); font-size: 16px; }
.state-line.on-air { color: var(--green); }
.glass-top::after { content: ""; width: 132px; }

.now-speaking { min-height: 1.5em; margin: 8px var(--gutter) 0; text-align: center; color: var(--ink); font-size: 16px; }
.now-speaking:empty::before { content: " "; }

.seats {
  align-self: center;
  display: grid;
  grid-template-columns: repeat(20, 1fr);
  gap: 6px 4px;
  width: min(100% - 2 * var(--gutter), 1400px);
  margin: 6px auto 0;
  padding: 6px 0 10px;
}
@media (max-width: 1099px) { .seats { grid-template-columns: repeat(10, 1fr); width: min(100% - 2 * var(--gutter), 900px); } }
.seat { position: relative; display: grid; justify-items: center; gap: 2px; min-height: 48px; cursor: pointer; }
.seat .sprite { position: relative; width: clamp(28px, 2.9vw, 56px); aspect-ratio: 282 / 302; }
@media (max-width: 1099px) { .seat .sprite { width: clamp(28px, 6.4vw, 66px); } }
.seat .sprite img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: center bottom; }
.seat .sprite .f2, .seat .sprite .f3 { opacity: 0; }
@media (prefers-reduced-motion: no-preference) {
  .seat.idle .sprite .f1 { animation: idle1 6s steps(1) infinite; animation-delay: var(--d, 0s); }
  .seat.idle .sprite .f2 { animation: idle2 6s steps(1) infinite; animation-delay: var(--d, 0s); }
  .seat.idle .sprite .f3 { animation: idle3 6s steps(1) infinite; animation-delay: var(--d, 0s); }
}
@keyframes idle1 { 0%, 100% { opacity: 1; } 70% { opacity: 0; } 80% { opacity: 1; } 88% { opacity: 0; } 96% { opacity: 1; } }
@keyframes idle2 { 0%, 100% { opacity: 0; } 70% { opacity: 1; } 80% { opacity: 0; } }
@keyframes idle3 { 0%, 100% { opacity: 0; } 88% { opacity: 1; } 96% { opacity: 0; } }
.seat .num { font-size: 16px; color: var(--dim); line-height: 1; }
.seat.spoke .num { color: var(--ink); }
.seat.lit .sprite { filter: brightness(1.9) drop-shadow(0 0 6px rgba(53, 255, 63, .55)); }
.seat.lit.low .sprite { filter: brightness(1.6) drop-shadow(0 0 6px rgba(255, 61, 61, .55)); }
.seat .say {
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 260px;
  padding: 6px 8px;
  background: var(--ink);
  color: #111;
  font-size: 16px;
  line-height: 1.25;
  z-index: 3;
  pointer-events: none;
}
.seat .say b { font-weight: 400; color: #0a7a12; }
.seat .say.low b { color: #a31212; }
.seat[data-edge="l"] .say { left: 0; transform: none; }
.seat[data-edge="r"] .say { left: auto; right: 0; transform: none; }
@media (max-width: 899px) { .seat .say { display: none; } .seat .num { display: none; } .seat { min-height: 0; } .seats { gap: 3px 2px; } .seat .sprite { width: clamp(26px, 7.4vw, 44px); } }

/* ---------- the room band, the card on the table ---------- */
.room {
  --band-w: max(100vw, 1100px);
  --band-h: calc(var(--band-w) * 233 / 1584);
  --card-w: min(100vw - 2 * var(--gutter) - 90px, 470px);
  --card-h: calc(var(--card-w) * 844 / 1104);
  position: relative;
  height: var(--band-h);
  margin-top: max(0px, calc(var(--card-h) - 0.72 * var(--band-h) + 8px));
}
.table-img { width: var(--band-w); max-width: none; margin: 0 auto; position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); }
.on-table {
  position: absolute;
  left: 50%;
  bottom: calc(0.28 * var(--band-h));
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 18px;
  width: min(100% - 2 * var(--gutter), 720px);
}
.lamp { width: clamp(72px, 9vw, 116px); flex: none; margin-bottom: 6px; }
.card { position: relative; width: var(--card-w); aspect-ratio: 1104 / 844; flex: none; }
.card-bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.card-form {
  position: absolute;
  inset: 24% 8% 8% 9%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto auto;
  align-content: space-between;
  gap: 10px 18px;
  color: var(--ink-card);
  font-family: var(--type);
}
.card-form label { display: grid; gap: 0; min-width: 0; }
.card-form label span { font-size: 16px; color: var(--ink-card-dim); line-height: 1; letter-spacing: .02em; }
.card-form input {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  border: 0;
  border-bottom: 2px solid var(--rule-card);
  background: transparent;
  color: var(--ink-card);
  padding: 2px 0 0;
  font-family: var(--type);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.2;
}
.card-form input::placeholder { color: #9a8b74; font-weight: 400; }
#f-ticker { text-transform: uppercase; }
#f-lore { font-weight: 400; font-size: 17px; }
.card-form input:focus-visible { outline: none; border-bottom-color: #0a7a12; }
.f-name { grid-column: 1; grid-row: 1; }
.f-ticker { grid-column: 2; grid-row: 1; }
.f-lore { grid-column: 1 / 3; grid-row: 2; }
.f-x { grid-column: 1; grid-row: 3; align-self: end; }
.f-pic { grid-column: 2; grid-row: 3; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 0 10px; cursor: pointer; }
.f-pic input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.pic-tag { position: relative; display: block; width: 72px; aspect-ratio: 232 / 262; }
.pic-tag .tag-img { position: absolute; inset: 0; width: 100%; height: 100%; }
.pic-tag #f-pic-preview { position: absolute; left: 6%; top: 24%; width: 88%; height: 70%; object-fit: cover; image-rendering: auto; }
.f-pic > span:last-child { font-size: 16px; color: var(--ink-card-dim); border-bottom: 2px solid var(--rule-card); padding: 6px 0; align-self: end; }
.f-pic:focus-within > span:last-child, .f-pic:hover > span:last-child { color: #0a7a12; }
.card.narrow .card-form { gap: 4px 10px; inset: 22% 7% 7% 8%; }
.card.narrow .card-form input { min-height: 30px; font-size: 17px; }
.card.narrow .pic-tag { width: 52px; }

.card-live { position: absolute; inset: 19% 8% 9% 9%; display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; color: var(--ink-card); font-family: var(--type); }
.live-pic { width: clamp(64px, 22%, 128px); aspect-ratio: 1; object-fit: cover; image-rendering: auto; border: 3px solid #fff; outline: 2px solid var(--rule-card); background: #fff; }
.live-text { min-width: 0; display: grid; gap: 4px; }
.live-name { font-size: clamp(18px, 2.2vw, 26px); font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.live-lore { font-size: 17px; color: var(--ink-card-dim); line-height: 1.25; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.live-score { display: grid; justify-items: center; line-height: 1; }
.live-score-l { font-size: 16px; color: var(--ink-card-dim); }
#live-score-n { font-family: var(--stamp); font-size: clamp(30px, 4.6vw, 56px); }
.card-stamp { position: absolute; right: -6%; top: -18%; width: 46%; display: grid; place-items: center; transform: rotate(-9deg); pointer-events: none; }
.card-stamp img { grid-area: 1 / 1; width: 100%; }
.card-stamp span { grid-area: 1 / 1; font-family: var(--stamp); font-size: clamp(20px, 3.6vw, 44px); letter-spacing: .05em; color: var(--green); }
.card-stamp.red span { color: var(--red); }

.table-actions { position: relative; z-index: 2; display: grid; justify-items: center; gap: 6px; padding: 8px var(--gutter) 8px; }
.show-note { margin: 0; font-size: 16px; color: var(--dim); text-align: center; max-width: 60ch; }
.show-note.err { color: var(--red); }
.result-actions { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: center; }

/* keys: a push-button picture with a label under it */
.key { display: inline-grid; justify-items: center; gap: 2px; text-decoration: none; min-width: 72px; min-height: 48px; transition: transform .08s; }
.key:active { transform: translateY(2px); }
.key-img { position: relative; width: 56px; aspect-ratio: 1; display: block; }
.key-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.key-img .key-on { opacity: 0; transition: opacity .1s; }
.key:hover .key-img .key-on, .key:focus-visible .key-img .key-on, .key.on .key-img .key-on, .key[aria-current] .key-img .key-on { opacity: 1; }
.key-label { font-size: 16px; line-height: 1.2; text-align: center; color: var(--ink); }
.key:disabled { cursor: not-allowed; }
.key:disabled .key-img { opacity: .5; }
.key:disabled .key-label { color: var(--dim); }
.key-primary .key-img { width: 64px; }
.key-primary .key-label { color: var(--green); }
.key-primary:disabled .key-label { color: var(--dim); }
.textkey { font-size: 16px; color: var(--ink); text-decoration: underline; text-underline-offset: 4px; min-height: 44px; padding: 0 4px; }
.textkey:hover { color: var(--green); }
.textkey-green { color: var(--green); }
.textkey:disabled { color: var(--dim); text-decoration: none; cursor: not-allowed; }

/* dial test line */
.dial-wrap { position: relative; border-top: 1px solid var(--line); background: #08090a; }
.dial { display: block; width: 100%; height: 80px; image-rendering: auto; }
.dial-label { position: absolute; left: var(--gutter); top: 6px; font-size: 16px; color: var(--dim); }

/* ---------- console nav ---------- */
.console { display: flex; justify-content: center; gap: clamp(4px, 2vw, 28px); padding: 18px var(--gutter) 8px; border-top: 1px solid var(--line); flex-wrap: nowrap; }
.console .key { min-width: 0; flex: 1 1 0; max-width: 110px; }
.console .key-label .short { display: none; }
@media (max-width: 400px) { .console .key-label .long { display: none; } .console .key-label .short { display: inline; } }

/* ---------- monitors ---------- */
.monitor { width: min(100% - 2 * var(--gutter), 1180px); margin: 0 auto; padding: 34px 0 18px; scroll-margin-top: 8px; }
.monitor h2 { font-size: 18px; letter-spacing: .12em; text-transform: uppercase; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.monitor h2 .num { color: var(--green); margin-right: 10px; }
.lead { color: var(--dim); max-width: 78ch; margin: 12px 0 0; }
.steps { margin: 14px 0 0; padding-left: 1.6em; max-width: 80ch; }
.steps li { margin: 0 0 8px; }
.steps li::marker { color: var(--green); }
.empty { color: var(--dim); margin: 14px 0 0; }

.rows { display: grid; gap: 10px; margin-top: 14px; }
.row { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px 14px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.row .thumb { width: 64px; height: 64px; object-fit: cover; image-rendering: auto; background: #1a1b1e; }
.row .name { font-size: 18px; overflow-wrap: anywhere; }
.row .name small { color: var(--dim); font-size: 16px; margin-left: 6px; }
.row .meta { color: var(--dim); font-size: 16px; margin-top: 2px; }
.row .score { font-family: var(--stamp); font-size: 34px; line-height: 1.5; text-align: right; }
.row .score.green { color: var(--green); }
.row .score.red { color: var(--red); }
.row .quotes { grid-column: 1 / 4; margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.row .quotes li b { font-weight: 400; color: var(--green); }
.row .links { grid-column: 1 / 4; display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; }
.chip { font-size: 16px; color: var(--dim); }
.chip.ok { color: var(--green); }
.buy { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 14px 0 8px; border: 1px solid var(--line); text-decoration: none; font-size: 16px; transition: transform .08s; }
.buy img { width: 30px; height: 30px; image-rendering: auto; }
.buy:hover { border-color: var(--green); }
.buy:active { transform: translateY(2px); }
.buy[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.mark { display: inline-grid; place-items: center; width: 48px; height: 48px; border: 1px solid var(--line); transition: transform .08s; }
.mark img { width: 28px; height: 28px; image-rendering: auto; }
.mark:hover { border-color: var(--green); }
.mark:active { transform: translateY(2px); }
.mark[aria-disabled="true"] { opacity: .45; pointer-events: none; }

.sheets { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-top: 14px; }
.sheet { display: grid; grid-template-columns: 44px 1fr; gap: 4px 10px; align-items: start; padding: 10px; border: 1px solid var(--line); text-align: left; min-height: 96px; }
.sheet:hover, .sheet:focus-visible { border-color: var(--green); }
.sheet img { width: 44px; grid-row: 1 / 3; }
.sheet .who { font-size: 16px; line-height: 1.25; }
.sheet .acc { font-size: 16px; color: var(--dim); line-height: 1.25; }
.sheet .acc b { font-weight: 400; color: var(--green); }
.humans { margin-top: 14px; display: grid; gap: 6px; }
.humans h3, .retired h3 { font-size: 16px; color: var(--dim); text-transform: uppercase; letter-spacing: .1em; margin: 0 0 4px; }
.retired { margin-top: 18px; }
.retired p { margin: 0; color: var(--dim); }

.contract { margin-top: 18px; border: 1px solid var(--line); padding: 14px; display: grid; gap: 10px; max-width: 720px; }
.contract-head { color: var(--dim); font-size: 16px; text-transform: uppercase; letter-spacing: .1em; }
.ca-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.ca { font: inherit; font-size: 17px; overflow-wrap: anywhere; word-break: break-all; user-select: all; color: var(--ink); }
.ca.none { color: var(--dim); user-select: none; }
.buy-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.seat-note { margin: 0; color: var(--dim); font-size: 16px; }
.seat-actions { margin-top: 18px; display: grid; gap: 12px; justify-items: start; }
.seat-vote { display: grid; gap: 8px; }
.seat-vote-text { margin: 0; color: var(--dim); }
.vote-keys { display: flex; flex-wrap: wrap; gap: 4px; }
.vote-keys .key { min-width: 52px; }
.vote-keys .key-img { width: 44px; }

/* ---------- dialogs ---------- */
.dlg { background: var(--bg); color: var(--ink); border: 1px solid var(--ink); padding: 0; width: min(100% - 32px, 760px); max-height: min(92svh, 900px); overflow: hidden; }
.dlg::backdrop { background: rgba(0, 0, 0, .7); }
.dlg-body { padding: 16px; display: grid; gap: 12px; max-height: min(92svh, 900px); overflow: auto; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.dlg-head h3 { font-size: 18px; letter-spacing: .1em; text-transform: uppercase; }
.report-card { display: grid; grid-template-columns: 96px 1fr auto; gap: 14px; align-items: center; }
.report-card img { width: 96px; height: 96px; object-fit: cover; image-rendering: auto; background: #1a1b1e; }
.report-card .score { font-family: var(--stamp); font-size: 48px; line-height: 1.35; }
.report-card .score.green { color: var(--green); }
.report-card .score.red { color: var(--red); }
.report h4 { font-size: 16px; color: var(--dim); text-transform: uppercase; letter-spacing: .1em; margin: 14px 0 6px; }
.report ul { margin: 0; padding-left: 1.2em; }
.report .lines { list-style: none; padding: 0; display: grid; gap: 4px; }
.report .lines li b { font-weight: 400; color: var(--green); }
.report .lines li.low b { color: var(--red); }
.launch-steps { display: grid; gap: 14px; }
.launch-step { border: 1px solid var(--line); padding: 12px; display: grid; gap: 8px; }
.launch-step.done { border-color: var(--green); }
.launch-step .h { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.launch-step .h b { font-weight: 400; }
.launch-step .h span { color: var(--dim); font-size: 16px; }
.launch-step p { margin: 0; color: var(--dim); font-size: 16px; }
.launch-step .split { display: grid; gap: 2px; font-size: 16px; }
.launch-step .split code { font: inherit; overflow-wrap: anywhere; }
.launch-step input { min-height: 44px; background: #16171a; border: 1px solid var(--line); color: var(--ink); padding: 0 10px; width: 140px; }
.launch-step .act { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.sheet-full { display: grid; gap: 6px; font-family: var(--type); font-size: 17px; }
.sheet-full img { width: 96px; }
.sheet-full dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; }
.sheet-full dt { color: var(--dim); }
.sheet-full dd { margin: 0; }

/* full-screen stamp */
.stamp { position: fixed; inset: 0; display: grid; place-items: center; z-index: 50; pointer-events: none; }
.stamp img { grid-area: 1 / 1; width: min(90vw, 900px); }
.stamp span { grid-area: 1 / 1; font-family: var(--stamp); font-size: min(22vw, 200px); letter-spacing: .04em; color: var(--green); line-height: 1; }
.stamp.red span { color: var(--red); }
.stamp { transform: rotate(-8deg) scale(1.6); opacity: 0; }
.stamp.hit { animation: stamp .6s steps(4) forwards; }
@keyframes stamp { 0% { transform: rotate(-8deg) scale(1.6); opacity: 0; } 30% { transform: rotate(-8deg) scale(1); opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; transform: rotate(-8deg) scale(1); } }
@media (prefers-reduced-motion: reduce) { .stamp.hit { animation: stampstill .7s linear forwards; } }
@keyframes stampstill { 0%, 90% { opacity: 1; transform: rotate(-8deg); } 100% { opacity: 0; transform: rotate(-8deg); } }

.toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); background: var(--ink); color: #111; padding: 8px 12px; font-size: 16px; max-width: min(90vw, 520px); opacity: 0; transition: opacity .2s; z-index: 60; pointer-events: none; }
.toast.show { opacity: 1; }

/* ---------- widths ---------- */
@media (max-width: 899px) {
  .glass-top { grid-template-columns: auto 1fr; }
  .glass-top::after { display: none; }
  .title { grid-column: 2; text-align: left; padding-top: 0; }
  .recording { width: 96px; }
  .plate { width: 80px; }
  .plate .xmark { width: 22px; }
  .lamp { width: 64px; }
  .seats { gap: 4px 2px; }
  .row { grid-template-columns: 56px 1fr auto; }
  .row .thumb { width: 56px; height: 56px; }
  .report-card { grid-template-columns: 72px 1fr auto; }
  .report-card img { width: 72px; height: 72px; }
}
@media (max-width: 520px) {
  .room { --band-w: max(100vw, 900px); --card-w: min(100vw - 2 * var(--gutter) - 60px, 470px); }
  .on-table { gap: 8px; }
  .lamp { width: 52px; margin-bottom: 4px; }
}
