/* Cat Dash - Modern Retro Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #0b0c10;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  display: flex;
  justify-content: center;
  align-items: center;
}

#game-wrapper {
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at center, #181c2b 0%, #08090d 100%);
  padding: 10px;
}

#canvas-container {
  position: relative;
  width: 100%;
  max-width: 960px;
  aspect-ratio: 800 / 400;
  max-height: 95vh;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.8), 0 0 15px rgba(255, 140, 0, 0.25);
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  touch-action: none;
  user-select: none;
}

/* Overlays and HUD */
.overlay-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#hud {
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  z-index: 10;
}

.hud-item {
  background: rgba(15, 18, 30, 0.75);
  border: 1px solid rgba(255, 165, 0, 0.4);
  backdrop-filter: blur(4px);
  padding: 6px 14px;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 70px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.hud-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #ff9d00;
  text-transform: uppercase;
}

.hud-value {
  font-size: 18px;
  font-weight: 900;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
  font-family: 'Courier New', Courier, monospace;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.hud-btn {
  margin-left: auto;
  pointer-events: auto;
  background: rgba(15, 18, 30, 0.75);
  border: 1px solid rgba(255, 165, 0, 0.4);
  color: #fff;
  font-size: 18px;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.15s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.hud-btn:hover {
  background: rgba(255, 140, 0, 0.3);
  border-color: #ffaa00;
  transform: scale(1.05);
}

/* Modals / Screen Overlays */
.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(10, 12, 20, 0.72);
  backdrop-filter: blur(6px);
  z-index: 20;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.22s;
  pointer-events: auto;
  cursor: pointer;
}

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

.panel {
  background: linear-gradient(135deg, rgba(28, 34, 56, 0.95) 0%, rgba(16, 18, 30, 0.96) 100%);
  border: 2px solid #ff9d00;
  box-shadow: 0 0 35px rgba(255, 140, 0, 0.3), inset 0 0 15px rgba(255, 165, 0, 0.15);
  border-radius: 16px;
  padding: 24px 36px;
  text-align: center;
  max-width: 90%;
  width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: panelPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes panelPop {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.title-logo {
  margin-bottom: 12px;
}

.glow-title {
  font-size: 42px;
  font-weight: 900;
  letter-spacing: 3px;
  color: #fff;
  text-shadow: 0 0 10px #ff7700, 0 0 20px #ff9900, 0 0 40px #ffaa00;
  margin: 0;
  line-height: 1.1;
}

.subtitle {
  font-size: 11px;
  letter-spacing: 4px;
  color: #ffb03a;
  font-weight: 700;
  margin-top: 4px;
}

.cat-preview-box {
  margin: 10px 0;
}

.cat-badge {
  font-size: 46px;
  filter: drop-shadow(0 0 10px rgba(255, 150, 0, 0.8));
  animation: bobbing 1.6s ease-in-out infinite alternate;
}

@keyframes bobbing {
  0% { transform: translateY(0) rotate(-2deg); }
  100% { transform: translateY(-8px) rotate(4deg); }
}

.stats-preview {
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 150, 0, 0.3);
  padding: 8px 24px;
  border-radius: 8px;
  margin-bottom: 16px;
}

.stat-tag {
  font-size: 10px;
  letter-spacing: 2px;
  color: #ffaa33;
  font-weight: 700;
}

.stat-num {
  font-size: 24px;
  font-weight: 900;
  color: #ffffff;
  font-family: 'Courier New', Courier, monospace;
}

.prompt-text {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #00ffff;
  text-shadow: 0 0 10px rgba(0, 255, 255, 0.6);
  margin-bottom: 10px;
}

.pulse {
  animation: pulseAnimation 1.2s ease-in-out infinite alternate;
}

@keyframes pulseAnimation {
  0% { opacity: 0.5; transform: scale(0.98); }
  100% { opacity: 1; transform: scale(1.02); }
}

.controls-hint {
  font-size: 11px;
  color: #9ab;
  letter-spacing: 0.5px;
}

/* Game Over Screen */
.gameover-title {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #ff3344;
  text-shadow: 0 0 12px rgba(255, 51, 68, 0.8);
  margin-bottom: 12px;
}

.result-details {
  width: 100%;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 50, 50, 0.3);
  border-radius: 10px;
  padding: 12px 18px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 700;
  color: #cdd;
}

.result-val {
  font-size: 20px;
  font-weight: 900;
  font-family: 'Courier New', Courier, monospace;
  color: #fff;
}

.result-val.highlight {
  color: #ffcc00;
  text-shadow: 0 0 8px rgba(255, 204, 0, 0.6);
}

.new-best-badge {
  color: #ffdd00;
  font-weight: 900;
  font-size: 13px;
  letter-spacing: 2px;
  text-align: center;
  padding-top: 4px;
  text-shadow: 0 0 10px #ffbb00;
  animation: pulseAnimation 0.8s infinite alternate;
}

.hidden {
  display: none !important;
}

.retro-button {
  pointer-events: auto;
  background: linear-gradient(180deg, #ff8c00 0%, #d85c00 100%);
  border: 2px solid #ffcc00;
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 2px;
  padding: 10px 32px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255, 140, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transition: transform 0.1s ease, filter 0.1s ease;
  margin-top: 8px;
}

.retro-button:hover {
  filter: brightness(1.15);
  transform: scale(1.04);
}

.retro-button:active {
  transform: scale(0.96);
}

/* Responsiveness on smaller screens */
@media (max-width: 600px) {
  .panel {
    padding: 16px 20px;
    width: 320px;
  }
  .glow-title {
    font-size: 32px;
  }
  .prompt-text {
    font-size: 11px;
  }
  .gameover-title {
    font-size: 30px;
  }
  .hud-item {
    padding: 4px 10px;
    min-width: 55px;
  }
  .hud-value {
    font-size: 15px;
  }
}
