/* Layout and components. Colours, fonts and sizes come from /ui/theme.css: change them there. */
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: var(--fs-base); -webkit-text-size-adjust: 100%; font-feature-settings: "calt" 0; }  /* calt off: Inter turns "2 x 10" into a times sign */
body { min-height: 100dvh; padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
body.no-tabs { padding-bottom: 0; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
.ic { display: block; flex: none; }

.top { display: flex; align-items: center; gap: 10px; padding: 14px 18px; padding-top: max(14px, env(safe-area-inset-top)); border-bottom: 1px solid var(--line); position: sticky; top: 0; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); z-index: 5; }
.top .logo { width: 28px; height: 28px; border-radius: 6px; }
.top .brand { font-family: var(--font-head); letter-spacing: .04em; font-size: 20px; }

main { max-width: 640px; margin: 0 auto; padding: 18px; }
h1, h2 { font-family: var(--font-head); font-weight: 400; letter-spacing: .02em; text-transform: var(--head-case); margin: 6px 0 14px; }
h1 { font-size: var(--fs-h1); } h2 { font-size: var(--fs-h2); }
.muted { color: var(--text-muted); }
.small { font-size: var(--fs-small); }
.err { color: var(--danger); }

/* tabs */
.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--tab-bg); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); z-index: 5; }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 0 12px; text-decoration: none; color: var(--tab-text); font-weight: 600; font-size: 12px; }
.tabs a .ic { width: calc(22px * var(--tab-icons)); height: calc(22px * var(--tab-icons)); }
.tabs a.on { color: var(--tab-on); box-shadow: inset 0 2px 0 var(--tab-on-mark); }

/* buttons, fields, chips */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 52px; padding: 14px 18px; border-radius: var(--radius-btn); border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 16px; cursor: pointer; text-align: center; text-decoration: none; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line-strong); }
.btn.big { min-height: 60px; font-size: 18px; }
.btn:disabled { opacity: .5; }
.field { display: block; width: 100%; padding: 14px; border-radius: var(--radius-btn); border: 1px solid var(--line-strong); background: var(--surface); margin: 8px 0 14px; }
.field:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.stack > * + * { margin-top: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 14px; }
.chip { min-width: var(--tap); height: var(--tap); padding: 0 12px; border-radius: var(--radius-pill); border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-weight: 600; }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 20px; font-weight: 600; font-size: 14px; z-index: 50; }

/* week / cards */
.weeknav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.weeknav button { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; width: var(--tap); height: var(--tap); display: grid; place-items: center; cursor: pointer; }
.day { border-top: 1px solid var(--line); padding: 12px 0; }
.day.today .dlabel { color: var(--accent); }
.dlabel { font-size: var(--fs-small); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: 6px; }
.card { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-decoration: none; margin-top: 8px; }
.card .bar { width: 5px; align-self: stretch; border-radius: 3px; background: var(--text-muted); }
.card.strength .bar { background: var(--kind-strength); }
.card.endurance .bar { background: var(--kind-endurance); }
.card.sprint .bar { background: var(--kind-sprint); }
.card.hyrox .bar { background: var(--kind-hyrox); }
.card.test .bar { background: var(--kind-test); }
.card .t { font-weight: 700; }
.card .s { color: var(--text-muted); font-size: var(--fs-small); margin-top: 2px; }
.card .chk { margin-left: auto; font-size: var(--fs-small); color: var(--text-muted); white-space: nowrap; }
.card.done .chk { color: var(--ok); }
.note { color: var(--text-muted); font-size: var(--fs-small); margin: 18px 0 0; }

/* session overview */
.objective { background: var(--surface); border-left: 3px solid var(--accent); border-radius: 8px; padding: 12px 14px; margin: 12px 0; }
.desc { white-space: pre-wrap; line-height: 1.5; }
.block { margin-top: 22px; }
.block h2 { margin-bottom: 4px; }
.bnotes { color: var(--text-muted); font-size: 14px; white-space: pre-wrap; margin-bottom: 8px; }
.exrow { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-top: 8px; }
.exrow .name { font-weight: 700; }
.exrow .rx { color: var(--text-muted); font-size: 14px; margin-top: 2px; }
.exrow .prog { margin-left: auto; font-size: var(--fs-small); color: var(--text-muted); white-space: nowrap; }
.exrow.full .prog { color: var(--ok); }
.startbar { position: sticky; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); margin-top: 18px; z-index: 4; }

