:root {
  color-scheme: dark;
  --bg: #101114;
  --panel: #191b20;
  --panel-strong: #22262e;
  --text: #f4f1e8;
  --muted: #a9b0bd;
  --cyan: #42d9ff;
  --gold: #f6c453;
  --red: #ff5c7a;
  --green: #65e5a2;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 15% 10%, rgba(66, 217, 255, 0.16), transparent 28rem),
    linear-gradient(135deg, #101114 0%, #18171d 46%, #11161a 100%);
  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(--gold);
  color: #141414;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  min-height: 44px;
  padding: 0 18px;
  transition:
    transform 140ms ease,
    filter 140ms ease;
}

button:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

.game-shell {
  align-content: start;
  display: grid;
  gap: 16px;
  margin: 0 auto;
  max-width: 1100px;
  min-height: 100vh;
  padding: 16px;
}

.topbar,
.controls {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

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

h1 {
  font-size: clamp(26px, 4vw, 44px);
  line-height: 0.95;
  margin: 0;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.stats span {
  background: rgba(244, 241, 232, 0.08);
  border: 1px solid rgba(244, 241, 232, 0.12);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  min-width: 82px;
  padding: 9px 12px;
  text-align: center;
}

.stage-wrap {
  aspect-ratio: 16 / 9;
  background: var(--panel);
  border: 1px solid rgba(244, 241, 232, 0.12);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  overflow: hidden;
  position: relative;
  justify-self: center;
  max-height: calc(100vh - 172px);
  width: min(100%, calc((100vh - 172px) * 16 / 9));
}

canvas {
  display: block;
  height: 100%;
  image-rendering: crisp-edges;
  width: 100%;
}

.overlay {
  align-items: center;
  background: rgba(16, 17, 20, 0.64);
  display: flex;
  inset: 0;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  transition: opacity 180ms ease;
}

.overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.panel {
  background: rgba(25, 27, 32, 0.92);
  border: 1px solid rgba(244, 241, 232, 0.18);
  border-radius: 8px;
  max-width: 420px;
  padding: 24px;
  text-align: center;
}

.panel h2 {
  font-size: 28px;
  line-height: 1.05;
  margin: 6px 0 10px;
}

.panel p {
  color: var(--muted);
  line-height: 1.55;
  margin: 0 0 18px;
}

.panel .small {
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  margin: 0;
}

.controls {
  justify-content: center;
}

.controls button:first-child {
  background: var(--cyan);
}

.controls button:last-child {
  background: var(--panel-strong);
  border: 1px solid rgba(244, 241, 232, 0.16);
  color: var(--text);
}

@media (max-width: 680px) {
  .game-shell {
    gap: 12px;
    padding: 12px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .stats {
    justify-content: stretch;
    width: 100%;
  }

  .stats span {
    flex: 1;
    min-width: 0;
  }

  .controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .panel {
    margin: 16px;
    padding: 18px;
  }

  .panel h2 {
    font-size: 22px;
  }

  .stage-wrap {
    max-height: calc(100vh - 190px);
    width: 100%;
  }
}
