body {
  margin: 0;
  /* Warm dark background instead of black */
  background: radial-gradient(circle at center, #2d1b0f 0%, #1a0f0a 100%);
  color: #fff;
  font-family: 'Press Start 2P', monospace;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* MOBILE TOUCH FIXES */
  touch-action: manipulation;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
}

/* Round Game Buttons Container */
#round-buttons {
  position: fixed;
  bottom: 50px;
  right: 50px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 30px;
  align-items: center;
}

/* Round Icon Buttons - Positioned over Bierdeckel */
#icon-buttons {
  position: absolute;
  left: 20px;
  bottom: 60px;
  display: none;
  /* Hidden initially until game starts */
  flex-direction: column;
  gap: 10px;
  z-index: 150;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  /* Wood button style */
  background: linear-gradient(135deg, #5d4037 0%, #3e2723 100%);
  border: 2px solid #8d6e63;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  padding: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  /* MOBILE TOUCH FIXES */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}

.icon-btn:hover {
  background-color: #2a2a2a;
  border-color: #555;
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7);
}

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

.icon-btn svg {
  width: 20px;
  height: 20px;
}

/* Popup Panels */
.popup-panel {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(0, 0, 0, 0.95);
  border: 2px solid #444;
  border-radius: 10px;
  padding: 20px;
  z-index: 200;
  max-width: 400px;
  width: 90%;
  max-height: 70vh;
  overflow-y: auto;
}

.popup-panel.active {
  display: block;
}

.popup-panel .close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
}

.popup-panel h2 {
  margin-top: 0;
  font-size: 16px;
  color: #ffff00;
}

.hidden {
  display: none !important;
  pointer-events: none;
}

#topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-top: 4px;
  padding: 10px 20px;
  /* Wood-like texture gradient */
  background: linear-gradient(180deg, #3e2723 0%, #281a14 100%);
  border-bottom: 3px solid #8d6e63;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
  position: sticky;
  top: 0;
  z-index: 100;
}

#topbar-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}

#topbar-right {
  display: flex;
  align-items: center;
}

.version-display {
  font-size: 9px;
  color: rgba(255, 215, 0, 0.7);
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  text-shadow: 1px 1px 2px black;
  letter-spacing: 0.3px;
  opacity: 0.8;
}

#logo {
  width: 140px;
  height: auto;
  margin-bottom: 4px;
}

.build-display {
  font-size: 12px;
  color: #ccc;
  font-family: 'Source Code Pro', monospace;
  text-align: right;
  min-width: 140px;
}

#container {
  position: relative;
  width: 90vw;
  max-width: 60rem;
  min-width: 20rem;
  aspect-ratio: 16 / 9;
  margin: 4rem auto 2rem;
  /* Wood frame effect */
  border: 8px solid #3e2723;
  outline: 2px solid #5d4037;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
  border-radius: 2rem;
  background: rgba(0, 0, 0, 0.5);
  /* Semi-transparent in case image doesn't load */
  overflow: hidden;
  /* Bessere Touch-Interaktion */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  /* GPU-Beschleunigung */
  transform: translateZ(0);
  will-change: transform;
}

/* Desktop: Bessere Platznutzung */
@media (min-width: 1200px) {
  body {
    display: block;
    /* Block statt Flex damit Spielfeld unter Header ist */
    padding: 0;
    /* Desktop hat keine fixed Position */
    position: relative;
    overflow: auto;
  }

  #topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    margin-bottom: 1rem;
    width: 100%;
  }

  #container {
    width: 90vw;
    max-width: 70rem;
    margin: 0 auto 2rem;
    aspect-ratio: 16 / 9;
    max-height: calc(100vh - 120px);
    /* Smooth scaling on window resize */
    transition: all 0.3s ease;
  }

  /* Buttons rechts nur bei ≥1200px */
  #round-buttons {
    position: fixed;
    bottom: 40px;
    right: 40px;
  }
}

/* Tablet: Optimierte Ansicht für mittlere Bildschirme */
@media (min-width: 769px) and (max-width: 1199px) {
  #container {
    width: 95vw;
    max-width: 900px;
    margin: 2rem auto;
    /* Optimale Skalierung für Tablets */
    aspect-ratio: 16 / 9;
  }

  #round-buttons {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    right: auto;
    gap: 25px;
  }


}

/* Mobile & Tablet: Buttons unterhalb des Spielfelds */
@media (max-width: 1199px) {
  #round-buttons {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) rotate(-2deg);
    right: auto;
  }
}

/* Mobile: Game Container nimmt vollen Bildschirm */
@media (max-width: 768px) {
  body {
    padding: 0;
    /* Verhindere Overscrolling auf iOS */
    position: fixed;
    overflow: hidden;
    width: 100%;
    height: 100%;
  }

  #topbar {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    margin-top: 0;
    opacity: 0.9;
  }

  #logo {
    width: 80px;
  }

  #versionTag {
    font-size: 0.7rem;
  }

  #container {
    width: 100vw;
    width: 100dvw;
    /* Dynamische Viewport-Höhe für mobile Browser */
    height: 100vh;
    height: 100dvh;
    /* Dynamische Viewport-Höhe für mobile Browser */
    max-width: none;
    min-width: none;
    aspect-ratio: unset;
    margin: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    /* Bessere Performance auf Mobilgeräten */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
  }
}

