/* GymBuddy
   ---------------------------------------------------------------------------
   Two independent axes, both chosen by the user and both applied as attributes
   on <html> — see app/theming.py.

     data-theme  the palette. Grounds, ink, accent, and the IWF plate ramp.
     data-shape  the geometry. Radius, borders, density, type scale.

   Everything below this header is written against variables only. A component
   that hardcodes a colour or a radius will look correct in the default theme and
   wrong in the other six, which is exactly the bug that is invisible in review.

   Palette rule, unchanged: colour means difficulty. The plate ramp (green 10
   through red 25) carries information everywhere it appears, so chrome stays
   neutral and `--accent` is the one deliberate exception — some themes put
   colour on the primary action, some don't.
   --------------------------------------------------------------------------- */

:root, :root[data-theme="chalk"] {
  /* grounds — three layers do the work borders used to */
  --paper: #FBFBF9;
  --surface: #F2F2EF;
  --raised: #E9E9E5;
  --ink: #15171A;
  --ink-2: #575C63;
  --ink-3: #8A9098;
  --divider: #E2E2DE;

  /* The primary action, and legible text on top of it. Defaults to ink-on-paper,
     which is why Chalk looks the same as it always did. */
  --accent: var(--ink);
  --on-accent: var(--paper);

  /* colour — meaning only */
  --p10: #2F7D51; --p15: #A87A15; --p20: #2E63B8; --p25: #B4342A;
  --p10-w: #E4F0E9; --p15-w: #F7EFD9; --p20-w: #E3EAF7; --p25-w: #F8E4E1;

  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;

  /* Tells the browser to theme native controls — date pickers, scrollbars, the
     search field's clear button — instead of forcing them light. */
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root, :root[data-theme="chalk"] {
    --paper: #0B0C0E;
    --surface: #131519;
    --raised: #1E2127;
    --ink: #F0F0EE;
    --ink-2: #A2A7AF;
    --ink-3: #6F757D;
    --divider: #23262C;
    --p10: #4FA871; --p15: #D9A32E; --p20: #5B8FE0; --p25: #D9584B;
    --p10-w: #16281D; --p15-w: #292211; --p20-w: #162030; --p25-w: #2A1614;
  }
}

/* ---------------------------------------------------------------- shape: soft */
/* The default. Filled surfaces, generous radius, no borders — structure comes
   from surface layering and hairline dividers rather than outlines. */
:root, :root[data-shape="soft"] {
  --r-panel: 18px;
  --r-btn: 14px;
  --r-ctl: 12px;
  --r-pill: 10px;

  --card-bg: var(--surface);
  --card-line: none;          /* a box-shadow, so it costs no layout */
  --pad-card: 16px;
  --pad-page: 18px;
  --gap-main: 14px;
  --font-base: 16px;
  --font-head: 29px;
  --tap: 48px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

/* iOS zooms the page on a double tap, and the +/− steppers get tapped fast enough
   to look like one — so changing a weight kept zooming the screen mid-set.
   `manipulation` keeps panning and pinch-to-zoom and drops only the double-tap
   gesture, which is the accessible fix; `user-scalable=no` on the viewport would
   also stop it and would take pinch-zoom away from everyone. */
button, a, label, summary, input, select, textarea,
.btn, .chip, .step, .tick, .chipbox span, .seg span { touch-action: manipulation; }

body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: var(--font-base); line-height: 1.5;
  -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%;
}
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.shell { max-width: 480px; margin: 0 auto; min-height: 100vh; padding-bottom: 88px; }
.shell--bare { padding-bottom: 24px; }

/* ---------------------------------------------------------------- head */
.head { display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; padding: 22px var(--pad-page) 14px; }
.head__k { font-family: var(--mono); font-size: 10px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-3); margin: 0 0 6px;
  /* A long kit list must not push the exercise name down the screen. */
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.head > div:first-child { min-width: 0; }
.head__t { font-size: var(--font-head); font-weight: 800; letter-spacing: -.035em; margin: 0;
  line-height: 1.02; text-wrap: balance; }
.main { padding: 0 var(--pad-page) 28px; display: flex; flex-direction: column;
  gap: var(--gap-main); }

/* ---------------------------------------------------------------- surfaces */
.card { background: var(--card-bg); border: none; border-radius: var(--r-panel);
  padding: var(--pad-card); box-shadow: var(--card-line); }
