.tv-body {
  margin: 0;
  background: #000;
  overflow: hidden;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  color: #f5f6f8;
}

.tv-root {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: #000;
}

.tv-panorama {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  background: #0b0b0b;
}

.tv-panorama:active {
  cursor: grabbing;
}

.tv-panorama-image {
  position: absolute;
  inset: 0;
  background-repeat: repeat-x;
  background-position: 0 50%;
  background-size: auto 100%;
  transition: background-image 0.35s ease;
}

.tv-nav-markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.tv-nav-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  padding: 0;
  background: rgba(17, 24, 39, 0.75);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  color: #fff;
  font-size: 0;
  pointer-events: auto;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

/* Arrow icon via pseudo-element */
.tv-nav-marker::before {
  content: '';
  display: block;
  width: 14px;
  height: 14px;
  margin: auto;
  border-top: 3px solid #fff;
  border-right: 3px solid #fff;
  transform: rotate(-45deg) translateY(3px);
  opacity: 0.9;
}

.tv-nav-marker.is-info {
  background: rgba(16, 185, 129, 0.82);
  border-color: rgba(255, 255, 255, 0.4);
}

.tv-nav-marker.is-info::before {
  content: 'i';
  width: auto;
  height: auto;
  margin: 0;
  border: 0;
  font-size: 18px;
  font-weight: 700;
  transform: translateY(0);
  opacity: 1;
}

.tv-nav-marker.is-route-next {
  border-color: rgba(250, 204, 21, 0.95);
  box-shadow: 0 0 0 4px rgba(250, 204, 21, 0.35), 0 6px 24px rgba(250, 204, 21, 0.35);
  background: rgba(180, 83, 9, 0.88);
}

.tv-nav-marker.is-route-dim:not(.is-info) {
  opacity: 0.45;
}

.tv-nav-marker:hover {
  transform: translate(-50%, -50%) scale(1.12);
  border-color: rgba(255, 255, 255, 0.7);
  background: rgba(37, 99, 235, 0.85);
  box-shadow: 0 6px 24px rgba(37, 99, 235, 0.4);
}

.tv-nav-marker:hover::before {
  opacity: 1;
}

.tv-nav-marker:active {
  transform: translate(-50%, -50%) scale(0.95);
}

.tv-loader {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 14px;
  backdrop-filter: blur(4px);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.tv-loader.visible {
  opacity: 1;
}

.tv-fade {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.tv-fade.active {
  opacity: 1;
}

/* Миникарта + кнопка «Маршрут» + всплывающая панель построения пути */
.tv-minimap-stack {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}

.tv-minimap-stack .tv-minimap {
  position: relative;
  left: auto;
  bottom: auto;
}

.tv-minimap {
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  backdrop-filter: blur(6px);
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  transition: width 0.2s ease, height 0.2s ease, opacity 0.2s ease;
}

/* Fallback until JS sizes from image aspect ratio (inline styles override). */
.tv-minimap:not(.tv-minimap--collapsed) {
  width: 440px;
  height: 440px;
}

.tv-minimap--collapsed {
  width: auto;
  height: auto;
  overflow: visible;
  padding: 6px;
}

.tv-minimap-toggle {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  width: 32px;
  height: 32px;
  cursor: pointer;
  line-height: 1;
  font-size: 18px;
}

.tv-minimap--collapsed .tv-minimap-toggle {
  position: relative;
  top: auto;
  right: auto;
}

.tv-minimap-zoom {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tv-minimap--collapsed .tv-minimap-zoom {
  display: none;
}

.tv-minimap-zoom-btn {
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  width: 32px;
  height: 32px;
  cursor: pointer;
  line-height: 1;
  font-size: 18px;
  padding: 0;
}

.tv-minimap-zoom-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14);
}

.tv-minimap-zoom-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.tv-minimap-body {
  position: absolute;
  inset: 0;
}

.tv-minimap--collapsed .tv-minimap-body {
  display: none;
}

.tv-minimap-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  opacity: 0.8;
}

.tv-minimap-points {
  position: absolute;
  inset: 0;
}

.tv-minimap-point {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.7);
  background: #2563eb;
  transform: translate(-50%, -50%);
  cursor: pointer;
  box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.5);
  transition: transform 0.15s ease, box-shadow 0.3s ease, background 0.15s ease, border-color 0.15s ease;
}

.tv-minimap-point:hover {
  transform: translate(-50%, -50%) scale(1.08);
}

.tv-minimap-point.active {
  background: #22d3ee;
  border-color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 10px rgba(34, 211, 238, 0.18);
}

.tv-minimap-point.on-route:not(.active) {
  background: #a855f7;
  border-color: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 0 6px rgba(168, 85, 247, 0.2);
}

.tv-minimap-route {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.tv-minimap-route polyline {
  stroke: rgba(250, 204, 21, 0.95);
  stroke-width: 1.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.6));
}

.tv-minimap-points {
  z-index: 1;
}

