:root {
  --bg: #0e1f26;
  --panel: #102932;
  --text: #eef8fb;
  --muted: #a9c1ca;
  --accent: #f4a259;
  --accent-2: #5dd1c8;
  --danger: #ff6b6b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 20% -10%, #27566b 0%, transparent 55%),
    radial-gradient(1000px 450px at 90% 110%, #1f3847 0%, transparent 60%),
    linear-gradient(165deg, #0a171d, var(--bg));
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

.bg-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(70px);
  z-index: 0;
  pointer-events: none;
}

.bg-orb-a {
  width: 240px;
  height: 240px;
  left: 8%;
  top: 8%;
  background: color-mix(in srgb, var(--accent-2) 55%, transparent);
}

.bg-orb-b {
  width: 280px;
  height: 280px;
  right: 10%;
  bottom: 10%;
  background: color-mix(in srgb, var(--accent) 45%, transparent);
}

.layout {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(260px, 360px) 1fr 1fr;
  grid-template-rows: auto auto;
  max-width: 1580px;
  margin: 0 auto;
  padding: 1.2rem;
}

.panel-form {
  grid-column: 1;
  grid-row: 1 / -1;
}

.panel-3d {
  grid-column: 3;
  grid-row: 1;
}

.panel-result {
  grid-column: 2;
  grid-row: 1;
}

.panel {
  background: color-mix(in srgb, var(--panel) 88%, #000);
  border: 1px solid #2a4b57;
  border-radius: 20px;
  padding: 1.1rem;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
}

h1 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  letter-spacing: 0.02em;
}

.lead {
  color: var(--muted);
  margin-top: 0.4rem;
}

form {
  margin-top: 1rem;
}

.row {
  display: grid;
  gap: 0.7rem;
  margin-bottom: 0.9rem;
}

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

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 600;
  color: #d6ebf2;
}

input {
  border: 1px solid #3a5f6d;
  background: #0d222a;
  color: var(--text);
  border-radius: 12px;
  padding: 0.6rem 0.7rem;
  font-size: 0.98rem;
}

input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent-2) 60%, white);
  outline-offset: 1px;
}

input[type="range"] {
  padding: 0;
  accent-color: #5dd1c8;
}

.slider-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.8rem;
  color: #9fc0ca;
}

.slider-meta button {
  width: auto;
  padding: 0.45rem 0.65rem;
  font-size: 0.8rem;
  border-radius: 9px;
}

.checkbox {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.6rem;
  font-weight: 500;
  margin-bottom: 0.9rem;
}

.hidden {
  display: none;
}

