/*
 * Прогулка — the planner page: composer and agent trace | map | itinerary.
 *
 * Built on base.css: its tokens, buttons, chips, segmented control, toggle and slider.
 * What is here is the three-pane layout and the planner's own pieces: the folding
 * composer, the trace rows, the map markers and popups, and the timeline. The route
 * keeps the one terracotta accent (line, stop numbers, main button), so on a projector
 * the eye always lands on it; everything else stays white, near-white and ink.
 */

/* ---------- layout: side | map | itinerary ---------- */

.planner {
  display: grid;
  gap: 16px;
  padding: 16px;
  min-height: 0;
  /* trace and itinerary keep readable widths, the map takes whatever is left */
  grid-template-columns: clamp(340px, 27vw, 450px) minmax(0, 1fr) clamp(350px, 28vw, 480px);
  grid-template-areas: "side map plan";
}

/* narrower screens: the itinerary moves under the map */
@media (max-width: 1199px) {
  .planner {
    grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "side map" "side plan";
  }
}

/* phones: one column, the page scrolls instead of the panes */
@media (max-width: 999px) {
  body.is-app { display: block; height: auto; }
  .planner { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; grid-template-areas: "side" "map" "plan"; gap: 12px; padding: 12px; }
  .side { overflow: visible; }
  .trace { min-height: 420px; max-height: 75vh; }
  .map-wrap { height: 62vh; min-height: 320px; }
  .plan { overflow: visible; }
}

.side {
  grid-area: side;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  /* only while the composer is unfolded and taller than the screen */
  overflow-y: auto;
}

/* ---------- composer ---------- */

.composer { flex: none; padding: 20px; }
@media (max-width: 1299px) {
  .composer { padding: 16px; }
}
.composer-body { display: grid; gap: 12px; }
.composer-body:not([hidden]) { animation: rise 0.25s ease-out both; }
.composer-head { display: grid; gap: 4px; }
.composer-label { font: 600 1.4rem/1.2 var(--serif); letter-spacing: -0.005em; }
.composer .textarea { min-height: 7.2em; font-size: 1.02rem; }

@media (max-height: 820px) {
  .composer .textarea { min-height: 5em; }
}

.examples { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.86rem; color: var(--muted); }
.example {
  padding: 4px 11px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: var(--card);
  font-size: 0.86rem;
  color: var(--ink-soft);
  transition: border-color 0.15s, background 0.15s;
}
.example:hover:not(:disabled) { border-color: var(--ink); }

/* collapsible sections of the form */
.drawer { border-top: 1px solid var(--rule); padding-top: 12px; }
.drawer summary {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  color: var(--ink);
}
.drawer summary::-webkit-details-marker { display: none; }
.drawer summary::before {
  content: "";
  width: 7px;
  height: 7px;
  margin: 0 2px 2px;
  border-right: 2px solid var(--route);
  border-bottom: 2px solid var(--route);
  transform: rotate(-45deg);
  transition: transform 0.2s;
}
.drawer[open] summary::before { transform: rotate(45deg); }
.drawer summary:hover .drawer-title { color: var(--route-deep); }

.refine-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin-top: 12px; }
.refine-grid .field { gap: 4px; font-size: 0.85rem; font-weight: 500; color: var(--muted); }
.refine-grid .wide { grid-column: 1 / -1; }
.refine-grid .input { min-width: 0; min-height: 40px; padding: 7px 11px; font-size: 0.95rem; color: var(--ink); }

