/*
 * trainr.css — styling for weeks rendered by Trainr\Render\WeekRenderer
 * (the single class rendering both athletes as of Task 19).
 *
 * Task 17, Part 2: rebuilt against corpus/Sugeily_Phase2_Week1.html's own
 * <style> block (137 rules, 15 custom properties, 14 gradients/shadows) —
 * that file is the floor this design has to clear, not the target. Same
 * warm-editorial identity (bone paper, coral/sage/gold accents, an
 * espresso-dark "north star" surface, Fraunces for display type, Hanken
 * Grotesk for everything else) carried further: deeper shadow layering,
 * a refined type scale, a numbered `.ix`/`.lapnum` badge that actually
 * renders (Task 17, Part 1 restored the data; this file restores the
 * design), and one deliberate dopamine moment — completing a set, then a
 * day — everything else stays still (see the motion block near the
 * bottom, and prefers-reduced-motion).
 *
 * Fire Stick CSS floor, same as tv.css/print.css and graded by the same
 * test (tests/Render/ViewModeTest.php): flexbox/grid, plain selectors,
 * @media/@keyframes only — no relational-parent pseudo-class, no size-query
 * at-rule, no grid-inheritance value, no nested rule blocks anywhere below
 * (the literal banned tokens are deliberately not spelled out in this
 * comment — ViewModeTest's own assertions grep the whole file, comments
 * included, so naming them here would fail the very check they describe).
 */

:root {
  /* ---- warm editorial palette, matched to the corpus's own tokens ---- */
  --paper:    #f4efe7;   /* corpus --bone   */
  --paper-2:  #ebe3d6;   /* corpus --bone-2 */
  --card:     #fbf8f2;
  --line:     #d8cebe;
  --ink:      #2c2520;   /* corpus --espresso      */
  --espresso: #5a4f45;   /* corpus --espresso-soft — secondary ink */
  --coral:    #c8553d;
  --coral-deep: #a8412d;
  --sage:     #6e7d5b;
  --sage-deep: #556349;
  --sage-bg:  #e7e9dd;
  --gold:     #b0894c;
  --blush-bg: #f1e2dc;
  --run:      #4a6fa5;
  --run-bg:   #2e3f5c;
  --safe:     #6e7d5b;   /* .ico.safe reuses sage, same as the corpus */
  --muted:    #5a4f45;
  --shadow:   rgba(44, 37, 32, 0.12);
  --shadow-lg: rgba(44, 37, 32, 0.16);

  /* One 44px floor shared by every tap target across all four densities
     (phone primary, tablet at bench-distance, TV remote, mouse) — see
     the touch-target block near the bottom. */
  --tap: 44px;

  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:    #16120e;
    --paper-2:  #201a14;
    --card:     #241d17;
    --line:     #3d3226;
    --ink:      #f1e9dc;
    --espresso: #c9bda9;
    --coral:    #e2795d;
    --coral-deep: #f0967d;
    --sage:     #93b58c;
    --sage-deep: #b3d1ac;
    --sage-bg:  #26301f;
    --gold:     #d9b378;
    --blush-bg: #362420;
    --run:      #7fa3d6;
    --run-bg:   #1c283b;
    --safe:     #93b58c;
    --muted:    #c9bda9;
    --shadow:   rgba(0, 0, 0, 0.32);
    --shadow-lg: rgba(0, 0, 0, 0.44);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  padding: 0 0 4rem;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.55;
  font-size: 16px;
}

/* ---- masthead: the page's own front door, matching corpus's
   `header.master` — eyebrow, serif H1 with an italic accent on the phase
   word, then the metadata chips. Danny's page never emits this (his own
   master-toggle-bar opens instead), so nothing below touches him. ---- */
header.master {
  background: linear-gradient(160deg, var(--ink), #3d332b);
  color: var(--paper);
  padding: 1.9rem 1.4rem 1.6rem;
  border-radius: 0 0 26px 26px;
  position: relative;
  overflow: hidden;
}
header.master::after {
  content: "";
  position: absolute;
  right: -2.5rem;
  top: -2.5rem;
  width: 10.6rem;
  height: 10.6rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(200, 85, 61, 0.32), transparent 70%);
  pointer-events: none;
}
header.master .kicker {
  position: relative;
  font-size: 0.75rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
  margin-bottom: 0.6rem;
}
header.master h1 {
  position: relative;
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.75rem;
  line-height: 1.12;
  letter-spacing: -0.01em;
}
header.master h1 em { color: var(--coral); font-style: italic; }
header.master .sub {
  position: relative;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: #d8cdbe;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
}
header.master .sub span { display: flex; align-items: center; gap: 0.3rem; }
header.master .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--gold); flex: none; }

