/* Base reset and typography — mobile-first */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, Helvetica, sans-serif;
  color: #fff;
  background: #000;
  /* Kill rubber-band / pull-to-refresh that breaks twin-stick play */
  overscroll-behavior: none;
  touch-action: none;
  position: fixed;
  inset: 0;
}

/* Allow scrolling only inside modals / panels */
.modal, .modal-content, .wave-upgrade-panel, .wave-upgrade-cards,
.hangar-modal, .shopGrid, .leaderboard-list, .terminal-logs,
#hangarOverlay #hangarContent, #shopCard,
.social-modal, .social-modal-content {
  touch-action: pan-y;
  overscroll-behavior: contain;
}

/* Interactive UI must stay tappable under body { touch-action: none }.
   manipulation = allow taps, disable double-tap zoom delay. */
button,
a,
select,
input,
textarea,
label,
.nav-btn,
.startButton-primary,
.footer-btn,
.closeBtn,
.btnBuy,
.secondaryBtn,
.pause-menu-btn,
.filter-btn,
.ship-select-btn,
.hangar-tab-btn,
.hangar-close-btn,
#unifiedMenuButton,
#abilityQBtn {
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  cursor: pointer;
}

/* Start screen must stay tappable above residual loading/canvas layers.
   Later #startScreen rules also set layout — keep z-index high enough that
   gameContainer (z:10) and leftover overlays never steal taps. */
#startScreen {
  z-index: 40 !important;
  pointer-events: auto;
}

#startScreen .start-main,
#startScreen .start-nav,
#startScreen .start-footer {
  position: relative;
  z-index: 1;
  pointer-events: auto;
}

#startScreen .nav-btn,
#startScreen .startButton-primary,
#startScreen .footer-btn,
#startScreen select {
  pointer-events: auto;
  position: relative;
  z-index: 2;
}

/* Icons/labels inside nav buttons must not steal the hit target */
#startScreen .nav-btn img,
#startScreen .nav-btn .nav-icon,
#startScreen .nav-btn .nav-label,
#startScreen .nav-btn span {
  pointer-events: none;
}

/* ==========================================
   INITIAL LOADING OVERLAY
   ========================================== */

.loading-overlay {
  position: fixed;
  inset: 0;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  pointer-events: auto;
}

.loading-overlay.loaded {
  animation: loadingFadeOut 0.8s ease forwards;
}

@keyframes loadingFadeOut {
  0% {
    opacity: 1;
    visibility: visible;
  }
  99% {
    opacity: 0;
    visibility: visible;
  }
  100% {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
}

.loading-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  width: 90%;
  max-width: 900px;
  padding: 40px 20px;
}

/* Title with streaming effect */
.loading-title-main {
  font-size: clamp(56px, 12vw, 120px);
  font-weight: 900;
  color: #4ade80;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-align: center;
  margin: 0 0 20px 0;
  text-shadow: 
    0 0 30px rgba(74, 222, 128, 0.8),
    0 0 60px rgba(74, 222, 128, 0.5),
    0 0 90px rgba(74, 222, 128, 0.3),
    0 4px 12px rgba(0, 0, 0, 0.9);
  opacity: 0;
  transform: translateY(-20px);
  animation: titleReveal 1s ease-out forwards;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

@keyframes titleReveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Terminal logs - larger, more prominent */
.terminal-logs {
  width: 100%;
  min-height: 260px;
  max-height: 360px;
  background: rgba(5, 5, 5, 0.85);
  border: 1px solid rgba(74, 222, 128, 0.4);
  border-radius: 12px;
  padding: 20px 24px;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Courier New', monospace;
  font-size: 15px;
  color: #4ade80;
  overflow-y: auto;
  line-height: 1.8;
  text-shadow: 0 0 8px rgba(74, 222, 128, 0.6);
  box-shadow: 
    0 0 30px rgba(74, 222, 128, 0.25),
    inset 0 2px 15px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
}

.terminal-logs::-webkit-scrollbar {
  width: 10px;
}

.terminal-logs::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.5);
  border-radius: 5px;
}

.terminal-logs::-webkit-scrollbar-thumb {
  background: rgba(74, 222, 128, 0.5);
  border-radius: 5px;
  border: 2px solid rgba(0, 0, 0, 0.3);
}

.terminal-logs::-webkit-scrollbar-thumb:hover {
  background: rgba(74, 222, 128, 0.7);
}

.terminal-line {
  margin-bottom: 6px;
  opacity: 0;
  animation: terminalFadeIn 0.4s ease forwards;
  font-weight: 500;
}

@keyframes terminalFadeIn {
  to {
    opacity: 1;
  }
}

.terminal-line .prompt {
  color: #22c55e;
  margin-right: 10px;
  font-weight: 700;
}

.terminal-line .timestamp {
  color: #86efac;
  margin-right: 10px;
  opacity: 0.8;
  font-size: 14px;
}

.terminal-line .status-ok {
  color: #4ade80;
  font-weight: 500;
}

.terminal-line .status-warn {
  color: #fbbf24;
  font-weight: 600;
}

.terminal-line .status-info {
  color: #60a5fa;
  font-weight: 500;
}

.terminal-line .status-highlight {
  color: #a78bfa;
  font-weight: 600;
  text-shadow: 0 0 10px rgba(167, 139, 250, 0.6);
}

/* Progress bar - smaller and minimal */
.loading-bar-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.loading-bar {
  position: relative;
  width: 100%;
  max-width: 600px;
  height: 8px;
  background: rgba(20, 20, 20, 0.9);
  border: 1px solid rgba(74, 222, 128, 0.3);
  border-radius: 4px;
  overflow: visible;
  box-shadow: 
    0 0 15px rgba(74, 222, 128, 0.2),
    inset 0 1px 5px rgba(0, 0, 0, 0.8);
}

.loading-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, 
    rgba(74, 222, 128, 0.6) 0%, 
    rgba(74, 222, 128, 0.9) 50%, 
    rgba(74, 222, 128, 0.6) 100%);
  border-radius: 3px;
  box-shadow: 
    0 0 12px rgba(74, 222, 128, 0.7),
    inset 0 1px 2px rgba(255, 255, 255, 0.4);
  transition: width 0.3s ease-out;
}

.loading-ship-canvas {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  pointer-events: none;
  z-index: 10;
  filter: drop-shadow(0 0 8px rgba(14, 165, 233, 0.8));
}

/* START SCREEN - Refined Compact Design */
#startScreen {
  position: absolute;
  inset: 0;
  background: #000000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  z-index: 20;
  padding: max(16px, env(safe-area-inset-top, 0px))
           max(12px, env(safe-area-inset-right, 0px))
           max(16px, env(safe-area-inset-bottom, 0px))
           max(12px, env(safe-area-inset-left, 0px));
  overflow: hidden;
}

/* Header with title and tagline */
.start-header {
  text-align: center;
  margin-bottom: 4px;
  position: relative;
  z-index: 1;
  animation: fadeSlideDown 1s ease-out 0.5s both;
}

@keyframes fadeSlideDown {
  0% {
    opacity: 0;
    transform: translateY(-30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

#gameTitle {
  font-size: clamp(42px, 10vw, 72px);
  font-weight: 900;
  color: #e2e8f0;
  letter-spacing: 0.12em;
  text-shadow: 0 0 30px rgba(74, 222, 128, 0.6), 0 2px 0 #0f172a;
  line-height: 1;
  animation: titlePulseGlow 3s ease-in-out infinite;
}

@keyframes titlePulseGlow {
  0%, 100% {
    text-shadow: 
      0 0 30px rgba(74, 222, 128, 0.6),
      0 0 60px rgba(74, 222, 128, 0.3),
      0 2px 0 #0f172a;
  }
  50% {
    text-shadow: 
      0 0 40px rgba(74, 222, 128, 0.8),
      0 0 80px rgba(74, 222, 128, 0.5),
      0 0 120px rgba(74, 222, 128, 0.2),
      0 2px 0 #0f172a;
  }
}

.title-accent {
  color: #4ade80;
  text-shadow: 0 0 40px rgba(74, 222, 128, 0.9), 0 0 80px rgba(74, 222, 128, 0.4);
  display: inline-block;
  animation: titleAccentFloat 4s ease-in-out infinite;
}

.title-accent:first-child {
  animation-delay: 0s;
}

.title-accent:last-child {
  animation-delay: 0.2s;
}

@keyframes titleAccentFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

.title-tagline {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  letter-spacing: 0.35em;
  margin-top: 6px;
  text-transform: uppercase;
  animation: fadeIn 1s ease-out 1s both;
}

.gameplay-hint {
  margin-top: 16px;
  padding: 8px 20px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(74, 222, 128, 0.3);
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  backdrop-filter: blur(10px);
  animation: fadeIn 1s ease-out 1.5s both, hintFloat 3s ease-in-out infinite 2s;
}

@keyframes hintFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

.hint-icon {
  font-size: 16px;
  animation: hintIconSpin 10s linear infinite;
}

@keyframes hintIconSpin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.hint-text {
  font-size: 11px;
  font-weight: 600;
  color: #86efac;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

@keyframes fadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

#startGraphicCanvas {
  width: min(360px, 85vw);
  height: 140px;
  background: linear-gradient(180deg, #030712 0%, #0f172a 100%);
  border-radius: 8px;
  border: 1px solid rgba(74, 222, 128, 0.35);
  box-shadow: 0 0 30px rgba(74, 222, 128, 0.15), inset 0 0 60px rgba(0, 0, 0, 0.5);
}

/* Main action area */
.start-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
  position: relative;
  z-index: 1;
  animation: fadeSlideUp 1s ease-out 0.8s both;
}

@keyframes fadeSlideUp {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.startButton-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 64px;
  font-size: 20px;
  font-weight: 900;
  background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
  color: #000000;
  border: 2px solid #22c55e;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 
    0 0 30px rgba(74, 222, 128, 0.5), 
    0 4px 20px rgba(74, 222, 128, 0.3), 
    inset 0 1px 0 rgba(255,255,255,0.2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  position: relative;
  min-width: 260px;
  overflow: hidden;
  animation: buttonPulse 2s ease-in-out infinite;
}

@keyframes buttonPulse {
  0%, 100% {
    box-shadow: 
      0 0 30px rgba(74, 222, 128, 0.5), 
      0 4px 20px rgba(74, 222, 128, 0.3), 
      inset 0 1px 0 rgba(255,255,255,0.2);
  }
  50% {
    box-shadow: 
      0 0 40px rgba(74, 222, 128, 0.7), 
      0 6px 30px rgba(74, 222, 128, 0.5),
      0 0 60px rgba(74, 222, 128, 0.3),
      inset 0 1px 0 rgba(255,255,255,0.3);
  }
}

.startButton-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.3) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: buttonShine 3s ease-in-out infinite;
}

@keyframes buttonShine {
  0%, 100% {
    transform: translateX(-100%);
  }
  50% {
    transform: translateX(100%);
  }
}

.startButton-primary .btn-icon {
  font-size: 14px;
}

.startButton-primary:hover {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  box-shadow: 0 0 40px rgba(74, 222, 128, 0.7), 0 6px 30px rgba(74, 222, 128, 0.4), inset 0 1px 0 rgba(255,255,255,0.3);
  transform: translateY(-2px);
}

.startButton-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(74, 222, 128, 0.4);
}