/* === AUSTRIAN TAVERN WELCOME SCREEN === */
#overlay.welcome-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg,
      #1a0f0a 0%,
      #2d1b0f 25%,
      #3e2918 50%,
      #2d1b0f 75%,
      #1a0f0a 100%);
  background-size: 400% 400%;
  animation: tavernBackgroundShift 8s ease-in-out infinite;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  cursor: pointer;
  z-index: 9999;
  font-family: 'Press Start 2P', sans-serif;
  pointer-events: auto;
  user-select: none;
  /* MOBILE TOUCH FIXES: Prevent zoom on overlay tap */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  /* Tavern atmosphere overlay */
  position: relative;
}

#overlay.welcome-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255, 140, 0, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(139, 69, 19, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(255, 215, 0, 0.05) 0%, transparent 70%);
  pointer-events: none;
}

@keyframes tavernBackgroundShift {

  0%,
  100% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }
}

.tavern-container {
  max-width: 600px;
  width: 90%;
  background: linear-gradient(135deg, rgba(20, 20, 20, 0.98) 0%, rgba(40, 30, 20, 0.95) 100%);
  border: 3px solid #FFD700;
  border-radius: 20px;
  padding: 2rem;
  box-shadow:
    0 0 30px rgba(255, 140, 0, 0.4),
    inset 0 0 20px rgba(139, 69, 19, 0.3),
    0 8px 32px rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  position: relative;
  overflow: hidden;
}

.tavern-container::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, #D2691E, #8B4513, #A0522D, #8B4513);
  background-size: 400% 400%;
  border-radius: 22px;
  z-index: -1;
  animation: tavernBorderGlow 4s ease-in-out infinite;
}

@keyframes tavernBorderGlow {

  0%,
  100% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }
}

.tavern-header {
  margin-bottom: 2rem;
}

.tavern-title {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.9rem, 2.2vw, 1.6rem);
  color: #FFD700;
  text-shadow:
    2px 2px 0 #000,
    0 0 15px rgba(255, 215, 0, 0.9),
    0 0 30px rgba(255, 140, 0, 0.6);
  margin: 0 0 0.5rem 0;
  animation: tavernTitleGlow 3s ease-in-out infinite;
  letter-spacing: -1px;
}

@keyframes tavernTitleGlow {

  0%,
  100% {
    text-shadow: 3px 3px 0 #8B4513, 0 0 20px rgba(255, 215, 0, 0.8);
  }

  50% {
    text-shadow: 3px 3px 0 #8B4513, 0 0 30px rgba(255, 215, 0, 1), 0 0 50px rgba(255, 140, 0, 0.8);
  }
}

.tavern-subtitle {
  font-size: clamp(0.7rem, 1.5vw, 1rem);
  color: #DEB887;
  margin: 0;
  text-shadow: 2px 2px 0 #654321;
  line-height: 1.4;
}

.tavern-content {
  margin-bottom: 1.5rem;
}

.name-input-section {
  margin-bottom: 2rem;
  background: rgba(139, 69, 19, 0.3);
  border: 2px solid #D2691E;
  border-radius: 15px;
  padding: 1.5rem;
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.3);
}

.name-label {
  display: block;
  font-size: clamp(0.8rem, 1.8vw, 1.2rem);
  color: #F4A460;
  margin-bottom: 1rem;
  text-shadow: 2px 2px 0 #654321;
}

.input-container {
  position: relative;
  margin-bottom: 0.8rem;
}

.tavern-input {
  width: 100%;
  padding: 1rem 3rem 1rem 1rem;
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.7rem, 1.5vw, 1rem);
  background: linear-gradient(145deg, #F5DEB3, #DEB887);
  border: 3px solid #8B4513;
  border-radius: 10px;
  color: #654321;
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.3);
  box-shadow:
    inset 0 2px 5px rgba(139, 69, 19, 0.3),
    0 3px 10px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  /* MOBILE TOUCH FIXES */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}

.tavern-input:focus {
  outline: none;
  border-color: #FFD700;
  box-shadow:
    inset 0 2px 5px rgba(139, 69, 19, 0.3),
    0 3px 10px rgba(0, 0, 0, 0.2),
    0 0 15px rgba(255, 215, 0, 0.6);
  background: linear-gradient(145deg, #FFFACD, #F5DEB3);
}

.tavern-input::placeholder {
  color: #A0522D;
  opacity: 0.7;
}

.input-decoration {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  pointer-events: none;
}

.name-hint {
  font-size: clamp(0.6rem, 1.2vw, 0.8rem);
  color: #DEB887;
  margin: 0;
  font-style: italic;
  text-shadow: 1px 1px 0 #654321;
  opacity: 0.9;
}

.tavern-atmosphere {
  margin-bottom: 2rem;
  background: rgba(139, 69, 19, 0.2);
  border: 1px solid #D2691E;
  border-radius: 10px;
  padding: 1rem;
}

.atmosphere-text p {
  font-size: clamp(0.6rem, 1.3vw, 0.9rem);
  color: #F4A460;
  margin: 0;
  text-shadow: 1px 1px 0 #654321;
  line-height: 1.4;
}

.tavern-start-button {
  width: 100%;
  padding: 1.5rem;
  background: linear-gradient(145deg, #228B22, #006400);
  border: 4px solid #32CD32;
  border-radius: 15px;
  font-family: 'Press Start 2P', monospace;
  color: #F0F8FF;
  text-shadow: 2px 2px 0 #006400;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow:
    0 6px 0 #004d00,
    0 8px 15px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  margin-bottom: 1rem;
  position: relative;
  overflow: hidden;
  /* MOBILE TOUCH FIXES */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}

.tavern-start-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
      transparent,
      rgba(255, 255, 255, 0.2),
      transparent);
  transition: left 0.5s ease;
}

