:root {
  --bg: #070d1a;
  --panel: #101a30;
  --panel-2: #16233f;
  --line: #23345a;
  --text: #eaf1ff;
  --dim: #8ba0c8;
  --accent: #4dd0ff;
  --hot: #ffd54a;
  --pad: max(14px, env(safe-area-inset-left));
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* Any explicit `display` beats the browser's own [hidden] rule, so elements
   laid out as grid or flex stay on screen when hidden -- which showed a stale
   route next to "no route on file". Settle it once, here. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 ui-rounded, "SF Pro Rounded", system-ui, -apple-system, Segoe UI, sans-serif;
}

body { touch-action: manipulation; user-select: none; -webkit-user-select: none; }

/* ------------------------------------------------------------- splash */

#splash {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  background: radial-gradient(120% 90% at 50% 0%, #16305c 0%, var(--bg) 60%);
}
.splash-plane { font-size: 68px; animation: float 3.5s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0) rotate(-8deg); } 50% { transform: translateY(-12px) rotate(-2deg); } }
#splash h1 { font-size: 34px; margin: 12px 0 6px; letter-spacing: -0.5px; }
#splash p { color: var(--dim); margin: 0 0 24px; }
#start {
  font: 600 20px/1 inherit;
  color: #06213a;
  background: var(--accent);
  border: 0;
  border-radius: 999px;
  padding: 18px 52px;
  box-shadow: 0 8px 30px rgba(77, 208, 255, 0.35);
}
#start:active { transform: scale(0.97); }
.hint { font-size: 13px; margin-top: 18px !important; }

/* ---------------------------------------------------------------- app */

#app {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) var(--pad) max(10px, env(safe-area-inset-bottom));
}

/* Grid items default to min-width:auto, so a row containing anything that
   will not wrap — the status text down in the bar — widens the whole column
   past the viewport and pushes the card off the right edge. Letting them
   shrink is what makes the ellipsis in .status actually do its job. */
#app > * { min-width: 0; }

/* --------------------------------------------------------------- card */

.card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  min-height: 168px;
  transition: border-color .25s, box-shadow .25s;
}
.card.locked { border-color: var(--hot); box-shadow: 0 0 0 1px var(--hot), 0 10px 40px rgba(255, 213, 74, .18); }
.card.empty { display: grid; place-items: center; }

.card-empty { text-align: center; color: var(--dim); }
.scan { font-size: 19px; color: var(--text); }
.card-empty .sub { font-size: 14px; margin-top: 6px; }

.row-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.callsign { font-size: 30px; font-weight: 700; letter-spacing: 1px; line-height: 1.1; }
.airline { color: var(--dim); font-size: 14px; margin-top: 2px; }

.lock { text-align: right; color: var(--hot); flex: none; }
.lock span { font-size: 22px; font-weight: 700; display: block; font-variant-numeric: tabular-nums; }
.lock small { color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }

.route { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin: 16px 0 4px; }
.port { text-align: center; min-width: 0; }
.port .code { font-size: 26px; font-weight: 700; }
.port .city { font-size: 13px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arrow { color: var(--accent); font-size: 20px; }
.route-missing { color: var(--dim); font-size: 14px; margin: 16px 0 4px; text-align: center; }

.spot {
  display: flex; align-items: center; gap: 8px;
  margin-top: 14px; font-size: 13px; color: var(--dim);
}
.spot i { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--dim); }
.spot.t-easy { color: #8ae9ff; }   .spot.t-easy i { background: #8ae9ff; box-shadow: 0 0 8px #8ae9ff; }
.spot.t-dot { color: #4dd0ff; }    .spot.t-dot i { background: #4dd0ff; }
.spot.t-faint i { background: #3f83ab; }
.spot.t-unseen i { background: #33536b; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.stats div { text-align: center; min-width: 0; }
.stats b { display: block; font-size: 15px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats small { color: var(--dim); font-size: 10px; text-transform: uppercase; letter-spacing: .4px; }

/* ---------------------------------------------------------------- sky */

.sky-wrap { position: relative; min-height: 0; }
#sky { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#sky:active { cursor: grabbing; }
/* Sits at the top: the corner minimap owns the bottom of the view. */
.sky-hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  pointer-events: none;
}
.sky-readout {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--dim);
  font-variant-numeric: tabular-nums;
}
/* The fix every angle on screen is measured from — worth being able to check. */
.fix {
  margin-top: 3px;
  font-size: 11px;
  color: #5d719a;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

/* ---------------------------------------------------------------- bar */

.bar { display: flex; align-items: center; gap: 6px; }
.ghost {
  font: 500 13px/1 inherit;
  color: var(--dim);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 12px;
  flex: none;
}
.ghost.on { color: #06213a; background: var(--accent); border-color: var(--accent); }
/* Also min-width:0 here, for the same reason one level down: without it the
   flex item will not shrink below its text and the ellipsis never kicks in. */
.status { flex: 1; min-width: 0; text-align: right; font-size: 12px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status.err { color: #ff8b8b; }