/* Inline difficulty selector */
.difficulty-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.difficultyDropdown {
  background: rgba(15, 23, 42, 0.8);
  color: #94a3b8;
  border: 1px solid rgba(100, 116, 139, 0.3);
  border-radius: 6px;
  padding: 6px 24px 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.difficultyDropdown:hover {
  border-color: rgba(74, 222, 128, 0.5);
  color: #e2e8f0;
}

.difficultyDropdown:focus {
  border-color: #4ade80;
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.2);
}

/* Game Mode and Planet Selection */
.game-mode-section,
.planet-select-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.mode-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #6b7280;
  font-weight: 600;
}

.gameModeDropdown,
.planetDropdown {
  background: rgba(15, 23, 42, 0.9);
  color: #e2e8f0;
  border: 1px solid rgba(100, 116, 139, 0.4);
  border-radius: 8px;
  padding: 8px 32px 8px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  min-width: 200px;
}

.gameModeDropdown:hover,
.planetDropdown:hover {
  border-color: rgba(74, 222, 128, 0.6);
  background: rgba(30, 41, 59, 0.9);
}

.gameModeDropdown:focus,
.planetDropdown:focus {
  border-color: #4ade80;
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.25);
}

.planet-select-section {
  animation: fadeSlideIn 0.3s ease;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Navigation buttons row — wraps cleanly in portrait */
.start-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: 6px;
  margin-top: 4px;
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  max-width: 100%;
  padding: 0 4px;
  box-sizing: border-box;
  animation: fadeSlideUp 1s ease-out 1.1s both;
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 10px 10px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(74, 222, 128, 0.3);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 0;
  flex: 1 1 calc(33.333% - 6px);
  max-width: calc(33.333% - 4px);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.nav-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(74, 222, 128, 0.2), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.nav-btn:hover::before {
  opacity: 1;
}

.nav-btn:hover {
  background: rgba(74, 222, 128, 0.1);
  border-color: #4ade80;
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(74, 222, 128, 0.3);
}

.nav-btn:active {
  transform: translateY(0);
}

.nav-icon {
  font-size: 18px;
  line-height: 1;
  transition: transform 0.2s ease;
}

.nav-btn:hover .nav-icon {
  transform: scale(1.1);
}

.nav-label {
  font-size: 10px;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  transition: color 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Hide bulky daily-best under Daily on tiny screens — still available in Daily screen */
#dailyBestDisplay {
  display: none !important;
}

.nav-btn:hover .nav-label {
  color: #4ade80;
}

/* Footer with social icons */
.start-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(100, 116, 139, 0.15);
  position: relative;
  z-index: 1;
  animation: fadeIn 1s ease-out 1.4s both;
}

.footer-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(74, 222, 128, 0.25);
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
  color: #6b7280;
  backdrop-filter: blur(5px);
  position: relative;
}

.footer-btn::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(74, 222, 128, 0.3), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.footer-btn:hover::after {
  opacity: 1;
}

.footer-btn:hover {
  background: rgba(74, 222, 128, 0.15);
  border-color: #4ade80;
  color: #4ade80;
  transform: scale(1.1);
  box-shadow: 0 0 15px rgba(74, 222, 128, 0.3);
}

.footer-btn-text {
  width: auto;
  border-radius: 6px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.footer-divider {
  width: 1px;
  height: 20px;
  background: rgba(100, 116, 139, 0.2);
  margin: 0 4px;
}

/* Legacy support - keep these for compatibility */
.menuRow {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 420px;
  margin-top: 12px;
}

.menuButton {
  padding: 16px 32px;
  font-size: 18px;
  font-weight: 800;
  background: linear-gradient(135deg, #4ade80, #22c55e);
  color: #000;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 16px rgba(74, 222, 128, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: relative;
  overflow: hidden;
}
.menuButton::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.menuButton:hover {
  background: linear-gradient(135deg, #22c55e, #4ade80);
  box-shadow: 0 6px 24px rgba(74, 222, 128, 0.6);
  transform: translateY(-2px);
}
.menuButton:hover::before {
  opacity: 1;
}
.menuButton:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(74, 222, 128, 0.4);
}
.menuSecondary {
  background: rgba(30, 41, 59, 0.9);
  color: #e2e8f0;
  border: 2px solid rgba(148, 163, 184, 0.4);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.menuSecondary:hover {
  background: rgba(74, 222, 128, 0.2);
  border-color: rgba(74, 222, 128, 0.6);
  box-shadow: 0 6px 20px rgba(74, 222, 128, 0.3);
  color: #fff;
}

/* GAME */
#gameContainer {
  position: absolute;
  inset: 0;
  display: none;
  z-index: 10;
  /* HUD sits inside; canvas fills full bleed under safe area */
  box-sizing: border-box;
}

#gameCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  z-index: 1;
}

/* HUD - Optimized for mobile */
#uiPanel, #leftControls, #centerControls, #rightControls {
  position: absolute;
  z-index: 4;
  opacity: 0.95;
}

#uiPanel {
  top: max(4px, env(safe-area-inset-top, 0px));
  left: max(4px, env(safe-area-inset-left, 0px));
  right: max(4px, env(safe-area-inset-right, 0px));
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 3px 6px;
  background: rgba(0,0,0,0.55);
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.12);
  max-width: calc(100vw - 8px);
  pointer-events: auto;
  /* Keep menu button above mission chip */
  z-index: 160;
}

.ui-stat-row {
  display: flex;
  align-items: center;
  gap: 2px;
  font-weight: 700;
  font-size: 10px;
  flex-shrink: 1;
  min-width: 0;
}

.ui-text-label {
  font-size: 8px;
  color: #bbb;
  white-space: nowrap;
}

.ui-text-value {
  font-size: 11px;
  min-width: 18px;
  text-align: right;
  white-space: nowrap;
}

.ui-bar-container {
  width: 40px;
  height: 7px;
  background: rgba(0,0,0,0.4);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.12);
  flex-shrink: 0;
}

/* Mission overlay fully disabled during combat — no on-screen tracker */
.mission-hud,
#missionHud {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  position: absolute !important;
  left: -9999px !important;
}

.ui-bar-fill {
  height: 100%;
  width: 100%;
  border-radius: 3px;
  transition: width 0.12s ease-out;
}

#xpBar {
  background: #4ade80;
}

.ui-bar-container.xp {
  width: 60px;
}

.ui-bar-container.ult {
  width: 60px;
  border: 1px solid rgba(250, 204, 21, 0.45);
}

#ultBar {
  background: linear-gradient(90deg, #f97316 0%, #facc15 55%, #f97316 100%);
}

#ultText {
  color: #fde68a;
}

.loadoutRow {
  gap: 4px;
}

#healthBar {
  background: #28a745;
}

#ammoBar {
  background: #ffc107;
}

#creditsBadge {
  margin-left: 2px;
  padding: 2px 5px;
  border-radius: 9999px;
  border: 1px solid #374151;
  background: #111827;
  display: flex;
  align-items: center;
  gap: 2px;
  font-weight: 800;
  font-size: 9px;
}

.creditLabel {
  letter-spacing: 0.08em;
  color: #f8fafc;
}

/* Action Log - Minimal Console Style */
/* Action Log - ENHANCED: Better positioning and styling */
#actionLog {
  position: absolute;
  bottom: 16px;
  left: 16px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
  max-width: 300px;
  font-family: 'Courier New', monospace;
}

.log-entry {
  background: rgba(0,0,0,0.92);
  border-left: 4px solid currentColor;
  border-radius: 3px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  animation: logSlideIn 0.25s ease, logFadeOut 0.5s ease 3.5s forwards;
  text-shadow: 0 0 6px currentColor, 0 1px 2px rgba(0,0,0,0.8);
  letter-spacing: 0.03em;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(255,255,255,0.1);
}

@keyframes logSlideIn {
  from { opacity: 0; transform: translateX(-25px) scale(0.95); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes logFadeOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to { opacity: 0; transform: translateX(-15px) scale(0.9); }
}

/* Equipment Slot Indicator - Secondary Weapons Dock */
#equipmentIndicator {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: auto;
}

.equip-slot {
  background: rgba(0,0,0,0.7);
  border: 2px solid rgba(148,163,184,0.3);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 54px;
  transition: all 0.2s ease;
  opacity: 0.6;
  cursor: pointer;
  position: relative;
  touch-action: manipulation;
  -webkit-touch-callout: none;
}

.equip-slot:hover {
  opacity: 0.85;
  border-color: rgba(134, 239, 172,0.5);
  transform: scale(1.05);
}

.equip-slot:focus {
  outline: none;
  border-color: #86efac;
  box-shadow: 0 0 0 2px rgba(134, 239, 172,0.3);
}

.equip-slot.active {
  border-color: #4ade80;
  background: rgba(34,197,94,0.3);
  opacity: 1;
  box-shadow: 0 0 14px rgba(34,197,94,0.5);
}

.equip-slot.preview {
  border-color: #fbbf24;
  background: rgba(251,191,36,0.2);
  opacity: 0.95;
  box-shadow: 0 0 10px rgba(251,191,36,0.4);
}

.equip-slot.dragging {
  opacity: 0.4;
  transform: scale(0.95);
}

.equip-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
  transition: transform 0.15s ease;
}

.equip-slot:hover .equip-icon {
  transform: scale(1.1);
}

