:root {
  color-scheme: dark;
  --bg: #08131d;
  --panel: rgba(9, 22, 34, 0.9);
  --panel-strong: rgba(10, 28, 44, 0.96);
  --border: rgba(255, 255, 255, 0.12);
  --text: #edf7f6;
  --muted: #a9c4c8;
  --accent: #ff8757;
  --accent-strong: #ff6433;
  --accent-cool: #ffbf70;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(255, 135, 87, 0.18), transparent 24%),
    radial-gradient(circle at bottom right, rgba(43, 95, 154, 0.35), transparent 28%),
    linear-gradient(180deg, #08131d 0%, #091521 100%);
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

body {
  min-height: 100vh;
}

h2,
p {
  margin: 0;
}

.app-shell,
.viewer-panel {
  min-height: 100vh;
}

.viewer-panel {
  position: relative;
}

#cesiumContainer {
  width: 100%;
  height: 100vh;
}

.marker-popup-layer {
  position: fixed;
  inset: 0;
  z-index: 18;
  pointer-events: none;
}

.marker-popup {
  position: absolute;
  display: none;
  min-width: 180px;
  max-width: min(280px, calc(100vw - 20px));
  padding: 10px 12px;
  background:
    linear-gradient(130deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.04)),
    rgba(8, 14, 22, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 12px;
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  color: #f3f6fa;
}

.marker-popup-title {
  margin: 0 0 8px;
  font-size: 0.86rem;
  line-height: 1.35;
  font-weight: 700;
  color: #f7fbff;
}

.marker-popup-body {
  display: grid;
  gap: 4px;
  font-size: 0.74rem;
  line-height: 1.45;
}

.marker-popup-row {
  display: grid;
  grid-template-columns: 68px 1fr;
  gap: 8px;
}

.marker-popup-label {
  color: rgba(216, 227, 238, 0.72);
}

.marker-popup-value {
  color: rgba(243, 246, 250, 0.96);
  word-break: break-word;
}

.marker-popup-leader {
  position: absolute;
  display: none;
  height: 1px;
  background: rgba(230, 242, 255, 0.45);
  box-shadow: 0 0 4px rgba(143, 211, 255, 0.2);
  transform-origin: 0 50%;
}

.marker-popup-layer {
  position: fixed;
  inset: 0;
  z-index: 18;
  pointer-events: none;
}

.marker-popup {
  position: absolute;
  display: none;
  min-width: 180px;
  max-width: min(280px, calc(100vw - 20px));
  padding: 10px 12px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.05)),
    rgba(9, 20, 32, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 14px;
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
  backdrop-filter: blur(14px) saturate(124%);
  -webkit-backdrop-filter: blur(14px) saturate(124%);
  color: #f3f8ff;
}

.marker-popup-title {
  margin: 0 0 8px;
  font-size: 0.86rem;
  line-height: 1.35;
  font-weight: 700;
}

.marker-popup-body {
  display: grid;
  gap: 4px;
  font-size: 0.74rem;
  line-height: 1.45;
  color: rgba(243, 248, 255, 0.9);
}

.marker-popup-row {
  display: grid;
  grid-template-columns: 68px 1fr;
  gap: 8px;
}

.marker-popup-label {
  color: rgba(201, 214, 227, 0.7);
}

.marker-popup-value {
  color: rgba(247, 251, 255, 0.94);
  word-break: break-word;
}

.marker-popup-leader {
  position: absolute;
  display: none;
  height: 1px;
  background: rgba(235, 242, 250, 0.42);
  box-shadow: 0 0 6px rgba(143, 211, 255, 0.16);
  transform-origin: 0 50%;
}

.config-toggle {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 30;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  font: inherit;
  color: var(--text);
  background: rgba(8, 20, 32, 0.54);
  backdrop-filter: blur(16px) saturate(140%);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  cursor: pointer;
}

.config-toggle-icon {
  font-size: 1.08rem;
  line-height: 1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.navigator-panel {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 28;
  width: 62px;
  padding: 10px 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.035)),
    rgba(8, 20, 32, 0.54);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.nav-icon-button,