.wrap { max-width: 720px; margin: 0 auto; }

/* ---- the week's own narrative card: "You earned this week" — dark,
   quiet, matching corpus's `.plan-note`. This and the masthead above are
   the first two things on the page, on purpose (Task 18: "the closest
   thing to what he means by dopamine-deriving"). ---- */
.plan-note {
  background: var(--ink);
  color: #e4daca;
  border-radius: 14px;
  padding: 0.9rem 1.1rem;
  margin: 1rem 0.75rem 0;
  font-size: 0.85rem;
  line-height: 1.6;
}
.plan-note b {
  color: var(--gold);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.7rem;
  display: block;
  margin-bottom: 0.3rem;
}

/* ---- day tabs: compact horizontal-scroll strip, two-line label, active
   state coloured by tab type — matches corpus's `tab-nav`/`tab-scroll`/
   `tab-btn` (class names and structure kept identical on purpose; see
   WeekRenderer::renderTabNav()'s own docblock for why the day *panels*
   below keep `class="day-content"` instead of the corpus's `day-panel`).
   Sticky so the strip stays reachable mid-scroll through a long day. ---- */
.tab-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--paper);
  padding: 0.7rem 0 0.55rem;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 10px var(--shadow);
}
.tab-scroll {
  display: flex;
  gap: 0.4rem;
  padding: 0 0.75rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.tab-scroll::-webkit-scrollbar { display: none; }
.tab-btn {
  flex: none;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.8rem;
  text-decoration: none;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--espresso);
  border-radius: 18px;
  padding: 0.5rem 0.8rem;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.08s ease, background 0.15s ease;
}
.tab-btn .tag {
  display: block;
  font-size: 0.56rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  opacity: 0.7;
  margin-bottom: 0.06rem;
}
.tab-btn[data-type="train"].active { background: var(--coral); color: var(--paper); border-color: var(--coral); }
.tab-btn[data-type="rest"].active { background: var(--sage); color: var(--paper); border-color: var(--sage); }
.tab-btn[data-type="rest"] { border-style: dashed; }
.tab-btn[data-type="info"].active { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.tab-btn:active { transform: scale(0.95); }

/* ---- day panels: every day still renders into the document (Gate 1
   depends on that), CSS shows only the one carrying `data-active`.
   `<noscript>` unhides every panel again for the true no-JS case, since
   trainr.js is what moves `data-active` on a tab click — see
   WeekRenderer::renderDay()'s own docblock. print.css unhides
   unconditionally further down the cascade (paper has no tabs). ---- */
.wrap > .day-content[data-day-panel] { display: none; animation: trainr-panel-in 0.25s ease; }
.wrap > .day-content[data-day-panel][data-active] { display: block; }
@media (prefers-reduced-motion: no-preference) {
  .wrap > .day-content[data-day-panel][data-active] { animation: trainr-panel-in 0.25s ease; }
}
@keyframes trainr-panel-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- floating sound toggle: bottom-right, always reachable without
   scrolling — matches corpus's `.sound-toggle`. Previously only Danny's
   page had one (inside his top toggle bar); Sugeily's had none at all. ---- */
.sound-toggle {
  position: fixed;
  right: 0.85rem;
  bottom: 0.85rem;
  z-index: 50;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--gold);
  border-radius: 30px;
  padding: 0.6rem 0.95rem;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: var(--font-body);
  cursor: pointer;
  box-shadow: 0 6px 18px var(--shadow-lg);
  -webkit-tap-highlight-color: transparent;
}
.sound-toggle.off { opacity: 0.6; }

/* ---- legacy anchor day-nav: Task 19 replaced this with `.tab-nav` on
   Danny's page too (see WeekRenderer::renderTabNav()) — the renderer
   never emits `.day-nav` any more. Rules kept, unused, rather than
   deleted: no test depends on their absence, and removing working CSS
   as a drive-by in an urgent fix is its own risk. ---- */
