/* ONE BULLET - Cyber-Tactical Aesthetic Design System */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700;800&family=Outfit:wght@400;500;600;700;800;900&display=swap');

:root {
  --bg-primary: #060911;
  --bg-secondary: #0d1322;
  --bg-card: rgba(15, 23, 42, 0.75);
  --cyan-glow: #00f3ff;
  --cyan-dim: rgba(0, 243, 255, 0.2);
  --magenta-glow: #ff007f;
  --magenta-dim: rgba(255, 0, 127, 0.2);
  --amber-glow: #ffb300;
  --red-glow: #ff2a5f;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --border-glass: rgba(56, 189, 248, 0.25);
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

html {
  height: 100%;
  height: -webkit-fill-available;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-display);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
  height: 100vh;
  height: 100dvh;
  min-height: -webkit-fill-available;
  width: 100vw;
  display: flex;
  justify-content: center;
  align-items: center;
  background-image: 
    radial-gradient(circle at 50% 10%, rgba(0, 243, 255, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 50% 90%, rgba(255, 0, 127, 0.06) 0%, transparent 60%);
}

/* App Wrapper */
.game-viewport {
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: 850px;
  max-height: 100vh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg-secondary);
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.8), 0 0 100px rgba(0, 243, 255, 0.05);
  border-left: 1px solid rgba(255, 255, 255, 0.05);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

/* Header HUD - iOS Notch / Dynamic Island Safe Area */
.header-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: calc(8px + env(safe-area-inset-top, 0px));
  padding-left: calc(16px + env(safe-area-inset-left, 0px));
  padding-right: calc(16px + env(safe-area-inset-right, 0px));
  padding-bottom: 8px;
  background: rgba(13, 19, 34, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-glass);
  z-index: 10;
}

.hud-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 1px;
  flex-shrink: 0;
}

.level-title-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}

.game-logo {
  font-weight: 900;
  font-size: 0.72rem;
  letter-spacing: 1.5px;
  line-height: 1.1;
  background: linear-gradient(135deg, #00f3ff, #ff007f);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-family: var(--font-mono);
  text-transform: uppercase;
}

.level-badge {
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.1;
  color: #ffffff;
  letter-spacing: 0.5px;
  font-family: var(--font-display);
}

.level-subtitle {
  display: none !important;
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 80px;
  flex-shrink: 0;
}

.hud-score {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 800;
  color: #ffb703;
  letter-spacing: 0.5px;
  text-shadow: 0 0 8px rgba(255, 183, 3, 0.4);
}

.hud-stars {
  color: var(--amber-glow);
  font-size: 1.05rem;
  letter-spacing: 2px;
  text-shadow: 0 0 8px rgba(255, 179, 0, 0.5);
}

.hud-attempts {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #38bdf8;
  font-weight: 600;
}

.hud-btn {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  flex-shrink: 0;
  box-sizing: border-box;
}

.btn-lang {
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  max-width: 38px !important;
  padding: 0 !important;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.5px;
  color: #00f3ff;
  border-color: rgba(0, 243, 255, 0.4);
  background: rgba(0, 243, 255, 0.08);
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex-shrink: 0 !important;
}

.btn-lang:hover {
  background: rgba(0, 243, 255, 0.2);
  border-color: #00f3ff;
}

.hud-btn:hover {
  background: var(--cyan-dim);
  border-color: var(--cyan-glow);
  transform: translateY(-1px);
  box-shadow: 0 0 12px var(--cyan-dim);
}

.hud-btn:active {
  transform: translateY(1px);
}

.btn-autoplay {
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
  padding: 0 10px;
  gap: 6px;
  background: linear-gradient(135deg, rgba(0, 243, 255, 0.15), rgba(57, 255, 20, 0.15));
  border: 1px solid rgba(0, 243, 255, 0.5);
  color: #00f3ff;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.2);
}

.btn-autoplay .btn-text {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 800;
}

.btn-autoplay:hover {
  background: linear-gradient(135deg, rgba(0, 243, 255, 0.3), rgba(57, 255, 20, 0.3));
  border-color: #00f3ff;
  box-shadow: 0 0 18px rgba(0, 243, 255, 0.45);
}

.btn-autoplay.active {
  background: linear-gradient(135deg, #00f3ff, #39ff14);
  color: #060911;
  border-color: #39ff14;
  box-shadow: 0 0 20px rgba(57, 255, 20, 0.7);
  animation: pulseAuto 1.2s infinite alternate;
}

@keyframes pulseAuto {
  from { box-shadow: 0 0 10px rgba(0, 243, 255, 0.4); transform: scale(1); }
  to { box-shadow: 0 0 22px rgba(57, 255, 20, 0.85); transform: scale(1.04); }
}

.autoplay-banner {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  align-items: center;
  gap: 12px;
  background: rgba(6, 9, 17, 0.92);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(0, 243, 255, 0.6);
  padding: 8px 16px;
  border-radius: 20px;
  box-shadow: 0 4px 24px rgba(0, 243, 255, 0.35);
  z-index: 50;
  font-size: 0.82rem;
  font-weight: 700;
  color: #00f3ff;
  letter-spacing: 0.5px;
  pointer-events: auto;
}

.autoplay-banner.visible {
  display: flex;
}

.pulse-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #39ff14;
  box-shadow: 0 0 10px #39ff14;
  animation: pulseDot 1s infinite alternate;
}

@keyframes pulseDot {
  from { opacity: 0.4; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1.3); }
}

