@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  color-scheme: dark;
  --ink: #f4f1e9;
  --muted: rgba(244, 241, 233, .62);
  --line: rgba(255, 255, 255, .16);
  --glass: rgba(10, 20, 24, .68);
  --amber: #f7b955;
  --red: #ff644f;
  --green: #8fd7a6;
}

* { box-sizing: border-box; }

html, body, #sim, #canvas-host { width: 100%; height: 100%; margin: 0; overflow: hidden; }

body {
  background: #93c6db;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

button { color: inherit; font: inherit; }
button:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }
canvas { display: block; width: 100%; height: 100%; }

#sim { position: relative; isolation: isolate; }
#canvas-host { position: absolute; inset: 0; z-index: 0; --cloud-veil-opacity: 0; }
#canvas-host canvas { position: relative; z-index: 0; }
#canvas-host::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: var(--cloud-veil-opacity);
  background:
    radial-gradient(ellipse at 24% 34%, rgba(250, 252, 249, .98) 0, rgba(237, 243, 240, .86) 27%, transparent 58%),
    radial-gradient(ellipse at 76% 67%, rgba(203, 216, 215, .94) 0, rgba(222, 231, 228, .78) 31%, transparent 62%),
    #dce5e3;
  will-change: opacity;
}
#canvas-host::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(12, 38, 50, .08), transparent 32%, transparent 72%, rgba(10, 20, 18, .13));
}

.screen {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .55s ease, visibility .55s;
}
.screen.visible { opacity: 1; visibility: visible; pointer-events: auto; }

#loading-screen {
  z-index: 50;
  flex-direction: column;
  gap: 22px;
  background: #101b1e;
  letter-spacing: .24em;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 16px;
}
.loading-mark { display: flex; align-items: center; gap: 9px; animation: loading-float 1.5s ease-in-out infinite; }
.loading-mark span { display: block; width: 50px; height: 5px; border-radius: 99px; background: #e6eadf; }
.loading-mark i { display: block; width: 10px; height: 32px; border-radius: 99px 99px 3px 3px; background: var(--amber); }
.loading-track { width: 225px; height: 3px; overflow: hidden; background: rgba(255,255,255,.13); }
.loading-track i { display: block; width: 5%; height: 100%; background: var(--amber); transition: width .3s; }
@keyframes loading-float { 50% { transform: translateY(-5px); } }

#preflight {
  position: absolute;
  top: 142px;
  left: 29px;
  z-index: 14;
  width: 330px;
  padding: 16px 17px 13px;
  border: 1px solid rgba(255,255,255,.14);
  border-left: 3px solid var(--amber);
  background: rgba(10,20,24,.76);
  box-shadow: 0 14px 38px rgba(5,12,14,.2);
  backdrop-filter: blur(11px);
  opacity: 0;
  visibility: hidden;
  transform: translateX(-12px);
  pointer-events: none;
  transition: opacity .3s, visibility .3s, transform .3s;
}
#preflight.visible { opacity: 1; visibility: visible; transform: translateX(0); }
.preflight-head { display: flex; justify-content: space-between; color: rgba(255,255,255,.68); font: 700 11px/1 "Barlow Condensed"; letter-spacing: .16em; }
.preflight-head b { color: var(--amber); }
#checklist { list-style: none; margin: 12px 0 9px; padding: 0; display: grid; gap: 3px; }
#checklist li { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; min-height: 31px; color: rgba(255,255,255,.46); transition: color .2s; }
#checklist li i { position: relative; width: 14px; height: 14px; border: 1px solid rgba(255,255,255,.3); transition: border-color .2s, background .2s, box-shadow .2s; }
#checklist li i::after { content: "✓"; position: absolute; left: 2px; top: -2px; color: #15251c; font: 800 12px/1 Inter; opacity: 0; transform: scale(.5); transition: opacity .2s, transform .2s; }
#checklist li span { display: flex; flex-direction: column; }
#checklist li strong { font: 600 14px/1.05 "Barlow Condensed"; letter-spacing: .045em; }
#checklist li em { margin-top: 2px; font: 600 8px/1 "Barlow Condensed"; letter-spacing: .12em; font-style: normal; opacity: .55; }
#checklist li kbd { min-width: 34px; padding: 4px 5px; color: rgba(255,255,255,.55); font-size: 9px; }
#checklist li.done { color: rgba(255,255,255,.9); }
#checklist li.done i { border-color: var(--green); background: var(--green); box-shadow: 0 0 0 3px rgba(143,215,166,.1); }
#checklist li.done i::after { opacity: 1; transform: scale(1); }
#checklist li.done em { color: var(--green); opacity: .85; }
#preflight-note { margin: 0; color: rgba(255,255,255,.42); font: 600 9px/1.2 Inter; letter-spacing: .09em; }
#preflight.complete { border-left-color: var(--green); }
#preflight.complete .preflight-head b, #preflight.complete #preflight-note { color: var(--green); }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 13px;
  color: var(--amber);
  font: 700 15px/1 "Barlow Condensed", sans-serif;
  letter-spacing: .19em;
}
.eyebrow-line { width: 34px; height: 3px; background: var(--amber); }
kbd { min-width: 29px; padding: 5px 8px; border: 1px solid rgba(255,255,255,.22); border-radius: 3px; background: rgba(255,255,255,.09); color: inherit; font: 600 12px/1 Inter; text-align: center; box-shadow: 0 1px 0 rgba(0,0,0,.25); }