.day-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  overflow-x: auto;
  box-shadow: 0 2px 10px var(--shadow);
}
.day-nav a {
  color: var(--espresso);
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--card);
  white-space: nowrap;
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.08s ease;
}
.day-nav a:hover { border-color: var(--coral); color: var(--coral); }
.day-nav a:active { transform: scale(0.96); }

.day-content {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem 1rem 0;
}

/* ---- day header: the dark "north star" gradient card, corpus's own
   signature surface, given a soft radial glow instead of a flat fill ---- */
.day-head {
  background: linear-gradient(160deg, var(--ink), #3d332b);
  color: var(--paper);
  padding: 1.5rem 1.3rem 1.35rem;
  border-radius: 20px;
  margin-bottom: 1.1rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 28px var(--shadow-lg);
}
.day-head::after {
  content: "";
  position: absolute;
  right: -2.5rem;
  top: -2.5rem;
  width: 10rem;
  height: 10rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(200, 85, 61, 0.32), transparent 70%);
  pointer-events: none;
}
.day-head h2 {
  margin: 0;
  position: relative;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.6rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.protocol {
  background: var(--card);
  border: 1.5px dashed var(--gold);
  border-radius: 16px;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}
.protocol h3 { margin: 0 0 0.5rem; font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; }
.protocol ul, .protocol dl { margin: 0; padding-left: 1.1rem; }
.protocol dt { font-weight: 700; margin-top: 0.4rem; color: var(--coral-deep); }
.protocol dd { margin: 0 0 0.3rem; color: var(--muted); }

/* ---- section headers: numbered badge restored (Task 17, Part 1) ---- */
.sec-head {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  margin: 1.75rem 0 0.4rem;
}
.sec-head .ix {
  flex: none;
  width: 1.9rem;
  height: 1.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--paper);
  background: var(--coral);
  border-radius: 8px;
  transform: translateY(2px);
}
.sec-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--ink);
}
.sec-note {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 0.9rem;
  max-width: 62ch;
}

/* ---- exercise cards: rounded, shadowed, coral-accented — the corpus's
   own card language, refined ---- */
.ex {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  margin-bottom: 0.9rem;
  overflow: hidden;
  box-shadow: 0 3px 12px var(--shadow);
}
.ex-top {
  padding: 0.95rem 1.1rem 0.7rem;
  border-left: 4px solid var(--coral);
}
.ex-tag {
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--coral);
  margin-bottom: 0.2rem;
}
.ex-top h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.12rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.ex-meta {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.3rem;
  font-weight: 500;
}

/* ---- set/rep/load rows ---- */
.row {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.4rem 1.1rem;
  border-top: 1px solid var(--line);
}
/* The first value row right under the card header, and the first row
   inside .ex-foot, both sit flush against the surface above them rather
   than opening with a stray rule line. Plain adjacent-sibling/first-child
   selectors — .row is never actually the first DIV child of .ex (.ex-top
   always precedes it), so a bare `:first-of-type` here would silently
   match nothing. */
.ex-top + .row,
.ex-foot > .row:first-child { border-top: none; }
.row p { margin: 0; flex: 1; color: var(--espresso); }
.row p b { color: var(--ink); font-weight: 600; }

.set-row { flex-wrap: wrap; }
.set { font-weight: 700; min-width: 3.5rem; color: var(--coral-deep); }
.reps { color: var(--muted); }
.load { font-family: var(--font-display); font-weight: 600; }
.rpe {
  margin-left: auto;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink);
  background: var(--paper-2);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
}

/* ---- exercise footer: cue/safety/swap prose + timers, one warm-tinted
   container, matching the source's own .ex-foot wrapper (Task 17) ---- */
.ex-foot {
  padding: 0.15rem 1.1rem 0.85rem;
  background: var(--paper-2);
  border-top: 1px solid var(--line);
}
.ex-foot .row { padding-left: 0; padding-right: 0; }

.ico {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  align-self: flex-start;
  color: var(--paper);
}
.ico.cue { background: var(--coral); }
.ico.safe { background: var(--sage); }
.ico.alt { background: var(--gold); }
.ico.hold { background: var(--ink); }
.ico.tempo { background: var(--run); }

