* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0d0d0d;
  color: #e8e8e8;
  min-height: 100vh;
}

/* --- Hero ---------------------------------------------------------------- */

.hero {
  width: 100%;
  background-color: #1a1a1a;
  background-image:
    radial-gradient(ellipse 120% 80% at 50% 100%, rgba(40, 38, 35, 0.9) 0%, transparent 70%),
    repeating-linear-gradient(
      -3deg,
      transparent,
      transparent 3px,
      rgba(0, 0, 0, 0.12) 3px,
      rgba(0, 0, 0, 0.12) 4px
    ),
    linear-gradient(165deg, #2a2826 0%, #1c1b19 45%, #121110 100%);
  border-bottom: 3px solid #2f2d2a;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.hero-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.5rem 0.5rem;
}

.hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.hero-title {
  margin: 0;
  font-family: "Bebas Neue", "Arial Narrow", sans-serif;
  font-size: clamp(3.5rem, 12vw, 6.5rem);
  font-weight: 400;
  letter-spacing: 0.06em;
  line-height: 0.95;
  color: #f5f0e6;
  text-shadow:
    0 2px 0 #1a1816,
    0 0 40px rgba(255, 215, 0, 0.08);
}

.hero-tagline {
  margin: 0.35rem 0 0;
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  font-weight: 400;
  color: #a8a49c;
  letter-spacing: 0.02em;
}

#hero-region-name {
  color: #ffd700;
  font-weight: 500;
}

.hero-route-wrap {
  margin-top: 0.5rem;
  margin-bottom: 0;
  max-width: 520px;
  opacity: 0.95;
  line-height: 0;
}

.hero-route {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.hero-route-path {
  filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.35));
  transition: none;
}

.hero-route-path.is-tracing {
  transition: stroke-dashoffset 2.4s ease-in-out;
}

/* --- Map app (below the fold) -------------------------------------------- */

.map-app {
  display: grid;
  grid-template-columns: 260px 1fr;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.5rem 1rem 1.25rem;
  gap: 0;
  min-height: calc(100vh - 220px);
}

#sidebar {
  padding: 1rem 1.25rem 1rem 0;
  border-right: 1px solid #333;
  background: transparent;
  overflow-y: auto;
}

#sidebar label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  margin-bottom: 0.35rem;
}

#region-select {
  width: 100%;
  padding: 0.5rem;
  background: #222;
  color: #eee;
  border: 1px solid #444;
  border-radius: 4px;
  margin-bottom: 1.25rem;
}

.legend h2 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  margin: 0 0 0.75rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  margin-bottom: 0.45rem;
}

.swatch {
  width: 1.25rem;
  height: 0.35rem;
  border-radius: 2px;
  flex-shrink: 0;
}

