:root {
  --bg: #101418; --card: #1a2027; --line: #2a323c; --text: #e8edf2; --muted: #93a1b0;
  --accent: #4dabf7; --accent-ink: #0b1a26; --ok: #51cf66; --warn: #ff8787; --alt: #b197fc;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
main { max-width: 640px; margin: 0 auto; padding: 12px 16px calc(32px + env(safe-area-inset-bottom)); }
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 1.35rem; margin: 8px 0 4px; }
h2 { font-size: 1.05rem; margin: 0; }
code { background: var(--line); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.label { display: block; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 4px; }
.card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin: 12px 0; color: var(--text); }
.card p { margin: 4px 0; }
.coach { border-left: 4px solid var(--accent); }
.empty { text-align: center; }

.tabs { position: sticky; top: 0; z-index: 5; display: flex; justify-content: center; gap: 4px; padding: calc(8px + env(safe-area-inset-top)) 8px 8px; background: rgba(16, 20, 24, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.tabs a { flex: 1; max-width: 200px; text-align: center; padding: 8px; border-radius: 10px; color: var(--muted); font-weight: 600; }
.tabs a.on { background: var(--card); color: var(--text); }

.weekhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.weekhead h1 { text-align: center; }
.arrow { font-size: 2rem; line-height: 1; padding: 4px 14px; }
.next { border-color: var(--accent); }
.next strong { display: block; font-size: 1.1rem; }
.sessions, .list { list-style: none; margin: 0; padding: 0; }
.session { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; }
.session .day { grid-column: 1 / -1; font-size: .8rem; color: var(--muted); }
.session .day::first-letter, .muted::first-letter { text-transform: uppercase; }
.session strong { grid-column: 1; }
.session .muted { grid-column: 1; font-size: .9rem; }
.session .status { grid-column: 2; grid-row: 2 / 4; align-self: center; font-size: .85rem; color: var(--muted); }
.session.done { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.session.done .status { color: var(--ok); }
.session.today { box-shadow: 0 0 0 2px var(--accent) inset; }
.row { display: flex; flex-direction: column; }
.back { display: inline-block; margin-top: 4px; }
.foot { text-align: center; margin-top: 28px; font-size: .9rem; }

label { display: block; margin: 10px 0 0; font-size: .9rem; color: var(--muted); }
input, select, textarea { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
button { font: inherit; font-weight: 600; padding: 10px 16px; border-radius: 10px; border: 0; background: var(--accent); color: var(--accent-ink); cursor: pointer; }
form button[type=submit] { width: 100%; margin-top: 14px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.error { color: var(--warn); }
.login { max-width: 360px; margin: 18vh auto 0; text-align: center; }
.login label { text-align: left; }

.exhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.swap { padding: 6px 12px; background: var(--line); color: var(--text); font-size: 1.1rem; }
.swap[aria-pressed=true] { background: var(--alt); color: #1b1230; }
.target { font-weight: 600; margin: 6px 0 2px; }
.note { color: var(--muted); font-size: .9rem; }
.last { font-size: .85rem; color: var(--muted); }
.ex .alt-only { display: none; }
.ex.variant .alt-only { display: inline; }
.ex.variant p.alt-only { display: block; }
.ex.variant .main-only { display: none; }
.ex.variant { border-color: color-mix(in srgb, var(--alt) 50%, var(--line)); }
.sets { width: 100%; border-collapse: collapse; margin-top: 8px; }
.sets th { font-size: .75rem; font-weight: 600; color: var(--muted); text-align: left; padding: 0 4px 4px; }
.sets td { padding: 3px 4px; }
.sets td:first-child { width: 28px; color: var(--muted); text-align: center; }
.sets input { margin: 0; padding: 10px 8px; text-align: center; font-size: 1.05rem; }
.sets tr.saved input { border-color: color-mix(in srgb, var(--ok) 60%, var(--line)); }
.sets tr.saved td:first-child { color: var(--ok); font-weight: 700; }
.addset { margin-top: 8px; background: transparent; color: var(--accent); padding: 6px 0; }
.feeling { display: flex; gap: 8px; margin-top: 4px; }
.feeling button { flex: 1; background: var(--bg); color: var(--text); border: 1px solid var(--line); }
.feeling button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.saved-state { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%); margin: 0; padding: 6px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-size: .9rem; opacity: 0; transition: opacity .2s; pointer-events: none; }
.saved-state.show { opacity: 1; }
.saved-state.err { color: var(--warn); border-color: var(--warn); opacity: 1; }

.history { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: .92rem; }
.history th { text-align: left; font-size: .75rem; color: var(--muted); font-weight: 600; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.history td { padding: 8px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.chart { width: 100%; height: auto; color: var(--accent); }

.targets { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 10px; text-align: center; }
.targets strong { display: block; font-size: 1.3rem; }
.targets span { font-size: .8rem; color: var(--muted); }
.meal ul { margin: 6px 0 0; padding-left: 20px; }
.meal li { margin: 4px 0; }
.meal li::marker { color: var(--muted); }
