/* Gym conditions: one hand, standing, bad lighting, sweaty fingers.
   Nothing tappable is under 56px. */
:root {
  --bg: #0b0d10;
  --surface: #161a20;
  --surface-2: #1e242c;
  --line: #2a323d;
  --text: #f2f5f8;
  --muted: #8f9bab;
  --accent: #4ade80;
  --accent-ink: #06210f;
  --warn: #fbbf24;
  --tap: 56px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  overscroll-behavior-y: contain;
}
#app { max-width: 640px; margin: 0 auto; padding: 0 16px calc(32px + env(safe-area-inset-bottom)); }
.loading { padding: 48px 0; text-align: center; color: var(--muted); }

/* Header */
.top { display: flex; align-items: center; gap: 12px; padding: calc(16px + env(safe-area-inset-top)) 0 12px; }
.top h1 { font-size: 26px; margin: 0; letter-spacing: -0.02em; }
.top .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.back {
  width: var(--tap); height: var(--tap); flex: 0 0 auto; margin-left: -14px;
  display: grid; place-items: center; background: none; border: 0;
  color: var(--text); font-size: 28px; cursor: pointer;
}

/* Slot list */
.slot {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px; margin-bottom: 10px; min-height: 76px; color: inherit;
  font: inherit; cursor: pointer;
}
.slot:active { background: var(--surface-2); }
.slot .idx {
  flex: 0 0 34px; height: 34px; border-radius: 10px; background: var(--surface-2);
  color: var(--muted); display: grid; place-items: center; font-size: 15px; font-weight: 600;
}
.slot.done .idx { background: var(--accent); color: var(--accent-ink); }
.slot .body { flex: 1 1 auto; min-width: 0; }
.slot .name { font-size: 17px; font-weight: 600; }
.slot .meta { color: var(--muted); font-size: 14px; margin-top: 3px; }
.slot .count { flex: 0 0 auto; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 15px; }
.slot.done .count { color: var(--accent); }

/* Last time */
.last {
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 10px; padding: 12px 14px; margin: 14px 0; font-size: 15px;
}
.last.none { border-left-color: var(--line); color: var(--muted); }
.last .label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.last .val { margin-top: 4px; font-variant-numeric: tabular-nums; }

/* Logged sets */
.done-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  font-variant-numeric: tabular-nums;
}
.done-row .n { color: var(--muted); width: 24px; }
.done-row .v { flex: 1 1 auto; }
.undo { min-width: var(--tap); min-height: 44px; background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; }

