:root {
  --bg: #0b0e13;
  --text: #e6ebf2;
  --muted: #9aa7b8;
  --good: #7ed957;
  --bad: #ff6b6b;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#stage {
  position: relative;
  width: 900px;
  height: 1250px;
  transform-origin: center center;
  user-select: none;
}

canvas {
  display: block;
  background: #171923;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.07), 0 24px 70px rgba(0, 0, 0, 0.55);
  touch-action: none; /* we handle pointer events ourselves */
  cursor: grab;
}

canvas.dragging { cursor: grabbing; }

/* ---- HUD ------------------------------------------------------------------ */

#hud {
  position: absolute;
  top: 12px;
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.title {
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(230, 235, 242, 0.4);
  font-weight: 600;
  font-size: 15px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(10, 12, 18, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.chip.bump { animation: bump 0.3s ease; }
@keyframes bump {
  40% { transform: scale(1.18); }
}

/* ---- milestone toast ------------------------------------------------------- */

#toast {
  position: absolute;
  top: 26%;
  left: 50%;
  transform: translateX(-50%);
  padding: 18px 42px;
  border-radius: 18px;
  background: rgba(10, 12, 18, 0.85);
  border: 2px solid #ffd54a;
  color: #ffd54a;
  font-size: 44px;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

#toast.hidden { display: none; }

#toast.show { animation: toastPop 2.4s ease forwards; }
@keyframes toastPop {
  0%   { opacity: 0; transform: translateX(-50%) scale(0.6); }
  12%  { opacity: 1; transform: translateX(-50%) scale(1.08); }
  20%  { transform: translateX(-50%) scale(1); }
  80%  { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) scale(0.94) translateY(-16px); }
}

/* ---- overlays --------------------------------------------------------------- */

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  text-align: center;
  background: rgba(8, 10, 15, 0.82);
  backdrop-filter: blur(3px);
  padding: 40px;
}

.overlay.hidden { display: none; }

.overlay h1 {
  margin: 0;
  font-size: 64px;
  letter-spacing: 0.01em;
}

.tag {
  margin: 0;
  max-width: 560px;
  color: var(--muted);
  font-size: 22px;
  line-height: 1.5;
}

.rules {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 24px;
}

.rules .good { color: var(--good); font-weight: 800; }
.rules .bad  { color: var(--bad);  font-weight: 800; }

button.primary {
  margin-top: 10px;
  padding: 16px 54px;
  font-size: 28px;
  font-weight: 700;
  color: #10131a;
  background: var(--good);
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.12s ease;
}

button.primary:hover { filter: brightness(1.1); transform: translateY(-2px); }
button.primary:active { transform: translateY(0); }

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  opacity: 0.8;
}