.equip-label {
  font-size: 8px;
  font-weight: 700;
  color: #fff;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.equip-key {
  position: absolute;
  top: -4px;
  right: -4px;
  background: rgba(74, 222, 128,0.9);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

/* Radial Quick-Select Menu */
.radial-menu {
  position: fixed;
  z-index: 500;
  width: 200px;
  height: 200px;
  pointer-events: auto;
  transform: translate(-50%, -50%);
}

.radial-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  background: rgba(15,23,42,0.95);
  border: 2px solid rgba(148,163,184,0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  z-index: 1;
}

.radial-item {
  position: absolute;
  width: 56px;
  height: 56px;
  background: rgba(15,23,42,0.95);
  border: 2px solid rgba(74, 222, 128,0.5);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: all 0.2s ease;
  transform-origin: center;
}

.radial-item:nth-child(2) { top: 0; left: 50%; transform: translateX(-50%); }
.radial-item:nth-child(3) { right: 0; top: 50%; transform: translateY(-50%); }
.radial-item:nth-child(4) { bottom: 0; left: 50%; transform: translateX(-50%); }
.radial-item:nth-child(5) { left: 0; top: 50%; transform: translateY(-50%); }

.radial-item:hover,
.radial-item.hovered {
  background: rgba(74, 222, 128,0.4);
  border-color: #86efac;
  transform: scale(1.15);
  box-shadow: 0 0 16px rgba(74, 222, 128,0.6);
}

.radial-item:nth-child(2):hover,
.radial-item:nth-child(2).hovered { transform: translateX(-50%) scale(1.15); }
.radial-item:nth-child(3):hover,
.radial-item:nth-child(3).hovered { transform: translateY(-50%) scale(1.15); }
.radial-item:nth-child(4):hover,
.radial-item:nth-child(4).hovered { transform: translateX(-50%) scale(1.15); }
.radial-item:nth-child(5):hover,
.radial-item:nth-child(5).hovered { transform: translateY(-50%) scale(1.15); }

.radial-item.selected {
  background: rgba(34,197,94,0.5);
  border-color: #4ade80;
}

.radial-item img {
  width: 28px;
  height: 28px;
}

.radial-item span {
  font-size: 7px;
  font-weight: 700;
  color: #e2e8f0;
  text-transform: uppercase;
}

/* Weapon Preview HUD */
.weapon-preview {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  background: rgba(15,23,42,0.95);
  border: 2px solid rgba(251,191,36,0.6);
  border-radius: 12px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  animation: previewSlideIn 0.25s ease;
  pointer-events: none;
}

@keyframes previewSlideIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.preview-icon {
  width: 48px;
  height: 48px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}

.preview-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.preview-name {
  font-size: 16px;
  font-weight: 800;
  color: #fbbf24;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.preview-desc {
  font-size: 12px;
  color: #94a3b8;
  max-width: 200px;
}

/* Radial menu animation */
@keyframes radialOpen {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.radial-menu.opening {
  animation: radialOpen 0.2s ease forwards;
}

.radial-menu.closing {
  animation: radialOpen 0.15s ease reverse forwards;
}

/* Mobile Controls — lower half zones so HUD/menu stay tappable */
#mobileControls {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

#mobileControls > * {
  pointer-events: auto;
}

/* Touch zones for joysticks: bottom ~58% only (don't steal top HUD taps) */
.touchZone {
  position: absolute;
  width: 48%;
  height: 58%;
  bottom: 0;
  top: auto;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  /* Extra padding for fat fingers */
  padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  touch-action: none;
}

#leftTouchZone {
  left: 0;
}

#rightTouchZone {
  right: 0;
}

/* Joysticks — larger defaults for thumbs */
.joystickBase {
  position: absolute;
  width: 128px;
  height: 128px;
  background: rgba(0,0,0,0.28);
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.22);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  pointer-events: none;
  transition: opacity 0.2s ease;
  bottom: max(28px, env(safe-area-inset-bottom, 0px) + 16px);
  opacity: 0.55;
}

#leftTouchZone .joystickBase {
  left: max(18px, env(safe-area-inset-left, 0px) + 10px);
}

#rightTouchZone .joystickBase {
  right: max(18px, env(safe-area-inset-right, 0px) + 10px);
}

.joystickStick {
  position: absolute;
  width: 62px;
  height: 62px;
  background: rgba(255,255,255,0.72);
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  transition: transform 0.05s ease-out;
}

/* Desktop / fine pointer: keep controls available but slightly smaller */
@media (pointer: fine) and (hover: hover) {
  html:not(.is-mobile) .joystickBase {
    width: 100px;
    height: 100px;
    bottom: 48px;
    opacity: 0.35;
  }
  html:not(.is-mobile) .joystickStick {
    width: 48px;
    height: 48px;
  }
}

/* Portrait phones: prioritize thumb reach */
@media (orientation: portrait) and (max-width: 500px) {
  .touchZone {
    height: 52%;
    width: 50%;
  }
  .joystickBase {
    width: 132px;
    height: 132px;
    bottom: max(36px, env(safe-area-inset-bottom, 0px) + 20px);
  }
  .joystickStick {
    width: 64px;
    height: 64px;
  }
  /* Equipment dock: smaller + higher so shoot stick stays free */
  #equipmentIndicator {
    right: 4px;
    top: 42%;
    transform: translateY(-50%) scale(0.92);
    transform-origin: right center;
  }
  .equip-label,
  .equip-key {
    display: none;
  }
  .equip-slot {
    min-width: 44px;
    padding: 8px;
  }
}

#joystickShootBase {
  background: rgba(220,38,38,0.25);
  border-color: rgba(239,68,68,0.4);
}

#joystickShootStick {
  background: rgba(239,68,68,0.8);
  box-shadow: 0 0 12px rgba(239,68,68,0.6);
}

/* Action Buttons - Single ability button */
#actionButtons {
  position: absolute;
  right: 15px;
  bottom: 180px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
}

.actionButton {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px solid rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.85);
  color: #fff;
  font-size: 32px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
}

.actionButton:active {
  transform: scale(0.92);
  box-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

.actionButton.ability-button {
  background: linear-gradient(135deg, rgba(74,222,128,0.9), rgba(34,197,94,0.9));
  border-color: rgba(74,222,128,0.6);
  box-shadow: 0 0 20px rgba(74,222,128,0.5);
}

.actionButton.ability-button.secondary-active {
  background: linear-gradient(135deg, rgba(249,115,22,0.9), rgba(234,88,12,0.9));
  border-color: rgba(249,115,22,0.6);
  box-shadow: 0 0 20px rgba(249,115,22,0.5);
}

.actionButton.ability-button.boost-active {
  background: linear-gradient(135deg, rgba(34,197,94,0.9), rgba(22,163,74,0.9));
  border-color: rgba(34,197,94,0.6);
  box-shadow: 0 0 20px rgba(34,197,94,0.5);
}

/* Unified menu button (replaces both action buttons and settings) */
/* Now integrated into the HUD panel */
#unifiedMenuButton {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid rgba(134, 239, 172,0.4);
  background: rgba(15,23,42,0.9);
  color: #86efac;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
  flex-shrink: 0;
  margin-left: auto;
  pointer-events: auto;
  z-index: 5;
}

#unifiedMenuButton:active {
  transform: scale(0.92);
  background: rgba(74, 222, 128,0.8);
  color: #fff;
  box-shadow: 0 0 12px rgba(74, 222, 128,0.6);
}

/* Settings button (legacy) - hide if unified menu is present */
.settingsButton {
  position: absolute;
  top: 50px;
  right: 15px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid rgba(148,163,184,0.3);
  background: rgba(15,23,42,0.8);
  color: #94a3b8;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
}

.settingsButton:active {
  transform: scale(0.9);
  background: rgba(74, 222, 128,0.7);
  color: #fff;
}

/* ==========================================
   WAVE UPGRADE (ROGUELITE CARD PICKER)
   ========================================== */

.wave-upgrade-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 500;
}

.wave-upgrade-modal.active {
  display: flex;
}

.wave-upgrade-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.wave-upgrade-panel {
  position: relative;
  z-index: 1;
  width: min(420px, 94vw);
  max-height: min(88vh, 720px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  padding: 18px 12px 20px;
}

.wave-upgrade-header {
  text-align: center;
  flex-shrink: 0;
}

.wave-upgrade-subtitle {
  font-family: 'Courier New', monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: #4ade80;
  text-transform: uppercase;
  margin-bottom: 4px;
  opacity: 0.8;
}

.wave-upgrade-title {
  font-size: clamp(16px, 4.5vw, 22px);
  font-weight: 900;
  color: #fff;
  letter-spacing: 0.06em;
  margin: 0 0 4px;
}

.wave-upgrade-hint {
  font-size: 12px;
  color: #64748b;
  letter-spacing: 0.02em;
}

.wave-upgrade-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: 2px 2px 8px;
  max-height: min(58vh, 440px);
}

@keyframes waveUpgradeFadeIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes waveCardPulse {
  0%, 100% { box-shadow: 0 0 18px rgba(99, 102, 241, 0.35), 0 8px 24px rgba(0,0,0,0.7); }
  50%       { box-shadow: 0 0 32px rgba(99, 102, 241, 0.6), 0 8px 24px rgba(0,0,0,0.7); }
}

