:root {
  color-scheme: dark;
  --bg: #0b0b0c;
  --panel: #171719;
  --panel-2: #202023;
  --text: #f7f7f8;
  --muted: #a5a5aa;
  --line: #2d2d31;
  --accent: #f4f4f5;
  --danger: #ff6b6b;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
#app {
  max-width: 720px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 16px calc(104px + env(safe-area-inset-bottom));
}
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 30px; margin-bottom: 6px; }
h2 { font-size: 20px; margin-bottom: 14px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  margin: 14px 0;
}
.hero { padding: 22px; }
.hero-title { font-size: 28px; font-weight: 800; letter-spacing: -0.5px; }
.hero-sub { color: var(--muted); margin: 8px 0 18px; }
.primary, .secondary, .ghost, .danger {
  width: 100%;
  border-radius: 14px;
  padding: 14px 16px;
  font-weight: 700;
}
.primary {
  background: var(--accent);
  color: #111;
  border: 0;
}
.secondary {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
}
.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(255,107,107,.35);
}
.compact {
  width: auto;
  padding: 10px 12px;
}
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
}
.stat strong { display: block; font-size: 24px; }
.list { display: grid; gap: 10px; }
.exercise {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}
.exercise-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.exercise-title { font-weight: 700; }
.badge {
  display: inline-block;
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  margin-top: 8px;
}
.nav {
  position: fixed;
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(688px, calc(100% - 24px));
  background: rgba(23,23,25,.95);
  backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: 20px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 8px;
}
.nav button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 10px 4px;
  font-size: 12px;
}
.nav button.active { color: var(--text); font-weight: 700; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}
input, select {
  width: 100%;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}
.set-row {
  display: grid;
  grid-template-columns: 36px 1fr 1fr 48px;
  gap: 8px;
  align-items: center;
  margin: 8px 0;
}
.set-row input { text-align: center; }
.check {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
}
.check.done { background: var(--accent); color: #111; }
.section-title { margin-top: 24px; }
.stack { display: grid; gap: 10px; }
.day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.selected-list {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}
.selected-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.icon-button {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--line);
}
.empty {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}
.spacer { height: 8px; }


.previous-box {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 14px;
}
.previous-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.previous-sets {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}
.previous-sets span {
  font-size: 13px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 9px;
}
.previous-empty {
  margin-bottom: 14px;
}
.set-labels {
  display: grid;
  grid-template-columns: 36px 1fr 1fr 48px;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
.transfer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.hidden-file {
  display: none;
}
.tiny-note {
  font-size: 12px;
  margin: 12px 0 0;
}
@media (max-width: 420px) {
  .previous-head {
    align-items: flex-start;
  }
  .previous-head .compact {
    padding: 9px 10px;
    font-size: 12px;
  }
}


.history-clickable {
  cursor: pointer;
}
.history-clickable:active {
  transform: scale(.99);
}
.history-open-label {
  margin-top: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.history-card-main {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}
.history-card-actions {
  display: grid;
  gap: 12px;
  justify-items: end;
}
.history-delete-button {
  border: 1px solid rgba(255,107,107,.35);
  background: transparent;
  color: var(--danger);
  border-radius: 10px;
  padding: 8px 10px;
  font-weight: 700;
}
.back-button {
  margin-bottom: 18px;
}
.history-detail-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}
.history-summary-pill {
  white-space: nowrap;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
}
.history-set-list {
  display: grid;
  gap: 8px;
}
.history-set-row {
  display: grid;
  grid-template-columns: 70px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.history-set-row:last-child {
  border-bottom: 0;
}
.history-set-number {
  color: var(--muted);
  font-size: 13px;
}
.done-text {
  font-size: 13px;
  font-weight: 700;
}
@media (max-width: 420px) {
  .history-set-row {
    grid-template-columns: 62px 1fr;
  }
  .history-set-row > :last-child {
    grid-column: 2;
  }
}


.pr-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 12px;
  margin: 0 0 14px;
}
.pr-box strong {
  display: block;
  margin-top: 4px;
  font-size: 17px;
}
.pr-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .6px;
}
.pr-date {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.pr-empty {
  color: var(--muted);
  font-size: 13px;
}
.exercise-info {
  flex: 1;
  min-width: 0;
}
.exercise-info .pr-box {
  margin: 10px 0 0;
}


.day-title-block {
  min-width: 0;
}
.day-title-block h2 {
  overflow-wrap: anywhere;
}
.day-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.day-actions .compact {
  width: auto;
}
.create-day-card {
  border-style: dashed;
}
.create-day-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}
.create-day-row .primary {
  width: auto;
}
@media (max-width: 420px) {
  .create-day-row {
    grid-template-columns: 1fr;
  }
  .create-day-row .primary {
    width: 100%;
  }
}