.tavern-start-button:hover::before {
  left: 100%;
}

.tavern-start-button:hover {
  transform: translateY(-2px);
  box-shadow:
    0 8px 0 #004d00,
    0 10px 20px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 0 20px rgba(50, 205, 50, 0.4);
  border-color: #3CB371;
}

.tavern-start-button:active {
  transform: translateY(4px);
  box-shadow:
    0 2px 0 #004d00,
    0 4px 8px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* MOBILE TOUCH ENHANCEMENTS: Enhanced mobile responsiveness */
.mobile-optimized .tavern-start-button {
  /* Larger touch target for mobile */
  min-height: 60px;
  padding: 1.8rem;
  /* Enhanced touch feedback */
  transition: all 0.1s ease !important;
}

.mobile-optimized .tavern-start-button:active,
.mobile-optimized .tavern-start-button.touched {
  transform: translateY(4px) scale(0.98);
  box-shadow:
    0 2px 0 #004d00,
    0 4px 8px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  filter: brightness(0.9);
}

/* Enhanced welcome screen mobile optimization */
.mobile-optimized .tavern-container {
  /* Better mobile spacing and sizing */
  max-width: 90vw;
  padding: 1.5rem;
  margin: 0.5rem;
}

.mobile-optimized .tavern-input {
  /* Better mobile input handling */
  min-height: 48px;
  font-size: 16px;
  /* Prevents iOS zoom on input focus */
}

/* Mobile control buttons enhancement */
.mobile-optimized .control-btn {
  /* Larger touch targets */
  min-width: 160px;
  min-height: 56px;
  /* Better touch feedback */
  transition: all 0.08s ease;
}

.mobile-optimized .control-btn:active {
  transform: translateY(2px) scale(0.96);
  filter: brightness(0.85);
}

.button-icon {
  font-size: 1.5em;
  display: inline-block;
  margin-right: 0.5rem;
}

.button-text {
  font-size: clamp(0.8rem, 1.8vw, 1.2rem);
  display: block;
  margin-bottom: 0.3rem;
}

.button-subtitle {
  font-size: clamp(0.5rem, 1.2vw, 0.8rem);
  display: block;
  opacity: 0.9;
  color: #E0FFE0;
}

.start-hint {
  font-size: clamp(0.5rem, 1.1vw, 0.7rem);
  color: #DEB887;
  margin: 0;
  opacity: 0.8;
  text-shadow: 1px 1px 0 #654321;
  font-style: italic;
}

.tavern-footer {
  border-top: 2px solid #D2691E;
  padding-top: 1rem;
  margin-top: 1rem;
}

.alpine-decoration {
  font-size: clamp(1rem, 2vw, 1.5rem);
  color: #DEB887;
  text-shadow: 1px 1px 0 #654321;
  animation: alpineFloat 4s ease-in-out infinite;
}

@keyframes alpineFloat {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-3px);
  }
}

/* Mobile Optimizations for Tavern Welcome Screen */
@media (max-width: 768px) {
  .tavern-container {
    padding: 1.5rem;
    margin: 1rem;
    width: calc(100% - 2rem);
  }

  .name-input-section {
    padding: 1rem;
  }

  .tavern-input {
    padding: 0.8rem 2.5rem 0.8rem 0.8rem;
  }

  .input-decoration {
    right: 0.8rem;
    font-size: 1rem;
  }

  .tavern-start-button {
    padding: 1.2rem;
  }
}

@media (max-width: 480px) {
  .tavern-container {
    padding: 1rem;
    border-radius: 15px;
  }

  .name-input-section {
    padding: 0.8rem;
    border-radius: 10px;
  }

  .tavern-atmosphere {
    padding: 0.8rem;
  }
}

/* Legacy overlay support for game states */
#overlay:not(.welcome-screen) {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  cursor: pointer;
  z-index: 9999;
  font-family: 'Press Start 2P', sans-serif;
  font-size: clamp(1rem, 2vw + 0.5rem, 1.6rem);
  text-shadow: 0 0 4px #000;
  pointer-events: auto;
  user-select: none;
  /* MOBILE TOUCH FIXES: Prevent zoom on overlay tap */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

/* === UNIFIED NOTIFICATION SYSTEM === */
#notify {
  position: fixed;
  left: 50%;
  top: 120px;
  /* Position below new HUD area */
  transform: translateX(-50%);
  font: 700 clamp(1rem, 2vw + 0.3rem, 2rem) 'Press Start 2P', sans-serif;
  color: #ffeb3b;
  text-shadow: 0 0 8px #000, 0 0 16px #ffeb3b;
  opacity: 0;
  transform: translateX(-50%) translateY(-20px);
  /* Start slightly above for slide-in effect */
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  z-index: 200;
  /* Increased z-index to ensure visibility above all HUD elements (100) and other game elements */
  text-align: center;
  white-space: nowrap;
  backdrop-filter: blur(4px);
  background: rgba(0, 0, 0, 0.6);
  padding: 8px 16px;
  border-radius: 12px;
  border: 2px solid rgba(255, 235, 59, 0.3);
}

/* Notification animation states */
#notify.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  /* Slide in from above */
}

#notify.hide {
  opacity: 0;
  transform: translateX(-50%) translateY(-20px);
  /* Slide out upwards */
}

