:root {
  color-scheme: light;
  --navy: #09203d;
  --blue: #0065b4;
  --border: #d6e0e9;
  --muted: #4f6276;
  --map: #eef4f8;
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--navy);
  background: var(--map);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }

.site-header {
  display: flex;
  align-items: center;
  min-height: 64px;
  padding: 12px clamp(16px, 3vw, 40px);
  background: white;
  border-bottom: 1px solid var(--border);
}

.wordmark {
  color: var(--blue);
  font-size: 21px;
  font-weight: 750;
}

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(310px, 370px);
  grid-template-rows: minmax(500px, 1fr);
  min-height: calc(100svh - 64px);
  padding: 16px;
  gap: 16px;
}

.route-panel {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
  padding: 24px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 8px 20px rgba(9, 32, 61, 0.08);
}

h1 {
  margin: 0 0 24px;
  font-size: 27px;
  line-height: 1.2;
}

.route-field {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 6px 10px;
  align-items: center;
  margin-bottom: 15px;
}

.point-badge {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: white;
  font-size: 14px;
  font-weight: 700;
}

.point-start { background: var(--blue); }
.point-finish { background: var(--navy); }
.route-field label { font-size: 14px; font-weight: 650; }

.route-field input {
  grid-column: 2;
  width: 100%;
  min-height: 45px;
  padding: 9px 12px;
  color: var(--navy);
  font: inherit;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
}

:where(input, button, a):focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.hint, .form-status {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.route-button {
  width: 100%;
  min-height: 47px;
  padding: 11px 12px;
  background: var(--blue);
  border: 0;
  border-radius: 8px;
  color: white;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.route-button:hover:not(:disabled) { background: #005493; }
.route-button:disabled { opacity: .65; cursor: wait; }
.form-status { margin: 12px 0 0; }
.form-status[data-error] { color: #a02b26; }

.route-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 22px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.route-summary dt { color: var(--muted); font-size: 13px; }
.route-summary dd { margin: 4px 0 0; font-size: 20px; font-weight: 700; }

.map-view {
  grid-column: 1;
  grid-row: 1;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #e8f1f6;
}

#route-canvas, #yandex-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.map-status, .map-credit {
  position: absolute;
  z-index: 1;
  margin: 0;
  background: rgba(255,255,255,.97);
  color: var(--muted);
}

.map-status {
  top: 16px;
  left: 16px;
  max-width: min(310px, calc(100% - 32px));
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.4;
}

.map-credit {
  bottom: 0;
  right: 0;
  padding: 4px 8px;
  font-size: 11px;
}

.map-credit a { color: inherit; }

@media (max-width: 760px) {
  .map-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(360px, 55svh);
    padding: 12px;
    gap: 12px;
  }

  .route-panel { grid-column: 1; padding: 20px; }
  .map-view { grid-row: 2; }
}
