* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #000;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
}

canvas {
  display: block;
}

/* Модальное окно */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  pointer-events: none;
}

.modal.hidden {
  display: none;
}

.modal-inner {
  position: relative;
  background: rgba(8, 14, 30, 0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(120, 180, 255, 0.25);
  border-radius: 16px;
  padding: 32px 36px 28px;
  min-width: 320px;
  max-width: 460px;
  width: 90vw;
  pointer-events: all;
  box-shadow: 0 0 60px rgba(80, 140, 255, 0.15), 0 8px 32px rgba(0,0,0,0.6);
  animation: modalIn 0.22s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.92) translateY(12px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  color: rgba(180, 210, 255, 0.6);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  transition: color 0.15s;
}
.modal-close:hover { color: #fff; }

.modal-icon {
  font-size: 42px;
  text-align: center;
  margin-bottom: 8px;
  line-height: 1;
}

.modal-title {
  text-align: center;
  color: #e8f0ff;
  font-family: Arial, sans-serif;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 20px;
  letter-spacing: 0.03em;
}

.modal-table {
  width: 100%;
  border-collapse: collapse;
  font-family: Arial, sans-serif;
  font-size: 13px;
}

.modal-table tr {
  border-bottom: 1px solid rgba(120, 180, 255, 0.1);
}
.modal-table tr:last-child { border-bottom: none; }

.modal-table td {
  padding: 7px 4px;
  vertical-align: top;
  line-height: 1.4;
}

.modal-table td:first-child {
  color: rgba(140, 190, 255, 0.75);
  white-space: nowrap;
  padding-right: 16px;
  width: 45%;
}

.modal-table td:last-child {
  color: #ddeeff;
}

/* ---- Панель управления ---- */
.controls {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(8, 14, 30, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(120, 180, 255, 0.2);
  border-radius: 40px;
  padding: 8px 18px;
  z-index: 200;
  user-select: none;
}

.ctrl-btn {
  background: none;
  border: none;
  color: rgba(180, 210, 255, 0.8);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
  line-height: 1;
}
.ctrl-btn:hover {
  background: rgba(100, 160, 255, 0.15);
  color: #fff;
}
.ctrl-btn.active {
  color: #ffdd00;
}

.ctrl-speed {
  color: rgba(180, 210, 255, 0.7);
  font-family: Arial, sans-serif;
  font-size: 13px;
  min-width: 32px;
  text-align: center;
}

/* ---- Разделитель в панели управления ---- */
.ctrl-divider {
  width: 1px;
  height: 22px;
  background: rgba(120,180,255,0.2);
  margin: 0 4px;
}

/* ---- Боковая панель ---- */
.side-panel {
  position: fixed;
  top: 50%;
  right: 24px;
  transform: translateY(-50%);
  width: 220px;
  background: rgba(8,14,30,0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(120,180,255,0.22);
  border-radius: 14px;
  padding: 20px 18px 18px;
  z-index: 150;
  animation: slideIn 0.22s ease;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(-50%) translateX(20px); }
  to   { opacity: 1; transform: translateY(-50%) translateX(0); }
}
.side-panel.hidden { display: none; }

.side-close {
  position: absolute;
  top: 10px; right: 12px;
  background: none; border: none;
  color: rgba(180,210,255,0.5);
  font-size: 15px; cursor: pointer;
  transition: color 0.15s;
}
.side-close:hover { color: #fff; }

.side-icon {
  font-size: 36px;
  text-align: center;
  margin-bottom: 6px;
}
.side-name {
  text-align: center;
  color: #e8f0ff;
  font-family: Arial, sans-serif;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 14px;
}
.side-stats {
  font-family: Arial, sans-serif;
  font-size: 12px;
}
.side-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 5px 0;
  border-bottom: 1px solid rgba(120,180,255,0.08);
}
.side-stat-row:last-child { border-bottom: none; }
.side-stat-label { color: rgba(140,190,255,0.7); }
.side-stat-value { color: #ddeeff; font-weight: 600; }
.side-stat-value.live {
  color: #7fffb0;
  font-variant-numeric: tabular-nums;
}

/* ---- Легенда ---- */
.legend {
  position: fixed;
  top: 50%;
  left: 24px;
  transform: translateY(-50%);
  width: 200px;
  max-height: 80vh;
  overflow-y: auto;
  background: rgba(8,14,30,0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(120,180,255,0.22);
  border-radius: 14px;
  padding: 16px 14px;
  z-index: 150;
  scrollbar-width: thin;
  scrollbar-color: rgba(120,180,255,0.3) transparent;
}
.legend.hidden { display: none; }
.legend-title {
  color: rgba(180,210,255,0.8);
  font-family: Arial, sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 0;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.12s;
  padding-left: 4px;
}
.legend-item:hover { background: rgba(120,180,255,0.08); }
.legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.legend-label {
  color: rgba(200,220,255,0.85);
  font-family: Arial, sans-serif;
  font-size: 12px;
}
.legend-section {
  color: rgba(120,160,200,0.5);
  font-family: Arial, sans-serif;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 10px 0 4px 4px;
}

/* ---- Сравнение размеров ---- */
.compare {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(8,14,30,0.88);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(120,180,255,0.22);
  border-radius: 14px;
  padding: 16px 20px 14px;
  z-index: 150;
  min-width: 600px;
}
.compare.hidden { display: none; }
.compare-title {
  color: rgba(180,210,255,0.8);
  font-family: Arial, sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  text-align: center;
}
#compareCanvas { display: block; }
.compare-close {
  position: absolute;
  top: 10px; right: 12px;
  background: none; border: none;
  color: rgba(180,210,255,0.5);
  font-size: 15px; cursor: pointer;
  transition: color 0.15s;
}
.compare-close:hover { color: #fff; }

/* ---- Поиск ---- */
.search-box {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  z-index: 300;
  background: rgba(8,14,30,0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(120,180,255,0.3);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.search-box.hidden { display: none; }

#searchInput {
  width: 100%;
  background: none;
  border: none;
  outline: none;
  color: #e8f0ff;
  font-family: Arial, sans-serif;
  font-size: 15px;
  padding: 14px 16px;
  box-sizing: border-box;
}
#searchInput::placeholder { color: rgba(140,180,220,0.45); }

.search-results { border-top: 1px solid rgba(120,180,255,0.12); }
.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  font-family: Arial, sans-serif;
  font-size: 13px;
  color: rgba(200,220,255,0.85);
  transition: background 0.12s;
}
.search-result-item:hover { background: rgba(100,160,255,0.12); }
.search-result-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.search-result-type {
  margin-left: auto;
  font-size: 10px;
  color: rgba(120,160,200,0.5);
}

/* ---- Режим слежения ---- */
.track-hint {
  position: fixed;
  top: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(8,14,30,0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(120,255,180,0.3);
  border-radius: 10px;
  padding: 8px 14px;
  z-index: 200;
  font-family: Arial, sans-serif;
  font-size: 13px;
  color: rgba(120,255,180,0.9);
}
.track-hint.hidden { display: none; }
.track-stop {
  background: none; border: none;
  color: rgba(120,255,180,0.6);
  font-size: 14px; cursor: pointer;
  transition: color 0.15s;
}
.track-stop:hover { color: #fff; }

/* ---- Временная шкала ---- */
.timeline {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: min(700px, 90vw);
  background: rgba(8,14,30,0.88);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(120,180,255,0.22);
  border-radius: 14px;
  padding: 14px 20px 12px;
  z-index: 200;
}
.timeline.hidden { display: none; }

.timeline-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-family: Arial, sans-serif;
  font-size: 13px;
}
.timeline-label { color: rgba(140,180,220,0.6); }
.timeline-date  { color: #e8f0ff; font-weight: 600; min-width: 120px; }

#timelineSlider {
  width: 100%;
  accent-color: rgba(100,160,255,0.8);
  cursor: pointer;
}

.timeline-ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-family: Arial, sans-serif;
  font-size: 10px;
  color: rgba(120,160,200,0.45);
}
