/* Stratos Horizon - Modern UI & Canvas Overlay Styles */

:root {
  --bg-gradient: linear-gradient(135deg, #0b1d3a 0%, #1e3c72 50%, #2a5298 100%);
  --accent-gold: #ffe259;
  --accent-orange: #ffa751;
  --accent-cyan: #00f2fe;
  --accent-emerald: #00b09b;
  --accent-red: #ff4e50;
  --panel-bg: rgba(11, 29, 58, 0.92);
  --panel-border: rgba(255, 255, 255, 0.2);
  --text-main: #f0f6ff;
  --text-muted: #a0aec0;
  --font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden !important;
  background: #060e1a;
  font-family: var(--font-family);
  color: var(--text-main);
}

#app-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden !important;
  display: flex;
  flex-direction: column;
}

#canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Gameplay HUD Layer (z-index 200000 above pause modal, overflow visible to allow instant scrollIntoView) */
.ui-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 200000 !important;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px;
  opacity: 1;
  overflow: visible;
}

.interactive {
  pointer-events: auto !important;
}

/* HUD Top Header (Single row, non-wrapping layout) */
.hud-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
  flex-wrap: nowrap;
  position: relative;
  z-index: 200001 !important;
  pointer-events: auto;
}

.hud-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 8px 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  position: relative;
  z-index: 200002 !important;
  pointer-events: auto;
}

.stratum-title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--accent-gold);
  text-shadow: 0 0 10px rgba(255, 226, 89, 0.3);
  white-space: nowrap;
}

.stratum-subtitle {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
}

/* Energy & Altitude Gauges (Fixed dimensions to prevent flexbox layout passes) */
.hud-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 200px;
  height: 36px;
  min-width: 200px;
  max-width: 200px;
  overflow: hidden;
  flex-shrink: 0;
}

.gauge-container {
  width: 100%;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 8px;
  height: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  position: relative;
}

.gauge-bar {
  height: 100%;
  width: 100%;
  border-radius: 6px;
}

.gauge-energy {
  background: linear-gradient(90deg, #ffa751, #ffe259);
  box-shadow: 0 0 12px rgba(255, 226, 89, 0.6);
}

.gauge-energy.warning {
  background: linear-gradient(90deg, #ff4e50, #f9d423);
}

.gauge-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

/* Beacon Status Indicators */
.beacon-tracker {
  display: flex;
  gap: 6px;
  align-items: center;
}

.beacon-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--accent-gold);
  background: rgba(255, 226, 89, 0.15);
}

.beacon-dot.active {
  background: var(--accent-gold);
  box-shadow: 0 0 12px var(--accent-gold);
}

.beacon-dot.gate-active-cyan {
  border-color: var(--accent-cyan);
  background: var(--accent-cyan);
  box-shadow: 0 0 16px var(--accent-cyan);
}

/* Touch Control Overlay */
.touch-zone {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  touch-action: none;
}

.steering-indicator {
  position: absolute;
  width: 90px;
  height: 90px;
  margin-left: -45px;
  margin-top: -45px;
  border: 2px dashed rgba(0, 242, 254, 0.5);
  border-radius: 50%;
  pointer-events: none !important;
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.steering-indicator.visible {
  opacity: 1;
}

.steering-knob {
  width: 28px;
  height: 28px;
  background: var(--accent-cyan);
  border-radius: 50%;
  box-shadow: 0 0 14px var(--accent-cyan);
  pointer-events: none !important;
}

/* Universal Button Stacking (Disable animations/transitions/will-change for instant Playwright stability) */
button, .control-btn, .btn-primary, .btn-secondary, .icon-btn, .btn-boost, [role="button"] {
  position: relative;
  z-index: 200005 !important;
  touch-action: manipulation;
  cursor: pointer;
  pointer-events: auto !important;
  transition: none !important;
  animation: none !important;
  transform: none !important;
  will-change: auto !important;
}

/* Action Controls (Bottom Right / Bottom Left) */
.hud-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  width: 100%;
  position: relative;
  z-index: 200001 !important;
  pointer-events: auto;
}

