:root {
  --bg: #0e1116; --surface: #171c24; --surface2: #1f2631; --line: #2b3441; --text: #f2f4f7; --muted: #9aa5b4;
  --good: #3ddc84; --good-ink: #06210f; --warn: #ffb547; --bad: #ff6b6b; --focus: #7cb7ff;
  --head: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --body: "Atkinson Hyperlegible", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f4f5f7; --surface: #ffffff; --surface2: #eceff3; --line: #d5dae2; --text: #121820; --muted: #5a6575; --good: #17a05a; --good-ink: #ffffff; --warn: #b36b00; --bad: #c92f2f; --focus: #1a64d0; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--body); font-size: 18px; line-height: 1.35; overflow-x: hidden; }
body { min-height: 100dvh; }
#app { max-width: 560px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 14px) max(16px, env(safe-area-inset-left)) calc(env(safe-area-inset-bottom) + 32px) max(16px, env(safe-area-inset-right)); }
h1, h2, h3, .head { font-family: var(--head); margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 28px; font-weight: 800; }
h2 { font-size: 20px; font-weight: 700; margin: 24px 0 10px; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; text-align: left; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
a { color: var(--focus); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; }
.top h1 { min-width: 0; }
.iconbtn { min-width: 48px; min-height: 48px; padding: 0 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); font-family: var(--head); font-weight: 700; font-size: 16px; display: inline-flex; align-items: center; justify-content: center; text-align: center; }
.coach { font-size: 20px; margin: 8px 0 16px; font-weight: 700; font-family: var(--head); line-height: 1.25; }
.coach small { display: block; font-family: var(--body); font-weight: 400; font-size: 16px; color: var(--muted); margin-top: 6px; }
.muted { color: var(--muted); }
.row { width: 100%; min-height: 64px; display: flex; align-items: center; gap: 14px; padding: 10px 16px; margin: 0 0 10px; border-radius: 18px; background: var(--surface); border: 2px solid var(--line); }
.row .box { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--muted); display: grid; place-items: center; font-size: 20px; font-weight: 800; color: transparent; }
.row .txt { flex: 1; min-width: 0; }
.row .name { font-family: var(--head); font-weight: 700; font-size: 20px; display: block; }
.row .sub { display: block; font-size: 15px; color: var(--muted); margin-top: 1px; }
.row.done { background: color-mix(in srgb, var(--good) 16%, var(--surface)); border-color: var(--good); }
.row.done .box { background: var(--good); border-color: var(--good); color: var(--good-ink); }
.row.done .sub { color: var(--text); }
.row.missed .box { border-color: var(--warn); color: var(--warn); }
.badge { flex: none; font-family: var(--head); font-weight: 700; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; padding: 4px 8px; border-radius: 999px; background: var(--good); color: var(--good-ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: -2px 0 12px; padding-left: 4px; }
.chip { min-height: 48px; padding: 0 16px; border-radius: 999px; border: 2px solid var(--line); background: var(--surface); font-weight: 700; display: inline-flex; align-items: center; }
.chip.on { border-color: var(--good); background: var(--good); color: var(--good-ink); }
.card { background: var(--surface); border: 2px solid var(--good); border-radius: 22px; padding: 18px 16px 16px; margin: 0 0 16px; }
.card h2 { margin: 0 0 12px; font-size: 22px; }
.card .q { font-family: var(--head); font-weight: 700; font-size: 18px; margin: 16px 0 8px; }
.card .q:first-of-type { margin-top: 0; }
.grid { display: grid; gap: 10px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.four { grid-template-columns: repeat(4, 1fr); }
.opt { min-height: 60px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface2); display: grid; place-items: center; text-align: center; font-family: var(--head); font-weight: 800; font-size: 22px; }
.opt.on { background: var(--good); border-color: var(--good); color: var(--good-ink); }
.primary { width: 100%; min-height: 64px; border-radius: 18px; background: var(--good); color: var(--good-ink); font-family: var(--head); font-weight: 800; font-size: 21px; text-align: center; display: grid; place-items: center; margin-top: 18px; }
.primary[disabled] { opacity: .45; cursor: default; }
.ghost { min-height: 56px; width: 100%; border-radius: 18px; border: 2px solid var(--line); background: var(--surface); font-family: var(--head); font-weight: 700; text-align: center; display: grid; place-items: center; margin-top: 10px; }
.linkbtn { min-height: 48px; padding: 0 4px; color: var(--focus); font-weight: 700; text-decoration: underline; }
.totals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 18px 0 8px; }
.tot { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 6px; text-align: center; }
.tot b { display: block; font-family: var(--head); font-size: 22px; }
.tot span { font-size: 13px; color: var(--muted); }
.tot.hit b { color: var(--good); }
.strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 10px; }
.day { min-height: 92px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 6px 0; text-align: center; }
.day[disabled] { opacity: .35; cursor: default; }
.day .dl { font-size: 12px; color: var(--muted); font-family: var(--head); font-weight: 700; }
.day .dn { font-family: var(--head); font-weight: 800; font-size: 17px; }
.day.today .dn { color: var(--good); }
.day.sel { border-color: var(--focus); background: var(--surface2); }
.dots { display: grid; grid-template-columns: 1fr; gap: 3px; justify-items: center; }
.dot { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--muted); }
.dot.on { background: var(--good); border-color: var(--good); }
.legend { font-size: 14px; color: var(--muted); margin: 8px 0 0; text-align: center; }
.menu-back { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 20; }
.menu { position: fixed; top: calc(env(safe-area-inset-top) + 8px); right: max(12px, env(safe-area-inset-right)); left: 12px; max-width: 360px; margin-left: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 8px; z-index: 21; box-shadow: 0 12px 40px rgba(0,0,0,.4); }
.menu button, .menu a { display: flex; align-items: center; min-height: 56px; padding: 0 16px; border-radius: 14px; font-family: var(--head); font-weight: 700; font-size: 19px; color: var(--text); text-decoration: none; width: 100%; }
.menu button:active, .menu a:active { background: var(--surface2); }
.back { min-height: 48px; display: inline-flex; align-items: center; font-family: var(--head); font-weight: 700; color: var(--focus); padding: 0 4px 0 0; margin-bottom: 4px; }
.goal { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 16px; margin-bottom: 10px; border-radius: 18px; background: var(--surface); border: 2px solid var(--line); }
.goal.hit { border-color: var(--good); }
.goal .g { flex: 1; min-width: 0; }
.goal .gn { font-family: var(--head); font-weight: 700; font-size: 19px; display: block; }
.goal .gs { font-size: 15px; color: var(--muted); }
.goal .res { font-family: var(--head); font-weight: 800; font-size: 15px; }
.goal.hit .res { color: var(--good); }
.goal:not(.hit) .res { color: var(--warn); }
.goal.open .res { color: var(--muted, inherit); }
textarea.field, input.field { width: 100%; min-height: 60px; padding: 14px 16px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); font-size: 18px; }
textarea.field { min-height: 96px; resize: none; }
.past { padding: 12px 0; border-bottom: 1px solid var(--line); }
.past b { font-family: var(--head); }
.stepper { display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 8px 8px 8px 16px; margin-bottom: 10px; border-radius: 18px; background: var(--surface); border: 2px solid var(--line); }
.stepper .lbl { flex: 1; font-family: var(--head); font-weight: 700; font-size: 18px; line-height: 1.2; }
.stepper .lbl small { display: block; font-family: var(--body); font-weight: 400; font-size: 14px; color: var(--muted); }
.stepper .val { width: 36px; text-align: center; font-family: var(--head); font-weight: 800; font-size: 24px; }
.stepper button.step { width: 48px; height: 48px; border-radius: 14px; background: var(--surface2); border: 1px solid var(--line); font-size: 26px; font-weight: 700; text-align: center; display: grid; place-items: center; }
.stepper input[type=time] { min-height: 48px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface2); padding: 0 10px; font-size: 18px; }
.note { font-size: 16px; color: var(--muted); margin: 6px 0 12px; }
.keybox { word-break: break-all; font-size: 14px; user-select: all; }
#toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 20px); transform: translate(-50%, 20px); max-width: calc(100vw - 32px); background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 700; opacity: 0; pointer-events: none; transition: .2s; z-index: 30; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.center { text-align: center; padding-top: 12vh; }
.center h1 { font-size: 34px; margin-bottom: 10px; }
.err { color: var(--bad); font-weight: 700; margin: 10px 0 0; }
.weeknav { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; font-size: 15px; }
.weeknav .linkbtn { min-width: 84px; text-decoration: none; text-align: left; }
.weeknav .linkbtn:last-child { text-align: right; }
.chips { flex-wrap: nowrap; gap: 6px; padding-left: 0; }
.chip { flex: 1 1 0; min-width: 0; padding: 0 4px; justify-content: center; font-size: 15px; }
