:root {
  --bg: #070b12;
  --panel: rgba(13, 19, 28, 0.88);
  --panel-solid: #0d131c;
  --border: #1c2735;
  --text: #e8f0f8;
  --mut: #7d8aaa;
  --accent: #2f9be6;
  --accent2: #1f6feb;
  --hot: #ff4d4f;
  --warm: #ffb020;
  --ok: #4fd38a;
  --heli: #c98bff;
  --shadow: 0 8px 30px rgba(0,0,0,.5);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; overflow: hidden; }
#cesiumContainer { position: fixed; inset: 0; }
.hidden { display: none !important; }
.mut { color: var(--mut); font-size: 11px; }
.cesium-widget-credits, .cesium-viewer-bottom { display: none !important; }
a { color: var(--accent); }

#topbar { position: fixed; top: 0; left: 0; right: 0; height: 52px; z-index: 20;
  display: flex; align-items: center; gap: 18px; padding: 0 18px;
  background: linear-gradient(180deg, rgba(7,11,18,.96), rgba(7,11,18,.6) 70%, transparent); pointer-events: none; }
#topbar > * { pointer-events: auto; }
.brand { font-weight: 700; font-size: 15px; }
.brand span { color: var(--accent); }
.tabs { display: flex; gap: 4px; background: rgba(20,28,40,.7); padding: 4px; border-radius: 10px; border: 1px solid var(--border); }
.tab { border: 0; background: transparent; color: var(--mut); font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 7px; cursor: pointer; transition: .15s; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--accent2); color: #fff; }
.status { margin-left: auto; font-size: 11px; color: var(--mut); text-align: right; line-height: 1.4; font-variant-numeric: tabular-nums; }
.status b { color: var(--ok); }
.status .stale { color: var(--warm); }

#help-chip { position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 16;
  background: var(--panel); border: 1px solid var(--border); border-radius: 20px; padding: 7px 16px;
  font-size: 11px; color: var(--mut); backdrop-filter: blur(10px); box-shadow: var(--shadow); }
#help-chip b { color: var(--text); }

.panel { position: fixed; top: 64px; left: 14px; width: 326px; max-height: calc(100vh - 90px);
  overflow-y: auto; z-index: 15; background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; padding: 16px; backdrop-filter: blur(14px); box-shadow: var(--shadow); }
