html,
body {
  margin: 0;
  height: 100%;
  background: #0b0f14;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-family: "Arial Black", system-ui, sans-serif;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  z-index: 1;
}

#main-menu {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  padding: 34px 38px 40px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(14, 16, 24, 0.62), rgba(4, 6, 10, 0.78));
  border: 3px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  transform: translate(-50%, -50%);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#main-menu.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, calc(-50% + 16px)) scale(0.96);
}

.overlay-panel {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 11;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 28px 30px 30px;
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(14, 16, 24, 0.72), rgba(4, 6, 10, 0.84));
  border: 3px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  transform: translate(-50%, -50%);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.overlay-panel.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, calc(-50% + 18px)) scale(0.96);
}

#game-over-menu {
  width: min(84vw, 360px);
}

#music-menu {
  width: min(84vw, 400px);
}

#pause-menu {
  width: min(84vw, 360px);
}

#pause-music-menu {
  width: min(84vw, 400px);
}

.settings-stack {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.overlay-title {
  margin: 0;
  color: #ffffff;
  letter-spacing: 3px;
  font-size: clamp(28px, 5vw, 42px);
  text-shadow: 0 6px 0 #333333, 0 0 22px rgba(255, 255, 255, 0.18);
}

.overlay-score {
  color: rgba(255, 255, 255, 0.92);
  font-size: 22px;
  letter-spacing: 1px;
}

.overlay-actions {
  display: flex;
  width: 100%;
  flex-direction: column;
  gap: 14px;
  margin-top: 6px;
}

.menu-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.game-title {
  margin: 0;
  color: #ffffff;
  text-align: center;
  line-height: 0.95;
  letter-spacing: 4px;
  font-size: clamp(52px, 8vw, 86px);
  text-shadow: 0 8px 0 #333333, 0 0 32px rgba(255, 255, 255, 0.32);
}

.ship-selector {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 24px;
  border-radius: 24px;
  background: rgba(0, 0, 0, 0.55);
  border: 3px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.slider-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 22px;
  background: rgba(0, 0, 0, 0.45);
  border: 3px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.sound-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.sound-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 22px;
  background: rgba(0, 0, 0, 0.45);
  border: 3px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.sound-label {
  color: rgba(255, 255, 255, 0.92);
  font-size: 17px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
}

.slider-value {
  color: #79ffd0;
  font-size: 18px;
  letter-spacing: 1.2px;
}

.volume-slider {
  width: 100%;
  accent-color: #1de6ab;
  cursor: pointer;
}

.toggle-btn {
  min-width: 94px;
  border: 3px solid #148860;
  border-radius: 16px;
  padding: 10px 18px;
  background: linear-gradient(180deg, #2cecae, #0ea46f);
  color: #09120d;
  font: inherit;
  font-size: 18px;
  letter-spacing: 1.4px;
  cursor: pointer;
  box-shadow: 0 8px 0 #0a5f40, 0 12px 24px rgba(27, 217, 149, 0.18);
  transition: transform 0.1s, box-shadow 0.1s, filter 0.2s;
}

.toggle-btn:hover {
  filter: brightness(1.05);
}

.toggle-btn:active {
  transform: translateY(8px);
  box-shadow: 0 0 0 #0a5f40, 0 8px 18px rgba(27, 217, 149, 0.12);
}

.toggle-btn.off {
  border-color: #3a4051;
  background: linear-gradient(180deg, #5d667c, #394153);
  color: #ffffff;
  box-shadow: 0 8px 0 #1a1e28, 0 12px 24px rgba(0, 0, 0, 0.24);
}

#ship-display {
  --ship-color: #00ffcc;
  position: relative;
  width: 88px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease;
}

.ship-preview-aura {
  position: absolute;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  filter: blur(8px);
}

.ship-preview-body {
  position: absolute;
  width: 54px;
  height: 66px;
  background: var(--ship-color);
  clip-path: polygon(50% 0%, 100% 100%, 65% 74%, 50% 87%, 35% 74%, 0% 100%);
  filter: drop-shadow(0 0 16px var(--ship-color));
}

.ship-preview-highlight {
  position: absolute;
  top: 16px;
  left: 50%;
  width: 26px;
  height: 30px;
  background: rgba(255, 255, 255, 0.26);
  clip-path: polygon(50% 0%, 100% 100%, 50% 54%, 0% 100%);
  transform: translateX(-50%);
}

.ship-preview-engine {
  position: absolute;
  bottom: 18px;
  left: 50%;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #ffffff;
  transform: translateX(-50%);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.9);
}

.nav-btn {
  width: 60px;
  height: 60px;
  border: none;
  border-radius: 18px;
  background: #2d3340;
  color: #ffffff;
  font: inherit;
  font-size: 28px;
  cursor: pointer;
  box-shadow: 0 8px 0 #151a24;
  transition: transform 0.1s, box-shadow 0.1s, background 0.2s;
}

.nav-btn:hover {
  background: #3a4252;
}

.nav-btn:active {
  transform: translateY(8px);
  box-shadow: 0 0 0 #151a24;
}

.menu-btn {
  min-width: 220px;
  border: 4px solid #9c1035;
  border-radius: 22px;
  padding: 18px 54px;
  background: linear-gradient(180deg, #ff5b87, #e7265d);
  color: #ffffff;
  font: inherit;
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: 2px;
  cursor: pointer;
  box-shadow: 0 12px 0 #740323, 0 16px 40px rgba(255, 51, 102, 0.28);
  transition: transform 0.1s, box-shadow 0.1s, filter 0.2s;
}

.menu-secondary-btn {
  font-size: clamp(22px, 3.6vw, 30px);
}

.overlay-btn {
  width: 100%;
  min-width: 0;
  font-size: clamp(24px, 4vw, 34px);
  padding: 16px 26px;
}

.alt-btn {
  width: 100%;
  border: 4px solid #2c3340;
  border-radius: 22px;
  padding: 16px 26px;
  background: linear-gradient(180deg, #4d586d, #31394a);
  color: #ffffff;
  font: inherit;
  font-size: clamp(20px, 3.6vw, 30px);
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 12px 0 #171c26, 0 16px 40px rgba(0, 0, 0, 0.24);
  transition: transform 0.1s, box-shadow 0.1s, filter 0.2s;
}

.alt-btn:hover {
  filter: brightness(1.06);
}

.alt-btn:active {
  transform: translateY(12px);
  box-shadow: 0 0 0 #171c26, 0 8px 20px rgba(0, 0, 0, 0.18);
}

.menu-btn:hover {
  filter: brightness(1.06);
}

.menu-btn:active {
  transform: translateY(12px);
  box-shadow: 0 0 0 #740323, 0 8px 20px rgba(255, 51, 102, 0.22);
}

@media (max-width: 700px) {
  #main-menu {
    width: min(88vw, 360px);
    gap: 22px;
    padding: 28px 20px 30px;
  }

  #game-over-menu {
    width: min(88vw, 340px);
    padding: 24px 18px 24px;
  }

  #music-menu {
    width: min(88vw, 360px);
    padding: 24px 18px 24px;
  }

  #pause-menu {
    width: min(88vw, 340px);
    padding: 24px 18px 24px;
  }

  #pause-music-menu {
    width: min(88vw, 360px);
    padding: 24px 18px 24px;
  }

  .ship-selector {
    width: 100%;
    justify-content: center;
    gap: 14px;
    padding: 16px 18px;
  }

  .slider-group,
  .sound-control {
    padding: 14px 14px;
  }

  .sound-label {
    font-size: 15px;
    letter-spacing: 1.2px;
  }

  .slider-value {
    font-size: 16px;
  }

  .toggle-btn {
    min-width: 82px;
    padding: 9px 14px;
    font-size: 16px;
  }

  #ship-display {
    width: 74px;
    height: 74px;
  }

  .ship-preview-body {
    width: 46px;
    height: 57px;
  }

  .ship-preview-highlight {
    top: 14px;
    width: 22px;
    height: 25px;
  }

  .ship-preview-engine {
    bottom: 15px;
  }

  .nav-btn {
    width: 52px;
    height: 52px;
    font-size: 24px;
  }

  .menu-btn {
    width: 100%;
    min-width: 0;
  }
}
