.topo-page { padding-bottom: 48px; }
.topo-intro { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, .7fr); align-items: end; gap: 30px; margin: 22px 0 25px; }
.topo-intro .eyebrow { margin: 0 0 8px; color: var(--green); font-size: .77rem; font-weight: 800; letter-spacing: .1em; }
.topo-intro h1 { max-width: 760px; margin: 0; color: var(--green-dark); font-size: clamp(2.1rem, 5vw, 3.8rem); line-height: 1.04; letter-spacing: -.055em; }
.topo-intro h1 span:not(.topo-title-accent) { color: var(--green-dark); }
.topo-intro h1 .topo-title-accent { color: var(--green); }
.topo-intro > p { max-width: 520px; margin: 0 0 4px; color: var(--muted); font-size: 1rem; line-height: 1.7; }
.topo-workspace { display: grid; grid-template-columns: minmax(270px, 330px) minmax(0, 1fr); align-items: stretch; gap: 18px; }
.topo-panel { display: flex; flex-direction: column; gap: 15px; padding: 21px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.topo-panel-heading { display: flex; align-items: center; gap: 12px; }
.topo-panel-heading h2 { margin: 1px 0 0; color: var(--text); font-size: 1.25rem; letter-spacing: -.025em; }
.topo-panel-heading .eyebrow { margin: 0; color: var(--muted); font-size: .69rem; font-weight: 800; letter-spacing: .09em; }
.topo-panel-icon { display: grid; flex: 0 0 46px; width: 46px; height: 46px; place-items: center; border-radius: 14px; background: var(--green-soft); color: var(--green-dark); font-size: 1.65rem; }
.topo-action { display: inline-flex; min-height: 45px; align-items: center; justify-content: center; gap: 9px; padding: 10px 13px; border: 1px solid #d5e4d8; border-radius: 12px; background: #f7fbf7; color: var(--green-dark); font: inherit; font-size: .9rem; font-weight: 750; text-align: center; cursor: pointer; transition: background .15s ease, border-color .15s ease, transform .15s ease; }
.topo-action:hover { transform: translateY(-1px); border-color: #9dc6a8; background: var(--green-soft); }
.topo-action:focus-visible, .topo-copy:focus-visible, .topo-coordinate-fields input:focus-visible { outline: 3px solid #e8ad41; outline-offset: 2px; }
.topo-location { min-height: 49px; border-color: var(--green); background: var(--green); color: white; }
.topo-location:hover { border-color: var(--green-dark); background: var(--green-dark); }
.topo-location > span:first-child { font-size: 1.25rem; }
.topo-help { margin: -10px 0 0; color: var(--muted); font-size: .76rem; line-height: 1.5; }
.topo-coordinate-form { display: grid; gap: 10px; padding-top: 15px; border-top: 1px solid var(--line); }
.topo-coordinate-form h3, .topo-layer-controls h3 { margin: 0; color: var(--text); font-size: .92rem; }
.topo-coordinate-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.topo-coordinate-fields label { display: grid; gap: 5px; color: var(--muted); font-size: .74rem; font-weight: 700; }
.topo-coordinate-fields input { min-width: 0; width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--soft); color: var(--text); font: inherit; font-variant-numeric: tabular-nums; }
.topo-coordinate-submit { width: 100%; min-height: 40px; }
.topo-layer-controls { display: grid; gap: 9px; padding-top: 14px; border-top: 1px solid var(--line); }
.topo-switch { position: relative; display: flex; min-height: 48px; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.topo-switch > span:first-child { display: grid; gap: 2px; }
.topo-switch strong { color: var(--text); font-size: .84rem; }
.topo-switch small { color: var(--muted); font-size: .72rem; }
.topo-switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.topo-switch-ui { position: relative; flex: 0 0 42px; width: 42px; height: 24px; border: 1px solid #c6d2c8; border-radius: 99px; background: #e8ede8; transition: background .15s ease; }
.topo-switch-ui::after { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: white; box-shadow: 0 1px 3px #0002; content: ""; transition: transform .15s ease; }
.topo-switch input:checked + .topo-switch-ui { border-color: var(--green); background: var(--green); }
.topo-switch input:checked + .topo-switch-ui::after { transform: translateX(18px); }
.topo-switch input:focus-visible + .topo-switch-ui { outline: 3px solid #e8ad41; outline-offset: 2px; }
.topo-3d-button { width: 100%; min-height: 42px; }
.topo-3d-button[aria-pressed="true"] { border-color: #a9ceb2; background: var(--green-soft); color: var(--green-dark); }
.topo-offline-button { width: 100%; min-height: 42px; }
.topo-offline-button.is-running { opacity: .72; cursor: wait; }
.topo-offline-progress { min-height: 18px; margin: -4px 0 0; color: var(--muted); font-size: .72rem; line-height: 1.45; }
.topo-offline-progress.is-error { color: #a12e23; }
.topo-basemap-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.topo-basemap-switch .topo-action { width: 100%; min-height: 42px; }
.topo-basemap-switch .topo-action.is-active { border-color: var(--green); background: var(--green); color: #fff; }
.topo-route-tools { display: grid; gap: 9px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.topo-route-tools h3 { margin: 0; color: var(--text); font-size: .92rem; }
.topo-route-tools > p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: .74rem; line-height: 1.5; }
.topo-route-tools .eyebrow { margin: 0; color: var(--green); font-size: .68rem; font-weight: 850; letter-spacing: .08em; }
.topo-route-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.topo-route-actions .topo-action { min-height: 42px; width: 100%; }
.topo-route-actions .topo-action:disabled { opacity: .48; cursor: not-allowed; }
.topo-route-actions #topo-export-geojson { grid-column: 1 / -1; }
.topo-route-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 0; }
.topo-route-summary > div { min-width: 0; }
.topo-route-summary dt { color: var(--muted); font-size: .68rem; }
.topo-route-summary dd { margin: 3px 0 0; color: var(--green-dark); font-size: .82rem; font-weight: 800; }
.topo-profile { width: 100%; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #f7faf7; }
.topo-profile canvas { display: block; width: 100%; height: 180px; }
.topo-result { padding: 14px; border: 1px solid #dbe8dd; border-radius: 14px; background: #f7faf7; }
.topo-result .eyebrow, .topo-gathering .eyebrow { margin: 0 0 5px; color: var(--green); font-size: .68rem; font-weight: 850; letter-spacing: .08em; }
.topo-result h3 { margin: 0; color: var(--text); font-size: .92rem; }
.topo-result-instruction { margin: 6px 0 0; color: var(--muted); font-size: .77rem; line-height: 1.5; }
.topo-result-values { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 0; }
.topo-result-values > div { min-width: 0; }
.topo-result-values dt { color: var(--muted); font-size: .7rem; }
.topo-result-values dd { margin: 3px 0 0; color: var(--green-dark); font-size: .96rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.topo-result-values .topo-result-coordinate { grid-column: 1 / -1; }
.topo-copy { margin-top: 12px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--green-dark); font: inherit; font-size: .74rem; font-weight: 700; cursor: pointer; }
.topo-waypoints { padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.topo-waypoints > .eyebrow { margin: 0 0 5px; color: var(--green); font-size: .68rem; font-weight: 850; letter-spacing: .08em; }
.topo-waypoints h3 { margin: 0; color: var(--text); font-size: .92rem; }
.topo-waypoint-help, .topo-waypoint-limit { margin: 6px 0 0; color: var(--muted); font-size: .74rem; line-height: 1.5; }
.topo-waypoint-form { display: grid; gap: 7px; margin-top: 11px; }
.topo-waypoint-form label { color: var(--text); font-size: .76rem; font-weight: 700; }
.topo-waypoint-form input { width: 100%; min-width: 0; min-height: 42px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--soft); color: var(--text); font: inherit; }
.topo-waypoint-form input:focus-visible, .topo-waypoint-button:focus-visible { outline: 3px solid #e8ad41; outline-offset: 2px; }
.topo-waypoint-form .topo-action { width: 100%; }
.topo-waypoint-form .topo-action:disabled { opacity: .55; cursor: not-allowed; }
.topo-waypoint-status { min-height: 18px; margin: 8px 0 0; color: var(--muted); font-size: .73rem; line-height: 1.5; overflow-wrap: anywhere; }
.topo-waypoint-status.is-error { color: #a12e23; }
.topo-waypoint-list { display: grid; gap: 8px; margin: 10px 0 0; padding: 0; list-style: none; }
.topo-waypoint-item, .topo-waypoint-empty { min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.topo-waypoint-item.is-active { border-color: var(--green); }
.topo-waypoint-item > strong, .topo-waypoint-coordinates, .topo-waypoint-item > small { display: block; overflow-wrap: anywhere; }
.topo-waypoint-item > strong { color: var(--text); font-size: .8rem; }
.topo-waypoint-coordinates, .topo-waypoint-item > small { margin-top: 3px; color: var(--muted); font-size: .68rem; font-variant-numeric: tabular-nums; }
.topo-waypoint-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.topo-waypoint-button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; font-size: .72rem; font-weight: 600; text-align: center; text-decoration: none; cursor: pointer; }
.topo-waypoint-delete { color: #a12e23; }
.topo-gathering { padding: 12px 13px; border: 1px solid #eedcba; border-radius: 13px; background: #fffaf0; }
.topo-gathering > p:not(.eyebrow) { margin: 0; color: #655536; font-size: .76rem; line-height: 1.55; }
.topo-gathering a { display: inline-block; margin-top: 8px; color: #6d4810; font-size: .78rem; font-weight: 800; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.topo-status { min-height: 20px; margin: -3px 0 0; color: var(--muted); font-size: .75rem; line-height: 1.45; }
.topo-status.is-error { color: #a12e23; }
.topo-data-note { padding-top: 11px; border-top: 1px solid var(--line); color: var(--muted); }
.topo-data-note summary { color: var(--text); font-size: .79rem; font-weight: 750; cursor: pointer; }
.topo-data-note p { margin: 9px 0 0; font-size: .72rem; line-height: 1.6; }
.topo-map-column { min-width: 0; }
.topo-map-wrap { position: relative; min-width: 0; height: clamp(520px, 70vh, 780px); overflow: hidden; border: 1px solid #d7dfd9; border-radius: 20px; background: #dce5db; box-shadow: var(--shadow); }
.topo-map { position: absolute; inset: 0; }
.topo-map-badge, .topo-map-tip { position: absolute; z-index: 3; border: 1px solid #ffffffa6; border-radius: 999px; background: #fffffff0; color: #254333; box-shadow: 0 4px 14px #143a2520; pointer-events: none; }
.topo-map-badge { top: 16px; left: 16px; display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; font-size: .69rem; font-weight: 850; letter-spacing: .07em; }
.topo-map-badge > span:first-child { color: var(--green); font-size: 1rem; }
.topo-map-tip { right: 16px; bottom: 17px; padding: 8px 12px; font-size: .74rem; }
.topo-map-error { position: absolute; z-index: 5; top: 64px; left: 16px; right: 16px; padding: 12px 14px; border: 1px solid #e9b9ae; border-radius: 12px; background: #fff4f1; color: #852d20; font-size: .83rem; line-height: 1.5; }
.topo-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding: 11px 4px 0; color: var(--muted); font-size: .74rem; }
.topo-legend > span { display: inline-flex; align-items: center; gap: 7px; }
.topo-legend i { display: inline-block; width: 22px; height: 3px; border-radius: 2px; }
.topo-legend-contour { background: #a55435; }
.topo-legend-elevation { background: linear-gradient(90deg, #4f9565, #d0bd55 38%, #d88b45 58%, #9d4f72 78%, #4a6e87); }
.topo-legend-slope { background: linear-gradient(90deg, #c0d5ae, #758c5e, #575d4e); }
.topo-legend .topo-legend-note { margin-left: auto; font-size: .7rem; }
.topo-caution { display: flex; align-items: flex-start; gap: 12px; margin-top: 18px; padding: 14px 17px; border: 1px solid #dce8df; border-radius: 14px; background: #f7faf7; color: var(--muted); }
.topo-caution > span { flex: 0 0 auto; color: var(--green); font-size: 1.1rem; }
.topo-caution p { margin: 0; font-size: .8rem; line-height: 1.6; }
.topo-map .maplibregl-ctrl-attrib { max-width: min(60vw, 520px); font-size: 10px; }
.topo-map .maplibregl-ctrl-group { overflow: hidden; }
html[data-theme="dark"] .topo-intro h1, html[data-theme="dark"] .topo-intro h1 span:not(.topo-title-accent) { color: #eef4ef; }
html[data-theme="dark"] .topo-intro h1 .topo-title-accent { color: #7ed2a4; }
html[data-theme="dark"] .topo-action { border-color: #40594a; background: #202e26; color: #e7f2eb; }
html[data-theme="dark"] .topo-action:hover { border-color: #6ca780; background: #263a2e; }
html[data-theme="dark"] .topo-location { border-color: #287c54; background: #287c54; color: #fff; }
html[data-theme="dark"] .topo-location:hover { border-color: #1d5e41; background: #1d5e41; }
html[data-theme="dark"] .topo-switch-ui { border-color: #53665b; background: #313e36; }
html[data-theme="dark"] .topo-switch-ui::after { background: #edf4ef; }
html[data-theme="dark"] .topo-result, html[data-theme="dark"] .topo-waypoints { border-color: #3b5144; background: #1a2821; }
html[data-theme="dark"] .topo-result-values dd { color: #a4dfbb; }
html[data-theme="dark"] .topo-copy, html[data-theme="dark"] .topo-waypoint-button { border-color: #44594c; background: #24332b; color: #e7f2eb; }
html[data-theme="dark"] .topo-waypoint-delete, html[data-theme="dark"] .topo-waypoint-status.is-error { color: #ff9a8d; }
html[data-theme="dark"] .topo-waypoint-item, html[data-theme="dark"] .topo-waypoint-empty { border-color: #394d40; background: #202e26; }
html[data-theme="dark"] .topo-waypoint-item.is-active { border-color: #77c493; }
html[data-theme="dark"] .topo-gathering { border-color: #645338; background: #2e281c; }
html[data-theme="dark"] .topo-gathering > p:not(.eyebrow), html[data-theme="dark"] .topo-gathering a { color: #f0d7a4; }
html[data-theme="dark"] .topo-status.is-error { color: #ff9a8d; }
html[data-theme="dark"] .topo-map-wrap { border-color: #3d5145; background: #19241e; }
html[data-theme="dark"] .topo-map-badge, html[data-theme="dark"] .topo-map-tip { border-color: #526357; background: #1b2922ed; color: #edf4ef; }
html[data-theme="dark"] .topo-map-error { border-color: #76493f; background: #34221f; color: #ffd2ca; }
html[data-theme="dark"] .topo-caution { border-color: #3c5144; background: #1a2821; color: #c4d2c8; }
html[data-theme="dark"] .topo-map .maplibregl-ctrl-group, html[data-theme="dark"] .topo-map .maplibregl-ctrl-attrib { border-color: #526357; background: #1b2922ed; color: #edf4ef; }
html[data-theme="dark"] .topo-map .maplibregl-ctrl-group { background: #fff; }
html[data-theme="dark"] .topo-map .maplibregl-ctrl-group button { background-color: #fff; }
html[data-theme="dark"] .topo-map .maplibregl-ctrl-attrib a { color: #b6d7c2; }
.topo-page.is-map-unavailable .topo-map-wrap { height: 160px; min-height: 160px; }
.topo-page.is-map-unavailable .topo-map-badge, .topo-page.is-map-unavailable .topo-map-tip { display: none; }
@media (max-width: 920px) {
  .topo-intro { grid-template-columns: 1fr; gap: 12px; }
  .topo-intro > p { max-width: 720px; }
  .topo-workspace { grid-template-columns: minmax(250px, 320px) minmax(0, 1fr); gap: 12px; }
  .topo-panel { padding: 16px; }
  .topo-map-wrap { height: min(68vh, 700px); min-height: 480px; }
}
@media (max-width: 700px) {
  .topo-page { padding-bottom: 30px; }
  .topo-intro { margin: 12px 0 18px; }
  .topo-intro h1 { font-size: clamp(2.15rem, 10vw, 3.2rem); }
  .topo-intro > p { font-size: .91rem; }
  .topo-workspace { grid-template-columns: 1fr; }
  .topo-panel { order: 2; }
  .topo-map-column { order: 1; }
  .topo-map-wrap { height: min(62vh, 610px); min-height: 390px; border-radius: 16px; }
  .topo-map-badge { top: 10px; left: 10px; padding: 7px 10px; font-size: .63rem; }
  .topo-map-tip { right: 9px; bottom: 10px; max-width: calc(100% - 18px); padding: 7px 9px; font-size: .68rem; }
  .topo-page.is-map-unavailable .topo-map-wrap { height: 130px; min-height: 130px; }
  .topo-page.is-map-unavailable .topo-panel { order: 1; }
  .topo-page.is-map-unavailable .topo-map-column { order: 2; }
  .topo-legend { gap: 8px 13px; font-size: .69rem; }
  .topo-legend .topo-legend-note { width: 100%; margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .topo-action, .topo-switch-ui, .topo-switch-ui::after { transition: none; }
}

.topo-navigation { min-width: 0; margin-top: 12px; padding: 12px; border: 1px solid var(--td2-border); border-radius: 12px; color: var(--td2-text); background: var(--td2-surface-raised); }
.topo-navigation[hidden] { display: none; }
.topo-navigation h4 { margin: 0 0 5px; font-size: .8rem; color: var(--td2-accent); }
.topo-navigation > strong { display: block; font-size: .88rem; overflow-wrap: anywhere; }
.topo-navigation-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 12px 0; }
.topo-navigation-metrics > div { min-width: 0; }
.topo-navigation-metrics dt { color: var(--td2-muted); font-size: .68rem; font-weight: 500; }
.topo-navigation-metrics dd { margin: 4px 0 0; color: var(--td2-text); font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.topo-navigation > p { margin: 0 0 10px; color: var(--td2-muted); font-size: .7rem; }
html[data-bs-theme] :is(.topo-waypoints, .topo-waypoint-item, .topo-waypoint-empty) { border-color: var(--td2-border); background: var(--td2-surface); }
html[data-bs-theme] .topo-waypoint-button { min-width: 0; border-color: var(--td2-border); background: var(--td2-surface); color: var(--td2-text); white-space: normal; overflow-wrap: anywhere; }
html[data-bs-theme] .topo-waypoint-button:hover { border-color: var(--td2-accent); color: var(--td2-accent); }
html[data-bs-theme] .topo-waypoint-directions { flex-basis: 100%; color: var(--td2-accent); background: var(--td2-surface-raised); }
html[data-bs-theme] .topo-waypoint-button[aria-pressed="true"] { border-color: var(--td2-accent); color: var(--td2-accent); }
html[data-bs-theme] .topo-waypoint-delete { color: #a12e23; }
html[data-bs-theme="dark"] .topo-waypoint-delete { color: #ff9a8d; }
