:root {
  --ink: #25303b;
  --muted: #6c7884;
  --line: rgba(37, 48, 59, 0.1);
  --card: rgba(255, 253, 248, 0.94);
  --tile: #f3f1ea;
  --chip: #eef1ec;
  --hover: #f0eee6;
  --field: #ffffff;
  --btn: #25303b;
  --btn-ink: #ffffff;
  --ghost: #eeece4;
  --accent: #e0569b;
  --accent2: #2f8fd8;
  --glow: 0 1px 0 rgba(255,255,255,0.8) inset, 0 6px 22px rgba(40, 55, 40, 0.16), 0 1px 3px rgba(40,55,40,0.12);
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  --bg: #cfe2ae;
}
body.neon {
  --ink: #fff6fb;
  --muted: #c9b4dc;
  --line: rgba(255, 120, 200, 0.22);
  --card: rgba(30, 14, 56, 0.86);
  --tile: rgba(255, 255, 255, 0.07);
  --chip: rgba(255, 255, 255, 0.1);
  --hover: rgba(255, 62, 165, 0.14);
  --field: rgba(255, 255, 255, 0.08);
  --btn: linear-gradient(135deg, #ff3ea5, #ff8a3d);
  --btn-ink: #ffffff;
  --ghost: rgba(255, 255, 255, 0.1);
  --accent: #ff3ea5;
  --accent2: #2de2e6;
  --glow: 0 0 0 1px rgba(255, 62, 165, 0.35), 0 0 26px rgba(255, 62, 165, 0.22), 0 10px 30px rgba(20, 0, 40, 0.35);
  --bg: #c4ebbd;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font-family: var(--font); }
#map { position: fixed; inset: 0; width: 100vw; height: 100vh; touch-action: none; cursor: grab; display: block; will-change: transform; backface-visibility: hidden; }
#overlay { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 1; }
body.tilted { background: #eef2f6; }
body.tilted.neon { background: #efe9f4; }

/* Welcome screen */
#splash { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: #d5dbe0; transition: opacity .7s ease, visibility .7s; }
body.neon #splash { background: radial-gradient(ellipse at 50% 60%, #5a2a7a 0%, #2a1446 70%); }
#splash.gone { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-inner { text-align: center; }
#splash h1 { margin: 0; font: 800 clamp(24px, 4vw, 34px)/1.2 var(--font); color: #2c3440; letter-spacing: -0.3px; text-shadow: 0 1px 0 rgba(255,255,255,.6); }
body.neon #splash h1 { color: #fff; text-shadow: none; }
body.neon .splash-name { background: linear-gradient(180deg, #ffe27a, #ff9a3c 40%, #ff3ea5 75%, #b24bff); -webkit-background-clip: text; background-clip: text; color: transparent; font-style: italic; padding-right: 3px; }
.splash-sky { position: relative; height: 48px; width: min(360px, 80vw); margin: 10px auto 0; overflow: hidden; }
.splash-plane { position: absolute; top: 6px; left: -40px; width: 38px; height: 38px; animation: fly 2.6s cubic-bezier(.45,.05,.55,.95) infinite; filter: drop-shadow(0 6px 4px rgba(20,30,40,.25)); }
@keyframes fly { 0% { transform: translate(0, 6px); } 50% { transform: translate(calc(min(360px, 80vw) / 2 + 20px), -2px); } 100% { transform: translate(calc(min(360px, 80vw) + 80px), 6px); } }
.splash-sub { margin: 6px 0 0; font: 700 12.5px var(--font); color: #6c7884; }
body.neon .splash-sub { color: #c9b4dc; }
@media (prefers-reduced-motion: reduce) { .splash-plane { animation: none; left: calc(50% - 19px); } }
#map.dragging { cursor: grabbing; }
#map.pointer { cursor: pointer; }
button, input, select { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
a { color: var(--accent2); }

.card { background: var(--card); border-radius: 16px; box-shadow: var(--glow); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); color: var(--ink); }

/* Brand + airport dropdown */
.brand { position: fixed; top: 14px; left: 14px; padding: 10px 14px 10px; z-index: 5; max-width: min(360px, calc(100vw - 28px)); }
.brand-row { display: flex; align-items: center; gap: 6px; }
.tiny { font-weight: 800; font-size: 30px; letter-spacing: -0.5px; color: var(--accent); line-height: 1; }
.picker { position: relative; display: inline-flex; }
.picker select {
  appearance: none; -webkit-appearance: none;
  font: 800 30px/1 var(--font); letter-spacing: -0.5px; color: var(--ink);
  background: var(--field); border: 2px solid var(--line); border-radius: 12px;
  padding: 2px 34px 3px 10px; cursor: pointer;
}
.picker select option { color: #25303b; background: #fff; }
.picker::after { content: "▾"; position: absolute; right: 11px; top: 50%; transform: translateY(-50%); font-size: 16px; color: var(--muted); pointer-events: none; }
.picker select:focus-visible { outline: 3px solid #9fd0f5; }
.filter { display: inline-flex; margin-left: auto; background: var(--chip); border-radius: 10px; padding: 3px; gap: 2px; }
.filter button { border: 0; background: none; font: 800 11.5px var(--font); padding: 5px 8px; border-radius: 8px; cursor: pointer; color: var(--muted); white-space: nowrap; }
.filter button.on { background: var(--accent); color: #fff; }
.ap-name { font-size: 12.5px; color: var(--muted); margin-top: 6px; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.chip { font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 99px; background: var(--chip); color: var(--ink); white-space: nowrap; }
.chip.VFR { background: #d9f2df; color: #1b7a3a; }
.chip.MVFR { background: #dceaff; color: #1f5fbf; }
.chip.IFR { background: #ffe0dd; color: #b42318; }
.chip.LIFR { background: #f6dcf5; color: #8e1f8a; }
.chip.atis { background: #25303b; color: #fff; }

/* Neon Miami brand */
body.neon .brand { background: linear-gradient(160deg, rgba(42, 16, 78, 0.92), rgba(92, 22, 96, 0.88) 60%, rgba(150, 40, 80, 0.85)); }
body.neon .tiny {
  font-style: italic; font-weight: 900; font-size: 34px; letter-spacing: -1px;
  background: linear-gradient(180deg, #ffe27a 0%, #ff9a3c 35%, #ff3ea5 70%, #b24bff 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 8px rgba(255, 62, 165, 0.55));
  padding-right: 4px;
}
body.neon .picker select { border-color: #2de2e6; box-shadow: 0 0 12px rgba(45, 226, 230, 0.45), inset 0 0 8px rgba(45, 226, 230, 0.2); font-style: italic; }
body.neon .picker::after { color: #2de2e6; }
body.neon .chip.atis { background: #2de2e6; color: #1e0e38; }
body.neon .brand::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 0; height: 3px; border-radius: 3px;
  background: linear-gradient(90deg, #ffe27a, #ff9a3c, #ff3ea5, #b24bff, #2de2e6);
}

/* Side panel */
.panel { position: fixed; top: 14px; right: 14px; bottom: 74px; width: 340px; z-index: 5; display: flex; flex-direction: column; overflow: hidden; transition: transform .25s ease, opacity .25s; }
.panel.hidden { transform: translateX(380px); opacity: 0; pointer-events: none; }
.reopen { position: fixed; top: 14px; right: 14px; z-index: 4; border: 0; padding: 9px 14px; font-weight: 700; cursor: pointer; display: none; }
.panel.hidden + .reopen { display: block; }
.tabs { display: flex; gap: 2px; padding: 8px 8px 0; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; background: none; padding: 8px 9px 9px; font-weight: 700; font-size: 13px; color: var(--muted); cursor: pointer; border-bottom: 2.5px solid transparent; }
.tabs button.on { color: var(--ink); border-color: var(--accent); }
.tabs .collapse { margin-left: auto; font-size: 18px; padding: 4px 8px; }
.tab { display: none; overflow-y: auto; padding: 10px 12px 16px; flex: 1; font-size: 13px; }
.tab.on { display: block; }
h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 2px 6px; display: flex; justify-content: space-between; }
.tab h3:first-child { margin-top: 4px; }
.row { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: center; padding: 7px 8px; border-radius: 10px; cursor: pointer; }
.row:hover, .row.sel { background: var(--hover); }
.dot { width: 10px; height: 10px; border-radius: 3px; box-shadow: 0 0 0 1.5px rgba(0,0,0,.08) inset; display: inline-block; }
.row b { font-weight: 800; }
.row .sub { color: var(--muted); font-size: 11.5px; display: block; margin-top: 1px; }
.row .r { text-align: right; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); padding: 6px 8px; font-size: 12.5px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.stat { background: var(--tile); border-radius: 10px; padding: 8px 6px; text-align: center; }
.stat b { display: block; font-size: 18px; }
.stat span { font-size: 10.5px; color: var(--muted); font-weight: 700; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; padding: 2px 4px; margin: 0; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; font-weight: 700; }
.raw { font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--tile); border-radius: 10px; padding: 8px 10px; white-space: pre-wrap; word-break: break-word; }
.rwys { display: flex; flex-wrap: wrap; gap: 5px; }
.rwy { font: 800 12px var(--font); padding: 3px 8px; border-radius: 6px; background: #25303b; color: #fff; }
.rwy.dep { background: var(--accent2); color: #10202a; }
.rwy.arr { background: var(--accent); }
.wind { display: inline-block; transition: transform .4s; }
.grid-types { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.type-tile { background: var(--tile); border-radius: 10px; padding: 8px; }
.type-tile b { display: block; font-size: 12.5px; }
.type-tile span { font-size: 11px; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-size: 11px; font-weight: 700; padding: 3px 7px; border-radius: 6px; background: var(--tile); display: inline-flex; gap: 5px; align-items: center; }
.btn { border: 0; background: var(--btn); color: var(--btn-ink); padding: 7px 12px; border-radius: 10px; font-weight: 700; cursor: pointer; font-size: 12.5px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: var(--ghost); color: var(--ink); }
.about p { line-height: 1.5; margin: 6px 2px; }
.credit-box { background: var(--tile); border-radius: 12px; padding: 10px 12px !important; border-left: 4px solid var(--accent); }
kbd { font: 700 11px var(--font); background: var(--field); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; }

/* Selected plane */
.plane-card { position: fixed; left: 14px; bottom: 40px; width: 330px; max-width: calc(100vw - 28px); z-index: 6; padding: 14px 14px 12px; }
.pc-top { display: flex; align-items: flex-start; gap: 10px; }
.pc-livery { width: 40px; height: 40px; border-radius: 10px; flex: none; position: relative; overflow: hidden; box-shadow: 0 0 0 1px rgba(0,0,0,.08) inset; }
.pc-livery i { position: absolute; inset: 0 0 0 55%; }
.pc-title { flex: 1; min-width: 0; }
.pc-title b { font-size: 20px; font-weight: 800; display: block; }
.pc-title span { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.pc-close { border: 0; background: var(--ghost); width: 28px; height: 28px; border-radius: 8px; cursor: pointer; font-size: 15px; flex: none; }
.pc-phase { margin: 10px 0 8px; font-weight: 800; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.pc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pc-grid div { background: var(--tile); border-radius: 10px; padding: 6px 8px; }
.pc-grid span { display: block; font-size: 10.5px; color: var(--muted); font-weight: 700; }
.pc-grid b { font-size: 13px; font-variant-numeric: tabular-nums; }
.pc-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.pc-actions a { text-decoration: none; }
.atc { margin-top: 10px; }
.atc-btn { width: 100%; }
.atc-msg, .atc-status { margin: 0; font-size: 12.5px; line-height: 1.4; }
.atc-status span { color: var(--muted); }
.atc-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 5px; max-height: 190px; overflow: auto; }
.atc-list li { background: var(--tile); border-radius: 10px; padding: 6px 8px; font-size: 12px; line-height: 1.35; }
.atc-list li.ctl { border-left: 3px solid #2de2e6; }
.atc-list li.plt { border-left: 3px solid #ff3ea5; }
.atc-list li span { display: block; font-size: 10px; font-weight: 800; color: var(--muted); margin-bottom: 1px; }
.atc-foot { margin: 6px 0 0; font-size: 10.5px; color: var(--muted); }
.atc-foot a { color: inherit; }
.linkish { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; font: inherit; cursor: pointer; }

/* Hints */
.hint { color: var(--muted); font-size: 11.5px; line-height: 1.45; margin: 6px 0; }

/* Controls */
.controls { position: fixed; right: 14px; bottom: 14px; z-index: 5; display: flex; gap: 6px; }
.controls button { border: 0; width: 42px; height: 42px; font-weight: 800; font-size: 17px; cursor: pointer; }
.controls button.on { background: #25303b; color: #fff; }
body.neon .controls button.on { background: linear-gradient(135deg, #ff3ea5, #ff8a3d); color: #fff; }
.status { position: fixed; left: 50%; transform: translateX(-50%); top: 14px; z-index: 4; padding: 6px 12px; font-size: 12px; font-weight: 700; color: var(--muted); display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.status .live { width: 8px; height: 8px; border-radius: 50%; background: #2fbf5b; box-shadow: 0 0 0 0 rgba(47,191,91,.6); animation: pulse 2s infinite; }
.status .sim { width: 8px; height: 8px; border-radius: 50%; background: #e3a12f; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(47,191,91,.55);} 70% { box-shadow: 0 0 0 8px rgba(47,191,91,0);} 100% { box-shadow: 0 0 0 0 rgba(47,191,91,0);} }

/* Credit to the original */
.credit { position: fixed; left: 14px; bottom: 12px; z-index: 5; font-size: 11.5px; font-weight: 700; text-decoration: none; color: var(--ink); background: var(--card); padding: 5px 10px; border-radius: 99px; box-shadow: var(--glow); }
.credit:hover { text-decoration: underline; }
.support-btn {
  position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 5;
  font: 800 13px var(--font); text-decoration: none; padding: 9px 16px; border-radius: 99px;
  box-shadow: 0 4px 14px rgba(0, 120, 170, 0.35); white-space: nowrap;
}
.support-btn:hover { filter: brightness(1.06); }
body.tv .support-btn { display: none; }
.btn.coffee { text-decoration: none; display: inline-block; }

/* TV mode */
body.tv .brand, body.tv .panel, body.tv .reopen, body.tv .plane-card, body.tv .status { display: none !important; }
body.tv .controls { opacity: 0; transition: opacity .3s; }
body.tv .controls:hover { opacity: 1; }
body.tv .credit { opacity: .7; }
.tv-caption { position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%); z-index: 6; background: rgba(20, 26, 34, 0.78); color: #fff; padding: 12px 20px; border-radius: 16px; text-align: center; font-weight: 700; backdrop-filter: blur(6px); }
body.neon .tv-caption { background: linear-gradient(160deg, rgba(42, 16, 78, 0.9), rgba(120, 28, 90, 0.85)); box-shadow: var(--glow); }
.tv-caption b { display: block; font-size: 24px; }
body.neon .tv-caption b { font-style: italic; }
.tv-caption span { opacity: .8; font-size: 14px; }

@media (max-width: 760px) {
  .brand { padding: 8px 11px; }
  .tiny, .picker select { font-size: 24px; }
  body.neon .tiny { font-size: 26px; }
  .panel { top: auto; left: 8px; right: 8px; bottom: 64px; width: auto; height: 42vh; }
  .panel.hidden { transform: translateY(110%); }
  .reopen { top: auto; bottom: 60px; left: 8px; right: auto; }
  .plane-card { left: 8px; right: 8px; bottom: 64px; width: auto; }
  .status { top: auto; bottom: 66px; display: none; }
  .controls { right: 8px; bottom: 10px; gap: 4px; }
  .controls button { width: 36px; height: 38px; font-size: 15px; }
  .credit { bottom: 106px; left: 8px; font-size: 10.5px; padding: 3px 9px; }
  .support-btn { left: auto; right: 8px; transform: none; bottom: 104px; padding: 6px 12px; font-size: 11.5px; }
}
