:root {
  color-scheme: light dark;
  --page-bg: radial-gradient(circle at top, #eef2ff 0, #f8fafc 55%, #f8fafc 100%);
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-border: #cbd5e1;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --shadow-soft: 0 10px 30px rgb(15 23 42 / 0.12);
  --text: #0f172a;
  --muted: #475569;
  --accent: #4f46e5;
  --accent-text: #ffffff;
  --link: #4338ca;
  --field-bg: #ffffff;
  --bar-bg: rgb(248 250 252 / 0.92);
  --notice-bg: #fef3c7;
  --notice-text: #78350f;
  --error-bg: #fee2e2;
  --error-text: #7f1d1d;
  --ok-bg: #dcfce7;
  --ok-text: #14532d;
  --radius: 20px;
  /* v0.2 viewer colours: superset accents, Options (cyan) and TRX (fuchsia) */
  --ss1: #16a34a; --ss2: #6366f1; --ss3: #d97706;
  --opt-text: #0e7490; --opt-border: #67e8f9; --opt-bg: #ecfeff; --opt-active-bg: #cffafe; --opt-active-border: #0891b2; --opt-badge-bg: rgb(8 145 178 / 0.15);
  --trx-text: #a21caf; --trx-border: #f0abfc; --trx-bg: #fdf4ff; --trx-active-bg: #fae8ff; --trx-active-border: #c026d3; --trx-badge-bg: rgb(192 38 211 / 0.12);
  --tag-bg: #f1f5f9; --tag-border: #cbd5e1; --panel-bg: #f8fafc; --item-border: #e2e8f0; --thumb-bg: #eef2ff;
  --alt-use-bg: #e0e7ff; --alt-use-border: #6366f1;
  --done-border: #16a34a; --done-shadow: 0 0 0 1px rgb(22 163 74 / 0.35), 0 10px 25px rgb(22 163 74 / 0.15);
  --done-flag-bg: #dcfce7; --done-flag-border: #86efac; --done-flag-text: #166534;
  --startline: #4338ca; --pairing: #047857; --swap: #b45309;
  --header-bg: linear-gradient(135deg, #e0e7ff, #dbeafe); --header-border: #c7d2fe; --header-shadow: 0 8px 22px rgb(100 116 139 / 0.22);
  --accent-soft: rgb(79 70 229 / 0.12);
}

:root[data-theme="light"] { color-scheme: light; }

:root[data-theme="dark"] {
  color-scheme: dark;
    --page-bg: radial-gradient(circle at top, #111827 0, #020617 40%, #000 100%);
    --bg: #050816;
    --surface: rgb(15 23 42 / 0.9);
    --surface-border: rgb(148 163 184 / 0.4);
    --card-bg: radial-gradient(circle at top left, #111827 0, #020617 40%, #020617 100%);
    --border: #1f2937;
    --shadow-soft: 0 14px 40px rgb(0 0 0 / 0.6);
    --text: #f9fafb;
    --muted: #9ca3af;
    --accent: #818cf8;
    --accent-text: #0b1020;
    --link: #c7d2fe;
    --field-bg: #0b1226;
    --bar-bg: rgb(2 6 23 / 0.92);
    --notice-bg: #422006;
    --notice-text: #fde68a;
    --error-bg: #450a0a;
    --error-text: #fecaca;
    --ok-bg: #052e16;
    --ok-text: #bbf7d0;
    --ss1: #22c55e; --ss2: #818cf8; --ss3: #fbbf24;
    --opt-text: #67e8f9; --opt-border: rgb(34 211 238 / 0.5); --opt-bg: rgb(34 211 238 / 0.1); --opt-active-bg: rgb(34 211 238 / 0.25); --opt-active-border: #22d3ee; --opt-badge-bg: rgb(34 211 238 / 0.2);
    --trx-text: #f0abfc; --trx-border: rgb(232 121 249 / 0.5); --trx-bg: rgb(232 121 249 / 0.1); --trx-active-bg: rgb(232 121 249 / 0.25); --trx-active-border: #e879f9; --trx-badge-bg: rgb(232 121 249 / 0.2);
    --tag-bg: rgb(15 23 42 / 0.9); --tag-border: rgb(55 65 81 / 0.9); --panel-bg: rgb(2 6 23 / 0.7); --item-border: rgb(31 41 55 / 0.8); --thumb-bg: #0b1020;
    --alt-use-bg: rgb(79 70 229 / 0.18); --alt-use-border: rgb(129 140 248 / 0.7);
    --done-border: rgb(34 197 94 / 0.9); --done-shadow: 0 0 0 1px rgb(34 197 94 / 0.45), 0 16px 40px rgb(22 163 74 / 0.4);
    --done-flag-bg: rgb(22 163 74 / 0.18); --done-flag-border: rgb(22 163 74 / 0.65); --done-flag-text: #bbf7d0;
    --startline: #c7d2fe; --pairing: #6ee7b7; --swap: #fcd34d;
    --header-bg: linear-gradient(135deg, #0f172a, #1e3a8a); --header-border: rgb(148 163 184 / 0.3); --header-shadow: 0 8px 24px rgb(15 23 42 / 0.9);
    --accent-soft: rgb(79 70 229 / 0.3);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page-bg: radial-gradient(circle at top, #111827 0, #020617 40%, #000 100%);
    --bg: #050816;
    --surface: rgb(15 23 42 / 0.9);
    --surface-border: rgb(148 163 184 / 0.4);
    --card-bg: radial-gradient(circle at top left, #111827 0, #020617 40%, #020617 100%);
    --border: #1f2937;
    --shadow-soft: 0 14px 40px rgb(0 0 0 / 0.6);
    --text: #f9fafb;
    --muted: #9ca3af;
    --accent: #818cf8;
    --accent-text: #0b1020;
    --link: #c7d2fe;
    --field-bg: #0b1226;
    --bar-bg: rgb(2 6 23 / 0.92);
    --notice-bg: #422006;
    --notice-text: #fde68a;
    --error-bg: #450a0a;
    --error-text: #fecaca;
    --ok-bg: #052e16;
    --ok-text: #bbf7d0;
    --ss1: #22c55e; --ss2: #818cf8; --ss3: #fbbf24;
    --opt-text: #67e8f9; --opt-border: rgb(34 211 238 / 0.5); --opt-bg: rgb(34 211 238 / 0.1); --opt-active-bg: rgb(34 211 238 / 0.25); --opt-active-border: #22d3ee; --opt-badge-bg: rgb(34 211 238 / 0.2);
    --trx-text: #f0abfc; --trx-border: rgb(232 121 249 / 0.5); --trx-bg: rgb(232 121 249 / 0.1); --trx-active-bg: rgb(232 121 249 / 0.25); --trx-active-border: #e879f9; --trx-badge-bg: rgb(232 121 249 / 0.2);
    --tag-bg: rgb(15 23 42 / 0.9); --tag-border: rgb(55 65 81 / 0.9); --panel-bg: rgb(2 6 23 / 0.7); --item-border: rgb(31 41 55 / 0.8); --thumb-bg: #0b1020;
    --alt-use-bg: rgb(79 70 229 / 0.18); --alt-use-border: rgb(129 140 248 / 0.7);
    --done-border: rgb(34 197 94 / 0.9); --done-shadow: 0 0 0 1px rgb(34 197 94 / 0.45), 0 16px 40px rgb(22 163 74 / 0.4);
    --done-flag-bg: rgb(22 163 74 / 0.18); --done-flag-border: rgb(22 163 74 / 0.65); --done-flag-text: #bbf7d0;
    --startline: #c7d2fe; --pairing: #6ee7b7; --swap: #fcd34d;
    --header-bg: linear-gradient(135deg, #0f172a, #1e3a8a); --header-border: rgb(148 163 184 / 0.3); --header-shadow: 0 8px 24px rgb(15 23 42 / 0.9);
    --accent-soft: rgb(79 70 229 / 0.3);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--text);
  min-height: 100vh;
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 12px max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
h3 { font-size: 1rem; margin: 20px 0 8px; }

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

[hidden] { display: none !important; }

label { display: block; font-weight: 600; margin: 12px 0 6px; }

input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  font: inherit; /* 16px keeps iOS from zooming on focus */
  color: var(--text);
  background: var(--field-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.btn {
  min-height: 44px;
  min-width: 44px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}
.btn.primary { color: var(--accent-text); background: var(--accent); border-color: var(--accent); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--muted); }
.btn:disabled { opacity: 0.55; cursor: default; }
#signin-button { width: 100%; margin-top: 16px; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.notice {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--notice-bg);
  color: var(--notice-text);
}
.notice.error { background: var(--error-bg); color: var(--error-text); }
.notice.ok { background: var(--ok-bg); color: var(--ok-text); }

.stats { margin: 16px 0 0; display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; }
.stats dt { color: var(--muted); }
.stats dd { margin: 0; overflow-wrap: anywhere; }
.stats dd[data-kind="error"] { color: var(--error-text); font-weight: 600; }
.stats dd[data-kind="ok"] { color: var(--ok-text); }

.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9rem; }

.events { list-style: none; margin: 0; padding: 0; }
.events li { padding: 10px 0; border-top: 1px solid var(--border); overflow-wrap: anywhere; }
.events li:first-child { border-top: 0; }
.events .kind { font-weight: 600; }
.events .meta { color: var(--muted); font-size: 0.85rem; }

/* ---- Phase D: home, session, summary, recovery ---- */

:root {
  --up-bg: #fef3c7;
  --up-text: #92400e;
  --up-border: #d97706;
  --warn-text: #92400e;
}
:root[data-theme="dark"] {
  color-scheme: dark;
    --up-bg: #422006;
    --up-text: #fcd34d;
    --up-border: #f59e0b;
    --warn-text: #fcd34d;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --up-bg: #422006;
    --up-text: #fcd34d;
    --up-border: #f59e0b;
    --warn-text: #fcd34d;
  }
}


a { color: var(--accent); }
.back { display: inline-block; min-height: 44px; line-height: 44px; margin-bottom: 4px; text-decoration: none; }
.screen-title { margin: 0 0 12px; }
.small { font-size: 0.85rem; }
.grow { flex: 1; }
.block { display: block; width: 100%; text-align: center; text-decoration: none; }
a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
a.btn.block { display: flex; }
.plain { list-style: none; margin: 0; padding: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.card.lead { border-color: var(--accent); border-width: 2px; }
.card .notice { margin: 12px 0; }
.up { color: var(--up-text); font-weight: 700; margin: 2px 0; }
.up-badge { display: inline-block; min-width: 1.5em; text-align: center; color: var(--up-text); background: var(--up-bg); border: 1px solid var(--up-border); border-radius: 6px; font-weight: 700; }


/* session: the v0.2 viewer's carousel and cards (spec 0.B.1) */
.phase-line { margin: 2px 0 12px; }
.track {
  display: flex; gap: 10px; align-items: flex-start; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  margin: 0 -16px; padding: 0 16px 24px; scroll-padding: 0 16px; touch-action: pan-x pan-y;
}
.track::-webkit-scrollbar { display: none; }
.ex {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-soft);
  padding: 14px 14px 12px; position: relative; display: flex; flex-direction: column; gap: 6px;
}
.slide { flex: 0 0 calc(100% - 28px); scroll-snap-align: center; scroll-snap-stop: always; min-width: 0; }
/* superset colour on the card's left edge */
.ex.ss1 { border-left: 4px solid var(--ss1); }
.ex.ss2 { border-left: 4px solid var(--ss2); }
.ex.ss3 { border-left: 4px solid var(--ss3); }
.ex.increased { border-color: var(--up-border); }
.ex.increased.ss1 { border-left-color: var(--ss1); } .ex.increased.ss2 { border-left-color: var(--ss2); } .ex.increased.ss3 { border-left-color: var(--ss3); }
.ex.done { border-color: var(--done-border); box-shadow: var(--done-shadow); }
.done-flag {
  position: absolute; top: 10px; right: 12px; padding: 3px 8px; border-radius: 999px; font-size: 0.7rem; display: inline-flex;
  align-items: center; gap: 5px; background: var(--done-flag-bg); border: 1px solid var(--done-flag-border); color: var(--done-flag-text);
}
.done-flag span { width: 8px; height: 8px; border-radius: 999px; background: var(--ok-text); }
.ex-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding-right: 0; }
.ex.done .ex-header { padding-right: 64px; }
.ex-title { margin: 0; font-size: 1.05rem; font-weight: 700; }
.ex.increased .ex-title { color: var(--up-text); }
.phase-chip {
  display: inline-flex; margin-top: 4px; padding: 3px 9px; border-radius: 999px; font-size: 0.75rem; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--surface-border); color: var(--text);
}
.ex.ss1 .phase-chip { border-color: var(--ss1); } .ex.ss2 .phase-chip { border-color: var(--ss2); } .ex.ss3 .phase-chip { border-color: var(--ss3); }
.ex-meta { text-align: right; font-size: 0.75rem; color: var(--muted); }
.ex-meta strong { display: block; font-size: 0.9rem; color: var(--text); }
.ex p { margin: 2px 0; }
.ex .suggest { font-weight: 600; }
.form-section { margin-top: 8px; border-top: 1px solid var(--item-border); padding-top: 10px; }
.gif-wrapper { position: relative; aspect-ratio: 16 / 10; border-radius: 16px; overflow: hidden; background: var(--thumb-bg); border: 1px solid var(--tag-border); display: flex; align-items: center; justify-content: center; }
.gif-wrapper img { width: 100%; height: auto; max-height: 100%; object-fit: contain; display: block; }
.gif-label {
  position: absolute; bottom: 8px; left: 10px; padding: 3px 8px; border-radius: 999px; font-size: 0.7rem; color: #e5e7eb;
  background: rgb(15 23 42 / 0.82); border: 1px solid rgb(148 163 184 / 0.4); display: inline-flex; align-items: center; gap: 6px;
}
.gif-label span { width: 6px; height: 6px; border-radius: 999px; background: #22c55e; box-shadow: 0 0 0 5px rgb(34 197 94 / 0.25); }
.gif-attribution { font-size: 0.72rem; color: var(--muted); margin-top: 6px; }
.exercise-body { font-size: 0.85rem; margin-top: 8px; line-height: 1.5; }
.pairing-tip { margin-top: 6px; color: var(--pairing); }
.start-line { margin-top: 6px; color: var(--startline); }
.ladder { margin-top: 6px; }
.ladder summary { cursor: pointer; min-height: 32px; }
.ladder ul { margin: 6px 0 0; padding-left: 18px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag { color: var(--text); font-size: 0.72rem; padding: 3px 8px; border-radius: 999px; background: var(--tag-bg); border: 1px solid var(--tag-border); }
.swap-note { font-size: 0.8rem; color: var(--swap); margin-top: 8px; }
.revert-btn { background: none; border: 0; padding: 0 4px; min-height: 32px; color: var(--link); text-decoration: underline; font: inherit; cursor: pointer; }
.alt-row { display: flex; gap: 8px; margin-top: 8px; }
.alt-toggle {
  min-height: 44px; padding: 6px 14px; border-radius: 999px; font: inherit; font-size: 0.85rem; cursor: pointer; display: inline-flex;
  align-items: center; gap: 6px;
}
.alt-toggle:disabled { opacity: 0.45; cursor: default; }
.alt-toggle.opt { color: var(--opt-text); border: 1px solid var(--opt-border); background: var(--opt-bg); }
.alt-toggle.opt[aria-expanded="true"] { border-color: var(--opt-active-border); background: var(--opt-active-bg); }
.alt-toggle.trx { color: var(--trx-text); border: 1px solid var(--trx-border); background: var(--trx-bg); }
.alt-toggle.trx[aria-expanded="true"] { border-color: var(--trx-active-border); background: var(--trx-active-bg); }
.alt-badge { font-size: 0.7rem; padding: 1px 6px; border-radius: 999px; background: var(--opt-badge-bg); }
.alt-toggle.trx .alt-badge { background: var(--trx-badge-bg); }
.alt-panel { margin-top: 8px; border: 1px solid var(--border); border-radius: 14px; background: var(--panel-bg); overflow: hidden; }
.alt-panel[data-group="alternatives"] { border-top: 2px solid var(--opt-active-border); }
.alt-panel[data-group="trxAlternatives"] { border-top: 2px solid var(--trx-active-border); }
.alt-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-top: 1px solid var(--item-border); }
.alt-item:first-child { border-top: 0; }
.alt-thumb { width: 56px; height: 42px; flex: none; border-radius: 8px; overflow: hidden; background: var(--thumb-bg); border: 1px solid var(--tag-border); }
.alt-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.alt-name { flex: 1; min-width: 0; font-size: 0.9rem; }
.alt-use {
  min-height: 44px; padding: 6px 12px; border-radius: 10px; font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer;
  color: var(--text); background: var(--alt-use-bg); border: 1px solid var(--alt-use-border);
}
.alt-use:disabled { opacity: 0.6; cursor: default; }
.finish-card { border-left: 4px solid var(--border); }
.finish-card h3 { margin: 0; }

  flex: none; min-height: 44px; padding: 0 8px; font: inherit; color: var(--text); background: var(--field-bg);
  border: 1px solid var(--border); border-radius: 10px;
}

.finish-actions { margin-top: 12px; }
textarea {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--text); background: var(--field-bg);
  border: 1px solid var(--border); border-radius: 10px; resize: vertical;
}

.rest-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; align-items: center; gap: 8px;
  padding: 10px max(16px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: var(--surface); border-top: 2px solid var(--accent); box-shadow: 0 -4px 12px rgb(0 0 0 / 0.15);
}
.rest-bar[data-over="true"] { border-top-color: var(--up-border); background: var(--up-bg); color: var(--up-text); }
.rest-bar .rest-time { flex: 1; font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* summary and recovery */
.summary-stats { margin: 0 0 16px; }
.callouts { border-color: var(--up-border); }
.callouts li { padding: 6px 0; }
.notes-text { white-space: pre-wrap; margin: 0; }
.recovery-card h3 { margin-top: 0; display: flex; align-items: center; gap: 10px; }
.recovery-card .step { display: inline-flex; align-items: center; justify-content: center; width: 1.8em; height: 1.8em; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-size: 0.9rem; }
.recovery-card .prescription { font-weight: 700; margin: 4px 0; }
.recovery-card .cue { margin: 4px 0; }

.device summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 600; }
.card > h3:first-child { margin-top: 0; }
.finish-actions .btn { white-space: nowrap; }

.demo { display: block; width: 100%; height: auto; border-radius: 12px; margin: 8px 0; background: var(--thumb-bg); }

/* ---- header (v0.2 viewer, spec 0.B.1): one slim line, opening to the day pills ---- */
.brand { margin: 0 0 4px; font-size: 1.5rem; }
.app-header {
  position: sticky; top: 0; z-index: 20; background: var(--header-bg); border-bottom: 1px solid var(--header-border);
  box-shadow: var(--header-shadow); border-radius: 0 0 16px 16px; padding-top: env(safe-area-inset-top);
  padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right));
}
.hdr-bar { display: flex; align-items: center; gap: 2px; min-height: 44px; max-width: 640px; margin: 0 auto; }
.hdr-status {
  flex: 1; min-width: 0; min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 8px; font: inherit; font-size: 0.95rem;
  font-weight: 600; color: var(--text); background: none; border: 0; text-align: left; cursor: pointer;
}
.hdr-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { flex: none; font-size: 0.7rem; color: var(--muted); transition: transform 0.15s; }
.app-header.open .chev { transform: rotate(180deg); }
.save-chip { flex: none; display: inline-flex; align-items: center; gap: 4px; min-width: 24px; padding: 0 4px; font-size: 0.75rem; font-weight: 700; }
.save-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.save-chip[data-kind="ok"] .save-dot { background: #22c55e; }
.save-chip[data-kind="warn"] .save-dot { background: #f59e0b; }
.save-chip[data-kind="error"] .save-dot { background: #ef4444; }
.save-chip[data-kind="warn"], .save-chip[data-kind="error"] { color: var(--warn-text); }
.theme-btn { flex: none; width: 44px; height: 44px; font-size: 1.15rem; color: var(--text); background: none; border: 0; cursor: pointer; }
.hdr-panel { max-width: 640px; margin: 0 auto; padding: 0 8px 12px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  min-height: 44px; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; font: inherit; font-size: 0.85rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--surface-border); border-radius: 999px; cursor: pointer;
}
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pill.gym .dot { background: var(--ss1); }
.pill.recovery .dot { background: var(--ss2); }
.pill.active { background: var(--accent-soft); border-color: var(--accent); }
.pill.today { font-weight: 700; }
.pill.signout { min-width: 44px; justify-content: center; color: var(--muted); }
.pill.signout.armed { color: var(--error-text); border-color: var(--error-text); }
.armed-text { font-size: 0.8rem; font-weight: 600; }
.save-line { margin: 10px 0 0; color: var(--muted); }

/* ---- Home: the day's cards ---- */
.page { padding-top: 12px; }
.day-body { padding-bottom: 96px; }
.phase-line { margin: 0 0 10px; }
.day-notice { margin: 0 0 10px; }
.older-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; font-size: 0.9rem; }
.ex.rec { border-left: 4px solid var(--ss2); }
.ex-header { margin-bottom: 2px; }
.exercise-body { color: var(--text); }
.log-area { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--item-border); }
.log-area p { margin: 0 0 4px; }

