:root {
  color-scheme: dark;
  --bg: #101114;
  --panel: #191b20;
  --panel-2: #22252b;
  --text: #f4f0df;
  --muted: #a8a79f;
  --line: #3a3d42;
  --accent: #e1b44c;
  --danger: #d45244;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 18% 16%, rgba(225, 180, 76, 0.11), transparent 26rem),
    linear-gradient(135deg, #0e0f12 0%, #17191e 50%, #101114 100%);
  color: var(--text);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

button,
canvas {
  font: inherit;
}

.game-shell {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(320px, 832px) minmax(260px, 340px);
  gap: 24px;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.stage-wrap {
  position: relative;
  width: min(832px, calc(100vw - 48px));
  aspect-ratio: 1;
  background: #08090a;
  border: 2px solid #494b4d;
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.45),
    inset 0 0 0 6px #131518;
}

#battlefield {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.overlay {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  align-content: center;
  gap: 18px;
  text-align: center;
  background: rgba(8, 9, 10, 0.76);
  backdrop-filter: blur(2px);
  padding: 28px;
}

.overlay.is-visible {
  display: grid;
}

.overlay-title {
  color: var(--accent);
  font-size: clamp(42px, 8vw, 88px);
  font-weight: 900;
  line-height: 1;
}

.overlay-text {
  color: var(--text);
  font-size: clamp(16px, 2vw, 22px);
}

.primary-button {
  min-width: 154px;
  height: 46px;
  border: 0;
  border-radius: 4px;
  background: var(--accent);
  color: #17110a;
  font-weight: 800;
  cursor: pointer;
  transition: transform 150ms ease, filter 150ms ease;
}

.primary-button:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.primary-button:active {
  transform: translateY(0);
}

.hud {
  min-height: min(832px, calc(100svh - 48px));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 26px;
  background: linear-gradient(180deg, rgba(25, 27, 32, 0.94), rgba(17, 18, 22, 0.94));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 26px;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.32);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(36px, 5vw, 56px);
  line-height: 0.96;
}

h2 {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 15px;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 0;
}

.stats div {
  min-height: 86px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
}

dt {
  color: var(--muted);
  font-size: 13px;
}

dd {
  margin: 8px 0 0;
  color: var(--text);
  font-size: 32px;
  font-weight: 900;
  line-height: 1;
}

.status-line {
  min-height: 52px;
  display: flex;
  align-items: center;
  border-left: 4px solid var(--accent);
  background: rgba(225, 180, 76, 0.08);
  padding: 12px 14px;
  color: #f7e3ad;
  font-weight: 700;
}

.controls {
  color: var(--muted);
  line-height: 1.8;
}

.controls p + p {
  margin-top: 8px;
}

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  margin: 0 3px;
  border: 1px solid #55585e;
  border-bottom-color: #303238;
  border-radius: 4px;
  background: #111216;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

@media (max-width: 980px) {
  .game-shell {
    min-height: auto;
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .stage-wrap {
    width: min(100%, calc(100svh - 250px));
    min-width: 300px;
    justify-self: center;
  }

  .hud {
    min-height: auto;
    gap: 18px;
    padding: 18px;
  }

  .stats {
    grid-template-columns: repeat(4, 1fr);
  }

  .stats div {
    min-height: 72px;
    padding: 12px;
  }

  dd {
    font-size: 24px;
  }
}

@media (max-width: 640px) {
  .game-shell {
    gap: 14px;
  }

  .stage-wrap {
    width: 100%;
    min-width: 0;
  }

  .stats {
    grid-template-columns: 1fr 1fr;
  }

  h1 {
    font-size: 36px;
  }
}
