@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Rubik:wght@400;600;800&display=swap');

/* ==========================================================================
   Base & Reset
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-color: #080b11;
  --panel-bg: rgba(18, 24, 38, 0.85);
  --border-color: #2a364f;
  --accent-gold: #fbbf24;
  --accent-cyan: #38bdf8;
  --accent-green: #34d399;
  --accent-purple: #c084fc;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --pixel-font: 'Press Start 2P', monospace, sans-serif;
  --ui-font: 'Rubik', system-ui, sans-serif;
  --canvas-max-width: 1060px;
}

html,
body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-color);
  background-image:
    radial-gradient(circle at 50% 15%, rgba(56, 189, 248, 0.09) 0%, transparent 60%),
    radial-gradient(circle at 80% 85%, rgba(192, 132, 252, 0.07) 0%, transparent 50%),
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 32px 32px, 32px 32px;
  color: var(--text-main);
  font-family: var(--ui-font);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* ==========================================================================
   Main Game Container
   ========================================================================== */
.game-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 100vw;
  padding: 12px;
}

/* ==========================================================================
   Arcade Header
   ========================================================================== */
.game-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}

.game-header.header-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-8px);
}

.game-title {
  font-family: var(--pixel-font);
  font-size: clamp(16px, 2.5vw, 24px);
  color: var(--accent-gold);
  text-shadow:
    0 0 12px rgba(251, 191, 36, 0.5),
    3px 3px 0px #000;
  letter-spacing: 1px;
}

.game-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.5px;
}

/* ==========================================================================
   Canvas Screen Frame (16:9 1280x720)
   ========================================================================== */
.canvas-container {
  position: relative;
  width: min(var(--canvas-max-width), 95vw);
  aspect-ratio: 16 / 9;
  background: #020617;
  border-radius: 12px;
  box-shadow:
    0 24px 48px -15px rgba(0, 0, 0, 0.85),
    0 0 0 2px var(--border-color),
    0 0 35px rgba(56, 189, 248, 0.18);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-crisp-edges;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background-color: #000;
}

/* ==========================================================================
   Loading Overlay
   ========================================================================== */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 11, 17, 0.94);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  z-index: 10;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

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

.loading-title {
  font-family: var(--pixel-font);
  font-size: 14px;
  color: var(--accent-cyan);
  animation: pulse 1.5s infinite ease-in-out;
}

.progress-bar-container {
  width: 280px;
  height: 16px;
  background: #1e293b;
  border: 2px solid #334155;
  border-radius: 999px;
  overflow: hidden;
  padding: 2px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.progress-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-green));
  border-radius: 999px;
  transition: width 0.15s ease-out;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

.progress-text {
  font-family: var(--pixel-font);
  font-size: 11px;
  color: var(--text-muted);
}

/* ==========================================================================
   Status Footer & Badges
   ========================================================================== */
.game-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(var(--canvas-max-width), 95vw);
  font-size: 12px;
  color: var(--text-muted);
  padding: 2px 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 6px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11px;
}

/* ==========================================================================
   Audio Controls
   ========================================================================== */
.audio-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 10px;
}

.audio-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  border-radius: 4px;
  transition: transform 0.15s ease, filter 0.2s ease;
}

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

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

.audio-btn.muted {
  filter: grayscale(1) opacity(0.65);
}

.audio-icon {
  font-size: 13px;
  user-select: none;
}

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 78px;
  height: 5px;
  background: #253347;
  border-radius: 999px;
  outline: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.volume-slider:hover {
  background: #334661;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.7);
  cursor: pointer;
  transition: transform 0.12s ease, background 0.2s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  background: var(--accent-gold);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.8);
}

.volume-slider::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border: none;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.7);
  cursor: pointer;
}

.volume-text {
  font-family: var(--pixel-font);
  font-size: 9px;
  color: var(--accent-cyan);
  min-width: 32px;
  text-align: right;
  letter-spacing: 0.5px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #eab308;
}

.status-dot.ready {
  background-color: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}

@keyframes pulse {

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

  50% {
    opacity: 0.7;
    transform: scale(0.98);
  }
}