* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: #0d131a; color: #f2f1ec;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, sans-serif;
  user-select: none;
}

#simRoot { position: relative; width: 100vw; height: 100vh; overflow: hidden; }
#glHost { position: absolute; inset: 0; }

/* Dynamic Red Danger Vignette & Crash Flash Overlay */
#redFlash {
  position: absolute; inset: 0; z-index: 25; pointer-events: none;
  background: radial-gradient(circle at center, rgba(220, 38, 38, 0.28) 0%, rgba(220, 20, 20, 0.88) 100%);
  opacity: 0;
  transition: opacity 0.07s ease-out;
}
#redFlash.hard-flash {
  background: rgba(239, 30, 30, 0.92);
  opacity: 1 !important;
}

/* Flight HUD (visible while flying) */
.hud-layer {
  position: absolute; inset: 0; pointer-events: none; z-index: 10;
  display: flex; flex-direction: column; justify-content: space-between; padding: 14px;
}
.hud-layer.hidden { display: none; }

.hud-top {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.hud-strip {
  pointer-events: auto;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: rgba(15, 20, 27, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px; padding: 7px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
}
.hud-metric span { color: #8fa0b5; font-size: 0.66rem; display: block; }
.hud-metric strong { color: #f8fafc; font-size: 0.94rem; }
.hud-metric strong.warn { color: #f87171; }
.hud-metric strong.ok { color: #4ade80; }
.hud-metric strong.gold { color: #fbbf24; }

.hud-btns { pointer-events: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.hbtn {
  padding: 7px 11px; border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(15, 20, 27, 0.88);
  color: #f2f1ec; font-size: 0.76rem; font-weight: 700;
  cursor: pointer;
}
.hbtn:hover { background: rgba(34, 44, 58, 0.95); }
.hbtn.primary { background: #d94626; border-color: #d94626; color: #fff; }
.hbtn.primary:hover { background: #ec5635; }
.hbtn.green { background: #15803d; border-color: #16a34a; color: #fff; }

/* Banner alerts (Turbulence, Stall, Passenger Scream, Airport Prompt) */
.hud-center-alerts {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.alert-pill {
  background: rgba(185, 28, 28, 0.9); color: #fff;
  font-weight: 800; font-size: 0.82rem; letter-spacing: 0.04em;
  padding: 6px 14px; border-radius: 4px; border: 1px solid rgba(255,255,255,0.25);
  display: none;
}
.alert-pill.show { display: inline-block; }
.alert-pill.info { background: rgba(15, 23, 42, 0.92); border-color: #38bdf8; color: #e0f2fe; }
.alert-pill.calm { background: rgba(20, 83, 45, 0.92); border-color: #4ade80; color: #dcfce7; }

/* Airport Ground Action Bar (shows when stopped on an island airport!) */
.airport-dock {
  pointer-events: auto;
  background: rgba(15, 20, 27, 0.93);
  border: 1px solid rgba(250, 204, 21, 0.45);
  border-radius: 8px;
  padding: 12px 16px;
  max-width: 720px; width: 100%;
  margin: 0 auto;
  display: none;
}
.airport-dock.show { display: block; }
.airport-dock-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 10px; flex-wrap: wrap;
}
.airport-dock-head h3 { font-size: 0.98rem; color: #fde68a; }
.contract-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.contract-card {
  background: #1a222d; border: 1px solid #2f3c4f; border-radius: 6px; padding: 9px 10px;
  display: flex; flex-direction: column; gap: 4px; font-size: 0.78rem;
}
.contract-card strong { color: #fff; font-size: 0.86rem; }

/* Bottom Flight Controls: Throttle slider + Minimap */
.hud-bottom {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
}
.throttle-box {
  pointer-events: auto;
  background: rgba(15, 20, 27, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px; padding: 10px 12px;
  display: flex; align-items: center; gap: 12px;
}
.throttle-box label { font-family: ui-monospace, monospace; font-size: 0.72rem; color: #94a3b8; }
.throttle-box input[type="range"] { width: 130px; accent-color: #d94626; cursor: pointer; }

.minimap-wrap {
  pointer-events: auto;
  background: rgba(12, 17, 24, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px; padding: 6px; cursor: pointer;
}
.minimap-wrap canvas { display: block; border-radius: 4px; }

/* =========================================================
   UNIQUE AVIATION START MENU + LIVE 3D HANGAR CUSTOMIZER
   ========================================================= */
.overlay-screen {
  position: absolute; inset: 0; z-index: 30;
  display: flex; pointer-events: auto;
}
.overlay-screen.hidden { display: none; }

/* Title Menu (left vintage-aviation editorial rail over sunlit 3D runway) */
.start-screen {
  background: linear-gradient(95deg, rgba(13, 18, 25, 0.93) 0%, rgba(13, 18, 25, 0.72) 42%, transparent 72%);
  align-items: center; padding: 24px 36px;
}
.start-panel {
  width: 440px; max-width: 100%;
  display: flex; flex-direction: column; gap: 14px;
}
.start-brand {
  display: flex; align-items: center; gap: 12px;
}
.start-title {
  font-size: 2.15rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; color: #faf9f5;
}
.start-sub { font-size: 0.86rem; color: #aeb9c7; line-height: 1.45; }

.airline-ledger {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.ledger-cell {
  background: rgba(20, 27, 36, 0.9); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px; padding: 8px 10px;
}
.ledger-cell span { display: block; font-size: 0.66rem; text-transform: uppercase; color: #8c9bae; font-family: ui-monospace, monospace; }
.ledger-cell strong { font-size: 1.02rem; font-family: ui-monospace, monospace; color: #fff; }

.menu-nav { display: flex; flex-direction: column; gap: 8px; }
.menu-btn {
  padding: 12px 16px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.16);
  background: rgba(20, 27, 36, 0.88); color: #f4f4f0;
  font-size: 0.92rem; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  transition: transform 0.1s, background 0.15s;
}
.menu-btn:hover { background: rgba(34, 45, 60, 0.95); transform: translateX(3px); }
.menu-btn.fly { background: #d94626; border-color: #d94626; color: #fff; font-size: 1.02rem; }
.menu-btn.fly:hover { background: #eb5534; }
.menu-btn small { font-weight: 500; opacity: 0.78; font-size: 0.76rem; }

.controls-summary {
  background: rgba(14, 19, 26, 0.85); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px; padding: 10px 12px; font-size: 0.76rem; color: #9fb0c4; line-height: 1.55;
}
.controls-summary b { color: #f2f1ec; font-family: ui-monospace, monospace; }

/* 3D Hangar Customizer / Crew / Fleet / Save Drawer (Right side so live 3D plane stays visible!) */
.hangar-screen {
  justify-content: flex-end;
  background: linear-gradient(270deg, rgba(12, 16, 22, 0.92) 0%, rgba(12, 16, 22, 0.35) 55%, transparent 100%);
}
.hangar-cam-bar {
  position: absolute; left: 20px; bottom: 20px;
  display: flex; gap: 8px; flex-wrap: wrap;
}
.hangar-drawer {
  width: 450px; max-width: 96%; height: 100%;
  background: rgba(15, 20, 27, 0.96);
  border-left: 1px solid rgba(255,255,255,0.14);
  display: flex; flex-direction: column; overflow: hidden;
}
.hangar-top {
  padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,0.12);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.hangar-tabs {
  display: flex; border-bottom: 1px solid rgba(255,255,255,0.12); padding: 0 12px; gap: 4px;
}
.htab {
  padding: 10px 10px; border: 0; border-bottom: 2px solid transparent;
  background: transparent; color: #8c9bae; font-size: 0.78rem; font-weight: 700; cursor: pointer;
}
.htab.active { color: #fff; border-bottom-color: #d94626; }

.hangar-body { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }

.hcard {
  background: #1a222d; border: 1px solid #2b3748; border-radius: 6px; padding: 11px 12px;
}
.hcard h4 { font-size: 0.86rem; margin-bottom: 4px; color: #f8fafc; }
.hcard p { font-size: 0.76rem; color: #9fb0c4; margin-bottom: 8px; }

.swatch-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.swatch {
  width: 26px; height: 26px; border-radius: 4px; border: 2px solid transparent; cursor: pointer;
}
.swatch.active { border-color: #ffffff; transform: scale(1.1); }

/* Full Interactive Map Modal */
.map-modal, .crash-modal {
  align-items: center; justify-content: center;
  background: rgba(8, 12, 18, 0.84); backdrop-filter: blur(5px); padding: 18px;
}
.map-box, .crash-box {
  background: #141b24; border: 1px solid #2d3b4e; border-radius: 8px;
  padding: 18px 20px; max-width: 680px; width: 100%;
}
.crash-box { max-width: 440px; text-align: center; border-top: 4px solid #dc2626; }
.crash-box h2 { font-size: 1.65rem; color: #fca5a5; margin-bottom: 6px; }
.crash-box p { color: #cbd5e1; font-size: 0.88rem; margin-bottom: 16px; }

.toast-bar {
  position: absolute; top: 64px; left: 50%; transform: translateX(-50%);
  background: #14532d; color: #dcfce7; border: 1px solid #22c55e;
  padding: 8px 16px; border-radius: 5px; font-weight: 700; font-size: 0.84rem;
  z-index: 60; opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.toast-bar.show { opacity: 1; }

/* GREAT (!), BRILLIANT (!!) & LAST-SECOND CLUTCH Landing Badge Notification */
.landing-badge {
  position: absolute; top: 108px; left: 50%;
  transform: translateX(-50%) scale(0.86);
  display: flex; align-items: center; gap: 12px;
  background: rgba(13, 18, 25, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px; padding: 10px 16px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
  z-index: 65; opacity: 0; pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.2, 1.35, 0.4, 1);
}
.landing-badge.show { opacity: 1; transform: translateX(-50%) scale(1); }
.lb-circle {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 1.35rem; color: #ffffff;
  letter-spacing: -0.04em; flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}
.lb-circle.great { background: #2563eb; border: 2px solid #93c5fd; }
.lb-circle.brilliant { background: #14b8a6; border: 2px solid #99f6e4; }
.lb-circle.clutch { background: linear-gradient(135deg, #0d9488, #2dd4bf); border: 2px solid #fde047; }
.lb-text strong { display: block; font-size: 0.98rem; color: #ffffff; letter-spacing: -0.01em; }
.lb-text span { display: block; font-size: 0.76rem; color: #cbd5e1; font-family: ui-monospace, Consolas, monospace; }
