:root {
  --bg: #efe6d6;
  --bg-deep: #dfd3bd;
  --panel: rgba(255, 252, 246, 0.92);
  --panel-border: rgba(71, 52, 29, 0.12);
  --ink: #24180f;
  --muted: #6a5846;
  --accent: #0f5f73;
  --accent-strong: #193f57;
  --accent-soft: rgba(15, 95, 115, 0.12);
  --shadow: 0 20px 44px rgba(50, 34, 16, 0.13);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(184, 139, 74, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(15, 95, 115, 0.14), transparent 28%),
    linear-gradient(180deg, #f8f3ea 0%, var(--bg) 100%);
  color: var(--ink);
  font-family: "Segoe UI", Tahoma, sans-serif;
}

body {
  padding: 20px;
}

a {
  color: var(--accent-strong);
}

button,
input,
select {
  font: inherit;
}

.page-shell {
  max-width: 1900px;
  margin: 0 auto;
}

.protocol-warning {
  margin-bottom: 16px;
  padding: 14px 18px;
  border-radius: 18px;
  background: rgba(143, 76, 13, 0.14);
  border: 1px solid rgba(143, 76, 13, 0.2);
  color: #6b3b08;
  line-height: 1.55;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 30px;
  border-radius: 28px;
  background: rgba(255, 251, 242, 0.86);
  border: 1px solid rgba(71, 52, 29, 0.1);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.timeline-panel {
  margin-top: 18px;
  padding: 22px 26px;
  border-radius: 24px;
  background: rgba(255, 251, 242, 0.9);
  border: 1px solid rgba(71, 52, 29, 0.1);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.timeline-header h2 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 1.4rem;
}

.timeline-note {
  max-width: 44ch;
  margin: 0;
  line-height: 1.6;
  color: var(--muted);
}

.timeline-toolbar {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  margin-top: 18px;
  flex-wrap: wrap;
}

.timeline-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  flex: 1;
}

.compact-field {
  margin-bottom: 0;
  min-width: 128px;
}

.compact-field input,
.compact-field select {
  min-height: 44px;
  padding: 10px 12px;
}

.timeline-date-field {
  min-width: 190px;
}

.secondary-button {
  border: 1px solid rgba(71, 52, 29, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  padding: 11px 15px;
  cursor: pointer;
  font-weight: 700;
}

.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.icon-button,
.timeline-play-button {
  width: auto;
}

.timeline-canvas-shell {
  margin-top: 18px;
}

.timeline-canvas-wrap {
  position: relative;
  height: 188px;
  border-radius: 22px;
  border: 1px solid rgba(71, 52, 29, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(244, 237, 224, 0.9)),
    radial-gradient(circle at top, rgba(15, 95, 115, 0.12), transparent 58%);
  overflow: hidden;
}

#timeline-canvas {
  display: block;
  width: 100%;
  height: 164px;
  margin-top: 12px;
}

.timeline-selection {
  position: absolute;
  top: 16px;
  bottom: 28px;
  display: flex;
  align-items: stretch;
  border: 1px solid rgba(15, 95, 115, 0.44);
  border-radius: 16px;
  background: rgba(15, 95, 115, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.timeline-selection-body {
  flex: 1;
  cursor: grab;
  background:
    linear-gradient(90deg, rgba(15, 95, 115, 0.12), rgba(209, 138, 52, 0.14)),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.28),
      rgba(255, 255, 255, 0.28) 8px,
      rgba(255, 255, 255, 0.08) 8px,
      rgba(255, 255, 255, 0.08) 16px
    );
}

.timeline-handle {
  width: 14px;
  border: none;
  padding: 0;
  background: rgba(15, 95, 115, 0.9);
  cursor: ew-resize;
}

.timeline-handle-left {
  border-radius: 15px 0 0 15px;
}

.timeline-handle-right {
  border-radius: 0 15px 15px 0;
}

.timeline-playback-marker {
  position: absolute;
  top: 10px;
  bottom: 18px;
  width: 2px;
  background: linear-gradient(180deg, rgba(194, 106, 27, 0.92), rgba(15, 95, 115, 0.22));
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
  pointer-events: none;
}

.timeline-playback-marker::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  width: 18px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(180deg, #f7d76e, #d9792b);
  transform: translateX(-50%);
  box-shadow: 0 3px 10px rgba(217, 121, 43, 0.38);
}

.timeline-ticks {
  position: relative;
  height: 28px;
  margin-top: 10px;
}

.timeline-tick {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
}

.timeline-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-top: 16px;
}

.timeline-footer-copy {
  display: grid;
  gap: 6px;
}

