/* SkyReach glass UI. Frosted, light-catching panels over the live 3D world.
   Accent colours mirror Unreal/SkyReach/Source/SkyReach/UI/SkyReachStyle.h. */
:root {
  color-scheme: dark;
  --night: #0b1220;
  --ink: #f4f7fb;
  --ink-soft: rgba(244, 247, 251, 0.72);
  --amber: #ffb703;
  --teal: #5fd4e4;
  --danger: #ff5a5f;
  --glass-fill: linear-gradient(155deg, rgba(255, 255, 255, 0.26) 0%, rgba(255, 255, 255, 0.08) 48%, rgba(255, 255, 255, 0.14) 100%);
  --glass-tint: rgba(16, 26, 44, 0.24);
  --glass-edge: rgba(255, 255, 255, 0.34);
  --glass-blur: blur(22px) saturate(175%);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--night); color: var(--ink);
  font-family: var(--font); touch-action: none; user-select: none; -webkit-user-select: none;
}
#world { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(130% 90% at 50% 40%, transparent 55%, rgba(0, 8, 20, 0.38) 100%); }
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; border: 0; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* ---------------- glass ---------------- */
.glass, .glass-strong {
  position: relative;
  background: var(--glass-fill), var(--glass-tint);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-edge);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.55), inset 0 -1px 1px rgba(255, 255, 255, 0.10), 0 10px 30px rgba(0, 10, 30, 0.22);
  text-shadow: 0 1px 2px rgba(0, 10, 25, 0.35);
}
.glass::after, .glass-strong::after {
  /* specular sheen along the top edge */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(120% 70% at 18% -10%, rgba(255, 255, 255, 0.34), transparent 55%);
}
.glass-strong { --glass-tint: rgba(12, 20, 36, 0.42); --glass-blur: blur(30px) saturate(180%); }


/* ---------------- HUD ---------------- */
#hud .top { flex: 0.72; position: relative; padding: calc(var(--safe-top) + 6px) 10px 0; pointer-events: none; }
#hud .top .bar, #hud .top .bar * { pointer-events: auto; }
.bar { display: flex; align-items: center; gap: 6px; }
#location { flex: 1; padding: 0 6px; font-weight: 700; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }
.pill { border-radius: 16px; padding: 10px 14px; font-weight: 700; font-size: 13px; letter-spacing: 0.4px; }
.pill.on { color: var(--amber); }
.pill.hold { color: var(--danger); --glass-tint: rgba(255, 60, 60, 0.18); }
.pfd { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; height: 128px; }
.readout, .hdg, .bar .pill, .message { --glass-tint: rgba(8, 16, 30, 0.42); }
.stack { display: flex; flex-direction: column; justify-content: space-between; gap: 6px; height: 128px; }
.readout { width: 96px; height: 61px; border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
.readout small { font-size: 8px; font-weight: 700; letter-spacing: 0.8px; color: var(--ink-soft); }
.readout b { font-size: 20px; font-weight: 700; line-height: 1.1; }
.readout span { font-size: 9px; color: var(--ink-soft); }
.readout.warn b { color: var(--danger); }
.att { position: relative; width: 128px; height: 128px; border-radius: 20px; padding: 0; overflow: hidden; }
.att canvas { width: 100%; height: 100%; display: block; }
.hdg-row { display: flex; justify-content: center; align-items: center; margin-top: 6px; position: relative; }
.hdg { position: absolute; left: 50%; bottom: 5px; transform: translateX(-50%); border-radius: 9px; padding: 1px 7px; font-weight: 700; font-size: 11px;
  color: var(--teal); background: rgba(8, 16, 30, 0.55); font-variant-numeric: tabular-nums; pointer-events: none; }
.agl { position: absolute; right: 4px; font-size: 10px; font-weight: 700; color: var(--ink); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7); }
.message { position: absolute; left: 16px; right: 16px; bottom: 14px; margin: 0 auto; width: fit-content; max-width: calc(100% - 32px);
  border-radius: 18px; padding: 10px 16px; font-weight: 700; font-size: 14px; text-align: center; }
