/* Mobile-first, one hand. Big targets (>= 48px), dark, no hover states needed. */
:root {
  --bg: #111214; --card: #1b1d21; --card2: #24272c; --line: #2e3238;
  --text: #f2f3f5; --dim: #9aa0a8; --accent: #22c55e; --accent-dim: #14532d;
  --warn: #f59e0b; --danger: #ef4444; --blue: #3b82f6;
  --radius: 14px; --tap: 52px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.35 -apple-system, system-ui, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: calc(140px + env(safe-area-inset-bottom)); }
main { padding: calc(12px + env(safe-area-inset-top)) 12px 0; max-width: 560px; margin: 0 auto; }
h1 { font-size: 24px; margin: 6px 0 2px; }
h2 { font-size: 18px; margin: 18px 0 8px; }
h3 { font-size: 18px; margin: 0 0 10px; }
p { margin: 6px 0; }
.dim { color: var(--dim); }
.small { font-size: 14px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1; }
.right { text-align: right; }

button, .btn { font: inherit; color: var(--text); background: var(--card2); border: 1px solid var(--line);
  border-radius: 12px; min-height: var(--tap); padding: 0 16px; cursor: pointer; user-select: none; -webkit-user-select: none; }
button:active { filter: brightness(1.25); }
button.primary { background: var(--accent); color: #04120a; border-color: var(--accent); font-weight: 700; }
button.danger { color: var(--danger); }
button.ghost { background: transparent; border-color: transparent; color: var(--dim); }
button.big { width: 100%; font-size: 20px; min-height: 60px; }
button.icon { min-width: var(--tap); padding: 0; font-size: 22px; }
button:disabled { opacity: .4; }
button.block { display: block; width: 100%; margin: 8px 0; }

input, select, textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; min-height: 48px; padding: 8px 12px; width: 100%; }
textarea { min-height: 120px; }
label { display: block; font-size: 14px; color: var(--dim); margin: 10px 0 4px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 48px; }
.check input { width: 24px; height: 24px; min-height: 0; }

.card { background: var(--card); border-radius: var(--radius); padding: 14px; margin: 10px 0; }
.card.skipped { opacity: .55; }
.list a, .list .item { display: flex; align-items: center; min-height: var(--tap); padding: 8px 12px;
  color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); gap: 10px; }
.list a:last-child, .list .item:last-child { border-bottom: 0; }
.list .item button { min-height: 44px; }

/* exercise card */
.ex-head { display: flex; align-items: center; gap: 8px; }
.ex-name { font-weight: 700; font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-height: 44px; display: flex; align-items: center; background: transparent; border: 0; padding: 0; text-align: left; justify-content: flex-start; }
.ex-meta { font-size: 13px; color: var(--dim); margin-bottom: 8px; }
.ex-meta b { color: var(--text); font-weight: 600; }
.wrow { display: flex; align-items: center; gap: 8px; margin: 6px 0 10px; }
.wrow .wval { flex: 1; font-size: 24px; font-weight: 700; background: transparent; border-color: var(--line); }
.wrow .wval small { font-size: 14px; color: var(--dim); font-weight: 400; margin-left: 4px; }
.sets { display: flex; gap: 8px; flex-wrap: wrap; }
.tile { width: 60px; height: 60px; border-radius: 12px; border: 2px solid var(--line); background: var(--card2);
  font-size: 20px; font-weight: 700; color: var(--dim); display: flex; align-items: center; justify-content: center; padding: 0; }
.tile.done { background: var(--accent); border-color: var(--accent); color: #04120a; }
.tile.open { outline: 3px solid var(--blue); outline-offset: 2px; }
.tile.add { font-size: 26px; border-style: dashed; }
.tile small { font-size: 12px; font-weight: 600; margin-left: 1px; }
.adjust { margin-top: 10px; padding: 10px; background: var(--card2); border-radius: 12px; display: grid; gap: 10px; }
.stepper { display: grid; grid-template-columns: var(--tap) 1fr var(--tap); align-items: center; gap: 6px; }
.stepper .val { text-align: center; font-size: 22px; font-weight: 700; }
.stepper .val small { display: block; font-size: 12px; color: var(--dim); font-weight: 400; }
.rir { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.rir .lbl { color: var(--dim); font-size: 14px; width: 30px; }
.chip { flex: 1; min-height: 44px; border-radius: 22px; background: var(--card2); border: 1px solid var(--line); font-weight: 700; padding: 0; }
.chip.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.last { font-size: 13px; color: var(--dim); margin-top: 6px; }

/* day chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin: 8px 0; }
.chips button { white-space: nowrap; min-height: 44px; padding: 0 14px; }
.chips button.on { background: var(--accent-dim); border-color: var(--accent); }

/* timer bar */
#timer { position: fixed; left: 0; right: 0; bottom: calc(64px + env(safe-area-inset-bottom)); margin: 0 12px;
  background: #0f2a1a; border: 1px solid var(--accent); color: var(--text); border-radius: 14px;
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; z-index: 5; font-size: 22px; font-weight: 700; }
#timer[hidden] { display: none; }
#timer.over { background: #3a1a0f; border-color: var(--warn); }
#timer .grow { flex: 1; }
#timer button { min-height: 44px; }

/* bottom nav */
#nav { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--card);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 6; }
#nav a { flex: 1; text-align: center; padding: 14px 0; color: var(--dim); text-decoration: none; font-size: 15px; font-weight: 600; }
#nav a.on { color: var(--accent); }

/* bottom sheet */
#sheet-root .backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 10; }
#sheet-root .sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 85vh; overflow-y: auto; z-index: 11;
  background: var(--card); border-radius: 18px 18px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
.sheet .menu button { display: block; width: 100%; text-align: left; margin-bottom: 8px; padding: 10px 16px; }
.sheet .menu button .sub { display: block; font-size: 13px; color: var(--dim); font-weight: 400; }
.sheet .actions { display: flex; gap: 8px; margin-top: 14px; }
.sheet .actions button { flex: 1; }
pre.block { background: var(--bg); border-radius: 10px; padding: 10px; font-size: 13px; white-space: pre-wrap; word-break: break-word; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(130px + env(safe-area-inset-bottom));
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 20px; font-weight: 600; z-index: 20; }
