:root {
  --ink: #10231e;
  --muted: #52665f;
  --cream: #fffdf7;
  --surface: rgba(255, 253, 247, 0.96);
  --green: #006b4b;
  --green-dark: #00503a;
  --coral: #e55232;
  --route: #ed7d31;
  --line: #e6e1d4;
  font-family: "Aptos", "Segoe UI", Arial, sans-serif;
  color: var(--ink);
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--cream);
}

.app-shell {
  display: grid;
  grid-template-columns: 360px 1fr;
}

.controls {
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 30px 25px;
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--line);
  box-shadow: 4px 0 22px rgba(16, 35, 30, 0.07);
}

.kicker {
  margin: 0 0 8px;
  color: var(--coral);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: clamp(1.65rem, 4vw, 2.05rem);
  font-weight: 600;
  line-height: 1.12;
}

.inputs {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
}

input {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid #c7c2b7;
  border-radius: 10px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-size: 1.05rem;
}

input:focus {
  outline: 2px solid var(--green);
  outline-offset: 1px;
}

button {
  margin-top: 5px;
  padding: 13px 18px;
  border: 0;
  border-radius: 10px;
  background: var(--green);
  color: white;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

button:hover,
button:focus-visible {
  background: var(--green-dark);
}

.stats {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 14px;
  background: #f4f1e6;
}

.stat-label {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.8rem;
}

.stats strong {
  font-size: 1.18rem;
}

.watch-plan {
  display: grid;
  gap: 11px;
  padding-top: 4px;
}

.plan-choice {
  gap: 5px;
}

.plan-choice select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #c7c2b7;
  border-radius: 9px;
  background: white;
  color: var(--ink);
  font: inherit;
}

.watch-steps {
  display: grid;
  gap: 11px;
}

.watch-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
}

.watch-heading .kicker {
  margin-bottom: 4px;
}

.watch-heading h2 {
  margin: 0;
  font-size: 1.22rem;
}

.text-button {
  margin: 0 0 2px;
  padding: 5px 0;
  color: var(--green);
  background: transparent;
  font-size: 0.79rem;
}

.text-button:hover,
.text-button:focus-visible {
  color: var(--green-dark);
  background: transparent;
}

.watch-help {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.42;
}

.watch-stop {
  display: grid;
  grid-template-columns: 27px 1fr;
  gap: 9px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}

.stop-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: #17688a;
  color: white;
  font-size: 0.84rem;
  font-weight: 700;
}

.stop-content h3 {
  margin: 2px 0 3px;
  font-size: 0.9rem;
}

.stop-content small {
  color: var(--muted);
  font-weight: 500;
}

.stop-forecast {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 0.8rem;
}

.stop-forecast strong {
  color: var(--ink);
}

.stop-note {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.35;
}

.observation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  font-size: 0.77rem;
}

.observation input {
  width: 91px;
  padding: 6px 7px;
  border-radius: 7px;
  font-size: 0.84rem;
}

.difference {
  min-height: 0.9rem;
  margin: 5px 0 0;
  color: var(--green);
  font-size: 0.74rem;
  font-weight: 650;
}

.travel-card {
  display: grid;
  gap: 3px;
  margin-left: 13px;
  padding: 7px 10px 7px 22px;
  border-left: 2px dashed #78a9bd;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.35;
}

.travel-card strong {
  color: #17688a;
  font-size: 0.78rem;
}

.arrival-card {
  margin-top: 2px;
  margin-bottom: 1px;
}

.food-card strong {
  color: var(--coral);
}

.final-stop {
  background: #f4f1e6;
}

.status {
  margin: auto 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.map-area,
#map {
  position: relative;
  height: 100%;
  min-height: 420px;
}

.legend {
  position: absolute;
  z-index: 500;
  right: 16px;
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 11px 14px;
  border-radius: 20px;
  background: rgba(255, 253, 247, 0.95);
  box-shadow: 0 2px 12px rgba(16, 35, 30, 0.16);
  color: var(--muted);
  font-size: 0.82rem;
}

