/* Map controls share the guide's paper, ink and accent colours. */
.map-interactive { cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.map-interactive.map-dragging { cursor: grabbing; }
.map-plane { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.map-plane .map-img { pointer-events: none; }
.map-tile-layer { position: absolute; inset: 0; overflow: hidden; pointer-events: none; filter: saturate(.72) brightness(1.03); }
.map-tile-layer img { position: absolute; max-width: none; display: block; }
.map-attribution { position: absolute; bottom: 0; right: 0; padding: 2px 7px; background: var(--paper); color: var(--ink-2); font: 10px/1.7 var(--sans); cursor: default; }
.map-attribution a { text-decoration: underline; text-underline-offset: 2px; }
.map-interactive .map-legend { bottom: 30px; }
.map-detail-status { display: block; min-height: 1.7em; font-size: 12px; color: var(--ink-2); }
.map-plane .map-svg { overflow: visible; }
.map-plane .node-label { pointer-events: none; }
.map-plane .walk, .map-plane .bus { stroke-width: var(--map-route-width, 2); vector-effect: non-scaling-stroke; }
.map-plane .walk-case { stroke-width: var(--map-route-casing, 4); vector-effect: non-scaling-stroke; }
.map-plane .bus { stroke-dasharray: var(--map-bus-dash, 11 13); }
.map-plane .leader { vector-effect: non-scaling-stroke; stroke-width: 1; }
.map-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding-top: 12px; }
.map-controls button, .map-close { min-height: 44px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--ink); font: inherit; font-size: 13px; font-weight: 550; white-space: nowrap; cursor: pointer; }
.map-controls button[data-action="in"], .map-controls button[data-action="out"] { width: 44px; padding: 0; font-family: var(--sans); font-size: 22px; }
.map-controls button:hover, .map-close:hover { background: var(--panel); border-color: var(--ink-2); }
.map-controls button:disabled { opacity: .45; cursor: default; }
.map-controls button:focus-visible, .map-close:focus-visible, .map-interactive:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.map-scale { min-width: 3.3em; text-align: center; color: var(--ink-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.map-expand { margin-left: auto; }
.map-help { color: var(--ink-2); font-size: 13px; line-height: 1.7; margin: 9px 0 0; }
.map-help-touch, .map-help-full, .map-help-compact { display: none; }
.map-tutorial { margin: 18px 0 28px; padding: 18px 0; border-block: 1px solid var(--line); }
.map-tutorial h3 { font: 600 16px var(--sans); margin: 0 0 8px; }
.map-tutorial p { margin: 5px 0; max-width: 68ch; color: var(--ink-2); font-size: 14px; line-height: 1.8; }
.map-open { overflow: hidden; }
.map-dialog { position: fixed; inset: 0; width: 100%; height: 100%; height: 100dvh; max-width: none; max-height: none; margin: 0; border: 0; padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); background: var(--paper); color: var(--ink); }
.map-dialog[open] { display: flex; flex-direction: column; gap: 12px; }
.map-dialog::backdrop { background: var(--paper); }
.map-dialog-head { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex: 0 0 auto; }
.map-dialog-head strong { font: 600 clamp(15px, 2vw, 20px) var(--serif); }
.map-dialog .map-shell { min-height: 0; flex: 1; display: flex; flex-direction: column; }
.map-dialog .map-stage { flex: 1; min-height: 0; aspect-ratio: auto !important; touch-action: none; }
.map-dialog .map-expand { display: none; }
.map-dialog .map-cap { display: none; }
.map-dialog .map-svg .node, .map-dialog .map-svg .map-wp-g { opacity: 1; }
.map-dialog .map-svg .walk, .map-dialog .map-svg .walk-case { stroke-dashoffset: 0; }
.map-dialog .map-svg .bus { opacity: 1; }
.map-dialog .map-help::after { content: "底图 © OpenStreetMap contributors（HOT）"; display: block; font-size: 11px; margin-top: 3px; }
@media (pointer: coarse) {
  .map-help-mouse { display: none; }
  .map-help-touch { display: inline; }
  .map-dialog .map-help-touch { display: none; }
  .map-dialog .map-help-full { display: inline; }
}
@media (max-width: 370px) {
  .map-controls { gap: 4px; }
  .map-controls button { padding-inline: 10px; }
  .map-scale { min-width: 2.7em; }
}
@media (max-width: 960px) and (pointer: coarse) {
  .map-help { margin-top: 6px; font-size: 12px; line-height: 1.5; }
  .map-help-touch { display: none; }
  .map-help-compact { display: inline; }
  .map-detail-status:empty { min-height: 0; }
  /* The interactive map already carries linked source attribution inside it. */
  .mapcard.map-enhanced > .map-cap { display: none; }
  .map-dialog .map-help-compact, .map-dialog .map-help::after { display: none; }
}
