/* Hero 90 design system */
:root {
  --font: "Readex Pro", "Segoe UI", Tahoma, sans-serif;
  --bg: #F3F6F4;
  --bg-2: #E9EFEB;
  --card: #FFFFFF;
  --ink: #10211A;
  --ink-2: #3A4D45;
  --muted: #6B7D75;
  --line: #E1E8E4;
  --brand: #0F6B4A;
  --brand-2: #14895F;
  --brand-ink: #FFFFFF;
  --brand-soft: #E3F3EB;
  --gold: #C9971C;
  --gold-soft: #FBF1D6;
  --good: #16935F;
  --ok: #D49A12;
  --low: #D2543F;
  --none: #C5D0CB;
  --good-soft: #E1F4EA;
  --ok-soft: #FCF0D3;
  --low-soft: #FBE5E0;
  --shadow: 0 1px 2px rgba(16, 33, 26, .04), 0 6px 20px rgba(16, 33, 26, .06);
  --shadow-lg: 0 10px 30px rgba(15, 107, 74, .25);
  --r: 20px;
  --r-sm: 14px;
  --hero-grad: linear-gradient(135deg, #0B4F37 0%, #0F6B4A 45%, #1B9A6A 100%);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B1310;
    --bg-2: #111C18;
    --card: #14201B;
    --ink: #E8F0EC;
    --ink-2: #BFD0C8;
    --muted: #8FA39A;
    --line: #22322B;
    --brand: #2FBF85;
    --brand-2: #45D69A;
    --brand-ink: #062016;
    --brand-soft: #173329;
    --gold: #E8B940;
    --gold-soft: #2E2814;
    --good: #3CCB8C;
    --ok: #E8B940;
    --low: #F07A65;
    --none: #33443D;
    --good-soft: #163428;
    --ok-soft: #302812;
    --low-soft: #3A1E19;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, .4);
    --hero-grad: linear-gradient(135deg, #0A3A29 0%, #0F5A40 50%, #16805A 100%);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15.5px; line-height: 1.65; color: var(--ink);
  background: var(--bg); -webkit-font-smoothing: antialiased;
  padding-bottom: calc(92px + env(safe-area-inset-bottom));
}
main { max-width: 760px; margin: 0 auto; padding: calc(18px + env(safe-area-inset-top)) 16px 24px; outline: none; }
h1, h2, h3 { line-height: 1.3; margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.08rem; }
h3 { font-size: 1rem; margin: 22px 0 6px; }
p { margin: 0 0 10px; }
a { color: var(--brand); }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.center { text-align: center; }
.lead { font-size: 1.05rem; font-weight: 500; }
.skip { position: absolute; inset-inline-start: -999px; }
.skip:focus { inset-inline-start: 12px; top: 12px; z-index: 99; background: var(--card); padding: 8px 12px; border-radius: 10px; }
.ico { width: 22px; height: 22px; flex: none; }
:focus-visible { outline: 2.5px solid var(--brand-2); outline-offset: 2px; border-radius: 8px; }

/* ---------- cards ---------- */
.card {
  background: var(--card); border-radius: var(--r); padding: 18px; margin: 0 0 14px;
  box-shadow: var(--shadow); border: 1px solid var(--line);
}
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h2 { flex: 1; }
.badge-ico {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand);
}
.badge-ico .ico { width: 19px; height: 19px; }
.card.accent { background: linear-gradient(180deg, var(--brand-soft), var(--card) 70%); }
.card.notice ul { margin: 0 0 14px; padding-inline-start: 20px; color: var(--ink-2); }
.card.danger .badge-ico { background: var(--low-soft); color: var(--low); }
.card.cert { background: linear-gradient(135deg, var(--gold-soft), var(--card)); border-color: var(--gold); }
.card.cert .badge-ico { background: var(--gold); color: #fff; }
.screen-head { margin: 4px 2px 16px; }
.screen-head p { margin: 4px 0 0; }
.count { font-size: .85rem; color: var(--muted); font-weight: 500; }
.mins { display: inline-flex; align-items: center; gap: 4px; font-size: .85rem; color: var(--muted); }
.mins .ico { width: 16px; height: 16px; }

/* ---------- hero ---------- */
.hero {
  background: var(--hero-grad); color: #fff; border-radius: 24px; padding: 26px 22px; margin-bottom: 16px;
  box-shadow: var(--shadow-lg); position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; inset-inline-end: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.16), transparent 70%); pointer-events: none;
}
.hero h1 { font-size: 1.75rem; margin: 4px 0 6px; }
.hero p { opacity: .88; margin: 0 0 14px; }
.hero-mark { font-weight: 300; font-size: 1.05rem; letter-spacing: .02em; opacity: .9; }
.hero-mark b { font-weight: 700; color: #FFD66B; }
.home-hero { display: flex; align-items: center; gap: 20px; }
.eyebrow { font-size: .8rem; letter-spacing: .08em; opacity: .75; margin: 0 !important; }

/* ---------- ring ---------- */
.ring { position: relative; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 8; }
.ring .ring-bg { stroke: var(--bg-2); }
.ring .ring-fg { stroke: var(--brand); stroke-linecap: round; transition: stroke-dasharray .5s ease; }
.ring.hi .ring-fg { stroke: var(--good); }
.ring.mid .ring-fg { stroke: var(--ok); }
.ring.lo .ring-fg { stroke: var(--low); }
.ring.none .ring-fg { stroke: transparent; }
.ring.light .ring-bg { stroke: rgba(255,255,255,.18); }
.ring.light .ring-fg { stroke: #FFD66B; }
.ring-in { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.1; }
.ring-in b { font-size: 1.7rem; font-weight: 700; }
.ring-in small { font-size: .66rem; color: var(--muted); margin-top: 3px; }
.ring.light .ring-in small { color: rgba(255,255,255,.75); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: .95rem; border: 0; cursor: pointer; text-decoration: none;
  background: var(--brand); color: var(--brand-ink); padding: 11px 18px; border-radius: 14px; min-height: 46px;
  transition: transform .1s, filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.block { width: 100%; }
.btn.lg { min-height: 54px; font-size: 1.05rem; border-radius: 16px; box-shadow: var(--shadow-lg); }
.btn.soft { background: var(--brand-soft); color: var(--brand); }
.btn.light { background: #fff; color: #0B4F37; }
.btn.danger { background: var(--low-soft); color: var(--low); }
.btn .ico { width: 19px; height: 19px; }
.icon-btn { width: 46px; padding: 0; flex: none; }
.link { background: none; border: 0; padding: 4px 0; font: inherit; font-size: .83rem; color: var(--brand); cursor: pointer; font-weight: 500; }
.link-btn { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; text-decoration: none; font-size: .92rem; }
.link-btn .ico { width: 17px; height: 17px; }
.circle-btn {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--card); color: var(--ink); box-shadow: var(--shadow); border: 1px solid var(--line);
}
.circle-btn.ghost { visibility: hidden; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.file-btn { cursor: pointer; }

/* ---------- fields ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.grid.two { grid-template-columns: 1fr 1fr; margin-top: 12px; }
.grid.three { grid-template-columns: repeat(3, 1fr); margin-bottom: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.wide { margin-top: 12px; }
.lbl { font-size: .82rem; color: var(--ink-2); font-weight: 500; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--bg); border: 1.5px solid transparent; border-radius: 12px;
  padding: 10px 12px; width: 100%; min-height: 46px; transition: border-color .15s, background .15s;
}
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-2); background: var(--card); }
input[type="number"] { -moz-appearance: textfield; }
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap input:not(:last-child) { padding-inline-end: 64px; }
.input-wrap i { position: absolute; inset-inline-end: 12px; font-style: normal; font-size: .78rem; color: var(--muted); pointer-events: none; white-space: nowrap; }
.hint { color: var(--muted); font-size: .76rem; }
.form-error { color: var(--low); font-weight: 500; min-height: 1.4em; }
.note { background: var(--gold-soft); border-radius: var(--r-sm); padding: 10px 14px; font-size: .9rem; }
.warn-text { color: var(--low); font-size: .85rem; }

/* toggles */
.toggles { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 14px; }
.toggles.col { flex-direction: column; }
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: .93rem; user-select: none; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; }
.toggle .track { width: 44px; height: 26px; border-radius: 99px; background: var(--none); position: relative; transition: background .2s; flex: none; }
.toggle .track span { position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.toggle input:checked + .track { background: var(--brand); }
.toggle input:checked + .track span { transform: translateX(-18px); }
[dir="ltr"] .toggle input:checked + .track span { transform: translateX(18px); }
.toggle input:focus-visible + .track { outline: 2.5px solid var(--brand-2); outline-offset: 2px; }

/* ---------- pills, chips ---------- */
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.chip { display: inline-flex; align-items: center; font-size: .76rem; font-weight: 500; padding: 3px 10px; border-radius: 99px; background: var(--bg-2); color: var(--ink-2); }
.chip.phase { background: var(--brand-soft); color: var(--brand); }
.chip.plat, .chip.hero, .chip.grade-hero, .chip.st-hero { background: var(--gold-soft); color: #8A6400; }
.chip.gold, .chip.st-steady, .chip.grade-steady { background: var(--good-soft); color: var(--good); }
.chip.silver, .chip.start { background: var(--bg-2); color: var(--ink-2); }
.chip.bronze, .chip.st-recovery, .chip.grade-recovery { background: var(--ok-soft); color: #94690A; }
.chip.out, .chip.st-missed { background: var(--low-soft); color: var(--low); }
.chip.st-today { background: var(--brand); color: var(--brand-ink); }
.chip.hidden { display: none; }
@media (prefers-color-scheme: dark) {
  .chip.plat, .chip.hero, .chip.grade-hero, .chip.st-hero, .chip.bronze, .chip.st-recovery, .chip.grade-recovery { color: var(--gold); }
}
.hero .chip { background: rgba(255,255,255,.16); color: #fff; }
.xp { display: inline-flex; align-items: center; gap: 4px; font-size: .8rem; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--gold-soft); color: #8A6400; }
@media (prefers-color-scheme: dark) { .xp { color: var(--gold); } }
.xp .ico { width: 14px; height: 14px; }
.weak { font-size: .8rem; color: var(--muted); padding: 3px 0; }

/* ---------- bars ---------- */
.bar { height: 7px; background: var(--bg-2); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--brand); border-radius: inherit; transition: width .35s ease; }
.hero .bar { background: rgba(255,255,255,.2); }
.hero .bar span { background: #FFD66B; }

/* ---------- day ---------- */
.day-top { display: flex; align-items: flex-start; gap: 12px; margin: 2px 0 8px; }
.day-title { flex: 1; text-align: center; }
.day-title h1 small { font-size: .95rem; font-weight: 400; color: var(--muted); }
.day-title p { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }
.day-title .pills { justify-content: center; }
.pick-day {
  display: flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; font-size: .88rem; font-weight: 500;
  margin: 4px auto 14px; padding: 8px 14px; border-radius: 99px; background: var(--brand-soft); width: fit-content;
}
.pick-day .ico { width: 17px; height: 17px; }
.summary .score-row { display: flex; align-items: center; gap: 18px; }
.score-text { flex: 1; min-width: 0; }
.score-text p { margin: 2px 0 0; font-size: .9rem; }
.alerts { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; }
.alerts li { background: var(--bg); border-radius: 12px; padding: 9px 12px; font-size: .88rem; border-inline-start: 3px solid var(--ok); }
.alerts li.warn { background: var(--low-soft); border-color: var(--low); }
.alerts li b { margin-inline-end: 6px; }

.metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.metric { background: var(--bg); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 8px; border: 1.5px solid transparent; transition: border-color .2s; }
.metric-top { display: flex; align-items: center; gap: 7px; }
.m-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--card); color: var(--muted); }
.m-ico .ico { width: 17px; height: 17px; }
.m-lbl { font-weight: 600; font-size: .88rem; flex: 1; }
.m-tag { font-size: .7rem; font-weight: 600; color: var(--muted); }
.metric input { background: var(--card); font-size: 1.2rem; font-weight: 600; min-height: 48px; }
.metric .input-wrap.big input { padding-inline-end: 56px; }
.m-note { font-size: .72rem; color: var(--muted); }
.metric.good .m-ico { background: var(--good-soft); color: var(--good); }
.metric.good .bar span { background: var(--good); }
.metric.good .m-tag { color: var(--good); }
.metric.ok .m-ico { background: var(--ok-soft); color: var(--ok); }
.metric.ok .bar span { background: var(--ok); }
.metric.ok .m-tag { color: var(--ok); }
.metric.low .m-ico { background: var(--low-soft); color: var(--low); }
.metric.low .bar span { background: var(--low); }
.metric.low .m-tag { color: var(--low); }

/* workout */
.dose { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 8px; }
.dose span { background: var(--brand-soft); border-radius: 14px; padding: 10px 6px; text-align: center; font-size: .78rem; color: var(--ink-2); display: flex; flex-direction: column; }
.dose b { font-size: 1.3rem; color: var(--brand); font-weight: 700; line-height: 1.3; }
.dose-text { background: var(--gold-soft); border-radius: 14px; padding: 12px; font-weight: 500; }
.ex-progress { display: flex; align-items: center; gap: 12px; margin: 12px 0 4px; font-size: .82rem; color: var(--muted); }
.ex-progress .bar { flex: 1; }
.ex-progress span { white-space: nowrap; }
.ex-list { list-style: none; padding: 0; margin: 10px 0 12px; display: grid; gap: 10px; }
.ex { display: flex; gap: 12px; background: var(--bg); border-radius: 16px; padding: 12px; transition: background .2s; }
.ex.done { background: var(--good-soft); }
.ex-check { flex: none; cursor: pointer; }
.ex-check input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; }
.ex-check span { width: 30px; height: 30px; border-radius: 10px; border: 2px solid var(--none); display: grid; place-items: center; color: transparent; background: var(--card); transition: all .15s; }
.ex-check span .ico { width: 18px; height: 18px; stroke-width: 2.6; }
.ex-check input:checked + span { background: var(--good); border-color: var(--good); color: #fff; }
.ex-check input:focus-visible + span { outline: 2.5px solid var(--brand-2); outline-offset: 2px; }
.ex-body { flex: 1; min-width: 0; }
.ex-body b { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.ex-body b em { font-style: normal; font-size: .72rem; width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.ex.done .ex-body b { text-decoration: line-through; text-decoration-color: var(--good); }
.ex-body p { margin: 3px 0 4px; font-size: .86rem; color: var(--ink-2); }
.search { display: inline-block; font-size: .74rem; color: var(--muted); background: var(--card); border-radius: 7px; padding: 1px 8px; font-family: ui-monospace, Consolas, monospace; }
.ex-note { margin-top: 8px; min-height: 40px; font-size: .86rem; background: var(--card); }
.ex-actions { margin-top: 2px; }
.add-custom { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
.add-custom input { flex: 1 1 180px; }
.add-custom select { flex: 0 1 140px; }

/* ---------- home ---------- */
.today-card .today-row { display: grid; grid-template-columns: auto 1fr 1fr; align-items: center; gap: 14px; }
.today-card h3 { margin: 0; font-size: 1rem; }
.today-card .ring-in b { font-size: 1.15rem; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 10px; }
.stat { background: var(--card); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.stat > .ico { color: var(--brand); width: 24px; height: 24px; margin-bottom: 4px; }
.stat b { font-size: 1.35rem; font-weight: 700; line-height: 1.25; }
.stat b small { font-size: .8rem; font-weight: 400; color: var(--muted); }
.stat .bar { margin: 4px 0 2px; }
.stats.mini { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); margin: 14px 0 0; }
.stats.mini .stat { box-shadow: none; background: var(--bg); border: 0; padding: 12px; }
.stats.mini .stat b { font-size: 1.15rem; }
.targets { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.targets div { background: var(--bg); border-radius: 14px; padding: 12px; display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; }
.targets .ico { grid-row: span 2; color: var(--brand); }
.targets span { font-size: .78rem; color: var(--muted); }
.targets b { font-weight: 600; }

/* ---------- calendar ---------- */
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cal-nav h2 { font-size: 1.15rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-wd { text-align: center; font-size: .72rem; color: var(--muted); font-weight: 500; padding-bottom: 4px; }
.cal-cell {
  aspect-ratio: 1 / 1.12; border-radius: 13px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-decoration: none; color: var(--ink); background: var(--bg); position: relative; line-height: 1.1; gap: 1px;
  transition: transform .12s, box-shadow .15s; border: 1.5px solid transparent; min-width: 0;
}
a.cal-cell:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.cal-cell b { font-size: .98rem; font-weight: 600; }
.cal-cell small { font-size: .6rem; color: var(--muted); }
.cal-cell.empty { background: none; }
.cal-cell.out { background: none; color: var(--none); }
.cal-cell.out b { font-weight: 400; }
.cal-cell.st-upcoming { background: var(--card); border-color: var(--line); }
.cal-cell.st-hero { background: var(--gold-soft); }
.cal-cell.st-steady { background: var(--good-soft); }
.cal-cell.st-recovery { background: var(--ok-soft); }
.cal-cell.st-missed { background: var(--low-soft); }
.cal-cell.is-today { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.cal-cell .dot { font-style: normal; font-size: .62rem; font-weight: 700; min-height: 1em; color: var(--muted); }
.dot.hi { color: var(--good); }
.dot.mid { color: var(--ok); }
.dot.lo { color: var(--low); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 14px; font-size: .76rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend .dot { width: 10px; height: 10px; border-radius: 4px; display: inline-grid; place-items: center; font-style: normal; font-size: .55rem; }
.legend .dot.hi { background: var(--gold-soft); border: 1.5px solid var(--gold); }
.legend .dot.mid { background: var(--good-soft); border: 1.5px solid var(--good); }
.legend .dot.lo { background: var(--ok-soft); border: 1.5px solid var(--ok); }
.legend .dot.missed { background: var(--low-soft); border: 1.5px solid var(--low); }
.legend .dot.strength { width: auto; height: auto; color: var(--muted); }
.week-list { display: grid; gap: 8px; }
.week-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; background: var(--bg); border-radius: 14px; text-decoration: none; color: var(--ink); }
.week-row:hover { background: var(--brand-soft); }
.week-row .muted { flex: 1; }
.week-row > .ico { width: 18px; height: 18px; color: var(--muted); }

/* week */
.day-dots { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.dd { border-radius: 12px; padding: 8px 2px; text-align: center; text-decoration: none; color: var(--ink); background: var(--bg); display: flex; flex-direction: column; line-height: 1.2; }
.dd small { font-size: .66rem; color: var(--muted); }
.dd b { font-size: 1rem; }
.dd.st-hero { background: var(--gold-soft); }
.dd.st-steady { background: var(--good-soft); }
.dd.st-recovery { background: var(--ok-soft); }
.dd.st-missed { background: var(--low-soft); }
.dd.st-today { outline: 2px solid var(--brand); }

/* ---------- progress ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .ref { stroke: var(--ok); stroke-dasharray: 5 5; stroke-width: 1.3; }
.chart .line { fill: none; stroke: var(--brand); stroke-width: 2.6; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot-pt { fill: var(--card); stroke: var(--brand); stroke-width: 2; }
.chart .g0 { stop-color: var(--brand); stop-opacity: .28; }
.chart .g1 { stop-color: var(--brand); stop-opacity: 0; }
.table-wrap { overflow-x: auto; margin-top: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: start; font-weight: 500; color: var(--muted); font-size: .78rem; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 9px 8px; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: 0; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.badge { background: var(--bg); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 3px; opacity: .55; }
.badge.on { opacity: 1; background: linear-gradient(160deg, var(--gold-soft), var(--bg)); }
.badge .medal { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--card); color: var(--muted); margin-bottom: 4px; }
.badge.on .medal { background: var(--gold); color: #fff; }
.badge b { font-size: .92rem; }
.badge small { font-size: .76rem; color: var(--muted); line-height: 1.4; }
.xp-s { font-size: .7rem; color: var(--muted); margin-top: 4px; }

/* ---------- tabs ---------- */
.tabs {
  position: fixed; bottom: 0; inset-inline: 0; z-index: 10; display: flex; justify-content: space-around; gap: 2px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-top: 1px solid var(--line);
}
.tabs a {
  flex: 1; max-width: 120px; display: flex; flex-direction: column; align-items: center; gap: 3px; text-decoration: none;
  color: var(--muted); font-size: .7rem; font-weight: 500; padding: 6px 4px; border-radius: 14px; transition: color .15s, background .15s;
}
.tabs a .ico { width: 23px; height: 23px; }
.tabs a[aria-current="page"] { color: var(--brand); background: var(--brand-soft); font-weight: 600; }
.tabs[hidden] { display: none; }
body[data-screen="setup"] { padding-bottom: 24px; }

/* ---------- responsive ---------- */
@media (max-width: 420px) {
  main { padding-inline: 12px; }
  .card { padding: 15px; }
  .hero { padding: 22px 18px; }
  .home-hero { gap: 14px; }
  .home-hero .ring { width: 96px !important; height: 96px !important; }
  .grid.three { grid-template-columns: 1fr 1fr; }
  .grid.three .field:first-child { grid-column: span 2; }
  .today-card .today-row { grid-template-columns: auto 1fr; }
  .today-card .today-row > div:last-child { grid-column: 2; }
  .cal-grid { gap: 4px; }
  .cal-cell { border-radius: 10px; }
  .cal-cell b { font-size: .88rem; }
  .summary .ring { width: 96px !important; height: 96px !important; }
}
@media (min-width: 720px) {
  body { font-size: 16px; }
  main { padding-top: 32px; }
  .metrics { grid-template-columns: repeat(3, 1fr); }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .cal-cell small { font-size: .66rem; }
  .cal-cell .dot { font-size: .72rem; }
  .tabs { left: 50%; right: auto; transform: translateX(-50%); bottom: 16px; width: min(560px, 92vw); border-radius: 22px; border: 1px solid var(--line); box-shadow: var(--shadow); padding: 8px; }
  body { padding-bottom: 110px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.cal-cell .dot.score { color: var(--ink); }
.week-row .range { white-space: nowrap; }
.week-row { flex-wrap: nowrap; }
.wk-info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.4; }
@media (min-width: 720px) { .cal-cell { aspect-ratio: 1.45 / 1; } }

/* start date chooser */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg-opt { cursor: pointer; }
.seg-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; }
.seg-opt span { display: flex; flex-direction: column; gap: 2px; height: 100%; padding: 12px 14px; border-radius: 14px; background: var(--bg); border: 1.5px solid transparent; transition: border-color .15s, background .15s; }
.seg-opt b { font-weight: 600; font-size: .92rem; }
.seg-opt small { font-size: .76rem; color: var(--muted); }
.seg-opt input:checked + span { border-color: var(--brand); background: var(--brand-soft); }
.seg-opt input:focus-visible + span { outline: 2.5px solid var(--brand-2); outline-offset: 2px; }
.start-sum { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; font-size: .86rem; color: var(--ink-2); background: var(--brand-soft); padding: 10px 12px; border-radius: 12px; }
.start-sum .ico { width: 18px; height: 18px; color: var(--brand); }
@media (max-width: 420px) { .seg { grid-template-columns: 1fr; } }

/* access code */
.code-input { font-family: ui-monospace, Consolas, monospace; font-size: 1.15rem; letter-spacing: .08em; text-align: center; text-transform: uppercase; }
.code-mask { font-family: ui-monospace, Consolas, monospace; letter-spacing: .05em; }
.sync-line { font-size: .85rem; color: var(--good); min-height: 1.3em; }