.autoplay-stop-btn {
  background: rgba(255, 42, 95, 0.25);
  border: 1px solid #ff2a5f;
  color: #ff2a5f;
  font-weight: 800;
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.5px;
}

.autoplay-stop-btn:hover {
  background: #ff2a5f;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(255, 42, 95, 0.6);
}

/* Canvas Container */
.canvas-container {
  flex: 1;
  width: 100%;
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #080c16;
}

#gameCanvas {
  display: block;
  touch-action: none;
}

/* Defeat Banner */
.defeat-banner {
  position: absolute;
  top: 14%;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(255, 42, 95, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 10px 24px;
  border-radius: 30px;
  border: 1px solid #ff4d6d;
  box-shadow: 0 0 25px rgba(255, 42, 95, 0.6);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 25;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
}

.defeat-banner.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.defeat-text {
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: 1px;
  color: #ffffff;
}

.defeat-btn {
  background: #ffffff;
  color: #ff2a5f;
  border: none;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.78rem;
  width: 104px !important;
  min-width: 104px !important;
  max-width: 104px !important;
  height: 32px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
  box-sizing: border-box;
}

/* Mirror Tactical Inventory Dock */
.mirror-dock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: rgba(10, 16, 28, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(0, 243, 255, 0.25);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  gap: 12px;
  z-index: 10;
  flex-shrink: 0 !important;
  min-height: 48px;
}

.dock-left {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.dock-badge-title {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 800;
  color: #00f3ff;
  letter-spacing: 0.5px;
  background: rgba(0, 243, 255, 0.12);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(0, 243, 255, 0.3);
}

.dock-status {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.dock-status strong {
  color: #38bdf8;
  font-size: 0.85rem;
}

.dock-center {
  flex: 1;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dock-tip {
  font-size: 0.72rem;
  color: #94a3b8;
  letter-spacing: 0.2px;
}

.dock-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-dock {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  box-sizing: border-box;
  flex-shrink: 0;
}

.btn-dock-add {
  width: 144px !important;
  min-width: 144px !important;
  max-width: 144px !important;
  height: 32px !important;
  padding: 0 4px !important;
  background: linear-gradient(135deg, rgba(0, 243, 255, 0.2), rgba(2, 132, 199, 0.25));
  border-color: rgba(0, 243, 255, 0.6);
  color: #ffffff;
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.15);
}

.btn-dock-add:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(0, 243, 255, 0.35), rgba(2, 132, 199, 0.4));
  border-color: #00f3ff;
  box-shadow: 0 0 16px rgba(0, 243, 255, 0.35);
  transform: translateY(-1px);
}

.btn-dock-add:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(15, 23, 42, 0.5);
  box-shadow: none;
}

