/* Snowbrothers - Main CSS Design System */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Outfit:wght@400;600;800&display=swap');

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body,
html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #0b132b;
  font-family: 'Press Start 2P', 'Outfit', cursive, sans-serif;
  color: #ffffff;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Main Container keeping 4:3 Aspect Ratio */
#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  max-width: 1200px;
  max-height: 900px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at center, #1c2541 0%, #0b132b 100%);
  box-shadow: 0 0 50px rgba(0, 242, 254, 0.25);
}

/* Canvas Styling */
#game-canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background-color: #050a18;
  image-rendering: auto;
  display: block;
}

/* Overlays Layer */
.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: rgba(11, 19, 43, 0.88);
  backdrop-filter: blur(8px);
  z-index: 10;
  padding: 30px;
  transition: opacity 0.3s ease;
}

.hidden {
  display: none !important;
}

/* HUD Overlay */
#hud-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 60px;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 5;
  pointer-events: none;
}

.hud-panel {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(28, 37, 65, 0.8);
  padding: 8px 16px;
  border-radius: 12px;
  border: 2px solid rgba(0, 242, 254, 0.5);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.hud-item {
  font-size: 13px;
  letter-spacing: 1px;
  color: #e0f7fa;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8), 0 0 10px #00f2fe;
}

.hud-item span {
  color: #ffeb3b;
}

#hud-timer.timer-warn {
  color: #ffb74d !important;
}

#hud-timer.timer-critical {
  color: #ff5252 !important;
  animation: timer-pulse 0.5s ease infinite;
}

#hud-chain.chain-hot {
  color: #ffeb3b !important;
  text-shadow: 0 0 8px #ff9800;
}

.power-active #hud-powerup {
  color: #69f0ae !important;
}

@keyframes timer-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.hud-lives {
  display: flex;
  gap: 6px;
}

.hud-heart {
  width: 20px;
  height: 20px;
  background: #ff5252;
  clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 50% 75%, 18% 100%, 0% 38%);
  display: inline-block;
  box-shadow: 0 0 8px #ff5252;
}

/* Menus & Titles */
.title-logo {
  font-size: 38px;
  text-align: center;
  color: #e0f7fa;
  text-shadow:
    0 0 12px #00f2fe,
    0 0 24px #00f2fe,
    0 0 48px #4facfe,
    4px 4px 0 #0b132b;
  margin-bottom: 18px;
  letter-spacing: 3px;
  line-height: 1.4;
}

.subtitle {
  font-size: 13px;
  color: #80deea;
  margin-bottom: 28px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
  letter-spacing: 1.5px;
}

/* Controls Guide Box */
.controls-card {
  background: rgba(28, 37, 65, 0.9);
  border: 2px solid rgba(0, 242, 254, 0.6);
  border-radius: 14px;
  padding: 24px 32px;
  margin-bottom: 32px;
  width: 100%;
  max-width: 540px;
  text-align: left;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.controls-card h3 {
  font-size: 14px;
  color: #ffeb3b;
  margin-bottom: 20px;
  text-align: center;
  letter-spacing: 2px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  row-gap: 16px;
  column-gap: 20px;
  font-size: 11px;
  line-height: 1.8;
  color: #e0f7fa;
}

.key-badge {
  background: #263238;
  color: #00f2fe;
  padding: 4px 8px;
  margin-right: 4px;
  border-radius: 6px;
  border: 1.5px solid #00f2fe;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* Button UI */
.arcade-btn {
  font-family: 'Press Start 2P', cursive;
  font-size: 15px;
  padding: 18px 40px;
  margin: 16px 10px;
  color: #0b132b;
  background: linear-gradient(180deg, #4facfe 0%, #00f2fe 100%);
  border: 3px solid #ffffff;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 6px 0 #00838f, 0 12px 25px rgba(0, 242, 254, 0.35);
  transition: transform 0.15 ease, box-shadow 0.15s ease;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.arcade-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 9px 0 #00838f, 0 16px 30px rgba(0, 242, 254, 0.5);
  background: linear-gradient(180deg, #64b5f6 0%, #4dd0e1 100%);
}

.arcade-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #00838f, 0 4px 10px rgba(0, 0, 0, 0.5);
}

.arcade-btn.secondary {
  background: linear-gradient(180deg, #78909c 0%, #455a64 100%);
  color: #ffffff;
  box-shadow: 0 6px 0 #263238, 0 10px 20px rgba(0, 0, 0, 0.5);
}

.arcade-btn.secondary:hover {
  background: linear-gradient(180deg, #90a4ae 0%, #546e7a 100%);
  box-shadow: 0 8px 0 #263238, 0 14px 25px rgba(255, 255, 255, 0.2);
}

/* Loading Screen Bar */
.loading-bar-container {
  width: 340px;
  height: 26px;
  background: #1c2541;
  border: 3px solid #00f2fe;
  border-radius: 13px;
  overflow: hidden;
  margin-top: 24px;
  box-shadow: 0 0 20px rgba(0, 242, 254, 0.4);
}

#loading-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #00f2fe, #4facfe);
  transition: width 0.2s ease;
}

/* Level Clear / Game Over Panels */
.modal-panel {
  background: rgba(28, 37, 65, 0.95);
  border: 3px solid #00f2fe;
  border-radius: 18px;
  padding: 36px 52px;
  text-align: center;
  box-shadow: 0 0 50px rgba(0, 242, 254, 0.4);
}

.modal-title {
  font-size: 26px;
  margin-bottom: 24px;
  color: #ffeb3b;
  text-shadow: 0 0 12px #ffeb3b;
  letter-spacing: 2px;
}

.stats-row {
  display: flex;
  justify-content: space-between;
  margin: 16px 0 24px 0;
  font-size: 13px;
  color: #e0f7fa;
}

/* Mobile Touch Controls — phones/tablets only */
#touch-controls {
  position: absolute;
  bottom: 20px;
  left: 0;
  width: 100%;
  padding: 0 24px;
  display: none !important;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
  z-index: 8;
}

@media (hover: none) and (pointer: coarse) {
  #touch-controls {
    display: flex !important;
  }
}

.touch-group {
  display: flex;
  gap: 14px;
  pointer-events: auto;
}

.touch-btn {
  width: 64px;
  height: 64px;
  background: rgba(28, 37, 65, 0.8);
  border: 2px solid #00f2fe;
  border-radius: 50%;
  color: #ffffff;
  font-size: 22px;
  display: flex;
  justify-content: center;
  align-items: center;
  touch-action: manipulation;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

.touch-btn:active {
  background: rgba(0, 242, 254, 0.6);
}