/* ==========================================================================
   Snake Games CMS — 3D Game & Cinematic HUD Stylesheet (game.css)
   ========================================================================== */

/* Game Stage Cinema Frame */
.game-viewport-card {
  position: relative;
  width: 100%;
  max-width: 1040px;
  margin: 0 auto 32px;
  background: #060911;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: box-shadow var(--transition-base), border-color var(--transition-base);
}

.game-viewport-card:hover {
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 45px rgba(16, 185, 129, 0.35);
  border-color: rgba(16, 185, 129, 0.4);
}

/* Aspect Ratio Container (16:10 Desktop, Adaptive Mobile) */
.canvas-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  min-height: 480px;
  background: #030712;
}

@media (max-width: 768px) {
  .canvas-wrapper {
    aspect-ratio: 4 / 5;
    min-height: 420px;
  }
}

#webgl-canvas {
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
  cursor: grab;
}

#webgl-canvas:active {
  cursor: grabbing;
}

/* 2D Fallback Canvas */
#lite-canvas {
  display: none;
  width: 100%;
  height: 100%;
  background: #0B0F19;
}

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

.hud-chip-group {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}

.hud-glass-chip {
  background: rgba(11, 15, 25, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.hud-score-val {
  font-size: 1.25rem;
  font-weight: 800;
  color: #34D399;
  font-family: var(--font-mono);
  min-width: 44px;
}

.hud-hi-score-val {
  color: #FBBF24;
  font-family: var(--font-mono);
}

.hud-btn {
  background: rgba(11, 15, 25, 0.75);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  transition: all var(--transition-fast);
}

.hud-btn:hover {
  background: rgba(16, 185, 129, 0.3);
  border-color: #10B981;
  transform: scale(1.05);
}

/* AI Standings Chip */
.ai-standings-chip {
  display: none;
  font-size: 0.8rem;
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  color: #E2E8F0;
}

.ai-standings-chip.visible {
  display: block;
}

/* Start Screen Overlay (Attract Mode Runs Live Behind This!) */
.game-overlay-screen {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(11, 15, 25, 0.45) 0%, rgba(6, 9, 17, 0.85) 100%);
  backdrop-filter: blur(2px);
  padding: 24px;
  text-align: center;
  transition: opacity 0.4s ease, visibility 0.4s;
}

.game-overlay-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.start-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-full);
  padding: 6px 16px;
  color: #34D399;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}

.start-title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.03em;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
  margin-bottom: 8px;
}

.start-tagline {
  color: #94A3B8;
  font-size: 1rem;
  max-width: 480px;
  margin: 0 auto 28px;
}

/* Pulsing Start CTA Button */
.btn-start-game {
  padding: 16px 44px;
  font-size: 1.25rem;
  font-weight: 800;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #10B981, #059669);
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 35px rgba(16, 185, 129, 0.6), 0 8px 24px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  transition: all 0.25s ease;
  animation: startPulse 2s infinite;
}

@keyframes startPulse {
  0% { transform: scale(1); box-shadow: 0 0 25px rgba(16, 185, 129, 0.5); }
  50% { transform: scale(1.05); box-shadow: 0 0 45px rgba(16, 185, 129, 0.85); }
  100% { transform: scale(1); box-shadow: 0 0 25px rgba(16, 185, 129, 0.5); }
}

.btn-start-game:hover {
  transform: scale(1.08) translateY(-2px);
  animation: none;
}

/* 3-2-1-GO! Countdown Overlay */
.countdown-overlay {
  position: absolute;
  inset: 0;
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}

.countdown-overlay.active {
  opacity: 1;
  visibility: visible;
}

.countdown-number {
  font-size: 6rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 40px #10B981;
  animation: countPop 0.8s ease-out;
}

@keyframes countPop {
  0% { transform: scale(0.4); opacity: 0; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(1); opacity: 0; }
}

/* First-Time Animated 3D Tutorial Overlay */
.tutorial-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: none;
  flex-direction: column;
  justify-content: space-between;
  padding: 32px;
  pointer-events: auto;
  background: rgba(5, 8, 15, 0.45);
}

.tutorial-overlay.active {
  display: flex;
}

.tutorial-card {
  align-self: center;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: var(--radius-lg);
  padding: 20px 28px;
  max-width: 480px;
  text-align: center;
  color: #fff;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.6);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.tutorial-caption {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: #34D399;
}

.tutorial-sub {
  font-size: 0.9rem;
  color: #CBD5E1;
}

