/* Elevation profile, shared by the route builder and public route pages. */
.elevation-profile { position: relative; display: grid; grid-template-rows: 24px minmax(0, 1fr); gap: 4px; height: 176px; padding: 10px 16px 8px; overflow: hidden; background: #fff; color: #283e36; }
.elevation-profile[hidden] { display: none; }
.elevation-profile svg { display: block; width: 100%; height: 100%; min-height: 0; cursor: crosshair; touch-action: pan-y; }
.elevation-profile__header { display: flex; justify-content: space-between; align-items: center; gap: 16px; font-size: 12px; line-height: 1.3; }
.elevation-profile__title { font-weight: 500; letter-spacing: -.01em; }
.elevation-profile__totals { display: flex; gap: 18px; color: #69756e; font-size: 11px; font-variant-numeric: tabular-nums; }
.elevation-profile__grid line { stroke: #e9eeeb; stroke-width: 1; }
.elevation-profile__grid text { fill: #7b8580; font: 10px Inter, ui-sans-serif, system-ui, sans-serif; }
.elevation-profile__line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.elevation-profile__cursor { stroke: #80978b; stroke-width: 1; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.elevation-profile__cursor-point { fill: #fff; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.elevation-profile__cursor[hidden], .elevation-profile__cursor-point[hidden] { display: none; }
.elevation-profile__detail { position: absolute; top: 38px; z-index: 1; padding: 6px 10px; border: 1px solid #dce6df; border-radius: 7px; background: #fff; box-shadow: 0 2px 8px #1432210d; color: #283e36; font-size: 11px; font-weight: 400; font-variant-numeric: tabular-nums; line-height: 1.2; pointer-events: none; display: flex; flex-direction: column; gap: 3px; max-width: calc(100% - 16px); box-sizing: border-box; white-space: normal; }
.elevation-profile__detail[hidden] { display: none; }
.elevation-profile:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.elevation-profile--public { border-top: 1px solid var(--border, #dddcd5); }
.route-profile-marker { display: block; box-sizing: border-box; width: 14px; height: 14px; min-width: 14px; min-height: 14px; aspect-ratio: 1; border: 2px solid white; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring), 0 2px 6px #14322133; }
@media(max-width:760px) { .elevation-profile { padding: 6px 10px 4px; grid-template-rows: 20px minmax(0, 1fr); gap: 2px; } .elevation-profile__totals { gap: 12px; } .elevation-profile__detail { top: 28px; padding: 4px 8px; font-size: 10px; } }
/* Profile tools share the same interaction model in the builder and public view. */
.elevation-profile { grid-template-rows: 28px minmax(0, 1fr); }
.elevation-profile__header { gap: 8px; min-width: 0; }
.elevation-profile__title { flex: 0 0 auto; }
.elevation-profile__actions { display: flex; align-items: center; gap: 4px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.elevation-profile__actions::-webkit-scrollbar { display: none; }
.elevation-profile .elevation-profile__action { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; gap: 4px; width: auto; min-width: 28px; min-height: 26px; height: 26px; margin: 0; padding: 3px 7px; border: 1px solid #dce6df; border-radius: 6px; background: #fff; color: var(--accent); font: 400 11px/1.2 Inter, system-ui, sans-serif; white-space: nowrap; }
.elevation-profile .elevation-profile__action[hidden] { display: none; }
.elevation-profile .elevation-profile__action svg { flex: 0 0 14px; width: 14px; height: 14px; min-height: 14px; touch-action: auto; cursor: inherit; }
.elevation-profile .elevation-profile__action[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-border); }
.elevation-profile .elevation-profile__action:disabled { opacity: .45; cursor: default; }
.elevation-profile .elevation-profile__action:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.elevation-profile__totals { margin-left: auto; white-space: nowrap; gap: 12px; }
@media(max-width:760px) {
 .elevation-profile { grid-template-rows: 28px minmax(0, 1fr); }
 .elevation-profile__header { gap: 6px; }
 .elevation-profile__title { font-size: 11px; }
 .elevation-profile__totals { gap: 6px; font-size: 10px; }
 .elevation-profile .elevation-profile__action { padding: 3px 5px; }
 .elevation-profile__action span { display: none; }
}
.elevation-profile.is-grade { grid-template-rows: 28px 14px minmax(0, 1fr); }
.elevation-profile__grade-legend { display: flex; justify-content: flex-end; align-items: center; gap: 12px; min-width: 0; color: #67736d; font: 400 10px/1 Inter, system-ui, sans-serif; }
.elevation-profile__grade-legend[hidden] { display: none; }
.elevation-profile__grade-legend > span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.elevation-profile__grade-legend i { display: inline-block; width: 14px; height: 6px; border-radius: 2px; }
.route-profile-marker { pointer-events: none; }
@media(max-width:760px) { .elevation-profile__grade-legend { justify-content: center; gap: 12px; font-size: 9px; } }

/* Touch tools have their own row: readable names and full finger targets. */
@media (max-width: 760px), (max-height: 500px) and (pointer: coarse) {
 .elevation-profile { height: 196px; grid-template-rows: 70px minmax(0, 1fr); padding: 8px 12px 6px; gap: 4px; }
 .elevation-profile.is-grade { grid-template-rows: 70px 24px minmax(0, 1fr); }
 .elevation-profile__header { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: 18px 48px; gap: 4px 8px; }
 .elevation-profile__title { font-size: 12px; }
 .elevation-profile__totals { grid-column: 2; grid-row: 1; font-size: 11px; }
 .elevation-profile__actions { grid-column: 1 / -1; grid-row: 2; align-self: stretch; overflow-x: auto; scrollbar-width: thin; overscroll-behavior-x: contain; touch-action: pan-x; }
 .elevation-profile .elevation-profile__action { height: 44px; min-height: 44px; min-width: 44px; padding: 8px 10px; font-size: 12px; }
 .elevation-profile__action span { display: inline; }
 .elevation-profile__grade-legend { justify-content: flex-start; gap: 12px; overflow-x: auto; white-space: nowrap; }
 .elevation-profile__grade-legend > span { flex: none; }
 .elevation-profile__detail { top: 82px; max-width: calc(100% - 16px); font-size: 11px; }
}

.elevation-profile__reading { font-weight: 500; }
.elevation-profile__slope { color: #69756e; }
.elevation-profile__slope[hidden] { display: none; }
.elevation-profile__circuits { pointer-events: none; }
.elevation-profile__circuit-rail { opacity: .6; }
.elevation-profile__circuit-badge { fill: #fff; stroke: #dce6df; stroke-width: 1; }
.elevation-profile__circuit-label { fill: #52665c; font: 400 10px Inter, ui-sans-serif, system-ui, sans-serif; }

/* Give lap labels their own space without flattening the chart beneath them. */
.elevation-profile--public.has-circuits { height: 200px; }
@media (max-width: 760px), (max-height: 500px) and (pointer: coarse) { .elevation-profile--public.has-circuits { height: 220px; } }
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
 .elevation-profile { grid-template-rows: 44px minmax(0, 1fr); }
 .elevation-profile.is-grade { grid-template-rows: 44px 24px minmax(0, 1fr); }
 .elevation-profile__header { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: 44px; }
 .elevation-profile__title { grid-column: 1; grid-row: 1; }
 .elevation-profile__actions { grid-column: 2; grid-row: 1; }
 .elevation-profile__totals { grid-column: 3; grid-row: 1; }
}
/* Keep every mobile action reachable without a row of text buttons. */
@media (max-width:760px), (max-height:500px) and (pointer:coarse) {
 .elevation-profile__action-label { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
 .elevation-profile .elevation-profile__action { display: inline-flex; flex: 0 0 44px; justify-content: center; align-items: center; width: 44px; min-width: 44px; height: 44px; padding: 0; }
 .elevation-profile__action svg { width: 18px; height: 18px; margin: 0; }
}

.elevation-profile .elevation-profile__action.is-warning { border-color: #e5cba5; background: #fff5e6; color: #8a4b0b; }
.elevation-profile .elevation-profile__action.is-warning .elevation-profile__action-label { display: inline; }

/* Animals replace the dot and stand directly on the inspected coordinate. */
.route-cursor { display: block; pointer-events: none; user-select: none; z-index: 3; }
.route-cursor--character { width: 24px; height: 24px; }
.route-cursor__character { display: block; width: 100%; height: 100%; transform: translateY(-25%) scaleX(var(--cursor-facing,1)); transform-origin: center; filter: drop-shadow(0 1px 1px #18352c66); }
.route-cursor__character img { display: block; width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }

.route-cursor--custom { width: var(--cursor-size); height: var(--cursor-size); }
.route-cursor--custom .route-cursor__character { transform: translateY(var(--cursor-offset)) scaleX(var(--cursor-facing,1)); }
.route-cursor--custom img.is-circle { border-radius: 50%; object-fit: cover; }