.zoom-button {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  cursor: pointer;
}

.nav-icon-button {
  position: relative;
  display: block;
  width: 28px;
  height: 28px;
  margin: 0 auto;
  padding: 0;
}

.nav-icon-button + .nav-icon-button {
  margin-top: 6px;
}

.nav-icon-button[aria-pressed="true"] {
  border-color: rgba(255, 135, 87, 0.58);
  background: rgba(255, 135, 87, 0.18);
}

.nav-home-icon::before,
.nav-rotate-icon::before,
.nav-rotate-icon::after,
.nav-sun-icon::before,
.nav-sun-icon::after,
.nav-wind-icon::before,
.nav-wind-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.nav-home-icon::before {
  width: 14px;
  height: 12px;
  background: var(--accent-cool);
  clip-path: polygon(
    50% 0,
    100% 38%,
    86% 38%,
    86% 100%,
    60% 100%,
    60% 68%,
    40% 68%,
    40% 100%,
    14% 100%,
    14% 38%,
    0 38%
  );
}

.nav-rotate-icon::before {
  width: 14px;
  height: 14px;
  border: 2px solid var(--accent-cool);
  border-right-color: transparent;
  border-radius: 999px;
}

.nav-rotate-icon::after {
  width: 0;
  height: 0;
  margin-left: 6px;
  margin-top: -5px;
  border-style: solid;
  border-width: 4px 0 4px 6px;
  border-color: transparent transparent transparent var(--accent-cool);
}

.nav-sun-icon::before {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--accent-cool);
  box-shadow: 0 0 10px rgba(255, 191, 112, 0.32);
}

.nav-sun-icon::after {
  width: 17px;
  height: 17px;
  background: var(--accent-cool);
  clip-path: polygon(
    47% 0,
    53% 0,
    55% 25%,
    74% 7%,
    79% 12%,
    63% 32%,
    100% 47%,
    100% 53%,
    63% 68%,
    79% 88%,
    74% 93%,
    55% 75%,
    53% 100%,
    47% 100%,
    45% 75%,
    26% 93%,
    21% 88%,
    37% 68%,
    0 53%,
    0 47%,
    37% 32%,
    21% 12%,
    26% 7%,
    45% 25%
  );
  opacity: 0.7;
}

.nav-wind-icon::before {
  width: 17px;
  height: 11px;
  border-top: 3px solid var(--accent-cool);
  border-bottom: 3px solid var(--accent-cool);
  border-radius: 999px;
  clip-path: polygon(0 0, 100% 0, 100% 45%, 18% 45%, 18% 55%, 82% 55%, 82% 100%, 0 100%);
}

.nav-wind-icon::after {
  width: 7px;
  height: 7px;
  margin-left: 4px;
  margin-top: -6px;
  border-top: 3px solid var(--accent-cool);
  border-right: 3px solid var(--accent-cool);
  border-radius: 0 999px 0 0;
}

.nav-zoom {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
}

.nav-zoom::before {
  content: "";
  position: absolute;
  top: 34px;
  bottom: 34px;
  left: 50%;
  width: 6px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 135, 87, 0.95), rgba(255, 191, 112, 0.42));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.22),
    0 0 14px rgba(255, 135, 87, 0.24);
  transform: translateX(-50%);
  pointer-events: none;
}

.zoom-button {
  position: relative;
  z-index: 1;
  width: 22px;
  height: 22px;
  padding: 0;
  color: #ffd0a0;
  font: 700 0.95rem/1 "Avenir Next", "Segoe UI", sans-serif;
}

.zoom-slider {
  position: relative;
  z-index: 1;
  width: 20px;
  height: 92px;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: var(--accent);
  writing-mode: vertical-lr;
  direction: rtl;
}

.zoom-slider::-webkit-slider-runnable-track {
  width: 6px;
  height: 92px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 135, 87, 0.9), rgba(255, 191, 112, 0.48));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.2),
    0 0 12px rgba(255, 135, 87, 0.2);
}

.zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  margin-left: -5px;
  border: 2px solid rgba(255, 248, 241, 0.92);
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 4px 14px rgba(255, 100, 51, 0.28);
}

.zoom-slider::-moz-range-track {
  width: 6px;
  height: 92px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 135, 87, 0.9), rgba(255, 191, 112, 0.48));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.2),
    0 0 12px rgba(255, 135, 87, 0.2);
}

.zoom-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 248, 241, 0.92);
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 4px 14px rgba(255, 100, 51, 0.28);
}

.config-backdrop {
  position: fixed;
  inset: 0;
  z-index: 24;
  background: rgba(3, 10, 16, 0.42);
  backdrop-filter: blur(6px);
}

.config-panel {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 25;
  width: min(364px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  overflow-y: auto;
  max-height: calc(100vh - 124px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03)),
    rgba(8, 19, 29, 0.48);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 22px;
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(22px) saturate(135%);
  transform: translateX(-110%);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 220ms ease,
    opacity 220ms ease;
}

.config-panel.is-open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.config-panel-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 2px 2px 0 56px;
}

.config-panel-header h2 {
  width: 100%;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(237, 247, 246, 0.9);
  text-align: right;
}

button,
input,
select {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
}

button {
  cursor: pointer;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.config-close:hover,
button:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.28);
}

button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  border-color: transparent;
  color: #fff8f1;
  font-weight: 600;
}

.panel-card {
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
    rgba(7, 20, 31, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(16px) saturate(130%);
}

.panel-card-tight {
  padding: 14px;
}

.panel-card h2 {
  margin-bottom: 12px;
  font-size: 0.84rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(237, 247, 246, 0.82);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 10px;
}

.field span {
  color: var(--muted);
  font-size: 0.78rem;
}

input,
select {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 10px 12px;
}

input::placeholder {
  color: rgba(237, 247, 246, 0.35);
}

.two-up {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.button-row {
  display: flex;
  gap: 12px;
}

.button-row button {
  flex: 1;
}

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

.stats div {
  padding: 11px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.stats dt {
  color: var(--muted);
  font-size: 0.72rem;
  margin-bottom: 5px;
}

.stats dd {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 600;
  line-height: 1.25;
  word-break: break-word;
}

.status {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.4;
  font-size: 0.8rem;
}

.status.error {
  color: #ff9b88;
}

.legend {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.8rem;
}

.legend-inline {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.legend-inline li {
  padding: 8px 9px;
  justify-content: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.06);
  white-space: nowrap;
}

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 999px;
}

.swatch.hot {
  background: #8f001a;
}

.swatch.warm {
  background: #d86d1f;
}

.swatch.cool {
  background: #fff4bf;
}

.timeline-dock {
  position: fixed;
  right: 18px;
  bottom: 18px;
  left: 18px;
  z-index: 20;
  max-width: min(1280px, calc(100vw - 36px));
  margin: 0 auto;
  padding: 2px 6px;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.latest-data-badge {
  position: absolute;
  top: -28px;
  right: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: calc(100vw - 36px);
  padding: 4px 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(9, 22, 34, 0.58);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16);
  color: rgba(247, 251, 255, 0.94);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  pointer-events: none;
}

.latest-data-badge[hidden] {
  display: none;
}

.latest-data-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 1 auto;
  min-width: 0;
}

.latest-data-item span {
  color: var(--muted);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  line-height: 1;
  white-space: nowrap;
}

.latest-data-item strong {
  overflow: hidden;
  font-size: 0.72rem;
  line-height: 1.1;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.latest-data-divider {
  width: 1px;
  height: 13px;
  background: rgba(255, 255, 255, 0.14);
}

.latest-data-next strong {
  color: #ffd0a0;
}

.timeline-handle-bubble strong {
  font-size: 0.72rem;
  line-height: 1.1;
  font-weight: 600;
  white-space: nowrap;
}

.timeline-slider-row {
  position: relative;
  overflow: visible;
}

.timeline-slider-row::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 0;
  left: 0;
  height: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  transform: translateY(-50%);
}

.timeline-slider-row-large {
  height: 68px;
  width: calc(100% + 24px);
  margin-left: -12px;
}

.timeline-gradient-track {
  position: absolute;
  top: 50%;
  left: 0;
  width: 0;
  height: 20px;
  border-radius: 999px;
  background: linear-gradient(90deg, #fff4bf 0%, #f5d46b 72%, #d86d1f 90%, #8f001a 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.18),
    0 10px 26px rgba(0, 0, 0, 0.2);
  transform: translateY(-50%);
  pointer-events: auto;
  cursor: grab;
  z-index: 1;
}

.timeline-gradient-track.is-dragging {
  cursor: grabbing;
}

.timeline-handle-bubble {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  width: max-content;
  min-width: 0;
  max-width: none;
  padding: 3px 8px;
  border-radius: 10px;
  background: rgba(9, 22, 34, 0.56);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(14px) saturate(120%);
  transform: translateX(-50%);
  pointer-events: none;
}

.timeline-handle-bubble-bottom {
  top: auto;
  bottom: 0;
}

.timeline-slider-row input[type="range"] {
  position: absolute;
  right: 0;
  left: 0;
  top: 50%;
  width: 100%;
  margin: 0;
  padding: 0;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border: 0;
  transform: translateY(-50%);
  z-index: 2;
}

.timeline-slider-row input[type="range"]::-webkit-slider-runnable-track {
  height: 20px;
  border-radius: 999px;
  background: transparent;
}

.timeline-slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -1px;
  border-radius: 999px;
  border: 2px solid rgba(255, 248, 241, 0.94);
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 6px 16px rgba(255, 100, 51, 0.24);
  pointer-events: auto;
}

.timeline-slider-row input[type="range"]::-moz-range-track {
  height: 20px;
  border-radius: 999px;
  background: transparent;
}

.timeline-slider-row input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 2px solid rgba(255, 248, 241, 0.94);
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 6px 16px rgba(255, 100, 51, 0.24);
  pointer-events: auto;
}

