/* Custom styles & animations for Team Building Game */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800;900&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  --font-display: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
}

body {
  font-family: var(--font-body);
}

h1, h2, h3, h4, .font-display {
  font-family: var(--font-display);
}

/* Custom glassmorphism styling */
.glass-panel {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.glass-panel-dark {
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Glow effects */
.glow-primary {
  box-shadow: 0 0 35px -5px rgba(239, 68, 68, 0.35);
}

.glow-gold {
  box-shadow: 0 0 35px -5px rgba(245, 158, 11, 0.45);
}

.glow-success {
  box-shadow: 0 0 35px -5px rgba(16, 185, 129, 0.35);
}

/* Racetrack & Turf container styling */
.racetrack-container {
  filter: drop-shadow(0 20px 30px rgba(6, 78, 59, 0.45));
}

.racetrack-turf {
  background: repeating-linear-gradient(
    0deg,
    #064e3b,
    #064e3b 30px,
    #065f46 30px,
    #065f46 60px
  );
}

/* ============================================================
   Fullscreen Race Canvas
   ============================================================ */

/* The canvas is always fixed, filling the entire viewport */
#race-canvas {
  position: fixed;
  inset: 0;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 0;
  display: block;
  opacity: 1;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

/* Brighter track while partants are announced one by one */
#race-canvas.race-canvas-intro {
  opacity: 1;
}

/* Full brightness while the race is actually running */
#race-canvas.race-canvas-racing {
  opacity: 1;
  pointer-events: none;
}

/* UI overlay that sits on top of the canvas */
#race-ui-overlay,
#projector-view,
#mobile-view {
  position: relative;
  z-index: 10;
  transition: opacity 0.4s ease;
}

#projector-view main,
#mobile-view main {
  position: relative;
  z-index: 20;
}

/* Ensure the UI for all game stages sits strictly above the canvas and any background overlay */
#section-splash,
#section-horse-intro,
#section-topic-challenge,
#section-passed-result,
#section-forfeits-voting {
  position: relative;
  z-index: 30;
}

#section-topic-challenge > *,
#section-forfeits-voting > *,
#section-passed-result > *,
#section-horse-intro > * {
  position: relative;
  z-index: 30;
}

/* Hide entire projector UI during the race */
.race-ui-hidden {
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 0.3s ease !important;
}

/* Needle animation */
@keyframes needleTick {
  0% { transform: rotate(0deg); }
  50% { transform: rotate(-15deg); }
  100% { transform: rotate(0deg); }
}

.needle-tick {
  animation: needleTick 0.1s ease-in-out;
}

/* Pulsing timer indicator */
@keyframes pulseDanger {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.85; }
}

.animate-pulse-danger {
  animation: pulseDanger 0.8s infinite ease-in-out;
}

/* Smooth transitions */
.transition-smooth {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Vote percentage bar transition */
.vote-bar-fill {
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb {
  background: rgba(156, 163, 175, 0.5);
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(107, 114, 128, 0.7);
}

/* Festive background */
.bg-festive-gradient {
  background: radial-gradient(circle at 10% 20%, rgba(220, 38, 38, 0.18) 0%, transparent 40%),
              radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.18) 0%, transparent 40%),
              radial-gradient(circle at 50% 50%, rgba(245, 158, 11, 0.08) 0%, transparent 60%),
              #0f172a;
}

/* ============================================================
   Pressure Vignette (Final 10 seconds of timer)
   ============================================================ */
.pressure-vignette {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
  background: radial-gradient(ellipse at center, transparent 35%, rgba(239, 68, 68, 0.35) 70%, rgba(220, 38, 38, 0.88) 100%);
  box-shadow: inset 0 0 100px 30px rgba(239, 68, 68, 0.85), inset 0 0 200px 80px rgba(185, 28, 28, 0.6);
  opacity: 0;
}

@keyframes pressureVignetteFlash {
  0% {
    opacity: 0.12;
    transform: scale(0.995);
  }
  25% {
    opacity: 1;
    transform: scale(1);
  }
  60% {
    opacity: 0.75;
  }
  100% {
    opacity: 0.12;
    transform: scale(0.995);
  }
}

.pressure-vignette.active {
  display: block !important;
  animation: pressureVignetteFlash 1s infinite cubic-bezier(0.4, 0, 0.2, 1);
}
