:root {
  --bg: #6aa84f;
  --panel: #3a3f4b;
  --accent: #7cf04a;
  --accent2: #ffd23f;
  --good: #7cff6b;
  --text: #f2f5ec;
  --muted: #b9c2a8;
  --pixel: "Press Start 2P", "Courier New", monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

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

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

/* cinematische vignet-overlay (subtiele rand-verduistering + warmte) */
#vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  background: radial-gradient(120% 90% at 50% 42%, rgba(0,0,0,0) 55%, rgba(0,0,0,0.28) 100%);
  mix-blend-mode: multiply;
}

/* ---------- HUD ---------- */
#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 18px;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}
.hud-block { display: flex; flex-direction: column; gap: 2px; }
.hud-block.right { align-items: flex-end; }
.hud-label {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #f2f5ec;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.55);
}
.hud-value {
  font-family: var(--pixel);
  font-size: 20px;
  line-height: 1.2;
  color: #fff;
  text-shadow: 2px 2px 0 #2c3a1c;
}
#balls .dot {
  display: inline-block;
  width: 13px; height: 13px;
  margin-left: 5px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #8b93b5 60%, #4a5168);
  box-shadow: 0 0 8px rgba(255,255,255,0.5);
}
#balls .dot.spent { background: #2a3050; box-shadow: none; opacity: 0.5; }

/* score-multiplier */
.hud-mult {
  font-family: var(--pixel);
  font-size: 13px;
  color: var(--accent2);
  text-shadow: 2px 2px 0 #4a3a10;
  opacity: 0;
  margin-top: 4px;
  transition: opacity 0.2s ease, transform 0.1s ease;
}
.hud-mult.show { opacity: 1; }
.hud-mult.pulse { transform: scale(1.3); }

/* nacht-meter */
#night {
  width: 86px; height: 9px;
  margin-top: 8px;
  border: 2px solid #20242d;
  border-radius: 2px;
  background: rgba(0,0,0,0.35);
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
}
#nightFill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #5a6172, #3a4a8c 60%, #8a5cd0);
  transition: width 0.15s linear;
}
#night.full #nightFill { background: linear-gradient(90deg, #8a5cd0, #c79bff); }

/* flash message in the centre */
#flash {
  position: absolute;
  top: 24%; left: 50%;
  transform: translateX(-50%);
  font-size: clamp(26px, 7vw, 56px);
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--accent2);
  text-shadow: 0 0 24px rgba(255,61,166,0.8);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
#flash.show { opacity: 1; }
#flash.boom {
  text-shadow: 0 0 30px #fff, 0 0 90px #ffe3b0, 0 0 160px #ff8a3a;
  transform: translateX(-50%) scale(1.3);
}

/* power meter for the plunger */
#power {
  position: absolute;
  right: 18px; bottom: 18px;
  width: 18px; height: 160px;
  border: 2px solid rgba(255,255,255,0.25);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(0,0,0,0.35);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
#power.show { opacity: 1; }
/* skill-shot sweetspot: laat los als de vulling deze gouden band raakt */
#powerSweet {
  position: absolute;
  left: 0; right: 0;
  bottom: 60%; height: 20%;
  background: rgba(255, 210, 63, 0.30);
  border-top: 2px solid var(--accent2);
  border-bottom: 2px solid var(--accent2);
}
#powerFill {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 0%;
  background: linear-gradient(0deg, var(--good), #f4ff5a 55%, var(--accent2));
}

/* mute button */
.mute {
  position: absolute;
  top: 12px; left: 50%;
  transform: translateX(-50%);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text);
  width: 40px; height: 40px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  pointer-events: auto;
}

/* ---------- overlays ---------- */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 30%, rgba(20,24,55,0.55), rgba(5,6,15,0.86));
  backdrop-filter: blur(4px);
  z-index: 10;
  padding: 20px;
}
.overlay.hidden { display: none; }
.panel {
  width: min(440px, 92vw);
  background: var(--panel);
  border: 4px solid #15171c;
  border-radius: 6px;
  padding: 28px 26px 26px;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6), inset 0 0 0 2px #565d6b;
}
.logo {
  margin: 6px 0 14px;
  font-family: var(--pixel);
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: 1px;
  color: var(--accent);
  text-shadow: 3px 3px 0 #1c2a12, 4px 4px 0 rgba(0,0,0,0.35);
}
.sub { margin: 0 0 18px; color: var(--muted); font-size: 15px; }
.howto { text-align: left; display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; }
.ht { font-size: 14px; color: #cfd6ee; line-height: 1.4; }
.ht b { color: var(--text); }
.kbd {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 3px;
  background: #5a6172;
  border: 2px solid #20242d;
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.18);
  font-size: 12px;
  font-weight: 700;
}
.btn {
  appearance: none;
  cursor: pointer;
  font-family: var(--pixel);
  font-size: 13px;
  line-height: 1.5;
  padding: 16px 22px;
  border-radius: 4px;
  color: #fff;
  background: #6aa84f;
  border: 3px solid #2f5320;
  box-shadow: inset 0 3px 0 rgba(255,255,255,0.25), inset 0 -4px 0 rgba(0,0,0,0.30);
  text-shadow: 2px 2px 0 #2c3a1c;
  transition: transform 0.06s ease, filter 0.15s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(2px); box-shadow: inset 0 2px 0 rgba(255,255,255,0.2), inset 0 -2px 0 rgba(0,0,0,0.3); }
.grade { font-family: var(--pixel); font-size: 20px; line-height: 1.4; margin: 4px 0 12px; color: var(--accent2); text-shadow: 2px 2px 0 #2c2410; }
.r-text { color: var(--muted); margin: 0 0 14px; }
.r-stats { font-size: 17px; margin-bottom: 20px; }
.best { margin: 14px 0 0; color: var(--muted); font-size: 14px; }

/* loader */
#loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  z-index: 20;
  color: var(--muted);
}
#loader.hidden { display: none; }
.spinner {
  width: 38px; height: 38px;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