/* Deliberately quieter than a card in every shape — used for asides, never actions. */
.card--flat { background: transparent; box-shadow: inset 0 0 0 1px var(--divider); }
.lbl { display: block; font-family: var(--mono); font-size: 10px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-3); }
.rowbtw { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: flex; flex-direction: column; min-width: 0; }
.g4 { gap: 4px; } .g6 { gap: 6px; } .g8 { gap: 8px; } .g10 { gap: 10px; } .g14 { gap: 14px; }
.p12 { font-size: 12.5px; color: var(--ink-2); line-height: 1.45; margin: 0; }
.p13 { font-size: 13.5px; color: var(--ink-2); line-height: 1.5; margin: 0; }
.p12 b, .p13 b { color: var(--ink); font-weight: 600; }

/* ---------------------------------------------------------------- rows */
.row { display: flex; align-items: center; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--divider); text-decoration: none; color: inherit;
  min-height: var(--tap); }
.row:last-child { border-bottom: none; }
.row__n { font-size: 15px; font-weight: 600; letter-spacing: -.015em; line-height: 1.25; }
.row__m { font-family: var(--mono); font-size: 11px; color: var(--ink-3); margin-top: 3px; }
.row__i { font-family: var(--mono); font-size: 12px; color: var(--ink-3); width: 20px; flex: none; }
.row__i--ss { color: var(--p20); font-weight: 700; }
.row__rx { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 13px;
  margin-left: auto; text-align: right; flex: none; }
.chev { color: var(--ink-3); margin-left: auto; }
.rowbtn { width: 100%; background: none; border: none; border-bottom: 1px solid var(--divider);
  font-family: var(--sans); text-align: left; cursor: pointer; color: inherit; }
a.card { display: block; text-decoration: none; color: inherit; }
.card--active { box-shadow: inset 0 0 0 2px var(--accent); }

/* Difficulty reads before you read a word. */
.edge { width: 4px; align-self: stretch; min-height: 32px; border-radius: 999px; flex: none; }
.edge--beginner { background: var(--p10); }
.edge--intermediate { background: var(--p20); }
.edge--advanced { background: var(--p25); }

/* ---------------------------------------------------------------- meaning */
.pill { font-family: var(--mono); font-size: 10px; letter-spacing: .06em;
  padding: 5px 10px; border-radius: var(--r-pill); white-space: nowrap; display: inline-block; }
.pill--d1 { color: var(--p10); background: var(--p10-w); }
.pill--d2 { color: var(--p15); background: var(--p15-w); }
.pill--d3 { color: var(--p20); background: var(--p20-w); }
.pill--d4 { color: var(--p25); background: var(--p25-w); }
.pill--now { color: var(--on-accent); background: var(--accent); font-weight: 700; }
.pro { font-family: var(--mono); font-size: 9px; letter-spacing: .14em; font-weight: 700;
  background: var(--accent); color: var(--on-accent); padding: 4px 8px; border-radius: 6px; }

/* ---------------------------------------------------------------- actions */
.btn { display: flex; align-items: center; justify-content: center; width: 100%;
  min-height: var(--tap); background: var(--accent); color: var(--on-accent); border: none;
  border-radius: var(--r-btn); padding: 14px; font-family: var(--sans); font-size: 15.5px;
  font-weight: 700; letter-spacing: -.01em; cursor: pointer; text-decoration: none; }
.btn--ghost { background: var(--raised); color: var(--ink); font-weight: 600; }
.btn--quiet { background: var(--surface); color: var(--ink-2); font-weight: 600; }
.btn--sm { min-height: 44px; padding: 10px; font-size: 13.5px; border-radius: var(--r-ctl); }
.btns { display: flex; gap: 10px; }
.btn:focus-visible, .chip:focus-visible, a:focus-visible, input:focus-visible,
button:focus-visible, .tick:focus-visible, .step:focus-visible {
  outline: 2.5px solid var(--ink); outline-offset: 2px; }
form.inline { margin: 0; display: contents; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; min-height: var(--tap);
  font-size: 13px; padding: 8px 15px; border: none; color: var(--ink-2);
  background: var(--surface); text-decoration: none; border-radius: var(--r-ctl);
  cursor: pointer; font-family: var(--sans); }