/* Mobile: Notify below new mobile HUD positioning */
@media (max-width: 768px) {
  #notify {
    top: 85px;
    /* Position below new mobile HUD area (~70px) */
    font-size: 0.9rem;
    padding: 6px 12px;
    border-radius: 8px;
    max-width: calc(100vw - 32px);
    /* Prevent overflow on small screens */
    white-space: normal;
    /* Allow text wrapping on mobile if needed */
    line-height: 1.2;
  }

  /* Mobile: Round Buttons anpassen */
  #round-buttons {
    bottom: 30px;
    right: 20px;
    gap: 20px;
  }

  #round-buttons .round-btn {
    width: 80px !important;
    height: 80px !important;
  }

  #round-buttons .round-btn div:first-child {
    font-size: 32px !important;
  }
}

/* === Z-INDEX HIERARCHY DOCUMENTATION ===
 * Level 1000+: Critical overlays (game start/end)
 * Level 200+:  All notifications (unified system)
 * Level 100:   HUD elements (points, clock, alcohol)
 * Level 50:    Game UI controls and panels
 * Level 10:    Game elements (sprites, animations)
 * Level 0:     Background elements
 */

/* Corner HUD Box Styling - Match notification appearance */
.hud-box {
  backdrop-filter: blur(4px);
  background: rgba(0, 0, 0, 0.6);
  padding: 8px 16px;
  border-radius: 12px;
  border: 2px solid rgba(255, 235, 59, 0.3);
  pointer-events: none;
  text-align: center;
  z-index: 100;
  /* Explicit z-index for HUD elements - below notifications (200+) */
}

.hud-box.points {
  border-color: rgba(255, 255, 0, 0.3);
  /* Yellow border for points */
}

.hud-box.alcohol {
  border-color: rgba(255, 102, 102, 0.3);
  /* Red border for alcohol */
}

.hud-box.clock {
  border-color: rgba(0, 255, 0, 0.3);
  /* Green border for clock */
}

/* Mobile HUD boxes - smaller padding and radius */
@media (max-width: 768px) {
  .hud-box {
    padding: 6px 12px;
    border-radius: 8px;
  }

  /* Mobile: Move controls to bottom center for better accessibility */
  #game-controls {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    flex-direction: row;
    gap: 2rem;
    /* Increased spacing for better touch targets */
  }

  /* Hide keyboard shortcuts on mobile */
  .key-hint {
    display: none;
  }

}

/* Legacy buttons removed */


#rules {
  width: 90vw;
  max-width: 50rem;
  background: #000;
  padding: 0.5rem;
  margin: 1rem 0;
  border: 0.125rem solid #fff;
  font-family: 'Source Code Pro', monospace;
  font-weight: 400;
  font-size: clamp(0.8rem, 1vw + 0.4rem, 1.1rem);
  line-height: 1.2;
  color: #fff;
  text-shadow: 0 0 2px #000;
}

#rules h2 {
  margin: 0.25rem 0;
  font-size: 0.875rem;
}

#rules ul {
  margin: 0.25rem 0 0 1rem;
  padding: 0;
}

.beer-glass {
  position: relative;
}

.vbar {
  position: absolute;
  right: 6px;
  bottom: 0;
  width: 8px;
  border-radius: 4px;
  transition: height 0.15s linear;
}

.vbar.cold {
  background: linear-gradient(#ffe600, #ffcf00);
}

.vbar.warm {
  background: linear-gradient(#ff6262, #ff9a9a);
}

.tilt {
  animation: tilt 0.6s forwards;
}

@keyframes tilt {
  to {
    transform: rotateZ(20deg);
    opacity: 0;
  }
}

@keyframes move {
  from {
    background-position: 0 0;
  }

  to {
    background-position: 100% 0;
  }
}

/* .clock {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  color: #fff;
  font-size: 0.75rem;
} */

.dialog {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.8);
  z-index: 25;
}

#scores {
  width: 90vw;
  max-width: 50rem;
  background: rgba(0, 0, 0, 0.7);
  padding: 0.5rem;
  margin-top: 1rem;
  border: 0.125rem solid #fff;
  font-size: 0.75rem;
  line-height: 1.2;
}

#scores,
#rules {
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  transition: all 0.3s;
}

#scores.open,
#rules.open {
  border: 0.125rem solid #fff;
  background: rgba(0, 0, 0, 0.7);
  padding: 0.5rem;
  margin-top: 1rem;
}

#rules.open {
  background: #000;
  margin: 1rem 0;
  border: none;
}

#scores,
#rules {
  position: fixed;
  bottom: 100px;
  left: 0;
  right: 0;
  width: 100%;
  max-width: none;
  margin: 0;
  max-height: 60vh;
  overflow-y: auto;
  z-index: 25;
}

#scores.open,
#rules.open {
  background: rgba(0, 0, 0, 0.95);
  border: none;
  border-top: 2px solid #fff;
  padding: 1rem;
  margin: 0;
}

.control-btn {
  position: fixed;
  padding: 16px 20px;
  font-size: 0.8rem;
  border-radius: 10px;
  z-index: 20;
  width: 140px;
  /* Increased width for better touch targets */
  min-height: 52px;

  /* Enhanced mobile arcade styling */
  box-shadow:
    0 3px 0 var(--btn-shadow),
    0 4px 8px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.control-btn:hover {
  transform: translateY(-1px) scale(1.01);
  box-shadow:
    0 4px 0 var(--btn-shadow),
    0 6px 12px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 0 15px var(--btn-glow);
}

.control-btn:active {
  transform: translateY(1px) scale(0.98);
  box-shadow:
    0 1px 0 var(--btn-shadow),
    0 2px 4px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

#btnDrink {
  right: 16px;
  bottom: 180px;
  /* DRAMATICALLY increased from 140px for much bigger gap on mobile */
}

#btnOrder {
  right: 16px;
  bottom: 80px;
  /* Kept at 80px to create MASSIVE 100px gap between buttons on mobile */
}

