/* Shared training UI: Strength/Cardio switch, per-exercise options in the
   routine editor, and the RIR column. Feature styles live in warmup.css,
   progression.css and cardio.css. */
.train-switch { margin: -6px 0 16px; }
.train-switch .seg { font-size: 13px; font-weight: 700; color: var(--muted); padding: 8px 18px; border-radius: 999px; text-decoration: none; }
.train-switch .seg.active { background: var(--tile-dark); color: #fff; }
:root[data-theme="dark"] .train-switch .seg.active { background: var(--accent); }

.wo-train-opts { margin: 8px 0 4px; border-top: 1px dashed var(--border); padding-top: 8px; }
.wo-train-opts summary { cursor: pointer; font-size: 13px; font-weight: 700; list-style: none; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.wo-train-opts summary::-webkit-details-marker { display: none; }
.wo-train-opts summary::before { content: '▸'; color: var(--muted); }
.wo-train-opts[open] summary::before { content: '▾'; }
.wo-train-opts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 14px; margin-top: 10px; font-size: 13px; }
.wo-train-opts-grid label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-weight: 600; }
.wo-train-opts-grid input[type="number"] { width: 100%; min-width: 0; }
.wo-train-opts-grid .wo-train-toggle { flex-direction: row; align-items: center; gap: 8px; color: var(--text); grid-column: 1 / -1; }
.wo-train-range { display: flex; align-items: center; gap: 6px; }
.wo-train-range input { width: 64px; }

.workout-sets-table.has-rir .wo-rir-cell .scroll-pick-display { min-width: 44px; }

/* Four input columns plus the done button must fit a 390px phone. */
@media (max-width: 520px) {
  .workout-sets-table.has-rir td, .workout-sets-table.has-rir th { padding: 4px 3px; }
  .workout-sets-table.has-rir .scroll-pick-display, .workout-sets-table.has-rir .scroll-pick-disabled { width: 100%; min-width: 0; padding-left: 4px; padding-right: 4px; }
  .workout-sets-table.has-rir .wo-rir-cell .scroll-pick-display { min-width: 0; }
  .workout-sets-table.has-rir td:first-child, .workout-sets-table.has-rir th:first-child { width: 34px; }
  .workout-sets-table.has-rir td:last-child, .workout-sets-table.has-rir th:last-child { width: 36px; }
}

/* "Prev" column: last time's matching set; tap to copy it in. */
.workout-sets-table .wo-prev-cell { width: 1%; white-space: nowrap; }
.wo-prev { display: inline-block; font: inherit; font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; background: none; border: 0; padding: 6px 4px; border-radius: 8px; white-space: nowrap; }
button.wo-prev { cursor: pointer; color: var(--text); background: var(--panel-2); padding: 6px 7px; }
button.wo-prev:hover { background: var(--accent-soft); }
button.wo-prev:active { transform: scale(0.96); }
.wo-prev.none { color: var(--border); }
.wo-prev-above svg { width: 11px; height: 11px; margin-right: 3px; vertical-align: -1px; }
:root[data-theme="dark"] button.wo-prev:hover { background: rgba(var(--acc-500-rgb), 0.18); }
@media (max-width: 520px) {
  .workout-sets-table.has-prev td, .workout-sets-table.has-prev th { padding: 4px 2px; }
  .workout-sets-table.has-prev .wo-prev { font-size: 11px; }
  button.wo-prev { padding: 6px 5px; }
}

