/* Cleanup removed bottom-link styles but kept for safety/other modals if needed */
.bottom-link {
  background: transparent;
  border: none;
  font-family: "Orbitron", monospace;
  font-size: 0.7rem;
  letter-spacing: 1px;
  color: #ffffff;
  opacity: 0.4;
  cursor: pointer;
  text-transform: uppercase;
  transition:
    opacity 0.2s ease,
    text-shadow 0.2s ease;
  position: absolute;
  bottom: 12px;
  margin: 0;
  width: auto;
  z-index: 20;
  pointer-events: auto;
  user-select: none;
}

.bottom-link:hover {
  opacity: 1;
  text-shadow: 0 0 8px var(--primary-color);
  color: #fff;
}

.override-active {
  color: var(--warning-color);
  text-shadow: 0 0 12px var(--warning-color);
}

#level-select-modal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(10, 15, 30, 0.95);
  border: 2px solid var(--warning-color);
  box-shadow: 0 0 40px var(--warning-color);
  padding: 30px;
  border-radius: 12px;
  text-align: center;
  z-index: 100;
  display: none;
  width: 90%;
  max-width: 300px;
  box-sizing: border-box;
}

#level-select-modal h2 {
  color: var(--warning-color);
  font-size: 1.5rem;
  margin-top: 0;
  text-shadow: 0 0 10px var(--warning-color);
}
#levelInput {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--warning-color);
  color: #fff;
  font-family: "Orbitron", sans-serif;
  font-size: 1.5rem;
  padding: 10px;
  width: 80px;
  text-align: center;
  margin: 20px 0;
  border-radius: 5px;
}

.level-btn-group {
  display: flex;
  justify-content: center;
  gap: 15px;
}
.level-action-btn {
  background: rgba(255, 136, 0, 0.2);
  border: 1px solid var(--warning-color);
  color: var(--warning-color);
  padding: 10px 20px;
  cursor: pointer;
  font-family: "Orbitron", sans-serif;
  font-weight: bold;
  text-transform: uppercase;
  border-radius: 4px;
  transition: all 0.2s;
}
.level-action-btn:hover {
  background: var(--warning-color);
  color: #000;
  box-shadow: 0 0 15px var(--warning-color);
}

/* Updated to include #briefing-modal styling via comma separation */
#help-modal,
#briefing-modal {
  position: absolute;
  inset: 0;
  margin: auto;
  background-color: rgba(10, 15, 30, 0.98);
  border: 2px solid var(--primary-color);
  box-shadow: 0 0 40px var(--primary-color);
  padding: 25px;
  border-radius: 12px;
  text-align: left;
  z-index: 110;
  display: none;
  width: 90%;
  max-width: 350px;
  max-height: 85svh;
  overflow-y: auto;
  box-sizing: border-box;
  font-family: "Segoe UI", sans-serif;
  font-size: 0.85rem;
  color: #ddd;
  line-height: 1.4;
  flex-direction: column;
}
#help-modal p:last-of-type,
#briefing-modal p:last-of-type {
  margin-bottom: 20px;
}
#help-modal h2,
#briefing-modal h2 {
  font-family: "Orbitron", sans-serif;
  color: var(--primary-color);
  text-align: center;
  margin-top: 0;
  margin-bottom: 15px;
  font-size: 1.4rem;
  text-shadow: 0 0 10px var(--primary-color);
}
#help-modal strong,
#briefing-modal strong {
  color: var(--accent-color);
  display: block;
  margin-top: 10px;
  margin-bottom: 4px;
  font-family: "Orbitron", sans-serif;
  font-size: 0.9rem;
}
#help-modal p,
#briefing-modal p {
  margin: 0;
  color: #ccc;
  font-size: 0.85rem;
}

.help-icon {
  display: inline-block;
  vertical-align: middle;
  margin-right: 5px;
}
.icon-shield {
  width: 12px;
  height: 12px;
  border: 2px solid var(--shield-color);
  border-radius: 50%;
  background: rgba(0, 255, 255, 0.3);
}
.icon-nuke {
  width: 10px;
  height: 10px;
  border: 2px solid var(--danger-color);
  background: rgba(255, 0, 0, 0.3);
  transform: rotate(45deg);
  margin: 2px 5px;
}

