:root {
  --ink: #173b45;
  --muted: #4d656c;
  --line: #d5e4e2;
  --accent: #173b45;
  --track: #168c83;
  --mint: #80dece;
  --panel: #fff;
  --warn: #b43820;
  --font: "Avenir Next", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: var(--font);
  background: #f3f8f7;
  overflow: hidden;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0 0.8rem;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 5;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 1.35rem;
  letter-spacing: 0.01em;
}

.brand strong {
  color: var(--accent);
}

.brand-mark {
  width: 52px;
  height: 40px;
  display: block;
  flex: none;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
}

.controls {
  margin-left: auto;
  display: flex;
  gap: 0.4rem;
}

.icon-btn,
.lang-btn,
.route-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

#plannerToggle:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

#plannerToggle[aria-expanded="true"]:focus-visible {
  outline-color: #fff;
  box-shadow: 0 0 0 3px var(--accent);
}

.measure-bar {
  width: min(100%, 420px);
  background: #ffffffee;
  border-radius: 8px;
  padding: 0.35rem 0.55rem;
  box-shadow: 0 1px 4px #0000001a;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.measure-bar[hidden] {
  display: none;
}

.measure-bar p {
  margin: 0;
}

.measure-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

#measureToggle[aria-pressed="true"] {
  background: var(--track);
  border-color: var(--track);
  color: #fff;
}

.measure-pin {
  width: 14px;
  height: 14px;
  border: 2px solid #fff;
  border-radius: 2px;
  background: var(--track);
  box-shadow: 0 1px 4px #00000033;
  padding: 0;
  cursor: grab;
}

.measure-label {
  background: #ffffffee;
  color: var(--accent);
  border: 1px solid var(--track);
  border-radius: 4px;
  font: 600 11px/1.2 sans-serif;
  padding: 0 0.25rem;
  pointer-events: none;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 0;
  box-shadow: 0 1px 2px #0001;
}

#menuToggle {
  box-shadow: none;
  border-color: transparent;
  align-content: center;
}

#menuToggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--accent);
  margin: 3px auto;
}

.lang-btn {
  border-radius: 999px;
  padding: 0.3rem 0.65rem;
}

.lang-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.map-stage {
  position: relative;
  height: calc(100% - 56px);
}

#map {
  position: absolute;
  inset: 0;
  height: auto;
  border-radius: 0;
}

.map-search,
.layers-wrap,
.bottom-stack {
  position: absolute;
  z-index: 2;
}

.map-search {
  top: 12px;
  left: 12px;
}

#placeSearch {
  width: min(280px, 70vw);
  height: 40px;
  border: 1px solid #cfd6dc;
  border-radius: 6px;
  padding: 0 0.8rem;
  font: inherit;
  background: #fff;
  box-shadow: 0 1px 3px #00000014;
}

