/* Tarmac interface.
   Direction: an airline lounge at dusk. Smoked glass panels over the scene, ivory type, one brass
   accent, hairline rules. A serif display face for names, a technical sans for everything read
   at a glance, mono for raw reports. Colour carries meaning only for flight phase and weather. */

@font-face { font-family: "Playfair Display"; font-weight: 400 700; font-display: swap; src: url("../fonts/PlayfairDisplay-400-700.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400 600; font-display: swap; src: url("../fonts/IBMPlexSans-400.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url("../fonts/IBMPlexMono-400.woff2") format("woff2"); }

:root {
  --ink: #090d13;                          /* page behind the scene */
  --glass: rgba(13, 18, 26, 0.76);         /* panels */
  --glass-solid: rgba(15, 21, 30, 0.94);   /* dialogs, menus */
  --line: rgba(240, 228, 204, 0.13);       /* hairlines, warm */
  --line-strong: rgba(240, 228, 204, 0.26);
  --text: #f3eee4;                         /* ivory */
  --soft: #bdb7ab;                         /* secondary text */
  --brass: #d9b97c;                        /* the one accent */
  --brass-ink: #1c1608;
  --arr: #92d2b6;                          /* arriving */
  --dep: #a3bfec;                          /* departing */
  --bad: #ea8674;
  --display: "Playfair Display", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --ui: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r: 14px;
  --gap: 14px;
  font-family: var(--ui);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--ink); color: var(--text); font-size: 14px; line-height: 1.4; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
:focus-visible { outline: 1.5px solid var(--brass); outline-offset: 2px; }

#stage { position: fixed; inset: 0; }
#gl { width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

.panel {
  position: fixed; z-index: 5; background: var(--glass); border: 1px solid var(--line); border-radius: var(--r);
  backdrop-filter: blur(18px) saturate(1.15); -webkit-backdrop-filter: blur(18px) saturate(1.15);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* ---------------------------------------------------------------- top bar: a scrim, not a box */
#topbar.panel {
  top: 0; left: 0; right: 0; height: 64px; display: flex; align-items: center; gap: 18px; padding: 0 22px 8px;
  background: linear-gradient(rgba(6, 9, 14, 0.82), rgba(6, 9, 14, 0.5) 62%, rgba(6, 9, 14, 0));
  border: 0; border-radius: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 12.5px; letter-spacing: 0.34em; text-transform: uppercase; }
.mark { width: 18px; height: 18px; background: var(--brass);
  clip-path: polygon(50% 0, 58% 34%, 100% 58%, 100% 70%, 58% 58%, 55% 82%, 68% 92%, 68% 100%, 50% 95%, 32% 100%, 32% 92%, 45% 82%, 42% 58%, 0 70%, 0 58%, 42% 34%); }
.mark.big { width: 40px; height: 40px; margin: 0 auto 18px; }
#airport-form { display: flex; align-items: center; gap: 8px; padding-left: 18px; border-left: 1px solid var(--line); }
#airport-select, #airport-input {
  height: 32px; padding: 0 10px; background: rgba(255, 255, 255, 0.045); border: 1px solid var(--line); border-radius: 8px;
  font-weight: 500; letter-spacing: 0.03em; transition: border-color 0.15s, background 0.15s;
}
#airport-select { max-width: 240px; padding-right: 4px; }
#airport-select:hover, #airport-input:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.07); }
#airport-select option, #airport-select optgroup { color: #15120c; background: #f6f1e7; font-weight: 400; letter-spacing: 0; }
#airport-select optgroup { font-weight: 600; }
#airport-input { width: 84px; text-transform: uppercase; letter-spacing: 0.1em; }
#airport-form button { height: 32px; padding: 0 12px; background: none; border: 1px solid var(--line); border-radius: 8px; letter-spacing: 0.04em; transition: border-color 0.15s, color 0.15s; }
#airport-form button:hover { border-color: var(--brass); color: var(--brass); }
#airport-name { font-family: var(--display); font-size: 19px; font-weight: 500; letter-spacing: 0.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; text-shadow: 0 1px 12px rgba(0, 0, 0, 0.5); }
.chip { display: inline-block; margin-left: 12px; padding: 2px 9px 1px; border: 1px solid rgba(146, 210, 182, 0.55); border-radius: 20px;
  color: var(--arr); font-family: var(--ui); font-size: 10.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; vertical-align: 3px; }