#hud { position: absolute; inset: 0; z-index: 10; pointer-events: none; opacity: 0; transition: opacity .6s; }
#hud.visible { opacity: 1; }
.hud-top-left, .hud-top-right, .hud-bottom-left, .hud-bottom-center, .hud-bottom-right { position: absolute; }
.hud-top-left { top: 27px; left: 29px; }
.brand-bug { display: flex; align-items: center; height: 23px; margin-bottom: 12px; color: rgba(255,255,255,.9); font: 800 14px "Barlow Condensed"; letter-spacing: .13em; text-shadow: 0 1px 4px #234; }
.brand-bug i { width: 22px; height: 4px; margin-right: 9px; background: var(--amber); box-shadow: 6px -5px 0 -1px var(--amber); }
.brand-bug small { margin-left: 9px; color: var(--amber); font-size: 10px; }
.primary-instruments { display: flex; background: var(--glass); border: 1px solid rgba(255,255,255,.14); backdrop-filter: blur(10px); box-shadow: 0 10px 30px rgba(7,15,17,.15); }
.instrument { min-width: 92px; padding: 11px 15px 12px; }
.instrument + .instrument { border-left: 1px solid rgba(255,255,255,.11); }
.instrument span { display: block; font: 700 31px/1 "Barlow Condensed"; letter-spacing: .02em; }
.instrument small { display: block; margin-top: 5px; color: rgba(255,255,255,.59); font: 600 10px/1 "Barlow Condensed"; letter-spacing: .16em; }
.hud-top-right { top: 26px; right: 28px; display: flex; align-items: center; gap: 10px; pointer-events: auto; }
.status-pill { display: flex; align-items: center; gap: 9px; height: 40px; padding: 0 14px; background: var(--glass); border: 1px solid rgba(255,255,255,.13); backdrop-filter: blur(8px); font: 600 11px Inter; letter-spacing: .08em; }
.status-pill i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.5); }
.status-pill.connected i { background: var(--green); box-shadow: 0 0 8px var(--green); }
.icon-button { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 1px solid rgba(255,255,255,.13); background: var(--glass); color: inherit; cursor: pointer; backdrop-filter: blur(8px); font: 700 17px Inter; text-decoration: none; }
.attitude { position: absolute; left: 50%; top: 51%; display: flex; align-items: center; gap: 9px; transform: translate(-50%,-50%); opacity: .72; }
.attitude-wing { width: 42px; height: 2px; background: white; box-shadow: 0 1px 2px rgba(0,0,0,.45); }
.attitude-wing.left::after, .attitude-wing.right::after { content: ""; display: block; width: 10px; height: 7px; border-top: 2px solid white; }
.attitude-wing.left::after { margin-left: 32px; }
.attitude-wing.right::after { margin-left: 0; }
.attitude i { width: 7px; height: 7px; border: 2px solid white; border-radius: 50%; }
.warning { position: absolute; top: 23%; left: 50%; display: flex; flex-direction: column; align-items: center; padding: 11px 22px; background: rgba(158,28,20,.86); border: 1px solid rgba(255,255,255,.32); transform: translate(-50%,-10px); opacity: 0; transition: opacity .15s, transform .15s; }
.warning.visible { opacity: 1; transform: translate(-50%,0); }
.warning b { font: 800 22px/1 "Barlow Condensed"; letter-spacing: .15em; }
.warning span { margin-top: 4px; font: 600 10px/1 Inter; letter-spacing: .14em; }
.hud-bottom-left { bottom: 28px; left: 29px; }
.engine-card { width: 292px; padding: 13px 15px; background: var(--glass); border: 1px solid rgba(255,255,255,.14); backdrop-filter: blur(9px); }
.engine-label, .engine-foot { display: flex; justify-content: space-between; font: 600 10px "Barlow Condensed"; letter-spacing: .14em; }
.engine-label { color: rgba(255,255,255,.55); }.engine-label b { color: var(--ink); }
.engine-label em { margin-left: 5px; color: var(--amber); font-style: normal; }
.engine-card[data-state="running"] .engine-label em { color: var(--green); }
.engine-card[data-state="stopping"] .engine-label em, .engine-card[data-state="off"] .engine-label em { color: rgba(255,255,255,.48); }
.throttle-track { position: relative; height: 5px; margin: 13px 3px 10px; background: rgba(255,255,255,.14); }
.throttle-track i { display: block; width: 0%; height: 100%; background: linear-gradient(90deg, #7bc999, var(--amber)); }
.throttle-track b { position: absolute; top: 50%; left: 0%; width: 13px; height: 13px; border-radius: 50%; background: white; transform: translate(-50%,-50%); box-shadow: 0 1px 4px #0008; }
.engine-foot { color: rgba(255,255,255,.4); }.engine-foot strong { color: var(--amber); }
.config-row { display: flex; margin-top: 9px; background: rgba(10,20,24,.5); border: 1px solid rgba(255,255,255,.1); }
.config-row div { padding: 9px 13px; }.config-row div + div { border-left: 1px solid rgba(255,255,255,.1); }
.config-row small, .config-row strong { display: block; font-family: "Barlow Condensed"; }
.config-row small { color: rgba(255,255,255,.48); font-size: 9px; letter-spacing: .15em; }.config-row strong { margin-top: 3px; font-size: 13px; letter-spacing: .04em; }
.config-row .fuel-low strong { color: var(--amber); }.config-row .fuel-empty strong { color: #ff786d; }
.hud-bottom-center { left: 50%; bottom: 28px; display: flex; flex-direction: column; align-items: center; transform: translateX(-50%); text-shadow: 0 1px 5px #123; }
.camera-label { text-align: center; }.camera-label small { display: block; color: rgba(255,255,255,.64); font: 600 9px Inter; letter-spacing: .18em; }.camera-label strong { font: 700 17px "Barlow Condensed"; letter-spacing: .12em; }
.camera-dots { display: flex; gap: 6px; margin: 9px 0 10px; }.camera-dots i { width: 18px; height: 3px; background: rgba(255,255,255,.3); }.camera-dots i.active { background: var(--amber); }
.hud-bottom-center > span { color: rgba(255,255,255,.67); font: 600 10px Inter; letter-spacing: .07em; }.hud-bottom-center kbd { padding: 4px 6px; margin-right: 4px; }
.hud-bottom-right { right: 28px; bottom: 378px; text-align: right; text-shadow: 0 1px 5px #123; }
.trim-card span, .trim-card strong, .trim-card small { display: block; }.trim-card span { color: rgba(255,255,255,.6); font: 600 9px Inter; letter-spacing: .17em; }.trim-card strong { margin: 4px 0; font: 700 19px "Barlow Condensed"; letter-spacing: .12em; }.trim-card small { color: rgba(255,255,255,.74); font: 500 10px Inter; letter-spacing: .07em; }

#minimap { position: absolute; right: 28px; bottom: 28px; width: 278px; padding: 11px; border: 1px solid rgba(255,255,255,.16); background: rgba(10,20,24,.76); box-shadow: 0 14px 38px rgba(5,12,14,.22); backdrop-filter: blur(10px); text-shadow: 0 1px 3px #123; }
.minimap-head, .minimap-foot { display: flex; justify-content: space-between; align-items: center; font-family: "Barlow Condensed", sans-serif; letter-spacing: .12em; }
.minimap-head { height: 23px; color: rgba(255,255,255,.68); font-size: 10px; font-weight: 700; }
.minimap-head strong { display: grid; place-items: center; width: 20px; height: 20px; border: 1px solid rgba(255,255,255,.24); color: var(--ink); font-size: 12px; }
#minimap-canvas { display: block; width: 254px; height: 254px; border: 1px solid rgba(255,255,255,.11); background: #73845e; }
.minimap-foot { min-height: 37px; padding-top: 9px; flex-wrap: wrap; gap: 4px; }
.minimap-foot span { color: rgba(255,255,255,.55); font-size: 9px; font-weight: 600; }
.minimap-foot strong { width: 100%; color: var(--amber); font-size: 11px; }

#controls { position: absolute; inset: 0; z-index: 45; display: grid; place-items: center; padding: 22px; background: rgba(4,11,13,.57); backdrop-filter: blur(12px); opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s; }
#controls.visible { opacity: 1; visibility: visible; }
.controls-card { position: relative; width: min(760px,100%); padding: 36px; border: 1px solid rgba(255,255,255,.14); background: #152326; box-shadow: 0 30px 90px rgba(0,0,0,.42); }
.controls-card .close { position: absolute; top: 15px; right: 18px; border: 0; background: none; color: rgba(255,255,255,.65); cursor: pointer; font-size: 32px; }
.controls-card h2 { margin: 11px 0 21px; font: 700 41px "Barlow Condensed"; letter-spacing: .02em; }
.control-tabs { display: flex; border-bottom: 1px solid var(--line); }
.control-tabs button { padding: 11px 21px; border: 0; border-bottom: 2px solid transparent; background: none; color: rgba(255,255,255,.5); cursor: pointer; font: 700 12px Inter; letter-spacing: .08em; }
.control-tabs button.active { border-color: var(--amber); color: var(--ink); }
.control-page { display: none; }.control-page.active { display: block; }
.control-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin-top: 20px; background: rgba(255,255,255,.08); }
.control-grid > div { display: flex; align-items: center; min-height: 67px; gap: 8px; padding: 11px 14px; background: #152326; }
.control-grid span { display: flex; flex-direction: column; margin-left: 5px; }.control-grid b { font: 600 14px Inter; }.control-grid small { margin-top: 4px; color: rgba(255,255,255,.5); font-size: 10px; }
.control-page > p { margin: 20px 2px 0; color: rgba(255,255,255,.58); font-size: 12px; line-height: 1.6; }.control-page p kbd { margin: 0 3px; }
.gamepad-diagram { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 22px 40px 10px; }
.gamepad-diagram > div { display: flex; align-items: center; gap: 13px; }.gamepad-diagram i { display: grid; place-items: center; width: 47px; height: 47px; border: 1px solid rgba(255,255,255,.24); border-radius: 50%; font: 700 11px Inter; font-style: normal; }.gamepad-diagram .trigger i { border-radius: 9px 9px 3px 3px; }.gamepad-diagram span { color: rgba(255,255,255,.62); font: 600 10px Inter; letter-spacing: .08em; }
.control-grid.compact > div { min-height: 52px; }

#toast { position: absolute; top: 130px; left: 50%; z-index: 20; min-width: 190px; padding: 12px 20px; border-left: 3px solid var(--amber); background: rgba(10,20,23,.8); transform: translate(-50%,-12px); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; backdrop-filter: blur(8px); }
#toast.visible { opacity: 1; transform: translate(-50%,0); }
#toast small, #toast strong { display: block; }#toast small { color: var(--amber); font: 700 9px Inter; letter-spacing: .16em; }#toast strong { margin-top: 4px; font: 700 17px "Barlow Condensed"; letter-spacing: .11em; }
#tip { position: absolute; z-index: 18; left: 50%; bottom: 126px; padding: 13px 18px; background: rgba(10,20,23,.76); border: 1px solid rgba(255,255,255,.12); transform: translateX(-50%); color: rgba(255,255,255,.78); font-size: 12px; backdrop-filter: blur(8px); opacity: 0; transition: opacity .5s; pointer-events: none; }
#tip.visible { opacity: 1; }#tip span { margin-right: 10px; color: var(--amber); font: 700 10px Inter; letter-spacing: .13em; }
#crash-continue { position: absolute; right: 28px; bottom: 28px; z-index: 30; max-width: min(360px, calc(100vw - 40px)); padding: 12px 15px 11px; border-right: 3px solid var(--amber); background: rgba(10,20,23,.62); text-align: right; text-shadow: 0 1px 4px #000; backdrop-filter: blur(7px); opacity: 0; visibility: hidden; transform: translateY(8px); pointer-events: none; transition: opacity .3s, visibility .3s, transform .3s; }
#crash-continue.visible { opacity: 1; visibility: visible; transform: translateY(0); }
#crash-continue small, #crash-continue strong { display: block; }
#crash-continue small { color: var(--amber); font: 700 9px/1 Inter; letter-spacing: .17em; }
#crash-continue strong { margin-top: 5px; color: rgba(255,255,255,.86); font: 700 13px/1.25 "Barlow Condensed"; letter-spacing: .1em; }
#crash-panel { position: absolute; inset: 0; z-index: 40; display: grid; place-items: center; padding: 24px; background: rgba(28,9,7,.48); backdrop-filter: blur(8px); opacity: 0; visibility: hidden; transition: opacity .35s, visibility .35s; }
#crash-panel.visible { opacity: 1; visibility: visible; }
#crash-panel > div { width: min(470px,100%); padding: 34px; border-top: 4px solid var(--red); background: #1c2526; text-align: center; box-shadow: 0 25px 80px #0007; }
#crash-panel small { color: var(--red); font: 700 11px Inter; letter-spacing: .16em; }#crash-panel h2 { margin: 10px 0; font: 700 40px "Barlow Condensed"; }#crash-panel p { color: rgba(255,255,255,.65); font-size: 14px; }#restart-button { width: 100%; margin-top: 15px; padding: 16px; border: 0; background: var(--red); cursor: pointer; font: 700 14px "Barlow Condensed"; letter-spacing: .09em; }

@media (max-width: 760px) {
  .screen { padding: 15px; }
  #preflight { top: max(70px, calc(env(safe-area-inset-top) + 60px)); left: max(10px, env(safe-area-inset-left)); width: min(260px, calc(100vw - 20px)); padding: 12px 13px 10px; }
  #checklist { margin-top: 9px; gap: 1px; }
  #checklist li { min-height: 27px; grid-template-columns: 20px 1fr; }
  #checklist li em, #checklist li kbd { display: none; }
  #checklist li strong { font-size: 13px; }
  .hud-top-left { top: max(10px, env(safe-area-inset-top)); left: max(10px, env(safe-area-inset-left)); }
  .brand-bug { display: none; }
  .instrument { min-width: 58px; padding: 8px 8px 9px; }.instrument span { font-size: 23px; }.instrument small { font-size: 8px; }
  .hud-top-right { top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); }.status-pill { display: none; }.icon-button { width: 38px; height: 38px; }
  .hud-bottom-left { left: max(10px, env(safe-area-inset-left)); bottom: max(10px, env(safe-area-inset-bottom)); }.engine-card { width: 205px; }.config-row div:nth-child(2) { display: none; }.config-row strong { font-size: 12px; }
  .hud-bottom-center { bottom: 220px; }.hud-bottom-right { display: none; }
  #minimap { right: max(10px, env(safe-area-inset-right)); bottom: max(10px, env(safe-area-inset-bottom)); width: 155px; padding: 7px; }
  .minimap-head { height: 20px; font-size: 8px; }.minimap-head strong { width: 17px; height: 17px; font-size: 9px; }
  #minimap-canvas { width: 139px; height: 139px; }
  .minimap-foot { min-height: 34px; padding-top: 6px; gap: 2px; }.minimap-foot span { font-size: 7px; }.minimap-foot strong { font-size: 9px; }
  .control-grid { grid-template-columns: 1fr; max-height: 50vh; overflow: auto; }
  .controls-card { padding: 27px 20px 23px; max-height: calc(100dvh - 24px); }
  .controls-card h2 { font-size: 36px; }
  .control-grid > div { min-height: 60px; }
  #tip { bottom: 292px; max-width: calc(100vw - 24px); text-align: center; }
  #crash-continue { right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); }
}

@media (max-width: 760px) and (orientation: landscape) {
  #preflight { width: min(440px, calc(100vw - 20px)); }
  #checklist { grid-template-columns: 1fr 1fr; column-gap: 14px; }
}

@media (max-width: 360px) {
  .engine-card { width: 180px !important; }
  #minimap { width: 120px; }
  #minimap-canvas { width: 104px; height: 104px; }
  .minimap-foot strong { font-size: 8px; }
  .hud-bottom-center { bottom: 195px; }
  #tip { bottom: 260px; }
}

@media (max-height: 720px) and (min-width: 761px) {
  .controls-card { max-height: calc(100dvh - 24px); padding: 24px 30px; overflow: auto; }
  .controls-card h2 { margin-bottom: 12px; }
  .control-grid { margin-top: 12px; }
  .control-grid > div { min-height: 52px; }
  .control-page > p { margin-top: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
