:root {
  --bg: #0b0d18;
  --card: rgba(16, 19, 33, 0.82);
  --glass: rgba(12, 14, 26, 0.55);
  --line: rgba(255, 255, 255, 0.1);
  --text: #f4f5fa;
  --muted: #9aa1b8;
  --accent: #ff6b35;
  --accent-2: #ff8f5e;
  --ok: #06d6a0;
  --warn: #ffd166;
  --bad: #ef476f;
  --radius: 18px;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  color: var(--text);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#vignette {
  position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.45));
}
body.menu #vignette { background: linear-gradient(90deg, rgba(8, 9, 18, 0.55), rgba(8, 9, 18, 0.15) 60%, rgba(8, 9, 18, 0.35)); }

.screen {
  position: fixed; inset: 0; overflow-y: auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; animation: fade 0.35s ease;
}
#onboard, #summary { align-items: center; }
#onboard > .card, #summary > .card { margin: auto 0; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.glass { background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-radius: 14px; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -0.01em; }
.logo { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; font-weight: 900; color: #fff; background: conic-gradient(from 200deg, var(--accent), #ffd166, var(--accent)); box-shadow: 0 0 18px rgba(255, 107, 53, 0.6); }
.brand { font-size: 18px; letter-spacing: 0.02em; }

.onboard-card { width: min(460px, 100%); padding: 28px; }
h1 { font-size: clamp(28px, 6vw, 40px); line-height: 1.05; margin: 18px 0 10px; letter-spacing: -0.03em; }
h2 { font-size: 18px; margin: 0 0 14px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 20px 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
input, select {
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; outline: none; width: 100%; transition: border-color 0.15s;
}
input:focus, select:focus { border-color: var(--accent); }
select option { background: #151827; }
.name-row { display: flex; gap: 8px; }
.name-row input { font-size: 18px; font-weight: 600; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; transition: transform 0.15s; }
.swatch[aria-checked="true"] { border-color: #fff; transform: scale(1.12); }
.more { margin-top: 16px; }
.more summary, .tips summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; flex-wrap: wrap; }

button { cursor: pointer; border: 0; border-radius: 12px; padding: 11px 16px; font-weight: 600; background: rgba(255, 255, 255, 0.08); transition: transform 0.1s, background 0.15s; }
button:hover { background: rgba(255, 255, 255, 0.14); }
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.45; cursor: default; }
.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 8px 24px rgba(255, 107, 53, 0.35); }
.primary:hover { background: linear-gradient(135deg, #ff7c4b, #ffa074); }
.primary.big { width: 100%; padding: 16px; font-size: 18px; margin-top: 18px; }
.ghost { background: transparent; border: 1px solid var(--line); }
.danger { color: var(--bad); }
.icon-btn { width: 44px; min-width: 44px; height: 44px; padding: 0; font-size: 20px; display: grid; place-items: center; }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.profiles { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px); }
.chip.active { border-color: var(--accent); background: rgba(255, 107, 53, 0.18); }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #10121c; flex: none; }
.chip.add { padding: 6px 12px; }

.home-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; max-width: 1100px; width: 100%; margin: 0 auto; }
.panel { padding: 20px; }
.maps { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.map-card { text-align: left; padding: 0; overflow: hidden; border: 2px solid transparent; background: rgba(255, 255, 255, 0.04); }
.map-card[aria-pressed="true"] { border-color: var(--accent); }
.map-card .thumb { height: 74px; }
.map-card .meta { padding: 10px 12px; }
.map-card b { display: block; }
.map-card span { font-size: 12px; color: var(--muted); font-weight: 400; }
.segmented { display: flex; gap: 4px; padding: 4px; background: rgba(255, 255, 255, 0.05); border-radius: 12px; flex-wrap: wrap; }
.segmented button { flex: 1; padding: 9px 10px; background: transparent; font-size: 14px; white-space: nowrap; }
.segmented button[aria-pressed="true"] { background: rgba(255, 255, 255, 0.16); }
.online-pill { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin: 18px 0 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.online .dot { background: var(--ok); box-shadow: 0 0 10px var(--ok); }

.runner { border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 10px; background: rgba(255, 255, 255, 0.03); }
.runner-head { display: flex; align-items: center; gap: 10px; }
.runner-head b { flex: 1; }
.runner-head .x { padding: 4px 10px; font-size: 13px; }
.device-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.device-actions button { font-size: 14px; padding: 9px 12px; }
.devices { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 6px; }
.devices li { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.devices li .status { margin-left: auto; color: var(--muted); }
.devices li.connected .status { color: var(--ok); }
.devices li button { padding: 2px 8px; font-size: 12px; }
.auto-incline { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.auto-incline .k { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.auto-incline .segmented button { font-size: 13px; padding: 7px 8px; }
.auto-incline .note.bad { color: #ef476f; }
.note { font-size: 12px; color: var(--muted); margin-top: 8px; }
.add-runner select { margin-top: 4px; }
.tips { margin-top: 16px; font-size: 14px; line-height: 1.5; }
.tips ol { padding-left: 20px; }

#hud { position: fixed; inset: 0; pointer-events: none; padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; }
#hud > * { pointer-events: auto; }
.hud-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.stats { padding: 14px 18px; display: grid; grid-template-columns: repeat(3, auto); gap: 8px 22px; }
.stat .v { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stat .v small { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 3px; }
.stat .k { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.stat.hr .v { display: flex; align-items: center; gap: 6px; }
.zone { font-size: 11px; padding: 2px 6px; border-radius: 6px; color: #111; font-weight: 800; }
.hud-right { display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.board { padding: 10px 12px; min-width: 220px; font-size: 13px; }
.board .row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.board .row.me { font-weight: 800; }
.board .row .gap { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--muted); }
.board .title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 4px; display: flex; justify-content: space-between; }
.swatch-sm { width: 10px; height: 10px; border-radius: 50%; flex: none; }
#minimap { width: 160px; height: 160px; display: block; }
.minimap-wrap { position: relative; overflow: hidden; line-height: 1.15; }
.incline {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 8px 5px; pointer-events: none;
  background: linear-gradient(transparent, rgba(8, 10, 20, 0.82) 38%); text-align: center;
  border-bottom: 3px solid transparent; transition: border-color 0.2s;
}
.incline-main { display: flex; align-items: baseline; justify-content: center; gap: 5px; }
.incline-main .k { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.incline-main b { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.incline-main .belt { font-size: 11px; font-weight: 700; }
.incline-sub { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.incline-sub.note { color: #4cc9f0; font-weight: 600; }
.incline-sub.note.max { color: #ef476f; }
.incline-sub.soon { color: #fff; font-weight: 700; }
.incline.alert { border-bottom-color: var(--accent); animation: incline-pulse 1s ease-in-out infinite; }
.incline.alert .incline-main b { color: var(--accent-2); }
@keyframes incline-pulse { 50% { background-color: rgba(255, 107, 53, 0.22); } }
.focus-tabs { display: flex; gap: 8px; margin-top: 10px; }
.focus-tabs button { font-size: 13px; padding: 6px 12px; background: var(--glass); border: 1px solid var(--line); }
.focus-tabs button[aria-pressed="true"] { border-color: var(--accent); }
.hud-bottom { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.pace-ctl { display: flex; align-items: center; gap: 10px; padding: 6px; }
.pace-ctl > div { display: flex; flex-direction: column; align-items: center; min-width: 70px; font-size: 13px; }

#summary-body .grid, #runs-panel .grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
#summary-body .who { margin-top: 18px; display: flex; align-items: center; gap: 10px; font-weight: 700; }
.summary-card { width: min(640px, 100%); padding: 28px; }
.summary-card h1 { margin-top: 0; }
.summary-actions { position: sticky; bottom: -28px; margin: 20px -28px -28px; padding: 16px 28px; background: linear-gradient(transparent, rgba(16, 19, 33, 0.96) 30%); border-radius: 0 0 var(--radius) var(--radius); }
.summary-actions .primary { min-width: 150px; }
.save-toggle { margin-left: auto; display: flex; align-items: center; gap: 6px; font-weight: 500; font-size: 14px; color: var(--muted); }
.save-toggle input { width: 18px; height: 18px; accent-color: var(--accent); }
.pbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pb { background: rgba(255, 209, 102, 0.16); color: var(--warn); border: 1px solid rgba(255, 209, 102, 0.35); padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.run-chart { display: block; width: 100%; height: 150px; margin-top: 16px; border-radius: 12px; background: rgba(255, 255, 255, 0.03); }
.splits { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 13px; font-variant-numeric: tabular-nums; }
.splits th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; padding: 4px 0; }
.splits td { padding: 5px 0; border-top: 1px solid var(--line); }
.splits td:first-child { width: 44px; color: var(--muted); }
.splits td:nth-child(2) { width: 70px; font-weight: 700; }
.splits .bar { display: block; height: 8px; border-radius: 4px; background: linear-gradient(90deg, rgba(76, 201, 240, 0.35), #4cc9f0); }
.splits tr.fast .bar { background: linear-gradient(90deg, rgba(6, 214, 160, 0.4), var(--ok)); }

.week-line { display: block; width: 100%; text-align: left; margin-top: 10px; padding: 8px 10px; font-size: 13px; font-weight: 500; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); }
.history-head { display: flex; align-items: center; gap: 12px; }
.history-head h2 { margin: 0; }
.history-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; max-width: 1100px; width: 100%; margin: 0 auto; align-items: start; }
.progress-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.pcard { padding: 14px; border-radius: 14px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; }
.pcard .k { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.pcard .v { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.pcard .v small { font-size: 13px; color: var(--muted); margin-left: 3px; font-weight: 600; }
.up { color: var(--ok); font-weight: 700; }
.down { color: var(--bad); font-weight: 700; }
.weekly-chart { display: block; width: 100%; height: 150px; }
.pb-list { list-style: none; padding: 0; margin: 0; }
.pb-list li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 9px 0; border-top: 1px solid var(--line); cursor: pointer; }
.pb-list li .small { grid-column: 1 / -1; }
.pb-list li b { font-variant-numeric: tabular-nums; }
.run-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.run-list button { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; padding: 8px 10px; background: rgba(255, 255, 255, 0.04); }
.run-list .thumb { width: 42px; height: 42px; border-radius: 10px; flex: none; }
.run-list .info, .run-list .nums { display: flex; flex-direction: column; gap: 2px; }
.run-list .info { flex: 1; min-width: 0; }
.run-list .nums { align-items: flex-end; font-variant-numeric: tabular-nums; }
.detail-head { display: flex; justify-content: space-between; margin-bottom: 12px; }
.detail-head button { padding: 8px 12px; font-size: 14px; }
#runs-panel h2 { margin-bottom: 4px; }
@media (max-width: 820px), (orientation: portrait) {
  .history-grid { grid-template-columns: 1fr; }
  #summary-body .grid, #runs-panel .grid { grid-template-columns: repeat(2, 1fr); }
}

#toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px); opacity: 0;
  background: #1b1f33; border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px;
  transition: all 0.25s; pointer-events: none; max-width: calc(100% - 32px); font-size: 14px; z-index: 10;
}
#toast.show { opacity: 1; transform: translateX(-50%); }

@media (max-width: 820px) {
  .home-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(3, auto); gap: 6px 14px; padding: 10px 12px; }
  .stat .v { font-size: 20px; }
  .board { min-width: 0; width: 170px; font-size: 12px; }
  #minimap { width: 120px; height: 120px; }
  .incline { padding: 10px 4px 3px; }
  .incline-main .k { display: none; }
  .incline-main b { font-size: 16px; }
  .incline-sub { font-size: 9.5px; }
  .hud-top { flex-direction: column; }
  .hud-right { flex-direction: row; align-items: flex-start; width: 100%; justify-content: space-between; }
  .grid3 { grid-template-columns: 1fr 1fr; }
}

.debug-btn { padding: 8px 12px; font-size: 13px; }
#debug {
  position: fixed; top: 12px; right: 12px; bottom: 12px; width: min(560px, calc(100% - 24px));
  display: flex; flex-direction: column; z-index: 20; animation: fade 0.2s ease; background: rgba(10, 12, 22, 0.94);
}
.debug-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.debug-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.debug-actions button { padding: 6px 10px; font-size: 12px; }
.debug-body { overflow-y: auto; padding: 4px 14px 14px; font-size: 12px; }
.debug-body h4 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 14px 0 6px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; }
.kv span:nth-child(odd) { color: var(--muted); }
.ok { color: var(--ok); }
.bad { color: var(--bad); }
.dtable { width: 100%; border-collapse: collapse; }
.dtable th { text-align: left; color: var(--muted); font-weight: 500; padding: 3px 6px 3px 0; }
.dtable td { padding: 4px 6px 4px 0; border-top: 1px solid var(--line); vertical-align: top; }
.mono, #debug-log { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.stale { opacity: 0.45; }
#debug-log { margin: 0; white-space: pre-wrap; word-break: break-all; max-height: 320px; overflow-y: auto; background: rgba(0, 0, 0, 0.3); padding: 8px; border-radius: 8px; line-height: 1.5; }
.tree details { margin: 4px 0; }
.tree ul { margin: 4px 0 4px 16px; padding: 0; list-style: none; }
.pace-ctl.auto button { opacity: 0.35; }

@media (orientation: portrait) {
  .home-grid { grid-template-columns: 1fr; }
  .hud-top { flex-direction: column; align-items: stretch; }
  .stats { grid-template-columns: repeat(3, 1fr); gap: 10px 16px; padding: 16px 20px; }
  .stat .v { font-size: clamp(22px, 5.4vw, 44px); }
  .stat .k { font-size: clamp(10px, 1.6vw, 14px); }
  .hud-right { flex-direction: row; justify-content: space-between; align-items: flex-start; }
  .board { flex: 1; min-width: 0; font-size: clamp(12px, 1.8vw, 16px); }
  #minimap { width: clamp(136px, 26vw, 220px); height: clamp(136px, 26vw, 220px); }
  .pace-ctl .icon-btn { width: 64px; min-width: 64px; height: 64px; font-size: 28px; }
  .pace-ctl > div { min-width: 96px; font-size: 15px; }
  .hud-bottom button { min-height: 52px; }
  #debug { top: auto; left: 12px; width: auto; height: 62vh; }
}

#avatar-preview { display: block; width: 100%; height: 190px; margin-top: 8px; border-radius: 14px; background: radial-gradient(ellipse at 50% 85%, rgba(255, 107, 53, 0.22), transparent 60%), rgba(255, 255, 255, 0.03); }
#gender-picker button { font-size: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.small-swatches .swatch { width: 28px; height: 28px; }
.swatch[aria-checked="true"].light { border-color: #ff6b35; }

.top-actions { display: flex; gap: 8px; flex-wrap: wrap; }
#sound-panel { position: fixed; right: 12px; bottom: 90px; width: min(320px, calc(100% - 24px)); padding: 14px 16px; z-index: 21; animation: fade 0.2s ease; }
#sound-panel header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
#sound-panel header .icon-btn { width: 36px; min-width: 36px; height: 36px; font-size: 16px; }
#sound-panel label { display: grid; grid-template-columns: 84px 1fr 38px; align-items: center; gap: 10px; padding: 8px 0; font-size: 14px; }
#sound-panel input[type="range"] { padding: 0; accent-color: var(--accent); background: none; border: 0; }
#sound-panel output { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
@media (orientation: portrait) {
  #sound-panel { bottom: 100px; }
  #sound-panel label { padding: 12px 0; }
}

#boot-error { position: fixed; left: 12px; right: 12px; top: 12px; z-index: 50; padding: 14px 16px; border-radius: 12px; background: #3a0d18; border: 1px solid #ef476f; color: #fff; font: 500 14px/1.4 Inter, system-ui, sans-serif; }

.stat.world .v { font-size: 16px; line-height: 1.2; padding-top: 6px; }

/* Map facts and elevation profiles */
.map-card .thumb { position: relative; }
.map-card .terrain-tag { position: absolute; top: 6px; right: 6px; font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; background: rgba(0, 0, 0, 0.45); color: #fff; }
.profile { display: block; width: 100%; color: var(--muted); }
.profile text { font-size: 10px; fill: var(--muted); }
.thumb-profile { position: absolute; left: 0; right: 0; bottom: 0; height: 34px; }
.map-facts { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 6px; font-size: 12px; font-variant-numeric: tabular-nums; }
.map-card .map-facts span { color: var(--text, #fff); font-weight: 600; font-size: 12px; }
.map-detail { margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 255, 255, 0.03); }
.md-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.md-head span { font-size: 13px; color: var(--muted); }
.md-profile { height: 90px; }
.md-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 10px 0; }
.md-stats > div { display: flex; flex-direction: column; min-width: 0; }
.md-stats .k { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.md-stats b { font-size: 16px; font-variant-numeric: tabular-nums; }
.md-stats small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.md-bands { display: flex; height: 8px; border-radius: 4px; overflow: hidden; gap: 1px; }
.md-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; font-size: 11px; color: var(--muted); }
.md-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; vertical-align: 0; }

/* Outside or treadmill: air quality card */
.air-card { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 8px; border-left: 4px solid var(--line); }
.air-card[data-verdict="outside"] { border-left-color: #06d6a0; }
.air-card[data-verdict="either"] { border-left-color: #ffd166; }
.air-card[data-verdict="treadmill"] { border-left-color: #ef476f; }
.air-card p { margin: 0; }
.air-head .k { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.air-main { display: flex; align-items: center; gap: 14px; }
.aqi { flex: none; width: 66px; height: 66px; border-radius: 16px; display: grid; place-items: center; align-content: center; background: color-mix(in srgb, var(--c) 22%, transparent); border: 2px solid var(--c); }
.aqi small { font-size: 10px; letter-spacing: 0.1em; color: var(--muted); }
.aqi b { font-size: 24px; line-height: 1; font-variant-numeric: tabular-nums; }
.air-verdict { font-size: 18px; font-weight: 800; }
.air-band { font-size: 13px; font-weight: 700; }
.air-facts { font-size: 13px; color: var(--muted); }
.air-facts b { color: var(--text, #fff); }
.air-reasons { margin: 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.air-reasons li.treadmill::marker { color: #ef476f; }
.air-reasons li.either::marker { color: #ffd166; }
.air-reasons li.outside::marker { color: #06d6a0; }
.air-window { font-size: 13px; }
.air-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.air-foot .bad { color: #ef476f; }
.air-actions { display: flex; gap: 4px; }
.air-actions button { padding: 4px 10px; font-size: 12px; }
.air-pick { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.air-pick > button { font-size: 14px; padding: 8px 12px; }
.air-search { display: flex; gap: 6px; flex: 1; min-width: 200px; }
.air-search input { flex: 1; min-width: 0; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06); color: inherit; font: inherit; font-size: 14px; }
.air-search button { padding: 8px 12px; font-size: 14px; }
.air-src { font-size: 10.5px; color: var(--muted); opacity: 0.8; }
@media (max-width: 760px) {
  .md-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.lap { position: absolute; top: 6px; left: 8px; font-size: 10.5px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
