/* Duolingo-style palette: bright fills, each with a darker "edge" for the pressable 3D look. */
:root {
  --green: #58cc02;
  --green-edge: #58a700;
  --blue: #1cb0f6;
  --blue-edge: #1899d6;
  --orange: #ff9600;
  --orange-edge: #e08600;
  --purple: #ce82ff;
  --purple-edge: #a568cc;
  --gold: #ffc800;
  --gold-edge: #e0a800;
  --red: #ff4b4b;
  --red-edge: #ea2b2b;
  --strava: #fc4c02;
  --strava-edge: #c93c02;
  --brand: #fc4c02; /* the app icon's orange (icon.svg), the wordmark's standard colour */

  --bg: #ffffff;
  --text: #4b4b4b;
  --muted: #777777;
  --faint: #afafaf;
  --line: #e5e5e5;
  --field: #f7f7f7;
  --card: #ffffff;

  --radius: 16px;
  --edge: 4px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131f24;
    --text: #f1f7fb;
    --muted: #a0b2bc;
    --faint: #52656d;
    --line: #37464f;
    --field: #202f36;
    --card: #131f24;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 700 16px/1.45 "Nunito", ui-rounded, system-ui, sans-serif;
}
p, h1, h2, ol { margin: 0; }
svg { width: 1em; height: 1em; flex: none; }

:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 8px; }

/* ---------- Top bar ---------- */
.topbar { border-bottom: 2px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 5; }
.topbar-inner {
  max-width: 720px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--brand); text-decoration: none;
  font-weight: 900; font-size: 1.45rem; letter-spacing: -0.02em;
}
.brand img { border-radius: 10px; }
/* The wordmark, as in the iOS app: "ride" in ink, "money" in the icon's orange, set tight. */
.wordmark { color: var(--text); letter-spacing: -0.03em; }
.wordmark b { color: var(--mark, var(--brand)); font-weight: inherit; } /* --mark: a wordmark reward */
.topbar-stats { display: flex; align-items: center; gap: 8px; min-width: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 12px;
  font-weight: 800; font-size: 0.95rem; white-space: nowrap;
}
.chip[hidden] { display: none; }
.chip-streak { color: var(--orange); font-size: 1.1rem; }
.chip-streak svg { width: 1.3em; height: 1.3em; }
.chip-streak.cold { color: var(--faint); }
.chip-who {
  border: 2px solid var(--line); color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; max-width: 180px;
}

main { max-width: 720px; margin: 0 auto; padding: 28px 16px calc(96px + env(safe-area-inset-bottom)); }
[data-page][hidden] { display: none; }

/* ---------- Buttons: solid fill sitting on a darker edge; it sinks when pressed ---------- */
.btn {
  --fill: var(--green); --rim: var(--green-edge);
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 50px; padding: 12px 28px;
  border: 0; border-radius: var(--radius);
  background: var(--fill); color: #fff;
  box-shadow: 0 var(--edge) 0 var(--rim);
  font: 800 1rem/1 "Nunito", ui-rounded, system-ui, sans-serif;
  text-transform: uppercase; letter-spacing: 0.06em; text-decoration: none;
  cursor: pointer; transition: transform 80ms ease, box-shadow 80ms ease, filter 120ms;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(var(--edge)); box-shadow: 0 0 0 var(--rim); }
.btn-strava { --fill: var(--strava); --rim: var(--strava-edge); }
.btn-blue { --fill: var(--blue); --rim: var(--blue-edge); }
.btn-orange { --fill: var(--orange); --rim: var(--orange-edge); }
.btn svg { width: 1.25em; height: 1.25em; margin-right: 10px; }
.btn:disabled { filter: grayscale(1); opacity: 0.5; cursor: not-allowed; }
.btn-ghost {
  --fill: var(--bg); --rim: var(--line);
  color: var(--muted); border: 2px solid var(--line); min-height: 44px; font-size: 0.85rem;
}

/* ---------- Connect screen ---------- */
.connect { text-align: center; padding: 24px 0 8px; display: grid; justify-items: center; gap: 18px; }
.connect[hidden] { display: none; }
.connect-badge {
  width: 132px; height: 132px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--green); color: #fff; font-size: 72px;
  box-shadow: 0 8px 0 var(--green-edge);
  animation: bob 2.6s ease-in-out infinite;
}
.connect h1 {
  font-weight: 900; font-size: clamp(1.9rem, 6vw, 2.6rem); line-height: 1.1;
  letter-spacing: -0.02em; max-width: 16ch; margin-top: 10px; text-wrap: balance;
}
.connect-copy { color: var(--muted); max-width: 38ch; font-size: 1.1rem; }
.connect-copy.error { color: var(--red); }
.connect .btn { margin-top: 6px; min-width: min(320px, 100%); }
.connect-fine { color: var(--faint); font-size: 0.85rem; }

@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-8px) rotate(3deg); }
}

/* ---------- Result: the "lesson complete" moment ---------- */
.result { text-align: center; padding: 8px 0 28px; }
.eyebrow {
  display: inline-block; padding: 6px 14px; border-radius: 12px;
  background: var(--gold); color: #5c4300; box-shadow: 0 3px 0 #e0a800;
  font-weight: 900; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em;
}
.saved {
  color: var(--green); font-weight: 900; font-variant-numeric: tabular-nums;
  font-size: clamp(3.4rem, 15vw, 5.6rem); line-height: 1; letter-spacing: -0.03em;
  margin: 8px 0 10px;
}
.status { color: var(--muted); min-height: 1.45em; }
.status.error { color: var(--red); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 26px; }
.stat {
  --c: var(--blue);
  border: 2px solid var(--c); border-radius: var(--radius);
  background: var(--c); overflow: hidden;
}
.stat-blue { --c: var(--blue); }
.stat-orange { --c: var(--orange); }
.stat-purple { --c: var(--purple); }
.stat-label {
  color: #fff; font-weight: 900; font-size: 0.72rem;
  text-transform: uppercase; letter-spacing: 0.08em; padding: 5px 4px 4px;
}
.stat-value {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--card); color: var(--c);
  border-radius: 13px; padding: 14px 6px;
  font-weight: 900; font-size: 1.25rem; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.stat-value svg { width: 1.1em; height: 1.1em; }

