:root {
  --pink: #ff6fae;
  --pink-deep: #e0428a;
  --sky: #8fd6ff;
  --ink: #3a2b3f;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #0c1024;
  font-family: "Baloo 2", "Comic Sans MS", "Segoe UI", system-ui, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

#game-shell {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  /* Crisp scaling of the virtual coordinate space to the device screen. */
  image-rendering: auto;
}

/* ---- Overlay (menu / win / lose screens) ---- */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 16, 36, 0.55);
  backdrop-filter: blur(3px);
  transition: opacity 0.25s ease;
}

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

.card {
  background: linear-gradient(160deg, #fff, #ffe6f3);
  color: var(--ink);
  border-radius: 24px;
  padding: clamp(20px, 4vw, 40px) clamp(24px, 5vw, 56px);
  text-align: center;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  max-width: min(90vw, 480px);
  border: 4px solid var(--pink);
}

.card h1 {
  margin: 0 0 0.3em;
  font-size: clamp(1.8rem, 6vw, 2.8rem);
  color: var(--pink-deep);
}

.card p {
  margin: 0.4em 0;
  font-size: clamp(1rem, 3.2vw, 1.25rem);
  line-height: 1.4;
}

.card .stats {
  font-weight: 700;
  color: var(--pink-deep);
  min-height: 1.2em;
}

.card button {
  margin-top: 1em;
  padding: 0.7em 2.2em;
  font: inherit;
  font-size: clamp(1.1rem, 3.5vw, 1.4rem);
  font-weight: 700;
  color: #fff;
  background: var(--pink);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 6px 0 var(--pink-deep);
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}

.card button:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 var(--pink-deep);
}

.loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.4rem;
  letter-spacing: 0.05em;
}

.loading.hidden { display: none; }