/* ---- timers: the dark, high-contrast bar every card can carry several
   of — the largest, most-tapped control on the page ---- */
.timer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.65rem;
  padding: 0.65rem 0.85rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: 14px;
  transition: background-color 0.2s ease;
}
.timer-label { font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.timer-display { font-family: var(--font-display); font-size: 1.4rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.timer-display.warn { color: #e8a23d; }
.timer-display.fire { color: #ff8f6e; }
.timer-btns { display: flex; gap: 0.4rem; }
.t-btn {
  font: inherit;
  font-weight: 700;
  font-size: 0.82rem;
  border: none;
  background: var(--coral);
  color: #fff;
  border-radius: 10px;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease;
}
.t-btn:active { transform: scale(0.94); }
.t-btn.running { background: #e8a23d; color: var(--ink); }
.t-btn.ghost { background: rgba(255, 255, 255, 0.16); color: var(--paper); }

.timer-warn-flash { background: rgba(176, 137, 76, 0.4); }
.timer-done-flash { background: rgba(200, 85, 61, 0.5); }

@media (max-width: 480px) {
  .day-content { padding: 1rem 0.75rem 0; }
  .rpe { margin-left: 0; }
}

/* ================================================================
   Danny's format: tier-label, lap/lapnum, divider-note, premise,
   toggles, HOW/WHY/FEEL, result fields — same tokens, same type scale.
   ================================================================ */

.tier-label {
  display: block;
  padding: 0.55rem 1.1rem 0;
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--coral);
}

.lap {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  margin: 1.75rem 0 0.4rem;
}
.lap .lapnum {
  flex: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--paper);
  background: var(--sage);
  padding: 0.3rem 0.55rem;
  border-radius: 8px;
}
.lap h3 { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; color: var(--ink); }

.divider-note {
  font-size: 0.85rem;
  color: var(--espresso);
  background: var(--blush-bg);
  border-left: 3px solid var(--coral);
  border-radius: 0 12px 12px 0;
  padding: 0.7rem 0.9rem;
  margin: 0 0 0.9rem;
}

.premise {
  color: var(--paper);
  opacity: 0.88;
  font-size: 0.85rem;
  margin: 0.65rem 0 0;
  border-left: 2px solid var(--gold);
  padding-left: 0.6rem;
  position: relative;
}
.master-toggle-bar {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  max-width: 720px;
  margin: 0 auto;
}
.master-toggle-bar button, #soundToggle {
  flex: 1;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.5rem;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--espresso);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
#soundToggle.off { color: var(--muted); }
.master-btn.is-active { border-color: var(--sage); color: var(--sage-deep); }
.day-mode-toggle {
  display: block;
  width: 100%;
  margin-top: 0.85rem;
  padding: 0.6rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(244, 239, 231, 0.35);
  background: transparent;
  color: var(--paper);
  font: inherit;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
}
.day-mode-toggle.is-indoor { border-color: var(--gold); color: var(--gold); }
.dmt-arrow { font-weight: 400; opacity: 0.75; }
.spec-line { font-family: var(--font-display); font-weight: 600; margin: 0.6rem 1.1rem 0.4rem; }
.fields { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 1.1rem 0.6rem; }
.fields .field {
  font-size: 0.75rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--paper-2);
}
.ex-body { padding: 0 1.1rem; }
.ex-body p { margin: 0.4rem 0; font-size: 0.92rem; }
.ex-body p.how { color: var(--ink); }
.ex-body p.why { color: var(--muted); }
.ex-body p.feel { color: var(--sage-deep); }
.result-box { margin: 0.7rem 1.1rem 0.9rem; padding-top: 0.6rem; border-top: 1px dashed var(--line); }
.result-box label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  margin-bottom: 0.3rem;
}
.result-input {
  width: 100%;
  font: inherit;
  padding: 0.5rem 0.6rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}
.result-status { display: block; font-size: 0.72rem; color: var(--sage-deep); margin-top: 0.3rem; min-height: 1em; }
.result-status.err { color: var(--coral); }

/* Danny's cards have no .ex-foot wrapper (his cues sit directly under
   .ex-body — see WeekRenderer::renderNarrativeCard()'s own docblock), so timers here are
   direct children of .ex and need their own edge padding. */