/* the barrel dial (ui/dial.js): one value; drag up for more, down for less, or tap the upper or lower half */
.dial {
  position: relative; width: 100%; height: 44px; overflow: hidden; border-radius: 12px; cursor: ns-resize; touch-action: pan-y;
  background: var(--field-bg); border: 1px solid var(--border);
}
.dial:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.dial-scroll {
  height: 100%; overflow-y: auto; scroll-snap-type: y mandatory; scrollbar-width: none; overscroll-behavior: contain; perspective: 160px;
  -webkit-overflow-scrolling: touch;
}
.dial-scroll::-webkit-scrollbar { display: none; }
.dial.dragging .dial-scroll { scroll-snap-type: none; }
.dial-list { list-style: none; margin: 0; padding: 0; }
.dial-item {
  height: 44px; display: flex; align-items: center; justify-content: center; scroll-snap-align: center; font-size: 1.15rem; font-weight: 800;
  font-variant-numeric: tabular-nums; transform-origin: center; user-select: none; -webkit-user-select: none;
}
.dial-hint { position: absolute; left: 0; right: 0; text-align: center; font-size: 0.6rem; line-height: 1; color: var(--muted); opacity: 0.8; pointer-events: none; z-index: 1; }
.dial-hint.up { top: 2px; }
.dial-hint.down { bottom: 2px; }
.dial.increase { background: var(--up-bg); border-color: var(--up-border); }
.dial.increase .dial-item { color: var(--up-text); }