/* Editor */
.editor { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px 16px; margin-top: 14px; }
.editor h2 { margin: 0 0 14px; font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.field { margin-bottom: 18px; }
.field > .label { color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.stepper { display: flex; align-items: stretch; gap: 10px; }
.stepper button {
  flex: 0 0 var(--tap); height: var(--tap); border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
  font-size: 28px; cursor: pointer;
}
.stepper button:active { background: var(--line); }
.stepper input {
  flex: 1 1 auto; min-width: 0; height: var(--tap); text-align: center;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  color: var(--text); font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.chips { display: flex; gap: 8px; }
.chips button {
  flex: 1 1 0; height: var(--tap); border-radius: 12px; background: var(--surface-2);
  border: 1px solid var(--line); color: var(--text); font-size: 17px; cursor: pointer;
}
.chips button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.chips .target { outline: 1px dashed var(--muted); }
.primary {
  width: 100%; min-height: 60px; border-radius: 14px; border: 0;
  background: var(--accent); color: var(--accent-ink); font-size: 19px; font-weight: 700; cursor: pointer;
}
.primary:disabled { opacity: .4; }
.primary:active { filter: brightness(.92); }

/* Misc */
.note { color: var(--muted); font-size: 14px; margin: 16px 0; }
.banner { background: #2a2114; border: 1px solid #4a3a18; color: var(--warn); border-radius: 10px; padding: 12px 14px; font-size: 14px; margin: 12px 0; }
.linkrow { display: flex; gap: 10px; margin-top: 16px; }
.linkrow a, .linkrow button {
  flex: 1 1 0; min-height: var(--tap); display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  color: var(--text); text-decoration: none; font: inherit; cursor: pointer;
}
.complete { text-align: center; padding: 20px; color: var(--accent); font-weight: 600; }

/* Target marker is redundant once that chip is selected. */
.chips button.target.on { outline: none; }

/* See alt */
.exbar { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.altbtn {
  min-height: 44px; padding: 0 16px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--text); font: inherit; font-size: 15px; cursor: pointer;
}
.altbtn:active { background: var(--line); }
.swapped {
  font-size: 13px; color: var(--warn); background: #2a2114; border: 1px solid #4a3a18;
  border-radius: 999px; padding: 6px 12px;
}
.sheet {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: flex-end; justify-content: center; z-index: 50;
}
.sheet-panel {
  width: 100%; max-width: 640px; max-height: 86vh; overflow-y: auto;
  background: var(--surface); border-radius: 18px 18px 0 0;
  border-top: 1px solid var(--line);
  padding: 18px 16px calc(20px + env(safe-area-inset-bottom));
}
.sheet-panel h2 { margin: 0 0 4px; font-size: 20px; }
.sheet-panel .hint { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.alt-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  min-height: 68px; padding: 14px; margin-bottom: 8px; font: inherit; color: inherit;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; cursor: pointer;
}
.alt-row:active { background: var(--line); }
.alt-row .body { flex: 1 1 auto; min-width: 0; }
.alt-row .name { font-size: 16px; font-weight: 600; }
.alt-row .meta { color: var(--muted); font-size: 13px; margin-top: 3px; }
.alt-row .tag { flex: 0 0 auto; font-size: 12px; color: var(--warn); }
.sheet-close { width: 100%; min-height: var(--tap); margin-top: 6px;
  background: none; border: 1px solid var(--line); border-radius: 12px;
  color: var(--muted); font: inherit; cursor: pointer; }

/* Cues popup: readable at arms length with 45 seconds of rest left. */
.cue-sec { margin-bottom: 18px; }
.cue-sec h3 {
  margin: 0 0 8px; font-size: 13px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted);
}
.cue-sec.avoid h3 { color: var(--warn); }
.cue-sec ul { margin: 0; padding-left: 20px; }
.cue-sec li { font-size: 17px; line-height: 1.45; margin-bottom: 7px; }
.cue-sec.avoid li::marker { color: var(--warn); }
.demo {
  display: grid; place-items: center; width: 100%; min-height: var(--tap);
  margin-top: 4px; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 12px; color: var(--text); text-decoration: none; font-size: 16px;
}
.unverified {
  background: #2a2114; border: 1px solid #4a3a18; color: var(--warn);
  border-radius: 10px; padding: 11px 13px; font-size: 13px; margin-bottom: 16px;
}
.dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--warn); margin-left: 7px; vertical-align: middle;
}

/* Offline queue */
.pending-pill {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 60;
  background: #2a2114; border: 1px solid #4a3a18; color: var(--warn);
  border-radius: 999px; padding: 10px 16px; font-size: 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
.done-row.pending { border-style: dashed; }
.done-row.pending .v { color: var(--muted); }
body.has-pending #app { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }

/* Program screen */
.day-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px; margin-bottom: 12px;
}
.day-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.day-name { flex: 1 1 auto; font-size: 18px; font-weight: 600; }
select.weekday {
  flex: 0 0 auto; min-height: var(--tap); padding: 0 12px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
  color: var(--text); font: inherit; font-size: 15px;
}
select.weekday:disabled { opacity: .5; }
.slot-line {
  display: flex; align-items: baseline; gap: 10px;
  padding: 8px 0; border-top: 1px solid var(--line); font-size: 15px;
}
.slot-line .n { color: var(--muted); width: 18px; flex: 0 0 auto; font-size: 13px; }
.slot-line .nm { flex: 1 1 auto; min-width: 0; }
.slot-line .rx { flex: 0 0 auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.danger {
  width: 100%; min-height: var(--tap); margin-top: 8px; border-radius: 12px;
  background: none; border: 1px solid #5a2a2a; color: #f87171;
  font: inherit; font-size: 16px; cursor: pointer;
}
.danger:active { background: #2a1414; }
.stat-block { display: flex; gap: 10px; margin: 4px 0 14px; }
.stat {
  flex: 1 1 0; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 8px; text-align: center;
}
.stat .big { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .cap { color: var(--muted); font-size: 12px; margin-top: 4px; line-height: 1.3; }

/* Login */
.login { padding: 18vh 0 0; text-align: center; }
.login h1 { font-size: 32px; margin: 0 0 10px; }
.login .note { margin: 0 auto 22px; max-width: 380px; }
input.passcode {
  width: 100%; height: 60px; margin-bottom: 12px; text-align: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  color: var(--text); font-size: 20px; letter-spacing: .04em;
}
