/* Vendored locally (assets/fonts) instead of linking fonts.googleapis.com, so the game keeps
   working even if Google Fonts is ever unreachable or blocked. */
@font-face {
  font-family: "Jua";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/Jua-Regular.ttf") format("truetype");
}

/* Single source of truth for every color and font the game uses — both here and on canvas.
   theme.js reads these same custom properties at startup so canvas-drawn text/shapes (game.js,
   tutorial.js, reloadIndicator.js, ammoHud.js, gesture.js) never hardcode a color or font of
   their own; this file is the only place a value like "the danger red" or "the game font" is
   actually written down. */
:root {
  --font-game: "Jua", sans-serif;

  --color-sky: #cfeaf6; /* fallback page background before the canvas paints its first frame */
  --color-black: #0a0a12; /* dark text on bright (green) buttons */
  --color-white: #ffffff;

  --color-success: #2dff8c; /* tracking / extended finger / positive state */
  --color-success-glow: rgba(45, 255, 140, 0.6);
  --color-success-glow-rest: rgba(0, 255, 120, 0); /* same glow, fully transparent at rest */
  --color-danger: #ff5566; /* searching / curled finger / warnings / out-of-ammo */
  --color-warning: #ffd23f; /* reload progress ring / hold-to-capture ring */
  --color-fist: #ffaa33; /* fisted palm indicator */
  --color-miss-ring: rgb(200, 200, 200); /* neutral "shot missed" ring */
  --color-neutral: #888888; /* untracked bone (thumb/palm) */
  --color-neutral-light: #dddddd; /* hand landmark dots */
  --color-neutral-dim: #999999; /* thumb tip (no extended state) */

  --color-webcam-bg: #000000;
  --color-webcam-border: #555555;

  --color-cream: #f4e6c9; /* popup + ammo panel background */
  --color-cream-border: #b8935a; /* popup + ammo panel border */
  --color-cream-text: #4a3520; /* popup body text */
  --color-cream-heading: #6b4a1f; /* popup headings, hover border */
  --color-cream-muted: #7a6244; /* splash hint text */
  --color-cream-live: #8a5a20; /* calibration live readout */
  --color-cream-btn-bg: rgba(255, 255, 255, 0.55);
  --color-cream-btn-bg-hover: rgba(255, 255, 255, 0.8);
  --color-ammo-empty-ring: rgba(120, 90, 50, 0.55);
  --color-ammo-pulse-rgb: 255, 70, 70; /* channel list — JS composes rgba(var, alpha) for the pulse */

  --overlay-scrim: rgba(0, 0, 0, 0.55); /* paused overlay / status chip / tutorial pause */
  --overlay-scrim-strong: rgba(0, 0, 0, 0.65); /* round-end overlay */
  --overlay-hairline: rgba(255, 255, 255, 0.25); /* reload ring track */
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  /* Matches the sky in backgroundEmpty.png (the gallery scene painted on #aim-canvas once assets
     load) so the instant of parsing this stylesheet — before the canvas has drawn a single frame —
     never shows a bare black page underneath the camera-gate popup. */
  background: var(--color-sky);
  font-family: var(--font-game);
  font-weight: 400;
  font-style: normal;
}

#aim-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 55;
  /* Nothing ever listens for clicks on this canvas — aiming/firing is all hand-tracking driven —
     so it must never intercept pointer events, or it would silently block clicks on any DOM UI
     drawn beneath it. */
  pointer-events: none;
}

#reticle-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  /* Above every popup (56) so the reticle is always visible over pause/tutorial-complete
     buttons — see reticle.js for why this has to be a separate canvas from #aim-canvas rather
     than just drawn last on it. */
  z-index: 57;
  pointer-events: none;
}

