* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}

body {
  background: #0a0a0a;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: 'Courier New', monospace;
  color: #fff;
  overflow: hidden;
  touch-action: none;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: 800px;
  max-height: 600px;
  aspect-ratio: 4 / 3;
  border: 2px solid #333;
}

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

/* Screens overlay */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: rgba(10, 10, 10, 0.9);
  z-index: 10;
}

/* Animated lobby background */
.lobby-bg {
  background: linear-gradient(135deg, #0f0c29, #1a1a2e, #16213e, #0f0c29);
  background-size: 400% 400%;
  animation: lobby-gradient 15s ease infinite;
}

@keyframes lobby-gradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Profile Button (top-left) */
#profile-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.5);
  padding: 6px 14px 6px 6px;
  border-radius: 30px;
  border: 2px solid #333;
  cursor: pointer;
  transition: border-color 0.2s;
  z-index: 11;
}

#profile-btn:hover { border-color: #4a9eff; }

#profile-avatar {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: linear-gradient(135deg, #4a9eff, #9333ea);
  border: 2px solid #fff;
  flex-shrink: 0;
}

.profile-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

#profile-name {
  font-size: 14px;
  font-weight: bold;
  color: #fff;
}

.profile-sub {
  font-size: 11px;
  color: #888;
}

/* Profile Modal */
#profile-screen {
  background: rgba(0, 0, 0, 0.85);
}

.profile-panel {
  background: #1a1a2e;
  border: 2px solid #333;
  border-radius: 16px;
  padding: 32px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  min-width: 320px;
}

.profile-panel h2 {
  font-size: 28px;
  color: #4a9eff;
  letter-spacing: 4px;
}

.profile-edit-avatar {
  width: 80px;
  height: 80px;
  border-radius: 10px;
  background: linear-gradient(135deg, #4a9eff, #9333ea);
  border: 4px solid #fff;
  cursor: pointer;
  margin-bottom: 8px;
  transition: transform 0.2s;
}

.profile-edit-avatar:hover { transform: scale(1.08); }

.profile-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 16px;
}

.profile-stat-row label {
  font-size: 14px;
  color: #888;
}

.profile-stat-row span {
  font-size: 18px;
  color: #4a9eff;
  font-weight: bold;
}

.profile-stat-row input {
  padding: 8px 12px;
  font-family: inherit;
  font-size: 16px;
  background: #0a0a0a;
  border: 2px solid #333;
  border-radius: 6px;
  color: #fff;
  outline: none;
  width: 160px;
  text-align: right;
}

.profile-stat-row input:focus {
  border-color: #4a9eff;
}

.profile-actions {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

.profile-actions .mode-btn {
  min-width: 100px;
  font-size: 16px;
  padding: 10px 24px;
}

.reset-btn {
  padding: 10px 16px;
  font-family: inherit;
  font-size: 12px;
  font-weight: bold;
  background: transparent;
  color: #ef4444;
  border: 2px solid #ef4444;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.reset-btn:hover { background: #ef4444; color: #fff; }

.hidden {
  display: none !important;
}

/* Lobby screen */
#lobby-screen {
  gap: 24px;
}

.lobby-title {
  font-size: 64px;
  font-weight: 900;
  color: #4a9eff;
  text-shadow: 0 0 30px rgba(74, 158, 255, 0.6), 0 0 60px rgba(74, 158, 255, 0.3);
  letter-spacing: 6px;
  line-height: 1;
  text-align: center;
  animation: title-pulse 2s ease-in-out infinite;
}

.lobby-title span {
  display: block;
  color: #22c55e;
  text-shadow: 0 0 30px rgba(34, 197, 94, 0.6), 0 0 60px rgba(34, 197, 94, 0.3);
}

@keyframes title-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.lobby-login {
  margin-top: 8px;
}

#username-input {
  padding: 14px 20px;
  font-family: inherit;
  font-size: 18px;
  background: #1a1a2e;
  border: 2px solid #4a9eff;
  color: #fff;
  text-align: center;
  outline: none;
  width: 280px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#username-input:focus {
  border-color: #22c55e;
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.4);
}