.message:empty { display: none; }
.message.warn { color: var(--danger); --glass-tint: rgba(120, 0, 10, 0.25); }
.panel {
  /* no backdrop: the controls float over the world so the aircraft stays in view */
  flex: 0.28; display: flex; flex-direction: column; padding-bottom: calc(var(--safe-bottom) + 2px);
  background: linear-gradient(to bottom, transparent, rgba(0, 8, 20, 0.28)); pointer-events: none;
}
.panel > * { pointer-events: auto; }
.panel .row { display: flex; justify-content: space-between; gap: 12px; padding: 0 12px 2px; position: relative; z-index: 1; }
.pill.wide { flex: none; padding: 7px 12px; font-size: 11px; --glass-tint: rgba(8, 16, 30, 0.5); }
.controls { flex: 1; display: flex; padding: 0 8px 6px; min-height: 0; position: relative; z-index: 1; }
#throttle { flex: 0.34; min-width: 0; height: 100%; touch-action: none; }
#yoke { flex: 0.66; min-width: 0; height: 100%; touch-action: none; }
.divider { width: 0; margin: 0; }
#throttle, #yoke { filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.35)); }
#btn-warp.limited { color: var(--ink-soft); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------------- route + weather (menu) ---------------- */

/* ---------------- route + autopilot (HUD) ---------------- */
.wind { position: absolute; left: 4px; font-size: 10px; font-weight: 700; color: var(--ink); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7); font-variant-numeric: tabular-nums; }
.tools { display: flex; align-items: center; gap: 6px; margin-top: 8px; pointer-events: auto; }
.tools .pill { padding: 8px 12px; font-size: 12px; --glass-tint: rgba(8, 16, 30, 0.42); }
.tools .pill.on { color: #0b1220; --glass-tint: rgba(77, 255, 154, 0.75); text-shadow: none; }
.chip { flex: 1; min-width: 0; border-radius: 14px; padding: 7px 10px; font-size: 11px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; --glass-tint: rgba(8, 16, 30, 0.42); text-align: center; }
.chip:empty { visibility: hidden; }
.chip .go { color: #4dff9a; }

/* ---------------- moving map ---------------- */
.minimap { position: relative; width: 128px; height: 128px; padding: 0; border-radius: 20px; overflow: hidden;
  --glass-tint: rgba(8, 16, 30, 0.42); pointer-events: auto; cursor: pointer; flex: none; }
.minimap canvas { display: block; width: 128px; height: 128px; }
.mm-label { position: absolute; left: 0; right: 0; bottom: 0; font-size: 8.5px; font-weight: 700; text-align: center; padding: 10px 6px 4px; line-height: 1.2;
  max-height: 3.4em; overflow: hidden; background: linear-gradient(to bottom, transparent, rgba(4, 10, 22, 0.75)); pointer-events: none; }
#hud .top .pfd, #hud .top .pfd * { pointer-events: auto; }
.wind span { display: block; color: var(--ink-soft); }

/* simplified top panel: icon buttons, one info line, and a chevron that hides the instruments */
.icon { flex: none; width: 38px; height: 38px; border-radius: 19px; padding: 0; display: grid; place-items: center; --glass-tint: rgba(8, 16, 30, 0.42); }
.icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.info { display: flex; justify-content: space-between; margin-top: 5px; padding: 0 4px; font-size: 10px; font-weight: 700; color: var(--ink);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7); font-variant-numeric: tabular-nums; pointer-events: none; }
#hud .top .tools, #hud .top .collapse, #hud .top .strip { pointer-events: auto; }
.collapse { display: block; margin: 7px auto 0; width: 46px; height: 18px; border-radius: 9px; padding: 0; --glass-tint: rgba(8, 16, 30, 0.35); }
.collapse svg { width: 18px; height: 9px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.25s; }
.strip { display: none; width: fit-content; margin: 8px auto 0; padding: 5px 14px; border-radius: 12px; font-size: 12px; font-weight: 700;
  font-variant-numeric: tabular-nums; white-space: nowrap; --glass-tint: rgba(8, 16, 30, 0.42); }
.strip .ap { color: #4dff9a; }
body.hud-min #instruments { display: none; }
body.hud-min .strip { display: block; }
body.hud-min .collapse svg { transform: rotate(180deg); }

/* ================= start page =================
   A still of the chosen aircraft in the game's own look, a clean light sheet over it, one clear
   call to action. Phones: the sheet fills the lower part; wide screens: a panel on the left. */
#menu {
  --m-ink: #172033; --m-soft: #5d6a80; --m-line: rgba(23, 32, 51, 0.1); --m-fill: #f3f6fa;
  --m-blue: #2f7ff6; --m-blue2: #1f63d8; --m-coral: #ff7a5c;
  color: var(--m-ink); text-shadow: none; background: #a9cbe8;
}
#menu .hero { position: absolute; left: 0; right: 0; top: 0; height: 50%; overflow: hidden; }   /* phones: the picture fills the space above the sheet */
#menu .hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 52%; opacity: 0; transform: scale(1.04);
  transition: opacity 0.7s ease, transform 6s ease-out; }
