:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --panel: rgba(20, 23, 27, 0.85);
  --text: #e8eaed;
  --text-dim: #9aa0a6;
  --border: rgba(255, 255, 255, 0.08);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#canvas.grabbing {
  cursor: grabbing;
}

#header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  padding: 16px 20px 12px;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(11, 13, 16, 0.9), transparent);
}

#header h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.subtitle {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--text-dim);
}

#legend {
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  backdrop-filter: blur(6px);
  max-height: 45vh;
  overflow-y: auto;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  user-select: none;
  opacity: 1;
  transition: opacity 0.15s ease;
}

.legend-item.dimmed {
  opacity: 0.35;
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex: none;
}

#journey-panel {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10;
  width: 240px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  backdrop-filter: blur(6px);
}

.journey-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.journey-row label {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.journey-row select {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 0.85rem;
}

.journey-actions {
  display: flex;
  gap: 8px;
}

.journey-actions button {
  flex: 1;
  background: #2d6cdf;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.journey-actions button:hover {
  filter: brightness(1.1);
}

#clear-btn {
  background: rgba(255, 255, 255, 0.08) !important;
}

#journey-status {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.4;
}

#tooltip {
  position: fixed;
  z-index: 20;
  pointer-events: none;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.8rem;
  max-width: 220px;
  backdrop-filter: blur(6px);
  transform: translate(-50%, -120%);
}

#tooltip .tooltip-title {
  font-weight: 600;
  margin-bottom: 4px;
}

#tooltip .tooltip-lines {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

#tooltip .tooltip-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

@media (max-width: 600px) {
  #legend {
    left: 8px;
    right: 8px;
    bottom: 8px;
    max-height: 25vh;
  }

  #journey-panel {
    left: 8px;
    right: 8px;
    top: 64px;
    width: auto;
  }

  #header {
    padding: 12px 12px 8px;
  }
}
