* {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
}

.timeline-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.timeline-heading[hidden] { display: none; }

.time-scale-scroll { overflow-x: auto; }
.time-scale { min-width: 1050px; padding: 4px 14px 12px; }
.time-labels {
  display: grid;
  grid-template-columns: repeat(19, minmax(0, 1fr));
  margin: 0 -14px 12px;
  font-size: 11px;
  text-align: center;
  color: #c2c9e5;
}
.time-labels small { display: block; margin-top: 5px; font-size: 10px; }
.time-labels button {
  border: 0;
  border-radius: 4px;
  padding: 4px 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.time-labels button:hover { background: rgba(114, 255, 191, 0.12); }
.time-labels button:focus-visible { outline: 2px solid #72ffbf; outline-offset: 2px; }
.time-labels button[aria-pressed="true"] { background: rgba(114, 255, 191, 0.18); }
.time-labels .is-now { color: #72ffbf; font-weight: bold; }
.time-slider { display: block; width: 100%; margin: 0; accent-color: #54e9bb; cursor: pointer; }
.time-slider:focus-visible { outline: 2px solid #72ffbf; outline-offset: 6px; }
.time-hint { margin: 10px 0 0; color: #c2c9e5; font-size: 13px; line-height: 1.5; }

/* Световые занавесы по краям: отдельный слой под интерфейсом. */
html { background: #060c1b; }
body::before,
body::after {
  content: "";
  position: fixed;
  top: -20vh;
  bottom: -20vh;
  width: clamp(120px, 23vw, 440px);
  z-index: -1;
  pointer-events: none;
  will-change: transform;
}

body::before {
  left: -5vw;
  background:
    radial-gradient(ellipse at 38% 62%, #37ffb577, transparent 58%),
    radial-gradient(ellipse at 65% 28%, #9965ff88, transparent 48%),
    repeating-linear-gradient(102deg,
      transparent 0% 8%, #66ffcb22 9%, #5cffcbaa 11%,
      #15dcb96b 13%, transparent 17% 23%, #a478ff88 25%,
      transparent 29% 34%);
  background-size: 100% 100%, 100% 100%, 180% 140%;
  mask-image: radial-gradient(ellipse at 25% 50%, #000 18%, transparent 73%);
  filter: blur(13px) saturate(1.5) brightness(1.2);
  opacity: 0.85;
  animation: aurora-drift 14s ease-in-out infinite alternate;
}

body::after {
  right: -5vw;
  background:
    radial-gradient(ellipse at 62% 38%, #53ffc877, transparent 56%),
    radial-gradient(ellipse at 38% 76%, #9255ed88, transparent 48%),
    repeating-linear-gradient(78deg,
      transparent 0% 12%, #24d8bb44 14%, #72ffbfaa 16%,
      transparent 21% 27%, #ad6aff88 30%, transparent 34% 40%);
  background-size: 100% 100%, 100% 100%, 180% 140%;
  mask-image: radial-gradient(ellipse at 75% 50%, #000 18%, transparent 73%);
  filter: blur(15px) saturate(1.5) brightness(1.2);
  animation: aurora-shimmer 12.5s ease-in-out -5.5s infinite alternate;
}

@keyframes aurora-drift {
  0% { transform: translate(-5%, -3%) skewX(-12deg) scale(1.05); opacity: 0.6; }
  50% { transform: translate(5%, 4%) skewX(5deg) scale(1.12, 0.95); opacity: 0.95; }
  100% { transform: translate(2%, -2%) skewX(-7deg) scale(1.02, 1.1); opacity: 0.75; }
}

@keyframes aurora-shimmer {
  0% { transform: translate(5%, 2%) skewX(8deg); opacity: 0.55; }
  50% { transform: translate(-5%, -3%) skewX(-6deg) scale(1.08); opacity: 0.9; }
  100% { transform: translate(2%, 4%) skewX(12deg) scale(0.98, 1.06); opacity: 0.7; }
}

@media (prefers-reduced-motion: reduce) {
  body::before,
  body::after {
    animation: none;
    will-change: auto;
  }
}

body {
  margin: 0;
  min-width: 320px;
  color: #ffffff;
  background: #060c1b;
  isolation: isolate;
  font-family: Arial, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.5;
}

button:hover:not(:disabled) {
  filter: brightness(1.1);
}

.dashboard {
  position: relative;
  z-index: 1;
  width: min(1280px, calc(100% - clamp(30px, 14vw, 260px)));
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px;
  background: #111a38;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 0 5px 20px;
}

.topbar p {
  margin: 0;
  color: #c2c9e5;
}

.eyebrow,
.card-label {
  color: #4e85fc;
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 0.15em;
}

h1 {
  margin: 5px 0 0;
  font-size: clamp(26px, 4vw, 40px);
}

h2 {
  margin: 0;
  font-size: 21px;
}

.status {
  min-height: 24px;
  margin: 0 5px 12px;
  color: #c2c9e5;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(310px, 0.9fr);
  gap: 18px;
}

.map-frame,
.point-card {
  min-height: 535px;
  overflow: hidden;
  border-radius: 20px;
}

.map-frame {
  position: relative;
  background: #093270;
  border: 2px solid #080d1f;
}

.loti-button {
  position: fixed;
  right: 0;
  bottom: 12px;
  z-index: 0;
  width: clamp(160px, 20vw, 280px);
  padding: 0;
  border: 0;
  background: transparent;
}
.loti-button img { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.loti-button .loti-speech {
  position: absolute;
  top: -12%;
  left: 0;
  width: 50%;
  transform: translateY(-50%);
}
.loti-button:focus-visible { outline: 3px solid #72ffbf; outline-offset: 3px; }
.loti-dialog { width: min(620px, calc(100% - 24px)); line-height: 1.6; }
.loti-dialog h2 { font-size: clamp(18px, 4vw, 24px); }
.loti-facts { padding-left: 22px; }
.loti-facts li + li { margin-top: 14px; }
.loti-tip { padding: 14px; border-radius: 12px; background: #72ffbf14; }

#map {
  width: 100%;
  height: 535px;
  background: #093270;
}

.point-card {
  background: #303030;
}

.aurora-image {
  height: 175px;
  background:
    linear-gradient(
      160deg,
      rgba(22, 111, 128, 0.25),
      rgba(0, 0, 0, 0.3)
    ),
    var(--point-image, url("https://images.unsplash.com/photo-1483347756197-71ef80e95f73?auto=format&fit=crop&w=900&q=80"))
    center / cover;
}

.point-content {
  padding: 16px 20px 20px;
  text-align: center;
}

.point-content h2 {
  margin-top: 6px;
}

.coordinates {
  min-height: 20px;
  margin: 7px 0 14px;
  color: #c4c4c4;
  font-size: 13px;
}

.route-button {
  width: 100%;
  margin-bottom: 10px;
  padding: 12px;
  color: #ffffff;
  font-weight: bold;
  background: #484848;
  border: 0;
  border-radius: 23px;
}

.metrics {
  display: grid;
  gap: 8px;
}

.metric {
  width: 100%;
  color: inherit;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 8px 15px;
  background: #484848;
  border-radius: 23px;
}

.metric span {
  font-size: 13px;
  font-weight: bold;
  text-align: left;
}

.metric strong {
  color: #4e85fc;
  white-space: nowrap;
}

.metric:focus-visible { outline: 2px solid #72ffbf; outline-offset: 3px; }
.metric-control.needs-selection .metric { pointer-events: none; }
.metric:hover:not(:disabled) { border-color: #72ffbf; }
.metric-dialog {
  width: min(900px, calc(100% - 24px));
  max-height: 90vh;
  padding: clamp(16px, 3vw, 28px);
  color: #ffffff;
  background: #111a38;
  border: 1px solid #526bc4;
  border-radius: 20px;
}
.metric-dialog::backdrop { background: #030818cc; }
.metric-dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.metric-chart svg { display: block; width: 100%; height: auto; }

.timeline {
  margin: 22px 0;
  padding: 10px 22px 14px;
  background: #303030;
  border-radius: 20px;
}

.timeline-labels {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  align-items: center;
  color: #aaaaaa;
  font-size: 12px;
  text-align: center;
}

.timeline-labels b {
  color: white;
}

.timeline-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.timeline-control button {
  padding: 0 4px;
  color: white;
  font-size: 32px;
  line-height: 1;
  background: transparent;
  border: 0;
}

.timeline-line {
  position: relative;
  flex: 1;
  height: 24px;
  background: #4e85fc;
  border-radius: 3px;
}

.timeline-progress {
  position: absolute;
  inset: 0 53% 0 0;
  background: #4076e9;
}

.timeline-now {
  position: absolute;
  top: -12px;
  bottom: -14px;
  left: 53%;
  border-left: 2px solid #e11;
}

.comparison-panel {
  padding: 20px;
  background: #303030;
  border: 1px solid #4b4b4b;
  border-radius: 18px;
}

.comparison-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.secondary-button {
  padding: 10px 15px;
  color: #ffffff;
  background: #484848;
  border: 0;
  border-radius: 20px;
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th,
td {
  padding: 12px;
  white-space: nowrap;
  border-bottom: 1px solid #555555;
}

th {
  color: #bdc6e4;
  font-size: 14px;
}

.route-control {
  position: relative;
}

.route-hint {
  position: absolute;
  z-index: 10;
  bottom: calc(100% + 8px);
  left: 0;
  right: 0;
  padding: 12px;
  color: #ffffff;
  background: #111a38d9;
  border: 1px solid #4e85fc;
  border-radius: 12px;
  box-shadow: 0 6px 20px #0008;
  font-size: 14px;
  line-height: 1.4;
  pointer-events: none;
  visibility: hidden;
}

.route-control.needs-selection:hover .route-hint,
.route-control.needs-selection:focus-within .route-hint {
  visibility: visible;
}

.route-control:focus-visible,
.sort-button:focus-visible {
  outline: 2px solid #4e85fc;
  outline-offset: 3px;
}

.sort-button {
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  text-align: inherit;
  font-weight: bold;
}

.sort-button span {
  margin-left: 5px;
  color: #4e85fc;
}

#comparison-body td:nth-child(2),
#comparison-body td:nth-child(3),
#comparison-body td:nth-child(5) {
  text-align: center;
}

.badge {
  display: inline-block;
  transform: translateX(-8px);
  padding: 4px 9px;
  background: #484848;
  border-radius: 20px;
}

.visibility-info {
  margin-top: 28px;
  padding: clamp(16px, 3vw, 24px);
  color: #c2c9e5;
  background: #0c142d;
  border: 1px solid #526bc466;
  border-radius: 20px;
  line-height: 1.7;
}

.visibility-info h2 {
  color: #ffffff;
  line-height: 1.4;
}

.visibility-info p {
  margin: 16px 0 0;
}

.visibility-info strong {
  color: #ffffff;
}

.visibility-info .visibility-disclaimer {
  padding: 14px 16px;
  background: #4e85fc14;
  border-left: 3px solid #72ffbf;
  border-radius: 0 10px 10px 0;
}

.balloon {
  min-width: 220px;
  color: #202020;
  font: 14px/1.5 Arial, sans-serif;
}

.balloon h3 {
  margin: 0 0 8px;
}

.balloon p {
  margin: 5px 0;
}

@media (max-width: 800px) {
  .dashboard {
    width: calc(100% - 16px);
    padding: 15px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .map-frame,
  .point-card,
  #map {
    min-height: 420px;
    height: 420px;
  }
}

@media (max-width: 560px) {
  .timeline {
    padding-right: 10px;
    padding-left: 10px;
  }

  .timeline-labels span:nth-child(even) {
    display: none;
  }

  .timeline-labels {
    grid-template-columns: repeat(6, 1fr);
  }

  .metric {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
    border-radius: 15px;
  }
}
