:root {
  color-scheme: dark;
  --bg: #101214;
  --panel: rgba(22, 25, 29, 0.9);
  --line: rgba(255, 255, 255, 0.16);
  --text: #f5f7f2;
  --muted: #b4baad;
  --accent: #37e0a1;
  --accent-2: #ffcc4d;
  --danger: #ff5d6c;
}

* {
  box-sizing: border-box;
}

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

body {
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 12%, rgba(55, 224, 161, 0.14), transparent 28rem),
    radial-gradient(circle at 84% 72%, rgba(255, 204, 77, 0.12), transparent 26rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #07110d;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  min-height: 44px;
  padding: 0 18px;
}

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

.shell {
  display: grid;
  min-height: 100vh;
  padding: 16px;
  place-items: center;
}

.game-surface {
  position: relative;
  width: min(100%, 1280px);
  aspect-ratio: 16 / 9;
  max-height: calc(100vh - 32px);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #121619;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.hud {
  position: absolute;
  z-index: 4;
  pointer-events: none;
}

.hud-top {
  display: grid;
  grid-template-columns: repeat(4, minmax(70px, 1fr));
  gap: 8px;
  left: 12px;
  right: 12px;
  top: 12px;
}

.stat {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(12, 14, 16, 0.64);
  padding: 8px 10px;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: clamp(0.68rem, 1.3vw, 0.78rem);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.1;
}

.stat strong {
  display: block;
  margin-top: 2px;
  font-size: clamp(0.95rem, 2.6vw, 1.25rem);
  line-height: 1.1;
}

.bars {
  position: absolute;
  z-index: 4;
  display: grid;
  gap: 6px;
  left: 12px;
  right: 12px;
  bottom: 12px;
  pointer-events: none;
}

.bar {
  height: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.3);
}

.bar span {
  display: block;
  width: 0%;
  height: 100%;
  transition: width 120ms linear;
}

.health span {
  background: linear-gradient(90deg, var(--danger), #ff9a5f);
}

.xp span {
  background: linear-gradient(90deg, #47a8ff, var(--accent));
}

.overlay {
  position: absolute;
  z-index: 8;
  inset: 0;
  display: grid;
  padding: 18px;
  place-items: center;
  background: rgba(7, 9, 10, 0.5);
  backdrop-filter: blur(5px);
}

.overlay.hidden {
  display: none;
}

.panel {
  width: min(92vw, 460px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: clamp(18px, 4vw, 28px);
  text-align: center;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.42);
}

.panel h1,
.panel h2 {
  margin: 0;
  font-size: clamp(2rem, 8vw, 4rem);
  letter-spacing: 0;
  line-height: 0.95;
}

.panel h2 {
  font-size: clamp(1.5rem, 5vw, 2.5rem);
}

.panel p {
  color: var(--muted);
  font-size: clamp(0.95rem, 2.7vw, 1.08rem);
  line-height: 1.5;
  margin: 14px 0 20px;
}

.upgrade-panel {
  width: min(94vw, 760px);
}

.choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.choice {
  display: grid;
  min-height: 130px;
  align-content: start;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 14px;
  text-align: left;
}

.choice:hover {
  background: rgba(55, 224, 161, 0.12);
  filter: none;
}

.choice strong {
  color: var(--accent-2);
  font-size: 1rem;
  line-height: 1.2;
}

.choice span {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

@media (max-width: 720px) {
  body {
    overflow: auto;
  }

  .shell {
    min-height: 100svh;
    padding: 8px;
  }

  .game-surface {
    width: 100%;
    max-height: calc(100svh - 16px);
  }

  .hud-top {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
    left: 8px;
    right: 8px;
    top: 8px;
  }

  .stat {
    padding: 6px;
  }

  .bars {
    left: 8px;
    right: 8px;
    bottom: 8px;
  }

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

  .choice {
    min-height: 86px;
  }
}
