dialog.run-timer {
  width: min(100% - 24px, 420px);
  max-width: none;
  max-height: 86dvh;
  padding: clamp(16px, 5vw, 28px);
  border-color: var(--rule);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.run-timer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.run-timer-header > div {min-width: 0}
.run-timer-header .eyebrow {color: var(--green); overflow-wrap: anywhere}
.run-timer-header h2 {margin: 6px 0 0; font-size: clamp(25px, 8vw, 34px)}
.run-timer-close.icon-button {flex: none; width: 44px; height: 44px; color: var(--muted); border: 1px solid var(--line); border-radius: 50%}
.run-timer-close:hover {background: var(--pale); color: var(--ink)}

.run-timer-picker {display: grid; gap: 12px}
.run-timer-picker label {display: grid; gap: 6px; color: var(--ink); font-size: 13px; font-weight: 650}
.run-timer-picker input:not([type="radio"]):not([type="checkbox"]) {
  width: 100%;
  min-width: 0;
  height: 46px;
  padding: 0 10px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 6px;
  font: 500 16px var(--font);
}

.run-timer-choices {
  max-height: clamp(100px, 30dvh, 240px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  overscroll-behavior: contain;
}

.run-timer-choices > p {padding: 10px 12px}
.run-timer-choices[data-run-options] {max-height: clamp(98px, 23dvh, 190px)}
.run-timer-picker .run-timer-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.run-timer-option + .run-timer-option {border-top: 1px solid var(--line)}
.run-timer-option:hover, .run-timer-option:focus-within, .run-timer-option:has(:checked) {background: var(--pale)}
.run-timer-option strong {overflow-wrap: anywhere}
.run-timer-option small {color: var(--muted); font-size: 11px}
.run-timer-option > span {display: grid; gap: 2px; min-width: 0}
.run-timer-option input {margin: 0; flex: none; accent-color: var(--green)}
.run-timer-option[data-mountain] {justify-content: space-between}

.run-timer-switch {
  justify-self: start;
  min-height: 40px;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}
.run-timer-switch:hover {text-decoration: underline}
.run-timer > .run-timer-switch {margin-top: -9px; margin-bottom: 6px}
.run-timer .run-timer-selected {color: var(--green); font-weight: 700; overflow-wrap: anywhere}

.run-timer p {font-size: 13px; color: var(--muted); line-height: 1.55}
.run-timer-loading {padding: 12px 0}
.run-timer .run-timer-start,
.run-timer .run-timer-stop {min-height: 48px; width: 100%; margin-top: 4px; font-size: 15px}
.run-timer-stop > span {width: 11px; height: 11px; border-radius: 2px; background: currentColor}

.run-timer-start-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 12px;
  min-inline-size: 0;
  margin: 0;
  padding: 3px 10px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.run-timer-start-options legend {padding: 0 4px; color: var(--muted); font-size: 12px}
.run-timer-start-options label {display: flex; align-items: center; flex-wrap: wrap; min-height: 44px; gap: 4px 8px}
.run-timer-start-options small {color: var(--muted); font-size: 11px}
.run-timer-delay {display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px}
.run-timer-picker .run-timer-delay input {width: 45px; height: 35px; padding: 0 6px; text-align: center; appearance: textfield}
.run-timer-delay input::-webkit-inner-spin-button, .run-timer-delay input::-webkit-outer-spin-button {appearance: none; margin: 0}
.run-timer-sound {cursor: pointer}
.run-timer-sound input {
  display: block;
  appearance: none;
  width: 38px;
  height: 22px;
  margin: 0;
  padding: 2px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 999px;
  cursor: inherit;
}
.run-timer-sound input::before {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
  content: '';
  transition: transform 160ms ease-out;
}
.run-timer-sound input:checked {background: var(--green); border-color: var(--green)}
.run-timer-sound input:checked::before {background: var(--paper); transform: translateX(16px)}
.run-timer-sound input:disabled {opacity: .55; cursor: default}

.run-timer-countdown {display: grid; gap: 14px}
.run-timer-countdown-dial {position: relative; display: grid; place-items: center; width: 116px; height: 116px; margin: 10px auto 0}
.run-timer-countdown-dial svg {position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg)}
.run-timer-countdown-dial circle {fill: none; stroke: var(--line); stroke-width: 4}
.run-timer-countdown-dial [data-countdown-ring] {
  stroke: var(--green);
  stroke-linecap: round;
  stroke-dasharray: 100;
  animation: run-timer-drain var(--countdown-duration) linear forwards;
}
@keyframes run-timer-drain {to {stroke-dashoffset: 100}}
.run-timer-cancel-countdown {min-height: 44px}

dialog.run-timer-active[open] {display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden}
.run-timer-running {display: grid; grid-template-rows: minmax(0, 1fr) auto; min-height: 0; gap: 10px}
.run-timer-running-content {display: grid; align-content: start; gap: 12px; min-height: 0; overflow-y: auto; overscroll-behavior: contain}
.run-timer-running-actions {display: grid; gap: 5px}
.run-timer-active .run-timer-header {margin-bottom: 14px}
.run-timer-active .run-timer-header h2 {font-size: clamp(24px, 6.5vw, 31px)}
.run-timer-face {
  padding: 14px 8px 16px;
  background: var(--surface) url('./assets/topography.svg') 75% 50% / 240px;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: center;
}
.run-timer-face .eyebrow {color: var(--muted)}
.run-timer-recording {display: inline-flex; align-items: center; gap: 7px; margin-bottom: 5px}
.run-timer-recording i {width: 6px; height: 6px; border-radius: 50%; background: var(--accent, var(--green))}
.run-timer-clock {
  --clock-size: clamp(38px, 13.5vw, 68px);
  display: flex;
  justify-content: center;
  align-items: baseline;
  color: var(--ink);
  font-size: var(--clock-size);
  font-weight: 740;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.055em;
  line-height: 1.06;
  overflow-wrap: anywhere;
}

.run-timer-clock.run-timer-hours {font-size: calc(var(--clock-size) * .68); align-items: center}
.run-timer-fraction {font-size: .52em; color: var(--green); align-self: center; padding-top: .7em}

.run-timer-course {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding: 1px 0;
}

.run-timer-course > div {min-width: 0}
.run-timer-course .eyebrow {color: var(--muted)}
.run-timer p.run-timer-name {color: var(--ink); font-size: 18px; font-weight: 780; overflow-wrap: anywhere}
.run-timer-difficulty {display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted)}
.run-timer-course > .run-timer-difficulty {margin-bottom: 5px}
.run-timer-trail {overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--surface)}
.run-timer-trail svg {
  display: block;
  width: 100%;
  height: clamp(100px, 20dvh, 150px);
  background-image: radial-gradient(var(--line) 1px, transparent 1px);
  background-size: 14px 14px;
}