.panel h2 { margin: 0 0 8px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.count { margin-left: auto; font-size: 12px; color: var(--accent); background: rgba(47,155,230,.12); padding: 2px 9px; border-radius: 20px; font-variant-numeric: tabular-nums; }
.hint { color: var(--mut); font-size: 12px; line-height: 1.5; margin: 0 0 14px; }
.hint b { color: #aebfd2; }
.row { display: flex; align-items: center; gap: 10px; margin: 11px 0; font-size: 13px; }
.row label:first-child { color: var(--mut); min-width: 96px; }

.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg.full { display: flex; width: 100%; margin-bottom: 10px; }
.seg.full button { flex: 1; }
.seg button { border: 0; background: transparent; color: var(--mut); padding: 8px 12px; font-size: 12px; cursor: pointer; font-weight: 600; }
.seg button.active { background: var(--accent2); color: #fff; }

/* iOS-style switch */
.sw { position: relative; display: inline-block; width: 38px; height: 22px; margin-left: auto; }
.sw input { opacity: 0; width: 0; height: 0; }
.sw span { position: absolute; inset: 0; background: #283447; border-radius: 22px; transition: .2s; cursor: pointer; }
.sw span:before { content: ""; position: absolute; height: 16px; width: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.sw input:checked + span { background: var(--accent2); }
.sw input:checked + span:before { transform: translateX(16px); }

.legend { margin: 14px 0 8px; }
.legend > span { font-size: 11px; color: var(--mut); text-transform: uppercase; letter-spacing: .5px; }
.grad { height: 10px; border-radius: 5px; margin: 6px 0 3px; background: linear-gradient(90deg,#ff3b3b,#ff9f1c,#ffe066,#7bed6b,#4fd3ff,#3b6bff); }
.grad-labels { display: flex; justify-content: space-between; font-size: 10px; color: var(--mut); }
.kinds { display: flex; gap: 16px; font-size: 11px; color: var(--mut); margin-top: 6px; }
.kinds span { display: flex; align-items: center; gap: 5px; }
.ki { width: 14px; height: 14px; fill: none; stroke: var(--accent); stroke-width: 1.6; }
.kinds span:last-child .ki { stroke: var(--heli); fill: none; }

/* visibility box */
.vis-box { margin: 4px 0 14px; }
.vis-readout { display: flex; align-items: baseline; gap: 8px; padding: 4px 2px; }
.vr-num { font-size: 22px; font-weight: 800; color: var(--accent); }
.vr-sub { font-size: 11px; color: var(--mut); }

/* live list — three bands */
.live-list { margin: 6px 0 4px; }
.ll-band { margin-bottom: 12px; }
.ll-head { display: flex; align-items: center; gap: 7px; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--mut); margin: 6px 0; }
.ll-head .cnt { background: rgba(255,255,255,.08); border-radius: 10px; padding: 0 7px; font-size: 10px; }
.ll-head.vis { color: var(--hot); }
.ll-head.soon { color: var(--warm); }
.ll-empty { color: var(--mut); font-size: 12px; font-style: italic; padding: 4px 0; }
.ll-item { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: 9px; background: rgba(255,255,255,.04); border: 1px solid var(--border); font-size: 12px; cursor: pointer; margin-bottom: 6px; }
.ll-item:hover { border-color: var(--accent); }
.ll-item.vis { border-color: rgba(255,77,79,.5); background: rgba(255,77,79,.09); }
.ll-item.soon { border-color: rgba(255,176,32,.45); background: rgba(255,176,32,.07); }
.ll-item.hid { opacity: .5; }
.ll-ic { width: 17px; height: 17px; flex: 0 0 auto; fill: none; stroke-width: 1.7; }
.ll-ic.plane { stroke: var(--accent); }
.ll-ic.heli { stroke: var(--heli); }
.ll-item.vis .ll-ic { stroke: var(--hot); }
.ll-main { flex: 1; min-width: 0; }
.ll-flight { font-weight: 700; color: var(--text); }
.ll-flight .ty { color: var(--mut); font-weight: 400; font-size: 11px; }
.ll-route { font-size: 11px; color: var(--accent); margin: 1px 0; }
.ll-sub { color: var(--mut); font-size: 11px; }
.ll-right { text-align: right; flex: 0 0 auto; }
.ll-eta { font-weight: 700; font-variant-numeric: tabular-nums; }
.ll-item.vis .ll-eta { color: var(--hot); }
.ll-item.soon .ll-eta { color: var(--warm); }
.ll-q { font-size: 10px; text-transform: uppercase; letter-spacing: .3px; }
.q-clear { color: var(--ok); } .q-faint { color: var(--warm); } .q-speck { color: var(--mut); }
.reason { font-size: 10px; text-transform: uppercase; letter-spacing: .3px; color: var(--mut); background: rgba(255,255,255,.06); padding: 1px 6px; border-radius: 4px; }
.spot { display: inline-flex; gap: 2px; margin-top: 3px; }
.spot i { width: 5px; height: 5px; border-radius: 50%; background: #2a3547; }
.spot i.on { background: var(--ok); }

.cfg { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 6px; }
.cfg summary { cursor: pointer; font-size: 13px; font-weight: 600; padding: 4px 0; user-select: none; }
.ctl { margin: 11px 0; }
.ctl label { display: flex; justify-content: space-between; font-size: 12px; color: var(--mut); margin-bottom: 5px; }
.ctl label b { color: var(--accent); font-variant-numeric: tabular-nums; }
.ctl.inline { display: flex; align-items: center; gap: 8px; }
.ctl.inline label { margin: 0; }
input[type=range] { width: 100%; accent-color: var(--accent); }
input[type=text] { flex: 1; background: rgba(0,0,0,.3); border: 1px solid var(--border); color: var(--text); padding: 6px 9px; border-radius: 7px; font-size: 12px; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 12px; margin: 9px 0; cursor: pointer; }
.big, .small { border: 0; cursor: pointer; }
.small { border: 1px solid var(--border); background: rgba(255,255,255,.05); color: var(--text); padding: 7px 12px; border-radius: 8px; font-size: 12px; }
.small:hover { background: rgba(255,255,255,.1); }
#email-status { display: block; margin-top: 6px; }

/* forecast */
.forecast-wrap { position: fixed; inset: 52px 0 0 0; z-index: 18; background: var(--bg); overflow-y: auto; }
.fc-inner { max-width: 1100px; margin: 0 auto; padding: 26px 28px 60px; }
.fc-inner h1 { font-size: 24px; margin: 8px 0 10px; }
.fc-inner h2 { font-size: 16px; margin: 30px 0 12px; }
.disclaimer { background: rgba(47,155,230,.07); border: 1px solid var(--border); border-left: 3px solid var(--accent); padding: 13px 16px; border-radius: 10px; color: #c7d4e2; font-size: 13px; line-height: 1.6; max-width: 760px; }
.disclaimer b { color: var(--text); }
.fc-stats { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.stat { background: var(--panel-solid); border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px; min-width: 130px; }
.stat .n { font-size: 24px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.stat .l { font-size: 11px; color: var(--mut); text-transform: uppercase; letter-spacing: .5px; margin-top: 3px; }
.fc-days { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.fc-day { background: var(--panel-solid); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.fc-day .hd { background: rgba(31,111,235,.14); padding: 9px 13px; font-weight: 700; font-size: 13px; border-bottom: 1px solid var(--border); }
.fc-day .body { padding: 6px 0; min-height: 40px; }
.fc-pass { display: flex; align-items: center; gap: 8px; padding: 6px 13px; font-size: 12px; }
.fc-pass .t { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; min-width: 62px; }
.fc-pass .c { margin-left: auto; }
.conf { width: 34px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.12); overflow: hidden; }
.conf i { display: block; height: 100%; background: var(--ok); }
.fc-none { color: var(--mut); font-size: 12px; font-style: italic; padding: 10px 13px; }
.heatmap { display: inline-block; background: var(--panel-solid); border: 1px solid var(--border); border-radius: 12px; padding: 14px; overflow-x: auto; }
.hm-grid { border-collapse: collapse; }
.hm-grid td, .hm-grid th { width: 22px; height: 20px; text-align: center; font-size: 9px; color: var(--mut); }
.hm-grid th.row { width: 34px; text-align: right; padding-right: 7px; font-size: 11px; }
.recent { display: flex; flex-direction: column; gap: 5px; max-width: 820px; }
.rec-row { display: flex; align-items: center; gap: 14px; padding: 8px 13px; background: var(--panel-solid); border: 1px solid var(--border); border-radius: 9px; font-size: 12px; }
.rec-row .when { color: var(--mut); min-width: 150px; }
.rec-row .fl { font-weight: 700; min-width: 80px; }
.rec-row .meta { color: var(--mut); }

#ac-info { position: fixed; z-index: 25; background: var(--panel-solid); border: 1px solid var(--border); border-radius: 12px; padding: 13px 15px; font-size: 12px; box-shadow: var(--shadow); min-width: 210px; pointer-events: none; }
#ac-info h3 { margin: 0 0 4px; font-size: 14px; color: var(--accent); display:flex; align-items:center; gap:6px; }
#ac-info .rt { color: var(--ok); font-size: 12px; margin-bottom: 7px; }
#ac-info .grid { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; }
#ac-info .grid span:nth-child(odd) { color: var(--mut); }

#osm-banner { position: fixed; bottom: 14px; right: 14px; z-index: 16; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 9px 14px; font-size: 12px; color: var(--mut); backdrop-filter: blur(10px); box-shadow: var(--shadow); max-width: 330px; }
#osm-banner .x { cursor: pointer; margin-left: 8px; color: var(--mut); }
#osm-banner code { background: rgba(255,255,255,.08); padding: 1px 5px; border-radius: 4px; color: var(--text); }

#warm-toast { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 22; background: var(--panel); border: 1px solid var(--border); border-radius: 20px; padding: 9px 18px; font-size: 12px; backdrop-filter: blur(10px); box-shadow: var(--shadow); }

@media (max-width: 640px) {
  .panel { width: calc(100vw - 28px); max-height: 44vh; }
  .status, #help-chip { display: none; }
}
