@font-face {
  font-family: Arcade;
  src: url('assets/ui-pixel.woff') format('woff');
  font-weight: 100 900;
  font-display: swap;
}
:root {
  color-scheme: dark;
  --bg: #090e1c;
  --panel: #101a2f;
  --edge: #34496a;
  --text: #ecf1dc;
  --muted: #a2b3c9;
  --red: #ff624b;
  --mint: #76e6bc;
  --gold: #ffd379;
  font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
  font-size: 14px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    linear-gradient(#1b2b4438 1px, transparent 1px),
    linear-gradient(90deg, #1b2b4438 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--text);
}
button,
select,
input {
  font: inherit;
}
button,
select {
  color: var(--text);
  border: 2px solid var(--edge);
  border-radius: 0;
  background: #111d32;
}
button {
  cursor: pointer;
  box-shadow: 2px 2px 0 #020713;
}
button:hover {
  background: #233752;
  border-color: var(--mint);
}
button:active {
  transform: translate(1px, 1px);
  box-shadow: none;
}
button:disabled {
  opacity: 0.6;
  cursor: wait;
}
button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
}
[hidden] {
  display: none !important;
}
a {
  color: var(--mint);
}
.cabinet {
  max-width: 1080px;
  margin: auto;
  padding: 24px 28px;
}
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 2px solid var(--edge);
  padding-bottom: 20px;
  margin-bottom: 24px;
}
.brand {
  font:
    24px Arcade,
    monospace;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.brand b {
  color: var(--red);
  font-weight: 400;
}
.brand span {
  font:
    14px 'Microsoft YaHei',
    sans-serif;
  margin-left: 18px;
  color: var(--muted);
  vertical-align: middle;
}
.edition {
  font:
    12px Arcade,
    monospace;
  color: var(--mint);
}
.layout {
  display: grid;
  grid-template-columns: minmax(0, 600px) minmax(250px, 300px);
  gap: 28px;
  justify-content: center;
  align-items: start;
}
.game-shell {
  width: 100%;
  padding: 12px;
  background: #111b30;
  border: 2px solid var(--edge);
  box-shadow: 6px 6px 0 #030713;
  min-width: 0;
}
.cabinet-label {
  display: flex;
  justify-content: space-between;
  padding: 0 2px 12px;
  font:
    12px Arcade,
    monospace;
  color: var(--muted);
}
.cabinet-label span:first-child {
  color: var(--mint);
}
.game-viewport {
  display: grid;
  place-items: center;
  background: #000;
  min-width: 0;
}
.screen {
  position: relative;
  width: 100%;
  max-width: 480px;
  aspect-ratio: 3/4;
  overflow: hidden;
  background: #000;
  container-type: inline-size;
}
.screen canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  outline: none;
  touch-action: none;
}
.scanlines {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(transparent 0, transparent 3px, #000 3px, #000 4px);
  opacity: 0.07;
}
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 28px 24px;
  text-align: center;
  background: linear-gradient(#0c1424ed, #091326f5);
}
.title-mark {
  width: 100%;
  margin: 0 0 6px;
}
.title-mark > span {
  font:
    12px Arcade,
    monospace;
  color: var(--muted);
}
.title-mark h1 {
  font:
    clamp(26px, 8cqw, 40px)/1.4 Arcade,
    monospace;
  margin: 20px 0 8px;
  color: var(--text);
  text-shadow: 0 4px #496875;
  white-space: nowrap;
}
.title-mark h1 b {
  font-weight: 400;
  color: var(--red);
  text-shadow: 0 4px #922d32;
}
.title-mark strong {
  font-size: 20px;
  color: var(--gold);
  letter-spacing: 8px;
}
.menu-caption {
  font-size: 14px;
  color: var(--mint);
  margin: 2px 0 14px;
  letter-spacing: 2px;
}
.menu-options {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 352px;
  text-align: left;
}
.menu-options label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 14px;
}
.difficulty-option {
  grid-column: 1/-1;
}
.menu-options select {
  width: 100%;
  min-width: 0;
  padding: 10px 6px;
  font-size: 14px;
  background: #0a1121;
}
.primary,
.secondary {
  min-width: 200px;
  min-height: 44px;
  padding: 10px 20px;
  font-weight: bold;
  font-size: 16px;
}
.primary {
  background: var(--red);
  border-color: #ffa275;
  color: #160f19;
  box-shadow: 4px 4px 0 #722c37;
}
.primary:hover {
  background: #ff9167;
  border-color: #ffd379;
}
.secondary {
  color: var(--text);
}
#start {
  width: 100%;
  max-width: 352px;
  margin-top: 12px;
}
.enter-hint {
  font:
    12px/1.6 Arcade,
    monospace;
  color: var(--gold);
  margin: 4px 0 0;
}
.menu-note {
  font-size: 12px;
  color: var(--muted);
  margin: 6px 0 0;
}
.compact {
  background: #091326f5;
}
.compact h2 {
  font-size: 24px;
  margin: 6px 0 20px;
}
.eyebrow {
  font:
    18px/1.6 Arcade,
    monospace;
  color: var(--gold);
}
#end-score {
  overflow-wrap: anywhere;
  max-width: 100%;
}
.screen-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 48px;
  padding-top: 10px;
}
.screen-toolbar > span {
  font-size: 12px;
  color: var(--muted);
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.screen-toolbar > div {
  display: flex;
  gap: 6px;
  flex: none;
}
.screen-toolbar button {
  min-height: 36px;
  padding: 6px 8px;
  font-size: 12px;
}
.touch-controls {
  display: none;
}
.side-panel {
  min-width: 0;
  background: #101a2f;
  border: 2px solid var(--edge);
  padding: 22px;
}
.record {
  padding-bottom: 22px;
  margin-bottom: 24px;
  border-bottom: 2px dashed var(--edge);
}
.record > span {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font:
    12px Arcade,
    monospace;
  color: var(--gold);
}
.record small {
  font:
    12px 'Microsoft YaHei',
    sans-serif;
  color: var(--muted);
}
.record strong {
  display: block;
  font:
    28px Arcade,
    monospace;
  color: var(--text);
  margin-top: 20px;
  letter-spacing: 2px;
}
.section-label {
  font:
    12px Arcade,
    monospace;
  color: var(--mint);
}
.side-panel h2 {
  font-size: 20px;
  font-weight: 500;
  margin: 10px 0 18px;
}
.controls {
  margin-bottom: 20px;
}
.controls h3 {
  display: none;
}
.controls p {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
  font-size: 14px;
  color: var(--muted);
}
kbd {
  font:
    12px Consolas,
    monospace;
  white-space: nowrap;
  border: 1px solid var(--edge);
  border-bottom-width: 3px;
  padding: 4px 6px;
  color: var(--text);
  background: #090f1d;
}
.toggle,
.volume {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  min-height: 36px;
}
.toggle input {
  accent-color: var(--mint);
  width: 18px;
  height: 18px;
}
.volume {
  justify-content: space-between;
}
.volume input {
  width: 65%;
  accent-color: var(--mint);
}
.weapons {
  border-top: 2px dashed var(--edge);
  margin-top: 20px;
  padding-top: 18px;
}
.weapons h3 {
  font-size: 14px;
  font-weight: 500;
  margin: 0 0 14px;
}
.weapons p {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  margin: 10px 0;
}
.weapons i {
  width: 8px;
  height: 16px;
  flex: none;
  box-shadow: 2px 2px #050a13;
}
.red {
  background: var(--red);
}
.blue {
  background: #68c8ff;
}
.purple {
  background: #d99aff;
}
.weapons b {
  font-weight: 400;
}
.weapons span {
  color: var(--muted);
  margin-left: auto;
}
.small-note {
  font-size: 14px;
  line-height: 1.9;
  color: var(--muted);
}
.small-note {
  margin: 20px 0 12px;
}
footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 22px;
  margin-top: 26px;
  border-top: 2px solid var(--edge);
  font-size: 12px;
  color: var(--muted);
}
footer span:first-child,
footer span:last-child {
  font:
    12px Arcade,
    monospace;
}
@container (max-width:380px) {
  .overlay {
    padding: 18px;
    gap: 10px;
  }
  .title-mark h1 {
    margin-top: 14px;
  }
  .title-mark strong {
    font-size: 18px;
  }
  .menu-caption {
    margin-bottom: 6px;
    font-size: 13px;
  }
  .menu-options {
    gap: 9px;
  }
  .menu-options select {
    padding: 8px 4px;
  }
  .menu-options label {
    font-size: 13px;
  }
  #start {
    margin-top: 8px;
  }
  .menu-note {
    margin-top: 2px;
  }
  .enter-hint {
    font-size: 11px;
  }
}
@container (max-width:300px) {
  .overlay {
    padding: 12px;
    gap: 6px;
  }
  .title-mark {
    margin: 0;
  }
  .title-mark > span {
    font-size: 10px;
  }
  .title-mark h1 {
    font-size: 24px;
    margin: 10px 0 6px;
  }
  .title-mark strong {
    font-size: 16px;
  }
  .menu-caption {
    font-size: 12px;
    margin: 2px 0 6px;
    letter-spacing: 0;
  }
  .menu-options label {
    gap: 4px;
    font-size: 12px;
  }
  .menu-options select {
    font-size: 12px;
    padding: 7px 3px;
  }
  .primary,
  .secondary {
    font-size: 14px;
    min-width: 160px;
    min-height: 40px;
    padding: 8px 12px;
  }
  #start {
    margin-top: 6px;
  }
  .menu-note {
    font-size: 11px;
  }
  .enter-hint {
    font-size: 10px;
  }
}
@media (max-width: 760px), (pointer: coarse) {
  .cabinet {
    padding: 16px;
  }
  .masthead {
    margin-bottom: 18px;
    padding-bottom: 16px;
  }
  .brand {
    font-size: 20px;
  }
  .edition {
    font-size: 10px;
  }
  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    max-width: 504px;
    margin: auto;
  }
  .side-panel {
    padding: 20px;
  }
  .record {
    margin-bottom: 20px;
  }
  .controls {
    display: none;
  }
  .side-panel h2,
  .section-label {
    display: none;
  }
  .touch-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
  }
  .touch-controls button {
    flex: none;
    padding: 12px 6px;
    min-height: 46px;
    font-size: 14px;
    touch-action: manipulation;
  }
  .touch-hint {
    flex: 1;
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
  }
  .small-note {
    font-size: 14px;
  }
  .weapons {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
  }
  .weapons h3 {
    grid-column: 1/-1;
    margin-bottom: 0;
  }
  .weapons p {
    flex-wrap: wrap;
    gap: 6px;
  }
  .weapons span {
    width: 100%;
    font-size: 12px;
    margin: 0;
    padding-left: 14px;
  }
  footer span:last-child {
    display: none;
  }
}
@media (max-width: 380px) {
  .cabinet {
    padding: 10px;
  }
  .brand {
    font-size: 18px;
  }
  .brand span {
    margin-left: 10px;
    font-size: 12px;
  }
  .edition {
    font-size: 9px;
  }
  .game-shell {
    padding: 8px;
  }
  .cabinet-label {
    font-size: 10px;
  }
  .screen-toolbar {
    gap: 4px;
  }
  .screen-toolbar button {
    padding: 6px;
  }
  .screen-toolbar > span {
    font-size: 11px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .scanlines {
    display: none;
  }
}
/* The fullscreen viewport consumes only the space left by the controls.
   Both dimensions come from one 3:4 rectangle, including after rotation. */
.fullscreen-fallback {
  overflow: hidden;
}
.game-shell:is(:fullscreen, .is-fullscreen) {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100dvh;
  max-width: none;
  margin: 0;
  padding: 0;
  border: 0;
  box-shadow: none;
  background: #000;
}
.game-shell.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1000;
}
.game-shell::backdrop {
  background: #000;
}
.game-shell:is(:fullscreen, .is-fullscreen) .cabinet-label {
  display: none;
}
.game-shell:is(:fullscreen, .is-fullscreen) .game-viewport {
  flex: 1;
  min-height: 0;
  width: 100%;
  container-type: size;
}
.game-shell:is(:fullscreen, .is-fullscreen) .screen {
  width: min(100cqw, 75cqh);
  height: auto;
  max-width: none;
  aspect-ratio: 3/4;
}
.game-shell:is(:fullscreen, .is-fullscreen) .screen-toolbar {
  flex: none;
  width: 100%;
  min-height: 48px;
  height: 48px;
  padding: 4px 12px;
  border-top: 1px solid #24334b;
  background: #080e1b;
}
.game-shell:is(:fullscreen, .is-fullscreen) .touch-controls {
  flex: none;
  margin: 0;
  padding: 4px 12px calc(4px + env(safe-area-inset-bottom));
  background: #080e1b;
}
.game-shell:is(:fullscreen, .is-fullscreen) .touch-controls button {
  min-height: 44px;
  padding: 8px;
}
.overlay {
  overflow-y: auto;
  justify-content: safe center;
}
.overlay > * {
  flex-shrink: 0;
}
@media (min-width: 761px) {
  .screen {
    max-width: min(480px, calc((100dvh - 210px) * 0.75));
  }
}