.tutorial-hand-anim {
  width: 56px;
  height: 56px;
  margin: 12px auto;
  animation: handSwipe 1.5s infinite ease-in-out;
}

@keyframes handSwipe {
  0%, 100% { transform: translateX(-30px); }
  50% { transform: translateX(30px); }
}

/* Controls Hint Strip Below Canvas */
.game-controls-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.controls-hint {
  display: flex;
  align-items: center;
  gap: 14px;
}

.key-badge {
  display: inline-block;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-main);
  box-shadow: 0 2px 0 var(--border);
}

.game-selectors {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Game Over Modal */
.game-over-stats {
  margin: 20px 0;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-val-highlight {
  font-weight: 800;
  color: var(--primary);
  font-size: 1.25rem;
  font-family: var(--font-mono);
}

/* Virtual Mobile D-Pad (Touch Devices) */
.mobile-dpad {
  display: none;
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 156px;
  height: 156px;
  z-index: 35;
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

@media (pointer: coarse), (max-width: 768px) {
  .mobile-dpad.visible,
  .game-viewport-card.is-focused-popup .mobile-dpad {
    display: block;
  }
}

.dpad-btn {
  position: absolute;
  width: 50px;
  height: 50px;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  border-radius: 14px;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  font-weight: 900;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  transition: transform 0.08s ease, background 0.08s ease, border-color 0.08s ease;
}

.dpad-btn:active, .dpad-btn.pressed {
  background: #4A752C;
  border-color: #84CC16;
  color: #FFFFFF;
  transform: scale(0.92);
  box-shadow: 0 0 16px rgba(132, 204, 22, 0.6);
}

.dpad-up { top: 0; left: 53px; }
.dpad-down { bottom: 0; left: 53px; }
.dpad-left { top: 53px; left: 0; }
.dpad-right { top: 53px; right: 0; }

/* ==========================================================================
   Google Snake & snake-game.io Dedicated UI Styles
   ========================================================================== */

/* Top Scoreboard Bar */
.google-snake-topbar {
  background: #4A752C;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  color: #FFFFFF;
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 700;
  user-select: none;
}

.google-snake-scores {
  display: flex;
  align-items: center;
  gap: 18px;
}

.google-score-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.15rem;
}

.google-score-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.google-score-num {
  font-family: var(--font-mono, monospace);
  font-weight: 800;
  font-size: 1.3rem;
  color: #FFFFFF;
  min-width: 24px;
}

.google-snake-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.google-action-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.google-action-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.08);
}

.google-action-btn:active {
  transform: scale(0.95);
}

/* Board Wrapper */
.google-snake-board {
  background: #578A34;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
  padding: 0;
  min-height: 480px;
}

@media (max-width: 768px) {
  .google-snake-board {
    min-height: 360px;
  }
}

/* Mode Chips Strip (Matches snake-game.io) */
.google-snake-mode-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 18px auto 0;
  max-width: 1040px;
  padding: 0 12px;
}

.mode-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 18px;
  background: #1E293B;
  border: 1px solid #334155;
  color: #CBD5E1;
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.15s ease;
  user-select: none;
}

.mode-chip:hover {
  background: #33401A;
  border-color: #6B8A2E;
  color: #FFFFFF;
  transform: translateY(-1px);
}

.mode-chip.is-current {
  background: #4A752C;
  border-color: #689F38;
  color: #FFFFFF;
  box-shadow: 0 0 14px rgba(74, 117, 44, 0.6);
}

.mode-chip-icon {
  font-size: 1rem;
}

/* Google Snake Settings Modal */
.google-snake-settings-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.google-snake-settings-modal.open {
  display: flex;
}

.settings-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.settings-modal-card {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 480px;
  background: #1E293B;
  border: 1px solid #334155;
  border-radius: 16px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
  color: #FFFFFF;
  overflow: hidden;
  animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #334155;
  background: #0F172A;
}

.settings-header h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.settings-close-btn {
  background: none;
  border: none;
  color: #94A3B8;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.settings-close-btn:hover {
  color: #FFFFFF;
}

.settings-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: 70vh;
  overflow-y: auto;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: #94A3B8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.settings-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.opt-btn {
  background: #0F172A;
  border: 1px solid #334155;
  color: #E2E8F0;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 1.25rem;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
}

.opt-btn.text-btn {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 8px 14px;
}

.opt-btn:hover {
  border-color: #4A752C;
  background: #1E3A1A;
}