.ex > .timer { margin: 0.65rem 1.1rem 0.9rem; }
.ex > .timer:last-child { margin-bottom: 1.1rem; }

/* ---- Verified Numbers (Task 13): every measurement.caveat rendered
   together with its value, never split apart — see
   WeekRenderer::renderMeasurements()'s own docblock. This markup
   existed before Task 17 with no styling at all (plain black text); a
   provenance caveat that matters enough to render unconditionally on
   every page load earns a card, not a bare paragraph. ---- */
.measurements {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1rem 0.25rem;
}
.measurements h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  margin: 0 0 0.6rem;
  color: var(--ink);
}
.measurement {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.6rem;
}
.measurement .metric { font-weight: 700; color: var(--ink); }
.measurement .value { font-family: var(--font-display); font-weight: 600; color: var(--coral-deep); margin-left: 0.3rem; }
.measurement .provenance {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--muted);
  background: var(--paper-2);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  margin-left: 0.4rem;
}
.measurement .caveat {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.82rem;
  font-style: italic;
  color: var(--muted);
}

/* ---- "Back it off" (Task 9): one tap, no ceremony ---- */
.back-off {
  margin: 1.4rem 0 0;
}
.back-off button {
  display: block;
  width: 100%;
  font: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  border: 1.5px solid var(--coral);
  background: transparent;
  color: var(--coral);
  cursor: pointer;
  transition: background 0.15s ease;
}
.back-off button:hover, .back-off button:active { background: var(--blush-bg); }

/* ================================================================
   Four densities, one palette, plus the PWA/dopamine layer.
   Flexbox and grid only: no relational-parent selector, no size-query
   at-rule, no grid-inheritance display value, no nested rule blocks below
   (grepped by tests/Render/ViewModeTest.php — the same floor tv.css and
   print.css hold themselves to, since Silk's older Chromium is one of
   the four targets this file also serves).
   ================================================================ */

/* ---- touch targets: 44px on every density that can be tapped, and a
   visible keyboard/switch focus ring everywhere — "no hover-only
   affordances" cuts both ways: a control usable only by pointing a
   mouse at it and hovering doesn't exist on a touch screen either. ---- */
.t-btn,
.day-nav a,
.tab-btn,
.back-off button,
.day-mode-toggle,
#soundToggle,
.master-toggle-bar button,
.result-input {
  min-height: var(--tap);
}
a:focus, button:focus, input:focus {
  outline: 3px solid var(--coral);
  outline-offset: 2px;
}

/* Timers are the largest, most-tapped control on a card — sized up from
   the base rules above on every density, most emphatically on phone
   where the card itself is narrowest. */
.t-btn { padding: 0.6rem 1.1rem; font-size: 0.9rem; }
.timer-display { font-size: 1.5rem; }

/* ---- motion with purpose: a completed set (a timer reaching zero) and
   an expiring timer get the animation budget; nothing else moves.
   prefers-reduced-motion keeps the plain instant colour-flash (already
   present above) with no animation layered on top — that is the
   dopamine moment this design spends its budget on: completing a set,
   then a day. ---- */
