/* Mobile-first. Dark by default -- gym lighting, phone in hand, one thumb. */
:root {
  --bg:        #0e1013;
  --surface:   #171a20;
  --surface-2: #1f232b;
  --border:    #2a2f39;
  --text:      #e8eaed;
  --text-dim:  #9aa2ae;
  --text-faint:#6b7280;
  --accent:    #7dd3fc;
  --advance:   #4ade80;
  --push:      #7dd3fc;
  --stall:     #fbbf24;
  --danger:    #f87171;
  --radius:    14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  padding-bottom: 84px;               /* clear the tab bar */
  overscroll-behavior-y: contain;
}

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

/* ---------- header ---------- */
header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(14,16,19,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 12px 14px;
}
header .bar { max-width: 720px; margin: 0 auto; display: flex; align-items: center; gap: 10px; }
header h1 { font-size: 17px; margin: 0; font-weight: 650; letter-spacing: -.01em; flex: 1; }
.timer { font-variant-numeric: tabular-nums; color: var(--text-dim); font-size: 13px; }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.card h3 { margin: 0 0 2px; font-size: 16px; font-weight: 620; letter-spacing: -.01em; }
.muted { color: var(--text-dim); font-size: 13px; }
.faint { color: var(--text-faint); font-size: 12px; }

/* ---------- the target banner: the reason this app exists ---------- */
.target {
  border-radius: 10px;
  padding: 10px 12px;
  margin: 10px 0;
  border-left: 3px solid var(--push);
  background: var(--surface-2);
}
.target.advance { border-left-color: var(--advance); }
.target.stalled { border-left-color: var(--stall); }
.target.new     { border-left-color: var(--text-faint); }
.target .head {
  font-size: 15px; font-weight: 640;
  font-variant-numeric: tabular-nums;
}
.target.advance .head { color: var(--advance); }
.target.push    .head { color: var(--push); }
.target.stalled .head { color: var(--stall); }
.target .detail { font-size: 12.5px; color: var(--text-dim); margin-top: 3px; }

/* ---------- stat row ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.stat {
  background: var(--surface-2); border-radius: 10px; padding: 9px 10px; text-align: center;
}
.stat .v { font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat .k { font-size: 10.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }

/* ---------- set rows ---------- */
.set-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 2px; border-top: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.set-row .n {
  width: 22px; height: 22px; border-radius: 6px; background: var(--surface-2);
  display: grid; place-items: center; font-size: 11px; color: var(--text-dim); flex: none;
}
.set-row .val { flex: 1; font-size: 15px; }
.set-row .e1 { font-size: 12px; color: var(--text-faint); }
.set-row.warmup .val { color: var(--text-faint); }
.del {
  background: none; border: none; color: var(--text-faint);
  font-size: 20px; line-height: 1; padding: 2px 8px; cursor: pointer;
  flex: none; width: auto;
}
.del:active { color: var(--danger); }

/* ---------- inputs ---------- */
.entry { display: flex; gap: 8px; align-items: stretch; margin-top: 10px; }

/* per-exercise set entry: [− weight +] [− reps +] then a full-width Log */
.entry-sets { flex-wrap: wrap; }
.entry-sets .row { flex: 1 1 45%; gap: 6px; }
.entry-sets .row > button.sm {
  flex: 0 0 40px; padding: 11px 0; font-size: 18px; line-height: 1;
}
.entry-sets .row > input {
  flex: 1 1 0; min-width: 0; padding: 11px 2px; font-size: 17px; font-weight: 600;
}
.entry-sets > button.go { flex: 1 1 100%; padding: 13px; }
input, select, textarea {
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); border-radius: 10px; padding: 11px 12px;
  font-size: 16px;                    /* >=16px stops iOS zoom-on-focus */
  font-family: inherit; width: 100%;
  font-variant-numeric: tabular-nums;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
input::placeholder { color: var(--text-faint); }
.num { text-align: center; }

