/* ═══════════════ GOLDEN GATE FLIGHT DECK — HUD ═══════════════ */
:root {
  --ink: #f3ede3;
  --ink-dim: rgba(243, 237, 227, 0.55);
  --ink-faint: rgba(243, 237, 227, 0.32);
  --amber: #f2a65a;
  --orange: #e05a3a;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --sans: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --glass-bg: linear-gradient(140deg, rgba(255, 244, 228, 0.13), rgba(24, 18, 12, 0.30));
  --glass-border: rgba(255, 235, 210, 0.18);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--sans);
  background: #10141a;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

#scene {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
#scene.dragging { cursor: grabbing; }

/* ── cinematic overlays ── */
#vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 3;
  background: radial-gradient(ellipse 120% 90% at 50% 42%, transparent 52%, rgba(12, 8, 5, 0.45) 100%);
}
#grain {
  position: fixed; inset: -60px; pointer-events: none; z-index: 3; opacity: 0.05;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='180' height='180' filter='url(%23n)'/></svg>");
}
#letterbox { position: fixed; inset: 0; pointer-events: none; z-index: 4; }
.lb-bar {
  position: absolute; left: 0; right: 0; height: 7vh; background: #000;
  transition: transform 0.9s cubic-bezier(0.7, 0, 0.25, 1);
}
.lb-top { top: 0; transform: translateY(-101%); }
.lb-bottom { bottom: 0; transform: translateY(101%); }
body.cinematic .lb-top { transform: translateY(0); }
body.cinematic .lb-bottom { transform: translateY(0); }

/* ── liquid glass ── */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: 0 14px 44px rgba(8, 6, 4, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.hud { position: fixed; z-index: 10; }

/* ── brand ── */
#brand {
  top: 22px; left: 26px;
  display: flex; align-items: center; gap: 12px;
  color: var(--ink); pointer-events: none;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.5);
}
#brand svg { color: var(--amber); flex: none; }
.brand-text h1 {
  font-size: 15px; font-weight: 700; letter-spacing: 0.34em; line-height: 1;
}
.brand-text p {
  margin-top: 5px; font-family: var(--mono);
  font-size: 9px; letter-spacing: 0.22em; color: var(--ink-dim);
}

/* ── mode bar ── */
#modebar {
  top: 20px; right: 24px;
  display: flex; gap: 4px; padding: 5px;
  border-radius: 999px;
}
#modebar button {
  appearance: none; border: 0; background: transparent;
  font-family: var(--mono); font-size: 10px; font-weight: 500;
  letter-spacing: 0.14em; color: var(--ink-dim);
  padding: 8px 14px; border-radius: 999px; cursor: pointer;
  transition: color 0.25s, background 0.25s, box-shadow 0.25s;
}
#modebar button:hover { color: var(--ink); }
#modebar button.active {
  color: #1a120c;
  background: linear-gradient(160deg, var(--amber), #e8894a);
  box-shadow: 0 4px 18px rgba(242, 166, 90, 0.45);
}
#letterbox-btn { font-size: 12px; padding: 7px 11px !important; }

/* ── telemetry ── */
#telemetry {
  right: 24px; bottom: 24px;
  width: 252px; padding: 15px 16px 13px;
}
.tel-head {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.24em; color: var(--ink-dim);
  padding-bottom: 10px; border-bottom: 1px solid rgba(255, 235, 210, 0.12);
}
.live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #ff5a3c; box-shadow: 0 0 8px #ff5a3c;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.25; } }
#t-route { margin-left: auto; color: var(--amber); text-align: right; letter-spacing: 0.12em; }

.tel-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 12px 8px; padding: 13px 0 4px;
}
.metric label {
  display: block; font-family: var(--mono);
  font-size: 8px; letter-spacing: 0.2em; color: var(--ink-faint); margin-bottom: 3px;
}
.metric div { display: flex; align-items: baseline; gap: 4px; }
.metric span {
  font-family: var(--mono); font-size: 19px; font-weight: 700;
  font-variant-numeric: tabular-nums; line-height: 1;
}
.metric small { font-family: var(--mono); font-size: 8px; color: var(--ink-dim); letter-spacing: 0.06em; }