.btn-dock-recall {
  width: 84px !important;
  min-width: 84px !important;
  max-width: 84px !important;
  height: 32px !important;
  padding: 0 !important;
  color: #94a3b8;
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-dock-recall:hover {
  color: #ff2a5f;
  border-color: rgba(255, 42, 95, 0.4);
  background: rgba(255, 42, 95, 0.1);
}

.dock-btn-icon {
  font-weight: 900;
  font-size: 0.9rem;
  color: #00f3ff;
}

@media (max-width: 600px) {
  /* Header HUD Mobile Optimizations - Keep all buttons visible */
  .header-hud {
    padding-left: calc(10px + env(safe-area-inset-left, 0px));
    padding-right: calc(8px + env(safe-area-inset-right, 0px));
    padding-top: calc(6px + env(safe-area-inset-top, 0px));
    padding-bottom: 6px;
  }
  .game-logo {
    display: block !important;
    font-size: 0.65rem;
    letter-spacing: 1px;
    line-height: 1;
  }
  .level-badge {
    font-size: 0.88rem;
    line-height: 1.1;
    font-weight: 800;
  }
  .hud-right {
    gap: 4px; /* Move buttons closer together as requested! */
  }
  .hud-stats {
    min-width: 58px;
    gap: 1px;
  }
  .hud-score {
    font-size: 0.72rem;
  }
  .hud-attempts {
    font-size: 0.65rem;
  }
  .hud-btn {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    border-radius: 8px;
    font-size: 0.82rem;
  }
  .btn-leaderboard {
    width: 66px !important;
    min-width: 66px !important;
    max-width: 66px !important;
    height: 32px !important;
    font-size: 0.7rem;
    gap: 2px;
    border-radius: 8px;
  }
  .btn-leaderboard .icon {
    font-size: 0.8rem;
  }
  .btn-lang {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    font-size: 0.72rem;
    border-radius: 8px;
  }
  .mirror-dock {
    padding: 6px 10px;
    gap: 6px;
  }
  .dock-center {
    display: none;
  }
  .dock-badge-title {
    font-size: 0.7rem;
    padding: 2px 6px;
  }
  .btn-dock-add {
    width: 132px !important;
    min-width: 132px !important;
    max-width: 132px !important;
    height: 32px !important;
    font-size: 0.68rem;
    padding: 0 4px !important;
  }
  .btn-dock-recall {
    width: 74px !important;
    min-width: 74px !important;
    max-width: 74px !important;
    font-size: 0.68rem;
  }
  .btn-ctrl {
    width: 68px !important;
    min-width: 68px !important;
    max-width: 68px !important;
    height: 54px !important;
    font-size: 0.68rem;
  }
  .btn-fire {
    height: 54px !important;
  }
  .modal-buttons {
    flex-wrap: wrap;
    gap: 8px;
  }
  #modalLeaderboardBtn, #modalRetryLevel {
    flex: 1 1 calc(50% - 4px);
    font-size: 0.85rem;
    padding: 11px 6px;
  }
  #modalNextLevel {
    flex: 1 1 100%;
    font-size: 0.92rem;
    padding: 12px 6px;
  }
}

/* Controls Bar - iOS Home Indicator Safe Area */
.controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  padding-left: calc(16px + env(safe-area-inset-left, 0px));
  padding-right: calc(16px + env(safe-area-inset-right, 0px));
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  background: rgba(13, 19, 34, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-glass);
  gap: 10px;
  z-index: 10;
}

.btn-ctrl {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  width: 74px !important;
  min-width: 74px !important;
  max-width: 74px !important;
  height: 56px !important;
  padding: 0 !important;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0 !important;
  box-sizing: border-box;
}

.btn-ctrl .ctrl-icon {
  font-size: 1.15rem;
}

.btn-ctrl:hover {
  background: var(--cyan-dim);
  border-color: var(--cyan-glow);
  transform: translateY(-2px);
  box-shadow: 0 0 14px var(--cyan-dim);
}

.btn-ctrl:active {
  transform: translateY(1px);
}

/* FIRE BUTTON (Hero element) */
.btn-fire {
  flex: 1;
  height: 56px !important;
  background: linear-gradient(135deg, #00f3ff 0%, #0284c7 60%, #ff007f 100%);
  border: none;
  border-radius: 14px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 25px rgba(0, 243, 255, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.6);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-sizing: border-box;
}

.btn-fire::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: shine 2.5s infinite;
}

@keyframes shine {
  0% { left: -100%; }
  30% { left: 100%; }
  100% { left: 100%; }
}

.fire-text {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: #030712;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.4);
}

.fire-icon {
  font-size: 1.3rem;
}

.btn-fire:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 0 35px rgba(0, 243, 255, 0.7), inset 0 1px 2px rgba(255, 255, 255, 0.8);
}

.btn-fire:active {
  transform: translateY(1px) scale(0.98);
}

