:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  color: #152234;
  --ink: #152234;
  --muted: #657386;
  --navy: #0b1728;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --launch: #19a974;
  --ascent-a: #ff8a1f;
  --ascent-b: #f97316;
  --descent-a: #a78bfa;
  --descent-b: #9678f3;
  --cruise-a: #22d3ee;
  --cruise-b: #13c5dd;
  --panel: rgba(255, 255, 255, 0.96);
  --border: rgba(15, 35, 58, 0.12);
  --shadow: 0 16px 48px rgba(10, 26, 48, 0.18);
}

* {
  box-sizing: border-box;
}

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

body {
  overflow: hidden;
  background: #d9e3eb;
}

button,
input,
select {
  font: inherit;
}

button,
a,
select,
input[type="range"] {
  -webkit-tap-highlight-color: transparent;
}

.maplibregl-ctrl-bottom-right {
  bottom: 60px;
}

.control-panel,
.editor-card {
  position: fixed;
  z-index: 20;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.control-panel {
  top: 18px;
  left: 18px;
  width: min(390px, calc(100vw - 36px));
  max-height: calc(100vh - 174px);
  overflow: auto;
  padding: 22px;
}

.panel-heading,
.editor-heading,
.locations-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 25px;
  letter-spacing: -0.03em;
}

h2 {
  margin-top: 3px;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.title-line {
  display: flex;
  align-items: center;
  gap: 9px;
}

.eyebrow {
  color: var(--blue);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.panel-links {
  display: flex;
  gap: 13px;
  margin-top: 6px;
}

.panel-links a {
  color: var(--blue);
  font-size: 11px;
  font-weight: 750;
  text-decoration: none;
}

.panel-links a:hover {
  text-decoration: underline;
}

#panel-content {
  margin-top: 18px;
}

.field-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(105px, 0.7fr);
  gap: 12px;
}

.field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 16px;
}

.field[hidden] {
  display: none;
}

.field > span {
  color: #3f4e61;
  font-size: 12px;
  font-weight: 700;
}

.field small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.checkbox-field {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 2px 0 18px;
  cursor: pointer;
}

.checkbox-field input {
  width: 17px;
  height: 17px;
  margin: 1px 0 0;
  accent-color: var(--blue);
}

.checkbox-field > span {
  display: grid;
  gap: 3px;
}

.checkbox-field strong {
  color: #3f4e61;
  font-size: 12px;
}

.checkbox-field small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

select,
input[type="text"],
input[type="number"] {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  color: var(--ink);
  background: white;
  border: 1px solid #d5dce5;
  border-radius: 10px;
  outline: none;
}

