:root {
  color-scheme: dark;
  --bg: #10182b;
  --card: #1a2744;
  --card-2: #223154;
  --ink: #f5f7fb;
  --muted: #93a0b8;
  --line: #31425f;
  --accent: #ff4d6a;
  --accent-ink: #ffffff;
  --ok: #3dd68c;
  font: 18px/1.35 system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  padding-top: env(safe-area-inset-top);
}
main { padding: 16px; max-width: 40rem; margin: 0 auto; }
a { color: var(--ink); }
.bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
}
.brand { font-weight: 700; text-decoration: none; }
nav { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
button, .big, input, select, textarea { font: inherit; color: inherit; }
button, .big, .home-card {
  min-height: 48px;
  min-width: 48px;
  padding: 12px 16px;
  border: 0;
  border-radius: 16px;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  text-align: center;
  touch-action: manipulation;
}
.secondary { background: transparent; color: var(--ink); border: 1px solid var(--line); }
input, select, textarea {
  min-height: 48px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: white;
  font-size: 1.15rem;
}
input::placeholder { color: #7f8da6; opacity: 1; }
.actions, .list { display: grid; gap: 12px; padding: 0; list-style: none; }
.home-card {
  display: grid;
  gap: 4px;
  background: var(--card);
  color: var(--ink);
  text-align: left;
  border-radius: 22px;
  padding: 18px;
}
.home-card span { color: var(--muted); font-size: 0.95rem; }
.error { color: #ff8f70; }
.muted { color: var(--muted); }
.unsynced { margin: 0; font-weight: 700; font-size: 0.9rem; }
.check { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 8px; }
.chart svg { width: 100%; height: auto; }
.morning { fill: var(--accent); }
.other { fill: none; stroke: var(--ink); stroke-width: 2; }
.average { fill: none; stroke: var(--ok); stroke-width: 3; }
.narrow { max-width: 24rem; margin: 10vh auto; padding: 16px; }
label, .slot, .set, .list li { display: grid; gap: 8px; }

body[data-page="train"] .bar nav a,
body[data-page="train"] .bar form { display: none; }
body[data-page="train"] {
  --dock-h: 80px;
  --rest-h: 168px;
  --cover: calc(var(--dock-h) + env(safe-area-inset-bottom) + 16px);
}
body[data-page="train"].resting {
  --cover: calc(var(--dock-h) + var(--rest-h) + env(safe-area-inset-bottom) + 16px);
}
body[data-page="train"] main {
  padding: 0 16px var(--cover);
  max-width: 40rem;
}

.rest {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--dock-h) + env(safe-area-inset-bottom));
  z-index: 6;
  margin: 0;
  padding: 10px 16px 12px;
  background: var(--card);
  border-radius: 22px 22px 0 0;
  display: grid;
  justify-items: center;
  gap: 2px;
}
.rest[hidden] { display: none; }
.rest-kicker { margin: 0; color: var(--muted); font-size: 0.85rem; font-weight: 700; }
.rest-count {
  margin: 0;
  font-size: 3.4rem;
  font-weight: 800;
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.rest-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
.rest-actions button { min-height: 48px; background: #121b30; color: var(--ink); }
.gym-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--bg);
  padding: 12px 0 10px;
}
.gym-head h1 {
  margin: 0;
  font-size: 1.7rem;
  flex: 1;
}
.icon-btn {
  width: 48px;
  height: 48px;
  padding: 0;
  display: grid;
  place-items: center;
  background: var(--card);
  color: var(--ink);
  border-radius: 14px;
}
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; }
.slot-card, .circuit-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  background: var(--card);
  border-radius: 22px;
  padding: 14px;
  margin: 0 0 12px;
}
.circuit-card { grid-template-columns: 1fr; }
.slot-open {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  width: 100%;
  grid-column: 1;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 0;
  min-height: 48px;
}
.slot-card > .icon-btn { grid-column: 3; }
.done-mark { grid-column: 2; justify-self: end; }
.equip {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: #2a1a2e;
  color: var(--accent);
  display: grid;
  place-items: center;
}
.equip svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.slot-open strong, .circuit-card h2 { font-size: 1.15rem; }
.slot-open p, .circuit-card p { margin: 2px 0 0; color: var(--muted); font-size: 0.95rem; }
.done-mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ok);
  color: #062216;
  display: grid;
  place-items: center;
  font-weight: 800;
}
.summary { color: var(--ink); font-weight: 700; }
.ex-name { font-size: 2rem; margin: 0 0 4px; }
.note-line { margin: 0 0 12px; color: var(--muted); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip {
  min-height: 48px;
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 14px;
}
.chip[aria-pressed="true"] { background: var(--accent); color: white; }
.panel {
  background: var(--card);
  border-radius: 18px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.set-head, .set-row {
  display: grid;
  grid-template-columns: 48px 1fr 1fr 32px;
  gap: 8px;
  align-items: center;
}
.set-head { color: var(--muted); font-size: 0.85rem; padding: 0 8px 6px; }
.set-row {
  background: transparent;
  border-radius: 16px;
  padding: 6px;
  margin-bottom: 8px;
}
.set-row.current { background: var(--card-2); box-shadow: inset 3px 0 0 var(--accent); }
.set-row, .set-tools, .circuit-card, .station { scroll-margin-bottom: var(--cover, 120px); }
.set-row .rpe { display: none; grid-column: 1 / -1; }
.set-row.current .rpe { display: grid; gap: 8px; margin-top: 8px; }
.badge {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  padding: 0;
}
.badge.warm { background: #3a445c; color: #d5dbe8; }
.set-row input {
  font-size: 1.45rem;
  font-weight: 700;
  text-align: center;
  background: #121b30;
}
.tick { color: var(--ok); font-weight: 800; text-align: center; }
.rpe-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 700; }
.info-btn {
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  font-weight: 800;
}
.rpe-hint { margin: 0; color: var(--muted); font-size: 0.95rem; }
.rpe-chips {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}
.rpe-chips button {
  min-width: 0;
  min-height: 52px;
  padding: 4px 0;
  border-radius: 12px;
  background: #121b30;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  line-height: 1.05;
}
.rpe-chips strong { font-size: 0.95rem; }
.rpe-chips small { font-size: 0.62rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.rpe-chips button[aria-pressed="true"] {
  background: var(--accent);
  color: white;
  box-shadow: inset 0 0 0 2px #fff;
}
.rpe-chips button[aria-pressed="true"] small { color: white; }
.set-tools { display: flex; gap: 8px; margin: 8px 0 16px; }
.set-tools button { flex: 1; background: var(--card); color: var(--ink); }
.station {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: #121b30;
  color: var(--ink);
  text-align: left;
}
.station span { color: var(--muted); font-weight: 700; }
.round-clock {
  width: 100%;
  margin: 4px 0;
  padding: 4px 0;
  background: transparent;
  color: var(--ink);
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.round-table {
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  gap: 4px 16px;
  align-items: baseline;
  font-variant-numeric: tabular-nums;
}
.round-table .head { color: var(--muted); font-size: 0.85rem; font-weight: 700; }
.round-done { font-weight: 800; min-height: 56px; font-size: 1.15rem; }
.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 10px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-top: 1px solid var(--line);
}
.dock.single { grid-template-columns: 1fr; }
.dock .primary { font-weight: 800; min-height: 56px; font-size: 1.15rem; }
.sheet {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / 55%);
  display: grid;
  align-items: end;
  z-index: 7;
}
.sheet section {
  background: var(--card);
  border-radius: 22px 22px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  display: grid;
  gap: 8px;
  max-height: 70dvh;
  overflow: auto;
}
.sheet button { background: var(--card-2); color: var(--ink); text-align: left; }
.sheet button.primary { background: var(--accent); color: white; text-align: center; font-weight: 800; }
.picker-results { display: grid; gap: 8px; }
.picker-head { margin: 8px 0 0; color: var(--muted); font-size: 0.85rem; font-weight: 700; }
.picker-choice { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: left; background: var(--card-2); color: var(--ink); }
.picker-choice span { color: var(--muted); font-size: 0.9rem; }
.exercise-create { display: grid; gap: 8px; }
.muscles { border: 0; margin: 0; padding: 0; display: grid; gap: 4px; }
.muscles legend { font-weight: 700; margin-bottom: 4px; }