/* Hide keyboard shortcuts on mobile for cleaner look */
.key-hint {
  display: none;
}
}

@media (max-width: 37.5rem) {
  #logo {
    width: 9rem;
  }

  /* Hide build tag on very small screens to save space */
  #buildTag {
    display: none;
  }

  .control-btn {
    padding: 14px 18px;
    font-size: 0.75rem;
    width: 130px;
    /* Vergrößert für bessere Touch-Targets auf kleinen Bildschirmen */
    min-height: 52px;
    /* Höher für bessere Erreichbarkeit */

    /* Smaller arcade styling for very small screens */
    box-shadow:
      0 2px 0 var(--btn-shadow),
      0 3px 6px rgba(0, 0, 0, 0.3),
      inset 0 1px 0 rgba(255, 255, 255, 0.2);
  }

  .control-btn:hover {
    transform: translateY(-1px) translateZ(0);
    box-shadow:
      0 3px 0 var(--btn-shadow),
      0 4px 8px rgba(0, 0, 0, 0.4),
      inset 0 1px 0 rgba(255, 255, 255, 0.3),
      0 0 10px var(--btn-glow);
  }

  .control-btn:active {
    transform: translateY(1px) translateZ(0);
    box-shadow:
      0 1px 0 var(--btn-shadow),
      0 2px 4px rgba(0, 0, 0, 0.2);
    /* Besseres visuelles Feedback auf kleinen Bildschirmen */
    filter: brightness(0.9);
  }

  .panel-toggle {
    width: 90vw;
    margin-inline: auto;
    text-align: center;
  }

  #btnDrink {
    right: 50%;
    transform: translateX(calc(50% + 70px));
    /* Zentriert mit Abstand */
    bottom: 180px;
  }

  #btnOrder {
    right: 50%;
    transform: translateX(calc(50% + 70px));
    /* Zentriert mit Abstand */
    bottom: 80px;
  }

  .clock {
    font-size: 0.5rem;
  }

  #rules {
    font-size: 0.75rem;
  }

  /* Keep keyboard shortcuts hidden on small screens */
  .key-hint {
    display: none;
  }
}

@media (max-width: 22.5rem) {
  body {
    flex-direction: column;
    gap: 0.4rem;
  }
}

/* Desktop: Show keyboard hints only on non-touch devices */
@media (min-width: 769px) {
  .key-hint {
    display: flex !important;
  }
}

/* MOBILE TOUCH FIXES: Ensure keyboard hints are hidden on all touch scenarios */
@media (max-width: 768px) {
  .key-hint {
    display: none !important;
  }
}

/* Force hide on touch devices regardless of screen size */
.touch-device .key-hint {
  display: none !important;
}

/* Enhanced Desktop Support - High Resolution Displays */
@media (min-width: 1440px) {
  #container {
    max-width: 60rem;
  }

  .panel-toggle,
  #scores,
  #rules {
    max-width: 60rem;
    font-size: 1rem;
  }


}

@media (min-width: 2560px) {
  #container {
    max-width: 70rem;
  }



  .panel-toggle {
    font-size: 1.1rem;
    padding: 0.7rem 1.3rem;
  }

  #overlay {
    font-size: clamp(1.5rem, 3vw + 0.5rem, 2.2rem);
  }
}

/* Touch Device Optimizations - Enhanced Arcade Styling */
@media (hover: none) and (pointer: coarse) {


  .panel-toggle {
    min-height: 48px;
    padding: 0.75rem 1rem;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  /* Hide keyboard shortcuts on touch devices */
  .key-hint {
    display: none !important;
  }

  /* Icon buttons touch optimization */
  .icon-btn {
    width: 48px;
    /* Larger touch targets */
    height: 48px;
    touch-action: manipulation !important;
  }
}

/* Additional touch device fixes for specific device targeting */
.touch-device {
  /* Global touch device styles */
  -webkit-text-size-adjust: 100%;
  /* Prevent text scaling on orientation change */
  -ms-text-size-adjust: 100%;
}

.touch-device .key-hint {
  display: none !important;
  /* Force hide keyboard hints on touch devices */
}

.touch-device #overlay {
  /* Better overlay touch handling */
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
  /* Subtle feedback */
}

.touch-device #container {
  /* Game container touch optimization */
  touch-action: pan-x pan-y;
  /* Allow panning but prevent zoom */
  -webkit-overflow-scrolling: touch;
  /* Smooth scrolling on iOS */
}

/* Landscape Orientation Support */
@media screen and (orientation: landscape) and (max-height: 500px) {
  #topbar {
    display: none;
  }

  #container {
    margin-top: 0;
    height: 100vh;
    height: 100dvh;
    /* Dynamische Viewport-Höhe */
    width: 100vw;
    width: 100dvw;
    /* Dynamische Viewport-Breite */
    border-radius: 0;
    border: none;
    /* Optimale Performance im Landscape-Modus */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }



  /* Ensure keyboard shortcuts stay hidden in landscape */
  .key-hint {
    display: none;
  }

  .panel-toggle {
    position: fixed;
    bottom: 10px;
    z-index: 60;
  }

  #toggleScores {
    left: 10px;
  }

  #toggleRules {
    right: 100px;
  }
}