/* «Настроить прогулку» */
.tune { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; margin-top: 14px; }
.tune-section { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.tune-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.tune-label { font-size: 0.86rem; font-weight: 600; color: var(--ink); }
.tune-value { font: 600 0.92rem var(--mono); color: var(--route-deep); }
.tune-hint { display: block; font-size: 0.84rem; font-weight: 400; line-height: 1.45; color: var(--muted); }
.tune-scale { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--muted); }
.tune-chips { gap: 6px; }
button.tune-chip { min-height: 34px; padding: 4px 12px; font-size: 0.88rem; }
/* the state is also a glyph, not only a colour */
.tune-chip[data-choice="more"]::before { content: "+"; font-weight: 700; }
.tune-chip[data-choice="less"]::before { content: "−"; font-weight: 700; }
.tune-pace { display: flex; flex-wrap: nowrap; gap: 2px; }
.tune-pace label { flex: 1 1 0; min-width: 0; }
/* four options in a narrow column: a long one wraps to two lines rather than overflow */
.tune-pace span { width: 100%; height: 100%; align-content: center; padding: 7px 2px; font-size: 0.88rem; line-height: 1.2; }
.tune .toggle { align-items: flex-start; }
.tune .toggle-track { margin-top: 2px; }
.tune-reset { justify-self: start; margin: -8px 0 0 -12px; }

.profile-note { font-size: 0.88rem; color: var(--muted); }
.profile-note a { font-weight: 500; }

.composer-actions { display: flex; gap: 8px; }
.composer-actions #build { flex: 1; }
.replan-note { font-size: 0.84rem; color: var(--muted); text-align: center; }

/* the folded composer: what was asked, at a glance */
.recap { display: grid; gap: 8px; animation: rise 0.25s ease-out both; }
.recap-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.recap-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--route-deep);
}
.recap-head .btn { margin: -6px -8px -6px 0; }
.recap-text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font: italic 400 1.06rem/1.45 var(--serif);
  color: var(--ink);
}
.recap-chips { gap: 5px; }
.recap-chips .chip { font-size: 0.84rem; }

/* ---------- agent trace ---------- */

.trace {
  flex: 1;
  min-height: 340px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.trace-head {
  display: grid;
  gap: 10px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--rule);
}
.trace-title-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; }
.trace-head h2 { font: 600 1.15rem/1.2 var(--serif); }

.health {
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  padding: 3px 10px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font: 500 0.74rem/1.3 var(--mono);
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.health::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.health[data-state="ok"]::before { background: var(--green); }
.health[data-state="down"]::before { background: var(--red); }

.steps { display: flex; flex-wrap: wrap; gap: 5px; }
.steps:empty { display: none; }
.step {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--card);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  transition: background 0.25s, color 0.25s, border-color 0.25s;
}
.step.is-active { border-color: var(--route); background: var(--route-tint); color: var(--route-deep); }
.step.is-active::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--route);
  animation: pulse 1.1s ease-in-out infinite;
}
.step.is-done { border-color: var(--ink); background: var(--ink); color: #fff; }
.step.is-done::before { content: "✓"; font-size: 0.8em; }
.step.is-failed { border-color: var(--red); background: var(--red-tint); color: var(--red); }
.step.is-skipped { opacity: 0.5; text-decoration: line-through; }

.status-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.status-row:has(.status:empty):has(.stop-run[hidden]) { display: none; }
.status {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 0.96rem;
  color: var(--ink-soft);
}
.status.is-live::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--route);
  animation: pulse 1.1s ease-in-out infinite;
}
.stop-run:hover:not(:disabled) { border-color: var(--red); background: var(--red-tint); color: var(--red); }

.hint { padding: 18px; font-size: 0.95rem; color: var(--muted); }

.trace-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 16px 18px;
  font-size: 0.93rem;
}

.row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  padding: 5px 0;
  animation: rise 0.25s ease-out both;
}
.row-body { min-width: 0; overflow-wrap: anywhere; }