.swatch.hot { background: #e6194b; }
.swatch.mid { background: #f58231; }
.swatch.low { background: #777; }
.swatch.verified {
  background: transparent;
  border: 2px solid #ffd700;
  height: 0.5rem;
}

#region-stats {
  margin-top: 1.25rem;
  font-size: 0.8rem;
  color: #aaa;
  line-height: 1.5;
}

main {
  position: relative;
  min-height: 0;
  padding-left: 0;
}

#map {
  width: 100%;
  height: min(72vh, 720px);
  min-height: 420px;
  border-radius: 8px;
  border: 1px solid #333;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 4px 24px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

#status {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  background: rgba(0, 0, 0, 0.75);
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  font-size: 0.8rem;
  pointer-events: none;
}

.leaflet-popup-content {
  margin: 0.6rem 0.8rem;
  font-size: 0.85rem;
  line-height: 1.45;
}

.popup-name {
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.popup-verified {
  color: #ffd700;
  font-weight: 500;
}

.popup-rejected {
  color: #e57373;
  font-weight: 500;
}

.popup-hint {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: #999;
}

.popup-status {
  margin-top: 0.25rem;
}

.verify-actions {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #444;
}

.verify-label {
  display: block;
  font-size: 0.75rem;
  color: #aaa;
  margin-bottom: 0.25rem;
}

.verify-note {
  width: 100%;
  min-height: 2.5rem;
  padding: 0.35rem 0.5rem;
  background: #222;
  color: #eee;
  border: 1px solid #555;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.8rem;
  resize: vertical;
}

.verify-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.verify-msg {
  margin: 0.5rem 0 0;
  font-size: 0.78rem;
  color: #8bc34a;
}

.verify-msg-error {
  color: #e57373;
}

#auth-widget {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  padding-top: 0.15rem;
}

.auth-status {
  font-size: 0.8rem;
  color: #a8a49c;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn {
  padding: 0.35rem 0.65rem;
  border-radius: 4px;
  border: 1px solid #555;
  background: #2a2a2a;
  color: #eee;
  font-size: 0.8rem;
  cursor: pointer;
}

.btn:hover {
  background: #333;
}

.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

.btn-primary {
  background: #2563eb;
  border-color: #2563eb;
}

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

.btn-verify {
  background: #2e4a2e;
  border-color: #4a7c4a;
}

.btn-reject {
  background: #4a2e2e;
  border-color: #7c4a4a;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 1rem;
}

.overlay[hidden] {
  display: none;
}

.overlay-card {
  background: #1a1a1a;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 1.25rem;
  width: 100%;
  max-width: 360px;
}

.overlay-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.overlay-hint {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  color: #999;
}

.overlay-card label {
  display: block;
  font-size: 0.75rem;
  color: #aaa;
  margin: 0.75rem 0 0.25rem;
}

.overlay-card input {
  width: 100%;
  padding: 0.5rem;
  background: #222;
  color: #eee;
  border: 1px solid #555;
  border-radius: 4px;
}

.overlay-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.auth-error {
  margin: 0.75rem 0 0;
  font-size: 0.8rem;
  color: #e57373;
}

#suggestions-panel {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #333;
}

#suggestions-panel h2 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  margin: 0 0 0.35rem;
}

.panel-hint {
  font-size: 0.75rem;
  color: #777;
  margin: 0 0 0.75rem;
  line-height: 1.4;
}

#suggestions-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.suggestion-item {
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 0.6rem;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
}

.suggestion-road {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.suggestion-proposal {
  color: #aaa;
  margin-bottom: 0.25rem;
}

.suggestion-note {
  color: #888;
  font-style: italic;
  margin-bottom: 0.35rem;
}

.suggestion-actions {
  display: flex;
  gap: 0.35rem;
}

.suggestion-empty {
  font-size: 0.8rem;
  color: #777;
}

/* --- Route builder ------------------------------------------------------- */

.route-builder {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #333;
}

.route-builder h2 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  margin: 0 0 0.35rem;
}

.route-field {
  margin-top: 0.85rem;
}

.route-field > label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  margin-bottom: 0.35rem;
}

#start-point-input {
  width: 100%;
  padding: 0.5rem;
  background: #222;
  color: #eee;
  border: 1px solid #444;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.85rem;
}

.route-start-actions {
  margin-top: 0.4rem;
}

.selected-roads-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.selected-roads-list li.selected-road-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: #1e1e1e;
  border: 1px solid #3a3a2a;
  border-left: 3px solid #5eead4;
  border-radius: 4px;
  padding: 0.45rem 0.55rem;
  margin-bottom: 0.4rem;
  font-size: 0.8rem;
}

.selected-road-item .road-label {
  flex: 1;
  min-width: 0;
}

.selected-road-item .road-name {
  font-weight: 600;
  color: #eee;
}

.selected-road-item .road-meta {
  color: #888;
  font-size: 0.75rem;
}

.route-build-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.85rem;
}

.route-status {
  margin: 0.5rem 0 0;
  font-size: 0.78rem;
  color: #a8a49c;
}

.route-status.is-error {
  color: #e57373;
}

.route-status.is-ok {
  color: #8bc34a;
}

.route-meta {
  margin-top: 0.75rem;
  padding: 0.65rem 0.75rem;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 4px;
  font-size: 0.85rem;
  line-height: 1.45;
  color: #ddd;
  max-height: 42vh;
  overflow-y: auto;
}

.route-meta strong {
  color: #ffd700;
}

.route-meta-roads {
  margin-top: 0.35rem;
  color: #aaa;
  font-size: 0.8rem;
}

.route-meta-legend {
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: #777;
}

.route-steps-wrap {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid #333;
}