.cesium-viewer-toolbar,
.cesium-viewer-animationContainer,
.cesium-viewer-timelineContainer,
.cesium-viewer-bottom,
.cesium-selection-wrapper,
.cesium-viewer-infoBoxContainer {
  display: none !important;
}

@media (max-width: 900px) {
  .config-toggle {
    top: 14px;
    left: 14px;
  }

  .navigator-panel {
    top: 14px;
    right: 14px;
  }

  .config-panel {
    top: 14px;
    right: 14px;
    left: 14px;
    width: auto;
    max-height: calc(100vh - 124px);
  }

  .timeline-dock {
    right: 14px;
    bottom: 14px;
    left: 14px;
    padding: 2px 6px;
  }

  .latest-data-badge {
    top: -26px;
    max-width: calc(100vw - 28px);
  }

  .timeline-handle-bubble {
    max-width: none;
  }

  .two-up,
  .stats {
    grid-template-columns: 1fr;
  }

  .legend-inline {
    grid-template-columns: 1fr;
  }

  .marker-popup {
    max-width: min(240px, calc(100vw - 20px));
  }
}

@media (max-width: 640px) {
  .navigator-panel {
    top: 12px;
    right: 12px;
    width: 58px;
    padding: 9px 5px;
    border-radius: 14px;
  }

  .latest-data-badge {
    top: -32px;
    right: auto;
    left: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(74px, auto);
    width: 100%;
    max-width: none;
    padding: 5px 8px;
  }

  .timeline-slider-row-large {
    height: 56px;
  }

  .timeline-handle-bubble {
    padding: 2px 8px;
  }

  .latest-data-item {
    gap: 5px;
  }

  .latest-data-item strong {
    font-size: 0.68rem;
  }

  .latest-data-next {
    justify-self: end;
  }
}
