/* 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;
  --red: #ff4b4b;
  --strava: #fc4c02;
  --strava-edge: #c93c02;

  --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(--green); text-decoration: none;
  font-weight: 900; font-size: 1.45rem; letter-spacing: -0.02em;
}
.brand img { border-radius: 10px; }
.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 48px; }

/* ---------- 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-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; }
.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], 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, select:focus { outline: none; border-color: var(--blue); }

.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; }

/* ---------- 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 .ride-list { padding: 0 0 12px; }
.ride-group .ride:first-child { border-top: 2px solid var(--line); padding-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); }
.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; }

.app-foot { display: flex; justify-content: center; margin-top: 28px; }
.foot { margin-top: 36px; text-align: center; font-size: 0.8rem; color: var(--faint); font-weight: 800; }

/* ---------- 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-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] { 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; }
.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%; }

@media (prefers-color-scheme: dark) {
  :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); }
}

/* ---------- 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) {
  .brand span { display: none; }
  .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; }
}

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