:root {
  color-scheme: dark;
  --panel: #20242b;
  --line: rgba(255,255,255,.16);
  --text: #f7f1e5;
  --muted: #bfc8d0;
  --gold: #f0c86a;
  --red: #ef5d50;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 16% 0%, rgba(240, 200, 106, .18), transparent 30%),
    radial-gradient(circle at 82% 10%, rgba(239, 93, 80, .14), transparent 34%),
    #111317;
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", monospace;
}

.shell {
  width: min(1280px, 100vw);
  height: min(860px, 100dvh);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
  padding: 12px;
}

.hud,
.footer {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(32,36,43,.95);
  box-shadow: 0 18px 50px rgba(0,0,0,.3);
}

.hud {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto auto;
  gap: 10px;
  padding: 10px;
}

.hud span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.hud strong {
  display: block;
  font-size: clamp(20px, 4vw, 30px);
  line-height: 1;
}

button {
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: var(--gold);
  color: #171717;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

button:disabled { opacity: .45; cursor: not-allowed; }

.game-wrap {
  position: relative;
  border: 2px solid rgba(255,255,255,.16);
  border-radius: 8px;
  overflow: hidden;
  background: #151b20;
  box-shadow: 0 22px 60px rgba(0,0,0,.36);
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(10,12,16,.64);
  font-size: clamp(36px, 8vw, 78px);
  font-weight: 900;
  text-align: center;
}

.overlay.hidden { display: none; }

.footer {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  color: var(--muted);
}

@media (max-width: 820px) {
  body { overflow: auto; }
  .shell { height: auto; min-height: 100dvh; }
  .hud { grid-template-columns: repeat(2, 1fr); }
  .game-wrap { min-height: 620px; }
  .footer { display: grid; }
}
