/* ── Reset ─────────────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  overflow: hidden;
  height: 100%;
  width: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Map ───────────────────────────────────────────────────────── */
#map {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  z-index: 1;
}

/* ── Sidebar ───────────────────────────────────────────────────── */
#sidebar {
  position: fixed;
  top: 0; left: 0;
  width: 300px; height: 100vh;
  background: #fff;
  border-right: 1px solid #e0e0e0;
  z-index: 1000;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* ── Header ────────────────────────────────────────────────────── */
.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid #e0e0e0;
  flex-shrink: 0;
}

.sidebar-title {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 7px;
}

.sidebar-badge {
  display: inline-block;
  background: #E1F5EE;
  color: #0F6E56;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 10px;
  border-radius: 20px;
}

/* ── Sections ──────────────────────────────────────────────────── */
.sidebar-section {
  padding: 12px 16px;
  flex-shrink: 0;
}

.section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  color: #9e9e9e;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.sidebar-divider {
  border: none;
  border-top: 1px solid #eeeeee;
  flex-shrink: 0;
}

/* ── Hint ──────────────────────────────────────────────────────── */
#hint, #loading {
  color: #9e9e9e;
  font-size: 13px;
  margin-top: 8px;
}

#hint {
  line-height: 1.5;
}

#loading { display: none; }
#results { display: none; }

/* ── Layer toggles ─────────────────────────────────────────────── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: #444;
  padding: 5px 0;
  cursor: pointer;
  user-select: none;
}

.toggle-row input[type="checkbox"] {
  display: none;
}

.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
  cursor: pointer;
}

.switch-slider {
  position: absolute;
  inset: 0;
  background: #d1d5db;
  border-radius: 20px;
  transition: background 0.2s;
}

.switch-slider::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  top: 3px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.switch input:checked + .switch-slider {
  background: #16a34a;
}

.switch input:checked + .switch-slider::before {
  transform: translateX(16px);
}

/* ── Legend ────────────────────────────────────────────────────── */
.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #444;
  padding: 4px 0;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

@keyframes aed-pulse {
  0%   { transform: translate(-50%, -50%) scale(1);   opacity: 0.7; }
  100% { transform: translate(-50%, -50%) scale(2.5); opacity: 0; }
}

/* ── Result cards ──────────────────────────────────────────────── */
.result-card {
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
}

.result-card.best {
  background: #f0fdf4;
  border: 1.5px solid #16a34a;
}

.result-card.alternative {
  background: #f9fafb;
  border: 1.5px solid #e5e7eb;
}

.rank-label {
  font-size: 11px;
  font-weight: 600;
  color: #9e9e9e;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.result-card.best .rank-label {
  color: #16a34a;
}

.time {
  font-size: 20px;
  font-weight: 700;
  color: #111827;
}

.distance {
  font-size: 13px;
  color: #6b7280;
  margin-top: 2px;
}

.extra-time {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 4px;
}

.aed-meta {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 6px;
}

/* ── Compare button ────────────────────────────────────────────── */
#btn-compare {
  width: 100%;
  padding: 10px;
  margin: 4px 0 12px;
  border: 1.5px solid #16a34a;
  border-radius: 8px;
  background: #16a34a;
  color: #ffffff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  font-family: inherit;
}

#btn-compare:hover {
  background: #15803d;
  border-color: #15803d;
}

#btn-compare.active {
  background: #f9fafb;
  color: #374151;
  border-color: #e5e7eb;
}

#btn-compare.active:hover {
  background: #f0fdf4;
  border-color: #16a34a;
  color: #16a34a;
}

/* ── Demo buttons ──────────────────────────────────────────────── */
#btn-demo {
  width: 100%;
  padding: 10px;
  margin-bottom: 6px;
  border: 1.5px solid #16a34a;
  border-radius: 8px;
  background: #16a34a;
  color: #ffffff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  font-family: inherit;
}

#btn-demo:hover {
  background: #15803d;
  border-color: #15803d;
}

#btn-reset {
  width: 100%;
  padding: 8px 4px;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
  color: #6b7280;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  font-family: inherit;
}

#btn-reset:hover {
  background: #f0fdf4;
  border-color: #16a34a;
}

/* ── Mobile / bottom sheet ─────────────────────────────────────── */
@media (max-width: 768px) {

  #sidebar {
    width: 100%;
    height: 45vh;
    top: auto;
    bottom: 0;
    border-right: none;
    border-top: 1px solid #e0e0e0;
    border-radius: 16px 16px 0 0;
  }

  #sidebar::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
    margin: 10px auto 6px;
  }

  #btn-demo,
  #btn-reset,
  #btn-compare {
    min-height: 44px;
    font-size: 14px;
  }

}
