/* AT Sport: explicit surface/text pairs keep nested cards readable in every theme. */
:root {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 18px;
  color-scheme: light;
  --forest: #173c33;
  --cream: #f5f2e9;
  --lime: #d7f25b;
  --page-bg: var(--cream);
  --card-bg: #fffef8;
  --text: var(--forest);
  --muted: #526454;
  --border: #cbd3c5;
  --soft-bg: #e5ebdc;
  --field-bg: #f5f2e9;
  --field-text: #173c33;
  --field-muted: #526454;
  --action-bg: #173c33;
  --action-text: #f5f2e9;
  --inverse-bg: #173c33;
  --inverse-text: #f5f2e9;
  --inverse-muted: #d2decf;
  --inverse-border: #749084;
  --rest-bg: #e3ead5;
  --rest-text: #173c33;
  --danger: #922f2a;
  --danger-bg: #f9e9e3;
  --gold: #a88744;
  --gold-text: #776025;
  --focus: #886818;
  --shadow: 0 12px 32px #173c3309;
}
body[data-theme=dark] {
  color-scheme: dark;
  --page-bg: #10251e;
  --card-bg: #18342a;
  --text: #ecf0e2;
  --muted: #bdcbb7;
  --border: #597665;
  --soft-bg: #254638;
  --field-bg: #10251e;
  --field-text: #ecf0e2;
  --field-muted: #bdcbb7;
  --action-bg: #d7f25b;
  --action-text: #173c33;
  --inverse-bg: #214e3b;
  --danger: #ffc0b2;
  --danger-bg: #572d29;
  --gold: #d1b575;
  --gold-text: #ddc78f;
  --focus: #e7d4a0;
  --shadow: 0 12px 32px #0002;
}
@media (prefers-color-scheme: dark) {
  body[data-theme=system] {
    color-scheme: dark;
    --page-bg: #10251e;
    --card-bg: #18342a;
    --text: #ecf0e2;
    --muted: #bdcbb7;
    --border: #597665;
    --soft-bg: #254638;
    --field-bg: #10251e;
    --field-text: #ecf0e2;
  --field-muted: #bdcbb7;
    --action-bg: #d7f25b;
    --action-text: #173c33;
    --inverse-bg: #214e3b;
    --danger: #ffc0b2;
    --danger-bg: #572d29;
    --gold: #d1b575;
    --gold-text: #ddc78f;
    --focus: #e7d4a0;
    --shadow: 0 12px 32px #0002;
  }
}
* { box-sizing: border-box; }
/* Resolve compatibility tokens on the themed element, never on :root. */
body { --paper: var(--page-bg); --card: var(--card-bg); --ink: var(--text); --line: var(--border); --soft: var(--soft-bg); margin: 0; background: var(--page-bg); color: var(--text); line-height: 1.5; }
button, input, select, textarea { font: inherit; }
a, button, input, select, textarea { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-underline-offset: .2em; }
a, button, label, p, h1, h2, h3 { overflow-wrap: anywhere; }
button, input, select, textarea { min-width: 0; max-width: 100%; }
button { border: 1px solid transparent; border-radius: 14px; background: var(--soft-bg); color: var(--text); padding: 12px 18px; min-height: 44px; min-width: 44px; font-weight: 650; cursor: pointer; white-space: normal; transition: transform .15s, box-shadow .15s; }
button:hover { box-shadow: inset 0 0 0 2px var(--border); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; }
:where(button, a, input, select, textarea):focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
.primary { background: var(--action-bg); color: var(--action-text); }
.accent { background: var(--lime); color: var(--forest); }
.danger { background: var(--danger-bg); color: var(--danger); }
.text-button { background: transparent; text-decoration: underline; padding: 10px 12px; }
.icon-button { padding: 10px 12px; background: transparent; }
h1 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.12; font-weight: 750; letter-spacing: -.045em; margin: 16px 0 20px; }
h2 { font-size: 1.4rem; line-height: 1.25; letter-spacing: -.025em; margin: 0 0 16px; }
h3 { font-size: 1.12rem; line-height: 1.3; letter-spacing: -.015em; margin: 0 0 10px; }
p { line-height: 1.65; }
.small { font-size: .9rem; line-height: 1.65; }
p.small, .notice { font-size: 1rem; }
.muted { color: var(--muted); }
.error { color: var(--danger); }
.eyebrow { display: flex; align-items: center; gap: 9px; font-size: .9rem; line-height: 1.5; font-weight: 700; letter-spacing: .04em; color: var(--muted); }
.eyebrow::before { content: ''; width: 22px; height: 2px; flex: 0 0 22px; background: var(--gold); }
.topbar { max-width: 1400px; min-height: 96px; margin: auto; padding: 14px 5%; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 12px; font-size: 1.1rem; font-weight: 850; text-decoration: none; }
.brand-symbol, .brand small { display: none; }
.brand > span:last-child { background: var(--forest); color: var(--cream); padding: 12px 16px; border-radius: 12px; letter-spacing: -.03em; }
.top-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px; max-width: 100%; }
.status { font-size: .9rem; max-width: 245px; line-height: 1.35; }
.status::before { content: '●'; color: var(--gold-text); margin-right: 6px; }
.app-shell { max-width: 1400px; margin: auto; padding: 0 5%; display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 40px; }
nav { display: flex; flex-direction: column; gap: 8px; padding-top: 40px; }
nav button { display: flex; gap: 10px; align-items: center; background: transparent; text-align: left; font-size: .9rem; padding: 14px 10px; }
nav button.active { background: var(--action-bg); color: var(--action-text); }
.nav-icon { flex: 0 0 20px; width: 20px; font-size: 1.1rem; }
.nav-foot { margin-top: auto; padding: 32px 10px; color: var(--muted); font-size: .9rem; line-height: 1.8; }
main { min-width: 0; min-height: calc(100vh - 96px); padding: 40px 0 64px; }
.section-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; margin: 32px 0 18px; }
.section-head h2 { margin: 0; }
/* Inverse panels own all foregrounds, including nested labels and hints. */
.hero, .workout-stage {
  --text: var(--inverse-text);
  --muted: var(--inverse-muted);
  --border: var(--inverse-border);
  --soft-bg: #315e4d;
  --field-bg: #f5f2e9;
  --field-text: #173c33;
  --field-muted: #526454;
  --focus: #e7d4a0;
  background: var(--inverse-bg);
  color: var(--text);
  border-radius: 26px;
  position: relative;
}
.hero { padding: 36px; min-height: 290px; overflow: hidden; }
.hero > div { max-width: 720px; position: relative; z-index: 1; }
.hero h1 { font-size: clamp(2rem, 4.8vw, 3.35rem); max-width: 660px; }
.hero p { max-width: 650px; color: var(--muted); }
.hero .accent { margin-top: 8px; }
.hero .edition { display: none; }
.hero-art { display: none; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: stretch; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { background: var(--card-bg); color: var(--text); border: 1px solid var(--border); border-radius: 20px; padding: 24px; margin-bottom: 16px; box-shadow: var(--shadow); min-width: 0; }
.grid > .card { margin-bottom: 0; }
.exercise { display: flex; flex-direction: column; align-items: flex-start; text-align: left; min-height: 200px; position: relative; }
.exercise-icon { min-height: 36px; line-height: 1.1; margin-bottom: 18px; font-size: 1.7rem; color: var(--text); }
.exercise .arrow { position: absolute; right: 20px; top: 22px; color: var(--muted); }
.exercise h3 { font-size: 1.12rem; }
.exercise .tag { font-size: .9rem; line-height: 1.5; color: var(--muted); margin-top: auto; font-weight: 400; }
.exercise:hover { border-color: var(--gold); }
.metric-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 22px; }
.metric { display: flex; flex-direction: column; gap: 6px; padding: 18px; border: 1px solid var(--border); border-radius: 16px; }
.metric strong { font-size: 1.6rem; font-weight: 700; letter-spacing: -.035em; }
.metric span { font-size: .9rem; color: var(--muted); }
.row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.row > div { min-width: 0; }
.spread { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.divider { border-top: 1px solid var(--border); margin: 26px 0; }
.pill { display: inline-block; border: 1px solid var(--border); border-radius: 100px; padding: 7px 12px; font-size: .9rem; background: var(--page-bg); color: var(--text); }
.pill.selected, .weekday.selected { background: var(--action-bg); color: var(--action-text); }
.notice { border-left: 4px solid var(--gold); padding: 14px 18px; background: var(--soft-bg); color: var(--text); border-radius: 0 12px 12px 0; font-size: 1rem; line-height: 1.65; }
.notice.error { color: var(--danger); background: var(--danger-bg); }
label { display: flex; flex-direction: column; gap: 8px; font-size: .9rem; font-weight: 600; line-height: 1.5; }
label.check { flex-direction: row; align-items: center; min-height: 44px; font-weight: 400; }
input, select, textarea { width: 100%; font-size: 1rem; background: var(--field-bg); color: var(--field-text); border: 1px solid var(--border); border-radius: 11px; padding: 12px 13px; min-height: 48px; }
input::placeholder, textarea::placeholder { color: var(--field-muted); opacity: 1; }
input[type=checkbox] { flex: 0 0 22px; width: 22px; min-height: 22px; accent-color: var(--action-bg); }
input[type=range] { accent-color: var(--action-bg); }
textarea { resize: vertical; min-height: 90px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.fields .wide { grid-column: 1 / -1; }
form > label { margin-bottom: 18px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
fieldset { border: 1px solid var(--border); border-radius: 12px; padding: 18px; margin: 20px 0; min-width: 0; }
legend { font-size: 1rem; font-weight: 650; padding: 0 5px; }
fieldset label + label { margin-top: 18px; }
.sets { display: flex; flex-wrap: wrap; gap: 8px; }
.set { background: var(--card-bg); color: var(--text); border: 1px solid var(--border); border-radius: 11px; padding: 12px; min-width: 60px; text-align: center; }
.set small { font-size: .9rem; }
.set.done { background: var(--soft-bg); }
.set.current { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.set.skipped { color: var(--muted); text-decoration: line-through; }
.workout { max-width: 780px; margin: auto; }
.workout-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.workout-stage { padding: 32px 26px; text-align: center; overflow: hidden; }
.workout-stage.rest { --text: var(--rest-text); --muted: #3c5641; --border: #91a382; --soft-bg: #d1ddc2; --focus: #886818; background: var(--rest-bg); }
.workout-stage .eyebrow { justify-content: center; color: var(--muted); }
.workout-stage h1 { font-size: 2rem; margin: 18px 0; letter-spacing: -.025em; }
.big-number { font-size: clamp(4rem, 15vw, 8.35rem); line-height: 1.12; letter-spacing: -.065em; font-weight: 700; font-variant-numeric: tabular-nums; }
.big-unit { display: block; font-size: .9rem; color: var(--muted); margin: 8px 0 24px; }
.workout-stage .primary-action { display: block; width: 100%; padding: 18px; font-size: 1rem; border-radius: 15px; }
.actual-input { display: block; text-align: center; font-size: 1.35rem; max-width: 180px; margin: 10px auto 20px; }
.set-details { margin: 20px 0 26px; text-align: left; }
.last-result { line-height: 1.65; color: var(--muted); }
.workout-tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 16px 0 24px; }
.workout-tools button { font-size: .9rem; }
.progress-track { height: 5px; background: var(--border); margin: -6px 0 24px; border-radius: 5px; overflow: hidden; }
.progress-track > span { display: block; height: 100%; background: var(--lime); }
.rest-controls { text-align: left; margin-top: 24px; padding: 18px; border: 1px solid var(--border); border-radius: 16px; background: var(--soft-bg); color: var(--text); }
.seconds-control { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; margin: 10px 0; }
.seconds-control input { text-align: center; font-variant-numeric: tabular-nums; }
.seconds-control button { padding: 10px 12px; }
.rest-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.rest-presets button { flex: 1 1 70px; font-size: .9rem; border: 1px solid var(--border); }
.history-item { margin-bottom: 14px; }
.history-item h3 { margin: 0; }
.history-date { font-size: .9rem; color: var(--muted); }
.history-total { font-size: 1.5rem; font-weight: 700; }
.history-filter-label { min-width: 180px; max-width: 100%; }
.routine-item { display: grid; grid-template-columns: 1fr; gap: 12px; padding: 20px 0; border-bottom: 1px solid var(--border); }
.routine-item label { margin-bottom: 10px; }
.routine-item button { padding: 10px 14px; }
.routine-label { font-size: .9rem; color: var(--gold-text); margin-bottom: 14px; line-height: 1.6; }
.weekdays { display: flex; flex-wrap: wrap; gap: 8px; }
.weekday { padding: 12px; border: 1px solid var(--border); }
.calendar-next, .activity-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 7px; margin: 22px 0; }
.calendar-day, .activity-day { background: var(--soft-bg); color: var(--text); min-width: 0; padding: 12px 4px; text-align: center; border-radius: 11px; font-size: .9rem; }
.calendar-day strong, .activity-day strong { display: block; font-size: 1.35rem; margin: 10px 0; }
.calendar-day.planned { background: var(--action-bg); color: var(--action-text); }
.activity-day.done { outline: 2px solid var(--gold); }
.activity-day span { display: block; overflow-wrap: anywhere; }
.table-scroll { overflow-x: auto; width: 100%; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 12px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { font-weight: 600; }
td { font-variant-numeric: tabular-nums; }
.chart { width: 100%; height: 240px; display: block; overflow: visible; }
.chart text { fill: var(--muted); font-size: 16px; }
.chart line { stroke: var(--border); }
.empty { text-align: center; padding: 36px 20px; color: var(--muted); }
.empty strong { display: block; font-size: 2rem; color: var(--gold-text); margin-bottom: 12px; }
.cycle-list { padding-left: 24px; }
.cycle-date { padding: 12px 4px; border-bottom: 1px solid var(--border); }
#routine-preview { font-size: .9rem; line-height: 1.8; }
.welcome-foot { font-size: .9rem; color: var(--muted); margin-top: 30px; line-height: 1.8; }
.decorative-arrow { font-size: 2rem; color: var(--gold-text); }
.import-label { display: block; }
.import-input { margin-top: 8px; }
.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); z-index: 20; background: var(--action-bg); color: var(--action-text); border: 1px solid var(--gold); padding: 16px 22px; border-radius: 15px; max-width: calc(100% - 24px); max-height: 40vh; overflow-y: auto; font-size: .9rem; line-height: 1.5; box-shadow: var(--shadow); }
dialog { border: 1px solid var(--border); border-radius: 22px; padding: 28px; background: var(--card-bg); color: var(--text); width: calc(100% - 28px); max-width: 660px; max-height: 90dvh; box-shadow: var(--shadow); }
dialog::backdrop { background: #112c24aa; backdrop-filter: blur(3px); }
dialog h2 { padding-right: 32px; }
.modal-close { float: right; padding: 5px 10px; margin-top: -5px; font-size: 1.4rem; background: transparent; }
.skip { position: fixed; top: -200px; left: 16px; z-index: 100; padding: 12px; background: var(--lime); color: var(--forest); }
.skip:focus { top: 12px; }
.mobile-only { display: none; }
/* Search and update controls share the same surfaces as all other forms. */
.library-filters { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; margin: 22px 0; }
.update-banner, .update-notice { max-width: 1260px; padding: 16px; margin: 20px auto; background: var(--soft-bg); color: var(--text); border: 1px solid var(--border); border-radius: 16px; }
@media (max-width: 1050px) {
  .app-shell { padding: 0 4%; grid-template-columns: 175px minmax(0, 1fr); gap: 24px; }
  .topbar { padding-left: 4%; padding-right: 4%; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { padding: 20px; }
  .hero { padding: 28px; }
}
@media (max-width: 700px) {
  .topbar { padding: 12px 16px; gap: 10px; }
  .brand { font-size: 1rem; }
  .top-actions { margin-left: auto; gap: 2px; }
  .status { max-width: 140px; padding: 10px 8px; }
  .app-shell { display: block; padding: 0 16px; }
  main { padding: 28px 0 200px; min-height: calc(100vh - 96px); }
  nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 8px 4px calc(8px + env(safe-area-inset-bottom)); gap: 0; background: var(--page-bg); color: var(--text); border-top: 1px solid var(--border); box-shadow: 0 -6px 24px #0001; }
  nav button { flex-direction: column; gap: 5px; text-align: center; font-size: .9rem; line-height: 1.25; padding: 8px 2px; min-width: 0; border-radius: 12px; }
  nav button span:last-child { max-width: 100%; overflow-wrap: anywhere; word-break: normal; }
  nav .nav-icon { flex: none; font-size: 1rem; }
  nav .nav-foot { display: none; }
  .hero { padding: 28px 22px; min-height: 290px; }
  .hero h1 { font-size: 2.12rem; }
  .hero .eyebrow { letter-spacing: 0; }
  .hero .accent { width: 100%; }
  .grid, .grid.two, .fields, .library-filters { grid-template-columns: 1fr; }
  .fields .wide { grid-column: auto; }
  .grid { gap: 14px; }
  .exercise { min-height: 180px; }
  .metric-row { grid-template-columns: 1fr; }
  .metric { padding: 16px; }
  .section-head { margin-top: 28px; }
  .section-head button { width: 100%; }
  .workout-stage { padding: 28px 20px; }
  .workout-stage.rest { padding: 20px 16px; }
  .workout-stage.rest h1 { font-size: 1.8rem; margin: 12px 0; }
  .workout-stage.rest .big-number { font-size: 3.7rem; }
  .workout-stage.rest .big-unit { margin: 4px 0 10px; }
  .workout-stage.rest .progress-track { margin-bottom: 16px; }
  .workout-stage.rest .rest-controls { margin: 14px 0; padding: 12px; }
  .workout-stage.rest .rest-controls h3 { margin-bottom: 8px; }
  .workout-stage.rest .rest-controls p { margin: 6px 0; }
  .workout-stage.rest .seconds-control { align-items: end; margin: 8px 0; }
  .workout-stage.rest .rest-presets { gap: 6px; }
  .workout-stage.rest .rest-presets button { flex: 1 1 44px; padding: 8px 4px; }
  .workout-tools { grid-template-columns: 1fr; }
  .calendar-next, .activity-week { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .history-filter-label { min-width: 0; width: 100%; }
  .history-total { font-size: 1.3rem; }
  .toast { bottom: 190px; }
  dialog { padding: 20px; }
  .row { gap: 10px; }
}
@media (max-width: 380px) {
  .topbar { padding: 10px 12px; gap: 8px; }
  .topbar .brand { margin-right: auto; }
  .top-actions { display: contents; }
  .topbar .status { order: 1; max-width: none; width: 100%; padding: 8px 12px; }
  .app-shell { padding: 0 12px; }
  .card { padding: 16px; }
  .hero { padding: 24px 18px; }
  .hero h1 { font-size: 2rem; }
  .activity-week { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rest-controls { padding: 12px; }
  .seconds-control button { padding: 10px 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

/* Derived progress and previous-set actions inherit semantic surface colors. */
.previous-set{margin:16px 0;padding:12px 16px;border:1px solid var(--line);border-radius:16px;text-align:left}
.previous-set p{margin:0 0 4px}.previous-set button{color:inherit;max-width:100%;white-space:normal}
.progress-summary{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(140px,100%),1fr));gap:12px;margin:20px 0}
.progress-summary .metric{min-width:0;border:1px solid var(--line);border-radius:16px;padding:16px}
.progress-summary .metric strong{font-size:clamp(24px,5vw,36px);overflow-wrap:anywhere}
.progress-summary .metric span{font-size:16px}.progress-filters{margin:20px 0}
.progress-chart h3{margin-top:20px}.progress-chart select{max-width:100%}
.sync-details{margin-top:20px}.sync-details summary,.progress-chart summary{cursor:pointer;min-height:44px;padding:10px 0;font-size:18px}
.sync-details .actions{margin-top:16px}.table-scroll{overflow-x:auto;max-width:100%}
.table-scroll table{width:100%;border-collapse:collapse;text-align:left}.table-scroll th,.table-scroll td{padding:12px 8px;border-bottom:1px solid var(--line)}
.table-scroll caption{text-align:left;padding:12px 0;font-weight:700}
@media(max-width:420px){.progress-summary{grid-template-columns:repeat(2,minmax(0,1fr))}.previous-set{padding:12px}.progress-filters{gap:12px}}

/* Live draft calculations keep input nodes stable and use current surface colors. */
.draft-preview{margin:20px 0;padding:16px;border:1px solid var(--line);border-radius:16px}
.draft-preview h3{margin-top:0}.draft-preview details{margin-top:12px}.draft-preview summary{min-height:44px;padding:10px 0;cursor:pointer}
.draft-totals{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin:16px 0}
.draft-totals>div{min-width:0}.draft-totals dt{font-size:16px;color:inherit}.draft-totals dd{font-size:28px;font-weight:700;margin:4px 0;overflow-wrap:anywhere}
#level-preview .set{min-width:70px}#level-error,#routine-error,#plan-error{margin:16px 0}
@media(max-width:360px){.draft-preview{padding:12px}.draft-totals{gap:12px}}

/* Minimal presentation: primary work stays visible; secondary reference uses native disclosure. */
.card { box-shadow: none; }
.eyebrow::before, .status::before { content: none; }
.brand > span:last-child { background: transparent; color: var(--text); padding: 0; border-radius: 0; }
.hero { --text: inherit; --muted: inherit; --border: inherit; --soft-bg: inherit; --focus: inherit; background: transparent; color: var(--text); border-radius: 0; padding: 0; min-height: 0; }
.hero h1 { font-size: clamp(2rem, 4vw, 3rem); }
.exercise { min-height: 64px; padding: 18px 4px; background: transparent; color: var(--text); border: 0; border-bottom: 1px solid var(--border); border-radius: 0; justify-content: center; }
.exercise h3 { margin: 0; }
.exercise:hover { background: var(--soft-bg); border-color: var(--border); }
.exercise-plan { margin: 24px 0 32px; }
.exercise-plan .section-head { margin-top: 0; }
.exercise-plan .set { background: transparent; border: 0; border-radius: 0; }
.secondary-details { border-top: 1px solid var(--border); padding: 6px 0; margin: 0; }
.secondary-details > summary { cursor: pointer; min-height: 48px; padding: 12px 0; font-weight: 600; font-size: 1rem; }
.secondary-details > summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.secondary-details[open] { padding-bottom: 20px; }
.secondary-details .card { border: 0; background: transparent; border-radius: 0; padding: 16px 0; margin: 0; }
.secondary-details .metric-row { margin: 12px 0 20px; }
.history-state, .plan-status { font-size: .9rem; color: var(--muted); }
.routine-label { font-weight: 400; letter-spacing: 0; }
nav { box-shadow: none; }
@media(max-width:700px) { nav button { justify-content: center; } }

.status { background: transparent; }
.exercise-plan .actions > .primary { width: 100%; }
.exercise-plan .actions > button:not(.primary) { background: transparent; text-decoration: underline; padding: 10px 8px; }
@media(max-width:700px) { .exercise-plan .section-head button { width: auto; } }

/* Compact draft controls keep editable values and confirmation separate. */
.value-control { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 8px; align-items: center; min-width: 0; }
.value-control > button { touch-action: manipulation; padding: 8px; min-width: 44px; min-height: 48px; background: transparent; border: 1px solid var(--border); }
.value-control > input { width: 100%; max-width: 100%; min-width: 0; }
.actual-control { max-width: 400px; margin: 10px auto 20px; }
.actual-control .actual-input { margin: 0; }
#daily-gifts p { margin: 12px 0; }
#daily-gifts a { display: inline-flex; align-items: center; min-height: 44px; }

/* Coaching stays behind secondary entries; no extra cards on the home screen. */
.coach-entry { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 20px 0 28px; }
.coach-preview { border-top: 1px solid var(--border); padding: 18px 0; overflow-wrap: anywhere; }
.coach-targets { list-style: none; padding: 0; margin: 12px 0; }
.coach-targets li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.coach-targets span { color: var(--muted); }
.coach-days .row { flex-wrap: wrap; gap: 8px 16px; }
.coach-days label { display: inline-flex; align-items: center; min-height: 44px; gap: 6px; margin: 0; }
.coach-days input { width: 20px; min-height: 20px; margin: 0; }
.coach-table { width: 100%; min-width: 0; font-size: .9rem; }
.coach-table th { text-align: left; overflow-wrap: anywhere; }
.coach-table td { text-align: right; }
.coach-swap-button { display: block; margin: 12px auto; min-height: 44px; }
#coach-form .fields > label, #coach-form select { min-width: 0; }
#coach-form, #coach-swap-form { min-width: 0; }
.pro-warm-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.pro-entry { padding:16px 0; border-bottom:1px solid var(--border); overflow-wrap:anywhere; }
.pro-photo-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; margin-top:20px; }
.pro-photo-grid figure { margin:0; min-width:0; }
.pro-photo-grid img { display:block; width:100%; height:auto; border-radius:12px; }
.pro-photo-grid figcaption { font-size:1rem; margin:8px 0; }
#pro-options-form select, #coach-proposal-form select, #pro-week-form select { width:100%; min-width:0; }
#photo-upload-form input[type=file] { width:100%; min-width:0; font-size:1rem; }
@media(max-width:500px) { #coach-form .fields { grid-template-columns: minmax(0,1fr); } .coach-entry { align-items: stretch; } }

#gift-text{width:100%;resize:vertical;min-height:220px}#gift-select{max-width:100%;margin-bottom:20px}.nav-foot button{width:100%}

/* Compact, keyboard-operable preparation choices. */
.training-choices{border:0;margin:0 0 1.25rem;padding:0;display:grid;gap:.5rem;min-width:0}
.training-choices legend{padding:0 0 .65rem;font-weight:700}
.training-choices label{display:flex;flex-direction:row;margin:0;align-items:center;gap:.75rem;padding:.7rem .85rem;border:1px solid var(--line);border-radius:14px;min-height:48px;cursor:pointer;min-width:0}
.training-choices label:has(input:checked){border-color:var(--text);box-shadow:inset 0 0 0 1px var(--text)}
.training-choices input{width:20px;height:20px;min-height:20px;flex:0 0 20px;margin:0;padding:0;accent-color:var(--forest)}
.training-choices label span{min-width:0;overflow-wrap:anywhere}
.training-choices small{display:block;margin-top:.15rem;font-size:16px;color:var(--muted)}
.training-choices:focus-within{scroll-margin-block:1rem}
.training-onboarding h1{font-size:clamp(32px,5vw,56px)}
.training-onboarding form{max-width:640px}
.toast{pointer-events:none}

.android-download [data-android-download]{display:inline-flex;align-items:center;justify-content:center;min-height:44px;min-width:44px;max-width:100%;padding:12px 18px;border:1px solid var(--border);border-radius:14px;background:var(--soft-bg);color:var(--text);font-weight:650;text-decoration:none;overflow-wrap:anywhere}
/* Growth release: one next action, quiet navigation, explicit recorded progress. */
nav button.active{background:var(--soft-bg);color:var(--text);box-shadow:inset 3px 0 0 var(--text);font-weight:750}
.brand>span:last-child{font-size:1.2rem;font-weight:900;letter-spacing:-.055em;padding:0;background:transparent;color:var(--text)}
.growth-next h1{max-width:700px;font-size:clamp(2.2rem,5vw,3.7rem);line-height:1.05;letter-spacing:-.055em}
.growth-ready{margin:22px 0;gap:8px}.growth-ready .set{flex:1;min-width:48px;max-width:110px;border:0;border-radius:0;border-top:1px solid var(--border);padding:14px 5px;background:transparent}.growth-ready .set strong{font-size:1.8rem;letter-spacing:-.04em}
.growth-plan-label{color:var(--muted);font-size:16px;margin-bottom:6px}
.growth-rhythm{margin:32px 0;padding:24px 0;border-top:1px solid var(--border);border-bottom:1px solid var(--border)}
.growth-rhythm h2{font-size:1.1rem;margin-bottom:16px}.growth-week{list-style:none;display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:8px;padding:0;margin:0}
.growth-week li{display:flex;align-items:center;flex-direction:column;gap:6px;min-width:0;text-align:center;border-radius:12px;padding:10px 2px;border:1px solid transparent;font-size:16px}
.growth-week time{font-size:16px;color:var(--muted)}.growth-week li strong{display:flex;align-items:center;justify-content:center;min-width:36px;min-height:36px;border-radius:50%;font-size:18px}
.growth-week li[data-status=completed] strong{background:var(--forest);color:var(--cream)}.growth-week li[data-status=partial] strong{background:#f3dfaa;color:#493a11}.growth-week li[data-status=planned] strong{box-shadow:inset 0 0 0 1px var(--border)}.growth-week li.is-today{border-color:var(--text)}.growth-week .small{font-size:16px;line-height:1.4;overflow-wrap:anywhere}
.growth-launch{border:1px solid var(--border);padding:24px;border-radius:18px;margin-bottom:24px;background:var(--card-bg)}.growth-launch h2{font-size:1.3rem}.growth-comparison{padding:24px 0;border-top:1px solid var(--border);border-bottom:1px solid var(--border);border-radius:0;box-shadow:none;margin:24px 0}.growth-comparison h3{font-size:1.2rem}.growth-comparison p:last-child{margin-bottom:0}.growth-share textarea{min-height:220px}.growth-training-example{display:block;margin-top:6px;color:var(--muted);font-size:16px}
@media(max-width:600px){nav button.active{box-shadow:inset 0 -3px 0 var(--text)}.growth-week{gap:2px}.growth-week li{padding:8px 0}.growth-week li strong{min-width:30px;min-height:34px}.growth-week .small{font-size:16px}.growth-ready .set strong{font-size:1.6rem}.growth-launch{padding:20px 16px}.growth-next h1{font-size:2.35rem}}
/* Let set cells wrap when text is enlarged; never clip the actual target. */
.growth-ready .set{flex:1 1 5rem;min-width:min(100%,5rem);max-width:140px}.growth-ready .set strong{display:block;overflow-wrap:anywhere}
/* Community is a second-level view; the private workout navigation stays unchanged. */
.community-view{max-width:820px;min-width:0}.community-view h1{font-size:clamp(32px,5vw,54px);line-height:1.08;letter-spacing:-.04em}.community-view p,.community-view label,.community-view button,.community-view summary{overflow-wrap:anywhere}.community-view .secondary-details{margin-block:24px}.community-view input:not([type=checkbox]),.community-view select,.community-view textarea{width:100%;max-width:100%;min-width:0}.community-view fieldset{min-width:0}.community-days{border:0;padding:0;margin:18px 0;display:flex;flex-wrap:wrap;gap:8px}.community-days legend{font-size:18px;font-weight:650;padding:0 0 10px}.community-days label{display:flex;align-items:center;gap:8px;min-height:44px;padding:8px 12px;border:1px solid var(--border);border-radius:12px;font-size:18px}.community-days input{width:20px;min-height:20px;margin:0;accent-color:var(--forest)}.community-targets{display:flex;flex-wrap:wrap;gap:8px;margin:20px 0}.community-targets span{flex:1 1 75px;padding:12px 8px;border-top:1px solid var(--border);font-size:16px;text-align:center;overflow-wrap:anywhere}.community-targets strong{display:block;font-size:30px}.community-ranking{list-style:none;padding:0;margin:16px 0}.community-ranking li{display:flex;flex-wrap:wrap;gap:14px;align-items:center;padding:16px 0;border-bottom:1px solid var(--border)}.community-ranking li>div{flex:1 1 120px;min-width:0}.community-ranking .small{display:block}.community-rank{font-size:24px;min-width:32px}.community-proofs{padding-left:1.2rem}.community-proofs li{padding:16px 0}.community-dates{line-height:1.8}.community-view .check{align-items:flex-start}.community-view .check input{flex:0 0 20px;margin-top:4px}.community-public{max-width:1000px;margin:auto;padding:24px}.community-public header{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:40px}.community-public main{padding:0}.community-public footer{margin-top:48px;border-top:1px solid var(--border);padding-top:24px}.community-public a.button{display:inline-flex;align-items:center;min-height:44px;padding:12px 18px;border-radius:12px;background:var(--action-bg);color:var(--action-text);text-decoration:none;font-weight:700}.community-public h1{font-size:clamp(32px,6vw,60px);line-height:1.05;max-width:800px}.community-public section{margin-block:32px}.community-public .community-ranking{max-width:820px}@media(max-width:420px){.community-public{padding:18px}.community-view .fields{display:block}.community-view .fields>label{margin-bottom:16px}.community-days label{flex:1 1 60px;justify-content:center}.community-view button{max-width:100%}}
/* Personal setup: a single readable card with explicit choices. */
.personal-form{max-width:42rem;margin-inline:auto}.personal-form h2{margin-bottom:1.25rem}.personal-choices{border:0;padding:0;margin:1rem 0;display:grid;gap:.75rem}.personal-choices label{display:flex;align-items:center;gap:.8rem;background:var(--field-bg);color:var(--text);font-size:1rem;border:1px solid var(--border);padding:1rem;border-radius:1rem;cursor:pointer}.personal-choices label:has(input:checked){border-color:var(--focus);box-shadow:inset 0 0 0 1px var(--focus)}.personal-choices input{width:1.4rem;height:1.4rem;flex:none;accent-color:#d9f65b}.personal-choices small{display:block;margin-top:.35rem;color:inherit;opacity:.85}.personal-days{display:flex;gap:.5rem;flex-wrap:wrap;border:0;padding:0;margin:1rem 0}.personal-days label{display:flex;align-items:center;gap:.3rem;min-height:44px}.personal-days input{width:1.25rem;height:1.25rem}.personal-exercises{padding:0;list-style:none}.personal-exercises li{display:flex;align-items:center;justify-content:space-between;gap:.75rem;border-bottom:1px solid var(--border,#60786b);padding:.75rem 0}.personal-exercises li>div{display:flex;gap:.25rem;flex:none}.personal-exercises button{min-width:44px;min-height:44px;padding:.35rem}.personal-seconds{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:.5rem;align-items:center}.personal-seconds button{min-height:48px}.personal-seconds input{min-width:0;text-align:center}.personal-targets{padding-block:.5rem;border-bottom:1px solid var(--border,#60786b)}.personal-targets h3{font-size:1.1rem;margin-bottom:.4rem}.personal-targets p{font-size:1.25rem;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}.personal-form .actions{margin-top:1.5rem}.personal-form .actions>.primary{width:100%}.personal-welcome .primary{display:block;margin-block:1.5rem .75rem}.personal-welcome .text-button{display:block}.personal-form fieldset legend{font-size:1rem}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}

/* The recorded result is the primary number; the target stays secondary. */
.workout-stage:not(.rest) .actual-control { max-width: 430px; }
.workout-stage:not(.rest) .actual-input { font-size: clamp(2.5rem,12vw,5rem); line-height: 1.15; font-weight: 700; padding: 12px 4px; }
.exercise-set-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 18px 0; }
.exercise-set-row .set { display: grid; text-align: center; min-width: 44px; padding: 8px 12px; }
.workout-target { margin: 8px 0; }

/* During a set, the result and confirmation keep the screen. */
body.in-workout #navigation { display: none; }
.workout-extras { text-align: left; margin: 12px 0; }
.workout-extras summary { font-size: 16px; }
body.in-workout .toast { pointer-events: none; bottom: 20px; }

body.in-workout .app-shell { grid-template-columns: minmax(0,1fr); max-width: 850px; }
/* Workout: one primary action, secondary tools reveal on demand. */
.workout-head{gap:8px;margin-bottom:12px;align-items:center}
.workout-head>.eyebrow{flex:1 1 90px;min-width:0}
.workout-top-tools{display:flex;gap:6px;flex-wrap:wrap}
.workout-top-tools button{padding:8px 12px;font-size:.9rem}
.workout-stage .rest-quick{display:flex;justify-content:center;gap:12px;margin:10px 0}
.rest-quick button{min-height:44px;padding:8px 18px;background:transparent;border:1px solid var(--border)}
.workout-stage .next-set{margin:12px 0;font-size:.9rem}
#workout-additional{text-align:left;margin-top:14px}
#workout-additional>summary{min-height:44px;padding-block:9px;font-weight:650}
#workout-additional .rest-controls{margin-top:12px}
#workout-additional>.workout-tools{grid-template-columns:repeat(2,minmax(0,1fr))}
#sound-dialog>.primary{width:100%}
#sound-check-status{min-height:1.5em;font-size:.95rem}
#sound-help{border-top:1px solid var(--border);margin-top:16px}
@media(max-width:600px){body.in-workout nav{display:none}body.in-workout .workout-stage{padding:18px 16px}body.in-workout .workout-stage h1{margin:10px 0;font-size:1.6rem}body.in-workout .workout-stage .big-number{font-size:3.5rem}body.in-workout .workout-stage .big-unit{margin:4px 0}body.in-workout .workout-head{position:sticky;top:0;z-index:5;background:var(--page-bg);padding-block:6px}}

/* Exact facts stay compact; detailed controls remain behind their summaries. */
.focus-metrics{display:flex;flex-wrap:wrap;gap:.35rem 1rem;font-size:.85rem;font-weight:650;margin:.65rem 0 1rem;line-height:1.5}
.focus-metrics>span{max-width:100%;overflow-wrap:anywhere}
.focus-plan-groups{display:grid;gap:.65rem;margin:.75rem 0 1rem}
.focus-plan-group{padding:.5rem 0;border-bottom:1px solid var(--line);min-width:0}
.focus-plan-group p{margin:.2rem 0;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}

/* A movement is identified by both a name and a fixed pictogram. */
.sport-icon{display:block;width:40px;height:40px;flex:none;color:currentColor}
.exercise-heading{display:flex;align-items:center;gap:12px;min-width:0}
.exercise-heading>span,.exercise-heading>strong{min-width:0}
.exercise-heading>.sport-icon{width:44px;height:44px}
.home-kicker{font-size:1rem;font-weight:650;margin:0 0 8px}
.hero h1.home-exercise-title{display:flex;align-items:center;gap:14px;font-size:clamp(2rem,4vw,2.6rem);margin:0 0 12px;line-height:1.15}
.home-exercise-title>.sport-icon{width:64px;height:64px;padding:8px;background:var(--soft-bg);border-radius:18px}
.home-exercise-title>span{min-width:0}
.growth-next .growth-plan-label{margin:0 0 12px;color:var(--muted);font-size:1rem}
.growth-next .focus-metrics{gap:8px 16px;margin:12px 0;font-size:1rem}
.growth-ready{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,2.8rem),1fr));gap:6px;margin:18px 0 20px}
.growth-ready .set{display:grid;gap:4px;flex:none;min-width:0;max-width:none;border:1px solid var(--border);border-radius:12px;padding:10px 2px;background:var(--card-bg);line-height:1.2}
.growth-ready .set strong{font-size:clamp(1rem,5.6vw,1.5rem);line-height:1.2;letter-spacing:-.03em;overflow-wrap:normal;font-variant-numeric:tabular-nums}
.growth-ready .set-order,.growth-ready .set-unit{font-size:max(.89rem,16px);color:var(--muted);line-height:1.2}
.growth-next .accent{margin:0;min-height:52px}
.exercise.card{flex-direction:row;align-items:center;justify-content:flex-start;gap:14px;min-height:84px;padding:14px 4px}
.movement-symbol{display:flex;align-items:center;justify-content:center;flex:0 0 52px;width:52px;height:52px;border-radius:15px;background:var(--soft-bg)}
.exercise.card h3{flex:1;min-width:0;margin:0}
.exercise-chevron>.sport-icon{width:22px;height:22px;color:var(--muted)}
.routine-exercises{display:grid;gap:10px;list-style:none;margin:0 0 20px;padding:0}
.routine-exercises li{display:flex;align-items:center;gap:10px;min-width:0}
.routine-exercises .sport-icon{width:32px;height:32px}
.focus-plan-group .exercise-heading{gap:10px}
.focus-plan-group .sport-icon{width:36px;height:36px}
.focus-plan-group p{margin-left:46px}
.workout-stage .exercise-heading{justify-content:center;text-align:left}
.workout-stage .next-set{display:flex;align-items:center;justify-content:center;gap:8px}
.next-set .sport-icon{width:32px;height:32px}
.growth-rhythm{margin:24px 0;padding:20px 0}
.growth-rhythm .row{gap:8px;align-items:baseline}
.growth-rhythm h2{margin:0}
.growth-week{margin-top:12px;gap:2px}
.growth-week li{gap:4px;padding:8px 0}
.week-status{display:block;font-size:1rem;line-height:1.2;font-weight:650;white-space:nowrap}
.growth-rhythm .week-legend{font-size:1rem;line-height:1.4;margin:12px 0 0}
.navigation-options{display:grid;gap:4px}
.navigation-options button{display:flex;align-items:center;text-align:left;gap:12px;background:transparent;padding:12px 4px;border-bottom:1px solid var(--border);border-radius:0}
.navigation-options button span{flex:1;min-width:0}
.navigation-options .sport-icon{width:30px;height:30px}
.navigation-options button>.sport-icon:last-child{width:20px;height:20px}
.navigation-options a{padding:16px 4px;font-size:1rem}
#navigation>button>.sport-icon{width:26px;height:26px}
#navigation>button>.nav-label{font-size:max(.89rem,16px);line-height:1.25}
@media(max-width:700px){
 #navigation{grid-template-columns:repeat(4,minmax(max-content,1fr));overflow-x:auto;overscroll-behavior-x:contain;padding:6px 4px calc(6px + env(safe-area-inset-bottom));gap:0;max-width:100%;scrollbar-width:thin}
 #navigation>button{flex-direction:column;gap:3px;padding:6px;min-height:64px}
 #navigation>button>.nav-label{white-space:nowrap;overflow-wrap:normal}
 main{padding-bottom:calc(100px + env(safe-area-inset-bottom))}
 .home-exercise-title>.sport-icon{width:56px;height:56px;border-radius:16px}
 .hero h1.home-exercise-title{font-size:2rem}
}
.focus-delta{font-size:.85rem;margin:.25rem 0;overflow-wrap:anywhere}
.focus-voice-status{margin:.3rem 0 .7rem;padding:.6rem .75rem;border-inline-start:3px solid currentColor;color:var(--text);background:var(--soft-bg)}
#finish-additional{margin:.8rem 0}#finish-additional>button{margin-top:.5rem}

.nav-short{display:none}
@media(max-width:380px){.nav-full{display:none}.nav-short{display:inline}}
@media(max-width:700px){#navigation>[data-action=navigation-menu]{position:sticky;right:0;background:var(--page-bg)}}

/* Keep large text inside flex disclosures and long exercise names. */
.skip{max-width:calc(100% - 32px);overflow-wrap:anywhere}
.actions>details,.coach-entry>details{min-width:0;max-width:100%}
summary{overflow-wrap:anywhere}
.routine-exercises li>span,.exercise-heading>span,.exercise-heading>strong{min-width:0;overflow-wrap:anywhere}

/* History puts the recorded movement and actual sets before prescription details. */
.history-head{display:flex;align-items:flex-start;justify-content:space-between;gap:.5rem;flex-wrap:wrap}
.history-heading{flex:1 1 13rem;min-width:0}
.history-heading h3{margin-top:.35rem;overflow-wrap:anywhere}
.history-item .exercise-heading{gap:10px;min-width:0}
.history-item .sport-icon{width:36px;height:36px}
.history-state{font-size:.85rem;white-space:normal}
.history-groups{display:grid;gap:.75rem;margin:.9rem 0}
.history-group{min-width:0}
.history-group h4{margin:0 0 .35rem;font-size:1rem}
.history-series{margin:0;font-weight:700;line-height:1.6;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
.history-unit{font-weight:400;white-space:nowrap}
.history-total{display:block}
.history-details{margin:.75rem 0;padding:.6rem 0}
.history-details ol{margin:.5rem 0;padding-left:1.35rem}
.history-details li{margin:.6rem 0;overflow-wrap:anywhere}
.history-details p{margin:.25rem 0;overflow-wrap:anywhere}
.history-actions{display:flex;gap:.25rem 1rem;flex-wrap:wrap}
.history-actions button{max-width:100%;overflow-wrap:anywhere}

.device-login-code{font-size:2rem;font-weight:800;font-variant-numeric:tabular-nums;letter-spacing:.12em;overflow-wrap:anywhere}

#coach-panel select{max-width:100%;width:100%}#coach-panel details{margin-block:1rem}#coach-result:not(:empty){border-inline-start:3px solid var(--accent,#d9f75b);padding-inline-start:.8rem;margin-block:1rem}#coach-panel .actions{flex-wrap:wrap}#coach-panel p{overflow-wrap:anywhere}

/* Shared action icons keep the original movement artwork and hit targets. */
.sport-section-icon{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;vertical-align:middle}
.sport-section-icon>svg{width:100%;height:100%;margin:0}
button[data-at-icon],a[data-at-icon]{gap:.45em}
.icon-button[data-at-icon]{display:inline-flex;align-items:center;justify-content:center}
#save-status[data-at-icon]>svg{width:1em;height:1em}