/* ---------- Cards ---------- */
.card {
  border: 2px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-top: 16px; background: var(--card);
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card h2 { font-weight: 900; font-size: 1.3rem; letter-spacing: -0.01em; }
.card-note { color: var(--muted); font-size: 0.95rem; text-align: right; }

/* ---------- Week strip ---------- */
.week-days { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.day { display: grid; justify-items: center; gap: 6px; color: var(--faint); font-weight: 800; font-size: 0.8rem; }
.day-dot {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--field); border: 2px solid var(--line);
}
.day.ridden .day-dot {
  background: var(--green); border-color: var(--green); color: #fff;
  box-shadow: 0 3px 0 var(--green-edge);
  animation: pop 420ms cubic-bezier(.34, 1.56, .64, 1) both;
  animation-delay: calc(var(--i) * 60ms);
}
.day.ridden { color: var(--green); }
.day.today .day-dot { outline: 3px solid var(--gold); outline-offset: 2px; }
/* Weekends skipped for streaks: dashed and faded, but still shows a ride if there was one. */
.day.off { opacity: 0.55; }
.day.off:not(.ridden) .day-dot { border-style: dashed; }
.day-dot svg { width: 22px; height: 22px; }

@keyframes pop {
  from { transform: scale(0.3); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ---------- Settings ---------- */
.fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.field { display: grid; gap: 6px; }
.field-label { color: var(--muted); font-weight: 800; font-size: 0.85rem; }
.unit { color: var(--faint); font-weight: 700; margin-left: 2px; }
input[type=number], input[type=text], input[type=date], input[type=time], select {
  width: 100%; min-height: 50px; padding: 10px 14px;
  font: 800 1.05rem "Nunito", ui-rounded, system-ui, sans-serif; color: var(--text);
  background: var(--field); border: 2px solid var(--line); border-radius: 14px;
  appearance: none; -webkit-appearance: none;
  transition: border-color 120ms;
}
select {
  padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='%23afafaf' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 20px;
}
input[type=number]:focus, input[type=text]:focus, input[type=date]:focus, input[type=time]:focus, select:focus { outline: none; border-color: var(--blue); }
input[type=date], input[type=time] { color-scheme: light dark; }

.switch { display: flex; align-items: center; gap: 12px; margin-top: 18px; cursor: pointer; font-weight: 800; position: relative; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  position: relative; width: 52px; height: 30px; flex: none;
  background: var(--line); border-radius: 999px; transition: background 150ms;
}
.switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 24px; height: 24px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15); transition: transform 180ms cubic-bezier(.34, 1.56, .64, 1);
}
.switch input:checked + .switch-track { background: var(--green); }
.switch input:checked + .switch-track::after { transform: translateX(22px); }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--blue); outline-offset: 3px; }
.switch-note { margin: 6px 0 0 64px; color: var(--muted); font-size: 0.85rem; }
.stamp-status { color: var(--green-edge); font-weight: 800; }
.plus-tag {
  display: inline-block; margin-left: 4px; padding: 1px 7px; border-radius: 999px; vertical-align: 2px;
  background: var(--gold); color: #5c4300; font-size: 0.68rem; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase;
}
.switch:has(input:disabled) { cursor: not-allowed; opacity: 0.6; }
.stamp-status:empty { display: none; }
.stamp-status.error { color: var(--red); }

/* ---------- Ride list ---------- */
.ride-list { list-style: none; padding: 0; display: grid; }
.ride {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px;
  padding: 12px 0; border-top: 2px solid var(--line);
}
.ride:first-child { border-top: 0; padding-top: 0; }
.ride-icon {
  width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center;
  background: var(--blue); color: #fff; box-shadow: 0 3px 0 var(--blue-edge);
}
.ride-icon svg { width: 26px; height: 26px; }
.ride.commute .ride-icon { background: var(--purple); box-shadow: 0 3px 0 var(--purple-edge); }
.ride-main { min-width: 0; }
.ride-name { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ride-meta { color: var(--muted); font-size: 0.88rem; font-weight: 700; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.tag {
  color: var(--purple); border: 2px solid currentColor; border-radius: 8px;
  padding: 0 6px; font-size: 0.7rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.06em;
}
.ride-saved { color: var(--green); font-weight: 900; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); text-align: center; padding: 18px 0 8px; }

/* Long lists fold into week / month groups. */
.ride-group { border-top: 2px solid var(--line); }
.ride-group:first-child { border-top: 0; }
.group-head {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px;
  padding: 12px 0; cursor: pointer; list-style: none;
}
.ride-group:first-child .group-head { padding-top: 0; }
.group-head::-webkit-details-marker { display: none; }
.group-chev {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  background: var(--field); border: 2px solid var(--line); color: var(--muted);
}
.group-chev::after {
  content: ""; width: 10px; height: 10px; margin-top: -4px;
  border: solid currentColor; border-width: 0 3px 3px 0; transform: rotate(45deg);
  transition: transform 150ms ease;
}
details[open] > .group-head .group-chev::after { transform: rotate(-135deg); margin-top: 4px; }
.group-head .ride-saved { color: var(--green); }
.ride-group > details > .ride-list { padding: 0 0 12px; }

/* Rides fall under one header per day. */
.ride-day { border-top: 2px solid var(--line); padding: 12px 0; }
.ride-list > .ride-day:first-child { border-top: 0; padding-top: 0; }
.ride-group .ride-list > .ride-day:first-child { border-top: 2px solid var(--line); padding-top: 12px; }
.day-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px;
  color: var(--muted); font-size: 0.8rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.06em;
}
.day-head .ride-saved { font-size: 0.95rem; letter-spacing: 0; }
.ride-day .ride { border-top: 0; padding: 0; }
.ride-day .ride + .ride { margin-top: 12px; }

/* ---------- Records ---------- */
/* Segmented toggle: one section at a time keeps the card short. */
.seg {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
  padding: 4px; margin-bottom: 14px;
  background: var(--field); border: 2px solid var(--line); border-radius: 14px;
}
.seg[hidden] { display: none; }
.seg button {
  min-height: 38px; padding: 6px 8px; border: 2px solid transparent; border-radius: 10px;
  background: none; color: var(--muted); cursor: pointer;
  font: 800 0.9rem "Nunito", ui-rounded, system-ui, sans-serif;
}
.seg button[aria-selected="true"] { background: var(--card); color: var(--blue); border-color: var(--line); box-shadow: 0 2px 0 var(--line); }
/* The same toggle as radios, for a choice inside a form (Plus: automatic or own petrol price). */
.seg-radio { margin: 6px 0 12px; }
.seg-radio label {
  position: relative;
  display: grid; place-items: center; min-height: 38px; padding: 6px 8px;
  border: 2px solid transparent; border-radius: 10px; color: var(--muted); cursor: pointer; font-weight: 800; font-size: 0.9rem;
}
.seg-radio input { position: absolute; opacity: 0; pointer-events: none; }
.seg-radio label:has(input:checked) { background: var(--card); color: var(--blue); border-color: var(--line); box-shadow: 0 2px 0 var(--line); }
.seg-radio label:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 2px; }
.records-msg { color: var(--muted); text-align: center; padding: 12px 0 4px; }
.records-msg.error { color: var(--red); }