.logline { display: flex; align-items: flex-end; gap: 6px; }
.dcol { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dcol.shared { flex: 0 0 54px; }
.dcap { font-size: 0.68rem; color: var(--muted); text-align: center; }
.times { align-self: flex-end; height: 44px; display: flex; align-items: center; margin: 0; color: var(--muted); font-size: 0.9rem; }
.okbtn {
  flex: 0 0 48px; height: 44px; font-size: 1.6rem; font-weight: 700; border-radius: 12px; border: 0; cursor: pointer;
  color: var(--accent-text); background: var(--accent);
}
.hold-text { flex: 1; margin: 0; align-self: center; }
.linklike { margin-top: 6px; padding: 0; min-height: 32px; font: inherit; font-size: 0.85rem; color: var(--link); background: none; border: 0; text-decoration: underline; cursor: pointer; }
.doneline { display: flex; align-items: center; gap: 8px; }
.doneline .btn { padding: 8px 12px; }
.done-summary { flex: 1; min-width: 0; font-weight: 600; }
.tick { flex: none; width: 1.7em; height: 1.7em; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--ok-text); background: var(--ok-bg); }
.dcap.skip { min-height: 22px; padding: 0 0 2px; font: inherit; font-size: 0.68rem; color: var(--muted); background: none; border: 0; cursor: pointer; }
.dcol.skipped .dial { opacity: 0.3; }
.dcol.skipped .dcap { text-decoration: line-through; }
.edit-bar p { margin: 0 0 8px; }

