/* 复古街机柜风格：深色背景 + 像素边框 + 居中舞台 */
:root {
  --bg: #07090d;
  --panel: #12161e;
  --cabinet: #1a2230;
  --gold: #e6c35c;
  --amber: #ffb347;
  --lime: #7dff6b;
  --danger: #ff5a5a;
  --muted: #8b93a7;
  --line: #3a4a2a;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(ellipse at top, #182033 0%, var(--bg) 55%),
    repeating-linear-gradient(90deg, #0a0c10 0 2px, #080a0e 2px 4px);
  color: #e8ecf4;
  font-family: "Courier New", Courier, monospace;
}

body {
  display: flex;
  justify-content: center;
  padding: 16px 12px 24px;
}

.arcade-frame {
  width: min(760px, 100%);
  background: linear-gradient(180deg, #1c2433 0%, var(--panel) 40%, #0e1218 100%);
  border: 6px solid #2b3548;
  box-shadow:
    0 0 0 4px #0a0c10,
    0 0 0 8px #6d5a2c,
    0 18px 50px rgba(0, 0, 0, 0.55),
    inset 0 0 40px rgba(0, 0, 0, 0.35);
  padding: 14px 16px 16px;
}

.game-title {
  margin: 0 0 8px;
  text-align: center;
  letter-spacing: 0.35em;
  font-size: 28px;
  color: var(--gold);
  text-shadow:
    0 0 8px rgba(230, 195, 92, 0.45),
    3px 3px 0 #3a2a08;
}

.hud-row,
.hud-row-sub {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 14px;
  letter-spacing: 0.08em;
}

.hud-row-sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.hud-item span {
  color: var(--lime);
}

.lives {
  color: var(--danger) !important;
  letter-spacing: 0.12em;
}

.stage-wrap {
  margin: 12px 0;
  display: flex;
  justify-content: center;
}

.cabinet {
  position: relative;
  width: min(100%, calc(100vh - 280px), 624px);
  aspect-ratio: 1 / 1;
  background: #05070b;
  border: 4px solid #4d3b16;
  box-shadow:
    inset 0 0 0 3px #22180a,
    inset 0 0 28px rgba(0, 0, 0, 0.65),
    0 0 20px rgba(80, 140, 60, 0.15);
  overflow: hidden;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #000;
}

.scanlines {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.035) 0 1px,
    transparent 1px 3px
  );
  mix-blend-mode: overlay;
}

.hud-bottom {
  text-align: center;
}

.hint-pc {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.06em;
}

.extra-panel {
  margin-top: 12px;
  padding: 10px 10px 8px;
  border: 2px solid #3a4a2a;
  background: rgba(8, 12, 10, 0.45);
  text-align: left;
}

.panel-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.panel-label {
  flex: 0 0 52px;
  color: var(--gold);
  font-size: 13px;
  letter-spacing: 0.16em;
}

.level-pick {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

#level-select {
  flex: 1;
  min-height: 34px;
  min-width: 140px;
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--gold);
  background: linear-gradient(180deg, #3a2e14, #1b150a);
  border: 2px solid #d2b15a;
  padding: 4px 8px;
}

.chip {
  min-width: 44px;
  min-height: 34px;
  padding: 4px 10px;
  letter-spacing: 0.08em;
  font-size: 12px;
  box-shadow: 0 2px 0 #0a0804;
}

.panel-hint {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
  line-height: 1.5;
}

.menu-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

button {
  font-family: inherit;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  border: 2px solid #d2b15a;
  background: linear-gradient(180deg, #3a2e14, #1b150a);
  color: var(--gold);
  padding: 8px 14px;
  min-height: 40px;
  box-shadow: 0 3px 0 #0a0804;
}

button:hover {
  filter: brightness(1.15);
}

button:active {
  transform: translateY(2px);
  box-shadow: none;
}

.touch-controls {
  display: none;
  margin-top: 14px;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}

.dpad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.dpad-mid {
  display: flex;
  gap: 36px;
}

.touch-btn {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  font-size: 18px;
  user-select: none;
  touch-action: none;
}

.touch-btn.fire {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: linear-gradient(180deg, #5a2218, #2a100c);
  border-color: #ff8a6a;
  color: #ffd0c4;
}

@media (pointer: coarse), (max-width: 720px) {
  .touch-controls {
    display: flex;
  }

  .arcade-frame {
    border-width: 4px;
    padding: 10px;
  }

  .game-title {
    font-size: 22px;
    letter-spacing: 0.22em;
  }

  .cabinet {
    width: min(100%, calc(100vh - 360px), 520px);
  }
}

@media (max-width: 420px) {
  .hint-pc {
    font-size: 11px;
  }

  .hud-row,
  .hud-row-sub {
    font-size: 12px;
  }
}
