:root {
  color-scheme: dark;
  --bg: #10120f;
  --card: #1b2118;
  --ink: #f3f5ef;
  --muted: #a7b09e;
  --line: #343b2e;
  --accent: #e2ff57;
  --danger: #ff6a45;
  --push: #ffb020;
  --pull: #79c8ff;
  --legs: #e2ff57;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  font-family: "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
}

body {
  max-width: 720px;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 16px calc(92px + env(safe-area-inset-bottom));
}

button, input {
  font: inherit;
  color: inherit;
}

button { cursor: pointer; }

.top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 18px 0 8px;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 12px;
}

h1 {
  margin: 0;
  font-size: 40px;
  letter-spacing: -0.04em;
  line-height: 0.95;
}

h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.03em;
}

.unit, .ghost, .danger, .primary, .add, .tiny {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 4px;
  min-height: 44px;
}

.unit {
  padding: 0 14px;
  background: var(--accent);
  color: #15180f;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: rgba(16, 18, 15, 0.94);
  border-top: 1px solid var(--line);
  max-width: 720px;
  margin: 0 auto;
}

.tabs button {
  min-height: 46px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 4px;
}

.tabs button[aria-current="page"] {
  background: var(--card);
  color: var(--ink);
}

.stack { display: grid; gap: 12px; }

.day {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  width: 100%;
  text-align: left;
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 6px solid var(--accent);
  border-radius: 6px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.day[data-day="push"] { border-left-color: var(--push); }
.day[data-day="pull"] { border-left-color: var(--pull); }
.day[data-day="legs"] { border-left-color: var(--legs); }

.day strong {
  font-size: 28px;
  letter-spacing: -0.03em;
}

.day small, .meta, .hint, .sub {
  color: var(--muted);
}

.day .go {
  align-self: center;
  font-weight: 700;
  color: var(--accent);
}

.banner, .card, .editor, .session {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
}

.banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.card header, .editor header, .session header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 8px;
}

.set {
  display: grid;
  grid-template-columns: 28px 1fr 1fr 44px;
  gap: 8px;
  align-items: end;
  margin-top: 8px;
}

label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }

input {
  width: 100%;
  min-height: 48px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #10140f;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.index {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  padding-bottom: 14px;
}

.hint { margin: 4px 0 0; font-size: 13px; }

.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.primary, .danger, .ghost, .add, .tiny {
  padding: 0 14px;
}

.primary {
  background: var(--accent);
  color: #15180f;
  border-color: var(--accent);
  font-weight: 700;
}

.danger { color: var(--danger); border-color: #5a3228; }

.tiny { min-height: 36px; padding: 0 10px; }

.actions {
  position: sticky;
  bottom: 78px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding-top: 8px;
  background: linear-gradient(transparent, var(--bg) 20%);
}

.install {
  color: var(--muted);
  font-size: 14px;
}

.editor .grid, .add-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.editor .name { grid-column: 1 / -1; }

.line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.line span { color: var(--muted); white-space: nowrap; }

.line strong {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.suggestion {
  margin: 8px 0 0;
  padding: 8px 10px;
  background: #141910;
  border-left: 3px solid var(--accent);
}

select {
  width: 100%;
  min-height: 48px;
  background: #10140f;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 10px;
  font: inherit;
}

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(78px + env(safe-area-inset-bottom));
  margin: 0 auto;
  max-width: 688px;
  background: #2a2018;
  color: #ffd7cc;
  border: 1px solid #5a3228;
  border-radius: 4px;
  padding: 12px 14px;
}

.empty { color: var(--muted); }

.fold-card { display: grid; }

.fold-head {
  display: grid;
  grid-template-columns: 1fr 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  overflow: hidden;
}

.fold {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  align-items: center;
  text-align: left;
  min-height: 58px;
  padding: 10px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.fold-card.open .fold-head {
  border-radius: 6px 6px 0 0;
}

.how {
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  color: var(--accent);
  font-size: 22px;
  font-weight: 700;
  min-height: 58px;
}

#how-dialog {
  width: min(520px, calc(100% - 24px));
  margin: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
}

#how-dialog::backdrop { background: rgba(0, 0, 0, 0.62); }

#how-dialog h2 { margin: 0; font-size: 22px; }

#how-dialog .how-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#how-dialog .feel { color: var(--muted); margin: 8px 0 12px; }

#how-dialog ol {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 10px;
}

.fold-name {
  font-size: 18px;
  font-weight: 700;
}

.fold-meta, .fold-mark {
  grid-column: 1 / -1;
  font-size: 13px;
}

.fold-meta { color: var(--muted); }

.fold-mark { color: var(--ink); }

.up-next {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 99px;
  background: var(--accent);
  color: #15180f;
  font-size: 12px;
  font-weight: 700;
  vertical-align: 2px;
}

.fold-card.is-next .fold-head { border-color: var(--accent); }

.set-block.is-next {
  margin-top: 8px;
  padding-left: 8px;
  border-left: 3px solid var(--accent);
}

.set-mark {
  margin: 2px 0 0 36px;
  font-size: 13px;
  color: var(--muted);
}

.chev { color: var(--accent); font-size: 18px; }

.fold-body {
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 6px 6px;
  padding: 12px;
  background: #151910;
}

.workout-weight { margin: 4px 0 8px; }

.save-log { width: 100%; margin-top: 12px; }

.tune {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.step, .reps {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 48px;
}

.step button, .reps input { min-width: 44px; }

.reps { display: grid; grid-template-columns: 1fr 1fr; }