select:focus,
input:focus {
  border-color: #7da5f8;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

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

.value-control {
  display: grid;
  gap: 3px;
}

.value-control output {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.compact-input {
  display: flex;
  align-items: center;
  overflow: hidden;
  background: white;
  border: 1px solid #d5dce5;
  border-radius: 10px;
}

.compact-input input {
  min-width: 0;
  border: 0;
  box-shadow: none;
}

.compact-input span {
  padding-right: 10px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.locations-heading {
  margin: 4px 0 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.text-button,
.icon-button {
  padding: 0;
  color: var(--blue);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.text-button {
  font-size: 12px;
  font-weight: 750;
}

.location-list {
  display: grid;
  gap: 8px;
}

.location-row {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 10px;
  text-align: left;
  background: #f7f9fc;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
}

.location-row:hover {
  background: white;
  border-color: #dbe2eb;
}

.location-row .copy {
  min-width: 0;
  flex: 1;
}

.location-row strong,
.location-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.location-row strong {
  font-size: 13px;
}

.location-row small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.dot,
.legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 50%;
}

.dot.launch,
.legend i.launch {
  background: var(--launch);
}

.map-hint {
  margin: 11px 0 15px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.primary-button,
.danger-button {
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 11px 16px;
  color: white;
  border: 0;
  border-radius: 11px;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  width: 100%;
  background: var(--blue);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.25);
}

.primary-button:hover {
  background: var(--blue-dark);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.primary-button.compact,
.danger-button {
  width: auto;
  min-height: 40px;
  box-shadow: none;
}

.danger-button {
  color: #c62828;
  background: #fff0f0;
}

.status {
  display: none;
  margin-top: 11px;
  padding: 9px 10px;
  color: #275334;
  background: #edf9f0;
  border-radius: 9px;
  font-size: 11px;
  line-height: 1.4;
}

.status.visible {
  display: block;
}

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

.editor-card {
  right: 18px;
  bottom: 78px;
  width: min(340px, calc(100vw - 36px));
  padding: 19px;
}

.editor-card[hidden],
.add-menu[hidden],
.loading[hidden] {
  display: none;
}

.editor-heading {
  margin-bottom: 17px;
}

.close-button {
  width: 30px;
  height: 30px;
  color: var(--muted);
  font-size: 25px;
}

.coordinates {
  grid-template-columns: 1fr 1fr;
}

.editor-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.add-menu {
  position: fixed;
  z-index: 30;
  overflow: hidden;
  min-width: 180px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.add-menu-heading {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  padding: 4px 5px 4px 13px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.add-menu-heading .close-button {
  flex: 0 0 30px;
}

.add-menu > button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 9px;
  padding: 11px 13px;
  color: var(--ink);
  text-align: left;
  background: white;
  border: 0;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.add-menu > button + button {
  border-top: 1px solid var(--border);
}

.add-menu > button:hover {
  background: #f5f8fc;
}

.loading {
  position: fixed;
  z-index: 40;
  top: 18px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 15px;
  color: white;
  background: rgba(11, 23, 40, 0.92);
  border-radius: 999px;
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 700;
}

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.bottom-bar {
  position: fixed;
  z-index: 12;
  bottom: 14px;
  left: 18px;
  display: flex;
  min-height: 50px;
  align-items: center;
  width: min(390px, calc(100vw - 36px));
  padding: 7px 10px;
  background: rgba(11, 23, 40, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(11, 23, 40, 0.22);
  backdrop-filter: blur(14px);
}

.vaaltech-logo {
  display: block;
  width: 100%;
}

.vaaltech-logo img {
  display: block;
  width: 100%;
  height: auto;
}

.legend {
  position: fixed;
  z-index: 11;
  right: 18px;
  bottom: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 38px;
  padding: 8px 12px;
  color: #435268;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border);
  border-radius: 11px;
  box-shadow: 0 6px 20px rgba(10, 26, 48, 0.12);
  font-size: 10px;
  font-weight: 700;
}

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

.legend span[hidden] {
  display: none;
}

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

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

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

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

.maplibregl-popup-content {
  padding: 11px 12px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(10, 26, 48, 0.2);
}

.trajectory-tooltip {
  min-width: 210px;
  color: var(--ink);
  font-size: 11px;
}

.trajectory-tooltip > strong {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
}

.trajectory-tooltip dl {
  display: grid;
  grid-template-columns: auto auto;
  gap: 4px 14px;
  margin: 0;
}

.trajectory-tooltip dt {
  color: var(--muted);
}

.trajectory-tooltip dd {
  margin: 0;
  font-weight: 700;
  text-align: right;
}

.mobile-only {
  display: none;
}

@media (max-width: 760px) {
  .control-panel {
    top: 10px;
    left: 10px;
    width: calc(100vw - 20px);
    max-height: min(68vh, calc(100vh - 170px));
    padding: 16px;
    border-radius: 15px;
  }

  .mobile-only {
    display: block;
  }

  #panel-content.collapsed {
    display: none;
  }

  .panel-heading h1 {
    font-size: 21px;
  }

  #panel-toggle {
    display: grid;
    width: 32px;
    gap: 4px;
  }

  #panel-toggle span {
    display: block;
    height: 2px;
    background: var(--ink);
    border-radius: 2px;
  }

  .editor-card {
    right: 10px;
    bottom: 150px;
    left: 10px;
    width: auto;
  }

  .bottom-bar {
    bottom: 8px;
    left: 10px;
    height: 48px;
    width: calc(100vw - 20px);
  }

  .vaaltech-logo {
    width: 100%;
  }

  .legend {
    display: none;
  }
}

@media (max-width: 390px) {
  .field-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .coordinates {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
}