.chip--on { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.chip--sm { min-height: 44px; font-size: 12px; padding: 6px 12px; border-radius: 10px; }

/* ---------------------------------------------------------------- the logger */
.setrow { display: grid; grid-template-columns: 14px 1fr 1fr 46px; gap: 6px;
  align-items: center; padding: 7px 0; border-bottom: 1px solid var(--divider); }
.setrow:last-of-type { border-bottom: none; }
.setrow__i { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.setrow__h { display: grid; grid-template-columns: 14px 1fr 1fr 46px; gap: 6px;
  padding-bottom: 6px; }
.setrow__h span { font-family: var(--mono); font-size: 9.5px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-3); text-align: center; }
.setrow__h span:first-child { text-align: left; }

/* Stepper — one tap per plate, no keyboard. Sized so "102.5" fits at 375px. */
.stepper { display: grid; grid-template-columns: 32px minmax(0, 1fr) 32px; align-items: center;
  background: var(--raised); border-radius: var(--r-ctl); }
.step { position: relative; min-height: 46px; border: none; background: transparent;
  color: var(--ink-2); font-size: 20px; line-height: 1; cursor: pointer;
  font-family: var(--sans); border-radius: var(--r-ctl);
  -webkit-tap-highlight-color: transparent; padding: 0; }
/* 32px visually so the number fits; 44px hit area so it still meets the minimum. */
.step::after { content: ""; position: absolute; top: 0; bottom: 0; left: -6px; right: -6px; }
.step:active { background: var(--surface); }
.val { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 19px;
  letter-spacing: -.05em; text-align: center; background: none; border: none;
  color: var(--ink-3); width: 100%; min-width: 0; padding: 8px 0; min-height: 46px;
  cursor: pointer; }
.val--done { color: var(--ink); font-weight: 600; }

.tick { width: 46px; height: 46px; border: none; background: var(--raised);
  display: grid; place-items: center; font-size: 19px; color: var(--on-accent); cursor: pointer;
  border-radius: var(--r-ctl); -webkit-tap-highlight-color: transparent; }
.tick::before { content: ""; width: 11px; height: 11px; border-radius: 50%;
  border: 1.5px solid var(--ink-3); }
.tick.on { background: var(--accent); font-weight: 700; }
.tick.on::before { display: none; }
/* Out-of-order sets: visibly unavailable, not silently ignored. */
.tick--off { opacity: .32; cursor: not-allowed; }
.btn:disabled { opacity: .3; cursor: not-allowed; }

.repeat { display: flex; align-items: center; gap: 12px; background: var(--surface);
  border-radius: var(--r-panel); padding: 13px 14px; }
.repeat__l { font-family: var(--mono); font-size: 11px; color: var(--ink-2); line-height: 1.45; }
.repeat__l b { color: var(--ink); font-weight: 500; }
.repeat__b { margin-left: auto; flex: none; min-height: 44px; font-size: 13px;
  font-weight: 700; background: var(--accent); color: var(--on-accent); border: none;
  padding: 10px 17px; cursor: pointer; font-family: var(--sans); border-radius: var(--r-ctl); }

.rest { display: flex; align-items: center; gap: 14px; background: var(--surface);
  border-radius: var(--r-panel); padding: 13px 14px; box-shadow: inset 0 0 0 2px var(--accent); }
.rest.over { box-shadow: inset 0 0 0 2px var(--p25); }
.rest__t { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 26px;
  letter-spacing: -.03em; }
.rest.over .rest__t { color: var(--p25); }
.rest__l { font-size: 12px; color: var(--ink-2); }
.ring { width: 44px; height: 44px; flex: none; transform: rotate(-90deg); }
.ring__t { fill: none; stroke: var(--raised); stroke-width: 4; }
.ring__p { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; }
.rest.over .ring__p { stroke: var(--p25); }

.next { background: var(--surface); border-radius: var(--r-panel); padding: 13px 14px;
  display: flex; flex-direction: column; gap: 5px; border-left: 5px solid var(--ink-3); }
.next.stay { border-left-color: var(--p10); }
.next.move { border-left-color: var(--p15); }
.next__nm { font-size: 15px; font-weight: 700; letter-spacing: -.02em; }
.next__k { font-family: var(--mono); font-size: 11px; color: var(--ink-2); }

.leg { background: var(--surface); border-radius: var(--r-panel); padding: 14px;
  border-left: 5px solid var(--p20); }
.leg__hd { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.leg__tag { font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--p20);
  text-transform: uppercase; }
.leg__nm { font-size: 14.5px; font-weight: 700; letter-spacing: -.015em; }
.leg__kit { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); margin-top: 2px; }

/* A button now, not a div — it explains itself when tapped. Needs the UA button
   styling reset or it renders with a border and the platform's own font. */
.sync { position: fixed; left: 50%; transform: translateX(-50%); bottom: 100px; z-index: 20;
  font-family: var(--mono); font-size: 11.5px; padding: 11px 18px; border-radius: 999px;
  background: var(--accent); color: var(--on-accent); display: none;
  border: none; cursor: pointer; -webkit-appearance: none; appearance: none; }
.sync.show { display: block; }