/* attitude indicator */
.adi {
  position: relative; width: 96px; height: 96px;
  margin: 12px auto 4px; border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(255, 235, 210, 0.22);
  box-shadow: inset 0 0 0 3px rgba(10, 8, 6, 0.55), 0 4px 14px rgba(8, 6, 4, 0.4);
}
.adi-horizon {
  position: absolute; left: -50%; top: -50%;
  width: 200%; height: 200%;
  background: linear-gradient(to bottom, #3f6b9e 0 50%, #6e5233 50% 100%);
  will-change: transform;
}
.adi-horizon::after {
  content: ''; position: absolute; left: 0; right: 0; top: 50%;
  height: 1px; background: rgba(255, 255, 255, 0.75);
}
.adi-mark {
  position: absolute; left: 50%; top: 50%;
  width: 34px; height: 14px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.adi-mark i, .adi-mark::before, .adi-mark::after {
  content: ''; position: absolute; background: var(--amber);
}
.adi-mark i { left: 50%; top: 50%; width: 4px; height: 4px; border-radius: 50%; transform: translate(-50%, -50%); }
.adi-mark::before, .adi-mark::after { top: 50%; width: 12px; height: 2px; margin-top: -1px; }
.adi-mark::before { left: 0; transform: rotate(28deg); transform-origin: right center; }
.adi-mark::after { right: 0; transform: rotate(-28deg); transform-origin: left center; }

.tel-foot {
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.1em;
  color: var(--ink-faint); padding-top: 10px;
  border-top: 1px solid rgba(255, 235, 210, 0.12);
}
.tel-touch { display: none; justify-content: center; gap: 10px; padding-top: 10px; }
.tel-touch button {
  width: 44px; height: 34px; border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 244, 228, 0.08); color: var(--ink);
  font-family: var(--mono); font-size: 16px; cursor: pointer;
}
@media (hover: none) { .tel-touch { display: flex; } }

/* ── hints ── */
#hints {
  left: 26px; bottom: 24px;
  padding: 11px 16px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em;
  color: var(--ink-dim); line-height: 1.9;
  max-width: 320px;
}
#hints b { color: var(--ink); font-weight: 700; }
#hints .key {
  display: inline-block; min-width: 18px; text-align: center;
  padding: 1px 5px; margin-right: 2px;
  border: 1px solid rgba(255, 235, 210, 0.25); border-radius: 5px;
  color: var(--ink); font-size: 9px;
}

/* ── crosshair ── */
#crosshair {
  position: fixed; left: 50%; top: 50%; z-index: 9;
  width: 18px; height: 18px; transform: translate(-50%, -50%);
  pointer-events: none; opacity: 0; transition: opacity 0.4s;
}
#crosshair.on { opacity: 0.85; }
#crosshair i {
  position: absolute; inset: 0; border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
}
#crosshair::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 3px; height: 3px; border-radius: 50%;
  background: #fff; transform: translate(-50%, -50%);
}

/* ── toast ── */
#toast {
  position: fixed; left: 50%; bottom: 92px; z-index: 11;
  transform: translate(-50%, 12px);
  padding: 10px 22px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.26em;
  color: var(--amber);
  opacity: 0; pointer-events: none;
  transition: opacity 0.35s, transform 0.35s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── loader ── */
#loader {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 26px;
  background: radial-gradient(ellipse 90% 70% at 50% 60%, #1b222c 0%, #0c0f14 70%);
  transition: opacity 1s ease, visibility 1s;
}
#loader.done { opacity: 0; visibility: hidden; }
.loader-bridge { width: min(420px, 72vw); color: var(--orange); opacity: 0.9; }
.loader-title {
  font-size: 14px; font-weight: 600; letter-spacing: 0.42em; color: var(--ink);
}
.loader-title span { color: var(--amber); }
.loader-track {
  width: min(240px, 50vw); height: 2px;
  background: rgba(243, 237, 227, 0.14); border-radius: 2px; overflow: hidden;
}
#loader-bar {
  width: 0%; height: 100%;
  background: linear-gradient(90deg, var(--orange), var(--amber));
  transition: width 0.4s ease;
}
#loader-status {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.3em; color: var(--ink-faint);
}

#webgl-error {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center; background: #0c0f14;
}
#webgl-error[hidden] { display: none; }
#webgl-error .glass { padding: 32px 44px; text-align: center; }
#webgl-error h2 { font-size: 16px; letter-spacing: 0.2em; margin-bottom: 8px; }
#webgl-error p { font-size: 12px; color: var(--ink-dim); }

/* ── responsive ── */
@media (max-width: 900px) {
  #brand { top: 16px; left: 16px; }
  .brand-text p { display: none; }
  #modebar { top: auto; bottom: 16px; right: 50%; transform: translateX(50%); }
  #modebar button { padding: 8px 10px; font-size: 9px; }
  #telemetry { right: 16px; bottom: 84px; width: 210px; padding: 12px; }
  .tel-grid { gap: 9px 6px; }
  .metric span { font-size: 16px; }
  .adi { width: 78px; height: 78px; }
  #hints { display: none; }
  #toast { bottom: 150px; }
}