.spacer { flex: 1; }
#home-link { white-space: nowrap; color: var(--soft); text-decoration: none; font-size: 13px; letter-spacing: 0.03em; padding-bottom: 1px; border-bottom: 1px solid transparent; transition: color 0.15s, border-color 0.15s; }
#home-link:hover { color: var(--text); border-bottom-color: var(--brass); }
#clock { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--soft); letter-spacing: 0.04em; font-size: 13px; }
.feed { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 13px 0 11px; background: rgba(255, 255, 255, 0.045); border: 1px solid var(--line); border-radius: 20px; white-space: nowrap; font-size: 12.5px; letter-spacing: 0.02em; transition: border-color 0.15s; }
.feed:hover { border-color: var(--line-strong); }
.feed .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brass); }
.feed[data-state="ok"] .dot { background: var(--arr); box-shadow: 0 0 0 3px rgba(146, 210, 182, 0.16); }
.feed[data-state="bad"] .dot { background: var(--bad); box-shadow: 0 0 0 3px rgba(234, 134, 116, 0.16); }

/* ---------------------------------------------------------------- traffic list */
#traffic { top: 74px; left: var(--gap); width: 364px; max-height: calc(100vh - 74px - 78px); display: flex; flex-direction: column; overflow: hidden; }
.tabs { display: flex; justify-content: space-between; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); flex: none; }
.tabs button { white-space: nowrap; padding: 13px 0 11px; background: none; border: 0; border-bottom: 1.5px solid transparent; margin-bottom: -1px; color: var(--soft);
  font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; transition: color 0.15s; }
