/* ==========================================================================
   PAPA SQUID: MEME MAYHEM — GAMEPLAY & HUD STYLESHEET
   WebGL Canvas, HUD Overlays, Touch Controls, Mode States, Victory/Defeat
   ========================================================================== */

#screen-game {
  padding: 0 !important;
  height: calc(100vh - 72px);
  height: calc(100dvh - 72px);
  min-height: 420px;
  position: relative;
  overflow: hidden;
  background: #0B0B17;
}

#game-canvas-container {
  width: 100%;
  height: 100%;
  min-height: 0;
  position: relative;
}

#game-canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
  outline: none;
}

/* Top HUD Bar */
.game-hud-top {
  position: absolute;
  top: 16px;
  left: 20px;
  right: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 50;
  pointer-events: none;
}

.game-hud-top > * {
  pointer-events: auto;
}

.hud-pill {
  background: rgba(21, 21, 42, 0.88);
  border: 3px solid var(--navy-border);
  border-radius: 999px;
  padding: 0.4rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--white);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.hud-timer {
  border-color: var(--sky-blue);
  font-size: 1.25rem;
}

.hud-timer.urgent {
  border-color: var(--meme-coral);
  color: #FFA590;
  animation: urgentBeat 0.6s infinite alternate;
}

@keyframes urgentBeat {
  0% { transform: scale(1); }
  100% { transform: scale(1.08); }
}

.hud-coins {
  border-color: #FBBF24;
  color: #FEF08A;
  font-size: 1.15rem;
}

.hud-progress-wrap {
  flex: 1;
  max-width: 380px;
  margin: 0 1rem;
}

/* Red Light / Green Light Banner Indicator */
.red-green-indicator-box {
  position: absolute;
  top: 75px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  pointer-events: none;
  text-align: center;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.traffic-pill {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.5rem;
  padding: 0.65rem 2.2rem;
  border-radius: 999px;
  letter-spacing: 1px;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-transform: uppercase;
  border: 4px solid #FFFFFF;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
}

.traffic-pill.green-light {
  background: linear-gradient(180deg, #84CC16 0%, #4D7C0F 100%);
  color: #FFFFFF;
  border-color: var(--lime-pop);
  box-shadow: 0 0 35px rgba(132, 204, 22, 0.7);
}

.traffic-pill.red-light {
  background: linear-gradient(180deg, #EF4444 0%, #991B1B 100%);
  color: #FFFFFF;
  border-color: #F87171;
  box-shadow: 0 0 45px rgba(239, 68, 68, 0.9);
  animation: redAlarm 0.4s infinite alternate;
}

@keyframes redAlarm {
  0% { transform: scale(1); filter: drop-shadow(0 0 10px #EF4444); }
  100% { transform: scale(1.05); filter: drop-shadow(0 0 25px #DC2626); }
}

/* Glass Bridge Status HUD */
.glass-bridge-hud {
  position: absolute;
  top: 75px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  pointer-events: none;
}

/* Meme Obstacle Rush HUD */
.rush-hud-status {
  position: absolute;
  top: 75px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  pointer-events: none;
}

/* Bottom Controls Dock */
.game-hud-bottom {
  position: absolute;
  bottom: 20px;
  left: 20px;
  right: 20px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  z-index: 50;
  pointer-events: none;
}

.game-hud-bottom > * {
  pointer-events: auto;
}

/* Virtual Joystick */
.virtual-joystick-base {
  width: 120px;
  height: 120px;
  background: rgba(32, 32, 68, 0.6);
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  position: relative;
  touch-action: none;
  display: none; /* enabled on touch screens / mobile */
}

.virtual-joystick-base,
.btn-action-touch {
  user-select: none;
  -webkit-user-select: none;
}

.virtual-joystick-thumb {
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, var(--squid-purple) 0%, var(--meme-coral) 100%);
  border: 2px solid var(--white);
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

/* Action Buttons (Jump / Slide) */
.action-buttons-wrap {
  display: none;
  gap: 1rem;
}

.btn-action-touch {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px solid #FFFFFF;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  transition: transform 0.1s;
}

.btn-action-touch:active {
  transform: scale(0.92);
}

.btn-action-jump {
  background: linear-gradient(180deg, #10B981 0%, #047857 100%);
}

.btn-action-slide {
  background: linear-gradient(180deg, #F59E0B 0%, #B45309 100%);
}

/* Desktop Keybind Hints Dock */
.desktop-controls-hint {
  background: rgba(21, 21, 42, 0.85);
  border: 2px solid var(--navy-border);
  border-radius: 14px;
  padding: 0.45rem 1rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.key-pill {
  background: #2E2E5B;
  border: 1px solid #4B4B8B;
  color: var(--white);
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  font-family: monospace;
}

/* Ready-Go Countdown Screen */
.countdown-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.4);
}

.countdown-number {
  font-family: var(--font-heading);
  font-size: 6rem;
  font-weight: 800;
  color: var(--lime-pop);
  text-shadow: 0 0 30px rgba(199, 244, 100, 0.8), 4px 4px 0 #1A1A32;
  animation: countPop 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) infinite;
}

@keyframes countPop {
  0% { transform: scale(0.5); opacity: 0; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 0.9; }
}

/* Victory Screen Modal Enhancements */
.victory-trophy-icon {
  font-size: 5rem;
  color: #FBBF24;
  text-align: center;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 0 25px rgba(251, 191, 36, 0.6));
  animation: floatTrophy 2s ease-in-out infinite;
}

@keyframes floatTrophy {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(4deg); }
}

.star-rating-row {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  font-size: 2.2rem;
  color: #FCD34D;
  margin: 0.5rem 0 1.25rem;
}

.reward-stat-box {
  background: var(--navy-card);
  border: 2px solid var(--navy-border);
  border-radius: 16px;
  padding: 0.75rem 1rem;
  text-align: center;
}

/* Defeat Screen Modal Enhancements */
.defeat-skull-icon {
  font-size: 5rem;
  color: var(--meme-coral);
  text-align: center;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 0 25px rgba(255, 107, 74, 0.6));
  animation: wobbleSkull 1.5s ease-in-out infinite;
}

@keyframes wobbleSkull {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-8deg); }
  75% { transform: rotate(8deg); }
}
