:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f6f7f9;
  color: #172033;
}

* { box-sizing: border-box; }

body { margin: 0; min-height: 100vh; background: radial-gradient(circle at top, #dce4f2, #f6f7f9 52%); }

main { width: min(1180px, calc(100% - 2rem)); margin-inline: auto; }

header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem max(1rem, calc((100vw - 1180px) / 2)); background: linear-gradient(135deg, #001a44, #002868); color: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .35); }
.brand-lockup { display: flex; align-items: center; gap: 1rem; }
.brand-logo { width: clamp(7rem, 13vw, 10rem); height: auto; filter: drop-shadow(0 0 4px rgba(255, 255, 255, .86)) drop-shadow(0 0 9px rgba(255, 255, 255, .42)); }

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.3rem, 3vw, 2rem); line-height: 1; }
h2 { margin-bottom: .35rem; }

.eyebrow { margin-bottom: .45rem; color: #fff; font-size: .78rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
#data-status { margin: 0; max-width: 28rem; color: rgba(255, 255, 255, .82); text-align: right; }

main { display: grid; gap: 1rem; padding-block: 1rem 3rem; }
.route-panel, .map-card, .safety-note { border: 1px solid #ccd3df; border-radius: 1rem; background: #fff; box-shadow: 0 1.2rem 3rem rgba(0, 40, 104, .12); }
.route-panel { grid-column: 1 / -1; padding: 1.25rem; }
.route-panel summary, .legend-panel summary { cursor: pointer; color: #002868; font-weight: 800; }
#route-summary { margin-left: .5rem; color: #5a6270; font-size: .85rem; font-weight: 500; }
.route-editor { display: grid; grid-template-columns: 1fr minmax(20rem, 1.2fr); gap: 1rem 2rem; align-items: end; margin-top: 1rem; }
.route-panel p, .map-heading p, .safety-note p { margin-bottom: 0; color: #5a6270; }

label { display: block; margin-bottom: .4rem; font-size: .82rem; font-weight: 750; color: #002868; }
.route-entry { display: flex; gap: .6rem; }
input, button { border-radius: .6rem; font: inherit; }
input { min-width: 0; flex: 1; border: 1px solid #8b97aa; padding: .75rem .85rem; background: #fff; color: #172033; text-transform: uppercase; }
button { border: 0; padding: .75rem 1rem; background: #bf0a30; color: #fff; font-weight: 800; cursor: pointer; }
button:hover { background: #950824; }
.map-controls { position: absolute; z-index: 5; right: .75rem; bottom: .75rem; left: .75rem; display: flex; align-items: center; gap: .6rem; pointer-events: none; }
.map-controls label, .settings-open, .deal-filter { margin: 0; border-radius: .6rem; padding: .45rem .65rem; background: rgba(255, 255, 255, .92); box-shadow: 0 .2rem .8rem rgba(0, 0, 0, .3); pointer-events: auto; }
.symbol-size-setting { display: flex; flex: 1; align-items: center; gap: .5rem; max-width: 20rem; color: #172033; font-size: .8rem; font-weight: 700; }
.symbol-size-setting input { flex: 1; padding: 0; accent-color: #002868; }
.symbol-size-setting output { min-width: 3.2rem; color: #5a6270; font-variant-numeric: tabular-nums; }
.settings-open { padding: .55rem .7rem; background: #bf0a30; color: #fff; font-size: 1.9rem; line-height: 1; }
.deal-filter { background: #22c55e; color: #fff; }
.deal-filter:hover { background: #16a34a; }
.deal-filter[aria-pressed="true"] { background: #15803d; box-shadow: inset 0 .15rem .3rem rgba(0, 0, 0, .5); transform: translateY(.1rem); }
#settings-dialog { width: fit-content; max-width: calc(100% - 1rem); border: 0; border-radius: .75rem; padding: .6rem; color: #172033; box-shadow: 0 1rem 3rem rgba(0, 0, 0, .4); }
#settings-dialog::backdrop { background: rgba(0, 26, 68, .65); }
.settings-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: .4rem; }
#settings-heading { margin: 0; font-size: 1.1rem; }
.settings-heading button { padding: .25rem .5rem; font-size: .8rem; }
.settings-row { display: flex; align-items: center; gap: .4rem; white-space: nowrap; }
.groundspeed-setting { display: flex; flex: none; align-items: center; gap: .25rem; color: #172033; }
.groundspeed-setting[hidden] { display: none; }
.groundspeed-setting span { display: flex; align-items: center; gap: .1rem; }
.groundspeed-setting input { width: 6.5ch; padding: .25rem .2rem; text-transform: none; }
.planning-setting { display: flex; flex: none; align-items: center; gap: .25rem; color: #172033; font-size: .82rem; font-weight: 750; }
.planning-setting input { padding: .25rem .2rem; }
.location-setting input { width: 6.5ch; flex: none; }
.location-setting button { padding: .25rem .5rem; border: 1px solid #002868; background: #fff; color: #002868; font-size: 1.2rem; line-height: 1; box-shadow: 0 .18rem 0 #8b97aa, 0 .25rem .35rem rgba(0, 0, 0, .25); transform: translateY(0); }
.location-setting button[aria-pressed="true"] { background: #002868; color: #fff; box-shadow: inset 0 .15rem .25rem rgba(0, 0, 0, .5); transform: translateY(.15rem); }
.fuel-remaining-setting input { width: 6.5ch; text-transform: none; }
#route-message { grid-column: 1 / -1; min-height: 1.2rem; margin: 0; color: #bf0a30; }

.map-card { position: relative; overflow: hidden; }
.map-stage { position: relative; }
.map-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .65rem 1.25rem; }
.map-heading h2 { margin: 0; font-size: 1rem; }
.legend-panel { border-top: 1px solid #ccd3df; padding: .85rem 1.25rem; }
.legend-panel .legend { margin-top: .75rem; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; color: #5a6270; font-size: .8rem; }
.legend .map-help { flex-basis: 100%; margin: 0; }
.legend i { display: inline-block; width: .7rem; height: .7rem; margin-right: .3rem; border-radius: 50%; }
.green-dot { background: #22c55e; }
.super-deal-dot { background: #39ff14; box-shadow: 0 0 .35rem #39ff14; }
.sky-blue-dot { background: #7dd3fc; }
.indigo-dot { background: #8b5cf6; }
.yellow-dot { background: #ffd500; }
.orange-dot { background: #ff8c00; }
.gray-dot { background: #808080; }
.red-dot { background: #e31b23; }
.part-time-dot { height: .35rem !important; border-radius: .7rem .7rem 0 0 !important; background: #ffd500; }
.route-dot { background: #f0f; }
.ownship-dot { border: 2px solid #bf0a30; background: #fff; }

#map { display: block; width: 100%; min-height: 28rem; background: #001a44; cursor: grab; touch-action: none; }
#map.dragging { cursor: grabbing; }
.map-grid { stroke: #29497b; stroke-width: 1; }
.state-outline { fill: none; stroke: #7890b5; stroke-width: 1.5; pointer-events: none; vector-effect: non-scaling-stroke; }
.lake-outline { fill: #001a44; stroke: #7890b5; stroke-width: 1.5; pointer-events: none; vector-effect: non-scaling-stroke; }
.fuel-marker { pointer-events: none; }
.marker-hit { fill: transparent; cursor: pointer; }
.route-line { fill: none; stroke: #f0f; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; vector-effect: non-scaling-stroke; }
.route-marker { fill: #f0f; cursor: pointer; }
.route-marker.unavailable { fill: #ed6a5a; }
.ownship-marker { pointer-events: none; filter: drop-shadow(0 0 2px #fff) drop-shadow(0 0 4px rgba(255, 255, 255, .75)); }
.airport-label { display: none; font-weight: 700; paint-order: stroke; cursor: pointer; stroke: #001a44; stroke-width: 1px; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.airport-label.visible, .route-label { display: block; }
.airport-price { font-size: .8em; }

#airport-tooltip { position: absolute; z-index: 10; width: min(23rem, calc(100% - 1rem)); max-height: min(25rem, calc(100% - 1rem)); overflow: auto; border: 2px solid #002868; border-radius: .75rem; padding: .9rem; background: #fff; color: #172033; box-shadow: 0 .75rem 2rem rgba(0, 0, 0, .35); }
#airport-tooltip[hidden] { display: none; }
#airport-tooltip h2 { margin: 0 2rem .2rem 0; font-size: 1.15rem; }
#airport-tooltip p { margin-bottom: .65rem; color: #5a6270; }
#airport-tooltip .warning { color: #bf0a30; font-weight: 800; }
#airport-tooltip .navigation { color: #002868; font-weight: 800; }
.tooltip-close { position: absolute; top: .35rem; right: .35rem; padding: .2rem .5rem; background: transparent; color: #002868; font-size: 1.2rem; }
.price-list { display: grid; gap: .55rem; margin: 0; padding: 0; list-style: none; }
.price-list li { border-top: 1px solid #d7dce5; padding-top: .55rem; }
.price-list strong, .price-list span { display: block; }
.price-list span { margin-top: .15rem; color: #414b5e; font-size: .88rem; }
.safety-note { grid-column: 1 / -1; padding: 1.1rem 1.25rem; border-color: #bf0a30; }

@media (max-width: 760px) {
  header { display: block; }
  #data-status { margin-top: 1rem; text-align: left; }
  .route-editor { display: block; }
  .route-editor form { margin-top: 1rem; }
  .map-controls { right: .4rem; bottom: .4rem; left: .4rem; flex-wrap: nowrap; gap: .3rem; }
  .map-controls label, .settings-open, .deal-filter { padding: .25rem .3rem; }
  .symbol-size-setting { min-width: 0; gap: .2rem; font-size: .65rem; }
  .symbol-size-setting input { width: 3rem; }
  .symbol-size-setting output { min-width: 2.4rem; }
  .deal-filter { flex: none; font-size: .7rem; }
  .settings-open { flex: none; font-size: 1.15rem; }
  .route-entry, .map-heading { flex-direction: column; }
  .safety-note { grid-column: 1; }
  #map { min-height: 22rem; }
}