.badge {
  display: grid;
  place-items: center;
  height: 24px;
  border-radius: 6px;
  background: var(--paper-deep);
  font: 600 0.72rem/1 var(--mono);
  color: var(--ink-soft);
}
.badge.is-blank { background: none; }
.src-osm { background: #e3f0db; color: #2d5a1c; }
.src-wikipedia { background: #efede8; color: #111; font: 700 0.95rem/1 var(--serif); }
.src-wikivoyage { background: #e0ecf5; color: #1b5480; }
.tool-details { background: #efeaf7; color: #4b3a75; }
.tool-shortlist { background: var(--route-tint); color: var(--route-deep); }
.tool-finish { background: var(--ink); color: #fff; }
.tool-memory { background: var(--green-tint); color: var(--green); font-size: 0.9rem; }

.row.divider {
  grid-template-columns: minmax(0, 1fr);
  margin: 10px 0 2px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.row.divider .badge { display: none; }
.row.divider q {
  font: italic 400 1.02rem/1.4 var(--serif);
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}

.row.stage { margin-top: 8px; padding-top: 10px; border-top: 1px dashed var(--rule-strong); }
.row.stage .row-body { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.stage-name {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--route-deep);
}
.stage-label { font-weight: 500; }
.row.stage.is-done .stage-name::after { content: " ✓"; color: var(--green); }
.stage-time { margin-left: auto; font: 0.78rem var(--mono); color: var(--muted); }

.brief-title {
  margin-bottom: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.row.brief .row-body { display: grid; gap: 7px; }
.row .chips { gap: 5px; }
.row .chip { font-size: 0.86rem; }
/* interests grouped by origin; the panel's are outlined, the profile's dashed */
.brief-group { display: grid; grid-template-columns: 6.6em minmax(0, 1fr); gap: 8px; align-items: baseline; }
.brief-origin { font-size: 0.78rem; color: var(--muted); }
.brief-group.is-walk .chip.is-interest { border-color: #eeb8a6; background: var(--card); }
.brief-group.is-profile .chip.is-interest { border: 1px dashed #eeb8a6; background: var(--route-wash); }

.tool-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.tool-name { font: 600 0.86rem var(--mono); }
.tool-args {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font: 0.8rem/1.4 var(--mono);
  color: var(--muted);
}
.row.tool.is-pending .tool-name::after { content: " …"; animation: pulse 1s ease-in-out infinite; }
.tool-result { margin-top: 2px; color: var(--ink-soft); }
.tool-result .count { margin-right: 7px; }
.row.tool.is-error .tool-result { color: var(--red); }
.row.tool.is-error .badge { box-shadow: inset 0 0 0 2px var(--red); }

.row.thought p {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: pointer;
  padding-left: 12px;
  border-left: 2px solid var(--rule-strong);
  font: italic 400 1.02rem/1.45 var(--serif);
  color: #4f524c;
}
.row.thought p.is-open { -webkit-line-clamp: unset; }

.cand-head { display: flex; align-items: baseline; gap: 10px; }
.cand-name { font-weight: 600; }
.candidate.is-add .badge { background: var(--green-tint); color: var(--green); font-size: 1rem; }
.candidate.is-remove .badge { background: var(--red-tint); color: var(--red); font-size: 1rem; }
.candidate.is-remove .cand-name { color: var(--muted); text-decoration: line-through; }
.score {
  flex: none;
  margin-left: auto;
  padding: 1px 7px;
  border: 1px solid #c5dccb;
  border-radius: 5px;
  /* the fill behind the number is the score itself */
  background: linear-gradient(90deg, var(--green-tint) calc(var(--score) * 100%), transparent 0);
  font: 600 0.78rem/1.5 var(--mono);
  color: var(--green);
}
.cand-reason {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 2px;
  font-size: 0.88rem;
  color: var(--muted);
}

.row.warning .row-body,
.row.error .row-body,
.row.memory .row-body { padding: 6px 10px; border-radius: 8px; }
.row.warning .row-body { background: var(--amber-tint); color: var(--amber); }
.row.warning .badge { background: var(--amber-tint); color: var(--amber); }
.row.error .row-body { background: var(--red-tint); color: var(--red); font-weight: 500; }
.row.error .badge { background: var(--red); color: #fff; }
.row.memory .row-body { background: var(--green-tint); color: var(--ink-soft); }
.memory-label { font-weight: 600; color: var(--green); }

.row.note .row-body { color: var(--ink-soft); }
.stop-reason {
  margin-left: 8px;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--paper-deep);
  font: 0.78rem var(--mono);
}
.row.plan-ready .row-body { font-weight: 600; color: var(--ink); }

/* a saved trip's earlier runs */
.row.history .row-body { display: grid; gap: 3px; }
.history-meta { font-size: 0.8rem; color: var(--muted); }
.history-text { font: italic 400 1rem/1.45 var(--serif); color: var(--ink); }
.history-reply { padding-left: 10px; border-left: 2px solid var(--route); font-size: 0.9rem; color: var(--ink-soft); }
.history-reply b { color: var(--route-deep); }

.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }

/* ---------- map ---------- */

.map-wrap {
  grid-area: map;
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: #f8f7f4; /* the basemap's own background, so loading tiles do not flash */
}
#map { position: absolute; inset: 0; }
.maplibregl-map { font: inherit; }

.map-legend {
  position: absolute;
  z-index: 2;
  top: 12px;
  left: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  max-width: calc(100% - 24px);
  padding: 6px 12px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: rgb(255 255 255 / 0.92);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(6px);
  font-size: 0.8rem;
  color: var(--ink-soft);
  pointer-events: none;
  animation: rise 0.25s ease-out both;
}
.map-legend li { display: flex; align-items: center; gap: 6px; }
.legend-mark { flex: none; width: 12px; height: 12px; border-radius: 50%; }
.legend-mark.is-start { background: #fff; box-shadow: inset 0 0 0 3px var(--ink); }
.legend-mark.is-stop { background: var(--route); }
.legend-mark.is-cand { border: 2px solid var(--route); background: #fff; }
.legend-mark.is-ghost { width: 10px; height: 10px; border: 2px solid var(--muted); background: #fff; }

.map-fallback {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-content: center;
  gap: 6px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  background: var(--paper);
}
.map-fallback-title { font: 600 1.3rem/1.2 var(--serif); color: var(--ink); }
.map-fallback-detail { font: 0.78rem var(--mono); }
.map-fallback-detail:empty { display: none; }

/* MapLibre moves the marker element with a transform, so the animations go on its children */
.maplibregl-marker:hover,
.maplibregl-marker:focus-visible,
.maplibregl-marker.is-hot { z-index: 2; }
.pin { cursor: pointer; }
.pin:focus-visible { outline: none; }
.pin:focus-visible .pin-dot { outline: 3px solid var(--route); outline-offset: 2px; }
.pin-dot {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 2.5px solid #fff;
  border-radius: 50%;
  background: var(--route);
  box-shadow: 0 2px 8px rgb(28 31 29 / 0.3);
  font: 700 0.95rem/1 var(--sans);
  color: #fff;
  transition: transform 0.15s, background 0.15s;
  animation: pop 0.45s cubic-bezier(0.3, 1.6, 0.5, 1) both;
  animation-delay: calc(var(--i) * 90ms + 200ms);
}
.pin.is-hot .pin-dot { transform: scale(1.22); background: var(--ink); }
.pin-start .pin-dot { width: 30px; height: 30px; background: var(--ink); }
.pin-start .pin-dot::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: #fff; }
/* a shortlisted place, before the optimizer has placed it */
.pin-cand { cursor: default; }
.pin-cand .pin-dot {
  width: 16px;
  height: 16px;
  border: 2px solid var(--route);
  background: #fff;
  box-shadow: 0 0 0 4px rgb(200 65 42 / 0.18);
  animation: pop 0.5s cubic-bezier(0.3, 1.6, 0.5, 1) both, beacon 1.8s ease-out 0.5s 2;
}
/* shortlisted, but did not fit the time window or the walk */
.pin-cand.is-dropped .pin-dot {
  width: 12px;
  height: 12px;
  border: 2px solid var(--muted);
  background: #fff;
  box-shadow: 0 1px 3px rgb(28 31 29 / 0.2);
  animation: none;
}
@keyframes beacon {
  0% { box-shadow: 0 0 0 0 rgb(200 65 42 / 0.45); }
  100% { box-shadow: 0 0 0 14px rgb(200 65 42 / 0); }
}

/* the name on hover: a text node, never markup */
.pin-tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  width: max-content;
  max-width: 240px;
  padding: 4px 9px;
  border-radius: 7px;
  background: var(--ink);
  font: 500 0.8rem/1.35 var(--sans);
  color: #fff;
  opacity: 0;
  transform: translate(-50%, 4px);
  transition: opacity 0.12s, transform 0.12s;
  pointer-events: none;
}
.pin:hover .pin-tip,
.pin:focus-visible .pin-tip { opacity: 1; transform: translate(-50%, 0); }

.route-popup .maplibregl-popup-content {
  padding: 14px 30px 14px 16px;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  font-size: 0.92rem;
  line-height: 1.45;
}
.route-popup .maplibregl-popup-close-button {
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  font-size: 1.2rem;
  line-height: 1;
  color: var(--muted);
}
.route-popup .maplibregl-popup-close-button:hover { background: var(--paper-deep); color: var(--ink); }
.popup { display: grid; gap: 5px; }
.popup h3 { font: 600 1.15rem/1.25 var(--serif); }
.popup p { color: var(--ink-soft); }
.popup .popup-meta { font: 500 0.78rem var(--mono); color: var(--muted); }
.popup .source { font-weight: 500; }

.maplibregl-ctrl-group:not(:empty) { border-radius: 10px; box-shadow: var(--shadow); }
.maplibregl-ctrl-attrib { font-size: 0.72rem; }

/* ---------- itinerary ---------- */

.plan-col {
  grid-area: plan;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.plan { flex: 1; min-height: 0; overflow-y: auto; padding: 22px 24px; }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 6px; }

.plan-head {
  display: grid;
  gap: 10px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule);
  animation: rise 0.35s ease-out both;
}
.plan-title { font: 600 1.75rem/1.15 var(--serif); letter-spacing: -0.01em; text-wrap: balance; }
.plan-summary { color: var(--ink-soft); }

.stats { display: flex; flex-wrap: wrap; row-gap: 10px; margin-top: 4px; }
.stat {
  display: flex;
  flex-direction: column-reverse;
  padding: 0 16px;
  border-left: 1px solid var(--rule);
  white-space: nowrap;
}
.stat:first-child { padding-left: 0; border-left: 0; }
.stat dt { font-size: 0.8rem; color: var(--muted); }
.stat dd { font: 600 1.4rem/1.15 var(--serif); }

.usage { font: 0.8rem/1.4 var(--mono); color: var(--muted); }

.violations { display: grid; gap: 4px; }
.violation { padding: 5px 10px; border-radius: 8px; font-size: 0.88rem; }
.violation b { margin-right: 4px; font-weight: 600; }
.violation.is-warning { background: var(--amber-tint); color: var(--amber); }
.violation.is-error { background: var(--red-tint); color: var(--red); }

/* timeline: a vertical rail with the numbered stops threaded on it */
.timeline { position: relative; margin-top: 18px; }
.timeline::before {
  content: "";
  position: absolute;
  top: 14px;
  bottom: 14px;
  left: 17px;
  border-left: 2px dotted #cbc3b3;
}

.endpoint {
  position: relative;
  padding: 4px 0 4px 50px;
  font-weight: 500;
  color: var(--ink-soft);
  animation: rise 0.35s ease-out both;
  animation-delay: calc(var(--i, 0) * 70ms);
}
.endpoint::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-top: -9px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: inset 0 0 0 5px var(--ink), inset 0 0 0 9px #fff;
}
.endpoint.is-end::before { background: var(--card); box-shadow: inset 0 0 0 3px var(--ink); }
.endpoint time,
.stop-meta time { font: 600 0.9rem var(--mono); color: var(--ink); white-space: nowrap; }

.leg {
  position: relative;
  padding: 10px 0 10px 50px;
  font-size: 0.88rem;
  color: var(--muted);
  animation: rise 0.35s ease-out both;
  animation-delay: calc(var(--i) * 70ms);
}
.leg::before {
  /* walking figure sitting on the rail */
  content: "";
  position: absolute;
  left: 8px;
  top: 50%;
  width: 20px;
  height: 20px;
  margin-top: -10px;
  border-radius: 50%;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23686b66'%3E%3Ccircle cx='13' cy='4' r='2'/%3E%3Cpath d='M9.8 8.9 7 23h2.1l1.8-8 2.1 2v6h2v-7.5l-2.1-2 .6-3C14.8 12 16.8 13 19 13v-2c-1.9 0-3.5-1-4.3-2.4l-1-1.6c-.4-.6-1-1-1.7-1-.3 0-.5.1-.8.1L6 8.3V13h2V9.6l1.8-.7'/%3E%3C/svg%3E") center / 14px no-repeat;
}

.stop {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 14px;
  padding: 6px 0;
  cursor: pointer;
  outline-offset: 4px;
  animation: rise 0.4s ease-out both;
  animation-delay: calc(var(--i) * 70ms);
}
.stop-num {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-top: 8px;
  border: 2.5px solid var(--card);
  border-radius: 50%;
  background: var(--route);
  box-shadow: 0 1px 4px rgb(28 31 29 / 0.22);
  font-weight: 700;
  color: #fff;
  transition: transform 0.15s, background 0.15s;
}
.stop-body {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  transition: background 0.15s, border-color 0.15s;
}
.stop:hover .stop-body,
.stop.is-hot .stop-body { border-color: var(--rule); background: var(--paper); }
.stop.is-hot .stop-num { transform: scale(1.12); background: var(--ink); }
.stop.is-active .stop-body { border-color: var(--route); background: var(--route-wash); }

.stop-meta { display: flex; align-items: center; gap: 10px; }
.kind {
  padding: 1px 8px;
  border: 1px solid var(--rule-strong);
  border-radius: 5px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink-soft);
}
.stop-name { font: 600 1.22rem/1.25 var(--serif); }
.stop-text { color: var(--ink-soft); }
.stop-tip {
  padding: 6px 10px;
  border-left: 3px solid var(--route);
  border-radius: 0 8px 8px 0;
  background: var(--route-wash);
  font-size: 0.92rem;
}
.stop-tip b { color: var(--route-deep); }

.stop-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 2px; }
.source { font-size: 0.86rem; font-weight: 500; text-decoration: none; }
a.source:hover { text-decoration: underline; }
span.source { color: var(--muted); }

.remove {
  padding: 4px 12px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 0.85rem;
  color: var(--ink-soft);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.remove:hover:not(:disabled) { border-color: var(--red); background: var(--red-tint); color: var(--red); }
.remove:disabled { opacity: 0.5; }

.dropped {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  font-size: 0.88rem;
  color: var(--muted);
}
.dropped b { color: var(--ink-soft); }

/* ---------- feedback ---------- */

.feedback {
  display: grid;
  gap: 8px;
  padding: 14px 18px 16px;
  border-top: 1px solid var(--rule);
  background: var(--paper);
}
.feedback label { font: 600 1.05rem/1.2 var(--serif); }
.feedback-row { display: flex; align-items: stretch; gap: 10px; }
.feedback .textarea { flex: 1; min-width: 0; min-height: 0; padding: 8px 12px; resize: none; }
.feedback .btn { min-height: auto; }
.feedback-hint { font-size: 0.8rem; color: var(--muted); }

.reply {
  padding: 8px 12px;
  border-left: 3px solid var(--route);
  border-radius: 0 8px 8px 0;
  background: var(--card);
  font: italic 400 1.02rem/1.4 var(--serif);
  animation: rise 0.3s ease-out both;
}
.reply b { font: 600 0.88rem var(--sans); color: var(--route-deep); }

/* the memory toast links to the profile */
.toast a { color: #fff; font-weight: 600; }
