* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: #0a0a1a;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

.game-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; }
canvas { display: block; width: 100%; height: 100%; }

.overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.85); color: #fff; z-index: 10;
}
.overlay.hidden { display: none; }

.overlay h1 {
  font-size: 52px; margin-bottom: 12px; color: #4fc3f7;
  text-shadow: 0 0 20px rgba(79, 195, 247, 0.5);
}
.overlay p { font-size: 18px; color: #aaa; margin-bottom: 8px; }

.coins-display { color: #ffd700 !important; font-size: 22px !important; font-weight: bold; margin-bottom: 20px !important; }

.btn-main {
  margin-top: 12px; padding: 14px 44px; font-size: 20px;
  background: #e94560; color: #fff; border: none; border-radius: 8px;
  cursor: pointer; transition: background 0.2s;
}
.btn-main:hover { background: #ff5a75; }
.btn-secondary { background: #0f3460; }
.btn-secondary:hover { background: #1a5a90; }

/* Mode selection */
.mode-buttons { display: flex; gap: 16px; margin: 16px 0; }
.controls-info { display: flex; gap: 40px; margin-top: 24px; }
.control-col { text-align: center; }
.control-col h3 { color: #4fc3f7; font-size: 16px; margin-bottom: 6px; }
.control-col p { font-size: 14px; color: #888; margin-bottom: 4px; }

/* Game Over scores */
.gameover-scores { display: flex; gap: 40px; margin: 16px 0; }
.gameover-player {
  text-align: center; padding: 16px 28px;
  background: rgba(255,255,255,0.05); border-radius: 12px;
  border: 2px solid #1a3a5c;
}
.gameover-player.winner { border-color: #ffd700; box-shadow: 0 0 15px rgba(255,215,0,0.2); }
.gameover-player h3 { font-size: 18px; margin-bottom: 4px; }
.gameover-player .go-score { font-size: 28px; font-weight: bold; margin: 4px 0; }
.gameover-player .go-coins { font-size: 14px; color: #ffd700; }
.gameover-player .go-tag { font-size: 12px; color: #ffd700; margin-top: 4px; }

/* Tabs */
.shop-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab-btn {
  padding: 10px 28px; font-size: 16px; background: #16213e; color: #888;
  border: 2px solid #1a3a5c; border-radius: 8px; cursor: pointer; transition: all 0.2s;
}
.tab-btn:hover { color: #fff; border-color: #4fc3f7; }
.tab-btn.active { background: #1a3a5c; color: #4fc3f7; border-color: #4fc3f7; }

/* Shop */
.shop-grid { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; max-width: 800px; padding: 10px; }
.shop-grid.hidden { display: none !important; }

.plane-card {
  background: #16213e; border: 2px solid #1a3a5c; border-radius: 12px;
  padding: 16px; width: 160px; text-align: center; cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
}
.plane-card:hover { border-color: #4fc3f7; transform: translateY(-2px); }
.plane-card.selected { border-color: #4fc3f7; box-shadow: 0 0 15px rgba(79, 195, 247, 0.3); }
.plane-card.locked { opacity: 0.5; }
.plane-card.locked:hover { border-color: #ffd700; }
.plane-card canvas { width: 80px; height: 80px; margin: 0 auto 8px; display: block; }
.plane-card h3 { color: #4fc3f7; font-size: 15px; margin-bottom: 6px; }
.plane-card .stats { font-size: 12px; color: #888; line-height: 1.6; }
.plane-card .price { margin-top: 8px; font-size: 14px; color: #ffd700; font-weight: bold; }
.plane-card .owned { margin-top: 8px; font-size: 13px; color: #4caf50; }

/* Upgrade Grid */
.upgrade-grid { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; max-width: 800px; padding: 10px; }
.upgrade-grid.hidden { display: none !important; }

.upgrade-card {
  background: #16213e; border: 2px solid #1a3a5c; border-radius: 12px;
  padding: 18px 20px; width: 180px; text-align: center; cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
}
.upgrade-card:hover { border-color: #4fc3f7; transform: translateY(-2px); }
.upgrade-card.maxed { opacity: 0.5; cursor: default; }
.upgrade-card.maxed:hover { border-color: #1a3a5c; transform: none; }
.upgrade-card .icon { font-size: 36px; margin-bottom: 8px; }
.upgrade-card h3 { color: #4fc3f7; font-size: 16px; margin-bottom: 6px; }
.upgrade-card .level-info { font-size: 13px; color: #aaa; margin-bottom: 4px; }
.upgrade-card .bar-track { width: 100%; height: 8px; background: #0a0a1a; border-radius: 4px; margin: 8px 0; overflow: hidden; }
.upgrade-card .bar-fill { height: 100%; background: #4fc3f7; border-radius: 4px; transition: width 0.3s; }
.upgrade-card .upgrade-price { font-size: 14px; color: #ffd700; font-weight: bold; margin-top: 6px; }
.upgrade-card .upgrade-max { font-size: 13px; color: #4caf50; margin-top: 6px; }

/* Joystick Toggle */
.joystick-toggle {
  position: fixed; top: 12px; right: 12px; z-index: 20;
  display: flex; align-items: center; gap: 8px; padding: 8px 16px;
  background: #16213e; border: 2px solid #1a3a5c; border-radius: 30px;
  color: #888; font-size: 14px; cursor: pointer; transition: all 0.2s;
}
.joystick-toggle:hover { border-color: #4fc3f7; color: #ccc; }
.joystick-toggle.active { border-color: #4caf50; color: #4caf50; background: rgba(76, 175, 80, 0.1); }
.joystick-toggle #joystickIcon { font-size: 18px; }

.gamepad-status {
  position: fixed; top: 56px; right: 12px; z-index: 20;
  padding: 10px 14px; background: rgba(22, 33, 62, 0.95); border: 1px solid #1a3a5c;
  border-radius: 12px; font-size: 12px; color: #ccc;
  display: flex; flex-direction: column; gap: 6px; min-width: 220px;
}
.gamepad-status.hidden { display: none; }

.gp-slot {
  display: flex; align-items: center; gap: 6px;
}

.gp-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  opacity: 0.3;
}
.gp-dot.active { opacity: 1; box-shadow: 0 0 6px currentColor; }

.gp-slot span:first-of-type { font-weight: bold; min-width: 24px; }

.gp-live {
  margin-left: auto; font-size: 10px; color: #888;
  font-family: monospace;
}

/* Gamepad UI highlight */
.gp-highlight {
  outline: 3px solid #4fc3f7 !important; outline-offset: 3px;
  box-shadow: 0 0 15px rgba(79, 195, 247, 0.4) !important; position: relative;
}

/* Level Banner */
.level-banner {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 5; text-align: center; animation: bannerPulse 2s ease-out forwards; pointer-events: none;
}
.level-banner.hidden { display: none; }
.level-banner h2 { font-size: 64px; color: #ffd700; text-shadow: 0 0 30px rgba(255, 215, 0, 0.6); }

@keyframes bannerPulse {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  40% { transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}