button {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 0.8rem;
  font-weight: 700;
  color: #10222a;
  background: linear-gradient(120deg, var(--accent), #ffd08c);
  cursor: pointer;
  transition: transform 140ms ease, filter 140ms ease;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.progress-wrap {
  margin-top: 0.8rem;
  padding: 0.55rem 0.65rem;
  border-radius: 12px;
  border: 1px solid #31525d;
  background: #0b1d24;
}

.progress-wrap-map {
  margin-top: 0;
  margin-bottom: 0.7rem;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: #b2ccd5;
  margin-bottom: 0.35rem;
}

.progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  border: 1px solid #345a66;
  overflow: hidden;
  background: #08161b;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #5dd1c8 0%, #f4a259 100%);
  transition: width 240ms ease;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pill {
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid #3e5963;
  color: var(--muted);
}

.liftmap-wrap {
  margin-top: 0.85rem;
  border: 1px solid #2f4a54;
  border-radius: 14px;
  padding: 0.7rem;
  background: #0b1c23;
}

.liftmap-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.liftmap-panel-head {
  margin-bottom: 0.7rem;
}

.liftmap-head-side {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.liftmap-head h3 {
  margin: 0;
  font-size: 0.92rem;
  color: #c7dfe7;
}

.map-toggle {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: #9ebec8;
  white-space: nowrap;
}

.north-up-btn {
  width: 2rem;
  min-width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid #416571;
  background: #0d222a;
  color: #eef8fb;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
}

.north-up-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.map-toggle input {
  margin: 0;
}

.meta {
  color: #8eb0ba;
  font-size: 0.78rem;
}

#liftmap-map {
  width: 100%;
  height: 480px;
  border-radius: 10px;
  border: 1px solid #33525e;
  background: #081318;
  overflow: hidden;
}

.leaflet-container {
  background: #081318;
}

.leaflet-map-pane {
  transform-origin: 50% 50%;
}

.legend {
  margin-top: 0.45rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.5rem;
  align-items: center;
  color: #9ebec8;
  font-size: 0.75rem;
}

.legend-bar {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #0b2f6a 0%, #1f8a8a 42%, #f4d35e 70%, #ee964b 84%, #d1495b 100%);
  border: 1px solid #3a5f6d;
}

.metrics {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.7rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metrics article {
  border: 1px solid #2f4a54;
  border-radius: 14px;
  padding: 0.7rem;
  background: #0c1d24;
}

.metrics h3 {
  margin: 0;
  font-size: 0.85rem;
  color: #8eb0ba;
}

.value {
  margin: 0.35rem 0 0;
  font-size: 1.35rem;
  font-weight: 700;
}

.json {
  margin: 0.9rem 0 0;
  max-height: 270px;
  overflow: auto;
  padding: 0.75rem;
  border-radius: 12px;
  border: 1px solid #2f4a54;
  background: #0a181f;
  color: #b8d6df;
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 0.82rem;
}

.reveal {
  opacity: 0;
  transform: translateY(12px);
  animation: rise 520ms ease forwards;
}

.delay {
  animation-delay: 120ms;
}

.delay2 {
  animation-delay: 60ms;
}

#view3d {
  display: block;
  width: 100%;
  height: 480px;
  border-radius: 10px;
  border: 1px solid #33525e;
  background: #081318;
  cursor: grab;
}

#view3d:active {
  cursor: grabbing;
}

.view3d-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.45rem;
  font-size: 0.78rem;
  color: #9ebec8;
}

.view3d-controls label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
  font-weight: 500;
  color: #9ebec8;
  flex: 1;
}

.view3d-controls .view-toggle {
  flex: 0 0 auto;
  font-size: 0.78rem;
  white-space: nowrap;
}

.view-toggle input {
  margin: 0;
}

#vert-scale-label {
  min-width: 2.8rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.blob-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.7rem;
  margin-top: 0.7rem;
  padding-top: 0.55rem;
  border-top: 1px solid #274550;
}

.blob-controls label {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 0.7rem;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 500;
  color: #9ebec8;
}

.blob-controls input {
  grid-column: 1 / 2;
}

.blob-controls span {
  grid-column: 2 / 3;
  grid-row: 1 / 3;
  min-width: 3.8rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

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

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: minmax(260px, 360px) 1fr;
    grid-template-rows: auto auto auto;
  }
  .panel-form  { grid-column: 1; grid-row: 1 / -1; }
  .panel-3d    { grid-column: 2; grid-row: 1; }
  .panel-result{ grid-column: 2; grid-row: 2; }
}

@media (max-width: 700px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }
  .panel-form, .panel-3d, .panel-result {
    grid-column: 1;
    grid-row: auto;
  }
  .row.two {
    grid-template-columns: 1fr;
  }
}

.map-tooltip {
  position: fixed;
  z-index: 1100;
  pointer-events: none;
  background: rgba(8, 20, 26, 0.90);
  color: #c7f0f8;
  font-size: 0.72rem;
  padding: 0.22rem 0.55rem;
  border-radius: 6px;
  border: 1px solid #2c5060;
  white-space: nowrap;
  backdrop-filter: blur(4px);
  transition: opacity 0.12s;
}

.map-tooltip.hidden {
  opacity: 0;
}