/* ---------------------------------------------------------------- ladder */
.rung { display: flex; align-items: flex-start; gap: 12px; padding: 11px 0; position: relative; }
.rung__rail { width: 10px; flex: none; align-self: stretch; display: flex; justify-content: center; }
.rung__rail::before { content: ""; width: 2px; background: var(--divider); border-radius: 2px; }
.rung__dot { position: absolute; left: 1px; top: 16px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--divider); }
.rung--beginner .rung__dot { background: var(--p10); }
.rung--intermediate .rung__dot { background: var(--p20); }
.rung--advanced .rung__dot { background: var(--p25); }
.rung__nm { font-size: 15px; font-weight: 600; letter-spacing: -.015em;
  text-decoration: none; color: inherit; }
.rung__why { font-size: 12.5px; color: var(--ink-2); margin-top: 4px; line-height: 1.45; }
.rung__unlock { font-family: var(--mono); font-size: 10.5px; color: var(--p15); margin-top: 5px; }
.rung--now { background: var(--raised); border-radius: var(--r-ctl); padding: 12px 12px;
  margin: 2px -6px; }
.locked { background: var(--surface); border-radius: var(--r-panel); padding: 18px;
  display: flex; flex-direction: column; gap: 12px; }

/* ---------------------------------------------------------------- forms */
.input { width: 100%; min-height: var(--tap); background: var(--raised);
  border: none; border-radius: var(--r-ctl); padding: 13px 14px; color: var(--ink);
  font-family: var(--sans); font-size: 16px;
  /* Without this, type="search" and type="date" render with the platform's own
     white chrome and ignore the background above. */
  -webkit-appearance: none; appearance: none; }
.input::placeholder { color: var(--ink-3); }
.input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
/* 16px is a hard floor on every focusable field: below it, iOS Safari zooms the
   page to "help" the moment the field is focused, and then leaves it zoomed. */
.input--sm { min-height: 44px; padding: 10px 12px; font-size: 16px; }
.input.num, input.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.field2 { display: flex; flex-direction: column; gap: 6px; }
.field2 > span { font-family: var(--mono); font-size: 10px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-3); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.search { display: flex; gap: 8px; }

.seg { display: flex; background: var(--raised); border-radius: var(--r-ctl); padding: 4px;
  gap: 4px; }
.seg label { flex: 1; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: flex; align-items: center; justify-content: center; min-height: 44px;
  text-align: center; font-size: 13.5px; font-weight: 600; color: var(--ink-2);
  padding: 8px 4px; cursor: pointer; border-radius: 9px; }
.seg input:checked + span { background: var(--accent); color: var(--on-accent); }
.seg input:focus-visible + span { outline: 2.5px solid var(--ink); outline-offset: 2px; }

.opt { display: flex; align-items: flex-start; gap: 12px; background: var(--surface);
  border-radius: var(--r-panel); padding: 15px; cursor: pointer; }
.opt input { margin-top: 3px; accent-color: var(--accent); flex: none; width: 18px; height: 18px; }
.opt b { display: block; font-size: 15px; font-weight: 700; letter-spacing: -.02em; }
.opt small { display: block; font-size: 12.5px; color: var(--ink-2); line-height: 1.45; margin-top: 4px; }
.opt:has(input:checked) { background: var(--raised); box-shadow: inset 0 0 0 2px var(--accent); }

.check { display: flex; align-items: center; gap: 12px; padding: 11px 0;
  border-bottom: 1px solid var(--divider); cursor: pointer; min-height: var(--tap); }
.check:last-child { border-bottom: none; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check__b { width: 26px; height: 26px; background: var(--raised); flex: none;
  display: grid; place-items: center; border-radius: 8px; }
.check input:checked + .check__b { background: var(--accent); }
.check input:checked + .check__b::after { content: "✓"; color: var(--on-accent);
  font-size: 14px; font-weight: 700; }
.check input:focus-visible + .check__b { outline: 2.5px solid var(--ink); outline-offset: 2px; }
.check__n { font-size: 14.5px; font-weight: 600; }
.check__m { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); margin-top: 2px; }

.chipbox { display: inline-block; cursor: pointer; }
.chipbox input { position: absolute; opacity: 0; pointer-events: none; }
.chipbox span { display: inline-flex; align-items: center; min-height: 44px; font-size: 13px;
  padding: 8px 14px; background: var(--surface); color: var(--ink-2); border-radius: var(--r-ctl); }