/* Safe Area Support for Notched Devices (iPhone X+, etc.) */
@supports (padding: max(0px)) {
  @media (max-width: 768px) {
    body {
      /* Respektiere Safe Areas */
      padding-left: env(safe-area-inset-left, 0);
      padding-right: env(safe-area-inset-right, 0);
      padding-top: env(safe-area-inset-top, 0);
      padding-bottom: env(safe-area-inset-bottom, 0);
    }

    #container {
      /* Berücksichtige Notch-Bereich */
      padding-top: max(0px, env(safe-area-inset-top, 0));
      padding-bottom: max(0px, env(safe-area-inset-bottom, 0));
    }



    #topbar {
      /* Topbar berücksichtigt Notch */
      padding-top: max(8px, env(safe-area-inset-top, 8px));
    }
  }
}

/* Landscape Safe Area Support */
@supports (padding: max(0px)) {
  @media screen and (orientation: landscape) and (max-height: 500px) {
    #container {
      padding-left: max(0px, env(safe-area-inset-left, 0));
      padding-right: max(0px, env(safe-area-inset-right, 0));
    }


  }
}

/* === VBAR:STYLE === */
.beer-glass {
  position: relative;
}

.vbar {
  position: absolute;
  right: 6px;
  bottom: 0;
  width: 8px;
  border-radius: 4px;
  transition: height 0.1s linear;
}

.vbar.cold {
  background: linear-gradient(#ffe600, #ffd000);
}

.vbar.warm {
  background: linear-gradient(#ff5c5c, #ff9a9a);
}

/* === ENHANCED DRINKING PROGRESS BAR === */
.drink-progress-container {
  position: absolute;
  pointer-events: none;
  z-index: 60;
}

.drink-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #ffeb3b 0%, #ffd700 40%, #ff8f00 80%, #e65100 100%);
  box-shadow:
    0 0 8px rgba(255, 235, 59, 0.9),
    inset 2px 0 2px rgba(255, 255, 255, 0.5),
    inset -2px 0 2px rgba(0, 0, 0, 0.3);
  border-radius: 3px;
  /* Retro pixel styling - sharp edges, solid colors */
  image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-crisp-edges;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  transition: none;
  transform-origin: top;
  transform: scaleY(1);
  opacity: 0;
  display: block;
  z-index: 60;
}

/* === LEGACY DRINKING ANIMATION (kept for compatibility) === */
.drink-animation {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 10;
}

.drink-bar {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  background: linear-gradient(180deg, #ffeb3b 0%, #ffc107 50%, #ff9800 100%);
  box-shadow:
    0 0 10px rgba(255, 235, 59, 0.6),
    inset 0 0 5px rgba(255, 255, 255, 0.3);
  border-radius: 0 0 4px 4px;
  transition: height 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  transform-origin: top;
}

.drink-bar.active {
  height: 100%;
  animation: drinkGlow 0.6s ease-out;
}

@keyframes drinkGlow {
  0% {
    box-shadow:
      0 0 10px rgba(255, 235, 59, 0.6),
      inset 0 0 5px rgba(255, 255, 255, 0.3);
  }

  50% {
    box-shadow:
      0 0 20px rgba(255, 235, 59, 0.9),
      0 0 30px rgba(255, 193, 7, 0.6),
      inset 0 0 10px rgba(255, 255, 255, 0.5);
  }

  100% {
    box-shadow:
      0 0 10px rgba(255, 235, 59, 0.6),
      inset 0 0 5px rgba(255, 255, 255, 0.3);
  }
}

/* === DRINKING PROGRESS BAR PULSE ANIMATION === */
@keyframes drinkingPulse {
  0% {
    filter: brightness(1) saturate(1);
    transform: scaleY(1) scaleX(1);
    box-shadow: 0 0 8px rgba(255, 235, 59, 0.9);
  }

  20% {
    filter: brightness(1.2) saturate(1.1);
    transform: scaleY(0.8) scaleX(1.05);
    box-shadow: 0 0 12px rgba(255, 235, 59, 1.0);
  }

  40% {
    filter: brightness(1.4) saturate(1.3);
    transform: scaleY(0.6) scaleX(1.1);
    box-shadow: 0 0 16px rgba(255, 193, 7, 1.0);
  }

  60% {
    filter: brightness(1.6) saturate(1.5);
    transform: scaleY(0.4) scaleX(1.15);
    box-shadow: 0 0 20px rgba(255, 152, 0, 0.9);
  }

  80% {
    filter: brightness(1.4) saturate(1.3);
    transform: scaleY(0.2) scaleX(1.1);
    box-shadow: 0 0 16px rgba(255, 193, 7, 0.8);
  }

  100% {
    filter: brightness(1) saturate(1);
    transform: scaleY(0) scaleX(1);
    box-shadow: 0 0 8px rgba(255, 235, 59, 0.6);
  }
}

/* Mobile optimizations for drinking animations */
@media (max-width: 768px) {
  .drink-progress-bar {
    box-shadow:
      0 0 4px rgba(255, 235, 59, 0.8),
      inset 1px 0 1px rgba(255, 255, 255, 0.3),
      inset -1px 0 1px rgba(0, 0, 0, 0.1);
    border-radius: 2px;
  }

  .drink-bar {
    border-radius: 0 0 2px 2px;
    box-shadow:
      0 0 5px rgba(255, 235, 59, 0.6),
      inset 0 0 3px rgba(255, 255, 255, 0.3);
  }

  @keyframes drinkGlow {
    0% {
      box-shadow:
        0 0 5px rgba(255, 235, 59, 0.6),
        inset 0 0 3px rgba(255, 255, 255, 0.3);
    }

    50% {
      box-shadow:
        0 0 10px rgba(255, 235, 59, 0.9),
        0 0 15px rgba(255, 193, 7, 0.6),
        inset 0 0 5px rgba(255, 255, 255, 0.5);
    }

    100% {
      box-shadow:
        0 0 5px rgba(255, 235, 59, 0.6),
        inset 0 0 3px rgba(255, 255, 255, 0.3);
    }
  }
}

/* === BEER TEMPERATURE DISPLAY === */
.temperature-display {
  position: absolute;
  padding: 2px 4px;
  background: transparent;
  border: none;
  color: #00ffff;
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  font-weight: bold;
  text-shadow:
    2px 2px 0px #000,
    -1px -1px 0px #000,
    1px -1px 0px #000,
    -1px 1px 0px #000,
    0 0 8px rgba(0, 255, 255, 0.8);
  pointer-events: none;
  z-index: 70;
  white-space: nowrap;
}

/* Temperature color variations */
.temperature-display.hot {
  color: #ff4500;
  text-shadow:
    2px 2px 0px #000,
    -1px -1px 0px #000,
    1px -1px 0px #000,
    -1px 1px 0px #000,
    0 0 8px rgba(255, 69, 0, 0.9);
}

.temperature-display.warm {
  color: #ff8c00;
  text-shadow:
    2px 2px 0px #000,
    -1px -1px 0px #000,
    1px -1px 0px #000,
    -1px 1px 0px #000,
    0 0 8px rgba(255, 140, 0, 0.9);
}

.temperature-display.warning {
  color: #ffa500;
  text-shadow:
    2px 2px 0px #000,
    -1px -1px 0px #000,
    1px -1px 0px #000,
    -1px 1px 0px #000,
    0 0 8px rgba(255, 165, 0, 0.9);
}

/* Mobile: Smaller temperature display */
@media (max-width: 768px) {
  .temperature-display {
    font-size: 10px;
    padding: 2px 3px;
  }
}

/* Very small screens: Even smaller temperature display */
@media (max-width: 480px) {
  .temperature-display {
    font-size: 9px;
    padding: 1px 2px;
  }
}

/* === RESPONSIVE BEER ELEMENT POSITIONING === */
/* Desktop adjustments for smaller beer sprites */
@media (min-width: 1001px) {

  /* Temperature displays for desktop - smaller and closer to beer */
  .temperature-display {
    font-size: 8px;
    padding: 2px 6px;
    border-radius: 6px;
    box-shadow:
      0 0 4px rgba(0, 191, 255, 0.4),
      inset 0 1px 0 rgba(255, 255, 255, 0.1),
      inset 0 -1px 0 rgba(0, 0, 0, 0.2);
  }

  /* Beer progress bars (inside glass) - smaller for desktop */
  .vbar {
    width: 6px;
    right: 4px;
  }
}

/* === VBAR:STYLE END === */


/* ===== ALCOHOL METABOLISM VISUAL FEEDBACK ===== */

/* Alcohol level HUD transitions for metabolism visual feedback */
@keyframes alcoholLevelGlow {

  0%,
  100% {
    text-shadow: 0 0 8px #000, 0 0 16px currentColor;
  }

  50% {
    text-shadow: 0 0 12px #000, 0 0 24px currentColor, 0 0 32px currentColor;
  }
}

.hud-box.alcohol {
  transition: color 0.3s ease-in-out, text-shadow 0.3s ease-in-out;
}

.hud-box.alcohol.sobering {
  animation: alcoholLevelGlow 2s ease-in-out;
}

/* Sober-up feedback animation for subtle metabolism notifications */
@keyframes soberUpFade {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.9);
    color: #90EE90;
  }

  20% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  80% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  100% {
    opacity: 0;
    transform: translateY(-10px) scale(0.9);
  }
}

