:root {
  --bg: #0d1020;
  --panel: #1a2038;
  --text: #eef1f6;
  --muted: #98a0b8;
  --accent: #6c8cff;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 2vh, 18px);
  background: radial-gradient(circle at 50% 0%, #232a4a, var(--bg) 70%);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  touch-action: manipulation;
}

h1 {
  margin: 0;
  font-size: clamp(1.2rem, 5vw, 1.6rem);
  letter-spacing: .06em;
}

.hud {
  display: flex;
  align-items: center;
  gap: clamp(10px, 3vw, 18px);
  background: var(--panel);
  padding: 8px 16px;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
  font-variant-numeric: tabular-nums;
}

.hud .stat { display: flex; flex-direction: column; align-items: center; min-width: 54px; }
.hud .label { font-size: .6rem; text-transform: uppercase; opacity: .65; letter-spacing: .08em; }
.hud .value { font-size: 1.15rem; font-weight: 700; }

#reset {
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  border: none;
  background: #2a3050;
  border-radius: 10px;
  padding: 8px 12px;
  color: inherit;
  transition: transform .08s, background .2s;
  touch-action: manipulation;
}
#reset:hover { background: #3a4270; }
#reset:active { transform: scale(.94); }

.stage {
  position: relative;
  width: min(92vw, 480px, 72vh);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .5);
  background: #0a0d18;
  touch-action: none;
}

footer {
  font-size: .7rem;
  opacity: .5;
  text-align: center;
  padding: 0 8px;
}