.opt-btn.active {
  background: #4A752C;
  border-color: #689F38;
  color: #FFFFFF;
  box-shadow: 0 0 10px rgba(74, 117, 44, 0.5);
}

.color-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.color-btn:hover {
  transform: scale(1.15);
}

.color-btn.active {
  border-color: #FFFFFF;
  transform: scale(1.18);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.5);
}

.rainbow-btn {
  background: linear-gradient(135deg, red, orange, yellow, green, blue, purple) !important;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.settings-footer {
  padding: 14px 20px;
  border-top: 1px solid #334155;
  background: #0F172A;
  text-align: right;
}

.settings-done-btn {
  background: #4A752C;
  border-color: #689F38;
  color: #fff;
  padding: 8px 22px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
}

.settings-done-btn:hover {
  background: #5A8F35;
}

/* ==========================================================================
   Focused Popup Game Mode & Mobile UX Enhancements
   ========================================================================== */
body.game-popup-active {
  overflow: hidden !important;
  touch-action: none !important;
}

.google-focus-close-btn {
  background: #E11D48;
  color: #FFFFFF;
  border: none;
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 800;
  font-size: 0.85rem;
  font-family: 'Nunito', sans-serif;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(225, 29, 72, 0.4);
  transition: transform 0.15s ease, background 0.15s ease;
  user-select: none;
  white-space: nowrap;
}

.google-focus-close-btn:hover {
  background: #BE123C;
  transform: scale(1.05);
}

.google-focus-close-btn:active {
  transform: scale(0.95);
}

/* When elevated into focused popup mode */
.game-viewport-card.is-focused-popup {
  position: fixed !important;
  inset: 0 !important;
  z-index: 99999 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  margin: 0 !important;
  border-radius: 0 !important;
  border: none !important;
  background: #060A12 !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  box-shadow: none !important;
  overflow: hidden !important;
  animation: popupFadeScale 0.15s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes popupFadeScale {
  from {
    opacity: 0.9;
    transform: scale(0.995);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.game-viewport-card.is-focused-popup .google-snake-topbar {
  flex-shrink: 0 !important;
  min-height: 44px !important;
  height: 44px !important;
  padding: max(4px, env(safe-area-inset-top, 4px)) 12px 4px !important;
  z-index: 20 !important;
  background: #4A752C !important;
  border-bottom: 2px solid rgba(0, 0, 0, 0.15) !important;
}

.game-viewport-card.is-focused-popup .google-snake-board {
  flex: 1 1 auto !important;
  width: 100vw !important;
  height: 100% !important;
  min-height: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative !important;
  padding: 0 !important;
  margin: 0 !important;
  background: #578A34 !important;
  overflow: hidden !important;
  touch-action: none !important;
}

.game-viewport-card.is-focused-popup canvas#webgl-canvas {
  max-width: 100vw !important;
  touch-action: none !important;
  display: block !important;
  margin: 0 auto !important;
}

.game-viewport-card.is-focused-popup .game-controls-strip {
  display: none !important;
}

/* Game mode strip inside popup: Docked at absolute bottom */
.game-viewport-card.is-focused-popup .google-snake-mode-strip {
  display: flex !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  gap: 8px !important;
  padding: 6px 12px max(6px, env(safe-area-inset-bottom, 6px)) !important;
  margin: 0 !important;
  width: 100vw !important;
  max-width: 100vw !important;
  min-height: 48px !important;
  height: 48px !important;
  justify-content: flex-start !important;
  scrollbar-width: none !important;
  flex-shrink: 0 !important;
  order: 99 !important;
  margin-top: auto !important;
  background: rgba(11, 19, 43, 0.98) !important;
  border-top: 1.5px solid rgba(16, 185, 129, 0.35) !important;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.6) !important;
  touch-action: pan-x !important;
  -webkit-touch-callout: none !important;
  user-select: none !important;
  z-index: 50 !important;
}

.game-viewport-card.is-focused-popup .google-snake-mode-strip::-webkit-scrollbar {
  display: none !important;
}

.game-viewport-card.is-focused-popup .mode-chip {
  height: 36px !important;
  padding: 0 14px !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  flex-shrink: 0 !important;
  border-radius: 18px !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  color: #E2E8F0 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  cursor: pointer !important;
  touch-action: manipulation !important;
  -webkit-tap-highlight-color: transparent !important;
  transition: all 0.15s ease !important;
}

.game-viewport-card.is-focused-popup .mode-chip.is-current {
  background: linear-gradient(135deg, #10B981, #059669) !important;
  border-color: #34D399 !important;
  color: #FFFFFF !important;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.5) !important;
}

/* User requirement: In mobile fullscreen popup mode, HIDE the 4 D-Pad buttons completely! */
.game-viewport-card.is-focused-popup .mobile-dpad {
  display: none !important;
}

/* ==========================================================================
   Game Over Modal — Reliable Display On Every Death
   ========================================================================== */
#game-over-modal {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 999999 !important;
  background: rgba(3, 7, 18, 0.88) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  display: none !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 16px !important;
  box-sizing: border-box !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transition: opacity 0.2s ease, visibility 0.2s ease !important;
}

#game-over-modal.open {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

#game-over-modal .modal-card {
  position: relative !important;
  z-index: 1000000 !important;
  background: #0F172A !important;
  border: 1.5px solid rgba(16, 185, 129, 0.45) !important;
  border-radius: 20px !important;
  max-width: 380px !important;
  width: 90% !important;
  max-height: 90vh !important;
  overflow-y: auto !important;
  padding: 24px 20px !important;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85), 0 0 35px rgba(16, 185, 129, 0.3) !important;
  text-align: center !important;
  animation: gameOverModalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

@keyframes gameOverModalPop {
  0% { transform: scale(0.88) translateY(16px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

#game-over-modal .game-over-stats {
  background: rgba(15, 23, 42, 0.7) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 14px !important;
  padding: 12px 16px !important;
  margin: 16px 0 20px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
}

#game-over-modal .stat-row {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  font-size: 0.92rem !important;
  color: #94A3B8 !important;
}

#game-over-modal .stat-val-highlight {
  font-size: 1.3rem !important;
  font-weight: 800 !important;
  color: #34D399 !important;
  font-family: var(--font-mono, monospace) !important;
}

#game-over-modal #btn-play-again {
  background: linear-gradient(135deg, #10B981, #059669) !important;
  color: #fff !important;
  font-weight: 800 !important;
  border: none !important;
  border-radius: 12px !important;
  padding: 12px 18px !important;
  font-size: 1rem !important;
  cursor: pointer !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4) !important;
  transition: all 0.15s ease !important;
}

