:root {
  --paper: #eeeae2;
  --surface: #f8f6f1;
  --ink: #232822;
  --muted: #686b60;
  --line: #cccbbf;
  --red: #b93726;
  --mono: "Courier New", monospace;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled, button[aria-disabled="true"] { cursor: default; opacity: .45; }
button, a, input, canvas { touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
[hidden] { display: none !important; }
.shell { max-width: 1600px; margin: auto; padding: 0 32px; }
.masthead { display: flex; justify-content: space-between; align-items: center; min-height: 92px; border-bottom: 1px solid var(--ink); gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; font-weight: 900; font-size: 15px; line-height: 1.03; letter-spacing: -.4px; }
.brand-mark { display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; color: var(--paper); background: var(--red); font-size: 29px; font-weight: 900; letter-spacing: -6px; padding-right: 5px; transform: skewY(-5deg); }
.brand-mark span { font-size: 20px; align-self: flex-end; margin-bottom: 9px; }
.brand-sub { display: block; font: 8px var(--mono); letter-spacing: .6px; margin-top: 6px; }
.top-links { display: flex; align-items: center; gap: 26px; }
.top-links .text-button { font: 12px var(--mono); }
.eyebrow, .sector, .game-bottom, .board-meta, .board-note, footer, .hint, label, .hud { font-family: var(--mono); }
.eyebrow { font-size: 10px; letter-spacing: 1.2px; font-weight: 700; margin: 0 0 15px; }
.signal { display: inline-block; width: 6px; height: 6px; background: #657b47; border-radius: 50%; vertical-align: middle; }
.arcade-layout { margin-top: 22px; }
.game-panel { border: 1px solid var(--ink); min-width: 0; }
.game-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 0 18px; min-height: 49px; background: var(--surface); border-bottom: 1px solid var(--ink); }
.sector { font-size: 10px; letter-spacing: .6px; display: flex; align-items: center; gap: 8px; }
.red-square { height: 6px; width: 6px; background: var(--red); }
.text-button { background: none; border: none; color: inherit; font-size: 11px; min-height: 44px; min-width: 44px; padding: 8px 0; }
.text-button:not(:disabled):hover { color: var(--red); }
.key-small { font: 9px var(--mono); color: var(--muted); border: 1px solid var(--line); padding: 2px 5px; margin-left: 10px; }
.toolbar-actions { display: flex; align-items: center; gap: 18px; }
#fullscreen-error:not(:empty) { padding: 8px 16px; margin: 0; }
.effects-control { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 11px; letter-spacing: 0; font-weight: normal; cursor: pointer; }
#effects { width: 16px; min-width: 16px; height: 16px; margin: 0; padding: 0; flex: none; accent-color: var(--red); }
.suit-setting { display: grid; grid-template-columns: 106px minmax(0, 1fr); column-gap: 14px; padding: 14px 0; border-block: 1px solid var(--line); }
.suit-setting > label, .suit-setting > select, .suit-setting > p { grid-column: 2; }
.suit-setting > label { margin-top: 0; align-self: end; }
#suit-preview { grid-column: 1; grid-row: 1 / 4; align-self: center; width: 106px; height: 106px; object-fit: contain; background: radial-gradient(ellipse at center, #f9f8f1, #dadbd4); border: 1px solid var(--line); }
select { width: 100%; min-width: 0; height: 44px; padding: 0 8px; border: 1px solid var(--line); border-radius: 0; color: var(--ink); background: var(--surface); font-size: 12px; }
#speed { display: block; width: 100%; height: 44px; padding: 0; margin: 0; border: 0; accent-color: var(--red); cursor: pointer; }
#speed-value { float: right; color: var(--red); }
.viewport { position: relative; isolation: isolate; background: #b9d7e3; overflow: hidden; height: clamp(480px, 46vw, 680px); }
canvas { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 20% center; }
.hud { pointer-events: none; position: absolute; top: 22px; left: 23px; right: 23px; display: flex; justify-content: space-between; align-items: flex-start; font-size: 9px; letter-spacing: 1px; color: #fff; text-shadow: 0 1px 3px #132331; }
.hud > span { padding-top: 4px; }
.hud > div { text-align: right; }
.hud-label { display: block; font-size: 8px; margin-bottom: 3px; }
.hud strong { font-size: 27px; font-weight: 400; letter-spacing: 1px; }
.hud-unit { font-size: 11px; margin-left: 5px; }
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: #13263842; padding: 50px 24px 20px; }
.launch-card { max-height: 100%; overflow-y: auto; width: min(480px, 100%); padding: 24px 26px; background: #f8f6f1fa; border: 1px solid #a7ad9e; box-shadow: 6px 6px 0 #13233125; }
.launch-card .eyebrow { font-size: 8px; color: var(--red); margin-bottom: 10px; }
.launch-card h2 { font-size: 28px; font-weight: 800; letter-spacing: -1px; margin: 0 0 8px; }
.launch-card > p:not(.eyebrow) { font-size: 11px; line-height: 1.6; color: var(--muted); margin: 0 0 15px; }
label { display: block; font-size: 9px; font-weight: bold; letter-spacing: .7px; margin: 18px 0 7px; }
.launch-fields { display: flex; gap: 8px; }
input { width: 0; flex: 1; min-width: 0; background: var(--surface); border: 1px solid #a8ac9f; padding: 0 12px; height: 44px; font-size: 12px; border-radius: 0; color: var(--ink); }
.primary-button { background: var(--red); color: #fff; border: 1px solid var(--red); font-size: 11px; font-weight: bold; min-height: 44px; padding: 0 15px; display: inline-flex; align-items: center; justify-content: center; gap: 16px; white-space: nowrap; }
.primary-button:hover { background: #932c1e; }
.primary-button > span { font-size: 17px; }
.hint { font-size: 9px; line-height: 1.5; color: var(--muted); margin: 8px 0 0; }
.error { font-size: 11px; color: var(--red); margin: 6px 0 0; }
.error:empty, #save-state:empty { display: none; }
.launch-card #save-state { margin: 12px 0 0; font-size: 11px; }
.game-bottom { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 18px; font-size: 8px; letter-spacing: .7px; border-top: 1px solid var(--ink); background: var(--surface); }
.game-bottom .signal { margin-right: 5px; width: 5px; height: 5px; }
.game-bottom > span + span { color: var(--muted); }
.jump-button { display: none; border: 0; border-left: 1px solid var(--line); background: none; align-self: stretch; padding: 0 18px; color: var(--red); font-weight: bold; min-height: 44px; }
.popup { width: min(540px, calc(100% - 32px)); max-height: calc(100dvh - 32px); margin: auto; padding: 0; color: var(--ink); border: 1px solid var(--ink); background: var(--surface); box-shadow: 8px 8px 0 #15202b33; overflow-y: auto; }
.popup::backdrop { background: #0e1d2ec2; backdrop-filter: blur(4px); }
body:has(dialog[open]) { overflow: hidden; }
.board-heading { padding: 20px 22px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.board-heading .eyebrow { color: var(--red); font-size: 8px; margin-bottom: 10px; }
.board-heading h2 { gap: 16px; font-size: 27px; letter-spacing: -1px; margin: 0; display: flex; align-items: center; }
.board-heading h2 > span { font: 11px var(--mono); border: 1px solid var(--line); padding: 6px; }
.board-meta { display: flex; align-items: center; justify-content: space-between; border-block: 1px solid var(--line); padding: 0 22px; font-size: 9px; letter-spacing: .6px; }
.board-meta button { font-size: 22px; min-width: 44px; }
.board-scroll { padding: 0 22px; max-height: 370px; overflow: auto; min-height: 180px; }
table { border-collapse: collapse; width: 100%; font: 11px var(--mono); table-layout: fixed; }
th { text-align: left; font-size: 8px; letter-spacing: .8px; color: var(--muted); font-weight: 400; padding: 14px 0 10px; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { width: 29px; color: var(--muted); }
th:last-child, td:last-child { text-align: right; width: 60px; }
td { padding: 11px 0; border-bottom: 1px solid #deded2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
tr:first-child td { color: var(--red); }
.board-empty { color: var(--muted); font: 12px/1.8 var(--mono); margin: 36px 0; max-width: 180px; }
.board-note { font-size: 9px; line-height: 1.7; color: var(--muted); border-top: 1px solid var(--line); padding: 14px 22px; margin: 0; }
.settings-body { padding: 0 22px 22px; }
.settings-body details { border-top: 1px solid var(--line); padding: 10px 0; }
.settings-body summary { padding: 10px 0; cursor: pointer; font: bold 12px var(--mono); }
.controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 18px 0; }
.control { display: flex; flex-direction: column; gap: 6px; }
.control > div { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; min-height: 32px; }
kbd { font: 9px var(--mono); border: 1px solid #bdbfb1; box-shadow: 0 2px 0 #d5d6c9; padding: 4px 6px; min-width: 25px; text-align: center; background: #f5f3ec; }
.or { font-size: 10px; color: var(--muted); }
.control strong { font-size: 11px; }
.control > span { font-size: 9px; color: var(--muted); line-height: 1.5; }
footer { display: flex; justify-content: space-between; gap: 20px; padding: 22px 0 30px; font-size: 8px; letter-spacing: .6px; color: var(--muted); }
.footer-mark { color: var(--red); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (max-width: 960px) {
  .shell { padding: 0 22px; }
  .jump-button { display: block; }
}
@media (max-width: 600px) {
  .shell { padding: 0 12px; }
  .masthead { min-height: 80px; }
  .brand { font-size: 11px; gap: 8px; }
  .brand-mark { width: 34px; height: 38px; font-size: 25px; }
  .brand-mark span { font-size: 17px; margin-bottom: 6px; }
  .brand-sub { display: none; }
  .top-links { gap: 14px; }
  .top-links .text-button { font-size: 10px; }
  .arcade-layout { margin-top: 12px; }
  .game-toolbar { min-height: 44px; padding: 0 12px; }
  .sector { font-size: 8px; gap: 6px; }
  .key-small { display: none; }
  .viewport { height: min(620px, calc(100svh - 190px)); min-height: 470px; }
  canvas { object-position: 10% center; }
  .hud { top: 16px; left: 14px; right: 14px; font-size: 8px; }
  .hud strong { font-size: 23px; }
  .overlay { padding: 55px 12px 18px; }
  .launch-card { padding: 18px 16px; }
  .launch-card h2 { font-size: 24px; }
  .launch-card > p:not(.eyebrow) { font-size: 10px; margin-bottom: 10px; }
  .suit-setting { grid-template-columns: 80px minmax(0, 1fr); gap: 4px 10px; padding: 10px 0; }
  #suit-preview { width: 80px; height: 96px; }
  select { font-size: 11px; padding: 0 4px; }
  label { margin-top: 12px; }
  .launch-fields { flex-wrap: wrap; }
  .launch-fields input { flex-basis: 100%; }
  .launch-fields .primary-button { width: 100%; }
  .primary-button { padding: 0 12px; gap: 9px; }
  .game-bottom { padding: 0 0 0 12px; font-size: 7px; }
  .game-bottom > span + span { display: none; }
  .board-heading { padding: 16px; }
  .board-heading h2 { font-size: 23px; }
  .board-scroll, .board-meta { padding-inline: 16px; }
  .settings-body { padding: 0 16px 16px; }
  .controls { gap: 8px; }
  kbd { font-size: 8px; padding: 4px; min-width: 22px; }
  footer { flex-wrap: wrap; gap: 12px; font-size: 7px; padding-top: 18px; }
  footer > span:nth-child(2) { order: 3; flex-basis: 100%; }
}
.shell:fullscreen { max-width: none; width: 100%; height: 100%; padding: 0; display: flex; flex-direction: column; background: var(--paper); overflow: auto; }
.shell:fullscreen .masthead { min-height: 64px; padding: 0 16px; flex-shrink: 0; }
.shell:fullscreen main { display: flex; flex: 1; min-height: 0; }
.shell:fullscreen .arcade-layout { display: flex; flex: 1; min-width: 0; margin: 0; }
.shell:fullscreen .game-panel { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.shell:fullscreen .game-toolbar, .shell:fullscreen .game-bottom { flex-shrink: 0; }
.shell:fullscreen .viewport { height: auto; min-height: 0; flex: 1; }
.shell:fullscreen #game { object-fit: contain; object-position: center; }
.shell:fullscreen footer { display: none; }
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
