/* Galactic Pioneers: Beyond the Blue - Styling */

:root {
  --cyan: #00f3ff;
  --coral: #ff4d79;
  --gold: #ffd166;
  --green: #38b000;
  --dark-bg: #050814;
  --card-bg: rgba(10, 15, 30, 0.88);
  --border-glow: rgba(0, 243, 255, 0.35);
  --text-main: #e2e8f0;
  --text-dim: #94a3b8;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #020308;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-main);
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #000000;
}

#game-canvas {
  width: 100%;
  height: 100%;
  max-width: 100vw;
  max-height: 100vh;
  object-fit: contain; /* Perfect aspect ratio preservation */
  display: block;
  background-color: #040714;
}

/* ==================== HUD LAYER ==================== */
.hud-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  z-index: 10;
}

.hud-section {
  display: flex;
  gap: 16px;
}

.hud-left {
  flex-direction: column;
}

.player-hud {
  background: rgba(8, 12, 24, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 8px 14px;
  min-width: 210px;
  backdrop-filter: blur(6px);
}

.p1-hud {
  border-left: 4px solid var(--cyan);
  box-shadow: 0 0 15px rgba(0, 243, 255, 0.15);
}

.p2-hud {
  border-left: 4px solid var(--coral);
  box-shadow: 0 0 15px rgba(255, 77, 121, 0.15);
}

.player-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.player-badge {
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 1px;
}

.p1-badge {
  color: var(--cyan);
}

.p2-badge {
  color: var(--coral);
}

.status-label {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(56, 176, 0, 0.25);
  color: #70e000;
}

.status-label.downed {
  background: rgba(255, 50, 50, 0.3);
  color: #ff4d4d;
  animation: pulse-danger 0.8s infinite alternate;
}

@keyframes pulse-danger {
  from { opacity: 0.6; }
  to { opacity: 1; }
}

.shield-row, .dash-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.hud-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

.shield-pips {
  display: flex;
  gap: 4px;
}

.shield-pip {
  width: 14px;
  height: 10px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.p1-hud .shield-pip.filled {
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  border-color: #ffffff;
}

.p2-hud .shield-pip.filled {
  background: var(--coral);
  box-shadow: 0 0 8px var(--coral);
  border-color: #ffffff;
}

.dash-bar {
  flex-grow: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  overflow: hidden;
}

.dash-fill {
  height: 100%;
  width: 100%;
  background: #ffffff;
  border-radius: 3px;
  transition: width 0.08s linear;
}

/* Center HUD */
.hud-center {
  flex-direction: column;
  align-items: center;
}

.hud-engine-tag {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--cyan);
  background: rgba(0, 243, 255, 0.12);
  border: 1px solid rgba(0, 243, 255, 0.35);
  border-radius: 12px;
  padding: 3px 12px;
  margin-bottom: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(6px);
}

.hud-engine-tag .engine-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan);
}

.sector-title-banner {
  background: rgba(10, 16, 32, 0.85);
  border: 1px solid var(--border-glow);
  padding: 6px 18px;
  border-radius: 20px;
  display: flex;
  gap: 14px;
  align-items: center;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1px;
  color: #ffffff;
  backdrop-filter: blur(8px);
}

.sector-timer {
  color: var(--gold);
  font-weight: 800;
  font-size: 14px;
}

/* Boss Health Bar */
.boss-health-container {
  margin-top: 8px;
  width: 420px;
  background: rgba(20, 5, 25, 0.85);
  border: 1px solid #ff0055;
  border-radius: 8px;
  padding: 8px 14px;
  box-shadow: 0 0 18px rgba(255, 0, 85, 0.3);
  text-align: center;
}

.boss-label {
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 2px;
  color: #ff3366;
  margin-bottom: 4px;
}

.boss-bar-track {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  overflow: hidden;
}

.boss-health-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #ff0055, #f72585, #ff9100);
  box-shadow: 0 0 10px #ff0055;
  transition: width 0.15s ease-out;
}

.boss-phase-label {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 3px;
  letter-spacing: 1px;
}