.btn-fire:disabled {
  opacity: 0.5;
  filter: grayscale(0.5);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-fire.active-firing {
  animation: pulse-fire 0.8s infinite alternate;
}

@keyframes pulse-fire {
  0% { box-shadow: 0 0 15px rgba(255, 0, 127, 0.4); }
  100% { box-shadow: 0 0 35px rgba(255, 0, 127, 0.8); }
}

/* Modals Overlay */
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(3, 7, 18, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 24px;
  padding: 30px;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 40px rgba(0, 243, 255, 0.15);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 18px;
  transform: scale(0.9);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-close-icon {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 30;
  line-height: 1;
}

.modal-close-icon:hover {
  background: rgba(255, 42, 95, 0.35);
  border-color: #ff2a5f;
  color: #ff2a5f;
  transform: scale(1.1);
}

.modal-overlay.visible .modal-card {
  transform: scale(1);
}

/* Victory Modal */
.vic-title {
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 1.5px;
  background: linear-gradient(135deg, #00f3ff, #ff007f);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.vic-stars {
  display: flex;
  justify-content: center;
  gap: 12px;
  font-size: 2.8rem;
  color: #334155;
}

.star-icon.active {
  color: var(--amber-glow);
  text-shadow: 0 0 20px rgba(255, 179, 0, 0.8);
  animation: star-bounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes star-bounce {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.3); }
  100% { transform: scale(1); opacity: 1; }
}

.vic-stats {
  display: flex;
  justify-content: space-around;
  background: rgba(0, 0, 0, 0.4);
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

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

.stat-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.stat-val {
  font-size: 1.25rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #38bdf8;
}

.modal-buttons {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.btn-modal {
  flex: 1;
  padding: 12px 6px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 0.88rem;
  cursor: pointer;
  font-family: var(--font-display);
  border: none;
  transition: all 0.2s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.btn-modal-primary {
  background: linear-gradient(135deg, #00f3ff, #0284c7);
  color: #030712;
  box-shadow: 0 0 20px rgba(0, 243, 255, 0.4);
}

.btn-modal-primary:hover {
  box-shadow: 0 0 30px rgba(0, 243, 255, 0.7);
  transform: translateY(-2px);
}

.btn-modal-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-modal-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Level Grid Modal */
.levels-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-height: 55vh;
  overflow-y: auto;
  padding: 8px 4px;
}

.level-card {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  padding: 14px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.level-card:hover:not(.locked) {
  border-color: var(--cyan-glow);
  transform: translateY(-3px);
  box-shadow: 0 0 16px var(--cyan-dim);
}

.level-card.current {
  border-color: var(--cyan-glow);
  background: rgba(0, 243, 255, 0.1);
}

.level-card.locked {
  opacity: 0.35;
  cursor: not-allowed;
  filter: grayscale(1);
}

.lvl-number {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 800;
  color: #00f3ff;
  letter-spacing: 0.5px;
}

.lvl-title {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.2;
}

.lvl-stars {
  font-size: 0.85rem;
  color: #475569;
}

.lvl-stars span.gold {
  color: var(--amber-glow);
  text-shadow: 0 0 6px rgba(255, 179, 0, 0.6);
}

/* Hint Modal */
.hint-body {
  font-size: 0.95rem;
  color: #cbd5e1;
  line-height: 1.6;
  background: rgba(0, 0, 0, 0.35);
  padding: 16px;
  border-radius: 12px;
  border-left: 3px solid var(--amber-glow);
  text-align: left;
}

/* Leaderboard & Victory Score Breakdown Styles */
.btn-leaderboard {
  width: 82px !important;
  min-width: 82px !important;
  max-width: 82px !important;
  height: 38px !important;
  padding: 0 !important;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.76rem;
  border-color: rgba(255, 183, 3, 0.4);
  background: rgba(255, 183, 3, 0.12);
  color: #ffb703;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0 !important;
  box-sizing: border-box;
}
.btn-leaderboard:hover {
  background: rgba(255, 183, 3, 0.25);
  border-color: #ffb703;
  box-shadow: 0 0 14px rgba(255, 183, 3, 0.4);
}
.btn-leaderboard .icon {
  font-size: 0.95rem;
  line-height: 1;
  display: inline-block;
}
.btn-leaderboard .btn-text {
  font-weight: 800;
  letter-spacing: 0.5px;
  display: inline-block;
}

#modalLeaderboardBtn {
  min-width: 100px;
  max-width: 130px;
  padding: 12px 10px;
  white-space: nowrap;
  background: rgba(255, 183, 3, 0.12);
  border: 1px solid rgba(255, 183, 3, 0.4);
  color: #ffb703;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}
#modalLeaderboardBtn:hover {
  background: rgba(255, 183, 3, 0.25);
  border-color: #ffb703;
  box-shadow: 0 0 14px rgba(255, 183, 3, 0.4);
}

/* Victory Score Breakdown Grid */
.vic-stats-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(0, 0, 0, 0.45);
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
}

.vic-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  font-family: var(--font-mono);
}

.stat-row-label {
  color: var(--text-secondary);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-row-val {
  color: var(--text-primary);
  font-weight: 700;
  margin-left: auto;
  margin-right: 12px;
}

.stat-row-bonus {
  font-weight: 800;
  color: #00f3ff;
  min-width: 90px;
  text-align: right;
}

.stat-row-bonus.gold {
  color: #ffd700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.stat-row-bonus.penalty {
  color: #ff2a5f;
}

.vic-total-box {
  background: linear-gradient(135deg, rgba(0, 243, 255, 0.1), rgba(255, 0, 127, 0.1));
  border: 1px solid rgba(0, 243, 255, 0.3);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: var(--font-mono);
}

.vic-total-row, .vic-grand-row, .vic-rank-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.vic-total-label {
  font-weight: 800;
  font-size: 0.88rem;
  color: #94a3b8;
}

.vic-total-val {
  font-size: 1.25rem;
  font-weight: 900;
  color: #ffd700;
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.5);
}

.vic-grand-label {
  font-size: 0.8rem;
  color: #cbd5e1;
}

.vic-grand-val {
  font-size: 0.95rem;
  font-weight: 800;
  color: #00f3ff;
}

.vic-rank-label {
  font-size: 0.8rem;
  color: #cbd5e1;
}

.vic-rank-val {
  font-size: 0.95rem;
  font-weight: 800;
  color: #ff007f;
}

/* Leaderboard Modal */
.modal-card-leaderboard {
  max-width: 520px;
  padding: 24px;
}

.lb-subtitle {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  margin-top: -10px;
}

.lb-player-card {
  background: linear-gradient(135deg, rgba(0, 243, 255, 0.12), rgba(255, 183, 3, 0.12));
  border: 1.5px solid rgba(0, 243, 255, 0.4);
  border-radius: 16px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 0 20px rgba(0, 243, 255, 0.15);
}

.lb-player-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: left;
}

.lb-player-label {
  font-size: 0.68rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.lb-player-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lb-player-name {
  font-size: 0.95rem;
  font-weight: 800;
  color: #ffffff;
  font-family: var(--font-display);
}

.lb-btn-edit-name {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #cbd5e1;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.lb-btn-edit-name:hover {
  background: rgba(0, 243, 255, 0.3);
  border-color: #00f3ff;
  color: #ffffff;
  transform: scale(1.08);
}

.lb-player-badges {
  display: flex;
  gap: 8px;
}

.lb-badge-item {
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 4px 8px;
  min-width: 52px;
  text-align: center;
}

.lb-badge-lbl {
  font-size: 0.62rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-weight: 700;
}

.lb-badge-val {
  font-size: 0.85rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #ffd700;
}

/* Leaderboard Table */
.lb-table-wrapper {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 340px;
}

.lb-table-header {
  display: grid;
  grid-template-columns: 48px 1fr 65px 95px;
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  text-align: left;
}

.lb-table-header .lb-col-levels,
.lb-table-header .lb-col-score {
  text-align: right;
}

.lb-list {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  gap: 1px;
}

.lb-row {
  display: grid;
  grid-template-columns: 48px 1fr 65px 95px;
  padding: 9px 14px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  transition: background 0.15s;
  text-align: left;
}

.lb-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.lb-row.is-player {
  background: linear-gradient(90deg, rgba(0, 243, 255, 0.18), rgba(255, 183, 3, 0.15));
  border: 1px solid rgba(0, 243, 255, 0.4);
  border-radius: 8px;
  margin: 2px 4px;
  box-shadow: 0 0 12px rgba(0, 243, 255, 0.2);
}

.lb-row.rank-1 .lb-cell-rank { color: #ffd700; font-weight: 900; font-size: 1rem; text-shadow: 0 0 8px rgba(255, 215, 0, 0.6); }
.lb-row.rank-2 .lb-cell-rank { color: #e2e8f0; font-weight: 900; font-size: 0.95rem; }
.lb-row.rank-3 .lb-cell-rank { color: #cd7f32; font-weight: 900; font-size: 0.95rem; }

.lb-cell-rank {
  color: var(--text-secondary);
  font-weight: 800;
}

.lb-cell-name {
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-you-badge {
  font-size: 0.62rem;
  background: #00f3ff;
  color: #030712;
  font-weight: 900;
  padding: 1px 5px;
  border-radius: 4px;
}

.lb-cell-levels {
  text-align: right;
  font-weight: 800;
  color: #38bdf8;
}

.lb-cell-score {
  text-align: right;
  font-weight: 900;
  color: #ffd700;
}

/* ==========================================================================
   START / PLAY OVERLAY & HERO CENTER BUTTON
   ========================================================================== */
.start-modal-overlay {
  z-index: 120;
  background: radial-gradient(circle at center, rgba(13, 20, 38, 0.96) 0%, rgba(4, 7, 14, 0.98) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.start-modal-card {
  position: relative;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(0, 243, 255, 0.45);
  border-radius: 28px;
  padding: 38px 24px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.85), 0 0 60px rgba(0, 243, 255, 0.22), inset 0 0 30px rgba(0, 243, 255, 0.06);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transform: scale(0.92);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.visible .start-modal-card {
  transform: scale(1);
}

.start-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.start-cyber-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: #00f3ff;
  background: rgba(0, 243, 255, 0.12);
  border: 1px solid rgba(0, 243, 255, 0.35);
  padding: 4px 14px;
  border-radius: 999px;
  text-transform: uppercase;
  box-shadow: 0 0 14px rgba(0, 243, 255, 0.25);
}

.start-title {
  font-size: 2.7rem;
  font-weight: 900;
  letter-spacing: 3px;
  line-height: 1.1;
  background: linear-gradient(135deg, #ffffff 0%, #00f3ff 45%, #ff007f 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 25px rgba(0, 243, 255, 0.45));
  font-family: var(--font-display);
}

.start-tagline {
  font-size: 0.84rem;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

/* Centered Giant Play Button */
.start-play-wrapper {
  margin: 8px 0;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.btn-hero-play {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 20px 46px;
  min-width: 230px;
  background: linear-gradient(135deg, #00f3ff 0%, #0284c7 48%, #ff007f 100%);
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  color: #ffffff;
  font-size: 1.35rem;
  font-weight: 900;
  font-family: var(--font-display);
  letter-spacing: 2px;
  cursor: pointer;
  box-shadow: 0 0 40px rgba(0, 243, 255, 0.7), 0 0 80px rgba(255, 0, 127, 0.4);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-transform: uppercase;
  z-index: 2;
}

.hero-play-icon {
  font-size: 1.45rem;
  line-height: 1;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.9));
  transform: translateX(-2px);
}

.hero-play-text {
  line-height: 1;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.btn-hero-play:hover {
  transform: scale(1.06) translateY(-3px);
  box-shadow: 0 0 55px rgba(0, 243, 255, 0.95), 0 0 100px rgba(255, 0, 127, 0.6);
  border-color: #ffffff;
}

.btn-hero-play:active {
  transform: scale(0.97) translateY(1px);
}

.hero-play-pulse-ring {
  position: absolute;
  inset: -10px;
  border-radius: 999px;
  border: 2px solid rgba(0, 243, 255, 0.8);
  animation: heroPulseRing 2s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
  pointer-events: none;
}

.hero-play-pulse-ring.delay {
  animation-delay: 1s;
}

@keyframes heroPulseRing {
  0% {
    transform: scale(0.95);
    opacity: 0.9;
  }
  100% {
    transform: scale(1.4);
    opacity: 0;
  }
}

.start-features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
}

.start-feat-box {
  background: rgba(13, 19, 34, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: transform 0.2s;
}

.start-feat-box:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 243, 255, 0.35);
}

.feat-ico {
  font-size: 1.35rem;
}

.feat-title {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-primary);
}

.feat-desc {
  font-size: 0.66rem;
  color: var(--text-secondary);
}

.start-info-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.start-level-label {
  color: var(--text-secondary);
  font-weight: 600;
}

.start-level-val {
  color: #ffb703;
  font-weight: 800;
}

/* ==========================================================================
   INTERACTIVE TUTORIAL BANNER (LEVEL 1)
   ========================================================================== */
.tutorial-banner {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 24px);
  max-width: 460px;
  background: rgba(7, 12, 24, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid rgba(0, 243, 255, 0.6);
  border-radius: 16px;
  padding: 10px 14px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.75), 0 0 30px rgba(0, 243, 255, 0.25);
  z-index: 60;
  display: none;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
  animation: tutBannerSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.tutorial-banner.visible {
  display: flex;
}

@keyframes tutBannerSlideUp {
  from {
    opacity: 0;
    transform: translate(-50%, 15px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.tut-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tut-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 900;
  color: #030712;
  background: #00f3ff;
  border-radius: 6px;
  padding: 2px 8px;
  letter-spacing: 0.5px;
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.6);
}

.tut-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: #f8fafc;
  letter-spacing: 0.5px;
  flex: 1;
  text-align: left;
}

.tut-btn-skip {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-secondary);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.tut-btn-skip:hover {
  background: rgba(255, 42, 95, 0.2);
  border-color: #ff2a5f;
  color: #ff2a5f;
}

.tut-body-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tut-icon {
  font-size: 1.4rem;
  filter: drop-shadow(0 0 6px rgba(0, 243, 255, 0.5));
}

.tut-desc {
  font-size: 0.82rem;
  color: #e2e8f0;
  line-height: 1.4;
  text-align: left;
  margin: 0;
}

.tut-desc strong {
  color: #00f3ff;
}

.tut-progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
}

.tut-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #00f3ff, #ffd700);
  box-shadow: 0 0 10px #00f3ff;
  transition: width 0.35s ease;
}

/* ==========================================================================
   TUTORIAL BUTTON PULSING HIGHLIGHTS
   ========================================================================== */
@keyframes dockAddPulseRing {
  0%, 100% {
    box-shadow: 0 0 16px rgba(0, 243, 255, 0.8), inset 0 0 10px rgba(0, 243, 255, 0.5);
    border-color: #00f3ff;
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 32px rgba(0, 243, 255, 1), 0 0 55px rgba(0, 243, 255, 0.6), inset 0 0 16px rgba(0, 243, 255, 0.9);
    border-color: #ffffff;
    transform: scale(1.05);
  }
}

.btn-dock-add.tutorial-highlight-add {
  animation: dockAddPulseRing 1.1s infinite ease-in-out !important;
  border-color: #00f3ff !important;
  position: relative;
  z-index: 30;
}

.btn-dock-add.tutorial-highlight-add::after {
  content: '👆 BẤM ĐỂ ĐẶT';
  position: absolute;
  top: -26px;
  left: 50%;
  transform: translateX(-50%);
  background: #00f3ff;
  color: #030712;
  font-size: 0.68rem;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 0 12px rgba(0, 243, 255, 0.8);
  animation: floatingBadgeBounce 1s infinite alternate ease-in-out;
  pointer-events: none;
}

@keyframes fireTutorialGlow {
  0%, 100% {
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.8), 0 0 60px rgba(0, 243, 255, 0.5);
    border-color: #ffd700;
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 50px rgba(255, 215, 0, 1), 0 0 90px rgba(255, 0, 127, 0.8), inset 0 0 20px rgba(255, 255, 255, 0.6);
    border-color: #ffffff;
    transform: scale(1.06);
  }
}

.btn-fire.tutorial-highlight-fire {
  animation: fireTutorialGlow 0.9s infinite ease-in-out !important;
  border-color: #ffd700 !important;
  position: relative;
  z-index: 30;
}

.btn-fire.tutorial-highlight-fire::after {
  content: '🎯 BẮN TIÊU DIỆT!';
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: #ffd700;
  color: #030712;
  font-size: 0.74rem;
  font-weight: 900;
  padding: 3px 12px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 0 16px rgba(255, 215, 0, 0.9);
  animation: floatingBadgeBounce 0.8s infinite alternate ease-in-out;
  pointer-events: none;
}

@keyframes floatingBadgeBounce {
  from { transform: translate(-50%, 0); }
  to { transform: translate(-50%, -4px); }
}

/* Desktop responsiveness adjustments */
@media (min-width: 768px) {
  .game-viewport {
    height: 94vh;
    border-radius: 24px;
    border: 1px solid var(--border-glass);
    overflow: hidden;
  }
}
