:root {
  color-scheme: dark;
  --bg: #111a27;
  --panel: #1c2a3d;
  --ink: #f5f8ff;
  --dim: #bfcbdb;
  --grid: #485a72;
  --blue: #68b9ff;
  --green: #58de9c;
  --yellow: #ffda69;
  --orange: #ff9c59;
  --red: #ff7483;
  --gray: #96a5b8;
  font-family: system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); }
main {
  width: min(100%, 30rem);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  margin: auto;
  padding: max(4px, env(safe-area-inset-top)) max(4px, env(safe-area-inset-right))
    max(4px, env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left));
}
main > :not(.profile) { flex-shrink: 0; }
header, .section-head, .legend { display: flex; align-items: center; justify-content: space-between; gap: 7px; }
h1, h2, p, dl, dd { margin: 0; }
header { padding-left: 4px; }
h1 { font-size: clamp(20px, 6.15vw, 29px); letter-spacing: -.025em; }
.install {
  min-height: 44px;
  padding: 0 11px;
  border: 1px solid var(--blue);
  border-radius: 9px;
  background: var(--panel);
  font-size: 13px;
  font-weight: 750;
}
.install-hint { color: var(--dim); font-size: 12px; padding: 4px; line-height: 1.35; }
h2 { font-size: clamp(14px, 4.65vw, 19px); line-height: 1.15; }
button, select { font: inherit; }
button { cursor: pointer; color: inherit; }
button:focus-visible, select:focus-visible, summary:focus-visible, a:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
nav { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; background: var(--panel); margin-top: 4px; padding: 3px; border-radius: 12px; }
nav button { min-height: 40px; background: none; border: 0; border-radius: 9px; font-size: 13px; font-weight: 750; color: var(--dim); }
nav button[aria-pressed=true] { background: var(--ink); color: var(--bg); }
#status { color: var(--dim); font-size: 12px; min-height: 23px; padding: 4px 4px; line-height: 1.35; }
.route-choice { display: flex; align-items: center; gap: 7px; color: var(--dim); font-size: 12px; padding-top: 6px; }
.route-choice select { flex: 1; min-width: 0; max-width: 65%; }
.panel { background: var(--panel); border-radius: 11px; padding: 8px 9px 1px; margin-bottom: 5px; }
.section-head span { font-size: 11px; color: var(--dim); white-space: nowrap; }
.profile {
  display: flex;
  flex-direction: column;
  flex: 1 0 0px;
}
.profile-near { flex-grow: 1.25; }
.profile svg {
  display: block;
  width: 100%;
  flex: 1 0 0px;
  min-height: 78px;
  overflow: visible;
  font: 12px system-ui, sans-serif;
}
.profile-near svg { min-height: 102px; }
svg .grid { stroke: var(--grid); stroke-width: 1; }
svg text { fill: var(--dim); }
svg .marker { fill: var(--ink); font-size: 10px; font-weight: 800; }
svg .terrain { fill: none; stroke-width: 3.5; stroke-linecap: round; }
.climb { --accent: var(--blue); position: relative; padding: 8px 11px 10px 13px; }
.climb::before { content: ''; position: absolute; inset: 8px auto 8px 0; width: 4px; border-radius: 3px; background: var(--accent); }
.climb h2 { font-size: 13px; color: var(--accent); }
#climbDistance { line-height: 1.06; font-weight: 820; font-size: clamp(26px, 11vw, 46px); margin: 3px 0 5px; overflow-wrap: anywhere; }
#climbDistance.note { font-size: clamp(16px, 5vw, 22px); }
dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
dl div { display: flex; flex-direction: column; }
dt { order: 2; color: var(--dim); font-size: 11px; }
dd { order: 1; font-weight: 800; font-size: clamp(17px, 6.4vw, 28px); white-space: nowrap; }
.legend { padding-inline: 3px; justify-content: flex-start; color: var(--dim); font-size: 10px; }
.swatches { display: flex; gap: 3px; }
.swatches i { width: 8px; height: 7px; border-radius: 2px; background: var(--color); }
.swatches i:nth-child(1) { --color: var(--blue); }
.swatches i:nth-child(2) { --color: var(--green); }
.swatches i:nth-child(3) { --color: var(--yellow); }
.swatches i:nth-child(4) { --color: var(--orange); }
.swatches i:nth-child(5) { --color: var(--red); }
#demo { margin-left: auto; padding: 6px; border: none; background: none; font-size: 11px; text-decoration: underline; }
details { margin: 0 4px; color: var(--dim); font-size: 11px; }
summary { width: fit-content; cursor: pointer; }
details p { margin-top: 8px; }
a { color: var(--blue); }
@media (max-width: 290px) {
  .section-head span { font-size: 9px; }
  .panel { padding-inline: 9px; }
  .climb { padding-left: 12px; }
  dt { font-size: 9px; }
}

@media (display-mode: fullscreen) {
  :root { background: var(--bg); }
}

@media (max-height: 540px) {
  h1 { font-size: 23px; }
  h2 { font-size: 15px; }
  .install, nav button { min-height: 36px; }
  .profile svg { min-height: 60px; }
  .profile-near svg { min-height: 81px; }
  .climb { padding-block: 6px; }
  #climbDistance { font-size: 32px; }
  #climbDistance.note { font-size: 18px; }
  dd { font-size: 20px; }
  #demo { padding-block: 4px; }
}