/* Right HUD */
.hud-right {
  flex-direction: column;
  align-items: flex-end;
  background: rgba(8, 12, 24, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 8px 16px;
  backdrop-filter: blur(6px);
}

.score-display {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.score-value {
  font-size: 24px;
  font-weight: 800;
  color: #ffffff;
  font-family: 'Courier New', Courier, monospace;
}

.multiplier-display {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0;
}

.multiplier-badge {
  font-weight: 800;
  font-size: 14px;
  color: var(--cyan);
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0, 243, 255, 0.15);
  border: 1px solid var(--cyan);
}

.high-score-display {
  font-size: 12px;
  color: var(--text-dim);
}

/* ==================== SCREEN OVERLAYS ==================== */
.hidden {
  display: none !important;
}

.screen-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 6, 16, 0.82);
  backdrop-filter: blur(10px);
  z-index: 20;
  transition: opacity 0.25s ease;
}

.screen-overlay.hidden {
  display: none !important;
}

.modal-card {
  background: var(--card-bg);
  border: 1px solid var(--border-glow);
  box-shadow: 0 0 35px rgba(0, 243, 255, 0.2), inset 0 0 20px rgba(0, 243, 255, 0.05);
  border-radius: 16px;
  padding: 36px 44px;
  max-width: 680px;
  width: 90%;
  text-align: center;
  color: var(--text-main);
  animation: modal-enter 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-enter {
  from {
    opacity: 0;
    transform: scale(0.94) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Main Menu */
.main-menu-card {
  max-width: 580px;
}

.game-logo {
  margin-bottom: 28px;
}

.logo-sub {
  font-size: 11px;
  letter-spacing: 4px;
  color: var(--cyan);
  font-weight: 700;
  margin-bottom: 4px;
}

.logo-title {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #ffffff;
  text-shadow: 0 0 20px var(--cyan);
}

.logo-accent {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 6px;
  color: var(--coral);
  margin-top: 4px;
  text-shadow: 0 0 15px var(--coral);
}

.menu-modes {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 24px;
}

.menu-sub-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
}

.menu-highscores {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 13px;
  color: var(--text-dim);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 16px;
}

.menu-highscores strong {
  color: var(--gold);
}

.stat-divider {
  color: rgba(255, 255, 255, 0.2);
}

/* Buttons */
.btn {
  font-family: inherit;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.18s ease;
  padding: 10px 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.2);
}

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

.btn-primary {
  background: linear-gradient(135deg, #0088cc, #00b4d8);
  border-color: var(--cyan);
  box-shadow: 0 0 16px rgba(0, 243, 255, 0.3);
}

.btn-secondary {
  background: linear-gradient(135deg, #d90429, #ef233c);
  border-color: var(--coral);
  box-shadow: 0 0 16px rgba(255, 77, 121, 0.3);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
  font-size: 12px;
  letter-spacing: 1px;
}

.btn-danger {
  background: rgba(220, 38, 38, 0.25);
  border-color: #ef4444;
  color: #fca5a5;
}

.btn-large {
  padding: 14px 20px;
}

.btn-icon {
  font-size: 24px;
}

.btn-text {
  text-align: left;
}

.btn-title {
  display: block;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1px;
}

.btn-desc {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.75);
}

/* Instructions Screen */
.controls-card {
  max-width: 780px;
}

.controls-card h2 {
  font-size: 24px;
  letter-spacing: 2px;
  margin-bottom: 20px;
  color: var(--cyan);
}

.controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  text-align: left;
  margin-bottom: 24px;
}

.control-col {
  background: rgba(0, 0, 0, 0.35);
  padding: 16px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.p1-col { border-left: 4px solid var(--cyan); }
.p2-col { border-left: 4px solid var(--coral); }

.p1-heading { color: var(--cyan); font-size: 13px; margin-bottom: 12px; }
.p2-heading { color: var(--coral); font-size: 13px; margin-bottom: 12px; }

.control-col ul {
  list-style: none;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

kbd {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
  color: #ffffff;
  margin-right: 3px;
}

.rules-box {
  background: rgba(0, 243, 255, 0.06);
  border: 1px solid rgba(0, 243, 255, 0.2);
  border-radius: 8px;
  padding: 14px;
  text-align: left;
  font-size: 13px;
  margin-bottom: 20px;
}

.rules-box h4 {
  color: var(--gold);
  font-size: 12px;
  letter-spacing: 1px;
  margin: 6px 0 4px 0;
}

.rules-box h4:first-child { margin-top: 0; }

/* Settings Screen */
.settings-card {
  max-width: 580px;
  text-align: left;
}

.settings-card h2 {
  font-size: 22px;
  letter-spacing: 2px;
  color: var(--cyan);
  text-align: center;
  margin-bottom: 22px;
}

.setting-item {
  margin-bottom: 18px;
}

.setting-item label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.slider-row input[type="range"] {
  flex-grow: 1;
  accent-color: var(--cyan);
}

.toggle-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.toggle-text {
  max-width: 80%;
}

.setting-name {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
}

.setting-desc {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

input[type="checkbox"].switch {
  width: 44px;
  height: 24px;
  accent-color: var(--cyan);
  cursor: pointer;
}

.modal-actions {
  margin-top: 24px;
  display: flex;
  justify-content: center;
  gap: 16px;
}

/* Upgrade Screen */
.upgrade-card {
  max-width: 860px;
}

.sector-clear-badge {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 2px;
  font-weight: 800;
  color: #70e000;
  background: rgba(112, 224, 0, 0.2);
  border: 1px solid #70e000;
  padding: 4px 10px;
  border-radius: 12px;
  margin-bottom: 8px;
}

.upgrade-header h2 {
  font-size: 24px;
  color: #ffffff;
  letter-spacing: 1px;
}

.upgrade-header p {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 6px;
  margin-bottom: 24px;
}

.upgrade-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.upgrade-option-card {
  background: rgba(15, 22, 45, 0.85);
  border: 1px solid rgba(0, 243, 255, 0.25);
  border-radius: 12px;
  padding: 20px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.upgrade-option-card:hover {
  transform: translateY(-5px);
  border-color: var(--cyan);
  box-shadow: 0 0 20px rgba(0, 243, 255, 0.35);
  background: rgba(20, 30, 60, 0.95);
}

.upgrade-key-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 243, 255, 0.2);
  border: 1px solid var(--cyan);
  color: var(--cyan);
  font-weight: 800;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
}

.upgrade-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.upgrade-title {
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 8px;
}

.upgrade-desc {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.4;
}

/* Pause Screen */
.pause-card {
  max-width: 440px;
}

.pause-card h2 {
  font-size: 26px;
  letter-spacing: 3px;
  color: var(--gold);
  margin-bottom: 8px;
}

.pause-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}

/* Defeat & Victory Screens */
.defeat-card {
  border-color: rgba(255, 50, 50, 0.4);
  box-shadow: 0 0 35px rgba(255, 50, 50, 0.25);
}

.defeat-title {
  font-size: 32px;
  color: #ff3366;
  letter-spacing: 3px;
  margin-bottom: 8px;
}

.victory-card {
  border-color: rgba(0, 245, 212, 0.4);
  box-shadow: 0 0 45px rgba(0, 245, 212, 0.3);
}

.victory-badge {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 3px;
  color: #00f5d4;
  margin-bottom: 6px;
}

.victory-title {
  font-size: 36px;
  letter-spacing: 3px;
  color: #ffffff;
  text-shadow: 0 0 25px #00f5d4;
  margin-bottom: 8px;
}

.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  background: rgba(0, 0, 0, 0.35);
  padding: 16px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin: 20px 0;
  text-align: left;
  font-size: 13px;
}

.results-grid strong {
  color: var(--gold);
  font-size: 15px;
}

/* Banner Notification */
.banner-notification {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  z-index: 15;
  animation: banner-fade 2.0s forwards cubic-bezier(0.16, 1, 0.3, 1);
  background: rgba(5, 10, 25, 0.7);
  padding: 8px 24px;
  border-radius: 24px;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(0, 243, 255, 0.2);
}

@keyframes banner-fade {
  0% { opacity: 0; transform: translate(-50%, -20%) scale(0.92); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  75% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -65%) scale(1.04); }
}

.banner-notification h2 {
  font-size: 32px;
  letter-spacing: 4px;
  color: #ffffff;
  text-shadow: 0 0 20px var(--cyan);
}

.banner-notification p {
  font-size: 16px;
  letter-spacing: 2px;
  color: var(--cyan);
  font-weight: 700;
  margin-top: 4px;
}