#menu .hero-img.on { opacity: 1; transform: scale(1); }
#menu .hero-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10, 26, 52, 0.42) 0%, rgba(10, 26, 52, 0) 26%, rgba(10, 26, 52, 0) 50%, rgba(10, 26, 52, 0.2) 100%); }
#menu .brand { position: relative; padding: calc(var(--safe-top) + 18px) 22px 0; color: #fff; text-shadow: 0 2px 14px rgba(0, 20, 50, 0.35); }
#menu .logo { display: flex; align-items: center; gap: 10px; font-size: 27px; font-weight: 800; letter-spacing: -0.6px; }
#menu .logo svg { width: 34px; height: 34px; flex: none; filter: drop-shadow(0 2px 6px rgba(0, 20, 50, 0.3)); }
#menu .logo svg circle { fill: #fff; }
#menu .logo svg path { fill: var(--m-blue); }
#menu .tagline { margin: 4px 0 0 44px; font-size: 14px; font-weight: 600; opacity: 0.92; }

#menu .sheet { position: absolute; left: 0; right: 0; bottom: 0; height: 58%; display: flex; flex-direction: column;
  background: rgba(255, 255, 255, 0.9); -webkit-backdrop-filter: blur(24px) saturate(160%); backdrop-filter: blur(24px) saturate(160%);
  border-radius: 28px 28px 0 0; box-shadow: 0 -12px 40px rgba(10, 30, 60, 0.18); overflow: hidden; }
#menu .sheet::before { content: ""; position: absolute; top: 8px; left: 50%; width: 40px; height: 5px; margin-left: -20px; border-radius: 3px; background: rgba(23, 32, 51, 0.16); }
#menu .sheet-scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; padding: 22px 18px 8px; }
#menu .block { padding: 0 0 16px; }
#menu .block + .block { border-top: 1px solid var(--m-line); padding-top: 14px; }
#menu h2 { margin: 0 2px 10px; font-size: 12px; font-weight: 800; letter-spacing: 1.1px; text-transform: uppercase; color: var(--m-soft); }

#menu .cards { display: flex; gap: 10px; }
#menu .card { flex: 1; display: flex; flex-direction: column; padding: 0; border-radius: 18px; overflow: hidden; background: #fff; text-align: left;
  box-shadow: 0 0 0 1.5px var(--m-line), 0 6px 16px rgba(10, 30, 60, 0.06); transition: box-shadow 0.2s, transform 0.2s; }
#menu .card:active { transform: scale(0.98); }
#menu .card .thumb { height: 74px; background-size: 260%; background-position: 50% 44%; }
#menu .card-text { display: flex; flex-direction: column; padding: 9px 12px 11px; }
#menu .card b { font-size: 16px; font-weight: 800; }
#menu .card-text span { font-size: 12px; color: var(--m-soft); margin-top: 1px; }
#menu .card.selected { box-shadow: 0 0 0 2.5px var(--m-blue), 0 8px 22px rgba(47, 127, 246, 0.22); }

