:root {
  --navy: #0b1424;
  --navy-2: #122038;
  --ink: #e8f0fa;
  --muted: #9bb0c9;
  --sun: #f0c23a;
  --sun-deep: #d9a512;
  --sky: #4ea0d9;
  --sky-soft: #8ec8ef;
  --cloud: #f4f8fc;
  --line: rgba(142, 200, 239, 0.22);
  --ok: #3dcf8e;
  --warn: #f0c23a;
  --err: #ff6b6b;
  --radius: 18px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "DM Sans", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--navy);
  line-height: 1.45;
}

.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 70% 55% at 78% 8%, rgba(240, 194, 58, 0.28), transparent 55%),
    radial-gradient(ellipse 50% 40% at 18% 18%, rgba(78, 160, 217, 0.35), transparent 60%),
    radial-gradient(ellipse 80% 50% at 50% 100%, rgba(18, 40, 72, 0.95), transparent 55%),
    linear-gradient(180deg, #07101d 0%, #122038 48%, #0b1424 100%);
}

.sky::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.03) 50%, transparent 100%);
  opacity: 0.5;
  animation: drift 18s ease-in-out infinite alternate;
}

@keyframes drift {
  from { transform: translateX(-2%); }
  to { transform: translateX(2%); }
}

.shell {
  width: min(920px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.5rem 0 4rem;
  display: grid;
  gap: 1.5rem;
}

.shell--wide {
  width: min(1280px, calc(100% - 2rem));
}

.tabs {
  display: flex;
  gap: 0.4rem;
  padding: 0.3rem;
  border-radius: 999px;
  background: rgba(7, 16, 29, 0.55);
  border: 1px solid var(--line);
  width: fit-content;
  max-width: 100%;
  animation: rise 0.75s ease both;
}

.tabs__btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  padding: 0.65rem 1.15rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.tabs__btn:hover {
  color: var(--cloud);
}

.tabs__btn.is-active {
  background: linear-gradient(135deg, rgba(240, 194, 58, 0.95), rgba(217, 165, 18, 0.95));
  color: #1a1404;
}

.tab-panel {
  display: none;
  grid-gap: 1.5rem;
}

.tab-panel.is-active {
  display: grid;
}

#tab-sonde.tab-panel.is-active {
  gap: 1.5rem;
}

.mission-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.9fr);
  gap: 1rem;
  align-items: start;
}

.mission-viz {
  display: grid;
  gap: 0.85rem;
  position: sticky;
  top: 1rem;
  align-self: start;
}

@media (max-width: 960px) {
  .mission-grid {
    grid-template-columns: 1fr;
  }

  .mission-viz {
    position: static;
  }

  .mission-side {
    max-height: none;
    overflow: visible;
    position: static;
  }
}

.map-wrap {
  display: grid;
  gap: 0.45rem;
}

.map-stage {
  position: relative;
}

.map {
  height: min(62vh, 560px);
  min-height: 360px;
  border-radius: 14px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: #0a1628;
}

.wind-banner {
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  top: 0.75rem;
  z-index: 1000;
  display: grid;
  gap: 0.45rem;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  background: rgba(7, 16, 29, 0.9);
  border: 1px solid rgba(240, 194, 58, 0.45);
  color: var(--cloud);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.wind-banner__row {
  display: flex;
  gap: 0.65rem;
  align-items: center;
}

.wind-banner__pulse {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: var(--sun);
  box-shadow: 0 0 0 0 rgba(240, 194, 58, 0.55);
  animation: pulse 1.2s ease-in-out infinite;
  flex: 0 0 auto;
}

.wind-progress {
  height: 6px;
  border-radius: 999px;
  background: rgba(142, 200, 239, 0.18);
  overflow: hidden;
}

.wind-progress__bar {
  height: 100%;
  width: 18%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--sun), var(--sky));
  transition: width 0.45s ease;
}

.wind-progress__bar[data-stage="1"] { width: 22%; }
.wind-progress__bar[data-stage="2"] { width: 55%; }
.wind-progress__bar[data-stage="3"] { width: 82%; }
.wind-progress__bar[data-stage="4"] { width: 100%; }

.wind-progress__bar.is-indeterminate {
  width: 35% !important;
  animation: wind-indeterminate 1.4s ease-in-out infinite;
}

@keyframes wind-indeterminate {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}

.wind-progress__label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
}

.wind-fetch-meta {
  margin-top: -0.2rem;
  padding: 0.65rem 0.8rem;
  border-radius: 12px;
  background: rgba(78, 160, 217, 0.12);
  border: 1px solid rgba(142, 200, 239, 0.28);
  color: var(--sky-soft);
  font-size: 0.84rem;
  line-height: 1.35;
}

.advanced {
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 0.45rem 0.75rem 0.7rem;
  background: rgba(7, 16, 29, 0.35);
  color: var(--muted);
  font-size: 0.86rem;
}