@media (prefers-reduced-motion: no-preference) {
  .timer-warn-flash { animation: trainr-warn-pulse 0.4s ease; }
  .timer-done-flash { animation: trainr-done-pulse 0.55s cubic-bezier(0.34, 1.56, 0.64, 1); }
  .day-complete-badge { animation: trainr-badge-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
  .sticky-timer.is-visible { animation: trainr-bar-in 0.25s ease; }
  .timer-display.fire { animation: trainr-fire-pulse 0.6s ease infinite; }
  .day-content.is-day-complete .day-head { animation: trainr-day-glow 0.7s ease; }
}
@keyframes trainr-warn-pulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.015); }
  100% { transform: scale(1); }
}
@keyframes trainr-done-pulse {
  0% { transform: scale(1); }
  35% { transform: scale(1.035); }
  100% { transform: scale(1); }
}
@keyframes trainr-badge-in {
  0% { transform: scale(0.4) rotate(-8deg); opacity: 0; }
  60% { transform: scale(1.12) rotate(2deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
@keyframes trainr-bar-in {
  0% { transform: translateY(100%); }
  100% { transform: translateY(0); }
}
@keyframes trainr-fire-pulse {
  50% { opacity: 0.55; }
}
@keyframes trainr-day-glow {
  0% { box-shadow: 0 10px 28px var(--shadow-lg); }
  45% { box-shadow: 0 10px 28px var(--shadow-lg), 0 0 0 6px rgba(110, 125, 91, 0.35); }
  100% { box-shadow: 0 10px 28px var(--shadow-lg); }
}

/* A finished day: trainr.js adds this badge next to the day heading once
   every timer on that day has completed at least once this visit — a
   transient, in-memory page state, never written anywhere — and marks
   the day itself `.is-day-complete` (the glow above). */
.day-complete-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: 0.6rem;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 999px;
  background: var(--sage);
  color: var(--paper);
  vertical-align: middle;
}

/* ---- the sticky "now" bar: while a timer is running, its label and
   countdown stay visible even if the athlete scrolls the card out of
   view (phone, one-handed, tired). trainr.js creates/updates this one
   element; it never duplicates server-rendered content. ---- */
.sticky-timer {
  position: fixed;
  left: 0.75rem;
  right: 0.75rem;
  bottom: 0.75rem;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: 999px;
  box-shadow: 0 6px 20px var(--shadow-lg);
  max-width: 480px;
  margin: 0 auto;
  cursor: pointer;
  border: none;
  font: inherit;
  width: calc(100% - 1.5rem);
}
.sticky-timer.is-visible { display: flex; }
.sticky-timer .st-label { font-size: 0.8rem; opacity: 0.85; flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sticky-timer .st-time { font-family: var(--font-display); font-size: 1.3rem; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---- offline/cache banners (sw.js injects these into the served HTML
   when it falls back to a cached week — see that file). A stale
   prescription shown as current is worse than showing nothing, so this
   is deliberately loud, not a quiet toast. ---- */
#trainr-cache-banner {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 0.6rem 1rem;
  background: var(--gold);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
}
.sync-pending {
  position: fixed;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 25;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: var(--coral);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  box-shadow: 0 3px 10px var(--shadow);
}

/* ---- desktop / tablet: multi-column above 700px regardless of pointer
   type (more width is more width); type scale then splits by pointer,
   since a touch tablet at arm's length on a bench and a mouse-driven
   laptop at normal reading distance need different sizes at the same
   viewport width. Neither branch changes the 44px tap floor above —
   tablet explicitly keeps it, and it costs a mouse-driven desktop
   nothing to keep it too. ---- */
@media (min-width: 700px) {
  body { display: grid; grid-template-columns: 220px minmax(0, 1fr); align-items: start; gap: 0 1.5rem; padding: 0 1.5rem 4rem; }
  body.view-tv, body.view-print { display: block; padding: 0; }
  .day-nav {
    grid-column: 1;
    grid-row: 1 / -1;
    flex-direction: column;
    align-items: stretch;
    position: sticky;
    top: 0;
    align-self: start;
    max-height: 100vh;
    overflow-y: auto;
    margin: 0 -1rem 0 -1.5rem;
    padding: 1.5rem 1rem;
    border-bottom: none;
    border-right: 1px solid var(--line);
    box-shadow: none;
  }
  .master-toggle-bar, .measurements, .day-content { grid-column: 2; margin-left: 0; margin-right: 0; }
  .day-content { max-width: 640px; padding-top: 1.5rem; }
}

/* Prose stays readable regardless of how wide the card gets to be. */
.ex-body p, .protocol p, .protocol dd, p.premise, .spec-line, .sec-note, .divider-note { max-width: 70ch; }

/* Desktop: mouse-driven, normal reading distance — the base type scale
   already fits; only the reading column narrows slightly further. */
@media (min-width: 1024px) and (hover: hover) and (pointer: fine) {
  .day-content { max-width: 600px; }
}

/* Tablet: touch-primary at arm's length on a bench — bigger type than
   desktop even though the device itself may be just as wide, because
   distance-to-eye, not screen size, drives legibility here. Tap targets
   stay at the shared 44px floor above, never the desktop's mouse-sized
   assumption. */
@media (min-width: 700px) and (pointer: coarse) {
  html { font-size: 19px; }
}