#menu .route-pick { display: flex; align-items: stretch; gap: 8px; }
#menu .route-pick button { flex: 1; display: flex; flex-direction: column; align-items: flex-start; padding: 9px 14px; border-radius: 16px; background: var(--m-fill);
  box-shadow: inset 0 0 0 1.5px transparent; text-align: left; min-width: 0; }
#menu .route-pick button.on { background: #fff; box-shadow: inset 0 0 0 2px var(--m-blue), 0 4px 12px rgba(47, 127, 246, 0.14); }
#menu .route-pick small { font-size: 11px; font-weight: 700; color: var(--m-soft); }
#menu .route-pick b { font-size: 17px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
#menu .route-arrow { display: flex; align-items: center; color: var(--m-soft); }
#menu .route-arrow svg, #menu .search svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
#menu .search { display: flex; align-items: center; gap: 8px; margin: 10px 0 6px; padding: 0 14px; height: 46px; border-radius: 14px; background: var(--m-fill); color: var(--m-soft); }
#menu .search input { flex: 1; background: transparent; border: 0; outline: 0; font: 600 15px var(--font); color: var(--m-ink); }
#menu .search input::placeholder { color: #8b96a8; font-weight: 500; }
#menu #results { list-style: none; margin: 0; padding: 0; max-height: 196px; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
#menu #results li { display: grid; grid-template-columns: 1fr; padding: 9px 12px; border-radius: 12px; cursor: pointer; }
#menu #results li + li { margin-top: 2px; }
#menu #results li:hover { background: var(--m-fill); }
#menu #results li.active { background: rgba(47, 127, 246, 0.1); }
#menu #results .code { display: flex; justify-content: space-between; font-weight: 800; font-size: 14px; color: var(--m-ink); }
#menu #results li.active .code { color: var(--m-blue2); }
#menu #results .code small { font-size: 11px; font-weight: 600; color: var(--m-soft); }
#menu #results .name { font-size: 13px; color: var(--m-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#menu #results .where { font-size: 12px; color: var(--m-soft); }
#menu .selected-title { margin: 12px 2px 8px; font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#menu .route-summary { margin: 10px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--m-fill); font-size: 13px; line-height: 1.5; color: var(--m-ink); }
#menu .route-summary:empty { display: none; }
#menu .route-summary em { font-style: normal; font-weight: 800; color: var(--m-blue2); }

#menu .chips { display: flex; flex-wrap: wrap; gap: 6px; }
#menu .chips button { padding: 8px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--m-fill); color: var(--m-ink); }
#menu .chips button.on { background: var(--m-ink); color: #fff; }
#menu .segmented { display: flex; padding: 4px; gap: 2px; border-radius: 14px; background: var(--m-fill); }
#menu .segmented button { flex: 1; padding: 9px 2px; border-radius: 10px; font-size: 13px; font-weight: 700; color: var(--m-soft); background: transparent; transition: background 0.2s, color 0.2s; }
#menu .segmented button.on { background: #fff; color: var(--m-ink); box-shadow: 0 2px 8px rgba(10, 30, 60, 0.12); }
#menu .segmented.small button { padding: 7px 4px; font-size: 12px; }
#menu .wx-row { display: flex; align-items: center; gap: 10px; }
#menu .wx-row + .wx-row { margin-top: 8px; }
#menu .wx-row > span { width: 64px; flex: none; font-size: 13px; font-weight: 700; color: var(--m-soft); }
#menu .setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; font-weight: 600; }
#menu .setting + .setting { margin-top: 12px; }
#menu .setting .segmented { flex: 0 1 230px; }
#menu .check { cursor: pointer; }
#menu .check input { position: absolute; opacity: 0; pointer-events: none; }
#menu .switch { position: relative; width: 48px; height: 28px; flex: none; border-radius: 14px; background: #cfd6e0; transition: background 0.2s; }
#menu .switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); transition: transform 0.2s; }
#menu .check input:checked + .switch { background: #34c46e; }
#menu .check input:checked + .switch::after { transform: translateX(20px); }
#menu .check input:focus-visible + .switch { outline: 2px solid var(--m-blue); outline-offset: 2px; }
#menu .credits { margin: 2px 2px 6px; }
#menu .credits summary { font-size: 12px; font-weight: 700; color: var(--m-soft); cursor: pointer; }
#menu .fine { margin: 8px 0 0; font-size: 11px; line-height: 1.5; color: var(--m-soft); }