.layers-wrap {
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.layers-btn {
  color: #3a4248;
}

.layer-panel {
  display: none;
  width: min(280px, 82vw);
  max-height: min(540px, calc(100vh - 360px));
  overflow: auto;
  background: #fff;
  border: 1px solid #e6eaee;
  border-radius: 8px;
  box-shadow: 0 8px 24px #0000001f;
  padding: 0.7rem 0.8rem 0.85rem;
}

.layers-wrap.open .layer-panel {
  display: block;
}

.panel-label {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.layer-choice {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.04rem 0;
  line-height: 1.15;
  cursor: pointer;
}

.bottom-stack {
  left: 12px;
  bottom: 32px;
  width: min(460px, calc(100% - 24px));
  max-height: calc(100% - 24px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.bottom-stack > * {
  pointer-events: auto;
}

#terrainStatus,
.legend-float,
.planner-toolbar,
.measure-bar,
.map-note {
  flex-shrink: 0;
}

.route-bar {
  flex-shrink: 0;
  background: #ffffffee;
  border-radius: 10px;
  box-shadow: 0 1px 4px #0000001a;
  padding: 0.45rem 0.55rem 0.5rem;
}

.route-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.gpx-open {
  margin-inline-start: 0.75rem;
}

.trip-name {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 0.45rem;
  font-size: 0.82rem;
}

.trip-name input {
  font: inherit;
  padding: 0.35rem 0.45rem;
  border: 1px solid #c5cdd6;
  border-radius: 8px;
}

.file-btn input {
  display: none;
}

.comparison-card,
.support-list {
  margin-top: 0.35rem;
}

.support-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.support-row input {
  min-width: 0;
  max-width: 100%;
}

.profile-cursor {
  width: 14px;
  height: 14px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #c45c26;
  box-shadow: 0 0 0 1px var(--accent);
}

.profile-slider input {
  width: 100%;
}

.route-modes + .route-modes,
.route-bar .small {
  margin-top: 0.35rem;
}

.route-bar .small:empty {
  display: none;
}

.planner-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  max-height: min(46vh, 520px);
  overflow: hidden;
}

.planner-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.route-figures {
  margin: 0 0 0.15rem;
  flex: 1 0 100%;
  color: var(--ink);
  font-weight: 650;
  font-size: 1rem;
}

.route-figures[hidden] {
  display: none;
}

.planner-actions,
.share-preview {
  flex: 0 0 auto;
  background: #ffffffee;
  border-radius: 10px;
  box-shadow: 0 1px 4px #0000001a;
  padding: 0.45rem 0.55rem;
}

.planner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.planner-actions .route-btn {
  min-height: 40px;
}

.share-preview p {
  margin: 0 0 0.35rem;
}

.trip-rail {
  background: #ffffffee;
  border-radius: 10px;
  box-shadow: 0 1px 4px #0000001a;
  padding: 0.4rem 0.55rem 0.5rem;
}

.trip-rail[hidden] {
  display: none;
}

.trip-rail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.trip-rail-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#supportModes {
  flex-direction: column;
  align-items: flex-start;
}

.support-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  width: 100%;
  margin-top: 0.35rem;
}

.support-picker[hidden] {
  display: none;
}

.planner-panel[hidden] {
  display: none;
}

.planner-panel > * {
  flex: 0 0 auto;
}

.planner-panel > .planner-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.depart-compare {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  overflow: visible;
  background: #ffffffee;
  border-radius: 10px;
  box-shadow: 0 1px 4px #0000001a;
  padding: 0.45rem 0.55rem 0.55rem;
}

#compareToggle {
  width: 100%;
  min-height: 40px;
  text-align: left;
  font-weight: 600;
}

#comparePanel[hidden] {
  display: none;
}

.weather-timeline {
  flex: 0 0 auto;
  background: #ffffffee;
  border-radius: 10px;
  box-shadow: 0 1px 4px #0000001a;
  padding: 0.45rem 0.55rem 0.55rem;
}

#timelineToggle {
  width: 100%;
  min-height: 40px;
  text-align: left;
  font-weight: 600;
}

#timelinePanel[hidden] {
  display: none;
}

#timelinePanel {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 240px;
  overflow: auto;
  margin-top: 0.4rem;
}

.timeline-chart {
  width: 100%;
  height: auto;
  min-height: 148px;
  aspect-ratio: 360 / 186;
  flex: 0 0 auto;
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  touch-action: pan-y;
}

.timeline-slider input {
  width: 100%;
  min-height: 32px;
}

.timeline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.timeline-actions .route-btn {
  flex: 1 1 140px;
  min-height: 40px;
}

#timelinePreview[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

#timelineReadout {
  white-space: pre-line;
}

#timelinePlace:empty,
#timelineMeta:empty,
#timelineNotice:empty,
#timelineLee:empty,
#timelinePeriod:empty {
  display: none;
}

.wind-preview[hidden] {
  display: none;
}

.wind-preview {
  position: absolute;
  z-index: 3;
  top: 60px;
  left: 12px;
  max-width: min(420px, calc(100% - 88px));
  margin: 0;
  padding: 0.35rem 0.55rem;
  background: #fff8ee;
  border: 1px solid #b45309;
  border-radius: 8px;
  color: #3c4650;
  font-size: 0.82rem;
  line-height: 1.35;
  pointer-events: none;
}

#comparePanel {
  min-height: 0;
  overflow: auto;
}