.advanced summary {
  cursor: pointer;
  color: var(--sky-soft);
  font-weight: 600;
  padding: 0.25rem 0;
}

.actions--tight {
  margin-top: 0.55rem;
}

.actions--tight .btn {
  padding: 0.55rem 0.9rem;
  font-size: 0.88rem;
}

.map-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.mission-side {
  display: grid;
  gap: 0.85rem;
  align-content: start;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.35rem;
  scrollbar-gutter: stable;
}

.mission-side input[readonly] {
  opacity: 0.85;
  color: var(--cloud);
  cursor: default;
}

.subhead {
  margin: 0.4rem 0 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 650;
}

.wp-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.wp-list__empty {
  color: var(--muted);
  padding: 0.7rem;
  border: 1px dashed var(--line);
  border-radius: 12px;
  text-align: center;
}

.wp-list__card {
  border-radius: 12px;
  background: rgba(7, 16, 29, 0.45);
  border: 1px solid transparent;
  padding: 0.45rem 0.55rem 0.55rem;
}

.wp-list__card.is-loiter {
  border-color: rgba(240, 194, 58, 0.45);
  box-shadow: inset 0 0 0 1px rgba(240, 194, 58, 0.12);
}

.wp-list__item {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 0.45rem;
  align-items: center;
}

.wp-list__opts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.85rem;
  align-items: center;
  margin-top: 0.4rem;
  padding-top: 0.4rem;
  border-top: 1px solid rgba(142, 200, 239, 0.12);
}

.wp-check {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  color: var(--cloud);
  font-size: 0.82rem;
  cursor: pointer;
  user-select: none;
}

.wp-check input {
  width: auto;
  accent-color: var(--sun);
}

.wp-mins {
  display: inline-flex;
  gap: 0.3rem;
  align-items: center;
  color: var(--muted);
  font-size: 0.78rem;
}

.wp-list__mins {
  width: 3.6rem;
  padding: 0.25rem 0.35rem;
  font-size: 0.82rem;
}

.wp-list__label {
  font-weight: 700;
  color: var(--sun);
  font-size: 0.82rem;
}

.wp-list__label.is-via {
  color: var(--sky-soft);
}

.wp-via-icon {
  background: transparent !important;
  border: 0 !important;
}

.wp-via-dot {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--sky);
  border: 2px solid var(--cloud);
  box-shadow: 0 0 0 1px rgba(11, 20, 36, 0.4);
}

.wp-list__coords {
  color: var(--muted);
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wp-list__alt {
  width: 5.5rem;
  padding: 0.35rem 0.45rem;
  font-size: 0.85rem;
}

.mission-summary {
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  background: rgba(7, 16, 29, 0.55);
  border: 1px solid var(--line);
  color: var(--cloud);
  font-size: 0.9rem;
  line-height: 1.4;
}

.mission-summary strong {
  color: var(--sun);
}

.ac-icon {
  background: transparent !important;
  border: 0 !important;
}

.splat-icon {
  background: transparent !important;
  border: 0 !important;
}

.splat-marker {
  width: 44px;
  height: 40px;
  display: grid;
  place-items: center;
  text-align: center;
  font-weight: 700;
  font-size: 0.72rem;
  line-height: 1.05;
  color: #0b1424;
  background: var(--splat, #f0c23a);
  border: 2px solid #0b1424;
  border-radius: 14px 14px 14px 4px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  transform: translateY(-2px);
}

.splat-marker small {
  display: block;
  font-size: 0.58rem;
  font-weight: 600;
  opacity: 0.8;
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

@media (max-width: 900px) {
  .config-grid {
    grid-template-columns: 1fr;
  }
}

.config-block {
  padding: 0.85rem 1rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(7, 16, 29, 0.4);
  display: grid;
  gap: 0.65rem;
}

.config-block .subhead {
  margin: 0;
}

.field--check {
  align-content: end;
}

.cfg-energy {
  margin-top: 1rem;
}

.cfg-energy__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem 1rem;
  margin-top: 0.55rem;
}

@media (max-width: 720px) {
  .cfg-energy__grid {
    grid-template-columns: 1fr;
  }
}

.cfg-energy__metric {
  font-size: 0.86rem;
  color: var(--muted);
}

.cfg-energy__metric strong {
  display: block;
  color: var(--cloud);
  font-size: 1.05rem;
  margin-top: 0.15rem;
}

.cfg-energy__metric strong.is-pos { color: var(--ok); }
.cfg-energy__metric strong.is-neg { color: var(--err); }

.cfg-chip {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(7, 16, 29, 0.45);
}

.cfg-chip__text {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.cfg-chip__text strong {
  color: var(--cloud);
}

.cfg-chip .btn {
  flex: 0 0 auto;
  padding: 0.55rem 0.9rem;
  font-size: 0.88rem;
}

.ac-icon__body {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.55));
  transition: transform 0.08s linear;
}

.leaflet-container {
  font: inherit;
  background: #0a1628;
}

.xsect {
  display: grid;
  gap: 0.55rem;
}

.xsect__canvas {
  width: 100%;
  height: auto;
  min-height: 220px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(18, 40, 72, 0.55), rgba(7, 16, 29, 0.85));
  cursor: crosshair;
  touch-action: none;
}