#helpCloseBtn,
#briefingCloseBtn {
  background: rgba(0, 87, 205, 0.3);
  border: 1px solid var(--primary-color);
  color: #fff;
  padding: 8px 20px;
  width: 100%;
  margin-top: 20px;
  cursor: pointer;
  font-family: "Orbitron", sans-serif;
  text-transform: uppercase;
  border-radius: 4px;
  transition: all 0.2s;
  margin-top: auto;
}
#helpCloseBtn:hover,
#briefingCloseBtn:hover {
  background: var(--primary-color);
}

#rotation-lock {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  z-index: 9999;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}
#rotation-lock h2 {
  color: var(--primary-color);
  font-size: 2rem;
  margin-bottom: 20px;
  text-shadow: 0 0 20px var(--primary-color);
}
#rotation-lock p {
  color: #fff;
  font-size: 1rem;
}

.mobile-hint {
  display: none;
}

/* VICTORY MODAL */
#victory-modal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(10, 15, 30, 0.95);
  background-image:
    linear-gradient(rgba(205, 0, 36, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(205, 0, 36, 0.1) 1px, transparent 1px);
  background-size: 20px 20px;
  border: 2px solid var(--game-over-red);
  box-shadow:
    0 0 60px var(--game-over-red),
    inset 0 0 30px rgba(205, 0, 36, 0.2);
  padding: 40px;
  border-radius: 15px;
  text-align: center;
  pointer-events: auto;
  z-index: 100; /* Higher than normal modal */
  display: none;
  width: 85%;
  max-width: 450px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  flex-direction: column;
  align-items: center;
}

#victory-modal h1 {
  color: #ffffff;
  text-shadow:
    0 0 10px var(--game-over-red),
    0 0 20px var(--game-over-red),
    0 0 40px var(--game-over-red);
}

#victory-score {
  font-size: 1.2rem;
  color: #fff;
  margin: 20px 0;
  font-weight: bold;
  text-shadow: 0 0 10px var(--game-over-red);
}

#victoryHomeBtn {
  background: rgba(205, 0, 36, 0.2);
  border: 2px solid var(--game-over-red);
  color: #fff;
  padding: 15px 30px;
  font-size: 1.1rem;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-family: "Orbitron", sans-serif;
  font-weight: 900;
  margin-top: 20px;
  width: 100%;
  transition: all 0.3s;
}

#victoryHomeBtn:hover {
  background: var(--game-over-red);
  box-shadow: 0 0 30px var(--game-over-red);
  color: #000;
}

@media (max-width: 600px) {
  .hud-top-bar {
    padding: 15px;
  }
  .score-board,
  .lives-board,
  .level-board {
    font-size: 0.9rem;
  }
  #level-overlay {
    font-size: 2rem;
  }
  .desktop-hint {
    display: none;
  }
  .mobile-hint {
    display: block;
  }
  #modal {
    width: calc(100% - 40px);
    top: 50%;
    padding: 20px;
    max-height: 95vh;
  }
  h1 {
    letter-spacing: 0px;
    font-size: 2rem;
    margin-bottom: 5px;
  }
  .logo-subtitle {
    margin-bottom: 15px;
  }
  .settings-bar {
    margin-bottom: 15px;
  }
  .instructions {
    margin-bottom: 15px;
  }
  /* Adjusted padding for smaller screens in the new flex layout */
  button#startBtn {
    padding: 12px 10px;
  }

  /* Specific mobile sizing override to ensure buttons are large enough */
  .pause-btn,
  .restart-btn,
  .home-btn {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
  #pause-overlay {
    font-size: 2rem;
  }
  #game-container {
    width: calc(100% - 16px);
    height: 100%;
  }

  .title-icon {
    width: 60px;
    height: 60px;
    margin-bottom: -5px;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  #rotation-lock {
    display: flex;
  }
  #game-container {
    display: none;
  }
}

@media (max-height: 600px) {
  #help-modal,
  #briefing-modal {
    padding: 15px;
    max-height: 85svh;
  }
  #help-modal h2,
  #briefing-modal h2 {
    font-size: 1.2rem;
    margin-bottom: 10px;
  }
  #help-modal p,
  #help-modal strong,
  #briefing-modal p,
  #briefing-modal strong {
    font-size: 0.75rem;
    margin-top: 5px;
  }
  #helpCloseBtn,
  #briefingCloseBtn {
    margin-top: 10px;
    padding: 6px 15px;
  }
}