.legend-route {
  width: 24px;
  height: 4px;
  border-radius: 2px;
  background: var(--route);
}

.legend-dot {
  width: 10px;
  height: 10px;
  margin-left: 7px;
  border-radius: 50%;
  background: var(--green);
}

.legend-watch {
  width: 11px;
  height: 11px;
  margin-left: 7px;
  border-radius: 50%;
  background: #17688a;
}

.legend-metro {
  width: 21px;
  height: 0;
  margin-left: 7px;
  border-top: 3px dashed;
}

.legend-metro.blue {
  border-color: #1675c1;
}

.legend-metro.red {
  border-color: #e32636;
}

.legend-metro.green {
  border-color: #19a34a;
}

.metro-station-marker {
  width: 13px;
  height: 13px;
  border: 2px solid white;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(16, 35, 30, 0.35);
}

.km-marker {
  min-width: 46px;
  padding: 4px 5px;
  border: 1px solid rgba(0, 80, 58, 0.22);
  border-radius: 7px;
  background: rgba(255, 253, 247, 0.97);
  box-shadow: 0 1px 5px rgba(16, 35, 30, 0.16);
  color: var(--green-dark);
  font-size: 10px;
  font-weight: 650;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
}

.km-marker b {
  display: block;
  color: var(--green);
  font-size: 11px;
}

.shifted-marker {
  border-color: rgba(0, 107, 75, 0.48);
  box-shadow: 0 2px 8px rgba(0, 80, 58, 0.25);
}

.observed-marker {
  border-color: var(--coral);
  background: #fff2ed;
}

.popup-observation {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 9px;
  font-size: 0.77rem;
}

.popup-observation input {
  width: 92px;
  padding: 5px 6px;
  border-radius: 7px;
  font-size: 0.84rem;
}

.popup-difference {
  margin: 7px 0 0;
  color: var(--green);
  font-size: 0.74rem;
  font-weight: 650;
}

.popup-input-error {
  min-height: 0.9rem;
  margin: 4px 0 0;
  color: var(--coral);
  font-size: 0.72rem;
}

.popup-save-observation,
.popup-clear-observation {
  margin-top: 7px;
  padding: 5px 9px;
  border-radius: 7px;
  font-size: 0.76rem;
}

.popup-clear-observation {
  margin-left: 5px;
  color: var(--green);
  background: transparent;
}

.popup-clear-observation:hover,
.popup-clear-observation:focus-visible {
  color: var(--green-dark);
  background: transparent;
}

.special-marker {
  padding: 6px 8px;
  border-radius: 9px;
  color: white;
  background: var(--green);
  box-shadow: 0 2px 8px rgba(0, 80, 58, 0.3);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.finish-marker {
  background: var(--coral);
}

.watch-marker {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 3px solid white;
  border-radius: 50% 50% 50% 0;
  background: #17688a;
  box-shadow: 0 2px 7px rgba(16, 35, 30, 0.32);
  color: white;
  font-size: 13px;
  font-weight: 700;
  transform: rotate(-45deg);
}

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

.watch-marker.finish-watch {
  background: var(--coral);
}

@media (max-width: 700px) {
  .app-shell {
    display: flex;
    flex-direction: column;
  }

  .controls {
    flex: 0 0 auto;
    gap: 14px;
    padding: 17px 16px 14px;
    max-height: 55vh;
    overflow-y: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  h1 {
    font-size: 1.45rem;
  }

  .inputs {
    grid-template-columns: 1fr 1fr auto;
    align-items: end;
    gap: 9px;
  }

  input {
    padding: 10px 9px;
    font-size: 1rem;
  }

  button {
    margin: 0;
    padding: 11px 12px;
    font-size: 0.9rem;
  }

  .stats {
    display: flex;
    justify-content: space-between;
    padding: 10px 14px;
  }

  .stats strong {
    font-size: 1.05rem;
  }

  .status {
    display: none;
  }

  .map-area {
    flex: 1 1 auto;
    min-height: 0;
  }

  .legend {
    right: 10px;
    bottom: 14px;
  }
}