#notify.sober-up {
  animation: soberUpFade 1s ease-in-out;
  font-size: 14px !important;
  color: #90EE90 !important;
  border-color: rgba(144, 238, 144, 0.4) !important;
}

/* === MOBILE SPIELER CLASS OPTIMIZATIONS === */

/* Player Icon Mobile Touch Targets - CRITICAL for Touch Devices */
.spieler-icon {
  /* Minimum touch target size for mobile devices */
  min-width: 44px !important;
  min-height: 44px !important;
  /* Enhanced touch feedback */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  /* Improved visibility on mobile */
  font-size: clamp(28px, 6vw, 44px) !important;
  /* Better positioning for mobile viewports */
  position: relative;
  z-index: 110;
  /* Above HUD elements */
}

/* Mobile BAC Display Optimization */
.spieler-bac-display {
  position: fixed;
  top: 50px;
  right: 10px;
  background: rgba(0, 0, 0, 0.8);
  color: #ff6666;
  padding: 8px 12px;
  border-radius: 8px;
  border: 2px solid rgba(255, 102, 102, 0.4);
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  font-weight: bold;
  text-shadow: 2px 2px 0px #000;
  z-index: 110;
  /* Mobile touch optimization */
  touch-action: none;
  pointer-events: none;
  /* Smooth transitions for BAC changes */
  transition: all 0.3s ease;
}