.startup-panel {
  margin-top: 18px;
  padding: 22px 26px;
  border-radius: 24px;
  background: rgba(255, 251, 242, 0.86);
  border: 1px solid rgba(71, 52, 29, 0.1);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.startup-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.startup-header h2 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 1.4rem;
}

.startup-progress {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
}

.startup-progress-track {
  flex: 1;
  height: 12px;
  border-radius: 999px;
  background: rgba(15, 95, 115, 0.1);
  overflow: hidden;
  border: 1px solid rgba(15, 95, 115, 0.12);
}

.startup-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-strong), var(--accent), #d18a34);
  transition: width 180ms ease;
}

.startup-progress-label {
  min-width: 48px;
  text-align: right;
  font-weight: 700;
  color: var(--accent-strong);
}

.startup-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.startup-metric {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(71, 52, 29, 0.09);
}

.startup-metric-label {
  display: block;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.startup-metric strong {
  display: block;
  margin-top: 8px;
  font-size: 1rem;
}

.startup-meta {
  margin-top: 16px;
}

.startup-error {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(143, 76, 13, 0.12);
  border: 1px solid rgba(143, 76, 13, 0.18);
  color: #7c4005;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.78rem;
  color: var(--accent);
}

.hero h1 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: clamp(2.1rem, 3.8vw, 3.8rem);
  line-height: 0.95;
}

.hero-text {
  margin: 14px 0 0;
  max-width: 66ch;
  color: var(--muted);
  line-height: 1.6;
}

.hero-stats {
  display: flex;
  gap: 14px;
  align-items: stretch;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.stat-card {
  min-width: 146px;
  padding: 16px 18px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(245, 237, 223, 0.86));
  border: 1px solid rgba(71, 52, 29, 0.1);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stat-label {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.stat-card strong {
  margin-top: 8px;
  font-size: 1.45rem;
  font-weight: 700;
}

.layout {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(420px, 1fr) minmax(340px, 420px);
  gap: 20px;
  margin-top: 22px;
}

.controls-panel,
.map-panel,
.inspector-panel {
  min-height: 78vh;
  border-radius: 28px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.controls-panel,
.inspector-panel {
  padding: 22px;
  overflow: auto;
}

.panel-section + .panel-section {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid rgba(71, 52, 29, 0.12);
}

.panel-section h2 {
  margin: 0 0 14px;
  font-family: Georgia, serif;
  font-size: 1.16rem;
}

.field,
.checkbox-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

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

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

input[type="search"],
input[type="text"],
select {
  width: 100%;
  border: 1px solid rgba(71, 52, 29, 0.18);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  padding: 12px 14px;
}

select {
  min-height: 120px;
}

input:focus,
select:focus,
button:focus {
  outline: 2px solid rgba(15, 95, 115, 0.25);
  outline-offset: 1px;
}

.checkbox-field {
  flex-direction: row;
  align-items: flex-start;
}

.checkbox-field input {
  margin-top: 4px;
}

.status-copy,
.note-copy {
  margin: 0;
  line-height: 1.6;
  color: var(--muted);
}

.legend {
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(71, 52, 29, 0.1);
}

.legend-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.legend-title {
  font-weight: 700;
}

.legend-body {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.88rem;
  color: var(--muted);
}

.legend-item-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 1px solid rgba(42, 30, 20, 0.18);
  flex-shrink: 0;
}

.fit-button,
.popup-open-button {
  width: 100%;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 700;
}

.fit-button {
  margin-top: 14px;
}

.map-panel {
  padding: 12px;
}

#map {
  width: 100%;
  height: calc(78vh - 24px);
  border-radius: 22px;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 20%, rgba(15, 95, 115, 0.16), transparent 22%),
    radial-gradient(circle at 75% 35%, rgba(184, 139, 74, 0.18), transparent 24%),
    linear-gradient(180deg, #f5f0e5 0%, var(--bg-deep) 100%);
}

.ufo-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.88);
  box-shadow: 0 0 0 1px rgba(32, 18, 4, 0.18), 0 2px 8px rgba(32, 18, 4, 0.24);
}

.playback-cursor-icon,
.playback-active-icon {
  background: transparent;
  border: none;
}

.playback-cursor {
  position: relative;
  width: 20px;
  height: 12px;
  pointer-events: none;
}

.playback-cursor::before,
.playback-cursor::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.playback-cursor::before {
  top: 0;
  width: 18px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(180deg, #f6d26b, #d57628);
  box-shadow: 0 4px 10px rgba(217, 121, 43, 0.42);
}

.playback-cursor::after {
  top: 6px;
  width: 10px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 250, 214, 0.86);
}

.playback-active-marker {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.95);
  background: radial-gradient(circle, rgba(255, 250, 214, 0.98) 0%, rgba(209, 138, 52, 0.92) 58%, rgba(15, 95, 115, 0.85) 100%);
  box-shadow: 0 0 0 1px rgba(32, 18, 4, 0.2), 0 0 24px rgba(217, 121, 43, 0.34);
  animation: playbackPulse 1.2s ease-in-out infinite;
}