#menu .cta { padding: 10px 18px calc(var(--safe-bottom) + 14px); background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.95) 30%); }
#menu .primary, .crash .primary { width: 100%; height: 56px; border-radius: 18px; font-size: 18px; font-weight: 800; letter-spacing: 0.2px; color: #fff;
  background: linear-gradient(180deg, var(--m-blue, #2f7ff6), var(--m-blue2, #1f63d8)); box-shadow: 0 10px 24px rgba(31, 99, 216, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.2s; }
#menu .primary:active, .crash .primary:active { transform: translateY(1px) scale(0.99); }
#menu .primary:disabled { opacity: 0.45; box-shadow: none; }

#menu .loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(12, 28, 54, 0.35);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); z-index: 5; }
#menu .loading-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 26px 30px; min-width: 240px; border-radius: 24px; background: #fff;
  box-shadow: 0 24px 60px rgba(10, 30, 60, 0.3); text-align: center; }
#menu .loading-card b { font-size: 17px; font-weight: 800; margin-top: 10px; }
#menu .loading-card span { font-size: 13px; color: var(--m-soft); }
#menu .spinner { width: 40px; height: 40px; border-radius: 50%; border: 4px solid #e3eaf4; border-top-color: var(--m-blue); animation: sr-spin 0.9s linear infinite; }
@keyframes sr-spin { to { transform: rotate(360deg); } }

@media (min-width: 820px) and (min-aspect-ratio: 1/1) {
  #menu .brand { padding: 30px 40px 0; }
  #menu .logo { font-size: 34px; }
  #menu .logo svg { width: 42px; height: 42px; }
  #menu .tagline { margin-left: 52px; font-size: 16px; }
  #menu .sheet { left: 32px; right: auto; top: 120px; bottom: 32px; width: 420px; height: auto; border-radius: 28px; box-shadow: 0 24px 70px rgba(10, 30, 60, 0.28); }
  #menu .sheet::before { display: none; }
  #menu .hero { height: 100%; }
  #menu .hero-img { object-position: 62% 46%; }
}

/* ================= crash card ================= */
.crash { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(120% 80% at 50% 50%, rgba(12, 20, 36, 0.12), rgba(12, 20, 36, 0.55)); pointer-events: auto; animation: sr-fade 0.35s ease-out; }
.crash-card { --m-blue: #2f7ff6; --m-blue2: #1f63d8; width: min(360px, 100%); padding: 26px 22px 20px; border-radius: 26px; background: rgba(255, 255, 255, 0.96); color: #172033;
  text-align: center; text-shadow: none; box-shadow: 0 30px 80px rgba(5, 15, 35, 0.4); animation: sr-pop 0.4s cubic-bezier(0.2, 1.3, 0.4, 1); }
.crash-badge { width: 58px; height: 58px; margin: 0 auto; border-radius: 50%; background: #ffe7e1; position: relative; }
.crash-badge::before { content: "!"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 30px; font-weight: 900; color: #ff5a3c; }
.crash-card h3 { margin: 14px 0 6px; font-size: 26px; font-weight: 800; letter-spacing: -0.3px; }
.crash-card p { margin: 0; font-size: 15px; line-height: 1.5; color: #4b5870; }
.crash-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }
.crash .ghost { height: 48px; border-radius: 16px; font-size: 16px; font-weight: 700; color: #172033; background: #eef2f7; }
@keyframes sr-fade { from { opacity: 0; } }
@keyframes sr-pop { from { opacity: 0; transform: translateY(14px) scale(0.96); } }