.chipbox input:checked + span { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.chipbox input:focus-visible + span { outline: 2.5px solid var(--ink); outline-offset: 2px; }

/* ---------------------------------------------------------------- data */
.sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sumi { background: var(--surface); border-radius: var(--r-ctl); padding: 14px 12px; }
.sumi__v { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 26px;
  letter-spacing: -.045em; line-height: 1; }
.sumi__u { font-size: 12px; color: var(--ink-3); letter-spacing: 0; }
.sumi__k { font-size: 9.5px; color: var(--ink-3); font-family: var(--mono);
  letter-spacing: .14em; text-transform: uppercase; margin-top: 8px; }

.chart { width: 100%; height: 96px; display: block; }
.chart__line { fill: none; stroke: var(--accent); stroke-width: 2;
  stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.bar { flex: 1; height: 8px; background: var(--raised); position: relative; margin: 0 12px;
  border-radius: 999px; overflow: hidden; }
.bar::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w);
  background: var(--accent); border-radius: 999px; }

.mapr__s { width: 28px; height: 28px; display: grid; place-items: center; font-size: 11px;
  flex: none; background: var(--raised); color: var(--ink-3); font-family: var(--mono);
  border-radius: 9px; }
.mapr__s--done { background: var(--accent); color: var(--on-accent); }

/* ---------------------------------------------------------------- chrome */
.steps { display: flex; gap: 6px; padding: 20px 18px 0; }
.steps i { height: 4px; flex: 1; background: var(--raised); border-radius: 999px; }
.steps i.on { background: var(--accent); }

.trial { display: block; text-align: center; font-family: var(--mono); font-size: 10.5px;
  letter-spacing: .1em; text-transform: uppercase; background: var(--accent); color: var(--on-accent);
  padding: 9px; text-decoration: none; }

.tabs { position: fixed; bottom: 0; left: 0; right: 0; max-width: 480px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(4, 1fr); background: var(--paper);
  border-top: 1px solid var(--divider); padding: 8px 6px 18px; z-index: 10; }
.tab { display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 10px;
  color: var(--ink-3); text-decoration: none; min-height: var(--tap);
  font-family: var(--mono); letter-spacing: .05em; text-transform: uppercase; }
.tab svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round; }
.tab.on { color: var(--ink); font-weight: 700; }

.term { border-bottom: 1.5px dotted var(--ink-2); cursor: help; }

/* Prescription note shown above the sets — the RPE cap you need before set one. */
.cue { margin: 0; font-size: 13px; line-height: 1.45; color: var(--ink);
  background: var(--surface); border-left: 5px solid var(--p15);
  border-radius: var(--r-ctl); padding: 11px 13px; overflow-wrap: anywhere; }
/* The cue carries a rendered note, so it holds paragraphs and lists rather than a
   single run of text. Tighter than .note — it is read standing over a dumbbell. */
.cue > :first-child { margin-top: 0; }
.cue > :last-child { margin-bottom: 0; }
.cue p { margin: 0 0 7px; }
.cue ul { margin: 0 0 7px; padding-left: 16px; }
.cue li { margin: 0 0 2px; }
.cue li::marker { color: var(--ink-3); }
.cue b, .cue strong { font-weight: 700; }
.cue a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.prose { font-size: 13.5px; line-height: 1.55; color: var(--ink-2); margin: 0;
  white-space: pre-wrap; }
.prose b, .prose strong { color: var(--ink); }

/* ================================================================ palettes
   Each theme restates the grounds, the plate ramp and the accent, in both
   schemes. `:root[data-theme=…]` outranks the bare `:root` defaults above,
   including inside the dark media query, so no !important is needed anywhere.

   The washes (--pXX-w) are backgrounds for coloured pills. They are tinted
   toward that theme's paper rather than being one shared set, because a wash
   mixed for cream paper looks dirty on white. */

/* ---- Carbon: cool neutrals, maximum contrast, nothing decorative ---- */
:root[data-theme="carbon"] {
  --paper: #FFFFFF; --surface: #F3F4F6; --raised: #E6E8EB;
  --ink: #0C0E11; --ink-2: #474D55; --ink-3: #808891; --divider: #E0E3E6;
  --p10: #2E7D50; --p15: #9E7213; --p20: #2A5FB4; --p25: #B03028;
  --p10-w: #E6F1EA; --p15-w: #F6EFDA; --p20-w: #E4EAF6; --p25-w: #F9E5E2;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="carbon"] {
    --paper: #08090A; --surface: #101214; --raised: #1A1D21;
    --ink: #F6F7F8; --ink-2: #9AA1A9; --ink-3: #676E76; --divider: #1F2226;
    --p10: #4FA871; --p15: #D9A32E; --p20: #5B8FE0; --p25: #D9584B;
    --p10-w: #142218; --p15-w: #241E10; --p20-w: #141D2C; --p25-w: #281514;
  }
}