.playback-trail-line {
  stroke-linecap: round;
}

.popup-content {
  line-height: 1.45;
}

.popup-title {
  margin: 0 0 8px;
  font-family: Georgia, serif;
  font-size: 1.05rem;
}

.popup-row {
  margin: 4px 0;
}

.popup-label {
  font-weight: 700;
}

.popup-open-button {
  margin-top: 10px;
}

.result-list {
  display: grid;
  gap: 10px;
}

.result-card {
  width: 100%;
  padding: 14px;
  text-align: left;
  border-radius: 18px;
  border: 1px solid rgba(71, 52, 29, 0.1);
  background: rgba(255, 255, 255, 0.76);
  cursor: pointer;
  color: inherit;
}

.result-card.is-active {
  border-color: rgba(15, 95, 115, 0.4);
  box-shadow: inset 0 0 0 1px rgba(15, 95, 115, 0.18);
}

.result-card.is-playback {
  border-color: rgba(209, 138, 52, 0.48);
  box-shadow: inset 0 0 0 1px rgba(209, 138, 52, 0.18);
}

.result-card-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}

.result-date {
  font-weight: 700;
}

.result-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.badge-mapped {
  background: rgba(20, 104, 63, 0.12);
  color: #14683f;
}

.badge-unmapped {
  background: rgba(143, 76, 13, 0.12);
  color: #8f4c0d;
}

.badge-precision {
  background: rgba(15, 95, 115, 0.12);
  color: var(--accent-strong);
}

.result-location {
  margin-top: 8px;
  font-weight: 600;
}

.result-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.92rem;
}

.detail-panel {
  display: grid;
  gap: 16px;
}

.detail-header {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(71, 52, 29, 0.1);
}

.detail-title {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 1.2rem;
}

.detail-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
}

.detail-grid {
  display: grid;
  gap: 8px;
}

.detail-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(71, 52, 29, 0.08);
}

.detail-label {
  color: var(--muted);
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.detail-value {
  word-break: break-word;
}

.detail-block {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(71, 52, 29, 0.1);
}

.detail-block h4 {
  margin: 0 0 10px;
  font-family: Georgia, serif;
  font-size: 1rem;
}

.detail-list {
  margin: 0;
  padding-left: 18px;
}

.detail-list li + li {
  margin-top: 6px;
}

.detail-pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(244, 239, 228, 0.92);
  border-radius: 14px;
  padding: 12px;
  overflow: auto;
}

.detail-json {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(71, 52, 29, 0.1);
}

.detail-json summary {
  cursor: pointer;
  font-weight: 700;
}

.leaflet-container {
  font-family: "Segoe UI", Tahoma, sans-serif;
}

.leaflet-interactive.land-outline {
  fill: rgba(116, 121, 118, 0.14);
  stroke: rgba(63, 66, 63, 0.34);
}

.cluster-icon {
  background: transparent;
  border: none;
}

.cluster-bubble {
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 16px rgba(32, 18, 4, 0.2);
  background: linear-gradient(135deg, rgba(15, 95, 115, 0.86), rgba(25, 63, 87, 0.94));
  color: #fff;
  font-weight: 700;
  font-size: 0.84rem;
}

.cluster-bubble.cluster-bubble-large {
  min-width: 46px;
  height: 46px;
  font-size: 0.92rem;
}

@keyframes playbackPulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.9;
  }

  50% {
    transform: scale(1.16);
    opacity: 1;
  }
}

@media (max-width: 1420px) {
  .layout {
    grid-template-columns: minmax(300px, 360px) minmax(420px, 1fr);
  }

  .startup-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .timeline-header,
  .timeline-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .inspector-panel {
    grid-column: 1 / -1;
    min-height: auto;
  }
}

@media (max-width: 1080px) {
  body {
    padding: 14px;
  }

  .hero {
    flex-direction: column;
  }

  .timeline-toolbar,
  .startup-header,
  .startup-progress {
    flex-direction: column;
    align-items: stretch;
  }

  .timeline-controls {
    width: 100%;
  }

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

  .controls-panel,
  .map-panel,
  .inspector-panel {
    min-height: auto;
  }

  #map {
    height: 68vh;
  }
}

@media (max-width: 640px) {
  .hero-stats {
    flex-direction: column;
  }

  .stat-card {
    min-width: 0;
  }

  .two-column {
    grid-template-columns: 1fr;
  }

  .timeline-date-field,
  .compact-field {
    min-width: 0;
  }

  .startup-metrics {
    grid-template-columns: 1fr;
  }

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