/* ---- Header icons, History, exercise detail, Settings (Phase E) ---- */
.pill.iconbtn { min-width: 44px; justify-content: center; padding: 0 10px; color: var(--link); border-color: var(--accent); background: var(--accent-soft); }
.pill-icons { display: flex; gap: 6px; align-items: center; }
.pill-sep { align-self: center; width: 1px; height: 24px; background: var(--surface-border); margin: 0 2px; }
@media (max-width: 480px) { .pill-sep { display: none; } }
.seg { display: flex; gap: 6px; margin: 0 0 12px; }
.seg a { flex: 1; min-height: 44px; display: flex; align-items: center; justify-content: center; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--surface-border); border-radius: 999px; font-size: 0.9rem; }
.seg a[aria-current="true"], .seg button[aria-pressed="true"] { color: var(--accent-text); background: var(--accent); border-color: var(--accent); }
.seg button { flex: 1; min-height: 44px; font: inherit; font-size: 0.9rem; color: var(--text); background: var(--surface); border: 1px solid var(--surface-border); border-radius: 999px; cursor: pointer; }
.group-label { margin: 18px 4px 6px; font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.hlist { padding: 0 14px; }
.hrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 56px; padding: 8px 0; border-top: 1px solid var(--border); color: inherit; text-decoration: none; }
.hrow:first-child { border-top: 0; }
.hrow .main { min-width: 0; }
.hrow .sub { display: block; font-size: 0.8rem; color: var(--muted); }
.hrow .ssbar { display: inline-block; width: 4px; height: 14px; border-radius: 2px; margin-right: 8px; vertical-align: -2px; background: var(--border); }
.ssbar.ss1 { background: var(--ss1); } .ssbar.ss2 { background: var(--ss2); } .ssbar.ss3 { background: var(--ss3); }
.wk { display: inline-block; width: 24px; height: 24px; border-radius: 6px; text-align: center; line-height: 24px; font-weight: 700; font-size: 0.8rem; margin-right: 8px; color: var(--accent-text); background: var(--accent); }
.tag-due, .tag-miss { flex: none; font-size: 0.75rem; padding: 1px 8px; border-radius: 6px; white-space: nowrap; }
.tag-due { color: var(--ok-text); background: var(--ok-bg); }
.tag-miss { color: var(--notice-text); background: var(--notice-bg); }
.stats2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 12px; }
.stats2 > div { padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.stats2 .k { display: block; font-size: 0.75rem; color: var(--muted); }
.stats2 .v { font-weight: 600; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--border); }
.chart .tick, .chart .axis { fill: var(--muted); font-size: 11px; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; }
.chart .dot { fill: var(--accent); }
.chart .inc { stroke: var(--ss1); stroke-dasharray: 3 3; }
.chart .inclabel { fill: var(--ok-text); font-size: 11px; }
.htable { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.htable th { text-align: left; font-weight: 500; font-size: 0.75rem; color: var(--muted); padding: 4px 0; }
.htable td { padding: 10px 0; border-top: 1px solid var(--border); vertical-align: top; }
.htable td.r, .htable th.r { text-align: right; }
.htable a { color: inherit; text-decoration: none; display: block; }
.empty-note { padding: 14px 0; color: var(--muted); }