/* Mobile Achievement Notifications */
.spieler-achievement {
  position: fixed;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(145deg, #228B22, #32CD32);
  color: white;
  padding: 12px 16px;
  border-radius: 12px;
  border: 3px solid #00FF00;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  text-align: center;
  z-index: 120;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.4),
    0 0 20px rgba(0, 255, 0, 0.3);
  /* Animation for mobile visibility */
  animation: achievementPulse 2s ease-in-out;
  /* Touch optimization */
  touch-action: none;
  pointer-events: none;
  max-width: calc(100vw - 40px);
  word-wrap: break-word;
}

@keyframes achievementPulse {

  0%,
  100% {
    transform: translateX(-50%) scale(1);
    opacity: 1;
  }

  20% {
    transform: translateX(-50%) scale(1.1);
    opacity: 1;
  }

  80% {
    transform: translateX(-50%) scale(1.05);
    opacity: 1;
  }
}

/* Mobile Player Stats Panel */
.spieler-stats-mobile {
  position: fixed;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.85);
  border: 2px solid rgba(255, 235, 59, 0.4);
  border-radius: 8px;
  padding: 6px 10px;
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: #ffeb3b;
  z-index: 110;
  /* Touch optimization */
  touch-action: none;
  pointer-events: none;
  /* Responsive sizing */
  max-width: calc(100vw - 120px);
}

/* Mobile Responsive Adjustments for Spieler */
@media (max-width: 768px) {
  .spieler-icon {
    font-size: 32px !important;
    min-width: 48px !important;
    min-height: 48px !important;
  }

  .spieler-bac-display {
    top: 60px;
    right: 8px;
    font-size: 10px;
    padding: 6px 10px;
  }

  .spieler-achievement {
    top: 80px;
    font-size: 9px;
    padding: 10px 14px;
    max-width: calc(100vw - 20px);
  }

  .spieler-stats-mobile {
    font-size: 8px;
    padding: 4px 8px;
    max-width: calc(100vw - 100px);
  }
}

/* Extra Small Mobile Devices */
@media (max-width: 480px) {
  .spieler-icon {
    font-size: 28px !important;
    min-width: 44px !important;
    min-height: 44px !important;
  }

  .spieler-bac-display {
    top: 50px;
    right: 5px;
    font-size: 9px;
    padding: 5px 8px;
  }

  .spieler-achievement {
    top: 70px;
    font-size: 8px;
    padding: 8px 12px;
  }

  .spieler-stats-mobile {
    font-size: 7px;
    padding: 3px 6px;
  }
}

/* Landscape Mobile Orientation */
@media (max-height: 600px) and (orientation: landscape) {
  .spieler-icon {
    font-size: 24px !important;
    min-width: 40px !important;
    min-height: 40px !important;
  }

  .spieler-bac-display {
    top: 5px;
    right: 5px;
    font-size: 8px;
    padding: 4px 6px;
  }

  .spieler-achievement {
    top: 30px;
    font-size: 7px;
    padding: 6px 10px;
  }

  .spieler-stats-mobile {
    top: 5px;
    left: 5px;
    font-size: 6px;
    padding: 2px 4px;
  }
}

/* === DEBUG MODE STYLING === */

/* Debug panel - top right corner */
#debug-panel {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.9);
  color: #00ff00;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  padding: 10px;
  border: 1px solid #00ff00;
  border-radius: 5px;
  z-index: 1000;
  display: none;
  line-height: 1.4;
  min-width: 200px;
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.7);
}

/* Debug coordinates display - bottom left corner */
#debug-coordinates {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.9);
  color: #ffff00;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  padding: 5px 10px;
  border: 1px solid #ffff00;
  border-radius: 5px;
  z-index: 1000;
  display: none;
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.7);
}

/* Debug mode active states */
#debug-panel.active,
#debug-coordinates.active {
  display: block;
}

/* Debug panel sections */
#debug-panel .debug-section {
  margin-bottom: 8px;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(0, 255, 0, 0.3);
}

#debug-panel .debug-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

#debug-panel .debug-label {
  color: #00ff88;
  font-weight: bold;
}

#debug-panel .debug-value {
  color: #88ff88;
}

/* Responsive debug panel adjustments */
@media (max-width: 768px) {
  #debug-panel {
    font-size: 10px;
    padding: 8px;
    min-width: 180px;
    right: 5px;
    top: 5px;
  }

  #debug-coordinates {
    font-size: 11px;
    padding: 4px 8px;
    bottom: 5px;
    left: 5px;
  }
}

@media (max-width: 480px) {
  #debug-panel {
    font-size: 9px;
    padding: 6px;
    min-width: 160px;
  }

  #debug-coordinates {
    font-size: 10px;
    padding: 3px 6px;
  }
}

/* Debug overlay graphics styling (handled by Phaser graphics object) */
/* These are visual indicators for game regions and boundaries */

/* Error Popup Styles */
.error-popup-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.error-popup-container.visible {
  opacity: 1;
  visibility: visible;
}

.error-popup-box {
  background: #fff;
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  font-family: Arial, sans-serif;
  overflow: hidden;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.error-popup-container.visible .error-popup-box {
  transform: scale(1);
}

.error-popup-header {
  background-color: #d9534f;
  color: white;
  padding: 10px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.error-popup-title {
  font-size: 1.2em;
  font-weight: bold;
}

.error-popup-close {
  background: none;
  border: none;
  color: white;
  font-size: 1.5em;
  cursor: pointer;
  line-height: 1;
}

.error-popup-body {
  padding: 20px;
  color: #333;
  line-height: 1.6;
  max-height: 70vh;
  overflow-y: auto;
}

.error-popup-message pre {
  background: #f4f4f4;
  padding: 10px;
  border-radius: 4px;
  border: 1px solid #ddd;
  font-size: 0.9em;
}