/* SkyTrack3D - UI shell. Dark "mission control" glass panels over a full-bleed Cesium globe. */
:root {
  --bg: rgba(9, 13, 21, 0.74);
  --bg-solid: #0b111b;
  --bg-hover: rgba(255, 255, 255, 0.07);
  --line: rgba(255, 255, 255, 0.09);
  --text: #e8eef7;
  --muted: #8d9bb0;
  --faint: #5d6b80;
  --accent: #4cc2ff;
  --accent-soft: rgba(76, 194, 255, 0.16);
  --good: #5be3a1;
  --warn: #ffb454;
  --bad: #ff6b6b;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono", monospace;
  --sans: Inter, "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #04070d; color: var(--text); font-family: var(--sans); font-size: 13px; overflow: hidden; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

#cesiumContainer { position: fixed; inset: 0; }
#cesiumContainer .cesium-viewer-bottom, .cesium-credit-lightbox-overlay { z-index: 1; }
.cesium-viewer-bottom { left: auto !important; right: 0; bottom: 4px; max-width: 46vw; opacity: .8; }
.cesium-widget-credits { font-size: 10px; }

.glass {
  background: var(--bg);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- boot overlay ---------- */
#boot { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 40%, #0d1626 0%, #04070d 70%); transition: opacity .6s ease; }
#boot.done { opacity: 0; pointer-events: none; }
#boot .box { text-align: center; max-width: 440px; padding: 24px; }
#boot .logo { width: 64px; height: 64px; margin: 0 auto 18px; animation: spin 14s linear infinite; }
#boot h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: .02em; font-weight: 700; }
#boot h1 b { color: var(--accent); }
#boot p { margin: 0; color: var(--muted); }
#boot .bar { margin: 20px auto 0; height: 3px; width: 220px; background: var(--line); border-radius: 3px; overflow: hidden; }
#boot .bar i { display: block; height: 100%; width: 35%; background: var(--accent); border-radius: 3px; animation: slide 1.2s ease-in-out infinite; }
#boot .madeby { margin-top: 26px; font-size: 12.5px; letter-spacing: .03em; color: var(--muted); }
#boot .madeby b { color: var(--text); font-weight: 650; }
#boot .err { margin-top: 18px; color: var(--bad); font-size: 13px; line-height: 1.5; }
@keyframes slide { 0% { transform: translateX(-120%); } 100% { transform: translateX(380%); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- top bar ---------- */
#topbar { position: fixed; top: 12px; left: 12px; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 8px 14px 8px 12px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 15px; letter-spacing: .01em; white-space: nowrap; }
.brand svg { width: 22px; height: 22px; color: var(--accent); }
.brand b { color: var(--accent); font-weight: 800; }
.pill { max-width: 330px; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 7px; padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.06); font-size: 12px; color: var(--muted); white-space: nowrap; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.pill.live { color: var(--text); } .pill.live .dot { background: var(--good); box-shadow: 0 0 0 0 rgba(91,227,161,.6); animation: pulse 2s infinite; }
.pill.demo .dot { background: var(--warn); } .pill.demo { color: var(--text); }
.pill.off .dot { background: var(--bad); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(91,227,161,.55); } 70% { box-shadow: 0 0 0 8px rgba(91,227,161,0); } 100% { box-shadow: 0 0 0 0 rgba(91,227,161,0); } }
.count { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.count b { color: var(--text); font-weight: 600; }

/* ---------- search ---------- */
#searchWrap { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 21; width: min(480px, calc(100vw - 720px)); min-width: 280px; padding: 0; }
#search { width: 100%; padding: 11px 16px 11px 40px; background: transparent; border: 0; outline: 0; font-size: 14px; }
#search::placeholder { color: var(--faint); }
#searchWrap svg { position: absolute; left: 14px; top: 11px; width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
#searchResults { max-height: 46vh; overflow: auto; border-top: 1px solid var(--line); }
#searchResults:empty { display: none; }
.sr { display: flex; justify-content: space-between; gap: 12px; padding: 9px 16px; cursor: pointer; align-items: center; }
.sr:hover, .sr.sel { background: var(--bg-hover); }
.sr .l { display: flex; flex-direction: column; min-width: 0; }
.sr .l b { font-weight: 600; } .sr .l span { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr .r { color: var(--accent); font-family: var(--mono); font-size: 11px; white-space: nowrap; }

/* ---------- left panel ---------- */
#panelLeft { position: fixed; top: 68px; left: 12px; bottom: 56px; z-index: 15; width: 300px; display: flex; flex-direction: column; overflow: hidden; transition: transform .25s ease; }
#panelLeft.collapsed { transform: translateX(calc(-100% - 20px)); }
#panelToggle { position: fixed; top: 68px; left: 12px; z-index: 14; width: 38px; height: 38px; display: none; place-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; backdrop-filter: blur(14px); }
#panelLeft.collapsed ~ #panelToggle { display: grid; }
.ph { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px 8px; }
.ph h2 { margin: 0; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.iconbtn { width: 28px; height: 28px; display: inline-grid; place-items: center; border-radius: 8px; background: transparent; border: 0; color: var(--muted); }
.iconbtn:hover { background: var(--bg-hover); color: var(--text); }
.iconbtn svg { width: 16px; height: 16px; }
#panelBody { overflow: auto; padding: 0 6px 10px; scrollbar-width: thin; scrollbar-color: #2b3a52 transparent; }
.sec { border-top: 1px solid var(--line); }
.sec:first-child { border-top: 0; }
.sec > summary { list-style: none; cursor: pointer; padding: 11px 10px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; border-radius: 8px; user-select: none; }
.sec > summary::-webkit-details-marker { display: none; }
.sec > summary::after { content: "\203A"; color: var(--faint); transition: transform .15s; font-size: 16px; }
.sec[open] > summary::after { transform: rotate(90deg); }
.sec > summary:hover { background: var(--bg-hover); }
.sec .inner { padding: 2px 10px 12px; display: flex; flex-direction: column; gap: 11px; }
.row { display: flex; flex-direction: column; gap: 5px; }
.row.inline { flex-direction: row; align-items: center; justify-content: space-between; }
.row label { color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; }
.row label output { color: var(--text); font-family: var(--mono); font-size: 11px; }
select, input[type=text] { width: 100%; background: rgba(255,255,255,.06); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 7px 9px; outline: 0; }
select:focus, input[type=text]:focus { border-color: var(--accent); }
select option { background: #101826; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.switch { position: relative; width: 36px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; background: #2a3750; border-radius: 20px; transition: .15s; cursor: pointer; }
.switch i::before { content: ""; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; border-radius: 50%; background: #cfd9e8; transition: .15s; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::before { transform: translateX(16px); background: #04121c; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.04); color: var(--muted); font-size: 12px; cursor: pointer; user-select: none; }
.chip.on { background: var(--accent-soft); border-color: rgba(76,194,255,.5); color: var(--text); }
.btn { padding: 7px 12px; border-radius: var(--radius-sm); background: rgba(255,255,255,.07); border: 1px solid var(--line); color: var(--text); }
.btn:hover { background: rgba(255,255,255,.12); }
.btn.primary { background: var(--accent); color: #04121c; border-color: transparent; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.on { background: var(--accent-soft); border-color: rgba(76,194,255,.55); }
.btns { display: flex; gap: 7px; flex-wrap: wrap; }
.hint { color: var(--faint); font-size: 11.5px; line-height: 1.45; }

/* ---------- right flight card ---------- */
#panelRight { position: fixed; top: 68px; right: 12px; z-index: 16; width: 332px; max-height: calc(100vh - 140px); overflow: auto; scrollbar-width: thin; scrollbar-color: #2b3a52 transparent; padding: 0; animation: slidein .22s ease; }
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.fc-head { padding: 14px 14px 10px; display: flex; justify-content: space-between; gap: 10px; }
.fc-cs { font-size: 22px; font-weight: 800; letter-spacing: .02em; }
.fc-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.badge { display: inline-block; padding: 2px 7px; border-radius: 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; background: rgba(255,255,255,.1); color: var(--text); margin-right: 5px; }
.badge.warn { background: rgba(255,180,84,.2); color: var(--warn); } .badge.bad { background: rgba(255,107,107,.2); color: var(--bad); } .badge.good { background: rgba(91,227,161,.18); color: var(--good); }
.fc-route { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; padding: 6px 14px 12px; }
.fc-route .ap { font-size: 20px; font-weight: 700; } .fc-route .ap small { display: block; font-weight: 400; font-size: 11px; color: var(--muted); max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-route .ap.r { text-align: right; } .fc-route .ap.r small { margin-left: auto; }
.fc-route .arc { color: var(--accent); text-align: center; font-size: 15px; }
.fc-prog { margin: 0 14px 12px; height: 4px; background: rgba(255,255,255,.1); border-radius: 4px; overflow: hidden; } .fc-prog i { display: block; height: 100%; background: var(--accent); }
.fc-photo { margin: 0 14px 12px; border-radius: 10px; overflow: hidden; position: relative; background: #111a28; } .fc-photo img { display: block; width: 100%; height: auto; } .fc-photo span { position: absolute; right: 6px; bottom: 5px; font-size: 10px; background: rgba(0,0,0,.55); padding: 1px 6px; border-radius: 6px; }
.fc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.fc-grid > div { background: rgba(10, 15, 24, .9); padding: 10px 14px; }
.fc-grid small { display: block; color: var(--muted); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 3px; }
.fc-grid b { font-family: var(--mono); font-size: 16px; font-weight: 600; } .fc-grid b em { font-style: normal; color: var(--muted); font-size: 11px; margin-left: 3px; font-weight: 400; }
.fc-spark { padding: 10px 14px 4px; } .fc-spark small { color: var(--muted); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; } .fc-spark canvas { width: 100%; height: 54px; display: block; margin-top: 4px; }
.fc-specs { padding: 8px 14px 4px; display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 12px; } .fc-specs span { color: var(--muted); } .fc-specs b { font-weight: 500; text-align: right; }
.fc-actions { padding: 12px 14px 14px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.fc-actions .btn { padding: 8px 4px; font-size: 12px; text-align: center; }

/* ---------- HUD ---------- */
#hud { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 12; display: flex; justify-content: space-between; align-items: center; gap: 12px; pointer-events: none; }
#hud > * { pointer-events: auto; }
.hudbox { display: flex; align-items: center; gap: 10px; padding: 7px 12px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.hudbox b { color: var(--text); font-weight: 600; }
.hudbox .sep { width: 1px; height: 16px; background: var(--line); }
.seg { display: inline-flex; background: rgba(255,255,255,.06); border-radius: 9px; padding: 2px; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 4px 9px; border-radius: 7px; font-family: var(--mono); font-size: 11.5px; }
.seg button.on { background: var(--accent); color: #04121c; font-weight: 700; }
.seg button:hover:not(.on) { color: var(--text); }
#legend { display: flex; align-items: center; gap: 9px; font-family: var(--sans); font-size: 11px; }
#legend .ramp { width: 160px; height: 8px; border-radius: 6px; }
#legend span { color: var(--muted); }

#tooltip { position: fixed; z-index: 30; pointer-events: none; padding: 7px 10px; border-radius: 10px; background: rgba(8, 12, 20, .92); border: 1px solid var(--line); font-size: 12px; line-height: 1.45; box-shadow: var(--shadow); transform: translate(14px, 14px); white-space: nowrap; }
#tooltip b { font-size: 13px; } #tooltip span { color: var(--muted); }
#toast { position: fixed; left: 50%; bottom: 66px; transform: translateX(-50%); z-index: 40; padding: 9px 16px; background: rgba(8,12,20,.95); border: 1px solid var(--line); border-radius: 999px; font-size: 12.5px; opacity: 0; pointer-events: none; transition: opacity .25s; }
#toast.show { opacity: 1; }

#camHint { position: fixed; top: 68px; left: 50%; transform: translateX(-50%); z-index: 14; padding: 6px 14px; border-radius: 999px; font-size: 12px; color: var(--muted); }
#camHint kbd, .kbd { font-family: var(--mono); font-size: 10.5px; padding: 1px 5px; border-radius: 5px; background: rgba(255,255,255,.1); color: var(--text); }

@media (max-width: 1100px) { #searchWrap { width: min(420px, calc(100vw - 540px)); } }
@media (max-width: 860px) {
  #topbar .count { display: none; }
  #searchWrap { top: 64px; left: 12px; right: 12px; width: auto; transform: none; }
  #panelLeft { top: 120px; width: min(300px, calc(100vw - 24px)); } #panelToggle { top: 120px; }
  #panelRight { top: auto; bottom: 64px; width: calc(100vw - 24px); max-height: 46vh; }
  #hud { flex-wrap: wrap; } #legend { display: none; }
}

/* The Cesium ion logo is only shown when Cesium ion services are actually in use (an Ion token is set).
   The "Data attribution" link stays visible always: the imagery / terrain providers require their credits. */
body:not(.ion-in-use) .cesium-credit-logoContainer { display: none !important; }

/* the maker credit stays visible (also in zen mode): top-right corner, clear of the search box and the flight card */
#madeBy { position: fixed; top: 12px; right: 12px; z-index: 22; padding: 7px 13px; border-radius: 999px; font-size: 11.5px; letter-spacing: .03em; color: var(--muted); pointer-events: none; user-select: none; }
#madeBy b { color: var(--text); font-weight: 650; }
@media (max-width: 520px) { #madeBy { padding: 5px 10px; font-size: 10.5px; } }

/* ---- monetisation + legal (js/monetize.js) - all hidden until site-config.js enables them ---- */
.mon-block { border-top: 1px solid var(--line); margin-top: 6px; padding: 12px 10px 4px; display: flex; flex-direction: column; gap: 10px; }
.mon-support { display: inline-flex; align-items: center; justify-content: center; gap: 7px; text-decoration: none; text-align: center; }
.mon-support span { color: #ff7a8a; }
.mon-legal { color: var(--faint); font-size: 11px; text-align: center; }
.mon-legal a, .hint.credits a { color: var(--accent); text-decoration: none; }
.mon-legal a:hover, .hint.credits a:hover { text-decoration: underline; }
.mon-ad { display: flex; flex-direction: column; gap: 4px; min-height: 60px; }
.mon-ad small { color: var(--faint); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
#boot .madeby-links { margin-top: 8px; font-size: 11.5px; color: var(--muted); }
#boot .madeby-links a { color: var(--accent); text-decoration: none; }

/* =====================================================================================================================
   Touch screens, phones, tablets, installed app (js/device.js adds html.is-touch / .is-phone / .is-tablet / .is-standalone)
   ===================================================================================================================== */
:root { --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px); --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px); }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
#cesiumContainer, #cesiumContainer canvas { touch-action: none; }
button, .chip, .sec > summary, .sr, .tr-row, select, label { touch-action: manipulation; }

/* notch / home-bar safe areas (matters when installed or full-screen) */
#topbar { top: calc(12px + var(--safe-t)); left: calc(12px + var(--safe-l)); }
#madeBy { top: calc(12px + var(--safe-t)); right: calc(12px + var(--safe-r)); }
#searchWrap { top: calc(12px + var(--safe-t)); }
#hud { left: calc(12px + var(--safe-l)); right: calc(12px + var(--safe-r)); bottom: calc(12px + var(--safe-b)); }
#panelLeft { top: calc(68px + var(--safe-t)); left: calc(12px + var(--safe-l)); bottom: calc(56px + var(--safe-b)); }
#panelToggle { top: calc(68px + var(--safe-t)); left: calc(12px + var(--safe-l)); }
#panelRight { top: calc(68px + var(--safe-t)); right: calc(12px + var(--safe-r)); }
#toast { bottom: calc(66px + var(--safe-b)); max-width: calc(100vw - 24px); text-align: center; }
#zenExit { position: fixed; top: calc(12px + var(--safe-t)); left: calc(12px + var(--safe-l)); z-index: 30; padding: 10px 16px; border-radius: 999px; color: var(--text); }
#madeBy .mb-pre { display: inline; }

/* bigger targets for fingers */
@media (pointer: coarse) {
  .iconbtn { width: 40px; height: 40px; border-radius: 12px; }
  .iconbtn svg { width: 20px; height: 20px; }
  #panelToggle { width: 46px; height: 46px; }
  .switch { width: 46px; height: 26px; }
  .switch i { border-radius: 26px; }
  .switch i::before { width: 20px; height: 20px; left: 3px; top: 3px; }
  .switch input:checked + i::before { transform: translateX(20px); }
  .seg button { padding: 9px 12px; font-size: 12.5px; }
  .chip { padding: 8px 13px; font-size: 13px; }
  .btn { padding: 11px 14px; }
  select, input[type=text] { padding: 11px 12px; font-size: 16px; }          /* 16 px stops iOS zooming into a focused field */
  #search { font-size: 16px; padding-top: 13px; padding-bottom: 13px; }
  #searchWrap svg { top: 14px; }
  input[type=range] { height: 32px; }
  .sec > summary { padding: 14px 10px; }
  .sr { padding: 12px 16px; }
  .tr-row { padding: 9px 6px; }
  .cam-btn { min-height: 44px; }
}

/* phones (portrait or landscape) */
html.is-phone #madeBy .mb-pre { display: none; }
@media (max-width: 600px) {
  #topbar { gap: 8px; padding: 6px 10px; }
  .pill { max-width: 34vw; }
  #madeBy { padding: 5px 9px; font-size: 10.5px; }
  #madeBy .mb-pre { display: none; }
  #searchWrap { top: calc(60px + var(--safe-t)); left: calc(12px + var(--safe-l)); right: calc(12px + var(--safe-r)); }
  #panelLeft { top: calc(116px + var(--safe-t)); width: calc(100vw - 24px - var(--safe-l) - var(--safe-r)); bottom: calc(60px + var(--safe-b)); }
  #panelToggle { top: calc(116px + var(--safe-t)); }
  #hud { gap: 6px; }
  .hudbox { padding: 5px 8px; gap: 6px; font-size: 11px; }
  #timebox > span:first-child { display: none; }
  #camInfo { display: none; }
  #viewbox .sep { display: none; }
  .seg button { padding: 7px 8px; }
  #camHint { display: none; }
  /* while a flight / airport card is open it is a bottom sheet and the time / view bar steps aside */
  #panelRight:not(.hidden) ~ #hud { display: none; }
  #panelRight.fd { bottom: calc(10px + var(--safe-b)); }
}
@media (max-height: 460px) and (orientation: landscape) {
  #panelRight.fd { top: calc(64px + var(--safe-t)); bottom: calc(56px + var(--safe-b)); left: auto; right: calc(8px + var(--safe-r)); width: min(380px, 48vw); max-height: none; }
  .fd-hero { height: 96px; }
  #panelLeft { top: calc(64px + var(--safe-t)); width: min(320px, 46vw); }
  #searchWrap { top: calc(12px + var(--safe-t)); left: 50%; right: auto; transform: translateX(-50%); width: min(380px, 40vw); }
}