.route-steps-title {
  margin: 0 0 0.45rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  font-weight: 600;
}

.route-steps-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.route-step-item {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  padding: 0.35rem 0;
  border-bottom: 1px solid #2a2a2a;
  font-size: 0.78rem;
  line-height: 1.35;
  color: #ccc;
}

.route-step-item:last-child {
  border-bottom: none;
}

.route-step-num {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: #2a2a2a;
  border: 1px solid #444;
  color: #aaa;
  font-size: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.05rem;
}

.route-step-dist {
  color: #888;
  white-space: nowrap;
}

.route-endpoint-marker {
  background: transparent;
  border: none;
}

.route-endpoint-pin {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.3rem;
  width: 52px;
  height: 40px;
}

.route-endpoint-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--pin-color, #22c55e);
  color: #fff;
  font-weight: 800;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #f5f0e6;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.65);
  flex-shrink: 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.route-endpoint-label {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #f5f0e6;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid var(--pin-color, #22c55e);
  border-radius: 3px;
  padding: 0.15rem 0.3rem;
  line-height: 1;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.route-endpoint-end .route-endpoint-dot {
  border-color: #fff;
}

body.route-view-active #clear-route-btn {
  border-color: #ffd700;
  color: #ffd700;
}

.save-route-wrap {
  margin-top: 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.my-drives {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid #333;
}

.my-drives h2 {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  font-weight: 600;
}

.drives-section {
  margin-top: 0.75rem;
}

.drives-section-title {
  margin: 0 0 0.4rem;
  font-size: 0.8rem;
  color: #ccc;
  font-weight: 600;
}

.drives-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.drives-empty {
  margin: 0;
  font-size: 0.78rem;
  color: #777;
}

.drive-card {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 0.55rem 0.65rem;
  font-size: 0.8rem;
  line-height: 1.4;
  color: #ddd;
}

.drive-card.is-active {
  border-color: #ffd700;
}

.drive-card-main {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 0;
  color: inherit;
  cursor: pointer;
  font: inherit;
}

.drive-card-main:hover .drive-roads {
  color: #ffd700;
}

.drive-roads {
  font-weight: 600;
  color: #eee;
}

.drive-meta {
  margin-top: 0.2rem;
  font-size: 0.72rem;
  color: #888;
}

.drive-rating {
  margin-top: 0.25rem;
  color: #ffd700;
  letter-spacing: 0.05em;
}

.drive-notes {
  margin-top: 0.25rem;
  color: #a8a49c;
  font-size: 0.75rem;
  white-space: pre-wrap;
}

.drive-actions {
  margin-top: 0.45rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.drive-rate-form {
  margin-top: 0.5rem;
  padding-top: 0.45rem;
  border-top: 1px solid #333;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.drive-rate-form label {
  margin: 0;
  font-size: 0.72rem;
  color: #aaa;
  text-transform: none;
  letter-spacing: 0;
}

.drive-stars {
  display: flex;
  gap: 0.25rem;
}

.drive-stars button {
  background: transparent;
  border: 1px solid #444;
  color: #777;
  border-radius: 3px;
  width: 1.75rem;
  height: 1.75rem;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0;
}

.drive-stars button.is-selected,
.drive-stars button:hover {
  border-color: #ffd700;
  color: #ffd700;
}

.drive-rate-form textarea {
  width: 100%;
  min-height: 3.2rem;
  resize: vertical;
  background: #121212;
  border: 1px solid #444;
  border-radius: 3px;
  color: #eee;
  font: inherit;
  padding: 0.4rem 0.5rem;
}

.drive-rate-actions {
  display: flex;
  gap: 0.35rem;
}

#selected-count {
  text-transform: none;
  letter-spacing: 0;
  color: #aaa;
  font-weight: 400;
}

@media (max-width: 720px) {
  .hero-inner {
    padding: 0.85rem 1rem 0.4rem;
  }

  .map-app {
    grid-template-columns: 1fr;
    padding: 0.4rem 0.75rem 1rem;
  }

  #sidebar {
    border-right: none;
    border-bottom: 1px solid #333;
    padding: 0 0 1rem;
  }

  #map {
    height: 55vh;
    min-height: 320px;
    border-radius: 6px;
  }
}
