  :root {
    --bg: #faf9f6;
    --surface: #ffffff;
    --ink: #1a1a18;
    --muted: #6b6459;
    --line: #e0ddd4;
    --accent: #2f5d7c;
    --accent-soft: #e3edf4;
    --liss: #6b5d4f;
    --liss-soft: #ede7de;
    --done: #2f5d7c;
    --partial: #5b8db0;
    --content-max: 720px;
    --fill-strong: #234a63; color-scheme: light;
  }
  :root[data-theme="dark"] {
    --bg: #0e0e0d;
    --surface: #1c1c1a;
    --ink: #f2efe8;
    --muted: #a39d8e;
    --line: #38352c;
    --accent: #6fa8d6;
    --accent-soft: #12222e;
    --liss: #b8a68e;
    --liss-soft: #2a2620;
    --done: #6fa8d6;
    --partial: #7fa3c4;
    --fill-strong: #1d4563; color-scheme: dark;
  }
  * { box-sizing: border-box; }
  .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;
  }
  body {
    margin: 0;
    transition: background-color 0.2s ease, color 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.4;
    padding-bottom: 60px;
  }

  /* ---- shared button base (was duplicated across 4 selectors) ---- */
  .btn {
    border: 1px solid var(--line);
    background: var(--surface);
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 0.82rem;
    cursor: pointer;
    color: var(--muted);
    white-space: nowrap;
    font-family: inherit;
  }
  .btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }

  header {
    padding: 24px 20px 14px;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 10;
  }
  h1 { margin: 0 0 4px; font-size: 1.35rem; font-weight: 700; }
  .title-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
  .text-input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 0.85rem;
    font-family: inherit;
    background: var(--surface);
    color: var(--ink);
  }
  .subtitle { margin: 0 0 14px; color: var(--muted); font-size: 0.88rem; }

  main { max-width: var(--content-max); margin: 0 auto; padding: 20px; }

  /* ---- progress bar ---- */

  .exercise-row { padding: 12px 0; border-bottom: 1px solid var(--line); transition: opacity 0.2s ease; scroll-margin-top: 150px; }
  .exercise-row:last-child { border-bottom: none; }

  /* Toggle-button glyphs follow existing state (body.icons-hidden /
     :root[data-theme]) purely in CSS — no inline styles, no JS needed. */
  .exercise-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
  .exercise-name { font-weight: 600; font-size: 0.95rem; }
  .exercise-target { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
  .exercise-note { font-size: 0.8rem; color: var(--muted); font-style: italic; margin-top: 2px; }

  .liss-card { background: var(--liss-soft); border-radius: 12px; padding: 18px; }
  .liss-card h2 { margin: 0 0 6px; font-size: 1.05rem; color: var(--liss); }
  .liss-card p { margin: 4px 0; font-size: 0.88rem; color: var(--ink); }

  footer {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 10px 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--muted);
    font-size: 0.8rem;
  }

  /* ---- view tabs (Tracker / Guide) ---- */
  .view-tabs {
    display: flex;
    overflow-x: auto;  /* safety net: scroll rather than clip if a tab ever overflows */
    gap: 4px;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 10px 20px 0;
    border-bottom: 1px solid var(--line);
  }
  .view-tab {
    border: none;
    background: none;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--muted);
    padding: 8px 4px 10px;
    margin-right: 16px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
  }
  .view-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

  /* ---- guide view ---- */

  .day-chips-head { display: flex; justify-content: space-between; width: 100%; font-size: 0.78rem; color: var(--muted); margin-top: 4px; }
  .day-chips { display: flex; gap: 6px; flex-wrap: wrap; }
  .day-chip { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 8px; padding: 7px 10px; font-size: 0.82rem; font-family: inherit; cursor: pointer; min-width: 44px; }
  .day-chip.active { background: var(--fill-strong); border-color: var(--fill-strong); color: white; }
  .day-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

  /* ---- 12-week heatmap ---- */
  .heatmap {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(7, 11px);
    gap: 3px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  /* ---- motion ---- */

  /* ---- settings (in-flow tab, not a popover) ---- */
  .settings-row { padding: 16px 0; border-bottom: 1px solid var(--line); }
  .settings-row:first-child { padding-top: 0; }
  .settings-row:last-child { border-bottom: none; padding-bottom: 0; }
  .settings-row:not(.settings-stack) { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
  .settings-label { font-size: 0.9rem; font-weight: 600; color: var(--ink); }

  /* ---- completed exercise dimming + current-exercise anchor ---- */

  /* ---- confetti burst (small, on-brand, decorative only) ---- */

  /* Header spans the full viewport (for its sticky background + border)
     but its contents align to the same column as everything below. */
  header > .title-row,
  header > .subtitle {
    max-width: var(--content-max);
    margin-left: auto;
    margin-right: auto;
  }

  /* Phones. Reclaim vertical space in the sticky header, and stop the
     exercise name/target pair from colliding on a narrow column. */
  @media (max-width: 560px) {
    header { padding: 14px 16px 10px; }
    h1 { font-size: 1.1rem; margin-bottom: 2px; }
    .subtitle { display: none; }
    main { padding: 16px; }
    .view-tab { margin-right: 10px; }  /* four tabs must fit a 320px phone */
    .view-tabs { padding: 8px 16px 0; }
    footer { padding: 10px 16px 24px; flex-direction: column; align-items: flex-start; gap: 10px; }
    .exercise-top { flex-direction: column; align-items: flex-start; gap: 1px; }
    .exercise-target { white-space: normal; }
    .settings-row { padding: 12px 0; }
  }

  /* iOS zooms the page in when focusing an input under 16px. Applies to
     touch devices at any width, so it is kept out of the width query. */
  @media (pointer: coarse) {
    .text-input { font-size: 16px; }
    .btn { padding: 9px 14px; }
    .view-tab { padding: 10px 4px 12px; }
  }

  /* Large desktops: widen the column a little rather than stranding the
     content in a narrow strip. */
  @media (min-width: 1100px) {
    :root { --content-max: 860px; }
  }

  /* ---- two-column layout: Tracker content + a permanently-visible
     progress sidebar, once there's genuinely room for both. Below this
     width, everything is untouched — single column, progress panel still
     toggled via the "Progress" button exactly as before. ---- */
  @media (min-width: 900px) {
  }

  /* Kettlebell additions */
  .chip-row { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; }
  .session-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
  .session-card h2 { margin: 0 0 4px; font-size: 1.1rem; }
  .session-meta { color: var(--muted); font-size: 0.85rem; margin: 0 0 8px; }
  .session-note { color: var(--muted); font-size: 0.85rem; margin: 12px 0 0; }

  /* Timers */
  .timer-panel { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); text-align: center; }
  .timer-display { font-size: 3.4rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
  .timer-sub { color: var(--muted); font-size: 0.9rem; margin: 4px 0 10px; min-height: 1.2em; }
  .timer-target { font-size: 1.1rem; font-weight: 600; color: var(--accent); min-height: 1.4em; }
  .timer-controls { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
  .btn-primary { background: var(--fill-strong); border-color: var(--fill-strong); color: #fff; }
  .timer-controls [hidden], .timer-sub[hidden] { display: none; }

  /* Logging */
  .log-card { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
  .log-card h3 { margin: 0 0 6px; font-size: 1rem; }
  .log-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .log-field { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--muted); }
  .log-field.wide { grid-column: 1 / -1; }
  .day-chip.logged { border-color: var(--done); color: var(--done); }
  .day-chip.logged::after { content: " \2713"; }

  /* Progress */
  .kb-bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin: 6px 0 12px; }
  .kb-fill { height: 100%; background: var(--accent); }
  .kb-heat { display: grid; grid-template-columns: 2.2rem repeat(7, 1fr); gap: 4px; margin: 12px 0; }
  .kb-lab { font-size: 0.75rem; color: var(--muted); display: flex; align-items: center; justify-content: center; }
  .kb-cell { aspect-ratio: 1; border-radius: 4px; border: 1px solid var(--line); }
  .kb-cell.on { background: var(--accent); border-color: var(--accent); }
  .kb-cell.rec { background: var(--liss); border-color: var(--liss); }
  .kb-cell.todo { border-color: var(--accent); }
  .kb-cell.off { border-style: dashed; opacity: 0.4; }
  .kb-cell.now { outline: 2px solid var(--ink); outline-offset: 1px; }