.tabs button.on { color: var(--text); border-bottom-color: var(--brass); }
.tabs button:hover { color: var(--text); }
.tabs i { font-style: normal; font-variant-numeric: tabular-nums; margin-left: 5px; font-weight: 400; letter-spacing: 0.02em; color: var(--soft); }
.tabs button.on i { color: var(--brass); }
#list { overflow-y: auto; overscroll-behavior: contain; min-height: 60px; padding: 4px 0; scrollbar-width: thin; scrollbar-color: rgba(240, 228, 204, 0.22) transparent; }
.row { display: grid; grid-template-columns: 10px 82px 44px 1fr auto; gap: 8px; align-items: baseline; padding: 8px 16px 8px 14px; cursor: pointer; font-variant-numeric: tabular-nums; position: relative; transition: background 0.12s; }
.row::before { content: ""; width: 6px; height: 6px; border-radius: 50%; align-self: center; background: rgba(240, 228, 204, 0.3); }
.row[data-phase="arrival"]::before { background: var(--arr); }
.row[data-phase="departure"]::before { background: var(--dep); }
.row + .row::after { content: ""; position: absolute; left: 32px; right: 16px; top: 0; border-top: 1px solid rgba(240, 228, 204, 0.06); }
.row:hover { background: rgba(255, 255, 255, 0.045); }
.row.sel { background: rgba(217, 185, 124, 0.12); box-shadow: inset 2px 0 0 var(--brass); }
.row b { font-weight: 600; letter-spacing: 0.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .t, .row .w { color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .s { white-space: nowrap; text-align: right; color: var(--text); }
.empty { margin: 0; padding: 18px 16px; color: var(--soft); }

/* ---------------------------------------------------------------- right column */
#right { position: fixed; z-index: 5; top: 74px; right: var(--gap); width: 322px; max-height: calc(100vh - 74px - 78px); display: flex; flex-direction: column; gap: var(--gap); overflow-y: auto; pointer-events: none; scrollbar-width: none; }
#right > .panel { position: static; pointer-events: auto; padding: 16px 18px; flex: none; }
dl { margin: 0; }
.wx-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.wx-head b { font-weight: 600; letter-spacing: 0.1em; }
.wx-head span:last-child { margin-left: auto; color: var(--soft); font-size: 12.5px; }
.cat { padding: 2px 9px 1px; border-radius: 20px; font-weight: 600; font-size: 10.5px; letter-spacing: 0.14em; border: 1px solid var(--line-strong); color: var(--soft); background: none; }
.cat.VFR { color: #92d2b6; border-color: rgba(146, 210, 182, 0.55); }
.cat.MVFR { color: #a3bfec; border-color: rgba(163, 191, 236, 0.55); }
.cat.IFR { color: #ea8674; border-color: rgba(234, 134, 116, 0.6); }
.cat.LIFR { color: #d6a2ea; border-color: rgba(214, 162, 234, 0.6); }
.wx-grid, .d-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; }
.wx-grid dt, .d-grid dt { color: var(--soft); font-size: 13px; }
.wx-grid dd, .d-grid dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.wind { width: 13px; height: 13px; fill: var(--brass); vertical-align: -2px; margin-right: 6px; }
.raw { display: block; margin-top: 13px; padding-top: 11px; border-top: 1px solid var(--line); font: 11.5px/1.55 var(--mono); color: var(--soft); white-space: normal; word-break: break-word; }

.d-head { display: flex; align-items: flex-start; gap: 10px; }
.d-head h2 { margin: 0; font-family: var(--display); font-weight: 500; font-size: 27px; line-height: 1.1; letter-spacing: 0.01em; }
.d-head p { margin: 5px 0 0; color: var(--soft); font-size: 13px; }
.d-head > div { flex: 1; min-width: 0; }
button.x { width: 26px; height: 26px; flex: none; border: 1px solid var(--line); border-radius: 50%; background: none; font-size: 15px; line-height: 1; color: var(--soft); transition: color 0.15s, border-color 0.15s; }
button.x:hover { color: var(--text); border-color: var(--line-strong); }
.phase { display: inline-block; margin: 12px 0 2px; padding: 2px 10px 1px; border-radius: 20px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; border: 1px solid var(--line-strong); color: var(--soft); }
.phase[data-phase="arrival"] { border-color: rgba(146, 210, 182, 0.55); color: var(--arr); }
.phase[data-phase="departure"] { border-color: rgba(163, 191, 236, 0.55); color: var(--dep); }
.route { margin: 10px 0 2px; }
.route b { display: block; font-size: 17px; font-weight: 500; letter-spacing: 0.08em; }
.route span { color: var(--soft); font-size: 13px; }
.d-grid { margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--line); }
.actions { display: flex; gap: 8px; margin-top: 15px; }
.actions button { flex: 1; padding: 8px 4px 7px; border: 1px solid var(--line); border-radius: 8px; background: none; white-space: nowrap; font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--soft); transition: color 0.15s, border-color 0.15s, background 0.15s; }
.actions button:hover { color: var(--text); border-color: var(--line-strong); }
.actions button.on { background: var(--brass); border-color: var(--brass); color: var(--brass-ink); }

/* ---------------------------------------------------------------- ATC audio */
.a-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.a-head b { flex: 1; font-size: 11px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; }
#atc-state { font-size: 12px; color: var(--soft); }
#atc-state[data-state="live"] { color: var(--arr); }
#atc-state[data-state="error"] { color: var(--bad); }
.streams { list-style: none; margin: 0 -6px 10px; padding: 0; display: grid; gap: 1px; max-height: 34vh; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(240, 228, 204, 0.22) transparent; }
.streams li { display: flex; align-items: center; gap: 10px; padding: 5px 6px; border-radius: 8px; }
.streams li.on { background: rgba(217, 185, 124, 0.12); }
.streams li.on span { color: var(--brass); }
.streams li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.streams button[data-act="play"] { width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 50%; background: none; font-size: 10px; transition: border-color 0.15s, color 0.15s; }
.streams button[data-act="play"]:hover { border-color: var(--brass); color: var(--brass); }
.hint { margin: 0 0 10px; color: var(--soft); }
.vol, .chk { display: flex; align-items: center; gap: 10px; margin: 8px 0; color: var(--soft); font-size: 13px; }
.vol input { flex: 1; accent-color: var(--brass); }
.chk input { accent-color: var(--brass); }
.add { display: grid; grid-template-columns: 1fr auto; gap: 6px; margin: 10px 0; }
.add input { height: 32px; padding: 0 10px; min-width: 0; background: rgba(255, 255, 255, 0.045); border: 1px solid var(--line); border-radius: 8px; }
.add input::placeholder { color: rgba(189, 183, 171, 0.7); }
.add #atc-url { grid-column: 1; }
.add #atc-label { grid-column: 1 / -1; }
.add button { padding: 0 14px; border: 1px solid var(--line); border-radius: 8px; background: none; }
.add button:hover { border-color: var(--brass); color: var(--brass); }
.ext { color: var(--brass); text-decoration: none; font-size: 13px; }
.ext:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------------------------------------------------------------- bottom dock */
#controls { left: var(--gap); right: var(--gap); width: fit-content; margin-inline: auto; bottom: 18px; display: flex; align-items: stretch; gap: 0; padding: 0 6px; border-radius: 16px; max-width: calc(100vw - 2 * var(--gap)); flex-wrap: nowrap; justify-content: center; }
#controls > * { padding: 6px 12px; }
#controls > * + * { border-left: 1px solid var(--line); }
.seg { display: flex; gap: 2px; }
.seg button, .toggles button {
  padding: 9px 7px 8px; border: 0; background: none; color: var(--soft); border-radius: 8px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; white-space: nowrap; transition: color 0.15s, background 0.15s;
}
.seg button:hover:not(:disabled), .toggles button:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.seg button.on { color: var(--text); box-shadow: inset 0 -1.5px 0 var(--brass); border-radius: 8px 8px 2px 2px; }
.seg button:disabled { color: rgba(189, 183, 171, 0.38); cursor: default; }
.toggles { display: flex; gap: 2px; justify-content: center; }
.toggles button { display: flex; align-items: center; gap: 7px; }
.toggles button::before { content: ""; width: 5px; height: 5px; border-radius: 50%; border: 1px solid rgba(189, 183, 171, 0.6); transition: background 0.15s, border-color 0.15s; }
.toggles button.on { color: var(--text); }
.toggles button.on::before { background: var(--brass); border-color: var(--brass); }

#tiles-status { position: fixed; z-index: 4; left: 50%; transform: translateX(-50%); bottom: 76px; color: var(--soft); font-size: 12px; letter-spacing: 0.04em; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9); pointer-events: none; white-space: nowrap; }

/* ---------------------------------------------------------------- aircraft labels */
.ac-label { pointer-events: auto; cursor: pointer; padding: 3px 8px 3px 7px; border-radius: 6px; background: rgba(10, 14, 20, 0.7); border: 1px solid rgba(240, 228, 204, 0.14);
  box-shadow: inset 2px 0 0 rgba(189, 183, 171, 0.7); font-size: 10.5px; line-height: 1.25; white-space: nowrap; font-variant-numeric: tabular-nums; user-select: none; text-align: left; }
.ac-label b { display: block; font-weight: 600; letter-spacing: 0.06em; }
.ac-label span { color: var(--soft); letter-spacing: 0.02em; }
.ac-label[data-phase="arrival"] { box-shadow: inset 2px 0 0 var(--arr); }
.ac-label[data-phase="departure"] { box-shadow: inset 2px 0 0 var(--dep); }
.ac-label:hover { background: rgba(22, 29, 40, 0.95); border-color: var(--line-strong); z-index: 2 !important; }
.ac-label.sel { background: rgba(15, 21, 30, 0.95); border-color: var(--brass); box-shadow: inset 2px 0 0 var(--brass), 0 0 0 3px rgba(217, 185, 124, 0.18); }
.ac-label.sel b { color: var(--brass); }

/* ---------------------------------------------------------------- loading and dialog */
#loading { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: radial-gradient(120% 90% at 50% 40%, #121a26, var(--ink) 70%); transition: opacity 0.7s; }
#loading.done { opacity: 0; pointer-events: none; }
#loading .box { text-align: center; max-width: 440px; padding: 0 24px; }
#loading .box::after { content: ""; display: block; width: 120px; height: 1px; margin: 20px auto 0; background: linear-gradient(90deg, transparent, var(--brass), transparent); background-size: 200% 100%; animation: sweep 1.8s linear infinite; }
#loading p { margin: 0; font-family: var(--display); font-size: 19px; font-weight: 400; letter-spacing: 0.01em; color: var(--text); }
#loading.error { z-index: 4; background: rgba(9, 13, 19, 0.94); }
#loading.error .box::after { display: none; }
#loading.error p { font-family: var(--ui); font-size: 15px; line-height: 1.55; }
@keyframes sweep { from { background-position: 100% 0; } to { background-position: -100% 0; } }

dialog { max-width: 640px; width: calc(100vw - 32px); padding: 28px 30px 24px; background: var(--glass-solid); color: var(--text); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); }
dialog::backdrop { background: rgba(4, 6, 10, 0.62); backdrop-filter: blur(3px); }
dialog h2 { margin: 0 0 10px; font-family: var(--display); font-weight: 500; font-size: 25px; }
dialog p { color: var(--soft); }
dialog ul { padding-left: 18px; display: grid; gap: 9px; line-height: 1.5; }
dialog li::marker { color: var(--brass); }
dialog b { font-weight: 600; }
dialog a { color: var(--brass); text-underline-offset: 3px; }
dialog form { text-align: right; margin-top: 18px; }
dialog button { padding: 8px 20px 7px; border: 1px solid var(--line-strong); border-radius: 8px; background: none; font-size: 11px; font-weight: 600; letter-spacing: 0.15em; text-transform: uppercase; }
dialog button:hover { border-color: var(--brass); color: var(--brass); }

/* ---------------------------------------------------------------- small screens */
@media (max-width: 1240px) {
  #controls { flex-wrap: wrap; row-gap: 0; }
  #tiles-status { bottom: 122px; }
  #controls > * { padding: 4px 8px; }
  #controls > * + * { border-left: 0; }
  #airport-name { display: none; }
  .toggles { flex-wrap: wrap; }
  .seg button, .toggles button { letter-spacing: 0.09em; padding: 8px 6px 7px; }
}
@media (max-width: 900px) {
  #airport-name, #clock, #home-link { display: none; }
  #topbar.panel { padding: 0 14px 8px; gap: 12px; }
  #airport-form { padding-left: 12px; }
  #traffic { width: 258px; max-height: 34vh; }
  .tabs { gap: 12px; padding: 0 12px; }
  .row { grid-template-columns: 10px 76px 1fr auto; padding: 7px 12px; }
  .row .t { display: none; }
  #right { width: 258px; max-height: calc(100vh - 74px - 170px); }
  .raw { display: none; }
  #tiles-status { display: none; }
}
@media (max-width: 560px) {
  #traffic { width: calc(100vw - 2 * var(--gap)); max-height: 26vh; }
  #right { top: auto; bottom: 170px; width: calc(100vw - 2 * var(--gap)); max-height: 30vh; }
  #weather { display: none; }
  .brand span:last-child { display: none; }
  #airport-form { border-left: 0; padding-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  #loading .box::after { animation: none; }
}