/* ---- Blueprint: cool blue-greys, like squared paper. Ink is near-navy ---- */
:root[data-theme="blueprint"] {
  --paper: #F7F9FC; --surface: #EBF0F7; --raised: #DCE4EF;
  --ink: #0F1B2D; --ink-2: #4A5A6E; --ink-3: #7B8CA2; --divider: #D8E0EB;
  --p10: #1E7A4C; --p15: #96690F; --p20: #2451A8; --p25: #AE2E24;
  --p10-w: #E1EFE8; --p15-w: #F4EBD6; --p20-w: #E1E9F7; --p25-w: #F8E4E1;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="blueprint"] {
    --paper: #080C12; --surface: #101720; --raised: #1A2430;
    --ink: #E9EFF6; --ink-2: #94A5B8; --ink-3: #62748A; --divider: #1D2732;
    --p10: #4FA871; --p15: #D9A32E; --p20: #7CA9F5; --p25: #E0655A;
    --p10-w: #12241A; --p15-w: #241E0F; --p20-w: #14202F; --p25-w: #2A1614;
  }
}

/* ---- Ledger: cream and sepia. A training notebook ---- */
:root[data-theme="ledger"] {
  --paper: #FDF9F0; --surface: #F4EDDF; --raised: #EAE0CC;
  --ink: #221C13; --ink-2: #5C5040; --ink-3: #8E8271; --divider: #E4D9C5;
  --accent: #6B4A22; --on-accent: #FDF9F0;
  --p10: #3D6B45; --p15: #8A6612; --p20: #34597F; --p25: #9B3B2C;
  --p10-w: #E7EEE2; --p15-w: #F5EBD4; --p20-w: #E4EBF1; --p25-w: #F6E3DD;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="ledger"] {
    --paper: #12100C; --surface: #1A1712; --raised: #26221A;
    --ink: #F2EADB; --ink-2: #A99C87; --ink-3: #776D5C; --divider: #2C2720;
    --accent: #D8A25C; --on-accent: #1B1409;
    --p10: #6FA678; --p15: #D9A83E; --p20: #6E9BC4; --p25: #D96F5C;
    --p10-w: #1A2419; --p15-w: #262010; --p20-w: #16202A; --p25-w: #2A1813;
  }
}

/* ---- Rack: Chalk's grounds, but the primary action takes the blue plate.
        The one theme where the accent is deliberately ramp colour — the whole
        idea is that the button looks like a 20 kg plate. ---- */
:root[data-theme="rack"] {
  --paper: #FAFAF8; --surface: #F1F1EE; --raised: #E7E7E3;
  --ink: #17181A; --ink-2: #565B62; --ink-3: #898F97; --divider: #E1E1DD;
  --accent: #2E63B8; --on-accent: #FFFFFF;
  --p10: #2F7D51; --p15: #A87A15; --p20: #2E63B8; --p25: #B4342A;
  --p10-w: #E4F0E9; --p15-w: #F7EFD9; --p20-w: #E3EAF7; --p25-w: #F8E4E1;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="rack"] {
    --paper: #0A0B0D; --surface: #131519; --raised: #1E2127;
    --ink: #F0F0EE; --ink-2: #A2A7AF; --ink-3: #6F757D; --divider: #23262C;
    --accent: #5B8FE0; --on-accent: #07101E;
    --p10: #4FA871; --p15: #D9A32E; --p20: #5B8FE0; --p25: #D9584B;
    --p10-w: #16281D; --p15-w: #292211; --p20-w: #162030; --p25-w: #2A1614;
  }
}

/* ---- Volt: quiet greys, one electric accent. Violet rather than the obvious
        lime — a green accent would collide with green-means-easy. ---- */
:root[data-theme="volt"] {
  --paper: #FAFAFA; --surface: #F0F1EF; --raised: #E4E6E1;
  --ink: #121410; --ink-2: #4F5449; --ink-3: #878C80; --divider: #E0E2DC;
  --accent: #6D28D9; --on-accent: #FFFFFF;
  --p10: #2F7D51; --p15: #A16207; --p20: #2E5FA8; --p25: #B03028;
  --p10-w: #E5F0E9; --p15-w: #F7EFD9; --p20-w: #E3E9F6; --p25-w: #F9E5E2;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="volt"] {
    --paper: #0A0B09; --surface: #121410; --raised: #1C1F18;
    --ink: #F1F3EC; --ink-2: #A0A698; --ink-3: #6D7367; --divider: #21251D;
    --accent: #A78BFA; --on-accent: #170A2E;
    --p10: #4FA871; --p15: #D9A32E; --p20: #5B8FE0; --p25: #D9584B;
    --p10-w: #142219; --p15-w: #242010; --p20-w: #151F2E; --p25-w: #281514;
  }
}

/* ---- Ember: warm neutrals, burnt orange. p25 is pushed to crimson here so
        difficulty-red stays distinct from accent-orange. ---- */