.compare-grid {
  display: grid;
  gap: 0.45rem;
}

.compare-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.55rem 0.55rem;
  min-width: 0;
}

.compare-card h3 {
  margin: 0 0 0.25rem;
  font-size: 0.92rem;
}

.compare-card.in-use {
  border-color: var(--accent);
}

.compare-use-mark {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.2rem;
}

.compare-body {
  white-space: pre-line;
  font-size: 0.82rem;
  color: var(--ink);
}

.compare-when {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.35rem;
  font-size: 0.82rem;
}

#compareWhen,
.compare-card button {
  width: 100%;
  min-height: 40px;
  font: inherit;
}

.compare-card button {
  margin-top: 0.4rem;
}

#comparePlace:empty,
#compareRange:empty,
#compareStatus:empty {
  display: none;
}

.compare-grid {
  grid-template-columns: 1fr;
}

.planner-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  flex-shrink: 0;
  align-items: center;
}

.card h4 {
  margin: 0.75rem 0 0.2rem;
  font-size: 0.86rem;
}

.card h4:first-of-type {
  margin-top: 0;
}

#forecastWindow:empty,
#departNotes:empty,
#conditionStamp:empty {
  display: none;
}

.planner-toolbar .route-btn,
#plannerToggle {
  min-height: 40px;
  box-shadow: 0 1px 4px #0000001a;
}

#plannerToggle {
  font-weight: 600;
  border-color: var(--accent);
  color: var(--accent);
}

#plannerToggle[aria-expanded="true"] {
  background: var(--accent);
  color: #fff;
}

.map-note {
  margin: 0;
  width: fit-content;
  background: #ffffffee;
  border-radius: 8px;
  padding: 0.2rem 0.55rem;
  box-shadow: 0 1px 4px #0000001a;
}

.map-note:empty,
#waterStatus:empty {
  display: none;
}

.route-btn {
  border-radius: 999px;
  padding: 0.32rem 0.7rem;
}

.route-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.route-btn:disabled,
.layer-choice input:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.legend-float,
.status-float {
  background: #ffffffee;
  border-radius: 8px;
  box-shadow: 0 1px 4px #0000001a;
}

.legend-float {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  width: fit-content;
  padding: 0.4rem 0.65rem;
  font-size: 0.82rem;
}

.legend-float span {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

#slopeLegend,
#aspectLegend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.7rem;
}

#slopeLegend[hidden],
#aspectLegend[hidden] {
  display: none;
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  display: inline-block;
}