.rank-list { list-style: none; padding: 0; display: grid; }
.rank {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px;
  padding: 10px 0; border-top: 2px solid var(--line);
}
.rank:first-child { border-top: 0; padding-top: 0; }
.rank-badge {
  --c: var(--field); --rim: var(--line);
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--c); color: var(--muted); box-shadow: 0 3px 0 var(--rim);
  font-weight: 900; font-size: 1.05rem;
}
.rank-1 .rank-badge { --c: var(--gold); --rim: #e0a800; color: #5c4300; }
.rank-2 .rank-badge { --c: #cfd8dc; --rim: #a7b4ba; color: #3d4a50; }
.rank-3 .rank-badge { --c: #e7a36b; --rim: #c27f48; color: #5a3410; }
.rank-main { min-width: 0; }
.rank-name { font-weight: 800; }
.bar { display: block; height: 8px; margin-top: 6px; border-radius: 999px; background: var(--field); overflow: hidden; }
.bar::after {
  content: ""; display: block; height: 100%; width: var(--w);
  background: var(--green); border-radius: inherit;
  animation: grow 600ms cubic-bezier(.34, 1.2, .64, 1) both;
}
@keyframes grow { from { width: 0; } }

.rec-list { list-style: none; padding: 0; display: grid; }
.rec-list[hidden], .rank-list[hidden] { display: none; }
.rec-row {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 14px;
  padding: 10px 0; border-top: 2px solid var(--line);
}
.rec-row:first-child { border-top: 0; padding-top: 0; }
.rec-main { min-width: 0; }
.rec-label { font-weight: 800; }
.rec-sub { color: var(--muted); font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-value { color: var(--c); font-weight: 900; font-size: 1.1rem; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Achievements ---------- */
/* Each badge takes its family colour from --c / --rim, set inline by app.js. */
.ach-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ach {
  width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 8px 12px; border: 2px solid var(--line); border-radius: var(--radius);
  background: var(--card); box-shadow: 0 4px 0 var(--line); color: var(--text); cursor: pointer;
  font: inherit; text-align: center;
  transition: transform 80ms ease, box-shadow 80ms ease;
}
.ach:active { transform: translateY(4px); box-shadow: 0 0 0 var(--line); }
.ach-badge {
  position: relative; width: 60px; height: 60px; flex: none; border-radius: 50%; margin-bottom: 6px;
  display: grid; place-items: center;
  background: var(--c); color: #fff; font-size: 30px; box-shadow: 0 4px 0 var(--rim);
}
.ach-badge.locked { background: var(--field); color: var(--faint); box-shadow: 0 4px 0 var(--line); border: 2px dashed var(--line); }
.ach.maxed .ach-badge { outline: 3px solid var(--gold); outline-offset: 3px; }
.ach-level {
  position: absolute; right: -6px; bottom: -6px;
  min-width: 26px; height: 26px; padding: 0 5px; border-radius: 999px;
  display: grid; place-items: center;
  background: var(--gold); color: #5c4300; border: 2px solid var(--card);
  font-weight: 900; font-size: 0.8rem; line-height: 1;
}
.ach-name { font-weight: 900; font-size: 0.92rem; line-height: 1.15; }
.ach .bar, .tier .bar { width: 100%; background: var(--line); margin-top: auto; }
.ach .bar::after, .tier .bar::after { background: var(--gold); }
.ach-progress { color: var(--muted); font-size: 0.75rem; font-variant-numeric: tabular-nums; white-space: nowrap; }

.ach-sheet .card-head h2 { font-weight: 900; font-size: 1.3rem; }
.ach-hero { display: grid; justify-items: center; text-align: center; gap: 2px; padding: 4px 0 16px; }
.ach-hero .ach-badge { width: 88px; height: 88px; font-size: 44px; margin-bottom: 14px; }
.ach-hero .ach-level { min-width: 32px; height: 32px; font-size: 0.95rem; }
.ach-now { font-weight: 900; font-size: 1.7rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ach-about { color: var(--muted); }
.ach-lvl { margin-top: 8px; color: #8a6500; font-weight: 900; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; }

.ach-ladder { list-style: none; padding: 0; border-top: 2px solid var(--line); }
.tier { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 2px solid var(--line); }
.tier:last-child { border-bottom: 0; padding-bottom: 0; }
.tier-tick {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--field); color: var(--faint); border: 2px solid var(--line);
  font-weight: 900; font-size: 0.9rem;
}
.tier-done .tier-tick { background: var(--c); border-color: var(--c); color: #fff; box-shadow: 0 3px 0 var(--rim); font-size: 18px; }
.tier-next .tier-tick { border-color: var(--c); color: var(--text); }
.tier-todo { color: var(--faint); }
.tier-main { min-width: 0; }
.tier-goal { font-weight: 900; }
.tier-sub { color: var(--muted); font-size: 0.88rem; }
.tier .bar { margin-top: 6px; }

.ach-new { list-style: none; padding: 0 0 20px; display: grid; gap: 14px; }
.ach-new li { display: flex; align-items: center; gap: 16px; animation: pop 420ms cubic-bezier(.34, 1.56, .64, 1) both; }
.ach-new .ach-badge { margin-bottom: 4px; }
.ach-sheet .btn { width: 100%; }

.settings-foot { display: flex; justify-content: center; margin-top: 24px; padding-top: 18px; border-top: 2px solid var(--line); }
.foot { margin-top: 36px; text-align: center; font-size: 0.8rem; color: var(--faint); font-weight: 800; }

/* ---------- What it bought you ---------- */
.bought {
  margin-top: 12px; padding: 8px 16px; border: 2px solid var(--line); border-radius: 999px;
  background: var(--field); color: var(--text); cursor: pointer;
  font: 900 0.95rem "Nunito", ui-rounded, system-ui, sans-serif;
  animation: pop 320ms cubic-bezier(.34, 1.56, .64, 1) both;
}
.bought[hidden] { display: none; }
.bought:active { transform: scale(0.97); }

/* ---------- Savings goal ---------- */
.goal-card .btn { width: 100%; margin-top: 14px; }
.goal-empty { display: flex; align-items: center; gap: 14px; }
.goal-emoji { font-size: 2.2rem; line-height: 1; }
.rec-sub-wrap { color: var(--muted); font-size: 0.92rem; }
.goal-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; }
.goal-main { min-width: 0; }
.goal-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.1rem; }
.goal-sub { color: var(--green); font-weight: 800; }
.goal-sub.done { color: var(--gold-edge); }
.goal-sub.muted { color: var(--muted); }
.goal-since { color: var(--muted); font-size: 0.8rem; }
.ob-text-btn.goal-edit { color: var(--blue-edge); }
.ring { position: relative; width: 66px; height: 66px; display: grid; place-items: center; }
.ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; }
.ring-track { stroke: var(--line); }
.ring-fill { stroke: var(--green); stroke-linecap: round; transition: stroke-dashoffset 700ms cubic-bezier(.34, 1.2, .64, 1); }
.ring-fill.done { stroke: var(--gold); }
.ring-label { position: relative; font-weight: 900; font-size: 0.9rem; }
.fields-goal { grid-template-columns: 1fr 1fr; }
.field-wide { grid-column: 1 / -1; }
.goal-km { margin-left: 0; min-height: 1.3em; }
.goal-actions { display: grid; gap: 8px; margin-top: 18px; }
.goal-actions .btn { width: 100%; }
.goal-actions [hidden] { display: none; }
.ob-text-btn.goal-remove { color: var(--red); }

/* Plus offer: why now, then what Plus does, the reason first. */
.offer-sheet .card-head { margin-bottom: 14px; }
.offer-list { display: grid; gap: 12px; margin: 18px 0 0; padding: 0; list-style: none; }
.offer-list li { display: flex; align-items: center; gap: 12px; }
.offer-list li:not(.lead) { opacity: 0.8; }
.offer-list .rec-sub-wrap { margin: 0; }
.offer-icon {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: grid; place-items: center; background: var(--gold); color: #5c4300; font-size: 20px;
  box-shadow: 0 3px 0 var(--gold-edge);
}
.offer-list .lead .offer-icon { background: var(--orange); color: #fff; box-shadow: 0 3px 0 var(--orange-edge); }
.offer-thanks { margin: 16px 0 0; padding: 12px 14px; border-radius: 14px; background: var(--field); color: var(--green-edge); font-weight: 800; text-align: center; }
.offer-thanks[hidden] { display: none; }
.offer-line { margin: 0; padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px; color: var(--text); font-size: 0.92rem; }
.offer-more { margin-top: 8px; padding-left: 0; color: var(--blue); }

/* Weekly price check: the onboarding price field, in a sheet. */
.price-sheet form { display: grid; gap: 16px; }
.price-sheet .card-head { margin-bottom: 0; }
.price-hint { margin: 0; text-align: center; }
.price-sheet .goal-actions { margin-top: 0; }
.share-wrap { display: flex; justify-content: center; margin-top: 22px; }
.share-wrap .btn { width: 100%; }
.share-wrap .btn[hidden] { display: none; }
.share-img { display: block; width: min(100%, 320px); height: auto; aspect-ratio: 360 / 450; margin: 0 auto; border-radius: 12px; background: var(--field); }

/* ---------- Savings chart ---------- */
.seg-2 { grid-template-columns: repeat(2, 1fr); }
.chart-plot { display: grid; grid-template-columns: auto 1fr; gap: 8px; height: 190px; }
.chart-axis { display: flex; flex-direction: column; justify-content: space-between; color: var(--faint); font-size: 0.75rem; text-align: right; font-variant-numeric: tabular-nums; margin: -0.5em 0; }
.chart-bars {
  display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); align-items: end; gap: 3px;
  border-bottom: 2px solid var(--line);
  background: linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 100% 50%;
}
.chart-bar {
  height: var(--h); min-height: 2px; border-radius: 4px 4px 0 0; background: var(--green);
  animation: rise 500ms cubic-bezier(.34, 1.2, .64, 1) both; animation-delay: calc(var(--i) * 12ms);
}
.chart-bar:hover { background: var(--green-edge); }
@keyframes rise { from { height: 0; } }
.chart-x { display: flex; justify-content: space-between; margin: 6px 0 0 2.6rem; color: var(--faint); font-size: 0.75rem; }

/* ---------- Weekly quests ---------- */
.level-bar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; margin-bottom: 14px; }
.level-pill { padding: 3px 10px; border-radius: 999px; background: var(--gold); color: #5c4300; font-weight: 900; font-size: 0.9rem; }
.level-bar .bar { margin-top: 0; height: 10px; }
.bar-gold::after, .celebrate .level-bar .bar::after { background: var(--gold); }
.level-xp { color: var(--muted); font-size: 0.8rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.quest-list { list-style: none; padding: 0; display: grid; gap: 14px; }
.quest { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 12px; }
.quest-icon {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: var(--c); color: #fff; box-shadow: 0 3px 0 var(--rim); font-size: 18px;
}
.quest-main { min-width: 0; flex: 1; }
.quest-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.quest-title { font-weight: 800; font-size: 0.95rem; }
.quest.done .quest-title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.quest-xp { color: var(--gold-edge); font-weight: 900; font-size: 0.8rem; white-space: nowrap; }
.quest.done .quest-xp { color: var(--green-edge); }
.quest .bar::after { background: var(--c); }
.quest-progress { color: var(--muted); font-size: 0.8rem; margin-top: 2px; }
.quest-sticker { display: flex; align-items: center; gap: 10px; margin-top: 14px; color: var(--muted); font-weight: 800; font-size: 0.88rem; }
.quest-sticker.earned { color: var(--c); }
.quest-sticker-art { width: 34px; height: 34px; flex: none; filter: grayscale(1); opacity: 0.35; }
.quest-sticker.earned .quest-sticker-art { filter: none; opacity: 1; }

.sticker-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 8px; }
.sticker { display: grid; justify-items: center; gap: 2px; text-align: center; }
.sticker-disc {
  width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center;
  background: var(--field); border: 2px solid var(--line); color: var(--faint);
  font-size: 1.3rem; font-weight: 900; margin-bottom: 4px;
}
.sticker.current .sticker-disc { border-style: dashed; }
.sticker.earned .sticker-disc, .celebrate-sticker .sticker-disc {
  background: var(--c); border-color: var(--c); box-shadow: 0 3px 0 var(--rim); font-size: 1.75rem;
  animation: pop 420ms cubic-bezier(.34, 1.56, .64, 1) both;
}
.sticker-art { width: 72%; height: 72%; }
.sticker-name { font-weight: 900; font-size: 0.75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.sticker:not(.earned) .sticker-name { color: var(--muted); }
.sticker-date { color: var(--faint); font-size: 0.72rem; }

/* ---------- Rewards ---------- */
.reward-section { margin-top: 16px; }
.reward-title { margin: 0 0 8px; font-weight: 900; font-size: 1rem; }
.reward-row { display: flex; gap: 10px; overflow-x: auto; padding: 6px 4px 8px; margin: 0 -4px; scrollbar-width: thin; }
.reward {
  flex: none; width: 82px; display: grid; justify-items: center; gap: 4px; padding: 0;
  border: 0; background: none; color: var(--text); cursor: pointer; font: inherit; text-align: center;
}
.reward.locked { cursor: not-allowed; }
.reward-swatch {
  position: relative; width: 64px; height: 64px; border-radius: 15px; overflow: hidden;
  display: grid; place-items: center; background: var(--field); outline: 3px solid transparent; outline-offset: 3px;
}
.reward.selected .reward-swatch { outline-color: var(--blue); }
.reward-docket {
  width: 30px; height: 38px; border-radius: 2px; transform: rotate(-4deg); background: #fff;
  background-image: repeating-linear-gradient(transparent 0 8px, #e5e5e5 8px 10px); background-size: 18px 100%; background-repeat: no-repeat; background-position: center 6px;
}
.reward-mark { display: grid; line-height: 0.95; font-weight: 900; font-size: 0.95rem; letter-spacing: -0.03em; color: var(--text); }
.reward-mark b { font-weight: inherit; }
.reward-lock { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, 0.45); color: #fff; font-size: 18px; }
.reward-name { font-weight: 900; font-size: 0.8rem; }
.reward.locked .reward-name { color: var(--muted); }
.reward-req { color: var(--muted); font-size: 0.7rem; line-height: 1.2; }
.reward-new { color: var(--gold-edge); font-weight: 800; font-size: 0.88rem; }

/* ---------- New-ride celebration ---------- */
.celebrate {
  width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0; padding: 0; border: 0;
  background: var(--bg); color: var(--text); overflow-y: auto;
}
.celebrate::backdrop { background: var(--bg); }
.celebrate[open] { animation: ob-in 260ms ease both; }
.celebrate-body {
  max-width: 560px; margin: 0 auto; padding: 36px 16px max(28px, env(safe-area-inset-bottom));
  display: grid; justify-items: center; gap: 12px; text-align: center;
}
.celebrate-hero { width: 104px; height: 104px; font-size: 58px; animation: pop 420ms cubic-bezier(.34, 1.56, .64, 1) both; }
.celebrate-title:focus { outline: none; }
.celebrate-title { font-weight: 900; font-size: clamp(2rem, 8vw, 2.5rem); line-height: 1.1; margin-top: 10px; }
.celebrate-saved { margin: 4px 0 0; }
.celebrate-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; margin-top: 6px; }
.celebrate-stat {
  display: grid; justify-items: center; gap: 2px; padding: 14px 8px;
  border: 2px solid var(--line); border-radius: var(--radius); color: var(--c);
  animation: pop 420ms 300ms cubic-bezier(.34, 1.56, .64, 1) both;
}
.celebrate-stat svg { width: 28px; height: 28px; }
.celebrate-stat b { font-weight: 900; font-size: 1.3rem; color: var(--text); }
.celebrate-stat span { color: var(--muted); font-size: 0.82rem; }
.celebrate-card { width: 100%; text-align: left; margin-top: 4px; }
.celebrate-card .ach-new { padding-bottom: 0; }
.celebrate-card .ach-new li { align-items: center; }
.celebrate-card .ach-badge { width: 48px; height: 48px; font-size: 24px; }
.celebrate-sticker { display: flex; align-items: center; gap: 14px; margin-top: 16px; }
.celebrate-card .level-bar { margin: 16px 0 0; }
.celebrate-body > .btn { width: 100%; margin-top: 10px; }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px max(8px, calc((100% - 720px) / 2)) max(8px, env(safe-area-inset-bottom));
  background: var(--bg); border-top: 2px solid var(--line);
}
.tabbar[hidden] { display: none; }
.tabbar button {
  display: grid; justify-items: center; gap: 2px; padding: 6px 4px; min-height: 52px;
  border: 2px solid transparent; border-radius: 12px; background: none; color: var(--faint); cursor: pointer;
  font: 900 0.75rem "Nunito", ui-rounded, system-ui, sans-serif; text-transform: uppercase; letter-spacing: 0.06em;
}
.tabbar svg { width: 26px; height: 26px; }
.tabbar button[aria-current="page"] { color: var(--blue); background: color-mix(in srgb, var(--blue) 12%, transparent); border-color: color-mix(in srgb, var(--blue) 40%, transparent); }

/* ---------- First-run guide ---------- */
.onboard {
  position: fixed; inset: 0; z-index: 20; background: var(--bg);
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh;
}
.onboard[hidden] { display: none; }
.ob-head, .ob-body, .ob-foot { width: 100%; max-width: 560px; margin: 0 auto; }
.ob-head { display: flex; align-items: center; gap: 12px; padding: 14px 12px 4px; }
.ob-head.is-hidden { visibility: hidden; }
.ob-icon-btn {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center;
  border: 0; padding: 0; background: none; color: var(--faint); font-size: 26px; cursor: pointer;
}
.ob-text-btn {
  min-height: 44px; padding: 0 8px; border: 0; background: none; cursor: pointer;
  color: var(--muted); font: 900 0.875rem "Nunito", ui-rounded, system-ui, sans-serif;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.ob-text-btn[hidden] { display: none; }
.ob-units { align-self: center; color: var(--blue-edge); }
.ob-progress { flex: 1; height: 16px; border-radius: 999px; background: var(--line); overflow: hidden; }
.ob-progress span {
  display: block; height: 100%; width: var(--p, 20%); border-radius: inherit;
  background: var(--green); box-shadow: inset 0 4px 0 -1px rgba(255, 255, 255, 0.3);
  transition: width 300ms cubic-bezier(.34, 1.3, .64, 1);
}
.ob-body { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 20px 24px; display: flex; flex-direction: column; }
.ob-step { display: flex; flex-direction: column; gap: 20px; animation: ob-in 260ms ease both; }
.ob-step[hidden] { display: none; }
.ob-step h1 { font-weight: 900; font-size: 1.75rem; line-height: 1.15; letter-spacing: -0.01em; }
.ob-step h1:focus { outline: none; }
@keyframes ob-in { from { opacity: 0; transform: translateX(24px); } }

.ob-welcome, .ob-done { flex: 1; align-items: center; justify-content: center; text-align: center; gap: 16px; }
.ob-welcome h1 { font-size: clamp(2rem, 8vw, 2.4rem); line-height: 1.1; max-width: 13ch; letter-spacing: -0.02em; }
.ob-lede { color: var(--muted); font-size: 1.1rem; max-width: 30ch; }
.ob-hero {
  width: 148px; height: 148px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 14px;
  background: var(--green); color: #fff; font-size: 84px; box-shadow: 0 8px 0 var(--green-edge);
  animation: bob 2.6s ease-in-out infinite;
}
.ob-hero.ob-gold { width: 112px; height: 112px; font-size: 64px; background: var(--gold); box-shadow: 0 7px 0 #e0a800; animation: pop 420ms cubic-bezier(.34, 1.56, .64, 1) both; }
.ob-perkm { color: var(--green-edge); font-weight: 900; }

.ob-say { display: flex; align-items: flex-end; gap: 12px; }
.ob-say p { margin-bottom: 8px; padding: 10px 14px; border: 2px solid var(--line); border-radius: 16px 16px 16px 4px; color: var(--muted); font-size: 0.95rem; }
.ob-avatar, .ob-tile {
  --c: var(--green); --rim: var(--green-edge);
  flex: none; display: grid; place-items: center; color: #fff;
  background: var(--c); box-shadow: 0 4px 0 var(--rim);
}
.ob-avatar { width: 60px; height: 60px; border-radius: 50%; font-size: 32px; }
.ob-tile { width: 52px; height: 52px; border-radius: 14px; font-size: 28px; box-shadow: 0 3px 0 var(--rim); }
.ob-orange { --c: var(--orange); --rim: var(--orange-edge); }
.ob-blue { --c: var(--blue); --rim: var(--blue-edge); }
.ob-purple { --c: var(--purple); --rim: var(--purple-edge); }
.ob-green { --c: var(--green); --rim: var(--green-edge); }

.ob-field { display: grid; gap: 8px; }
.ob-big-input, .ob-small-input {
  display: flex; align-items: center; gap: 6px; padding: 0 20px;
  background: var(--field); border: 2px solid var(--line); border-radius: 18px;
  transition: border-color 120ms;
}
.ob-big-input { height: 92px; font-weight: 900; font-size: 2.5rem; color: var(--faint); }
.ob-small-input { min-height: 52px; padding: 0 16px; border-radius: 14px; }
.ob-big-input:focus-within, .ob-small-input:focus-within { border-color: var(--blue); }
.ob-big-input input, .ob-small-input input {
  flex: 1; min-width: 0; min-height: 0; padding: 0; border: 0; background: none; outline: none;
  color: var(--text); font-variant-numeric: tabular-nums;
}
.ob-big-input input { font: 900 3rem "Nunito", ui-rounded, system-ui, sans-serif; }
.ob-small-input input { font: 800 1.1rem "Nunito", ui-rounded, system-ui, sans-serif; }
.ob-suffix { color: var(--muted); font-weight: 800; font-size: 1rem; white-space: nowrap; }
.ob-field.invalid .ob-big-input, .ob-field.invalid .ob-small-input { border-color: var(--red); }
.ob-error { color: var(--red); font-size: 0.9rem; }
.ob-error[hidden], .ob-field[hidden], .field[hidden], .fields[hidden] { display: none; }

.ob-steppers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ob-chip {
  min-height: 52px; border: 2px solid var(--line); border-radius: 16px;
  background: var(--card); box-shadow: 0 4px 0 var(--line); color: var(--text); cursor: pointer;
  font: 900 1.1rem "Nunito", ui-rounded, system-ui, sans-serif;
  transition: transform 80ms ease, box-shadow 80ms ease;
}
.ob-chip:active { transform: translateY(4px); box-shadow: 0 0 0 var(--line); }
.ob-tip { display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px; border-radius: 16px; background: #fff4e0; color: #7a4a00; font-size: 0.95rem; }
.ob-tip svg { width: 20px; height: 20px; margin-top: 2px; }

.ob-options { display: grid; gap: 10px; }
/* "What fuel does your car take?" answers (Plus), on the price card and in #fuelDialog. */
.fuel-choices { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.fuel-choices .btn { flex: 1 1 0; min-width: 6em; }
.ob-switch { padding: 16px; border: 2px solid var(--line); border-radius: 16px; }
.ob-switch .switch { margin-top: 0; }
.ob-option { position: relative; display: block; cursor: pointer; }
.ob-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ob-card {
  --on: var(--blue); --on-bg: #ddf4ff; --on-ink: #1477a8;
  display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 10px 16px;
  border: 2px solid var(--line); border-radius: 16px; background: var(--card); box-shadow: 0 4px 0 var(--line);
  transition: transform 80ms ease, box-shadow 80ms ease, border-color 120ms, background 120ms;
}
.ob-option-purple .ob-card { --on: var(--purple); --on-bg: #f7ecff; --on-ink: #8a3fc0; }
.ob-card-tall { min-height: 96px; gap: 16px; padding: 16px; border-radius: 18px; }
.ob-option:active .ob-card { transform: translateY(4px); box-shadow: 0 0 0 var(--line); }
.ob-option input:checked + .ob-card { border-color: var(--on); background: var(--on-bg); box-shadow: 0 4px 0 var(--on); }
.ob-option input:checked + .ob-card b, .ob-option input:checked + .ob-card .ob-card-val { color: var(--on-ink); }
.ob-option input:focus-visible + .ob-card { outline: 3px solid var(--blue); outline-offset: 3px; }
.ob-card-main { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ob-card-main b { font-weight: 900; font-size: 1.05rem; }
.ob-card-main small { color: var(--muted); font-weight: 700; font-size: 0.875rem; }
.ob-card-val { font-weight: 900; font-size: 1.05rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ob-card-val small { font-size: 0.75rem; }
.ob-radio-dot {
  width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid var(--line); color: #fff; font-size: 16px;
}
.ob-radio-dot svg { opacity: 0; }
.ob-option input:checked + .ob-card .ob-radio-dot { background: var(--on); border-color: var(--on); }
.ob-option input:checked + .ob-card .ob-radio-dot svg { opacity: 1; }

.ob-summary { width: 100%; margin: 10px 0 0; border: 2px solid var(--line); border-radius: 16px; text-align: left; }
.ob-summary div { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 12px; padding: 10px 8px 10px 14px; border-top: 2px solid var(--line); }
.ob-summary div:first-child { border-top: 0; }
.ob-summary dt { grid-column: 1; color: var(--muted); font-weight: 800; font-size: 0.82rem; }
.ob-summary dd { grid-column: 1; margin: 0; font-weight: 900; font-size: 1.05rem; }
.ob-summary .ob-edit { grid-column: 2; grid-row: 1 / span 2; color: var(--blue-edge); }
.ob-fine { color: var(--muted); font-size: 0.9rem; }

.ob-foot { display: grid; gap: 6px; padding: 16px 20px max(24px, env(safe-area-inset-bottom)); border-top: 2px solid var(--line); }
.ob-foot .btn { width: 100%; }

/* ---------- Plus walkthrough (#plusWelcome): the first-run guide's pieces, in Plus gold ---------- */
.pw .pw-form { display: flex; flex-direction: column; height: 100%; }
.pw { overflow: hidden; }
.pw-progress span { background: var(--gold); }
.pw-hero { background: var(--gold); box-shadow: 0 8px 0 var(--gold-edge); }
.pw-btn { --fill: var(--gold); --rim: var(--gold-edge); color: #5c4300; }
.pw-later, .pw-skip, .pw-locate { color: var(--blue-edge); }
.pw-later[hidden] { display: none; }
.pw-orange .ob-card { --on: var(--orange); --on-bg: #fff1e0; --on-ink: #b85e00; }
.pw-live, #pwFuels { display: grid; gap: 14px; }
.pw-live[hidden], #pwFuels[hidden], #pwWhereBlock[hidden], .ob-tip[hidden] { display: none; }
.pw-q { font-weight: 900; font-size: 1.1rem; }
.pw-find { display: flex; gap: 10px; align-items: stretch; }
.pw-find .ob-small-input { flex: 1; min-width: 0; }
.pw-locate { justify-self: start; padding-left: 0; }
.pw-where { font-weight: 800; color: var(--green-edge); }
.pw-where:empty { display: none; }
.pw-where.error { color: var(--red); }
.pw-lede { max-width: none; }
/* #stampBlock and #commuteBlock, borrowed from the settings sheet, as cards. */
.pw-strava { display: grid; gap: 14px; }
.pw-strava > div { padding: 2px 16px 16px; border: 2px solid var(--line); border-radius: 16px; }
.pw-recap { width: 100%; text-align: left; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pw-orange .ob-card { --on-bg: #3a2a14; --on-ink: #ffb35c; }
  :root:not([data-theme="light"]) .pw-where { color: var(--green); }
  :root:not([data-theme="light"]) .ob-card { --on-bg: #16394a; --on-ink: #7fd3fa; }
  :root:not([data-theme="light"]) .ob-option-purple .ob-card { --on-bg: #3a2a4a; --on-ink: #e2b8ff; }
  :root:not([data-theme="light"]) .ob-tip { background: #3a2c14; color: #ffd28a; }
  :root:not([data-theme="light"]) .ob-perkm { color: var(--green); }
  :root:not([data-theme="light"]) .ach-lvl { color: var(--gold); }
}

/* ---------- Your numbers sheet ---------- */
.icon-btn {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center;
  border: 2px solid var(--line); border-radius: 12px; padding: 0;
  background: var(--bg); color: var(--muted); font-size: 22px; cursor: pointer;
}
.icon-btn[hidden] { display: none; }
.icon-btn:hover { color: var(--text); }
.card-head .icon-btn { border: 0; margin: -8px -8px -8px 0; }
.sheet {
  width: min(560px, calc(100% - 32px)); max-height: calc(100% - 32px); padding: 20px;
  border: 2px solid var(--line); border-radius: 20px;
  background: var(--card); color: var(--text);
}
.sheet::backdrop { background: rgba(19, 31, 36, 0.55); }
.sheet[open] { animation: sheet-in 220ms cubic-bezier(.34, 1.2, .64, 1); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(24px); } }
@media (max-width: 560px) {
  /* A bottom sheet on phones. */
  .sheet {
    width: 100%; max-width: 100%; margin: auto 0 0; border-width: 2px 0 0;
    border-radius: 20px 20px 0 0; padding-bottom: max(20px, env(safe-area-inset-bottom));
  }
}

/* ---------- Small screens ---------- */
@media (max-width: 560px) {
  /* Like the iOS app: keep the wordmark, drop the name chip (it's in the Strava sign-in anyway). */
  .brand { font-size: 1.3rem; gap: 8px; }
  .chip-who { display: none !important; }
  .stats { gap: 8px; }
  .stat-value { flex-direction: column; gap: 2px; font-size: 1.05rem; padding: 10px 4px; }
  .fields { grid-template-columns: 1fr; }
  .day-dot { width: 34px; height: 34px; }
  .card { padding: 16px; }
}

/* ---------- RideMoney Plus: live price card, rain-day freeze, recap ---------- */
/* A rainy day without a ride: the streak is safe. */
.day.rain:not(.ridden) .day-dot { border-style: solid; border-color: var(--blue); color: var(--blue); background: var(--field); }
.day.rain { opacity: 1; color: var(--blue); }
.card h2 .plus-tag { margin-left: 8px; }
.price-icon {
  width: 46px; height: 46px; border-radius: 14px; flex: none;
  display: grid; place-items: center; background: var(--orange); color: #fff; font-size: 24px;
  box-shadow: 0 3px 0 var(--orange-edge);
}
.price-card .goal-empty + .price-settings, .price-card .price-settings { margin-top: 10px; padding-left: 0; color: var(--blue); }
.price-now { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.price-big { font-weight: 900; font-size: 2.5rem; line-height: 1.1; letter-spacing: -0.02em; }
.price-change { font-weight: 900; font-size: 0.95rem; }
.price-change.up { color: var(--orange); }
.price-change.down { color: var(--green-edge); }
.price-chart { position: relative; margin: 12px 0 4px; padding-right: 44px; }
.price-chart svg { display: block; width: 100%; height: 70px; overflow: visible; }
.price-chart polyline { fill: none; stroke: var(--orange); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.price-axis {
  position: absolute; top: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column; justify-content: space-between;
  color: var(--muted); font-size: 0.75rem; text-align: right;
}
.price-note { color: var(--muted); font-size: 0.82rem; margin-top: 8px; }

.recap-open {
  display: flex; align-items: center; gap: 14px; width: 100%; margin-top: 20px; padding: 16px;
  border: 0; border-radius: var(--radius); cursor: pointer; text-align: left; color: #fff;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  box-shadow: 0 var(--edge) 0 var(--purple-edge);
  font: inherit; transition: transform 80ms ease, box-shadow 80ms ease;
}
.recap-open[hidden] { display: none; }
.recap-open:active { transform: translateY(var(--edge)); box-shadow: 0 0 0 var(--purple-edge); }
.recap-open-emoji {
  width: 52px; height: 52px; border-radius: 14px; flex: none;
  display: grid; place-items: center; font-size: 30px; background: rgba(255, 255, 255, 0.2);
}
.recap-open-main { display: grid; gap: 2px; min-width: 0; }
.recap-open-main b { font-weight: 900; font-size: 1.1rem; }
.recap-open-main > span { opacity: 0.9; font-size: 0.92rem; }

.plus-block { margin-top: 24px; padding-top: 18px; border-top: 2px solid var(--line); }
.plus-block[hidden] { display: none; }
.plus-title { margin: 0 0 14px; font-weight: 900; font-size: 1.1rem; }
.plus-block .fields { grid-template-columns: 1fr 1fr; }
.plus-block [hidden] { display: none; }
.switch-note.error { color: var(--red); }

/* Commute times for tagging commutes on Strava (Plus). */
.commute-times { margin: 12px 0 0 64px; display: grid; gap: 12px; }
.commute-times[hidden] { display: none; }
.day-picks { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; } /* one even row, like CommuteTimesEditor */
.day-picks legend { padding: 0; margin-bottom: 6px; }
.day-picks label { position: relative; cursor: pointer; }
.day-picks input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.day-picks span {
  display: grid; place-items: center; width: 100%; height: 38px; border-radius: 12px;
  border: 2px solid var(--line); color: var(--muted); font-weight: 900;
}
.day-picks input:checked + span { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 3px 0 var(--blue-edge); }
.day-picks input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: 2px; }
/* The window's name, then "from to to" on one line under it, so both windows' times line up at any width. */
.commute-window { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px 6px; color: var(--muted); font-weight: 800; }
.commute-window .check { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; color: var(--text); cursor: pointer; }
.commute-window .check input { width: 20px; height: 20px; accent-color: var(--green); }
.commute-window input[type="time"] { width: 100%; min-width: 0; padding: 10px 8px; font-size: 1rem; }
.commute-window:has(.check input:not(:checked)) input[type="time"] { opacity: 0.5; }
@media (max-width: 480px) { .commute-times { margin-left: 0; } }
.plus-where { margin-left: 64px; }
.plus-where .switch-note { margin-left: 0; }
.plus-find { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.plus-find input {
  flex: 1 1 140px; min-width: 0; min-height: 44px; padding: 8px 12px;
  border: 2px solid var(--line); border-radius: 12px; background: var(--field); color: var(--text);
  font: 700 1rem "Nunito", ui-rounded, system-ui, sans-serif;
}
.btn-small { min-height: 44px; padding: 10px 16px; font-size: 0.8rem; }
.btn-ghost.btn-small { box-shadow: 0 3px 0 var(--line); }
@media (max-width: 560px) { .plus-where { margin-left: 0; } }

.recap {
  width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0; padding: 0; border: 0;
  background: var(--green); overflow: hidden;
}
.recap::backdrop { background: rgba(19, 31, 36, 0.8); }
.recap[open] { animation: ob-in 260ms ease both; }
.recap-slide {
  position: relative; isolation: isolate; overflow: hidden;
  height: 100%; padding: 72px 28px 110px; cursor: pointer; user-select: none; touch-action: pan-y;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center;
  background: linear-gradient(160deg, var(--a, var(--green)), var(--b, var(--green-edge)));
}
/* Big soft shapes drifting behind each slide, placed differently slide to slide */
.recap-slide::before, .recap-slide::after {
  content: ""; position: absolute; z-index: -1; border-radius: 42% 58% 63% 37% / 41% 44% 56% 59%;
  background: rgba(255, 255, 255, 0.16); animation: recap-drift 14s ease-in-out infinite alternate;
}
.recap-slide::before { width: 380px; height: 380px; top: -140px; right: -120px; }
.recap-slide::after { width: 300px; height: 300px; bottom: -120px; left: -110px; background: rgba(0, 0, 0, 0.1); animation-duration: 18s; }
.recap-slide[data-shape="1"]::before { top: auto; bottom: -160px; right: -80px; }
.recap-slide[data-shape="1"]::after { bottom: auto; top: -100px; left: -90px; }
.recap-slide[data-shape="2"]::before { top: 30%; right: -220px; border-radius: 50%; }
.recap-slide[data-shape="3"]::after { left: 20%; bottom: -200px; width: 420px; height: 260px; }
@keyframes recap-drift { to { transform: rotate(40deg) scale(1.12); border-radius: 58% 42% 37% 63% / 56% 59% 41% 44%; } }
.recap-slide > * { animation: pop 420ms cubic-bezier(.34, 1.56, .64, 1) both; }
.recap-slide > :nth-child(2) { animation-delay: 80ms; }
.recap-slide > :nth-child(3) { animation-delay: 160ms; }
.recap-slide > :nth-child(4) { animation-delay: 240ms; }
.recap-slide > :nth-child(5) { animation-delay: 320ms; }
.recap-slide > :nth-child(6) { animation-delay: 400ms; }
.recap-big { font-weight: 900; font-size: clamp(2.6rem, 14vw, 4rem); line-height: 1.05; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.recap-money { font-variant-numeric: tabular-nums; }
.recap-say { font-weight: 900; font-size: clamp(1.25rem, 5vw, 1.6rem); line-height: 1.25; max-width: 22ch; }
.recap-small { font-weight: 800; font-size: 1.05rem; opacity: 0.85; max-width: 32ch; }
.recap-emoji { font-size: 80px; line-height: 1; }
.recap-hero { width: 120px; height: 120px; font-size: 64px; background: rgba(255, 255, 255, 0.25); animation: bob 2.6s ease-in-out infinite; }
.recap-close {
  position: absolute; top: calc(max(16px, env(safe-area-inset-top)) + 14px); right: 16px; z-index: 2;
  width: 40px; height: 40px; border: 0; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; font-size: 18px; color: #fff; background: rgba(0, 0, 0, 0.2);
}

/* Story progress: one bar per slide; the current bar's fill is the slide's timer */
.recap-bars {
  position: absolute; z-index: 2; top: max(12px, env(safe-area-inset-top)); left: 16px; right: 16px;
  display: flex; gap: 5px; pointer-events: none;
}
.recap-bar { flex: 1; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.35); overflow: hidden; }
.recap-bar i { display: block; height: 100%; width: 0; background: #fff; border-radius: inherit; }
.recap-bar.done i, .recap-bar.on i { width: 100%; }
.recap-bar.on:not(.wait) i { animation: recap-fill 6s linear both; }
.recap-bar.on.wait i { width: 0; }
.recap-bar:last-child.on.wait i { width: 100%; }
.recap.paused .recap-bar i, .recap.paused .recap-slide::before, .recap.paused .recap-slide::after { animation-play-state: paused; }
@keyframes recap-fill { from { width: 0; } }

.recap-nav {
  position: absolute; left: 0; right: 0; bottom: max(24px, env(safe-area-inset-bottom));
  display: flex; align-items: center; justify-content: center; gap: 120px; color: #fff; pointer-events: none;
}
.recap-arrow {
  width: 48px; height: 48px; border: 0; border-radius: 50%; cursor: pointer; pointer-events: auto;
  display: grid; place-items: center; font-size: 22px; color: #fff; background: rgba(0, 0, 0, 0.2);
}
.recap-arrow:disabled { opacity: 0.3; cursor: default; }
.recap-arrow-next svg { transform: scaleX(-1); }

/* Month by month */
.recap-months { width: min(340px, 100%); }
.recap-months svg { display: block; width: 100%; height: auto; overflow: visible; }
.recap-months text { fill: currentColor; font: 800 12px Nunito, sans-serif; opacity: 0.8; }
.recap-col { transform-box: fill-box; transform-origin: bottom; animation: recap-rise 600ms cubic-bezier(.34, 1.56, .64, 1) both; }
@keyframes recap-rise { from { transform: scaleY(0); } }

/* Top 5 rides */
.recap-top { list-style: none; margin: 0; padding: 0; width: min(420px, 100%); display: grid; gap: 10px; text-align: left; }
.recap-top li {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.18); animation: ob-in 380ms ease both;
}
.recap-top-rank { font-weight: 900; font-size: 1.6rem; width: 1.2em; text-align: center; flex: none; }
.recap-top-main { display: grid; min-width: 0; flex: 1; }
.recap-top-main b { font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recap-top-main span { font-weight: 700; font-size: 0.9rem; opacity: 0.85; }
.recap-top-saved { font-weight: 900; flex: none; }

/* The guessing game */
.recap-quiz { display: grid; gap: 12px; width: min(320px, 100%); margin-top: 6px; }
.recap-guess {
  min-height: 56px; border: 0; border-radius: 16px; cursor: pointer; font: 900 1.35rem Nunito, sans-serif;
  color: var(--purple-edge); background: #fff; box-shadow: 0 var(--edge) 0 rgba(0, 0, 0, 0.18);
}
.recap-guess:active:not(:disabled) { transform: translateY(var(--edge)); box-shadow: none; }
.recap-guess:disabled { cursor: default; opacity: 0.55; }
.recap-guess.right { opacity: 1; color: #fff; background: var(--green); box-shadow: 0 var(--edge) 0 var(--green-edge); animation: pop 420ms cubic-bezier(.34, 1.56, .64, 1); }
.recap-guess.wrong { opacity: 1; color: #fff; background: var(--red); box-shadow: 0 var(--edge) 0 var(--red-edge); }
.recap-quiz-say { min-height: 1.5em; justify-self: center; }

/* The summary card, the shareable end */
.recap-card {
  width: min(340px, 100%); padding: 20px; border-radius: 22px; display: grid; gap: 4px; text-align: left;
  color: var(--text); background: var(--card); box-shadow: 0 6px 0 rgba(0, 0, 0, 0.18);
}
.recap-card-head { display: flex; font-weight: 900; font-size: 1.2rem; margin-bottom: 8px; }
.recap-card-money { color: var(--green); }
.recap-card-year { margin-left: auto; color: var(--muted); }
.recap-card-label { color: var(--muted); font-weight: 800; font-size: 0.85rem; }
.recap-card-saved { font-weight: 900; font-size: 2.6rem; line-height: 1.1; color: var(--green-edge); overflow-wrap: anywhere; }
.recap-card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0 10px; }
.recap-card-stat { display: grid; }
.recap-card-stat span { color: var(--muted); font-weight: 800; font-size: 0.8rem; }
.recap-card-stat b { font-weight: 900; font-size: 1.15rem; }
.recap-card-persona { font-weight: 900; font-size: 1.1rem; padding-top: 12px; border-top: 2px solid var(--line); }
.recap-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }
.recap-actions .btn { min-width: 150px; }
.recap-share { --fill: var(--gold); --rim: var(--gold-edge); color: #5c4300; }
.recap-done { --fill: #fff; --rim: rgba(255, 255, 255, 0.5); color: var(--blue-edge); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