:root[data-theme="ember"] {
  --paper: #FDFAF7; --surface: #F5EEE7; --raised: #EBE2D8;
  --ink: #1A1512; --ink-2: #5E5148; --ink-3: #94867B; --divider: #E6DBD0;
  --accent: #C2410C; --on-accent: #FFF7ED;
  --p10: #2F7D51; --p15: #A87A15; --p20: #2E63B8; --p25: #9F1239;
  --p10-w: #E6F0E9; --p15-w: #F7EFD9; --p20-w: #E4EAF6; --p25-w: #F8E1E7;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="ember"] {
    --paper: #0D0A08; --surface: #17120F; --raised: #221B16;
    --ink: #F4EDE7; --ink-2: #A99A8E; --ink-3: #7A6C61; --divider: #261E19;
    --accent: #FB923C; --on-accent: #1F1004;
    --p10: #4FA871; --p15: #D9A32E; --p20: #5B8FE0; --p25: #F0688E;
    --p10-w: #14231A; --p15-w: #252010; --p20-w: #151F2D; --p25-w: #2B1420;
  }
}

/* ================================================================ shapes
   Geometry only. A shape never changes a colour — that is what makes the two
   axes independent, and why seven palettes don't have to be built four times. */

/* ---- Sharp: square corners and a hairline rule. Denser, more technical ---- */
:root[data-shape="sharp"] {
  --r-panel: 3px; --r-btn: 3px; --r-ctl: 3px; --r-pill: 2px;
  --card-line: inset 0 0 0 1px var(--divider);
  --pad-card: 14px; --pad-page: 16px; --gap-main: 11px;
  --font-base: 15.5px; --font-head: 27px; --tap: 46px;
}
:root[data-shape="sharp"] .head__t { letter-spacing: -.02em; }
:root[data-shape="sharp"] .chip--sm,
:root[data-shape="sharp"] .check__b,
:root[data-shape="sharp"] .mapr__s,
:root[data-shape="sharp"] .seg span { border-radius: 2px; }
:root[data-shape="sharp"] .bar,
:root[data-shape="sharp"] .bar::after,
:root[data-shape="sharp"] .steps i,
:root[data-shape="sharp"] .sync { border-radius: 2px; }

/* ---- Outline: cards drawn with a single line and nothing filled. The lightest
        option, and the one that needs the most help — most controls get their
        shape from a fill, so they are unfilled here too or the page reads as
        outlined cards full of solid blocks. ---- */
:root[data-shape="outline"] {
  --r-panel: 14px; --r-btn: 12px; --r-ctl: 10px; --r-pill: 8px;
  --card-bg: transparent;
  --card-line: inset 0 0 0 1px var(--divider);
  --pad-card: 15px; --pad-page: 18px; --gap-main: 12px;
  --font-base: 16px; --font-head: 28px; --tap: 48px;
}
:root[data-shape="outline"] .chip,
:root[data-shape="outline"] .chipbox span,
:root[data-shape="outline"] .input,
:root[data-shape="outline"] .stepper,
:root[data-shape="outline"] .tick,
:root[data-shape="outline"] .check__b,
:root[data-shape="outline"] .seg,
:root[data-shape="outline"] .sumi,
:root[data-shape="outline"] .repeat,
:root[data-shape="outline"] .next,
:root[data-shape="outline"] .leg,
:root[data-shape="outline"] .opt,
:root[data-shape="outline"] .locked,
:root[data-shape="outline"] .cue {
  background: transparent; box-shadow: inset 0 0 0 1px var(--divider);
}
/* Selected states must still read as filled, or nothing on the page looks chosen. */
:root[data-shape="outline"] .chip--on,
:root[data-shape="outline"] .chipbox input:checked + span,
:root[data-shape="outline"] .seg input:checked + span,
:root[data-shape="outline"] .tick.on,
:root[data-shape="outline"] .check input:checked + .check__b {
  background: var(--accent); box-shadow: none;
}
:root[data-shape="outline"] .rest,
:root[data-shape="outline"] .card--active,
:root[data-shape="outline"] .opt:has(input:checked) {
  box-shadow: inset 0 0 0 2px var(--accent);
}
:root[data-shape="outline"] .rung--now { background: transparent;
  box-shadow: inset 0 0 0 1px var(--divider); }

