:root {
  --ink: #1e2528;
  --muted: #647072;
  --panel: #fffaf1;
  --line: #d8d0c3;
  --start: #127c72;
  --destination: #d44f35;
  --accent: #2f5f9f;
  --shadow: 0 22px 60px rgba(22, 30, 35, 0.2);
}

* {
  box-sizing: border-box;
}

html,
body,
.app-shell {
  height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #eef2ef;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
  min-height: 100%;
}

.route-panel {
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  background: var(--ink);
  border-radius: 8px;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1;
  letter-spacing: 0;
}

p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.feature-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 6px;
  background: #eee4d5;
  border-radius: 8px;
}

.feature-tab {
  min-height: 44px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1.15;
  padding: 0 8px;
  text-align: center;
}

.feature-tab.active {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 8px 18px rgba(47, 95, 159, 0.22);
}

.city-search {
  display: grid;
  gap: 8px;
}

.city-search label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.place-search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.city-search input {
  width: 100%;
  min-height: 44px;
  padding: 0 13px;
  color: var(--ink);
  font-weight: 700;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
}

.city-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 95, 159, 0.15);
}

.search-action {
  min-height: 44px;
  padding: 0 12px;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  background: var(--ink);
  border-radius: 8px;
  cursor: pointer;
}

.search-action:hover {
  background: var(--accent);
}

.city-results {
  display: grid;
  gap: 6px;
  max-height: 178px;
  overflow: auto;
}

.city-results:empty {
  display: none;
}

.city-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
  padding: 8px 10px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  text-align: left;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.city-result span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.selection-list {
  display: grid;
  gap: 0;
}

.point-card {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 16px;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.point-card.active {
  border-color: rgba(47, 95, 159, 0.62);
  box-shadow: 0 0 0 3px rgba(47, 95, 159, 0.13);
}

.point-card:hover {
  border-color: rgba(47, 95, 159, 0.42);
}

.swap-route {
  z-index: 1;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  margin: -5px auto;
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  background: var(--ink);
  border: 3px solid var(--panel);
  border-radius: 50%;
  box-shadow: 0 8px 18px rgba(30, 37, 40, 0.18);
  cursor: pointer;
}

.swap-route:hover {
  background: var(--accent);
}

.point-dot {
  width: 14px;
  height: 14px;
  margin-top: 4px;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 2px currentColor;
}

.start-dot {
  color: var(--start);
  background: var(--start);
}

.destination-dot {
  color: var(--destination);
  background: var(--destination);
}

.point-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.point-card strong {
  display: block;
  min-height: 24px;
  margin-top: 5px;
  overflow-wrap: anywhere;
  font-size: 16px;
  line-height: 1.35;
}

.actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: auto;
}

.secondary-action {
  min-height: 44px;
  color: var(--ink);
  font-weight: 800;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.secondary-action:hover,
.feature-tab:hover,
.language-button:hover,
.city-result:hover {
  filter: brightness(0.98);
}

.map-stage {
  position: relative;
  min-width: 0;
  min-height: 100vh;
  overflow: hidden;
  background: #dbe5e0;
}

#map {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.leaflet-container {
  color: var(--ink);
  font: inherit;
  background: #dbe5e0;
}

.leaflet-control-zoom a {
  color: var(--ink);
}

.leaflet-popup-content-wrapper {
  color: var(--ink);
  border-radius: 8px;
}

.leaflet-popup-content {
  margin: 10px 12px;
  font-weight: 800;
}

.map-marker {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #fff;
  font-weight: 900;
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 8px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  transform: rotate(-45deg);
}

.map-marker span {
  transform: rotate(45deg);
}

.map-marker.start {
  background: var(--start);
}

.map-marker.destination {
  background: var(--destination);
}

.map-hint {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 2;
  max-width: min(420px, calc(100% - 36px));
  padding: 12px 14px;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  background: rgba(30, 37, 40, 0.86);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}

.settings-control {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 3;
}

.settings-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: var(--ink);
  font-size: 19px;
  font-weight: 900;
  background: rgba(255, 253, 248, 0.96);
  border: 1px solid rgba(100, 112, 114, 0.24);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(30, 37, 40, 0.14);
  cursor: pointer;
}

.settings-button:hover {
  background: #fff;
}

.settings-panel {
  position: absolute;
  bottom: 52px;
  left: 0;
  width: 240px;
  padding: 12px;
  background: rgba(255, 253, 248, 0.98);
  border: 1px solid rgba(100, 112, 114, 0.24);
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(30, 37, 40, 0.18);
}

.settings-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.language-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 6px;
  background: #f5ecdd;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.language-button {
  min-height: 34px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
}

.language-button.active {
  color: #fff;
  background: var(--ink);
}

@media (max-width: 780px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(480px, 1fr);
  }

  .route-panel {
    gap: 14px;
    padding: 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  h1 {
    font-size: 24px;
  }

  .map-stage {
    min-height: 480px;
  }

  .feature-tabs {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .route-panel {
    padding: 12px;
  }

  .selection-list,
  .actions {
    gap: 8px;
  }

  .point-card {
    padding: 12px;
  }
}