.wave-card {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  text-align: left;
  color: inherit;
  font: inherit;
  background: linear-gradient(160deg, #0c0c18 0%, #0a0a14 100%);
  border: 1.5px solid rgba(99, 102, 241, 0.4);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  box-shadow: 0 4px 14px rgba(0,0,0,0.45);
  /* No infinite pulse — it felt noisy and “busy” */
  animation: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
  touch-action: pan-y;
  flex-shrink: 0;
}

.wave-card::before {
  content: none;
}

.wave-card:hover {
  border-color: rgba(139, 92, 246, 0.75);
  background: linear-gradient(160deg, #12122a 0%, #0c0c18 100%);
}

.wave-card:active {
  transform: scale(0.99);
}

.wave-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.wave-card-icon {
  font-size: 20px;
  line-height: 1;
}

.wave-card-name {
  font-size: 15px;
  font-weight: 800;
  color: #e2e8f0;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.wave-card-flavor {
  display: none; /* declutter — stat line is enough */
}

.wave-card-stat {
  display: inline-block;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
  color: #a5b4fc;
  font-family: ui-monospace, 'Courier New', monospace;
  letter-spacing: 0.03em;
  align-self: flex-start;
}

/* ── Rarity badge ────────────────────────────────────────────────────────── */
.wave-card-rarity {
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-family: ui-monospace, 'Courier New', monospace;
  padding: 2px 7px;
  border-radius: 4px;
  flex-shrink: 0;
}

/* COMMON — slate-grey badge, default card border stays indigo */
.wave-card-rarity--common {
  background: rgba(100, 116, 139, 0.25);
  border: 1px solid rgba(100, 116, 139, 0.5);
  color: #94a3b8;
}

/* RARE — azure/blue */
.wave-card-rarity--rare {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.5);
  color: #38bdf8;
}
.wave-card--rare {
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 4px 14px rgba(0,0,0,0.45);
  animation: none;
}
.wave-card--rare:hover {
  border-color: rgba(56, 189, 248, 0.9);
}

/* EPIC — gold/amber with shimmer */
.wave-card-rarity--epic {
  background: rgba(251, 191, 36, 0.2);
  border: 1px solid rgba(251, 191, 36, 0.6);
  color: #fbbf24;
}
.wave-card--epic {
  background: linear-gradient(160deg, #100d00 0%, #0a0800 100%);
  border-color: rgba(251, 191, 36, 0.55);
  box-shadow: 0 4px 14px rgba(0,0,0,0.45);
  animation: none;
}
.wave-card--epic:hover {
  border-color: rgba(251, 191, 36, 0.95);
}

/* Settings Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 300;
  backdrop-filter: blur(4px);
}

.modal.active {
  display: flex;
}

.modal-content {
  background: linear-gradient(145deg, #000000, #0f0f0f);
  border: 2px solid rgba(74, 222, 128,0.4);
  border-radius: 16px;
  width: min(450px, 92vw);
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0,0,0,0.8), 0 0 60px rgba(74,222,128,0.15), inset 0 1px 0 rgba(255,255,255,0.03);
}

.modal-content.unified-menu {
  width: min(700px, 95vw);
  max-height: 90vh;
}

/* Menu Tabs */
.menu-tabs {
  display: flex;
  gap: 4px;
  padding: 12px 16px 0;
  border-bottom: 2px solid rgba(74, 222, 128,0.2);
  overflow-x: auto;
}

.menu-tab {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: #94a3b8;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.menu-tab:hover {
  color: #e2e8f0;
  background: rgba(74, 222, 128,0.1);
}

.menu-tab.active {
  color: #86efac;
  border-bottom-color: #4ade80;
  background: rgba(74, 222, 128,0.15);
}

/* Tab Content */
.tab-content {
  display: none;
  animation: tabFadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Equipment Slot Configuration */
.equipment-slot-config {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.equipment-slot-config label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.equipment-slot-config label span:first-child {
  font-size: 13px;
  font-weight: 700;
  color: #cbd5e1;
}

.equipment-select {
  background: rgba(30,41,59,0.9);
  color: #e2e8f0;
  border: 1px solid rgba(74, 222, 128,0.4);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
  cursor: pointer;
  width: 100%;
}

.equipment-select:focus {
  outline: none;
  border-color: #4ade80;
  box-shadow: 0 0 0 2px rgba(74, 222, 128,0.2);
}

/* Game Tab Action Buttons */
.game-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.game-action-btn {
  width: 100%;
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 700;
  border: 2px solid rgba(148,163,184,0.3);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(30,41,59,0.9);
  color: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.game-action-btn:hover {
  background: rgba(74, 222, 128,0.3);
  border-color: #86efac;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 222, 128,0.4);
}

.game-action-btn:active {
  transform: translateY(0);
}

.game-action-btn.primary {
  background: linear-gradient(135deg, #4ade80, #22c55e);
  border-color: #4ade80;
  color: #000;
  font-size: 18px;
}

.game-action-btn.primary:hover {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  box-shadow: 0 4px 16px rgba(34,197,94,0.5);
}

.game-action-btn.danger {
  background: rgba(127,29,29,0.8);
  border-color: rgba(239,68,68,0.5);
  color: #fca5a5;
}

.game-action-btn.danger:hover {
  background: rgba(185,28,28,0.9);
  border-color: #ef4444;
  color: #fff;
  box-shadow: 0 4px 12px rgba(239,68,68,0.4);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 2px solid rgba(74, 222, 128,0.3);
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
}

.modal-header h2 {
  font-size: 24px;
  font-weight: 900;
  color: #86efac;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-shadow: 0 0 10px rgba(134, 239, 172, 0.3);
}

.closeBtn {
  background: rgba(30, 41, 59, 0.6);
  border: 2px solid rgba(148, 163, 184, 0.3);
  color: #94a3b8;
  font-size: 24px;
  cursor: pointer;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.25s ease;
  font-weight: 700;
}

.closeBtn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #ef4444;
  transform: rotate(90deg);
}

.closeBtn:active {
  transform: rotate(90deg) scale(0.95);
}

.settings-section {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(74, 222, 128,0.1);
}

.settings-section:last-of-type {
  border-bottom: none;
}

.settings-section h3 {
  font-size: 14px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.settings-section label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  color: #e2e8f0;
  font-size: 14px;
}

.settings-section label span:first-child {
  flex: 1;
}

.settings-section input[type="range"] {
  width: 140px;
  margin: 0 10px;
  accent-color: #4ade80;
}

.settings-section label span:last-child {
  min-width: 45px;
  text-align: right;
  color: #86efac;
  font-weight: 600;
}

.settings-section select {
  background: rgba(30,41,59,0.9);
  color: #e2e8f0;
  border: 1px solid rgba(74, 222, 128,0.4);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 14px;
  cursor: pointer;
  min-width: 160px;
}

.settings-section select:focus {
  outline: none;
  border-color: #4ade80;
  box-shadow: 0 0 0 2px rgba(74, 222, 128,0.2);
}

.checkbox-label {
  flex-direction: row !important;
  gap: 10px;
}

.checkbox-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: #4ade80;
  cursor: pointer;
}

.modal-footer {
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  background: rgba(15, 23, 42, 0.3);
  border-top: 1px solid rgba(74, 222, 128, 0.2);
}

.primaryBtn,
.secondaryBtn {
  padding: 14px 24px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.25s ease;
  border: none;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.primaryBtn {
  background: linear-gradient(135deg, #4ade80, #22c55e);
  color: #fff;
  flex: 1;
  box-shadow: 0 4px 12px rgba(74, 222, 128, 0.4);
}

.primaryBtn:hover {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  box-shadow: 0 6px 20px rgba(74, 222, 128,0.6);
  transform: translateY(-2px);
}

.primaryBtn:active {
  transform: translateY(0);
}

.secondaryBtn {
  background: rgba(30,41,59,0.9);
  color: #cbd5e1;
  border: 2px solid rgba(148,163,184,0.4);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.secondaryBtn:hover {
  background: rgba(74, 222, 128, 0.2);
  border-color: #4ade80;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(74, 222, 128, 0.3);
}

.fullscreenBtn {
  width: 100%;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: linear-gradient(135deg, #4ade80, #22c55e);
  color: #fff;
  border: none;
  margin-top: 8px;
}

.fullscreenBtn:hover {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  box-shadow: 0 4px 12px rgba(74,222,128,0.4);
}

/* Landscape optimizations for mobile */
@media screen and (orientation: landscape) and (max-height: 600px) {
  /* Compact HUD for landscape */
  #uiPanel {
    top: 2px;
    left: 2px;
    right: 2px;
    padding: 2px 4px;
    font-size: 9px;
    gap: 2px;
  }
  
  .ui-stat-row {
    font-size: 9px;
    gap: 2px;
  }
  
  .ui-text-label {
    font-size: 7px;
  }
  
  .ui-text-value {
    font-size: 10px;
  }
  
  .ui-bar-container {
    width: 40px;
    height: 6px;
  }
  
  /* Smaller joysticks for landscape */
  .joystickBase {
    width: 90px;
    height: 90px;
    bottom: 30px;
  }
  
  .joystickStick {
    width: 45px;
    height: 45px;
  }
  
  #leftTouchZone .joystickBase {
    left: 15px;
  }
  
  #rightTouchZone .joystickBase {
    right: 15px;
  }
  
  /* Unified menu button adjustment for landscape - stays in HUD */
  #unifiedMenuButton {
    width: 28px;
    height: 28px;
    font-size: 16px;
  }
  
  .settingsButton {
    top: 30px;
    right: 10px;
    width: 40px;
    height: 40px;
    font-size: 20px;
  }
  
  /* Equipment indicator compact */
  #equipmentIndicator {
    right: 4px;
    gap: 4px;
  }
  
  .equip-slot {
    padding: 4px 6px;
    min-width: 40px;
  }
  
  .equip-icon {
    width: 18px;
    height: 18px;
  }
  
  .equip-label {
    font-size: 7px;
  }
  
  .equip-key {
    width: 14px;
    height: 14px;
    font-size: 8px;
    top: -3px;
    right: -3px;
  }
  
  /* Radial menu compact */
  .radial-menu {
    width: 160px;
    height: 160px;
  }
  
  .radial-item {
    width: 44px;
    height: 44px;
  }
  
  .radial-item img {
    width: 22px;
    height: 22px;
  }
  
  .radial-center {
    width: 40px;
    height: 40px;
    font-size: 8px;
  }
  
  /* Weapon preview compact */
  .weapon-preview {
    top: 60px;
    padding: 8px 14px;
  }
  
  .preview-icon {
    width: 36px;
    height: 36px;
  }
  
  .preview-name {
    font-size: 13px;
  }
  
  .preview-desc {
    font-size: 10px;
    max-width: 150px;
  }
  
  /* Action log positioning - ENHANCED: Better mobile positioning to avoid overlap */
  #actionLog {
    bottom: 6px;
    left: 6px;
    max-width: 240px;
    gap: 3px;
  }
  
  .log-entry {
    font-size: 9px;
    padding: 4px 8px;
    border-left-width: 3px;
  }
}

/* Additional optimizations for very wide screens */
@media screen and (orientation: landscape) and (min-aspect-ratio: 2/1) {
  #leftTouchZone .joystickBase {
    left: 60px;
  }
  
  #rightTouchZone .joystickBase {
    right: 60px;
  }
  
  /* Equipment indicator stays glued to right edge in all orientations */
  #equipmentIndicator {
    right: 8px;
  }
}

/* Message box */
#messageBox {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.88);
  border: 2px solid #fff;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  font-size: 22px;
  display: none;
  z-index: 100;
  min-width: 280px;
}

#messageTitle {
  font-size: 28px;
  font-weight: 900;
  color: #4ade80;
  margin-bottom: 8px;
}

#messageText {
  font-size: 16px;
  margin-bottom: 16px;
  color: #ddd;
}

#messageButton {
  padding: 10px 20px;
  font-size: 16px;
  font-weight: 800;
  background: #4ade80;
  color: #000;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

/* Shop modal */
#shopModal {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

#shopCard {
  background: linear-gradient(145deg, #000000, #0a0a0a);
  backdrop-filter: blur(20px);
  border: 2px solid rgba(74, 222, 128, 0.5);
  border-radius: 20px;
  width: min(880px, 95vw);
  max-height: 90vh;
  overflow: auto;
  padding: 0;
  box-shadow: 0 25px 60px rgba(0,0,0,0.9), 0 0 80px rgba(74,222,128,0.2), inset 0 1px 0 rgba(255,255,255,0.05);
}

#shopHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid rgba(74, 222, 128,0.4);
  position: sticky;
  top: 0;
  z-index: 10;
}

#shopTitle {
  font-weight: 900;
  font-size: 24px;
  color: #86efac;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-shadow: 0 0 10px rgba(134, 239, 172, 0.4);
}

#closeShop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(148, 163, 184, 0.4);
  color: #94a3b8;
  font-size: 14px;
  cursor: pointer;
  padding: 10px 18px;
  border-radius: 10px;
  transition: all 0.2s ease;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.05);
}

#closeShop:hover {
  background: rgba(74, 222, 128, 0.2);
  border-color: #4ade80;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(74, 222, 128, 0.3), inset 0 1px 0 rgba(255,255,255,0.1);
}

#openHangarFromShop.secondaryBtn {
  background: rgba(30,41,59,0.9);
  color: #cbd5e1;
  border: 2px solid rgba(148,163,184,0.4);
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  margin-right: 8px;
  transition: all 0.25s ease;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 13px;
}

#openHangarFromShop.secondaryBtn:hover {
  background: rgba(74, 222, 128, 0.2);
  border-color: #4ade80;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(74, 222, 128, 0.3);
}

.shopHeaderActions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.shopCredits {
  font-weight: 900;
  background: rgba(15, 23, 42, 0.9);
  border: 2px solid rgba(74, 222, 128, 0.4);
  border-radius: 9999px;
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.05em;
  color: #4ade80;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.shopGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  padding: 20px 24px;
}