.run-timer-route-line, .run-timer-route-edge {fill: none; stroke-linecap: round; stroke-linejoin: round}
.run-timer-route-edge {stroke: var(--paper); stroke-width: 8}
.run-timer-route-line {stroke: var(--green); stroke-width: 4}
.run-timer-pin {transition: transform 260ms ease-out}
.run-timer-pin[hidden] {display: none}
.run-timer-pin circle {fill: #3689e3}
.run-timer-pin circle:first-child {fill-opacity: .28}
.run-timer-pin circle:last-child {stroke: #fff; stroke-width: 1.5}
.run-timer p.run-timer-gps {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  margin: 0;
  padding: 6px 10px;
  border-top: 1px solid var(--line);
  font-size: 11px;
}
.run-timer-gps.live::before {content: ''; width: 7px; height: 7px; border-radius: 50%; background: #3689e3}
.run-timer p.run-timer-hint {text-align: center; font-size: 11px}

.run-timer-stats {min-width: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface)}
.run-timer-stats-header {display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 3px 8px; padding: 8px 10px; border-bottom: 1px solid var(--line)}
.run-timer-stats-header strong {color: var(--ink); font-size: 13px}
.run-timer-stats-header span {color: var(--muted); font-size: 11px}
.run-timer-stats dl {display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0}
.run-timer-stats dl > div {min-width: 0; padding: 7px 10px}
.run-timer-stats dl > div:nth-child(2n) {border-inline-start: 1px solid var(--line)}
.run-timer-stats dl > div:nth-child(n+3) {border-top: 1px solid var(--line)}
.run-timer-stats dt, .run-timer-stats dd small {color: var(--muted); font-size: 11px}
.run-timer-stats dd {margin: 0; color: var(--ink); font-size: 17px; font-weight: 740; font-variant-numeric: tabular-nums; overflow-wrap: anywhere}
.run-timer-result + .run-timer-stats {margin-bottom: 12px}
.run-timer-account-save {display: grid; gap: 5px}
.run-timer-account-save .button {min-height: 44px; width: 100%}
.run-timer-account-save .icon {width: 16px; height: 16px}
.run-timer p.run-timer-account-status {margin: 0; font-size: 12px}
.run-timer-account-status:empty {display: none}

@media (prefers-reduced-motion: reduce) {
  .run-timer-pin, .run-timer-sound input::before {transition: none}
  .run-timer-countdown-dial [data-countdown-ring] {animation: none}
}

.run-timer-result {
  display: grid;
  gap: 4px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border-left: 3px solid var(--green);
  background: var(--pale);
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.run-timer-result strong {color: var(--ink); font-size: 29px; font-variant-numeric: tabular-nums; line-height: 1.1}
.run-timer-result small {color: var(--green); font-size: .65em}
.run-timer-history {margin-top: 16px; border-top: 1px solid var(--line)}
.run-timer-history > summary {min-height: 44px; padding: 12px 0; cursor: pointer; color: var(--green); font-size: 13px; font-weight: 650}
.run-timer-history > summary span {margin-left: 4px; color: var(--muted); font-weight: 500}
.run-timer-history ul {padding: 0; list-style: none}
.run-timer-history li {
  margin: 0;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.run-timer-history-line {display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center}
.run-timer-history-title {display: grid; font-size: 11px}
.run-timer-history li time {font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 700}
.run-timer-watch {margin-top: 4px}
.run-timer-watch .button {margin-top: 10px}
.run-timer-watch [data-watch-message]:not(:empty) {margin-top: 8px}
.run-timer-history-run > summary {display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 44px; list-style: none; cursor: pointer}
.run-timer-history-run > summary::-webkit-details-marker {display: none}
.run-timer-history-run > summary svg {width: 14px; height: 14px; color: var(--green)}
.run-timer-history-run[open] > summary svg {transform: rotate(180deg)}
.run-timer-history-run .run-timer-stats {margin-top: 6px}
.run-timer-history-run .run-timer-account-save {margin-top: 8px}
