:root {
  color-scheme: light;
  --bg: #dff5ff;
  --ink: #24313c;
  --muted: #60737f;
  --panel: rgba(255, 255, 255, 0.76);
  --line: rgba(36, 49, 60, 0.16);
  --accent: #f7c948;
  --danger: #ff6b5f;
  --cyan: #52b8e8;
  --green: #8dd867;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background:
    radial-gradient(circle at 14% 10%, rgba(255, 255, 255, 0.92), transparent 18rem),
    radial-gradient(circle at 88% 18%, rgba(247, 201, 72, 0.28), transparent 20rem),
    linear-gradient(135deg, #a8dcff 0%, #dff5ff 52%, #fff6c8 100%);
  touch-action: none;
  user-select: none;
}

.shell {
  width: min(100vw, 1120px);
  height: 100dvh;
  margin: 0 auto;
  padding: clamp(14px, 2.4vw, 28px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(10px, 1.8vw, 18px);
}

.hud {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

h1 {
  margin: 0;
  font-size: clamp(1.55rem, 3.2vw, 3.2rem);
  line-height: 0.95;
  letter-spacing: 0;
}

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

.stats span,
.controls span {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.58);
  backdrop-filter: blur(14px);
  font-size: 0.86rem;
  white-space: nowrap;
}

.stats strong {
  color: var(--ink);
  font-size: 1.1rem;
}

.stage-wrap {
  position: relative;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #bdeeff;
  box-shadow:
    0 28px 80px rgba(73, 139, 172, 0.25),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

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

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  background: linear-gradient(rgba(215, 245, 255, 0.08), rgba(215, 245, 255, 0.42));
}

.overlay.hidden {
  pointer-events: none;
  opacity: 0;
}

.state {
  margin: 0;
  color: var(--ink);
  font-size: clamp(2.2rem, 7vw, 5.8rem);
  font-weight: 900;
  line-height: 0.9;
  text-shadow: 0 12px 26px rgba(0, 0, 0, 0.3);
}

.hint {
  max-width: 27rem;
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.95rem, 1.5vw, 1.1rem);
  line-height: 1.55;
}

button {
  appearance: none;
  min-width: 118px;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 11px 18px;
  color: #10151a;
  background: var(--accent);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 14px 28px rgba(247, 201, 72, 0.22);
}

button:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
}

.controls {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

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

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

  .stats {
    justify-content: start;
  }

  .controls span {
    min-height: 30px;
    font-size: 0.75rem;
    padding: 6px 8px;
  }
}