button {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 14px; font-size: 15px; font-weight: 560;
  font-family: inherit; cursor: pointer;
}
button:active { transform: scale(.97); }
button.primary { background: var(--accent); color: #06202c; border-color: transparent; font-weight: 660; }
button.go      { background: var(--advance); color: #052e16; border-color: transparent; font-weight: 660; }
button.ghost   { background: none; }
button.wide    { width: 100%; }
button.sm      { padding: 7px 10px; font-size: 13px; }

.row { display: flex; gap: 8px; }
.row > * { flex: 1; }

/* ---------- tab bar ---------- */
nav.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  background: rgba(14,16,19,.95); backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: flex; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
nav.tabs button {
  flex: 1; background: none; border: none; color: var(--text-faint);
  font-size: 11px; padding: 7px 2px; display: flex; flex-direction: column;
  align-items: center; gap: 3px; font-weight: 560;
}
nav.tabs button .ico { font-size: 19px; line-height: 1; }
nav.tabs button.on { color: var(--accent); }

/* ---------- misc ---------- */
.pill {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; background: var(--surface-2); color: var(--text-dim);
}
.pill.up   { color: var(--advance); }
.pill.down { color: var(--danger); }
.pill.flat { color: var(--text-dim); }

.empty { text-align: center; padding: 40px 20px; color: var(--text-faint); }
.empty .big { font-size: 40px; margin-bottom: 10px; }

.list-item {
  display: flex; align-items: center; gap: 10px; padding: 12px 2px;
  border-bottom: 1px solid var(--border); cursor: pointer;
}
.list-item:last-child { border-bottom: none; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .name { font-weight: 560; font-size: 15px; }
.list-item .sub { font-size: 12.5px; color: var(--text-faint); }

dialog {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 16px; padding: 16px; width: min(92vw, 460px);
}
dialog::backdrop { background: rgba(0,0,0,.6); }

.toast {
  position: fixed; bottom: 92px; left: 50%; transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 10px 16px; border-radius: 999px; font-size: 14px; z-index: 60;
  opacity: 0; transition: opacity .2s; pointer-events: none; white-space: nowrap;
}
.toast.show { opacity: 1; }

.hidden { display: none !important; }


/* ---------- rest timer (PRD §5.3) ----------
   Sits above the tab bar so it stays visible while scrolling the session. */
.restbar {
  position: fixed; left: 8px; right: 8px;
  bottom: calc(64px + env(safe-area-inset-bottom));
  z-index: 40;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px; padding: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,.45);
}
.restbar.done { border-color: var(--advance); }
.restbar .rest-mid { flex: 1; text-align: center; }
.restbar .rest-time {
  font-size: 25px; font-weight: 700; font-variant-numeric: tabular-nums;
  letter-spacing: -.02em; line-height: 1.05;
}
.restbar.done .rest-time { color: var(--advance); }
.restbar .rest-label {
  font-size: 10.5px; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: .06em;
}
.restbar button {
  background: var(--surface); border: 1px solid var(--border);
  padding: 11px 10px; font-size: 13px; font-weight: 600; flex: none;
}
.restbar .rest-skip { background: none; border: none; color: var(--text-dim); }

/* ---------- RIR chips (PRD §5.4.3) ---------- */
.rir-row { display: flex; align-items: center; gap: 6px; margin-top: 9px; flex-wrap: wrap; }
.rir-row .lab {
  font-size: 11px; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: .05em; margin-right: 2px;
}
.chip {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim);
  border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600;
  flex: none; width: auto; cursor: pointer;
}
.chip.on { background: var(--accent); color: #06202c; border-color: transparent; }

/* ---------- why-this-weight ---------- */
.why-btn {
  background: none; border: none; color: var(--accent);
  font-size: 12px; padding: 4px 0 0; font-weight: 600; width: auto; cursor: pointer;
}
.why-check {
  display: flex; gap: 8px; align-items: baseline;
  padding: 7px 0; border-top: 1px solid var(--border); font-size: 13px;
}
.why-check .mark { flex: none; font-weight: 700; }
.why-check .mark.yes { color: var(--advance); }
.why-check .mark.no  { color: var(--text-faint); }
.why-sentence {
  background: var(--surface-2); border-radius: 10px; padding: 11px 12px;
  font-size: 14.5px; line-height: 1.4; margin-bottom: 10px;
}
.why-cap {
  border-left: 3px solid var(--stall); background: var(--surface-2);
  padding: 9px 11px; border-radius: 8px; font-size: 12.5px;
  color: var(--stall); margin-top: 10px;
}