/* ── strength player ─────────────────────────────────────────────────────── */
.player { position: fixed; inset: 0; background: var(--bg); z-index: 20; display: flex; flex-direction: column; }
.p-top { display: flex; align-items: center; gap: 10px; padding: 12px 14px; padding-top: max(12px, env(safe-area-inset-top)); border-bottom: 1px solid var(--line); }
.p-top .iconbtn { width: var(--tap); height: var(--tap); border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; }
.p-top .ttl { flex: 1; min-width: 0; }
.p-top .ttl .a { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-top .ttl .b { color: var(--text-muted); font-size: var(--fs-small); }
.p-top .clock { font-variant-numeric: tabular-nums; font-weight: 700; display: flex; align-items: center; gap: 6px; color: var(--text-muted); }
.p-progress { display: flex; gap: 4px; padding: 10px 14px 0; }
.p-progress span { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.p-progress span.done { background: var(--ok); }
.p-progress span.cur { background: var(--accent); }
.p-body { flex: 1; overflow-y: auto; padding: 16px 18px 24px; max-width: 640px; width: 100%; margin: 0 auto; }
.p-block { color: var(--accent); font-size: var(--fs-small); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.p-name { font-family: var(--font-head); font-size: 32px; line-height: 1.05; text-transform: var(--head-case); margin: 6px 0 8px; }
.p-rx { color: var(--text-muted); }
.p-last { display: inline-block; margin-top: 8px; font-size: var(--fs-small); color: var(--text-muted); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 4px 10px; }
.p-notes { color: var(--text-muted); font-size: 14px; white-space: pre-wrap; margin-top: 10px; line-height: 1.45; }
.p-sets { margin-top: 18px; }
.p-head, .p-set { display: grid; grid-template-columns: 40px 1fr 1fr 1fr 56px; gap: 8px; align-items: center; }
.p-head { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 0 0 6px; }
.p-set { padding: 8px 0; border-top: 1px solid var(--line); }
.p-set .n { font-weight: 700; color: var(--text-muted); text-align: center; }
.p-set .target { font-size: 14px; color: var(--text-muted); }
.p-set input { width: 100%; height: 48px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface-2); text-align: center; font-size: 18px; font-weight: 700; }
.p-set .tick { width: 52px; height: 52px; border-radius: 50%; border: 2px solid var(--line-strong); background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--text-muted); }
.p-set.on .tick { background: var(--ok); border-color: var(--ok); color: #000; }
.p-set.on input { border-color: transparent; background: var(--surface); }
.p-alldone { margin-top: 14px; }
.p-foot { display: flex; gap: 10px; padding: 12px 14px; padding-bottom: max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--bg); }
.p-foot .btn { flex: 1; }
.p-foot .btn.ghost { flex: 0 0 auto; width: 64px; }

.rest { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line-strong); border-radius: 20px 20px 0 0; padding: 18px 18px max(18px, env(safe-area-inset-bottom)); box-shadow: 0 -10px 40px rgba(0,0,0,.5); text-align: center; }
.rest .lbl { color: var(--text-muted); font-size: var(--fs-small); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.rest .big { font-family: var(--font-head); font-size: 64px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.rest.over .big { color: var(--ok); }
.rest .row { display: flex; gap: 10px; margin-top: 10px; }
.rest .row .btn { flex: 1; min-height: 48px; }
.rest .barwrap { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin: 8px 0 4px; }
.rest .barwrap span { display: block; height: 100%; background: var(--accent); transition: width 1s linear; }

.sheet { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; }
.sheet > div { width: 100%; max-height: 80dvh; overflow-y: auto; background: var(--surface); border-radius: 20px 20px 0 0; padding: 18px; padding-bottom: max(18px, env(safe-area-inset-bottom)); }
.sheet .item { display: flex; justify-content: space-between; align-items: center; padding: 12px 4px; border-top: 1px solid var(--line); cursor: pointer; }
.sheet .item.cur { color: var(--accent); }

/* design page */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.swatch { border-radius: 10px; border: 1px solid var(--line); overflow: hidden; font-size: 11px; }
.swatch div { height: 44px; }
.swatch span { display: block; padding: 4px 6px; color: var(--text-muted); }

/* feedback after a session */
.fb { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: var(--radius); padding: 14px 16px; margin: 14px 0; }
.fb.note { border-left-color: var(--warn); }
.fb.warn { border-left-color: var(--danger); }
.fb-h { font-weight: 700; margin-bottom: 6px; }
.fb ul { margin: 0; padding-left: 18px; line-height: 1.5; }
.fb li + li { margin-top: 4px; }
.fb-coach { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