.control-btn {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  border-radius: 50px;
  padding: 10px 20px;
  font-size: 1rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
  min-height: 44px;
}

.control-btn:hover, .control-btn:active {
  background: rgba(30, 60, 114, 0.95);
  border-color: rgba(255, 255, 255, 0.4);
}

.btn-boost {
  background: linear-gradient(135deg, rgba(255, 167, 81, 0.9), rgba(255, 78, 80, 0.9));
  border-color: rgba(255, 226, 89, 0.6);
  touch-action: none;
}

.btn-boost:active {
  background: linear-gradient(135deg, #ffa751, #ff4e50);
}

/* Audio & Controls Top Left / Top Right Circular Buttons */
.icon-btn {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  max-width: 48px;
  max-height: 48px;
  border-radius: 50%;
  padding: 0;
  font-size: 1.3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.icon-btn:hover, .icon-btn:active {
  background: rgba(30, 60, 114, 0.95);
  border-color: rgba(255, 255, 255, 0.4);
}

/* Modals & Overlays Base */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(6, 14, 26, 0.95);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: auto;
  pointer-events: none !important;
  opacity: 1;
}

/* Start Modal Screen (z-index 300000 on top of everything) */
#modal-start {
  z-index: 300000 !important;
}

#modal-pause {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(6, 14, 26, 0.75);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: auto;
  pointer-events: none !important;
  opacity: 1;
}

.modal-card {
  position: relative;
  z-index: 100001;
  background: rgba(15, 32, 60, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 20px;
  padding: 18px 16px;
  max-width: 380px;
  width: 92%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  margin: auto;
  pointer-events: auto !important;
}

.modal-logo {
  width: 40px;
  height: 40px;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  margin: 0 auto 6px;
  display: block;
  filter: drop-shadow(0 0 10px rgba(255, 226, 89, 0.5));
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 4px;
  background: linear-gradient(90deg, #ffe259, #ffa751, #00f2fe);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.modal-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.3;
  margin-bottom: 8px;
}

.guide-box {
  background: rgba(0, 0, 0, 0.4);
  border-radius: 10px;
  padding: 6px 8px;
  margin-bottom: 10px;
  text-align: left;
  font-size: 0.72rem;
  line-height: 1.3;
}

.guide-item {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.guide-item:last-child {
  margin-bottom: 0;
}

.guide-icon {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.65rem;
  color: var(--accent-gold);
}

.btn-primary {
  background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
  border: none;
  color: #060e1a;
  padding: 14px 24px;
  font-size: 0.95rem;
  font-weight: 800;
  border-radius: 50px;
  box-shadow: 0 6px 20px rgba(0, 242, 254, 0.4);
  width: 100%;
  display: block;
}

.btn-primary:hover, .btn-primary:active {
  box-shadow: 0 8px 26px rgba(0, 242, 254, 0.6);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  padding: 10px 24px;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 50px;
  margin-top: 6px;
  width: 100%;
  display: block;
}

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

/* Mobile Responsiveness Tweaks */
@media (max-width: 600px) {
  .hud-top {
    flex-wrap: nowrap;
    gap: 6px;
  }
  .hud-card {
    padding: 6px 10px;
    gap: 6px;
  }
  .stratum-title {
    font-size: 0.85rem;
  }
  .stratum-subtitle {
    display: none;
  }
  .modal-card {
    padding: 12px 10px;
  }
  .modal-title {
    font-size: 1.1rem;
  }
}

/* HIGH-SPECIFICITY OVERRIDE FOR ALL HIDDEN MODALS & UI CONTAINERS */
#modal-pause.hidden, #modal-start.hidden, #modal-level-complete.hidden, #modal-game-over.hidden,
.modal-overlay.hidden, .ui-layer.hidden, .hidden,
#modal-pause.hidden *, #modal-start.hidden *, #modal-level-complete.hidden *, #modal-game-over.hidden *,
.modal-overlay.hidden *, .ui-layer.hidden *, .hidden * {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
}