/* Exercise name opens its weight history. */
.wo-ex-name { display: inline-flex; align-items: center; gap: 5px; font: inherit; color: inherit; background: none; border: 0; padding: 2px 0; cursor: pointer; text-align: left; }
.wo-ex-name svg { width: 15px; height: 15px; color: var(--accent-dark); flex: none; }
.wo-ex-name:hover strong { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
:root[data-theme="dark"] .wo-ex-name svg { color: var(--accent); }

/* ---------- PR moments (live + finished workout) ---------- */
.pr-chip { display: inline-flex; align-items: center; margin-left: 4px; padding: 1px 6px; border-radius: 999px; font-size: 10px; font-weight: 700; letter-spacing: .02em; color: #92400e; background: #fef3c7; box-shadow: 0 0 0 1px rgba(245, 158, 11, .35); vertical-align: middle; }
:root[data-theme="dark"] .pr-chip { color: #fcd34d; background: rgba(245, 158, 11, .16); }
.workout-sets-table tr.is-pr td { background: rgba(245, 158, 11, .08); }
.ps-set.is-pr { box-shadow: inset 0 0 0 1px rgba(245, 158, 11, .5); }
.ps-set .pr-chip { margin: 0 4px 0 0; }
.ps-prs { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .1); font-size: 12.5px; color: #c9ccd1; }
.ps-prs .pr-chip { margin: 0; color: #fcd34d; background: rgba(245, 158, 11, .18); }
.pr-pop { position: fixed; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 14px); z-index: 4000; display: flex; align-items: center; gap: 12px; width: min(400px, calc(100vw - 32px)); box-sizing: border-box; padding: 12px 16px 12px 12px; border-radius: 18px; background: #16181b; color: #fff; box-shadow: 0 16px 32px -12px rgba(17, 18, 20, .6), 0 0 0 1px rgba(245, 158, 11, .35); transform: translate(-50%, -24px) scale(.96); opacity: 0; transition: transform .35s cubic-bezier(.2, .9, .3, 1.2), opacity .2s ease; pointer-events: none; }
.pr-pop.show { transform: translate(-50%, 0) scale(1); opacity: 1; }
.pr-pop-badge { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: rgba(245, 158, 11, .18); box-shadow: 0 0 18px rgba(245, 158, 11, .45); }
.pr-pop-badge svg { width: 22px; height: 22px; fill: none; stroke: #fbbf24; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pr-pop-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pr-pop-t b { font-size: 14px; font-weight: 700; }
.pr-pop-t span { font-size: 12px; color: #c9ccd1; }
@media (prefers-reduced-motion: reduce) { .pr-pop { transition: opacity .2s ease; transform: translate(-50%, 0); } }

/* ---------- rest timer, plates, swap ---------- */
.lv-rest.is-done { background: var(--accent); color: #fff; }
.lv-rest.is-done .btn { color: #fff; }
.lv-ex-actions { grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); }
.lv-pill.on { background: var(--accent-soft); color: var(--accent-dark); }
.lv-plates, .lv-swap { margin-top: 10px; padding: 12px; border-radius: 16px; background: var(--u-tile); }
.lv-plates-top { display: flex; align-items: baseline; gap: 8px; }
.lv-plates-top b { font-size: 17px; font-weight: 700; }
.lv-plates-top span { font-size: 12px; color: var(--muted); }
.lv-plate-row { display: flex; align-items: center; gap: 3px; margin: 12px 0 4px; min-height: 64px; }
.lv-bar-end { width: 26px; height: 10px; border-radius: 3px; background: #9ca3af; margin-right: 2px; }
.lv-plate { display: grid; place-items: center; width: 22px; border-radius: 5px; font-style: normal; font-size: 10px; font-weight: 700; color: #fff; writing-mode: vertical-rl; transform: rotate(180deg); box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.lv-plate.p25 { height: 64px; background: #dc2626; }
.lv-plate.p20 { height: 60px; background: #2563eb; }
.lv-plate.p15 { height: 54px; background: #ca8a04; }
.lv-plate.p10 { height: 48px; background: #16a34a; }
.lv-plate.p5 { height: 38px; background: #e5e7eb; color: #111; }
.lv-plate.p2_5 { height: 30px; background: #1f2937; }
.lv-plate.p1_25 { height: 24px; width: 16px; background: #9ca3af; }
.lv-bar-pick { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.lv-bar-pick button { height: 30px; padding: 0 12px; border-radius: 999px; border: 0; background: var(--panel); font: inherit; font-size: 12px; font-weight: 600; color: var(--text); cursor: pointer; }
.lv-bar-pick button.on { background: var(--accent); color: #fff; }
.lv-swap .u-ins { background: var(--panel); }
.lv-ex-tile.sm { width: 32px; height: 32px; border-radius: 10px; overflow: hidden; flex: none; }
.lv-ex-tile.sm img { width: 100%; height: 100%; object-fit: cover; }
.wo-link-icon-btn svg { display: block; }

/* Gym profiles */
.lv-gym-chip { display: inline-flex; align-items: center; gap: 2px; padding: 0; border: 0; background: none; font: inherit; color: var(--accent-dark, var(--accent)); font-weight: 600; cursor: pointer; }
.lv-gym-chip svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.lv-gym { display: grid; gap: 8px; margin-bottom: 12px; }
.lv-gym-pick { display: flex; gap: 4px; padding: 4px; border-radius: 99px; background: var(--u-tile, #f1f2f4); }
.lv-gym-pick button { flex: 1; min-width: 0; height: 36px; border: 0; border-radius: 99px; background: transparent; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lv-gym-pick button.on { background: var(--panel, #fff); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.lv-gym-sec { margin-top: 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.lv-gym-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.lv-gym-chips button { height: 32px; padding: 0 12px; border: 1px solid var(--line, rgba(0, 0, 0, .1)); border-radius: 99px; background: transparent; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; }
.lv-gym-chips button.on { border-color: transparent; background: var(--accent-soft); color: var(--accent-dark, var(--accent)); font-weight: 600; }
.lv-nokit { margin: 6px 0 8px; padding: 8px 12px; border-radius: 12px; background: #fef3c7; color: #78350f; font-size: 13px; }
.lv-nokit .link { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: inherit; text-decoration: underline; cursor: pointer; }
:root[data-theme="dark"] .lv-gym-pick { background: rgba(255, 255, 255, .07); }
:root[data-theme="dark"] .lv-gym-pick button.on { background: rgba(255, 255, 255, .14); }
:root[data-theme="dark"] .lv-gym-chips button.on { background: rgba(var(--acc-500-rgb), .16); color: var(--acc-400); }
:root[data-theme="dark"] .lv-gym-chip { color: var(--acc-400); }
:root[data-theme="dark"] .lv-nokit { background: rgba(245, 158, 11, .14); color: #fcd34d; }
