:root {
  color-scheme: dark;
  --bg: #05070a;
  --panel: rgba(9, 16, 23, 0.76);
  --panel-strong: rgba(13, 25, 34, 0.92);
  --line: rgba(174, 215, 222, 0.2);
  --line-strong: rgba(187, 234, 232, 0.42);
  --text: #f4fbfa;
  --muted: #a9bac0;
  --cyan: #69e5e0;
  --green: #83d99a;
  --amber: #ffbf66;
  --warning: #ff8a7a;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-height: 620px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(20, 36, 42, 0.18), rgba(5, 7, 10, 0) 34%),
    #05070a;
}

#mapContainer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.maplibregl-map {
  width: 100%;
  height: 100%;
  font-family: inherit;
  background: #05070a;
}

.maplibregl-canvas {
  outline: none;
}

.route-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.maplibregl-marker {
  z-index: 2;
}

.maplibregl-ctrl-bottom-left,
.maplibregl-ctrl-bottom-right {
  z-index: 2;
}

.maplibregl-ctrl-attrib {
  border-radius: 6px 0 0 0;
  background: rgba(5, 10, 14, 0.72) !important;
  color: rgba(244, 251, 250, 0.74);
  font-size: 10px;
}

.maplibregl-ctrl-attrib a {
  color: rgba(105, 229, 224, 0.9);
}

.map-marker {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 3px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  background: var(--marker-color, #83d99a);
  box-shadow: 0 0 24px color-mix(in srgb, var(--marker-color, #83d99a) 70%, transparent);
}

.map-marker::after {
  content: attr(data-label);
  position: absolute;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  max-width: 160px;
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(5, 10, 14, 0.78);
  color: #effcfa;
  font-size: 0.78rem;
  font-weight: 820;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

.map-plane {
  width: 44px;
  height: 44px;
  filter: drop-shadow(0 0 16px rgba(105, 229, 224, 0.85));
  transform-origin: 50% 50%;
  pointer-events: none;
}

.map-plane svg {
  width: 100%;
  height: 100%;
  fill: #f7fffb;
  stroke: #69e5e0;
  stroke-width: 1.4;
}

.topbar {
  position: absolute;
  top: 24px;
  left: 28px;
  right: 28px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  pointer-events: none;
}

.brand,
.route-chip {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  border: 1px solid var(--line);
  background: rgba(6, 12, 17, 0.56);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.brand {
  gap: 10px;
  padding: 0 15px 0 10px;
  border-radius: 999px;
  font-weight: 780;
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(105, 229, 224, 0.24), rgba(131, 217, 154, 0.14));
}

.brand-mark svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--cyan);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.route-chip {
  gap: 11px;
  padding: 0 16px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 760;
}

.chip-line {
  width: 54px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--amber));
  box-shadow: 0 0 20px rgba(105, 229, 224, 0.55);
}

.workspace {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.planner-panel,
.route-summary {
  pointer-events: auto;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow);
}

.planner-panel {
  position: absolute;
  left: 28px;
  bottom: 28px;
  width: min(390px, calc(100vw - 56px));
  padding: 22px;
  border-radius: 8px;
}

.panel-title {
  margin-bottom: 18px;
}

.panel-title p,
.metric-label,
.airport-field span {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 710;
  text-transform: uppercase;
}

.panel-title h1 {
  margin: 4px 0 0;
  font-size: 1.9rem;
  line-height: 1.08;
}

.route-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  gap: 12px;
  align-items: stretch;
}