.s1 { background: #2f9478; }
.s2 { background: #d69e1c; }
.s3 { background: #d6602a; }
.s4 { background: #b01246; }

.status-float {
  padding: 0.15rem 0.7rem;
  max-height: 30vh;
  overflow: auto;
}

#routeStats {
  white-space: pre-line;
}

.status-float:not(:has(p:not(:empty), canvas:not([hidden]))),
.status-float p:empty {
  display: none;
}

#routeProfile {
  width: 100%;
  height: 78px;
  display: block;
  margin-top: 0.35rem;
}

#routeProfile[hidden],
#tempCurve[hidden],
.wind-arrow[hidden] {
  display: none;
}

.wind-arrow {
  position: absolute;
  left: 50%;
  top: 42%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--accent);
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.wind-arrow svg {
  filter: drop-shadow(0 0 2px #fff) drop-shadow(0 0 2px #fff);
}

.wind-arrow span {
  background: #ffffffee;
  border-radius: 999px;
  font-size: 0.75rem;
  padding: 0.1rem 0.45rem;
}

.weather-mark {
  position: absolute;
  left: 50%;
  top: 38%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.weather-mark[hidden] {
  display: none;
}

.weather-ring {
  --ring: var(--line);
  position: relative;
  width: 92px;
  height: 92px;
  border: 6px solid var(--ring);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px #00000022;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  color: var(--ink);
  font-weight: 600;
  line-height: 1.1;
}

.weather-ring[data-band="light"] { --ring: #2aa7c7; }
.weather-ring[data-band="moderate"] { --ring: #3c9a45; }
.weather-ring[data-band="fresh"] { --ring: #e09a1a; }
.weather-ring[data-band="strong"] { --ring: #d6452a; }
.weather-ring[data-band="severe"] { --ring: #7a3aa8; }

.weather-temp {
  font-size: 1.35rem;
}

.weather-speed,
.weather-from {
  font-size: 0.78rem;
}

.weather-notch {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  pointer-events: none;
}

.weather-notch[hidden] {
  display: none;
}

.weather-notch::before,
.weather-notch::after {
  content: "";
  position: absolute;
  left: 50%;
  border-style: solid;
  border-color: transparent;
}

.weather-notch::before {
  top: -16px;
  margin-left: -11px;
  border-width: 0 11px 18px;
  border-bottom-color: #fff;
}

.weather-notch::after {
  top: -12px;
  margin-left: -8px;
  border-width: 0 8px 14px;
  border-bottom-color: var(--ring);
}

#weatherMarkNote {
  margin: 0;
  max-width: 180px;
  padding: 0.1rem 0.45rem;
  background: #ffffffee;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.3;
  text-align: center;
}

#weatherMarkNote:empty {
  display: none;
}

.fell-weather {
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  color: var(--ink);
}

.fell-weather .weather-ring {
  width: 58px;
  height: 58px;
  border-width: 4px;
  pointer-events: none;
}

.fell-weather.is-selected .weather-ring {
  width: 84px;
  height: 84px;
  border-width: 6px;
}

.fell-weather .weather-temp {
  font-size: 1rem;
}

.fell-weather.is-selected .weather-temp {
  font-size: 1.2rem;
}

.fell-name,
.fell-preview {
  margin-top: 0.12rem;
  padding: 0 0.35rem;
  background: #ffffffee;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.3;
}

.fell-preview {
  color: #9a3412;
}

.fell-preview[hidden] {
  display: none;
}

.weather-ring.is-compact {
  width: 72px;
  height: 72px;
  border-width: 5px;
  margin: 0.15rem 0 0.35rem;
  pointer-events: none;
}

.weather-ring.is-compact .weather-temp {
  font-size: 1.05rem;
}

.compare-lines {
  margin: 0;
  white-space: pre-line;
}

.weather-hours {
  position: absolute;
  z-index: 3;
  left: 8px;
  right: 8px;
  bottom: 6px;
  background: #ffffffee;
  border-radius: 10px;
  box-shadow: 0 1px 4px #0000001a;
  padding: 0.25rem 0.35rem;
}

.weather-hour-tools {
  display: flex;
  justify-content: flex-end;
  gap: 0.35rem;
}

.weather-hour-tools:not(:has(button:not([hidden]))) {
  display: none;
}

.weather-hour-tools .route-btn {
  min-height: 32px;
  padding: 0.15rem 0.55rem;
  font-size: 0.78rem;
}

.weather-hours[hidden] {
  display: none;
}

.weather-hour-track {
  display: flex;
  gap: 0.2rem;
  overflow-x: auto;
  padding-bottom: 0.1rem;
}

.weather-hour {
  flex: 0 0 auto;
  width: 52px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0.15rem 0.1rem 0.3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0.05rem;
  cursor: pointer;
}

.weather-hour-day {
  min-height: 0.85rem;
  font-size: 0.62rem;
  color: var(--muted);
  line-height: 1.1;
}

.weather-hour-time {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.1;
}

.weather-hour-offset {
  font-size: 0.62rem;
  line-height: 1;
  color: var(--muted);
}

.weather-hour-wind {
  width: 70%;
  height: 4px;
  border-radius: 999px;
  background: var(--line);
}

.weather-hour[data-band="light"] .weather-hour-wind { background: #2aa7c7; }
.weather-hour[data-band="moderate"] .weather-hour-wind { background: #3c9a45; }
.weather-hour[data-band="fresh"] .weather-hour-wind { background: #e09a1a; }
.weather-hour[data-band="strong"] .weather-hour-wind { background: #d6452a; }
.weather-hour[data-band="severe"] .weather-hour-wind { background: #7a3aa8; }

.weather-hour.is-shown {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.weather-hour.is-departure .weather-hour-time {
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

#windLegend {
  display: flex;
  flex-basis: 100%;
  flex-wrap: wrap;
  gap: 0.35rem 0.7rem;
}

#windLegend[hidden] {
  display: none;
}

.wind-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: inset 0 0 0 3px currentColor;
  background: #fff;
}

.wind-swatch[data-band="light"] { color: #2aa7c7; }
.wind-swatch[data-band="moderate"] { color: #3c9a45; }
.wind-swatch[data-band="fresh"] { color: #e09a1a; }
.wind-swatch[data-band="strong"] { color: #d6452a; }
.wind-swatch[data-band="severe"] { color: #7a3aa8; }

.map-stage.hours-open .bottom-stack {
  bottom: var(--hour-strip, 76px);
  max-height: calc(100% - 12px - var(--hour-strip, 76px));
}

.map-stage.hours-open .maplibregl-ctrl-bottom-right,
.map-stage.hours-open .maplibregl-ctrl-bottom-left {
  bottom: var(--hour-strip, 76px);
}

#tempCurve {
  width: 100%;
  height: 108px;
  display: block;
  margin-top: 0.4rem;
}

#tempCurveNote {
  margin: 0.3rem 0 0;
}

.trip-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.trip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.trip-prepare,
.trip-delete,
#refreshConditions {
  min-height: 40px;
}

.trip-report,
.offline-note {
  flex: 1 0 100%;
  margin: 0;
}

.offline-note {
  position: absolute;
  z-index: 3;
  top: 0.6rem;
  left: 0.6rem;
  right: 0.6rem;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  background: rgba(255, 248, 230, 0.95);
  color: #3d3420;
  pointer-events: none;
}

.offline-note button {
  pointer-events: auto;
  margin-left: 0.35rem;
  min-height: 32px;
}

.trip-row button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}

.trip-row .trip-open {
  flex: 1;
  padding: 0.4rem 0.55rem;
}

.leg-list {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  max-width: 100%;
  padding-bottom: 0.1rem;
}

.leg-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 0.22rem 0.55rem;
  font: inherit;
  cursor: pointer;
}

.leg-chip.selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.leg-chip i {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}

.text-retry {
  border: 0;
  background: transparent;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.depart {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.2rem;
  font-size: 0.92rem;
}

.depart select {
  flex: 1;
  min-width: 0;
}

.route-pin,
.source-pin {
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px #00000033;
  padding: 0;
}

.route-pin {
  width: 22px;
  height: 22px;
  background: var(--accent);
  color: #fff;
  font: 700 11px/18px sans-serif;
  cursor: grab;
}

.route-pin.start { background: #1b7f4e; }
.route-pin.end { background: #9b1d3a; }

.source-pin {
  width: 16px;
  height: 16px;
  background: var(--accent);
  cursor: pointer;
}

#aspectLegend {
  max-width: 280px;
}

.source-pin.avalanche { background: #c44900; }

.source-card {
  z-index: 6;
  font-family: var(--font);
}

.source-card .maplibregl-popup-content {
  padding: 0.7rem 0.75rem 0.75rem;
  border-radius: 12px;
  color: var(--ink);
  box-shadow: 0 8px 24px #00000022;
}

.source-card .maplibregl-popup-close-button {
  font-size: 1.15rem;
  color: var(--muted);
  padding: 0.15rem 0.4rem;
}

.source-card-title {
  display: block;
  padding-right: 1rem;
  font-size: 0.98rem;
}

.source-links {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.source-links a {
  display: block;
  border-radius: 8px;
  padding: 0.38rem 0.55rem;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
}

.source-links a[data-kind="weather"],
.source-links a[data-kind="weather"]:visited {
  color: var(--accent);
  background: var(--mint);
}

.source-links a[data-kind="wind"],
.source-links a[data-kind="wind"]:visited {
  color: #fff;
  background: var(--track);
}

.source-links a[data-kind="avalanche"],
.source-links a[data-kind="avalanche"]:visited {
  color: #8a3414;
  background: #f8ece4;
}

.source-links a:hover {
  filter: brightness(0.97);
}

.source-links a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 1px;
}

.status-float p {
  margin: 0.35rem 0;
}

.maplibregl-ctrl-top-left {
  top: 60px;
  left: 12px;
}

.orbit-ctrl {
  display: flex;
}

.orbit-ctrl[hidden] {
  display: none;
}

.orbit-ctrl button {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  padding: 0;
  color: #333;
  background: #fff;
  cursor: pointer;
}

.orbit-ctrl button + button {
  border-left: 1px solid #ddd;
}

.drawer {
  position: fixed;
  z-index: 4;
  top: 56px;
  left: 0;
  bottom: 0;
  width: min(380px, 100%);
  background: #fff;
  border-right: 1px solid var(--line);
  box-shadow: 8px 0 24px #00000014;
  transform: translateX(-105%);
  transition: transform 0.2s ease;
  overflow: auto;
  padding: 1rem;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  align-items: flex-start;
}

.drawer h2 {
  margin: 0 0 0.8rem;
  font-size: 1.05rem;
}

.safety-banner {
  margin: 0 0 0.8rem;
  padding: 0.7rem;
  border-left: 4px solid var(--warn);
  background: #fff2ef;
  border-radius: 8px;
}

.cards {
  display: grid;
  gap: 0.6rem;
}

.card {
  background: #f6f8fa;
  padding: 0.7rem;
  border-radius: 8px;
}

button.card {
  display: block;
  width: 100%;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

button.card:hover,
button.card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.card h3,
.drawer section h2 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

#sourcesTitle {
  font-size: 0.92rem;
}

.source-list {
  margin: 0;
  padding-left: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.82rem;
  line-height: 1.4;
}

.source-list a {
  color: var(--track);
}

.about-entry {
  margin: 0.2rem 0 1rem;
}

.about-entry button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--track);
  font: inherit;
  font-size: 0.92rem;
  text-align: left;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.modal-content.about-sheet {
  width: min(34rem, 100%);
  max-width: 34rem;
  max-height: min(36rem, calc(100% - 1rem));
  overflow: auto;
  padding: 0;
}

.about-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
  position: sticky;
  top: 0;
  padding: 0.85rem 0.7rem 0.45rem 1rem;
  background: #fff;
}

.about-head h2 {
  margin: 0.35rem 0 0;
  font-size: 1.15rem;
}

.about-copy {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0 1rem 1.1rem;
  font-size: 0.95rem;
  line-height: 1.45;
}

.about-logo {
  display: block;
  width: min(280px, 100%);
  height: auto;
  margin: 0.2rem 0 0.6rem;
}

.about-copy h3 {
  margin: 0.45rem 0 0;
  font-size: 0.92rem;
}

.about-copy p {
  margin: 0;
}

.about-copy a {
  color: var(--track);
}

.maplibregl-ctrl-attrib {
  max-width: min(460px, 78vw);
  font-family: var(--font);
  font-size: 11px;
  line-height: 1.35;
}

#timelineChart text {
  font-family: var(--font);
}

.maplibregl-ctrl-attrib a {
  color: inherit;
}

.small {
  font-size: 0.86rem;
  color: var(--muted);
}

#terrainNotice.warn {
  color: var(--warn);
}

#routeStats {
  color: var(--ink);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 6;
  background: #173b45cc;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.visible {
  display: flex;
}

.modal-content {
  max-width: 520px;
  background: #fff;
  padding: 1rem;
  border-radius: 10px;
}

#acceptDisclaimer {
  margin-top: 1rem;
  border: none;
  border-radius: 6px;
  padding: 0.7rem 0.95rem;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

@media (max-width: 700px) {
  .bottom-stack {
    width: calc(100% - 16px);
    left: 8px;
    max-height: calc(100% - 16px);
  }

  #terrainStatus,
  .status-float {
    max-height: 16vh;
    overflow: auto;
  }

  .route-bar {
    flex-shrink: 0;
  }

  #plannerPanel {
    max-height: 46vh;
  }

  .layer-panel {
    max-height: min(168px, 24vh);
  }

  .planner-toolbar {
    flex-shrink: 0;
  }

  .map-search {
    left: 8px;
    right: 64px;
  }

  #placeSearch {
    width: 100%;
  }
}