#game-over-modal #btn-play-again:hover,
#game-over-modal #btn-play-again:active {
  transform: translateY(-1px) scale(1.02) !important;
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.5) !important;
}

#game-over-modal #btn-share-score {
  background: rgba(30, 41, 59, 0.9) !important;
  color: #F8FAFC !important;
  font-weight: 800 !important;
  border: 1.5px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 12px !important;
  padding: 12px 18px !important;
  font-size: 1rem !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
}

#game-over-modal #btn-share-score:hover,
#game-over-modal #btn-share-score:active {
  background: rgba(51, 65, 85, 0.9) !important;
  border-color: #38BDF8 !important;
  color: #38BDF8 !important;
  transform: translateY(-1px) scale(1.02) !important;
}

/* ==========================================================================
   Swipe Gesture Guide / Tutorial Overlay
   ========================================================================== */
.swipe-tutorial-overlay {
  position: absolute;
  inset: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 10, 18, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  pointer-events: none;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.swipe-tutorial-overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.swipe-tutorial-card {
  background: rgba(15, 23, 42, 0.95);
  border: 1.5px solid rgba(16, 185, 129, 0.45);
  border-radius: 20px;
  padding: 22px 24px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 25px rgba(16, 185, 129, 0.35);
  max-width: 280px;
  animation: tutorialPulse 2.2s infinite ease-in-out;
}

@keyframes tutorialPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

.swipe-hand-anim {
  width: 68px;
  height: 68px;
  margin: 0 auto 12px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 185, 129, 0.15);
  border-radius: 50%;
  border: 1.5px solid rgba(52, 211, 153, 0.4);
}

.swipe-hand {
  font-size: 32px;
  display: inline-block;
  animation: swipeHandMotion 2.4s infinite ease-in-out;
}

@keyframes swipeHandMotion {
  0% { transform: translate(0, 0); }
  25% { transform: translate(18px, 0); }
  50% { transform: translate(0, -18px); }
  75% { transform: translate(-18px, 0); }
  100% { transform: translate(0, 0); }
}

.swipe-tutorial-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #FFFFFF;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.swipe-tutorial-sub {
  font-size: 0.85rem;
  font-weight: 600;
  color: #34D399;
  margin-bottom: 12px;
}

.swipe-directions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.swipe-dir-pill {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 6px 8px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