.airport-field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.airport-field input {
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 0 14px;
  border: 1px solid rgba(203, 235, 235, 0.2);
  border-radius: 8px;
  outline: none;
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.airport-field input:focus {
  border-color: rgba(105, 229, 224, 0.72);
  box-shadow: 0 0 0 4px rgba(105, 229, 224, 0.1);
}

.airport-field input.is-invalid {
  border-color: rgba(255, 138, 122, 0.82);
  box-shadow: 0 0 0 4px rgba(255, 138, 122, 0.1);
}

.icon-button,
.primary-action,
.preset-routes button {
  border: 1px solid rgba(203, 235, 235, 0.2);
  border-radius: 8px;
  color: var(--text);
  background: rgba(18, 31, 38, 0.82);
}

.icon-button {
  grid-row: 1 / span 2;
  grid-column: 2;
  width: 46px;
  height: 46px;
  align-self: center;
  display: grid;
  place-items: center;
}

.icon-button svg,
.primary-action svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button:hover,
.preset-routes button:hover {
  border-color: rgba(105, 229, 224, 0.5);
  background: rgba(27, 48, 54, 0.95);
}

.primary-action {
  grid-column: 1 / -1;
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 2px;
  border-color: rgba(255, 191, 102, 0.52);
  background: linear-gradient(135deg, rgba(255, 191, 102, 0.96), rgba(105, 229, 224, 0.88));
  color: #071014;
  font-weight: 820;
}

.primary-action:hover {
  filter: brightness(1.04);
}

.status-message {
  min-height: 22px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.status-message.error {
  color: var(--warning);
}

.preset-routes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.preset-routes button {
  min-width: 0;
  min-height: 36px;
  padding: 0 8px;
  color: #d9e9eb;
  font-size: 0.78rem;
  font-weight: 760;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.route-summary {
  position: absolute;
  right: 28px;
  bottom: 28px;
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 1fr));
  gap: 1px;
  overflow: hidden;
  border-radius: 8px;
}

.metric {
  display: grid;
  gap: 4px;
  min-width: 0;
  min-height: 82px;
  padding: 17px 18px;
  background: rgba(6, 13, 18, 0.48);
}

.metric-value {
  color: var(--text);
  font-size: 1.24rem;
  font-weight: 820;
  line-height: 1.1;
  white-space: nowrap;
}

.metric-label {
  white-space: nowrap;
}

.airport-label {
  position: absolute;
  z-index: 2;
  display: none;
  min-width: 64px;
  max-width: 180px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(5, 10, 14, 0.74);
  color: #effcfa;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
  font-size: 0.78rem;
  font-weight: 820;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.airport-label.visible {
  display: block;
}

.loading-state {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 5;
  transform: translate(-50%, -50%);
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(4, 9, 13, 0.78);
  color: var(--muted);
  backdrop-filter: blur(16px);
  font-size: 0.9rem;
}

.loading-state.hidden {
  opacity: 0;
  visibility: hidden;
}

@media (max-width: 960px) {
  #app {
    min-height: 720px;
  }

  .topbar {
    top: 16px;
    left: 16px;
    right: 16px;
  }

  .planner-panel {
    left: 16px;
    bottom: 16px;
    width: min(430px, calc(100vw - 32px));
    padding: 18px;
  }

  .route-summary {
    right: 16px;
    bottom: 16px;
    transform: translateY(calc(-100% - 14px));
    grid-template-columns: repeat(3, minmax(88px, 1fr));
  }

  .metric {
    min-height: 70px;
    padding: 13px 14px;
  }

  .metric-value {
    font-size: 1.05rem;
  }
}

@media (max-width: 680px) {
  html,
  body {
    overflow: auto;
  }

  #app {
    min-height: 860px;
  }

  .topbar {
    align-items: flex-start;
  }

  .route-chip {
    display: none;
  }

  .planner-panel {
    max-height: none;
    overflow: visible;
  }

  .panel-title {
    display: none;
  }

  .route-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .icon-button {
    display: none;
  }

  .primary-action {
    grid-column: 1;
  }

  .preset-routes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .route-summary {
    left: 16px;
    right: 16px;
    bottom: 486px;
    transform: none;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .metric {
    padding: 11px 6px;
  }

  .metric-value {
    font-size: 0.85rem;
    white-space: normal;
  }

  .metric-label {
    font-size: 0.64rem;
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }
}