.item {
  border: 2px solid rgba(148,163,184,0.25);
  border-radius: 12px;
  padding: 16px;
  background: rgba(15, 23, 42, 0.8);
  transition: all 0.25s ease;
}

.item:hover {
  border-color: rgba(74, 222, 128, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.item h4 {
  margin-bottom: 8px;
  color: #e2e8f0;
  font-size: 16px;
  font-weight: 800;
}

/* HANGAR */
/* ==============================
   HANGAR MODAL — Ship Selection
   ============================== */

.hangar-modal {
  width: min(960px, 95vw);
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.hangar-content {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.hangar-content::-webkit-scrollbar {
  width: 8px;
}

.hangar-content::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.5);
  border-radius: 4px;
}

.hangar-content::-webkit-scrollbar-thumb {
  background: rgba(74, 222, 128, 0.5);
  border-radius: 4px;
}

.hangar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.ship-card {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(15px);
  border: 2px solid rgba(74, 222, 128, 0.35);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  transition: all 0.25s ease;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  cursor: pointer;
}

.ship-card:hover {
  transform: translateY(-4px);
  border-color: rgba(74, 222, 128, 0.65);
  box-shadow: 0 16px 36px rgba(74, 222, 128, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.ship-card.active {
  border-color: #4ade80;
  box-shadow: 0 0 30px rgba(74, 222, 128, 0.45), inset 0 1px 0 rgba(74, 222, 128, 0.15);
  background: rgba(0, 10, 0, 0.85);
}

.ship-card-canvas {
  width: 100%;
  height: 130px;
  display: block;
  border-radius: 10px;
  background: #000;
  border: 1px solid rgba(74, 222, 128, 0.25);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8);
}

.ship-card-name {
  font-weight: 900;
  font-size: 18px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #e2e8f0;
}

.ship-card-class {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #4ade80;
  background: rgba(74, 222, 128, 0.12);
  border: 1px solid rgba(74, 222, 128, 0.35);
  border-radius: 6px;
  padding: 3px 10px;
}

.ship-card-desc {
  font-size: 13px;
  line-height: 1.5;
  color: #94a3b8;
  flex: 1;
}

.ship-card-stats {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.stat-row-pip {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-row-pip .stat-label-pip {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #9ca3af;
  min-width: 80px;
}

.stat-pips {
  display: flex;
  gap: 5px;
}

.stat-pip {
  width: 18px;
  height: 8px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.2);
  transition: background 0.2s ease;
}

.stat-pip.filled {
  background: #4ade80;
  border-color: #4ade80;
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.6);
}

.ship-select-btn {
  align-self: stretch;
  background: linear-gradient(135deg, #4ade80, #22c55e);
  color: #000;
  border: none;
  border-radius: 10px;
  padding: 12px 18px;
  cursor: pointer;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 13px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(74, 222, 128, 0.4);
}

.ship-select-btn:hover {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  box-shadow: 0 6px 20px rgba(74, 222, 128, 0.6);
  transform: translateY(-2px);
}

.ship-select-btn.selected-btn {
  background: rgba(0, 0, 0, 0.5);
  color: #4ade80;
  border: 2px solid rgba(74, 222, 128, 0.4);
  cursor: default;
  box-shadow: none;
  transform: none;
}

.ship-select-btn.selected-btn:hover {
  background: rgba(0, 0, 0, 0.5);
  transform: none;
  box-shadow: none;
}

/* Legacy hangar (armory) — keep working inside game pause menu */
.hangarSectionHeader {
  grid-column: 1 / -1;
  font-weight: 900;
  letter-spacing: 0.08em;
  font-size: 14px;
  text-transform: uppercase;
  color: #86efac;
  margin-top: 20px;
  margin-bottom: 8px;
  border-bottom: 2px solid rgba(74, 222, 128, 0.3);
  padding-bottom: 6px;
}

.hangarShip {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(15px);
  border: 2px solid rgba(74, 222, 128, 0.4);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  transition: all 0.25s ease;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.hangarShip:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 36px rgba(74, 222, 128, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  border-color: rgba(74, 222, 128, 0.7);
}

.hangarShip.selected {
  border-color: rgba(251, 191, 36, 0.8);
  box-shadow: 0 0 30px rgba(251, 191, 36, 0.5), inset 0 1px 0 rgba(251, 191, 36, 0.2);
  background: rgba(0, 0, 0, 0.85);
}

.shipPreview {
  width: 100%;
  height: 140px;
  display: block;
  border-radius: 12px;
  background: #000;
  border: 2px solid rgba(74, 222, 128, 0.3);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.8), 0 4px 12px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
}

.shipMeta h3 {
  font-size: 18px;
  font-weight: 900;
  margin-bottom: 6px;
  color: #e2e8f0;
}

.shipMeta p {
  font-size: 13px;
  line-height: 1.5;
  color: #94a3b8;
}

.shipStats {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 12px;
}

.stat-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-label strong {
  color: #d1d5db;
}

.stat-bar-container {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 4px;
  border: 1px solid rgba(74, 222, 128, 0.2);
  overflow: hidden;
  position: relative;
}

.stat-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #4ade80, #22c55e);
  border-radius: 3px;
  transition: width 0.3s ease;
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.stat-bar-fill.stat-low {
  background: linear-gradient(90deg, #ef4444, #dc2626);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.stat-bar-fill.stat-high {
  background: linear-gradient(90deg, #22c55e, #16a34a);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.hangarShip button {
  align-self: stretch;
  background: linear-gradient(135deg, #4ade80, #22c55e);
  color: #000;
  border: none;
  border-radius: 12px;
  padding: 13px 20px;
  cursor: pointer;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 13px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(74, 222, 128, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.hangarShip button:hover:not(:disabled) {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  box-shadow: 0 6px 20px rgba(74, 222, 128, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.hangarShip button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 3px 10px rgba(74, 222, 128, 0.4);
}

.hangarShip button:disabled {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  color: #6b7280;
  cursor: not-allowed;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(74, 222, 128, 0.3);
}

.armoryCard {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(15px);
}

.weaponPreview {
  height: 110px;
  border-color: rgba(74, 222, 128,0.45);
}

.item p {
  font-size: 13px;
  color: #94a3b8;
  min-height: 36px;
  line-height: 1.5;
}

.tags {
  font-size: 11px;
  color: #86efac;
  margin: 8px 0;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.buyRow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(74, 222, 128, 0.2);
}

.btnBuy {
  background: linear-gradient(135deg, #4ade80, #22c55e);
  color: #000;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 900;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 12px rgba(74, 222, 128, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 13px;
}

.btnBuy:hover:not([disabled]) {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  box-shadow: 0 6px 20px rgba(74, 222, 128, 0.6);
  transform: translateY(-2px);
}

.btnBuy:active:not([disabled]) {
  transform: translateY(0);
}

.btnBuy[disabled] {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  color: #6b7280;
  cursor: not-allowed;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.05);
  border: 2px solid rgba(74, 222, 128, 0.2);
}

/* Pause Menu Modal */
.pause-menu {
  width: min(400px, 90vw);
  background: linear-gradient(145deg, #000000, #0a0a0a);
  backdrop-filter: blur(20px);
  border: 2px solid rgba(74, 222, 128,0.6);
  border-radius: 20px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.9), 0 0 80px rgba(74,222,128,0.2), inset 0 1px 0 rgba(255,255,255,0.05);
}

.pause-menu-content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pause-menu-btn {
  width: 100%;
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 700;
  border: 2px solid rgba(74, 222, 128,0.3);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(10px);
  color: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.03);
}

.pause-menu-btn:hover {
  background: rgba(74, 222, 128,0.2);
  border-color: #4ade80;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(74, 222, 128,0.4), inset 0 1px 0 rgba(255,255,255,0.1);
}

.pause-menu-btn:active {
  transform: translateY(0);
}

.pause-menu-btn.primary {
  background: linear-gradient(135deg, #4ade80, #22c55e);
  border-color: #4ade80;
  color: #000;
  font-size: 18px;
  box-shadow: 0 4px 14px rgba(74, 222, 128, 0.4), inset 0 1px 0 rgba(255,255,255,0.2);
}

.pause-menu-btn.primary:hover {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  box-shadow: 0 6px 20px rgba(34,197,94,0.6), inset 0 1px 0 rgba(255,255,255,0.3);
}

.pause-menu-btn.danger {
  background: rgba(127,29,29,0.8);
  border-color: rgba(239,68,68,0.5);
  color: #fca5a5;
}

.pause-menu-btn.danger:hover {
  background: rgba(185,28,28,0.9);
  border-color: #ef4444;
  color: #fff;
  box-shadow: 0 4px 12px rgba(239,68,68,0.4);
}

.pause-menu-message {
  min-height: 0;
  padding: 0;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  border-radius: 6px;
  margin-top: 8px;
  transition: all 0.3s ease;
}

.pause-menu-message:not(:empty) {
  min-height: 30px;
  padding: 10px;
}

.pause-menu-message.success {
  background: rgba(34,197,94,0.2);
  color: #4ade80;
  border: 1px solid rgba(34,197,94,0.4);
}

.pause-menu-message.error {
  background: rgba(239,68,68,0.2);
  color: #fca5a5;
  border: 1px solid rgba(239,68,68,0.4);
}

.pause-menu-message.info {
  background: rgba(74, 222, 128,0.2);
  color: #86efac;
  border: 1px solid rgba(74, 222, 128,0.4);
}

/* Game Over Screen */
.game-over-screen {
  width: min(500px, 92vw);
  background: linear-gradient(145deg, #0a0000, #000000);
  border: 3px solid rgba(239,68,68,0.6);
  box-shadow: 0 20px 60px rgba(0,0,0,0.9), 0 0 60px rgba(239,68,68,0.2), inset 0 1px 0 rgba(255,255,255,0.03);
}

.game-over-header {
  padding: 24px;
  background: linear-gradient(135deg, rgba(127,29,29,0.5), rgba(0,0,0,0.8));
  border-bottom: 2px solid rgba(239,68,68,0.3);
}

.game-over-header h1 {
  margin: 0;
  font-size: 42px;
  font-weight: 900;
  text-align: center;
  color: #ef4444;
  text-shadow: 0 0 20px rgba(239,68,68,0.8), 0 4px 8px rgba(0,0,0,0.5);
  letter-spacing: 0.05em;
}

.game-over-stats {
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: rgba(0,0,0,0.8);
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: rgba(0,0,0,0.9);
  border: 2px solid rgba(148,163,184,0.2);
  border-radius: 12px;
  transition: all 0.3s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
}

.stat-item:hover {
  border-color: rgba(134, 239, 172,0.5);
  transform: translateX(4px);
}

.stat-label {
  font-size: 16px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 28px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.rank-badge {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #000;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 24px;
  box-shadow: 0 4px 12px rgba(251,191,36,0.4);
}

.game-over-run-stats {
  display: flex;
  flex-direction: row;
  gap: 12px;
  padding: 0 24px 20px;
  background: rgba(0,0,0,0.8);
}

.run-stat-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(148,163,184,0.2);
  border-radius: 10px;
  transition: border-color 0.25s ease;
}

.run-stat-item:hover {
  border-color: rgba(134,239,172,0.45);
}

.game-over-pilot-xp {
  padding: 0 24px 16px;
  background: rgba(0,0,0,0.8);
}

.game-over-pilot-xp-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.game-over-pilot-level {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #4ade80;
  text-transform: uppercase;
}

.game-over-xp-earned {
  font-size: 12px;
  font-weight: 600;
  color: #fbbf24;
}

.game-over-xp-progress {
  font-size: 11px;
  color: rgba(148,163,184,0.7);
  margin-left: auto;
}

.game-over-xp-track {
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
}

.game-over-xp-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #4ade80);
  border-radius: 3px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.game-over-level-up-badge {
  margin-top: 8px;
  padding: 5px 12px;
  background: linear-gradient(90deg, rgba(74,222,128,0.15), rgba(74,222,128,0.05));
  border: 1px solid rgba(74,222,128,0.4);
  border-radius: 6px;
  color: #4ade80;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

.run-stat-label {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.run-stat-value {
  font-size: 22px;
  font-weight: 900;
  color: #e2e8f0;
  text-shadow: 0 0 10px rgba(134,239,172,0.35);
  line-height: 1;
}

.run-stat-pb {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #fbbf24;
  background: rgba(251,191,36,0.15);
  border: 1px solid rgba(251,191,36,0.4);
  border-radius: 4px;
  padding: 1px 5px;
  text-transform: uppercase;
  animation: pb-pulse 1.2s ease-in-out infinite;
}

@keyframes pb-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.login-prompt {
  text-align: center;
  padding: 16px;
  background: rgba(74, 222, 128,0.15);
  border: 2px solid rgba(74, 222, 128,0.3);
  border-radius: 12px;
  color: #86efac;
  font-weight: 600;
}

.login-prompt p {
  margin: 0;
  font-size: 15px;
}

.game-over-actions {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 2px solid rgba(148,163,184,0.2);
}

.game-over-btn {
  width: 100%;
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 700;
  border: 2px solid rgba(148,163,184,0.3);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.25s ease;
  background: rgba(30,41,59,0.9);
  color: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.game-over-btn:hover {
  background: rgba(74, 222, 128,0.3);
  border-color: #86efac;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(74, 222, 128,0.4);
}

.game-over-btn:active {
  transform: translateY(0);
}

.game-over-btn.primary {
  background: linear-gradient(135deg, #4ade80, #22c55e);
  border-color: #4ade80;
  color: #000;
  font-size: 18px;
  padding: 16px 24px;
  box-shadow: 0 4px 16px rgba(74,222,128,0.4);
}

.game-over-btn.primary:hover {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  box-shadow: 0 6px 24px rgba(34,197,94,0.6);
  transform: translateY(-3px);
}

.game-over-btn.secondary {
  background: rgba(71,85,105,0.5);
  border-color: rgba(100,116,139,0.5);
  color: #cbd5e1;
}

.game-over-btn.secondary:hover {
  background: rgba(100,116,139,0.7);
  border-color: #94a3b8;
  color: #fff;
}

.game-over-btn.ad-continue-btn {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  border: 1px solid #4ade80;
  box-shadow: 0 0 16px rgba(74, 222, 128, 0.35);
  font-size: 14px;
  letter-spacing: 0.03em;
}
.game-over-btn.ad-continue-btn:hover {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  box-shadow: 0 0 24px rgba(74, 222, 128, 0.55);
}

.game-over-btn.share-btn {
  background: linear-gradient(135deg, rgba(56,189,248,0.15) 0%, rgba(14,165,233,0.1) 100%);
  border-color: rgba(56,189,248,0.5);
  color: #7dd3fc;
  gap: 9px;
}

.game-over-btn.share-btn:hover {
  background: linear-gradient(135deg, rgba(56,189,248,0.3) 0%, rgba(14,165,233,0.2) 100%);
  border-color: #38bdf8;
  color: #e0f2fe;
  box-shadow: 0 6px 20px rgba(56,189,248,0.35);
  transform: translateY(-2px);
}

.game-over-btn.share-btn.copied {
  background: linear-gradient(135deg, rgba(74,222,128,0.25) 0%, rgba(34,197,94,0.15) 100%);
  border-color: rgba(74,222,128,0.6);
  color: #86efac;
  box-shadow: 0 4px 14px rgba(74,222,128,0.3);
}

.game-over-btn.share-btn svg {
  flex-shrink: 0;
}

/* Authentication Modal */
.auth-modal {
  width: min(440px, 92vw);
}

.auth-content {
  padding: 24px 28px;
}

.auth-section label {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.auth-label {
  font-size: 14px;
  font-weight: 700;
  color: #e2e8f0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 12px;
}

.auth-input {
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  color: #f1f5f9;
  border: 2px solid rgba(74, 222, 128,0.4);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 15px;
  width: 100%;
  outline: none;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255,255,255,0.03);
}

.auth-input:focus {
  border-color: #4ade80;
  box-shadow: 0 0 0 3px rgba(74, 222, 128,0.3), 0 4px 16px rgba(74, 222, 128, 0.2), inset 0 1px 0 rgba(255,255,255,0.05);
  background: rgba(0, 0, 0, 0.9);
}

.auth-input::placeholder {
  color: #6b7280;
}

.auth-error {
  color: #f87171;
  font-size: 13px;
  margin-top: 8px;
  min-height: 20px;
  font-weight: 600;
}

/* Leaderboard Modal */
.leaderboard-modal {
  width: min(650px, 95vw);
  max-height: 90vh;
}

.leaderboard-content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.leaderboard-user-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  gap: 16px;
  border: 2px solid rgba(74, 222, 128, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.leaderboard-user-info span {
  font-weight: 700;
  color: #86efac;
  font-size: 15px;
}

.leaderboard-status {
  font-size: 12px;
  color: #fca5a5;
  min-height: 18px;
  padding: 0 4px;
}

.leaderboard-status.success {
  color: #4ade80;
}

.leaderboard-status.warning {
  color: #fbbf24;
}

.leaderboard-filter {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.filter-btn {
  background: rgba(30,41,59,0.9);
  color: #cbd5e1;
  border: 2px solid rgba(148,163,184,0.3);
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filter-btn:hover {
  background: rgba(74, 222, 128,0.2);
  border-color: #4ade80;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(74, 222, 128, 0.3);
}

.filter-btn.active {
  background: linear-gradient(135deg, #4ade80, #22c55e);
  color: #fff;
  border-color: #4ade80;
  box-shadow: 0 4px 16px rgba(74, 222, 128, 0.5);
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}

.leaderboard-list::-webkit-scrollbar {
  width: 8px;
}

.leaderboard-list::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.5);
  border-radius: 4px;
}

.leaderboard-list::-webkit-scrollbar-thumb {
  background: rgba(74, 222, 128, 0.5);
  border-radius: 4px;
}

.leaderboard-list::-webkit-scrollbar-thumb:hover {
  background: rgba(74, 222, 128, 0.7);
}

.leaderboard-entry {
  background: rgba(0, 0, 0, 0.9);
  border: 2px solid rgba(148,163,184,0.25);
  border-radius: 12px;
  padding: 14px 18px;
  display: grid;
  grid-template-columns: 50px 1fr auto auto;
  gap: 16px;
  align-items: center;
  transition: all 0.25s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
}

.leaderboard-entry:hover {
  background: rgba(10,10,10,0.95);
  border-color: rgba(74, 222, 128, 0.5);
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255,255,255,0.05);
}

.leaderboard-entry.current-user {
  border-color: #4ade80;
  background: rgba(0,20,10,0.9);
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.3), inset 0 1px 0 rgba(74, 222, 128, 0.1);
}

.leaderboard-rank {
  font-size: 20px;
  font-weight: 900;
  color: #86efac;
  text-align: center;
  min-width: 50px;
}

.leaderboard-rank.top-1 {
  color: #facc15;
  text-shadow: 0 0 10px rgba(250, 204, 21, 0.5);
  font-size: 24px;
}

.leaderboard-rank.top-2 {
  color: #cbd5e1;
  text-shadow: 0 0 8px rgba(203, 213, 225, 0.4);
  font-size: 22px;
}

.leaderboard-rank.top-3 {
  color: #fb923c;
  text-shadow: 0 0 8px rgba(251, 146, 60, 0.4);
  font-size: 22px;
}

.leaderboard-player {
  font-size: 15px;
  font-weight: 700;
  color: #f1f5f9;
}

.leaderboard-score {
  font-size: 18px;
  font-weight: 800;
  color: #4ade80;
  text-shadow: 0 0 8px rgba(74, 222, 128, 0.4);
}

.leaderboard-level {
  font-size: 13px;
  color: #94a3b8;
  font-weight: 600;
}

.leaderboard-empty {
  text-align: center;
  padding: 60px 20px;
  color: #6b7280;
  font-size: 15px;
  font-style: italic;
}

.leaderboard-loading {
  text-align: center;
  padding: 60px 20px;
  color: #86efac;
  font-size: 15px;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* ==========================================
   SOCIAL HUB STYLES
   ========================================== */

/* Social Modal Base */
.social-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.2s ease;
}

.social-modal-content {
  background: linear-gradient(135deg, #000000 0%, #0a0a0a 100%);
  border: 2px solid rgba(134, 239, 172, 0.3);
  border-radius: 16px;
  padding: 32px;
  max-width: 600px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 60px rgba(74, 222, 128, 0.1), inset 0 1px 0 rgba(255,255,255,0.03);
  position: relative;
}

.close-modal {
  position: absolute;
  top: 16px;
  right: 24px;
  font-size: 32px;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1;
}

.close-modal:hover {
  color: #f87171;
  transform: rotate(90deg);
}

/* Auth Modal */
.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 12px;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(134, 239, 172, 0.2);
  border-radius: 8px;
  color: #94a3b8;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.auth-tab.active {
  background: rgba(134, 239, 172, 0.2);
  border-color: #86efac;
  color: #86efac;
}

.auth-tab:hover:not(.active) {
  background: rgba(134, 239, 172, 0.1);
  border-color: rgba(134, 239, 172, 0.3);
}

#authForm input {
  width: 100%;
  padding: 14px;
  margin-bottom: 16px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(134, 239, 172, 0.2);
  border-radius: 8px;
  color: #e2e8f0;
  font-size: 14px;
  transition: all 0.2s;
}

#authForm input:focus {
  outline: none;
  border-color: #86efac;
  background: rgba(15, 23, 42, 0.8);
}

.error-message {
  color: #f87171;
  background: rgba(248, 113, 113, 0.1);
  padding: 12px;
  border-radius: 8px;
  margin-top: 12px;
  font-size: 13px;
}

.success-message {
  color: #4ade80;
  background: rgba(74, 222, 128, 0.1);
  padding: 12px;
  border-radius: 8px;
  margin-top: 12px;
  font-size: 13px;
}

/* Profile Card */
.profile-card {
  max-width: 700px;
}

.profile-header {
  display: flex;
  gap: 24px;
  align-items: start;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 2px solid rgba(134, 239, 172, 0.2);
}

.profile-avatar-large {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 4px solid rgba(134, 239, 172, 0.4);
  box-shadow: 0 0 30px rgba(134, 239, 172, 0.3);
}

.profile-info h2 {
  margin: 0 0 8px 0;
  font-size: 28px;
  color: #e2e8f0;
}

.profile-badges {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.badge {
  font-size: 24px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.profile-level {
  color: #86efac;
  font-size: 16px;
  margin: 8px 0;
  font-weight: 600;
}

.profile-bio {
  color: #94a3b8;
  font-size: 14px;
  line-height: 1.6;
  margin-top: 12px;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid rgba(134, 239, 172, 0.2);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  transition: all 0.2s;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
}

.stat-card:hover {
  border-color: #86efac;
  background: rgba(0, 0, 0, 0.95);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 222, 128, 0.2), inset 0 1px 0 rgba(255,255,255,0.05);
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #86efac;
  margin-bottom: 8px;
}

.stat-label {
  font-size: 12px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.profile-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* Friends List */
.friend-requests {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 2px solid rgba(134, 239, 172, 0.2);
}

.friend-requests h3,
.friends-list h3 {
  color: #e2e8f0;
  font-size: 18px;
  margin-bottom: 16px;
}

.friend-request-card,
.friend-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid rgba(134, 239, 172, 0.2);
  border-radius: 12px;
  margin-bottom: 12px;
  transition: all 0.2s;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
}

.friend-card {
  cursor: pointer;
}

.friend-card:hover {
  border-color: #86efac;
  background: rgba(0, 0, 0, 0.95);
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(74, 222, 128, 0.2), inset 0 1px 0 rgba(255,255,255,0.05);
}

.friend-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid rgba(134, 239, 172, 0.3);
}

.friend-info {
  flex: 1;
}

.friend-info strong {
  display: block;
  color: #e2e8f0;
  font-size: 15px;
  margin-bottom: 4px;
}

.friend-level {
  color: #94a3b8;
  font-size: 13px;
}

.friend-badges {
  margin-top: 4px;
  font-size: 14px;
}

.friend-status {
  font-size: 12px;
}

.friend-status.online {
  color: #4ade80;
}

.friend-status.offline {
  color: #6b7280;
}

.friend-actions {
  display: flex;
  gap: 8px;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 14px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 600;
}

.btn-primary {
  background: linear-gradient(135deg, #4ade80 0%, #16a34a 100%);
  color: white;
  padding: 14px 28px;
  font-size: 15px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 600;
  width: 100%;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #22c55e 0%, #1e40af 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(74, 222, 128, 0.4);
}

.btn-secondary {
  background: rgba(71, 85, 105, 0.3);
  color: #94a3b8;
  padding: 14px 28px;
  font-size: 15px;
  border-radius: 10px;
  border: 1px solid rgba(100, 116, 139, 0.3);
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 600;
}

.btn-secondary:hover {
  background: rgba(71, 85, 105, 0.5);
  border-color: rgba(100, 116, 139, 0.5);
  transform: translateY(-2px);
}

/* Friend Search */
.friend-search {
  position: relative;
  margin-bottom: 20px;
}

#friendSearchInput {
  width: 100%;
  padding: 14px 16px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(134, 239, 172, 0.2);
  border-radius: 10px;
  color: #e2e8f0;
  font-size: 14px;
  transition: all 0.2s;
}

#friendSearchInput:focus {
  outline: none;
  border-color: #86efac;
  background: rgba(15, 23, 42, 0.8);
}

.search-results-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #0f172a;
  border: 1px solid rgba(134, 239, 172, 0.3);
  border-radius: 10px;
  margin-top: 8px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 1px solid rgba(134, 239, 172, 0.1);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: rgba(134, 239, 172, 0.1);
}

.search-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(134, 239, 172, 0.3);
}

.search-level {
  color: #94a3b8;
  font-size: 12px;
  margin-left: 8px;
}

.search-no-results {
  padding: 20px;
  text-align: center;
  color: #6b7280;
  font-size: 13px;
}

.search-loading {
  padding: 20px;
  text-align: center;
  color: #60a5fa;
  font-size: 13px;
  animation: pulse 1.5s ease-in-out infinite;
}

.search-error {
  padding: 20px;
  text-align: center;
  color: #ef4444;
  font-size: 13px;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.no-friends,
.no-activity {
  text-align: center;
  padding: 40px 20px;
  color: #6b7280;
  font-size: 14px;
}

/* Activity Feed */
.activity-feed {
  max-height: 500px;
  overflow-y: auto;
}

.activity-card {
  display: flex;
  gap: 16px;
  padding: 16px;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid rgba(134, 239, 172, 0.15);
  border-radius: 12px;
  margin-bottom: 12px;
  transition: all 0.2s;
}

.activity-card:hover {
  background: rgba(15, 23, 42, 0.6);
  border-color: rgba(134, 239, 172, 0.3);
}

.activity-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid rgba(134, 239, 172, 0.3);
  flex-shrink: 0;
}

.activity-content {
  flex: 1;
  font-size: 14px;
  line-height: 1.6;
  color: #cbd5e1;
}

.activity-content strong {
  color: #86efac;
  font-weight: 600;
}

.activity-time {
  color: #6b7280;
  font-size: 12px;
  margin-top: 4px;
}

/* Navigation Avatar */
.nav-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(134, 239, 172, 0.5);
  margin-right: 8px;
  vertical-align: middle;
}

/* Responsive */
@media (max-width: 640px) {
  .social-modal-content {
    padding: 24px 20px;
    width: 95%;
  }

  .profile-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .profile-avatar-large {
    width: 100px;
    height: 100px;
  }

  .profile-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat-value {
    font-size: 24px;
  }

  .profile-actions {
    flex-direction: column;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
  }
}

/* Scrollbar Styling for Social Modals */
.social-modal-content::-webkit-scrollbar,
.activity-feed::-webkit-scrollbar,
.search-results-dropdown::-webkit-scrollbar {
  width: 8px;
}

.social-modal-content::-webkit-scrollbar-track,
.activity-feed::-webkit-scrollbar-track,
.search-results-dropdown::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.4);
  border-radius: 10px;
}

.social-modal-content::-webkit-scrollbar-thumb,
.activity-feed::-webkit-scrollbar-thumb,
.search-results-dropdown::-webkit-scrollbar-thumb {
  background: rgba(134, 239, 172, 0.3);
  border-radius: 10px;
}

.social-modal-content::-webkit-scrollbar-thumb:hover,
.activity-feed::-webkit-scrollbar-thumb:hover,
.search-results-dropdown::-webkit-scrollbar-thumb:hover {
  background: rgba(134, 239, 172, 0.5);
}

/* Social Menu Row - Updated for footer design */
.social-menu-row {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(134, 239, 172, 0.2);
}

.menuTertiary {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(134, 239, 172, 0.3);
}

.menuTertiary:hover {
  background: rgba(74, 222, 128, 0.2);
  border-color: #86efac;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(134, 239, 172, 0.3);
}

/* Wave ad prompt overlay */
.wave-ad-prompt {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 600;
  background: rgba(0, 0, 0, 0.88);
  border: 1px solid rgba(74, 222, 128, 0.4);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: 'Orbitron', 'Courier New', monospace;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 0 24px rgba(74, 222, 128, 0.15), 0 4px 16px rgba(0, 0, 0, 0.6);
  animation: waveAdPromptSlideIn 0.35s ease;
  max-width: min(420px, 94vw);
}

@keyframes waveAdPromptSlideIn {
  from { opacity: 0; transform: translateX(-50%) translateY(16px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.wave-ad-prompt__text {
  font-size: clamp(11px, 3vw, 13px);
  color: #e2e8f0;
  line-height: 1.4;
  flex: 1;
}

.wave-ad-prompt__watch {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-family: 'Orbitron', 'Courier New', monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, transform 0.1s;
}

.wave-ad-prompt__watch:hover {
  background: linear-gradient(135deg, #4ade80, #22c55e);
  transform: translateY(-1px);
}

.wave-ad-prompt__dismiss {
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 6px;
  color: #94a3b8;
  font-size: 16px;
  line-height: 1;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s;
}

.wave-ad-prompt__dismiss:hover {
  color: #e2e8f0;
  border-color: rgba(148, 163, 184, 0.6);
}

/* Responsive adjustments for start screen */
@media screen and (max-height: 600px) {
  #startScreen {
    gap: 10px;
    padding: 12px;
  }
  
  #gameTitle {
    font-size: clamp(32px, 8vw, 48px);
  }
  
  .title-tagline {
    font-size: 10px;
    margin-top: 4px;
  }
  
  #startGraphicCanvas {
    height: 100px;
    width: min(300px, 80vw);
  }
  
  .start-main {
    margin: 4px 0;
  }
  
  .startButton-primary {
    padding: 10px 36px;
    font-size: 14px;
  }
  
  .nav-btn {
    padding: 8px 14px;
    min-width: 65px;
  }
  
  .nav-icon {
    font-size: 16px;
  }
  
  .nav-label {
    font-size: 10px;
  }
  
  .start-footer {
    margin-top: 8px;
    padding-top: 8px;
  }
  
  .footer-btn {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }
}

@media screen and (max-width: 400px) {
  .start-nav {
    gap: 5px;
    width: 100%;
  }
  
  .nav-btn {
    padding: 8px 6px;
    flex: 1 1 calc(33.333% - 5px);
    max-width: calc(33.333% - 4px);
  }
  
  .nav-label {
    font-size: 9px;
  }

  .nav-icon {
    width: 16px;
    height: 16px;
  }
}

/* Portrait phones: keep home actions in a tight 3+2 grid */
@media screen and (max-width: 480px) and (orientation: portrait) {
  .start-nav {
    gap: 6px;
  }
  .nav-btn {
    flex: 1 1 calc(33.333% - 6px);
    max-width: calc(33.333% - 4px);
  }
  .gameplay-hint {
    max-width: 90vw;
  }
  .hint-text {
    font-size: 12px;
  }
}

/* Notification Badge */
.notification-badge {
  display: inline-block;
  background: #ef4444;
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 6px;
  vertical-align: middle;
  animation: pulse-badge 2s ease-in-out infinite;
}

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

/* ==========================================
   WAVE INTRO BANNER
   ========================================== */

#waveBanner {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  z-index: 8500;
  pointer-events: none;
}

#waveBannerInner {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

#waveBannerNumber {
  font-family: 'Courier New', Courier, monospace;
  font-size: clamp(48px, 10vw, 96px);
  font-weight: 900;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  text-shadow:
    0 0 30px rgba(255, 255, 255, 0.6),
    0 0 60px rgba(14, 165, 233, 0.4),
    0 2px 8px rgba(0, 0, 0, 0.9);
}

#waveBannerSub {
  font-family: 'Courier New', Courier, monospace;
  font-size: clamp(14px, 3vw, 22px);
  font-weight: 700;
  color: #0ea5e9;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  text-shadow:
    0 0 16px rgba(14, 165, 233, 0.8),
    0 0 32px rgba(14, 165, 233, 0.4);
}

@keyframes waveBannerShow {
  0%   { opacity: 0; transform: scale(0.92); }
  15%  { opacity: 1; transform: scale(1); }
  75%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.04); }
}

/* ===== ENHANCED PROFILE STYLES ===== */

/* Profile Title */
.profile-title {
  color: #facc15;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Prestige Badge */
.prestige-badge {
  display: inline-block;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #000;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 4px;
  margin-right: 8px;
  vertical-align: middle;
}

/* Profile Sections */
.profile-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid rgba(134, 239, 172, 0.2);
}

.profile-section h3 {
  color: #e2e8f0;
  font-size: 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Achievements Grid */
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
}

.achievement-item {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(134, 239, 172, 0.2);
  border-radius: 10px;
  padding: 12px 8px;
  text-align: center;
  transition: all 0.2s;
}

.achievement-item.unlocked {
  border-color: #4ade80;
  background: rgba(74, 222, 128, 0.1);
}

.achievement-item.locked {
  opacity: 0.5;
  filter: grayscale(1);
}

.achievement-item:hover {
  transform: translateY(-2px);
}

.achievement-icon {
  display: block;
  font-size: 24px;
  margin-bottom: 6px;
}

.achievement-name {
  display: block;
  font-size: 11px;
  color: #94a3b8;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.achievement-item.unlocked .achievement-name {
  color: #4ade80;
}

/* Prestige Progress */
.prestige-info {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(134, 239, 172, 0.2);
  border-radius: 12px;
  padding: 20px;
}

.prestige-level {
  font-size: 18px;
  color: #facc15;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.prestige-star {
  font-size: 24px;
}

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

.prestige-bar {
  flex: 1;
  height: 12px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(134, 239, 172, 0.2);
}

.prestige-fill {
  height: 100%;
  background: linear-gradient(90deg, #4ade80, #22c55e);
  border-radius: 5px;
  transition: width 0.3s ease;
}

.prestige-progress span {
  font-size: 13px;
  color: #94a3b8;
  font-weight: 600;
  min-width: 80px;
}

.btn-prestige {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 800;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #000;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-prestige:hover {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(245, 158, 11, 0.4);
}

.prestige-warning {
  margin-top: 12px;
  font-size: 12px;
  color: #f87171;
  text-align: center;
}

.prestige-hint {
  margin-top: 8px;
  font-size: 13px;
  color: #86efac;
  text-align: center;
}

/* Ships Grid */
.ships-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}

.ship-item {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(134, 239, 172, 0.2);
  border-radius: 10px;
  padding: 16px 12px;
  text-align: center;
  transition: all 0.2s;
  position: relative;
}

.ship-item.unlocked {
  border-color: #86efac;
}

.ship-item.locked {
  opacity: 0.5;
}

.ship-icon {
  display: block;
  font-size: 28px;
  margin-bottom: 8px;
}

.ship-name {
  display: block;
  font-size: 12px;
  color: #e2e8f0;
  font-weight: 600;
}

.ship-lock {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 12px;
}

/* Achievement Toast */
.achievement-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 2px solid #4ade80;
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 100000;
  transform: translateX(120%);
  transition: transform 0.3s ease;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.achievement-toast.show {
  transform: translateX(0);
}

.achievement-toast-icon {
  font-size: 32px;
}

.achievement-toast-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.achievement-toast-title {
  font-size: 11px;
  color: #4ade80;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.achievement-toast-category {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(74, 222, 128, 0.12);
  color: rgba(74, 222, 128, 0.85);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  vertical-align: middle;
}

.achievement-toast-name {
  font-size: 15px;
  color: #e2e8f0;
  font-weight: 600;
  line-height: 1.2;
}

.achievement-toast-desc {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
  line-height: 1.3;
}

.achievement-toast-icon img {
  display: block;
  filter: drop-shadow(0 0 6px rgba(74, 222, 128, 0.5));
}

/* Tech Fragment Toast — gold/amber shimmer style */
.tech-fragment-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: linear-gradient(135deg, #92400e 0%, #b45309 50%, #d97706 100%);
  border: 1px solid #f59e0b;
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 100000;
  transform: translateX(120%);
  transition: transform 0.3s ease, opacity 0.35s ease;
  box-shadow: 0 4px 24px rgba(245, 158, 11, 0.35), 0 8px 32px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.tech-fragment-toast::after {
  content: '';
  position: absolute;
  top: 0;
  left: -75%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.25) 50%,
    transparent 100%
  );
  animation: tech-fragment-shimmer 2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes tech-fragment-shimmer {
  0%   { left: -75%; }
  60%  { left: 130%; }
  100% { left: 130%; }
}

.tech-fragment-toast.show {
  transform: translateX(0);
}

.tech-fragment-toast-icon {
  font-size: 28px;
  filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.8));
}

.tech-fragment-toast-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tech-fragment-toast-title {
  font-size: 14px;
  color: #fef3c7;
  font-weight: 700;
  letter-spacing: 0.3px;
  line-height: 1.2;
}

.tech-fragment-toast-sub {
  font-size: 11px;
  color: #fde68a;
  opacity: 0.85;
  font-style: italic;
}

/* Enhanced Profile Card */
.enhanced-profile {
  max-width: 750px;
}

/* Responsive */
@media screen and (max-width: 600px) {
  .achievements-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .achievement-item {
    padding: 10px 6px;
  }
  
  .achievement-icon {
    font-size: 20px;
  }
  
  .achievement-name {
    font-size: 9px;
  }
  
  .ships-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .ship-icon {
    font-size: 24px;
  }
  
  .ship-name {
    font-size: 10px;
  }
  
  .achievement-toast {
    right: 10px;
    left: 10px;
    transform: translateY(-120%);
  }
  
  .achievement-toast.show {
    transform: translateY(0);
  }
}

/* Logged in button state */
.footer-btn-logged-in {
  background: rgba(74, 222, 128, 0.2);
  border-color: rgba(74, 222, 128, 0.4);
  color: #4ade80;
}

.footer-btn-logged-in:hover {
  background: rgba(74, 222, 128, 0.3);
  border-color: #4ade80;
}

/* Small notification badge for icons */
.notification-badge-small {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: white;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Social auth form */
#socialAuthForm input {
  width: 100%;
  padding: 14px;
  margin-bottom: 16px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(134, 239, 172, 0.2);
  border-radius: 8px;
  color: #e2e8f0;
  font-size: 14px;
  transition: all 0.2s;
}

#socialAuthForm input:focus {
  outline: none;
  border-color: #86efac;
  background: rgba(15, 23, 42, 0.8);
}

