@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/assets/vendor/fonts/inter-latin-wght-normal.woff2") format("woff2");
}

:root {
  color-scheme: light;
  font-family: "Inter Variable", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  --ink: #242629;
  --label: #494c50;
  --muted: #666a70;
  --surface: #ffffff;
  --surface-muted: #f5f5f5;
  --surface-sunken: #eeeeef;
  --panel: rgba(255, 255, 255, 0.96);
  --border: rgba(30, 32, 35, 0.13);
  --border-interactive: #cbd8ef;
  --grid-line: #dfe5ed;
  --blue: #2563eb;
  --ascent: #eb6834;
  --cruise-a: #3fc0b0;
  --cruise-b: #0e9384;
  --airfield: #2563eb;
  --selected: #2563eb;
  --target: #ef4444;
  --chart-height: 240px;
  --sidebar-width: 390px;
}

:root.dark-mode {
  color-scheme: dark;
  --ink: #eeeeef;
  --label: #d1d2d4;
  --muted: #aaaeb3;
  --surface: #252629;
  --surface-muted: #2d2e32;
  --surface-sunken: #1d1e21;
  --panel: rgba(34, 35, 38, 0.98);
  --border: rgba(230, 230, 232, 0.15);
  --border-interactive: #555a63;
  --grid-line: #3c3e43;
  --airfield: #2563eb;
}

* {
  box-sizing: border-box;
}

html,
body,
#map {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: var(--surface-sunken);
}

.settings {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.settings h2 {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.settings-content {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 12px;
}

.timezone-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.timezone-toggle input { position: absolute; opacity: 0; }
.toggle-track { width: 28px; height: 16px; position: relative; background: #718096; border-radius: 999px; }
.toggle-track i { position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; background: #fff; border-radius: 50%; transition: transform .15s ease; }
.timezone-toggle input:checked + .toggle-track { background: var(--blue); }
.timezone-toggle input:checked + .toggle-track i { transform: translateX(12px); }

.timezone-toggle input:focus-visible + .toggle-track { outline: 2px solid var(--blue); outline-offset: 3px; }

button,
input,
select {
  font: inherit;
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.control-panel {
  position: fixed;
  z-index: 20;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  overflow: auto;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.control-panel header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 22px 16px;
}

.control-panel header img {
  width: 92px;
  height: auto;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 21px;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

h2 {
  margin-bottom: 13px;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.eyebrow {
  margin-bottom: 3px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

section {
  padding: 18px 22px;
  border-top: 1px solid var(--border);
}

.field {
  display: grid;
  gap: 7px;
  margin-top: 16px;
  color: var(--label);
  font-size: 12px;
  font-weight: 700;
}

.field > span {
  color: var(--ink);
}

.field output {
  min-height: 18px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

.field small,
.status {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.45;
}

.check-field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.check-field input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--blue);
}

.check-field:has(input:disabled) {
  color: var(--muted);
  cursor: not-allowed;
}

.selection-output {
  min-height: 40px;
  padding: 10px 11px;
  background: var(--surface-muted);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
}

select {
  width: 100%;
  padding: 9px 10px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-interactive);
  border-radius: 8px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--blue);
}

.status {
  min-height: 16px;
  margin-top: 14px;
}

.status.error {
  color: #8a2525;
}

.legend {
  position: fixed;
  z-index: 11;
  top: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(10, 26, 48, 0.12);
  color: var(--label);
  font-size: 11px;
  font-weight: 700;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend [hidden] {
  display: none;
}

.legend i {
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.legend i.airfield {
  background: var(--airfield);
}

.legend i.selected {
  background: var(--selected);
}

.legend i.target {
  background: var(--target);
}

.legend i.ascent,
.legend i.cruise,
.legend i.heatmap {
  width: 22px;
  height: 3px;
  border-radius: 2px;
}

.legend i.ascent {
  background: var(--ascent);
}

.legend i.cruise {
  background: linear-gradient(90deg, var(--cruise-a) 0 50%, var(--cruise-b) 50%);
}

.legend i.heatmap {
  height: 8px;
  background: linear-gradient(90deg, #2dd4bf, #facc15, #ef4444);
}

.maplibregl-popup-content {
  max-width: 280px;
  padding: 11px 12px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(10, 26, 48, 0.2);
  font: 12px/1.45 "Inter Variable", sans-serif;
}

.maplibregl-popup-content strong {
  display: block;
  margin-bottom: 3px;
  font-size: 13px;
}

#map {
  position: absolute;
  left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  height: calc(100% - var(--chart-height));
}

.map-hint { margin-top: 8px; font-size: 11px; color: var(--muted); line-height: 1.5; }
.target-heading { margin-top: 20px; }
.timeslot-panel {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--chart-height);
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  padding: 14px 20px 10px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 12;
}
.chart-heading { flex-shrink: 0; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.chart-heading h2 { margin: 0; text-transform: none; letter-spacing: -0.02em; }
.chart-heading span, #timeslot-status, .chart-caption { font-size: 11px; color: var(--muted); }
#timeslot-status { margin-top: 6px; height: 16px; flex-shrink: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.timeslot-chart { flex: 1; min-height: 0; min-width: 0; overflow: hidden; }
.timeslot-chart svg { display: block; width: 100%; height: 100%; }
.timeslot-chart text { fill: var(--muted); font: 10px "Inter Variable", sans-serif; }
.chart-grid { stroke: var(--grid-line); }
.chart-reachable { fill: #ef4444; }
.chart-unreachable { fill: #bfc3c9; }
.chart-unchecked { fill: #50545a; }
.chart-reachable.chart-current-slot { fill: #ffb3b3; }
.chart-unreachable.chart-current-slot { fill: #ffffff; }
.chart-caption { margin-top: 3px; flex-shrink: 0; }
#timezone-description { flex-basis: 100%; margin-top: 0; }
#chart-metadata { max-width: 65%; text-align: right; }
.maplibregl-popup-content { background: var(--surface); color: var(--ink); }
:root.dark-mode .status.error { color: #ff9d9d; }

@media (max-width: 760px) {
  :root { --chart-height: 220px; }
  .control-panel { width: 100%; height: 32vh; border-bottom: 1px solid var(--border); }
  .control-panel header { padding: 12px 16px; }
  .control-panel header img { width: 86px; }
  section { padding: 14px 16px; }
  #map { left: 0; top: 32vh; width: 100%; height: calc(68vh - var(--chart-height)); }
  .timeslot-panel { left: 0; padding: 10px 12px; }
  .chart-heading { align-items: flex-start; }
  .chart-heading span { text-align: right; }
  .legend { top: calc(32vh + 8px); right: 8px; gap: 8px; font-size: 10px; padding: 7px; }
}

:root:not(.has-target) { --chart-height: 0px; }
.timeslot-panel[hidden] { display: none; }