#webcam-container {
  position: fixed;
  bottom: 16px;
  right: 16px;
  width: 240px;
  height: 180px;
  z-index: 60;
  border-radius: 10px;
  overflow: hidden;
  background: var(--color-webcam-bg);
  border: 3px solid var(--color-webcam-border);
  box-shadow: 0 0 0 var(--color-success-glow-rest);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#webcam-container.tracking {
  border-color: var(--color-success);
  box-shadow: 0 0 16px var(--color-success-glow);
}

#webcam-container.searching {
  border-color: var(--color-danger);
}

#webcam,
#webcam-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: scaleX(-1); /* mirror for a natural selfie view */
}

#status {
  position: absolute;
  bottom: 4px;
  left: 4px;
  color: var(--color-white);
  font-size: 13px;
  background: var(--overlay-scrim);
  padding: 2px 6px;
  border-radius: 4px;
}

#calibration-title {
  margin: 0 0 12px;
  font-size: 22px;
}

#calibration-instruction {
  margin: 0 0 16px;
  font-size: 17px;
  line-height: 1.5;
}

#calibration-live {
  margin-bottom: 20px;
  font-size: 16px;
  color: var(--color-cream-live);
}

#calibration-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

#calibration-capture-btn {
  color: var(--color-black);
}

#camera-gate-status {
  margin: 0 0 16px;
  font-size: 17px;
  line-height: 1.5;
}

#camera-gate-retry-btn {
  margin-top: 4px;
  color: var(--color-black);
  background: var(--color-success);
  border-color: var(--color-success);
}

#camera-gate-retry-btn.hidden {
  display: none;
}

/* Shared shape for every floating popup (splash menu, calibration, pause menu, tutorial
   complete) — same cream/tan palette as the in-game ammo indicator (ammoHud.js), so the whole
   game reads as one visual system instead of a patchwork of dark modal styles. Centered directly
   via fixed positioning rather than a full-screen dimming wrapper, so each one reads as a popup
   over the still-visible stage (gallery backdrop, dimmed paused game, etc.), not a screen swap. */
.cream-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  /* Above the aim-canvas (55), below the reticle (57) — see reticle.js for why the reticle needs
     its own layer to render over popups like this one. */
  z-index: 56;
  width: min(420px, 90vw);
  padding: 28px 32px;
  background: var(--color-cream);
  border: 3px solid var(--color-cream-border);
  border-radius: 10px;
  color: var(--color-cream-text);
  text-align: center;
}

.cream-popup.hidden {
  display: none;
}

.cream-popup h1,
.cream-popup h2 {
  margin: 0 0 20px;
  color: var(--color-cream-heading);
}

#splash-screen h1 {
  margin: 0 0 8px;
  font-size: 38px;
}

#splash-highscore {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: bold;
  color: var(--color-cream-heading);
}

#splash-highscore.hidden {
  display: none;
}

.splash-hint {
  margin: 0 0 24px;
  font-size: 16px;
  color: var(--color-cream-muted);
}

#tutorial-complete-box {
  width: min(320px, 90vw);
}

#pause-menu-box,
#round-end-box,
#difficulty-select-box {
  width: min(360px, 90vw);
}

#round-end-score {
  margin: 0 0 4px;
  font-size: 18px;
}

#round-end-highscore {
  margin: 0 0 20px;
  font-size: 16px;
  color: var(--color-cream-muted);
}

#splash-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.splash-btn {
  padding: 14px 20px;
  font-size: 22px;
  color: var(--color-cream-text);
  background: var(--color-cream-btn-bg);
  border: 1px solid var(--color-cream-border);
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font-game);
}

.splash-btn:hover {
  border-color: var(--color-cream-heading);
  background: var(--color-cream-btn-bg-hover);
}

/* Shared row layout for a popup's button pair (pause menu, round-end box) — not .splash-buttons'
   stacked column, these sit side by side. */
.popup-btn-row {
  display: flex;
  gap: 12px;
}

.popup-btn-row .splash-btn {
  flex: 1;
  padding: 12px 16px;
  font-size: 18px;
}