/* ====== LOCAL LEADERBOARD (game over screen) ====== */
.personal-best-banner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 0 0 12px;
  padding: 10px 20px;
  background: linear-gradient(135deg, rgba(251,191,36,0.2), rgba(245,158,11,0.1));
  border: 2px solid rgba(251,191,36,0.7);
  border-radius: 10px;
  text-align: center;
  animation: bestBannerPulse 1.6s ease-in-out infinite;
}

.personal-best-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.personal-best-text {
  font-family: var(--font-mono, 'Courier New', Courier, monospace);
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fbbf24;
  text-shadow: 0 0 16px rgba(251,191,36,0.8);
}

.personal-best-stats {
  font-size: 11px;
  font-family: var(--font-mono, monospace);
  color: rgba(255, 215, 0, 0.75);
  letter-spacing: 0.06em;
  margin-top: 2px;
}

@keyframes bestBannerPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(251,191,36,0.3); }
  50%       { box-shadow: 0 0 22px rgba(251,191,36,0.7); }
}

.local-leaderboard-panel {
  margin: 16px 24px 0;
  background: rgba(0,0,0,0.7);
  border: 2px solid rgba(74,222,128,0.25);
  border-radius: 12px;
  overflow: hidden;
}

.local-lb-title {
  padding: 10px 16px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #4ade80;
  background: rgba(74,222,128,0.08);
  border-bottom: 1px solid rgba(74,222,128,0.2);
}