.xsect__readout {
  font-size: 0.86rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-height: 1.3em;
}

.field--inline {
  min-width: 9rem;
}

.brand {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.25rem;
  align-items: center;
  animation: rise 0.7s ease both;
}

.brand__logo {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  animation: float 5s ease-in-out infinite;
}

.brand__name {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 0.95;
  color: var(--cloud);
}

.brand__title {
  margin: 0.35rem 0 0.5rem;
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 3vw, 1.65rem);
  font-weight: 500;
  color: var(--sun);
}

.brand__lede {
  margin: 0;
  max-width: 38ch;
  color: var(--muted);
  font-size: 0.98rem;
}

.panel {
  background: rgba(11, 20, 36, 0.55);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem 1.4rem 1.5rem;
  backdrop-filter: blur(10px);
  animation: rise 0.8s ease both;
  animation-delay: 0.08s;
}

.panel__head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 650;
}

.panel__head p {
  margin: 0.35rem 0 1.1rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.panel__head--row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.panel__head--row p {
  margin-bottom: 0.9rem;
}

.form {
  display: grid;
  gap: 0.9rem;
}

.sonde-slot {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(7, 16, 29, 0.55);
}

.sonde-slot__label {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sky-soft);
}

.sonde-slot__name {
  margin: 0.25rem 0 0;
  font-weight: 600;
  color: var(--cloud);
  word-break: break-all;
}

.sonde-slot__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.btn--danger {
  background: transparent;
  color: #ffb4b4;
  border: 1px solid rgba(255, 107, 107, 0.45);
}

.btn--danger:hover {
  background: rgba(255, 107, 107, 0.12);
}

.btn--tiny {
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
}

.file-list .file-actions {
  display: flex;
  gap: 0.55rem;
  align-items: center;
}

.field {
  display: grid;
  gap: 0.35rem;
}

.field span,
.formats legend {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sky-soft);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

.field-row--3 {
  grid-template-columns: 1fr 1fr 1fr;
}

@media (max-width: 640px) {
  .field-row--3 {
    grid-template-columns: 1fr;
  }
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(7, 16, 29, 0.7);
  color: var(--ink);
  padding: 0.7rem 0.85rem;
  font: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  min-width: 1rem;
  height: 1rem;
  padding: 0;
  border-radius: 3px;
  accent-color: var(--sun);
  flex: 0 0 auto;
}

input:focus,
select:focus {
  border-color: var(--sky);
  box-shadow: 0 0 0 3px rgba(78, 160, 217, 0.2);
}

.formats {
  border: 0;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.2rem;
  align-items: center;
}

.formats legend {
  width: 100%;
  margin-bottom: 0.35rem;
}

.formats label {
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
  color: var(--ink);
  font-size: 0.95rem;
  white-space: nowrap;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 0.3rem;
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.75rem 1.2rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

.btn--primary {
  background: linear-gradient(135deg, var(--sun), var(--sun-deep));
  color: #1a1404;
}

.btn--ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.upload {
  display: inline-flex;
  align-items: center;
}

.status {
  margin-top: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.status__dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 0 rgba(155, 176, 201, 0.4);
}

.status[data-state="running"] .status__dot {
  background: var(--warn);
  animation: pulse 1.2s ease-in-out infinite;
}

.status[data-state="ok"] .status__dot {
  background: var(--ok);
}

.status[data-state="error"] .status__dot {
  background: var(--err);
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240, 194, 58, 0.45); }
  50% { box-shadow: 0 0 0 8px rgba(240, 194, 58, 0); }
}

.log {
  margin: 0.8rem 0 0;
  max-height: 180px;
  overflow: auto;
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  color: #c9d7e8;
  font-size: 0.78rem;
  white-space: pre-wrap;
}

.file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.file-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  border: 1px solid transparent;
  background: rgba(7, 16, 29, 0.45);
  transition: border-color 0.2s ease;
}

.file-list li:hover {
  border-color: var(--line);
}

.file-list a {
  color: var(--sky-soft);
  text-decoration: none;
  font-weight: 600;
}

.file-list a:hover {
  color: var(--sun);
}

.file-meta {
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

.file-list .empty {
  color: var(--muted);
  background: transparent;
  border: 1px dashed var(--line);
  justify-content: center;
}

.foot {
  text-align: center;
  color: rgba(155, 176, 201, 0.7);
  font-size: 0.8rem;
  padding-bottom: 1.5rem;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@media (max-width: 640px) {
  .brand {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .brand__logo {
    width: 96px;
    height: 96px;
  }

  .field-row,
  .panel__head--row {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .sonde-slot,
  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .btn,
  .upload {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
}