.tv-back {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 2;
  background: rgba(15, 23, 42, 0.7);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.tv-back:hover {
  background: rgba(15, 23, 42, 0.9);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.tv-toolbar {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  padding: 6px 10px;
  color: #fff;
  font-size: 14px;
  backdrop-filter: blur(6px);
}

.tv-tour-select select {
  margin-left: 6px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  border-radius: 6px;
  padding: 4px 6px;
}

.tv-tour-progress {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  min-width: 230px;
}

.tv-tour-progress.hidden {
  display: none;
}

.tv-tour-progress-title {
  font-size: 13px;
  font-weight: 600;
  color: #e5e7eb;
  margin-bottom: 6px;
}

.tv-tour-progress-row {
  font-size: 13px;
  color: #f8fafc;
}

.tv-tour-progress-bar {
  margin-top: 6px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
}

.tv-tour-progress-bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #22d3ee, #16a34a);
  transition: width 0.2s ease;
}

.tv-tour-hint-btn {
  margin-top: 10px;
  width: 100%;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(147, 197, 253, 0.35);
  background: rgba(37, 99, 235, 0.35);
  color: #e0f2fe;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.tv-tour-hint-btn:hover:not(:disabled) {
  background: rgba(37, 99, 235, 0.55);
  border-color: rgba(147, 197, 253, 0.55);
}

.tv-tour-hint-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.tv-route-panel {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 8px;
  z-index: 3;
  width: max-content;
  max-width: min(280px, calc(100vw - 32px));
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f1f5f9;
  font-size: 13px;
  backdrop-filter: blur(6px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.tv-route-panel.hidden {
  display: none;
}

.tv-route-panel-toggle {
  margin-top: 8px;
  align-self: stretch;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(15, 23, 42, 0.88);
  color: #f8fafc;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.tv-route-panel-toggle:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(255, 255, 255, 0.35);
}

.tv-route-panel-toggle[aria-expanded="true"] {
  background: rgba(37, 99, 235, 0.92);
  border-color: rgba(147, 197, 253, 0.45);
}

.tv-route-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.tv-route-panel-title {
  font-weight: 600;
  margin: 0;
  color: #e2e8f0;
  flex: 1;
  min-width: 0;
}

.tv-route-panel-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.tv-route-panel-close:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.tv-route-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.tv-route-row label {
  font-size: 12px;
  color: #94a3b8;
}

.tv-route-row select {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: 8px;
  padding: 6px 8px;
}

.tv-route-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.tv-route-primary,
.tv-route-secondary {
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid transparent;
}

.tv-route-primary {
  background: #2563eb;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.12);
}

.tv-route-primary:hover {
  background: #1d4ed8;
}

.tv-route-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border-color: rgba(255, 255, 255, 0.2);
}

.tv-route-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
}

.tv-route-status {
  margin-top: 8px;
  font-size: 12px;
  color: #fbbf24;
  min-height: 1.2em;
}

.tv-route-deviation {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  max-width: min(420px, calc(100vw - 24px));
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(30, 27, 20, 0.92);
  border: 1px solid rgba(251, 191, 36, 0.45);
  color: #fef3c7;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.tv-route-deviation.hidden {
  display: none;
}

.tv-route-deviation-text {
  margin: 0 0 12px 0;
  font-size: 15px;
  line-height: 1.35;
}

.tv-route-deviation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tv-route-recalc-hint {
  margin: 10px 0 0 0;
  font-size: 13px;
  color: #fca5a5;
}

.tv-route-recalc-hint.hidden {
  display: none;
}

.tv-route-arrived {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 6;
  padding: 14px 22px;
  border-radius: 12px;
  background: rgba(22, 101, 52, 0.92);
  color: #ecfdf5;
  font-size: 17px;
  font-weight: 600;
  border: 1px solid rgba(52, 211, 153, 0.5);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.tv-route-arrived.hidden {
  display: none;
}

.tv-route-toast {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 6;
  max-width: min(360px, calc(100vw - 32px));
  padding: 14px 22px;
  border-radius: 12px;
  background: rgba(30, 58, 138, 0.94);
  color: #eff6ff;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  border: 1px solid rgba(147, 197, 253, 0.45);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

.tv-route-toast.hidden {
  display: none;
}

@media (max-width: 600px) {
  .tv-minimap:not(.tv-minimap--collapsed) {
    width: 360px;
    height: 360px;
  }
  .tv-nav-marker {
    width: 40px;
    height: 40px;
  }
  .tv-nav-marker::before {
    width: 12px;
    height: 12px;
    border-width: 2px;
  }
  .tv-back {
    top: 10px;
    left: 10px;
  }
  .tv-minimap-stack {
    left: 10px;
    bottom: 10px;
  }
  .tv-route-panel {
    max-width: min(260px, calc(100vw - 20px));
    font-size: 12px;
  }
  .tv-route-deviation {
    bottom: 88px;
  }
}

.tv-info-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 5;
}

.tv-info-overlay.visible {
  display: flex;
}

.tv-info-card {
  background: rgba(15, 23, 42, 0.92);
  color: #f8fafc;
  padding: 16px 20px;
  border-radius: 14px;
  max-width: min(520px, 90vw);
  width: 100%;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  position: relative;
}

.tv-info-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 20px;
  cursor: pointer;
}

.tv-info-close:hover {
  color: #e2e8f0;
}

.tv-info-card h4 {
  margin: 0 0 8px 0;
  font-size: 18px;
}

.tv-info-card p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.4;
}