.local-lb-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
}

.local-lb-table thead th {
  padding: 8px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #64748b;
  border-bottom: 1px solid rgba(74,222,128,0.15);
}

.local-lb-table thead th:nth-child(2) {
  text-align: right;
}

.local-lb-table tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.2s;
}

.local-lb-table tbody tr:last-child {
  border-bottom: none;
}

.local-lb-table tbody tr:hover {
  background: rgba(74,222,128,0.06);
}

.local-lb-rank {
  padding: 9px 14px;
  color: #94a3b8;
  font-weight: 700;
  width: 50px;
}

.local-lb-score {
  padding: 9px 14px;
  color: #e2e8f0;
  font-weight: 700;
  text-align: right;
}

.local-lb-date {
  padding: 9px 14px;
  color: #64748b;
  font-size: 12px;
  text-align: right;
}

.local-lb-empty {
  padding: 16px;
  text-align: center;
  color: #475569;
  font-style: italic;
}

.local-lb-highlight {
  background: rgba(251,191,36,0.1) !important;
}

.local-lb-highlight .local-lb-rank {
  color: #fbbf24;
}

.local-lb-highlight .local-lb-score {
  color: #fbbf24;
  text-shadow: 0 0 8px rgba(251,191,36,0.5);
}

/* Game Over — Perk Loadout */
.game-over-perks {
  margin: 12px 0 0;
  padding: 10px 14px;
  background: rgba(99,102,241,0.08);
  border: 1px solid rgba(99,102,241,0.18);
  border-radius: 8px;
  text-align: left;
}
.game-over-perks__label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #818cf8;
  margin-bottom: 8px;
}
.game-over-perks__list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.game-over-perk-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: rgba(99,102,241,0.15);
  border: 1px solid rgba(99,102,241,0.25);
  border-radius: 20px;
  font-size: 11px;
  color: #c7d2fe;
  white-space: nowrap;
}

/* ── Wave Cleared Overlay ─────────────────────────────────────────────────── */
@keyframes waveClearedFadeIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}
#waveClearedOverlay {
  font-family: monospace;
}
#waveClearedCard {
  animation: waveClearedFadeIn 0.25s ease-out forwards;
}

/* ── Mission Complete Toast ───────────────────────────────────────────────── */
@keyframes missionToastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.mission-complete-toast {
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  min-width: 240px;
  max-width: 360px;
  padding: 14px 24px;
  background: rgba(0, 0, 0, 0.82);
  border: 1.5px solid #4ade80;
  border-radius: 10px;
  box-shadow: 0 0 24px rgba(74, 222, 128, 0.25);
  text-align: center;
  font-family: monospace;
  z-index: 9000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.mission-complete-toast--visible {
  animation: missionToastIn 0.3s ease-out forwards;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.mission-complete-toast__header {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: #4ade80;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.mission-complete-toast__name {
  font-size: 14px;
  font-weight: 500;
  color: #ffffff;
  letter-spacing: 0.05em;
}