/* ---- Compact: soft shapes, tighter spacing. More on screen per scroll ---- */
:root[data-shape="compact"] {
  --r-panel: 14px; --r-btn: 11px; --r-ctl: 10px; --r-pill: 8px;
  --card-bg: var(--surface); --card-line: none;
  --pad-card: 12px; --pad-page: 14px; --gap-main: 9px;
  --font-base: 15px; --font-head: 23px; --tap: 44px;
}
:root[data-shape="compact"] .head { padding-top: 16px; padding-bottom: 10px; }
:root[data-shape="compact"] .row { padding: 9px 0; }
:root[data-shape="compact"] .setrow { padding: 5px 0; }
:root[data-shape="compact"] .sumi { padding: 11px 10px; }
:root[data-shape="compact"] .sumi__v { font-size: 22px; }
:root[data-shape="compact"] .row__n { font-size: 14px; }
:root[data-shape="compact"] .tabs { padding: 6px 6px 14px; }

/* ================================================================ notes
   Pasted coaching text: what to be careful of, and the video that shows it.
   Rendered by app/notes.py — escaped first, links added after. */
.note { font-size: 13.5px; line-height: 1.55; color: var(--ink-2); margin: 0;
  overflow-wrap: anywhere; }
.note > :first-child { margin-top: 0; }
.note > :last-child { margin-bottom: 0; }
.note p { margin: 0 0 10px; }
.note ul { margin: 0 0 10px; padding-left: 17px; }
.note li { margin: 0 0 3px; }
.note li::marker { color: var(--ink-3); }
.note b, .note strong { color: var(--ink); font-weight: 600; }
/* Links look like links. A note's whole reason to exist is often the video in it. */
.note a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px;
  text-decoration-thickness: 1px; }
.note--tight { font-size: 12.5px; }

/* The mid-session notes sheet. Fixed rather than inline: it has to be reachable
   from any exercise without scrolling away from the set you're logging, and it
   has to close back to exactly where you were. */
.sheet { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end;
  justify-content: center; background: rgba(0, 0, 0, .45); }
.sheet[hidden] { display: none !important; }
.sheet__p { width: 100%; max-width: 480px; max-height: 82vh; overflow-y: auto;
  background: var(--paper); border-radius: var(--r-panel) var(--r-panel) 0 0;
  padding: 18px var(--pad-page) calc(18px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 14px; }
.sheet__h { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet__x { background: var(--raised); color: var(--ink); border: none; cursor: pointer;
  min-height: 40px; padding: 8px 15px; border-radius: var(--r-ctl); font-size: 13px;
  font-family: var(--sans); font-weight: 600; }

/* ---------------------------------------------------------------- kit editor */
/* Weight, count, name. Three columns rather than a chip per size, because the
   count is the part that was missing and a chip can't hold it. */
.kit { display: flex; flex-direction: column; gap: 6px; }
.kit__r, .kit__h { display: grid; grid-template-columns: 1fr 1fr 1.5fr; gap: 6px; }
.kit__h span { font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-3); padding-left: 2px; }

/* ---------------------------------------------------------------- appearance */
.swatch { display: flex; margin-left: auto; flex: none; border-radius: var(--r-pill);
  overflow: hidden; box-shadow: inset 0 0 0 1px var(--divider); }
.swatch i { width: 22px; height: 34px; display: block; }

/* Collapsible sections — notes, mostly. The default triangle is inconsistent
   across platforms and drags the label off its baseline. */
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary .chev { transform: rotate(90deg); }
.chev { transition: transform .15s ease; }

/* A row whose whole surface is the submit button — used where a list item starts
   a session rather than navigating. */
.rowform { display: contents; }
.rowbtn { display: flex; align-items: center; gap: 12px; padding: 12px 0;
  min-height: var(--tap); }
.rowbtn:disabled { opacity: .4; cursor: not-allowed; }

/* ---------------------------------------------------------------- your notes */
/* Kept visually apart from .cue. The cue is the programme talking; this is you,
   so it gets the neutral rail rather than the prescription's amber one. */
.mine { display: flex; flex-direction: column; gap: 8px; }
.mine__r { display: flex; align-items: flex-start; gap: 10px; background: var(--surface);
  border-left: 5px solid var(--p20); border-radius: var(--r-ctl); padding: 11px 13px; }
.mine__r .note { flex: 1; min-width: 0; }
.mine__r .chip { flex: none; }

/* One limb at a time */
.sidebar { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 10px; }
/* The first side of a split set carries the divider; the second sits tight under it
   so a set reads as one block of two lines rather than two unrelated rows. */
.setrow--top { border-bottom: none; padding-bottom: 2px; }
.setrow--top + .setrow { padding-top: 2px; }

/* A rung that has not been reviewed says so. Deliberately not styled as an error —
   it is usable content — but it must never read as curated. */
.rung__draft { display: block; font-size: 11.5px; line-height: 1.4; margin-top: 5px;
  color: var(--p15); }