/* Big Play Button */
.lobby-play-btn {
  font-size: 36px;
  padding: 24px 100px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  border: 4px solid #fff;
  border-radius: 16px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 900;
  letter-spacing: 8px;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
  box-shadow: 0 8px 0 #15803d, 0 12px 30px rgba(0, 0, 0, 0.5);
  transition: transform 0.1s, box-shadow 0.1s;
  animation: play-glow 1.5s ease-in-out infinite;
}

.lobby-play-btn:hover {
  background: linear-gradient(135deg, #4ade80, #22c55e);
  transform: translateY(-2px);
  box-shadow: 0 10px 0 #15803d, 0 16px 40px rgba(34, 197, 94, 0.5);
}

.lobby-play-btn:active {
  transform: translateY(4px);
  box-shadow: 0 4px 0 #15803d, 0 6px 15px rgba(0, 0, 0, 0.5);
}

@keyframes play-glow {
  0%, 100% { box-shadow: 0 8px 0 #15803d, 0 12px 30px rgba(0, 0, 0, 0.5); }
  50% { box-shadow: 0 8px 0 #15803d, 0 12px 40px rgba(34, 197, 94, 0.6); }
}

/* Lobby info / controls */
.lobby-info {
  display: flex;
  gap: 24px;
  margin-top: 16px;
}

.lobby-stat {
  font-size: 13px;
  color: #888;
  text-align: center;
}

.lobby-stat span {
  display: block;
  color: #4a9eff;
  font-weight: bold;
  font-size: 15px;
  margin-bottom: 2px;
}

/* Mode Buttons */
.mode-buttons {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}

.mode-btn {
  padding: 16px 40px;
  font-family: inherit;
  font-size: 22px;
  font-weight: bold;
  color: #fff;
  border: 3px solid rgba(255,255,255,0.3);
  border-radius: 12px;
  cursor: pointer;
  letter-spacing: 3px;
  transition: transform 0.1s, box-shadow 0.1s;
  min-width: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.mode-btn:hover { transform: translateY(-2px); }
.mode-btn:active { transform: translateY(2px); }

.mode-btn-blue {
  background: linear-gradient(135deg, #4a9eff, #2563eb);
  box-shadow: 0 6px 0 #1e40af;
}
.mode-btn-blue:hover { box-shadow: 0 8px 0 #1e40af, 0 8px 20px rgba(74,158,255,0.4); }

.mode-btn-green {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  box-shadow: 0 6px 0 #15803d;
}
.mode-btn-green:hover { box-shadow: 0 8px 0 #15803d, 0 8px 20px rgba(34,197,94,0.4); }

.mode-btn-purple {
  background: linear-gradient(135deg, #a855f7, #9333ea);
  box-shadow: 0 6px 0 #7e22ce;
}
.mode-btn-purple:hover { box-shadow: 0 8px 0 #7e22ce, 0 8px 20px rgba(168,85,247,0.4); }

.mode-btn-red {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  box-shadow: 0 6px 0 #7f1d1d;
}
.mode-btn-red:hover { box-shadow: 0 8px 0 #7f1d1d, 0 8px 20px rgba(239,68,68,0.4); }

.mode-icon {
  font-size: 13px;
  opacity: 0.7;
  background: rgba(0,0,0,0.2);
  padding: 4px 10px;
  border-radius: 6px;
}

.mode-label {
  font-size: 22px;
}

/* Level Select */
.select-title {
  font-size: 28px;
  color: #4a9eff;
  margin-bottom: 20px;
  letter-spacing: 3px;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  max-width: 500px;
  margin-bottom: 20px;
}

.level-cell {
  aspect-ratio: 1;
  background: #1a1a2e;
  border: 2px solid #333;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: bold;
  color: #666;
  cursor: pointer;
  transition: all 0.15s;
}

.level-cell:hover { border-color: #4a9eff; }
.level-cell.unlocked { color: #4a9eff; border-color: #2563eb; }
.level-cell.unlocked:hover { background: #2563eb; color: #fff; }
.level-cell.completed { background: #16a34a; border-color: #22c55e; color: #fff; }
.level-cell.locked { color: #333; cursor: not-allowed; }

.lock-icon {
  font-size: 22px;
  opacity: 0.5;
  filter: grayscale(1);
}

.level-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.nav-btn {
  padding: 8px 20px;
  font-size: 14px;
  background: #333;
  border: 2px solid #555;
  border-radius: 6px;
  color: #fff;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
}

.nav-btn:hover { background: #4a9eff; border-color: #4a9eff; }

.page-info { color: #888; font-size: 14px; }

.back-btn {
  padding: 8px 24px;
  font-size: 14px;
  background: transparent;
  border: 2px solid #555;
  border-radius: 6px;
  color: #888;
  font-family: inherit;
  cursor: pointer;
  margin-top: 8px;
}

.back-btn:hover { border-color: #ef4444; color: #ef4444; }

/* HUD mode badge */
.hud-mode {
  margin-left: auto;
  font-style: italic;
}

.hud-mode span { color: #a855f7; }

/* Upgrade Button (lobby) */
.upgrade-btn {
  padding: 10px 32px;
  font-family: inherit;
  font-size: 16px;
  font-weight: bold;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  border: 3px solid #fbbf24;
  border-radius: 10px;
  cursor: pointer;
  letter-spacing: 3px;
  margin-top: 4px;
  box-shadow: 0 4px 0 #b45309;
  transition: transform 0.1s;
}

.upgrade-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #b45309; }
.upgrade-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #b45309; }

/* Upgrade Screen */
.upgrade-coins {
  font-size: 18px;
  color: #fbbf24;
  margin-bottom: 20px;
}

.upgrade-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 500px;
}

.upgrade-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #1a1a2e;
  border: 2px solid #333;
  border-radius: 12px;
  padding: 14px 20px;
}

.upgrade-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 900;
  color: #fff;
  flex-shrink: 0;
}

.upgrade-icon-speed { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.upgrade-icon-power { background: linear-gradient(135deg, #ef4444, #dc2626); }
.upgrade-icon-life { background: linear-gradient(135deg, #22c55e, #16a34a); }

.upgrade-detail {
  flex: 1;
}

.upgrade-detail h3 {
  font-size: 16px;
  color: #fff;
  letter-spacing: 2px;
}

.upgrade-detail p {
  font-size: 12px;
  color: #888;
  margin: 2px 0 6px;
}

.upgrade-bar {
  height: 8px;
  background: #0a0a0a;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 4px;
}

.upgrade-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s;
}

.upgrade-cost {
  font-size: 12px;
  color: #fbbf24;
}

.upgrade-buy-btn {
  padding: 8px 16px;
  font-family: inherit;
  font-size: 12px;
  font-weight: bold;
  background: #f59e0b;
  color: #fff;
  border: 2px solid #fbbf24;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
}

.upgrade-buy-btn:hover { background: #fbbf24; }
.upgrade-buy-btn:disabled { background: #333; border-color: #444; color: #666; cursor: not-allowed; }

/* Lobby bottom buttons row */
.lobby-bottom-btns {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

.leaderboard-btn {
  padding: 10px 32px;
  font-family: inherit;
  font-size: 16px;
  font-weight: bold;
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  color: #fff;
  border: 3px solid #fb7185;
  border-radius: 10px;
  cursor: pointer;
  letter-spacing: 3px;
  box-shadow: 0 4px 0 #9f1239;
  transition: transform 0.1s;
}

.leaderboard-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #9f1239; }
.leaderboard-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #9f1239; }

/* Leaderboard Screen */
.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  max-width: 420px;
  margin-bottom: 20px;
  max-height: 350px;
  overflow-y: auto;
}

.lb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: #1a1a2e;
  border: 2px solid #333;
  border-radius: 8px;
}

.lb-row.current {
  border-color: #22c55e;
  background: #0f2914;
}

.lb-row.gold { border-color: #fbbf24; background: #291f0a; }
.lb-row.silver { border-color: #9ca3af; background: #1f1f24; }
.lb-row.bronze { border-color: #d97706; background: #291c0a; }

.lb-rank {
  font-size: 18px;
  font-weight: 900;
  color: #4a9eff;
  width: 36px;
  text-align: center;
  flex-shrink: 0;
}

.lb-row.gold .lb-rank { color: #fbbf24; }
.lb-row.silver .lb-rank { color: #9ca3af; }
.lb-row.bronze .lb-rank { color: #d97706; }

.lb-name {
  flex: 1;
  font-size: 15px;
  color: #fff;
}

.lb-score {
  font-size: 16px;
  color: #22c55e;
  font-weight: bold;
}

.lb-level {
  font-size: 12px;
  color: #888;
}

.lb-empty {
  color: #555;
  text-align: center;
  padding: 40px;
}

/* Ship selection button (lobby) */
.ships-btn {
  padding: 10px 32px;
  font-family: inherit;
  font-size: 16px;
  font-weight: bold;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  border: 3px solid #818cf8;
  border-radius: 10px;
  cursor: pointer;
  letter-spacing: 3px;
  box-shadow: 0 4px 0 #3730a3;
  transition: transform 0.1s;
}

.ships-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #3730a3; }
.ships-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #3730a3; }

/* Skins button (lobby) */
.skins-btn2 {
  padding: 10px 32px;
  font-family: inherit;
  font-size: 16px;
  font-weight: bold;
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #fff;
  border: 3px solid #fb923c;
  border-radius: 10px;
  cursor: pointer;
  letter-spacing: 3px;
  box-shadow: 0 4px 0 #9a3412;
  transition: transform 0.1s;
}

.skins-btn2:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #9a3412; }
.skins-btn2:active { transform: translateY(2px); box-shadow: 0 2px 0 #9a3412; }

/* Skin Grid */
.skin-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 420px;
  margin-bottom: 20px;
}

.skin-card {
  aspect-ratio: 1;
  border-radius: 10px;
  border: 3px solid #333;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: border-color 0.2s, transform 0.1s;
  position: relative;
  overflow: hidden;
}

.skin-card:hover { transform: scale(1.05); }
.skin-card.selected { border-color: #22c55e; box-shadow: 0 0 12px rgba(34,197,94,0.5); }
.skin-card.locked { opacity: 0.35; cursor: not-allowed; }

.skin-preview-ship {
  width: 28px;
  height: 20px;
  border-radius: 3px;
}

.skin-name {
  font-size: 9px;
  color: #fff;
  text-align: center;
  text-shadow: 1px 1px 2px #000;
}

.skin-lock {
  font-size: 20px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Ship Select Screen */
.ship-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 480px;
  margin-bottom: 20px;
  max-height: 380px;
  overflow-y: auto;
}

.ship-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: #1a1a2e;
  border: 2px solid #333;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.ship-card:hover { border-color: #6366f1; }
.ship-card.selected { border-color: #22c55e; background: #0f2914; }
.ship-card.locked { opacity: 0.4; cursor: not-allowed; }

.ship-preview {
  width: 48px;
  height: 36px;
  border-radius: 4px;
  flex-shrink: 0;
  position: relative;
}

.ship-info { flex: 1; }

.ship-info h3 {
  font-size: 15px;
  color: #fff;
  letter-spacing: 1px;
}

.ship-info p {
  font-size: 11px;
  color: #888;
}

.ship-stats {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.ship-stat-tag {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #333;
  color: #aaa;
}

.ship-stat-tag.damage { background: #f43f5e; color: #fff; }
.ship-stat-tag.multishot { background: #ef4444; color: #fff; }
.ship-stat-tag.homing { background: #f59e0b; color: #fff; }
.ship-stat-tag.shield { background: #4a9eff; color: #fff; }

.ship-unlock {
  font-size: 11px;
  color: #fbbf24;
  flex-shrink: 0;
}

.ship-equipped {
  font-size: 11px;
  color: #22c55e;
  font-weight: bold;
  flex-shrink: 0;
}

/* Game Over buttons */
@keyframes boss-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.7; }
}

.gameover-buttons {
  display: flex;
  gap: 16px;
  margin-top: 24px;
}

button {
  padding: 12px 32px;
  font-family: inherit;
  font-size: 18px;
  font-weight: bold;
  background: #4a9eff;
  color: #fff;
  border: none;
  cursor: pointer;
  letter-spacing: 2px;
  transition: background 0.2s;
}

button:hover {
  background: #22c55e;
}

#login-message {
  color: #ef4444;
  font-size: 14px;
  margin-top: 12px;
  min-height: 20px;
}

/* HUD */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-around;
  padding: 8px;
  background: rgba(0, 0, 0, 0.6);
  z-index: 5;
  pointer-events: none;
}

.hud-item {
  font-size: 14px;
  color: #ddd;
}

.hud-item span {
  color: #4a9eff;
  font-weight: bold;
}

/* Game Over */
#gameover-screen h2 {
  font-size: 42px;
  color: #ef4444;
  margin-bottom: 24px;
  letter-spacing: 4px;
}

#gameover-screen p {
  font-size: 18px;
  margin-bottom: 8px;
}

#gameover-screen span {
  color: #4a9eff;
}

#gameover-screen button {
  margin-top: 24px;
}

/* ============================================
   TOUCH CONTROLS (mobile/tablet)
   ============================================ */
#touch-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 45%;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  z-index: 6;
  pointer-events: none;
}

/* Virtual Joystick */
#joystick-zone {
  width: 140px;
  height: 140px;
  margin: 0 0 20px 20px;
  position: relative;
  pointer-events: auto;
}

#joystick-base {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  position: absolute;
  bottom: 0;
  left: 0;
  touch-action: none;
}

#joystick-thumb {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(74, 158, 255, 0.6);
  border: 2px solid rgba(74, 158, 255, 0.9);
  position: absolute;
  top: 35px;
  left: 35px;
  transition: background 0.1s;
}

#joystick-thumb.active {
  background: rgba(34, 197, 94, 0.7);
  border-color: rgba(34, 197, 94, 1);
}

/* Action Buttons */
#action-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0 20px 20px 0;
  pointer-events: auto;
}

.touch-btn {
  font-family: inherit;
  font-weight: bold;
  border: 3px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  touch-action: none;
  transition: transform 0.05s, background 0.05s;
}

.touch-btn:active {
  transform: scale(0.92);
}

.touch-btn-fire {
  width: 90px;
  height: 90px;
  font-size: 18px;
  background: rgba(239, 68, 68, 0.6);
  border-color: rgba(239, 68, 68, 0.8);
  color: #fff;
}

.touch-btn-fire:active {
  background: rgba(239, 68, 68, 0.9);
}

.touch-btn-small {
  width: 60px;
  height: 60px;
  font-size: 14px;
  background: rgba(251, 191, 36, 0.5);
  border-color: rgba(251, 191, 36, 0.7);
  color: #fff;
}

.touch-btn-small:active {
  background: rgba(251, 191, 36, 0.8);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 600px) {
  .lobby-title {
    font-size: 32px !important;
    letter-spacing: 3px !important;
  }

  #username-input {
    font-size: 14px !important;
    width: 180px !important;
    padding: 10px 14px !important;
  }

  /* Mode buttons stack tighter */
  .mode-btn {
    font-size: 16px !important;
    min-width: 220px !important;
    padding: 12px 24px !important;
  }

  .mode-icon {
    font-size: 11px !important;
    padding: 3px 8px !important;
  }

  /* Bottom buttons: smaller and wrap */
  .lobby-bottom-btns {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px !important;
  }

  .upgrade-btn, .ships-btn, .skins-btn2, .leaderboard-btn {
    font-size: 11px !important;
    padding: 8px 14px !important;
    letter-spacing: 1px !important;
  }

  .lobby-info {
    gap: 8px !important;
  }

  .lobby-stat {
    font-size: 10px !important;
  }

  .hud-item {
    font-size: 11px !important;
  }

  #gameover-screen h2 {
    font-size: 28px !important;
  }

  /* Profile button smaller */
  #profile-btn {
    padding: 4px 10px 4px 4px;
    gap: 6px;
  }
  #profile-avatar {
    width: 28px;
    height: 28px;
  }
  #profile-name {
    font-size: 12px;
  }
  .profile-sub {
    font-size: 10px;
  }

  /* Screens scroll on small phones */
  #lobby-screen {
    overflow-y: auto;
    padding: 48px 12px 12px;
  }

  #joystick-zone {
    width: 110px;
    height: 110px;
    margin: 0 0 12px 12px;
  }

  #joystick-base {
    width: 100px;
    height: 100px;
  }

  .touch-btn-fire {
    width: 75px;
    height: 75px;
    font-size: 16px;
  }

  .touch-btn-small {
    width: 50px;
    height: 50px;
    font-size: 12px;
  }

  #action-buttons {
    margin: 0 12px 12px 0;
  }

  /* Level select grid */
  .level-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    max-width: 300px !important;
  }

  /* Ship/upgrade/leaderboard lists */
  .ship-card, .upgrade-card, .lb-row {
    padding: 8px 12px !important;
  }

  .select-title {
    font-size: 22px !important;
  }
}

/* Tablet fine-tuning */
@media (min-width: 601px) and (max-width: 1024px) {
  .lobby-title {
    font-size: 48px !important;
  }
}
