/* ── Polymorf Booth ── */
:root {
  --bg-dark: #0a0a0f;
  --accent: #7c3aed;
  --accent-glow: rgba(124, 58, 237, 0.5);
  --accent-light: #a78bfa;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --danger: #ef4444;
  --success: #22c55e;
}

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

body {
  background: var(--bg-dark);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  cursor: none;
}

/* Hidden elements */
#camera-a, #camera-b { display: none; }
#composite-canvas { display: none; }

/* Main display */
#display-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ── Overlays ── */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.overlay--active {
  opacity: 1;
  pointer-events: auto;
}

/* ── Idle / Attract ── */
.idle-content {
  text-align: center;
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.idle-title {
  font-size: 5rem;
  font-weight: 900;
  letter-spacing: 0.2em;
  background: linear-gradient(135deg, #7c3aed, #a78bfa, #c4b5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 40px var(--accent-glow));
  animation: pulse-glow 3s ease-in-out infinite;
}

.idle-subtitle {
  font-size: 1.5rem;
  color: var(--text-muted);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-top: 0.5rem;
  animation: fade-pulse 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { filter: drop-shadow(0 0 40px var(--accent-glow)); }
  50% { filter: drop-shadow(0 0 60px rgba(124, 58, 237, 0.8)); }
}

@keyframes fade-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* Reticle indicators */
.idle-reticle {
  position: absolute;
  width: 200px;
  height: 200px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.4;
  animation: reticle-breathe 2.5s ease-in-out infinite;
}
.idle-reticle span {
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-light);
}
.idle-reticle--left { left: 15%; }
.idle-reticle--right { right: 15%; }

.idle-reticle::before,
.idle-reticle::after {
  content: '';
  position: absolute;
  background: var(--accent);
}
.idle-reticle::before {
  width: 30px; height: 2px;
  top: 50%; left: -15px;
}
.idle-reticle::after {
  width: 2px; height: 30px;
  left: 50%; top: -15px;
}

@keyframes reticle-breathe {
  0%, 100% { opacity: 0.3; transform: translateY(-50%) scale(0.95); }
  50% { opacity: 0.6; transform: translateY(-50%) scale(1.05); }
}

/* ── Countdown ── */
.countdown-ring {
  width: 250px;
  height: 250px;
  border-radius: 50%;
  border: 4px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 60px var(--accent-glow), inset 0 0 40px var(--accent-glow);
  animation: countdown-pulse 1s ease-in-out infinite;
}

#countdown-number {
  font-size: 8rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 40px var(--accent-glow);
}

@keyframes countdown-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* ── Processing ── */
.processing-content { text-align: center; }

.spinner {
  width: 80px;
  height: 80px;
  border: 4px solid rgba(124, 58, 237, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1.5rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

.processing-text {
  font-size: 1.5rem;
  color: var(--accent-light);
  letter-spacing: 0.1em;
  animation: fade-pulse 1.5s ease-in-out infinite;
}

/* ── Reveal ── */
.reveal-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

#reveal-image {
  max-width: 70vw;
  max-height: 60vh;
  border-radius: 12px;
  border: 2px solid var(--accent);
  box-shadow: 0 0 40px var(--accent-glow);
}

#reveal-qr {
  background: #fff;
  padding: 12px;
  border-radius: 8px;
}
#reveal-qr img {
  width: 180px;
  height: 180px;
}

.reveal-hint {
  color: var(--text-muted);
  font-size: 1.1rem;
  letter-spacing: 0.1em;
}

.reveal-cooldown {
  width: 300px;
  height: 4px;
  background: rgba(124, 58, 237, 0.2);
  border-radius: 2px;
  overflow: hidden;
}

.cooldown-bar {
  height: 100%;
  width: 100%;
  background: var(--accent);
  transform-origin: left;
  transition: transform linear;
}

/* ── Error ── */
.error-content { text-align: center; }

.error-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid var(--danger);
  color: var(--danger);
  font-size: 3rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

#error-message {
  font-size: 1.3rem;
  color: var(--danger);
  margin-bottom: 0.5rem;
}

.error-hint { color: var(--text-muted); }

/* ── Face Indicators ── */
#face-indicators {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.face-indicator {
  position: absolute;
  border: 2px solid var(--accent);
  border-radius: 4px;
  box-shadow: 0 0 15px var(--accent-glow);
  transition: all 0.1s ease;
}

.face-indicator--locked {
  border-color: var(--success);
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.5);
}

.face-indicator__label {
  position: absolute;
  top: -22px;
  left: 0;
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent-light);
  white-space: nowrap;
}

.face-indicator--locked .face-indicator__label {
  color: var(--success);
}

/* Corner brackets on face indicators */
.face-indicator::before,
.face-indicator::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border-color: inherit;
  border-style: solid;
}
.face-indicator::before {
  top: -1px; left: -1px;
  border-width: 2px 0 0 2px;
}
.face-indicator::after {
  bottom: -1px; right: -1px;
  border-width: 0 2px 2px 0;
}

/* ── Status Bar ── */
#status-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: rgba(10, 10, 15, 0.8);
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: monospace;
}
