:root {
  --cam-bg: #000;
  --cam-text: #E5E7EB;
  --cam-accent: #FB923C;
  --cam-primary: #F87171;
  --cam-primary-hover: #EF4444;
  --cam-panel: rgba(17, 24, 39, 0.85);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* The intro/stage/review sections set display via their class rules, which
   would override the `hidden` attribute. Keep `hidden` authoritative so the
   JS show/hide logic works. */
[hidden] { display: none !important; }

.camera-page {
  background: var(--cam-bg);
  color: var(--cam-text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  min-height: 100vh;
  overflow: hidden;
}

/* Intro */
.intro { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; text-align: center; }
.intro__inner { max-width: 28rem; }
.intro h1 { font-size: 1.9rem; margin-bottom: 1rem; color: #F9FAFB; }
.intro p { margin-bottom: 1rem; line-height: 1.6; }
.intro__note { font-size: 0.9rem; color: #9CA3AF; }
.intro__error { color: var(--cam-primary); min-height: 1.5rem; margin-top: 1rem; }
.intro__back { display: inline-block; margin-top: 1.5rem; color: var(--cam-accent); }

/* Buttons */
.cam-btn { display: inline-flex; align-items: center; justify-content: center; padding: 0.8rem 1.6rem; font-size: 1rem; font-weight: 600; border: 1px solid #374151; border-radius: 8px; background: #111827; color: var(--cam-text); cursor: pointer; }
.cam-btn--primary { background: var(--cam-primary); border-color: var(--cam-primary); color: #fff; }
.cam-btn--primary:active { background: var(--cam-primary-hover); }
.cam-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 2.75rem; height: 2.75rem; border-radius: 50%; background: rgba(0,0,0,0.5); color: #fff; border: none; font-size: 1.4rem; text-decoration: none; cursor: pointer; }

/* Stage */
.stage { position: fixed; inset: 0; background: #000; }
.stage__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.stage__overlays { position: absolute; inset: 0; pointer-events: none; }
.stage__top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: calc(env(safe-area-inset-top) + 0.75rem) 0.75rem 0.75rem; }
.stage__bottom { position: absolute; bottom: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: center; padding: 0.75rem 0.75rem calc(env(safe-area-inset-bottom) + 1.25rem); }

.mode-switch { display: flex; background: rgba(0,0,0,0.5); border-radius: 999px; padding: 0.2rem; }
.mode-switch__btn { border: none; background: transparent; color: #fff; padding: 0.4rem 0.9rem; border-radius: 999px; font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.mode-switch__btn.is-active { background: var(--cam-primary); }

.shutter { width: 4.5rem; height: 4.5rem; border-radius: 50%; background: #fff; border: 4px solid rgba(255,255,255,0.5); cursor: pointer; }
.shutter:active { transform: scale(0.94); }

.mode-panel { position: absolute; left: 0; right: 0; bottom: 6.5rem; padding: 0 0.75rem; }

/* Review */
.review { position: fixed; inset: 0; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1rem; gap: 1rem; }
.review__img { max-width: 100%; max-height: 72vh; border-radius: 8px; }
.review__actions { display: flex; gap: 1rem; }
.review__hint { color: #9CA3AF; font-size: 0.9rem; text-align: center; }
/* 'fill' stretches the frame to the viewport exactly as capture.js stretches
   it onto the saved canvas, so the live preview matches the saved photo. */
.booth-frame-overlay { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; }
.booth-frames { display: flex; gap: 0.5rem; overflow-x: auto; padding: 0.5rem; background: var(--cam-panel); border-radius: 10px; margin-bottom: 0.5rem; }
.booth-chip { flex: 0 0 auto; padding: 0.5rem 0.9rem; border-radius: 999px; border: 1px solid #374151; background: #111827; color: #fff; font-size: 0.85rem; cursor: pointer; }
.booth-chip[aria-pressed="true"] { background: var(--cam-accent); border-color: var(--cam-accent); color: #111; }

.hunt-detector { background: var(--cam-panel); border-radius: 10px; padding: 0.75rem 1rem; }
.hunt-meter { height: 0.6rem; background: rgba(255,255,255,0.15); border-radius: 999px; overflow: hidden; }
.hunt-meter__fill { height: 100%; width: 0%; background: linear-gradient(90deg, #60A5FA, var(--cam-accent), var(--cam-primary)); transition: width 0.4s ease; }
.hunt-status { margin-top: 0.5rem; font-size: 0.9rem; text-align: center; }

.ghost-sprite {
  position: absolute;
  width: 40%;
  transform: translate(-50%, -50%) scale(var(--scale, 1));
  pointer-events: none;
  filter: drop-shadow(0 0 12px rgba(180, 220, 255, 0.5));
  animation: ghost-bob 3s ease-in-out infinite, ghost-flicker 2.4s ease-in-out infinite;
}

@keyframes ghost-bob {
  0%, 100% { margin-top: -0.6rem; }
  50% { margin-top: 0.6rem; }
}

@keyframes ghost-flicker {
  0%, 100% { opacity: 0.92; }
  50% { opacity: 0.7; }
}

.ghost-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.6);
  color: #fff;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  font-size: 0.85rem;
}
