/* Final Approach — full-bleed canvas air traffic game. Self-contained. */

@import url("https://fonts.googleapis.com/css2?family=Archivo:wght@600;700;800;900&family=Geist+Mono:wght@400;500;600&display=swap");

:root{
  --ink: #eaf1ff;
  --dim: rgba(234, 241, 255, 0.58);
  --faint: rgba(234, 241, 255, 0.32);
  --bg: #05080f;
  --jet: #ff5a5f;
  --prop: #ffc24a;
  --heli: #4fd2ff;
  --green: #5dff9d;
  --line: rgba(160, 190, 255, 0.16);
  --font-display: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

*, *::before, *::after{ box-sizing: border-box; }
html, body{
  height: 100%; margin: 0; overflow: hidden;
  background: var(--bg); color: var(--ink);
  font-family: var(--font-display);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  /* paths are drawn with a finger: a pan here would cancel the drag (the 2026-10-21 trap) */
  touch-action: none;
}
canvas{
  display: block; width: 100%; height: 100%; touch-action: none;
  -webkit-touch-callout: none; user-select: none; -webkit-user-select: none;
}

/* ---------- HUD ---------- */
.hud{
  position: fixed; z-index: 5; pointer-events: none;
  top: max(12px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  display: flex; gap: 24px; align-items: flex-end;
  font-family: var(--font-mono);
  padding: 7px 18px;
  border: 1px solid var(--line); border-radius: 12px;
  background: rgba(6, 10, 22, 0.62);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.hud[hidden]{ display: none; }
.hud__cell{ display: flex; flex-direction: column; align-items: center; gap: 1px; }
.hud__k{ font-size: 8px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--faint); }
.hud__cell span:last-child{ font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
#landed{ color: var(--green); }
.hud.is-bump #landed{ animation: bump 260ms ease-out; }
@keyframes bump{ 0%{ transform: scale(1); } 40%{ transform: scale(1.32); } 100%{ transform: scale(1); } }

/* ---------- Buttons ---------- */
.sound-btn, .ff-btn{
  position: fixed; z-index: 6;
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line); background: rgba(7, 11, 24, 0.62); color: var(--ink);
  font-size: 15px; cursor: pointer; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: transform 140ms ease, border-color 140ms ease, opacity 140ms ease, background 140ms ease;
}
.sound-btn{ top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); }
.ff-btn{
  bottom: max(14px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  width: auto; padding: 0 16px; border-radius: 999px; font-size: 13px; letter-spacing: -0.1em;
}
.ff-btn[hidden]{ display: none; }
.ff-btn[aria-pressed="true"]{ background: rgba(93, 255, 157, 0.16); border-color: rgba(93, 255, 157, 0.55); color: var(--green); }
.sound-btn:hover{ transform: translateY(-1px); border-color: var(--heli); }
.sound-btn[aria-pressed="false"]{ opacity: 0.45; }
.sound-btn:focus-visible, .ff-btn:focus-visible{ outline: none; box-shadow: 0 0 0 3px rgba(79, 210, 255, 0.45); }

/* ---------- Overlay ---------- */
.overlay{
  position: fixed; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  padding: 22px; overflow-y: auto;
  background: radial-gradient(90% 70% at 50% 42%, rgba(4, 7, 16, 0.6), rgba(1, 2, 6, 0.9));
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  transition: opacity 240ms ease;
}
.overlay[hidden]{ display: none; }
.overlay.is-out{ opacity: 0; pointer-events: none; }
.panel{
  max-width: 500px; text-align: center; margin: auto;
  padding: clamp(22px, 5vw, 34px);
  border: 1px solid var(--line); border-radius: 16px;
  background: rgba(6, 10, 22, 0.84);
  box-shadow: 0 30px 90px -20px rgba(0,0,0,0.85);
}
.panel__eyebrow{ margin: 0 0 6px; font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--green); }
.panel__title{ margin: 0 0 12px; font-size: clamp(1.9rem, 7.4vw, 2.9rem); font-weight: 900; letter-spacing: -0.02em; }
.panel__text{ margin: 0 0 20px; font-family: var(--font-mono); font-size: 0.8rem; line-height: 1.7; color: var(--dim); }
.panel__text b{ color: var(--ink); font-weight: 600; }
.k{ font-weight: 600; }
.k--jet{ color: var(--jet); } .k--prop{ color: var(--prop); } .k--heli{ color: var(--heli); }
.play-btn{
  appearance: none; font-family: var(--font-display); font-weight: 800; font-size: 1rem;
  padding: 13px 30px; border-radius: 999px; cursor: pointer;
  border: 0; background: linear-gradient(180deg, #b9ffd6, var(--green));
  color: #052414; box-shadow: 0 10px 30px -8px rgba(93, 255, 157, 0.55);
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.play-btn:hover{ transform: translateY(-2px); box-shadow: 0 16px 38px -10px rgba(93, 255, 157, 0.75); }
.play-btn:focus-visible{ outline: none; box-shadow: 0 0 0 3px rgba(93, 255, 157, 0.45); }
.panel__keys{ margin: 16px 0 0; font-family: var(--font-mono); font-size: 0.64rem; letter-spacing: 0.06em; color: var(--faint); }

/* ---------- Frame corners ---------- */
.frame{ position: fixed; inset: 0; z-index: 4; pointer-events: none; }
.frame__corner{
  position: fixed; font-family: var(--font-mono); font-size: 0.6rem;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--faint);
}
.frame__corner--tl{ top: max(14px, env(safe-area-inset-top)); left: max(14px, env(safe-area-inset-left)); }
.frame__corner--tr{ top: max(14px, env(safe-area-inset-top)); right: max(58px, calc(env(safe-area-inset-right) + 58px)); }
.frame__corner--bl{ bottom: max(14px, env(safe-area-inset-bottom)); left: max(14px, env(safe-area-inset-left)); pointer-events: auto; }
.frame__corner--bl a{ color: var(--faint); text-decoration: none; }
.frame__corner--bl a:hover{ color: var(--green); }

@media (max-width: 620px){
  /* the HUD is centred at the top and the toy name is pinned top-right; below this width they meet */
  .frame__corner--tr{ display: none; }
  .hud{ gap: 16px; padding: 6px 12px; }
  .hud__k{ font-size: 7px; letter-spacing: 0.12em; }
  .hud__cell span:last-child{ font-size: 15px; }
  /* the tickets pill docks bottom-left above the back link; the fast-forward pill sits clear of it */
  .ff-btn{ bottom: max(16px, calc(env(safe-area-inset-bottom) + 4px)); left: auto; right: max(14px, env(safe-area-inset-right)); transform: none; }
}
@media (max-height: 620px){
  .hud{ top: max(6px, env(safe-area-inset-top)); padding: 4px 11px; }
}
@media (prefers-reduced-motion: reduce){
  .play-btn, .sound-btn, .ff-btn, .overlay{ transition: none; }
  .hud.is-bump #landed{ animation: none; }
}

/* Aircraft fly over the whole screen and the shared tip-jar / fullscreen badges dock at
   right-CENTRE, right in the airspace. Move them to the top-right under the sound button.
   Doubled classes out-specify the components' own injected styles. */
.opt-tipjar.opt-tipjar{
  top: calc(max(12px, env(safe-area-inset-top)) + 48px);
  bottom: auto; transform: none;
}
.opt-fs.opt-fs{
  top: calc(max(12px, env(safe-area-inset-top)) + 100px);
  bottom: auto; transform: none;
}
.opt-tipjar.opt-tipjar.tj-nudge{ animation: none; }
