:root {
  color-scheme: light;
  --ink: #1d1d1b;
  --paper: #f5f0e6;
  --paper-2: #fffaf0;
  --green: #8aaa79;
  --purple: #8d79a8;
  --yellow: #f0c84b;
  --red: #d95f49;
  --blue: #6d96a6;
  --muted: #6e6a61;
  --line: 3px solid var(--ink);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  min-height: 44px;
  border: var(--line);
  border-radius: var(--radius);
  background: var(--yellow);
  color: var(--ink);
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--ink);
}

button:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--ink);
}

button.secondary {
  background: var(--paper-2);
}

button.danger {
  background: var(--red);
  color: #fff;
}

button.icon {
  width: 44px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

input,
textarea,
select {
  width: 100%;
  border: var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--paper-2);
  color: var(--ink);
  font-weight: 800;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 950;
  text-transform: uppercase;
}

.app-shell {
  min-height: 100vh;
}

.boot-screen,
.login-screen {
  min-height: 100vh;
  display: grid;
  align-content: center;
  gap: 18px;
  padding: 24px;
  background:
    linear-gradient(90deg, transparent 0 94%, var(--ink) 94% 96%, transparent 96%),
    linear-gradient(0deg, transparent 0 94%, var(--ink) 94% 96%, transparent 96%),
    var(--paper);
  background-size: 38px 38px;
}

.stamp {
  display: inline-block;
  width: fit-content;
  border: var(--line);
  padding: 6px 10px;
  background: var(--green);
  font-weight: 950;
  letter-spacing: 0;
}

.boot-screen h1,
.login-screen h1,
.page-title {
  margin: 0;
  font-size: clamp(3.5rem, 19vw, 7.8rem);
  line-height: 0.84;
  letter-spacing: 0;
  text-transform: uppercase;
  max-width: 920px;
}

.login-panel {
  width: min(100%, 440px);
  display: grid;
  gap: 12px;
}

.login-help {
  border: var(--line);
  background: var(--yellow);
  padding: 10px 12px;
  font-weight: 850;
}

.layout {
  min-height: 100vh;
  padding-bottom: 86px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) 14px 12px;
  border-bottom: var(--line);
  background: var(--paper);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 950;
  text-transform: uppercase;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border: var(--line);
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--yellow);
  font-weight: 950;
}

.sync-state {
  font-size: 0.76rem;
  font-weight: 950;
  text-transform: uppercase;
  color: var(--muted);
}

.content {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 14px 28px;
}

.bottom-nav {
  position: fixed;
  z-index: 30;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-top: var(--line);
  background: var(--paper-2);
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-button {
  min-height: 62px;
  border: 0;
  border-right: var(--line);
  border-radius: 0;
  box-shadow: none;
  background: var(--paper-2);
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 8px 2px;
  font-size: 0.65rem;
}

.nav-button:last-child {
  border-right: 0;
}

.nav-button.active {
  background: var(--green);
}

.nav-icon {
  width: 22px;
  height: 22px;
}

.hero-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  align-items: stretch;
}

.block {
  border-top: var(--line);
  padding: 14px 0;
}

.poster-panel {
  border: var(--line);
  border-radius: var(--radius);
  background: var(--green);
  padding: 14px;
  display: grid;
  gap: 16px;
  min-height: 330px;
}

.poster-panel.yellow {
  background: var(--yellow);
}

.poster-panel.purple {
  background: var(--purple);
  color: #fff;
}

.poster-panel.paper {
  background: var(--paper-2);
  color: var(--ink);
}

.eyebrow {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 950;
  text-transform: uppercase;
}

.workout-name {
  margin: 0;
  font-size: clamp(3.2rem, 15vw, 8rem);
  line-height: 0.84;
  letter-spacing: 0;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.panel-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  justify-content: space-between;
}

.big-number {
  font-size: clamp(3rem, 17vw, 7rem);
  line-height: 0.85;
  font-weight: 950;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.stat {
  border: var(--line);
  border-radius: var(--radius);
  background: var(--paper-2);
  padding: 10px;
  min-height: 98px;
  display: grid;
  align-content: space-between;
}

.stat strong {
  font-size: clamp(1.8rem, 9vw, 3.6rem);
  line-height: 0.9;
}

.stat span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 950;
  text-transform: uppercase;
}

.list {
  display: grid;
  gap: 10px;
}

.row {
  border: var(--line);
  border-radius: var(--radius);
  background: var(--paper-2);
  padding: 12px;
  display: grid;
  gap: 6px;
}

.row-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.row-title {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1;
  text-transform: uppercase;
}

.meta {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.empty {
  min-height: 260px;
  display: grid;
  align-content: center;
  gap: 12px;
  border: var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: var(--paper-2);
}

.line-illo {
  width: min(100%, 280px);
  height: auto;
}

.active-workout {
  background: var(--ink);
  color: var(--paper);
  min-height: 100vh;
  padding-bottom: 24px;
}

.active-workout .topbar {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--paper);
}

.active-workout .brand-mark {
  border-color: var(--paper);
}

.active-workout button.secondary {
  background: var(--paper);
}

.workout-header {
  padding: 16px 14px 8px;
  display: grid;
  gap: 10px;
}

.workout-header h1 {
  margin: 0;
  font-size: clamp(3rem, 16vw, 7rem);
  line-height: 0.84;
  text-transform: uppercase;
}

.timer-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  border: 3px solid var(--paper);
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--purple);
  color: #fff;
  font-weight: 950;
}

.section-title {
  position: sticky;
  top: 65px;
  z-index: 10;
  margin: 22px -14px 12px;
  padding: 9px 14px;
  border-top: 3px solid var(--paper);
  border-bottom: 3px solid var(--paper);
  background: var(--yellow);
  color: var(--ink);
  font-size: 1rem;
  font-weight: 950;
  text-transform: uppercase;
}

.exercise {
  border: 3px solid var(--paper);
  border-radius: var(--radius);
  margin-bottom: 14px;
  background: #2b2b28;
}

.exercise.superset {
  border-color: var(--yellow);
}

.exercise-head {
  padding: 12px;
  display: grid;
  gap: 8px;
}

.exercise-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.exercise h3 {
  margin: 0;
  font-size: clamp(1.35rem, 7vw, 2.4rem);
  line-height: 0.95;
  text-transform: uppercase;
}

.tag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border: 2px solid currentColor;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.68rem;
  font-weight: 950;
  text-transform: uppercase;
}

.instruction {
  color: #d9d2c5;
  font-size: 0.9rem;
  line-height: 1.35;
}

.last-box {
  border-top: 2px dashed var(--paper);
  padding-top: 8px;
  color: #d9d2c5;
  font-size: 0.85rem;
  font-weight: 800;
}

.sets {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
}

.set-row {
  display: grid;
  grid-template-columns: 34px repeat(2, minmax(0, 1fr)) 48px;
  gap: 8px;
  align-items: center;
}

.set-row.cols-1 {
  grid-template-columns: 34px minmax(0, 1fr) 48px;
}

.set-row.cols-3 {
  grid-template-columns: 34px repeat(3, minmax(0, 1fr)) 48px;
}

.set-index {
  font-weight: 950;
  font-size: 1.1rem;
}

.stepper {
  display: grid;
  grid-template-columns: 44px minmax(70px, 1fr) 44px;
  border: 2px solid var(--paper);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
}

.stepper button {
  min-height: 54px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: var(--green);
  font-size: 1.1rem;
}

.stepper input {
  min-width: 0;
  border: 0;
  border-radius: 0;
  padding: 4px;
  background: var(--paper);
  text-align: center;
  font-size: clamp(1.45rem, 7vw, 2.4rem);
  line-height: 1;
  font-weight: 950;
}

.stepper-value {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-items: center;
  background: var(--paper);
  color: var(--ink);
}

.stepper-value input {
  padding-bottom: 0;
}

.stepper-value span {
  display: block;
  padding-bottom: 5px;
  text-align: center;
  font-size: 0.64rem;
  font-weight: 950;
  text-transform: uppercase;
  color: var(--muted);
}

.check {
  width: 48px;
  height: 48px;
  border: 3px solid var(--paper);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  background: transparent;
}

.check input {
  width: 26px;
  height: 26px;
  accent-color: var(--yellow);
}

.cardio-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 0 12px 12px;
}

.exercise-note {
  padding: 0 12px 12px;
}

.exercise-actions {
  padding: 0 12px 12px;
}

.add-set-button {
  width: 100%;
  min-height: 42px;
  box-shadow: none;
}

.exercise-note textarea {
  border-color: var(--paper);
  background: #171714;
  color: var(--paper);
}

.workout-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 10px 14px max(10px, env(safe-area-inset-bottom));
  background: var(--ink);
  border-top: 3px solid var(--paper);
}

.finish-panel {
  display: grid;
  gap: 8px;
  padding: 18px 0 32px;
}

.finish-panel button {
  min-height: 58px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(29, 29, 27, 0.72);
  display: grid;
  place-items: end center;
  padding: 14px;
}

.modal {
  width: min(100%, 720px);
  max-height: 88vh;
  overflow: auto;
  border: var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 14px;
  display: grid;
  gap: 12px;
}

.modal h2 {
  margin: 0;
  font-size: clamp(2rem, 11vw, 4rem);
  line-height: 0.9;
  text-transform: uppercase;
}

.recommendation {
  border: var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--paper-2);
  display: grid;
  gap: 8px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.page-tabs {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 12px;
}

.segmented button {
  min-height: 42px;
  font-size: 0.7rem;
  box-shadow: none;
}

.segmented button.active {
  background: var(--green);
}

.chart {
  display: grid;
  gap: 8px;
}

.bar-row {
  display: grid;
  grid-template-columns: 108px 1fr 70px;
  gap: 8px;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 850;
}

.bar {
  height: 20px;
  border: 2px solid var(--ink);
  background: var(--paper-2);
}

.bar span {
  display: block;
  height: 100%;
  background: var(--purple);
}

.form-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.inline-field {
  width: 86px;
}

.inline-field input {
  padding: 8px;
}

.json-editor {
  min-height: 230px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.84rem;
  line-height: 1.35;
  text-transform: none;
  font-weight: 700;
}

.account-status {
  min-height: 0;
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  font-weight: 900;
}

.account-status.success,
.account-status.error {
  border: var(--line);
  padding: 10px 12px;
}

.account-status.success {
  background: var(--green);
}

.account-status.error {
  background: var(--red);
  color: #fff;
}

.planner-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
}

.calendar-page {
  display: grid;
  gap: 12px;
}

.calendar-tabs {
  max-width: 520px;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 6px;
  font-size: 0.7rem;
  font-weight: 950;
  text-transform: uppercase;
  color: var(--muted);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.calendar-grid.week-grid {
  min-height: 360px;
}

.calendar-cell {
  min-height: 132px;
  border: var(--line);
  border-radius: var(--radius);
  background: var(--paper-2);
  padding: 6px;
  display: grid;
  align-content: start;
  gap: 6px;
}

.calendar-cell.muted-cell {
  opacity: 0.55;
}

.calendar-cell.today-cell {
  background: var(--yellow);
}

.calendar-cell.drop-target {
  outline: 4px solid var(--purple);
  outline-offset: -6px;
}

.calendar-date {
  width: 38px;
  min-height: 34px;
  box-shadow: none;
  padding: 0;
  background: var(--paper);
}

.calendar-items {
  display: grid;
  gap: 5px;
}

.workout-pill {
  min-height: 34px;
  width: 100%;
  padding: 4px 6px;
  box-shadow: none;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--green);
  text-align: left;
  font-size: 0.72rem;
  line-height: 1;
  overflow-wrap: anywhere;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22px;
  gap: 4px;
  align-items: center;
  font-weight: 900;
  text-transform: uppercase;
}

.workout-pill.completed {
  background: var(--purple);
  color: #fff;
}

.pill-delete {
  min-height: 22px;
  width: 22px;
  border: 0;
  border-radius: 50%;
  box-shadow: none;
  padding: 0;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.82rem;
  line-height: 1;
}

.day-focus {
  border: var(--line);
  border-radius: var(--radius);
  background: var(--paper-2);
  padding: 14px;
  display: grid;
  gap: 14px;
}

.program-card {
  margin-bottom: 14px;
}

.program-card.editing {
  outline: 4px solid var(--ink);
  outline-offset: -8px;
}

.program-name-input {
  font-size: clamp(2rem, 10vw, 4rem);
  line-height: 0.9;
  text-transform: uppercase;
  font-weight: 950;
}

.workout-row-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.details-panel {
  border: var(--line);
  border-radius: var(--radius);
  background: var(--paper-2);
  padding: 12px;
}

.details-panel summary {
  cursor: pointer;
  font-weight: 950;
  text-transform: uppercase;
}

.workout-card[draggable="true"] {
  cursor: grab;
}

.workout-card.dragging {
  opacity: 0.5;
}

.builder-page {
  display: grid;
  gap: 12px;
}

.builder-section,
.builder-exercise {
  border: var(--line);
  border-radius: var(--radius);
  background: var(--paper-2);
  padding: 12px;
  display: grid;
  gap: 12px;
  margin-bottom: 10px;
}

.builder-exercises {
  display: grid;
  gap: 10px;
}

.builder-exercise.dragging {
  opacity: 0.5;
}

.drag-handle {
  width: 34px;
  height: 34px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  background: var(--yellow);
  font-weight: 950;
}

.drag-handle.small {
  width: 30px;
  height: 30px;
  font-size: 0.9rem;
}

.builder-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.full {
  grid-column: 1 / -1;
}

.toast {
  position: fixed;
  z-index: 80;
  left: 14px;
  right: 14px;
  bottom: 86px;
  border: var(--line);
  border-radius: var(--radius);
  background: var(--yellow);
  padding: 12px;
  font-weight: 900;
}

.hidden {
  display: none !important;
}

@media (max-width: 760px) {
  .hero-grid,
  .form-grid,
  .cardio-grid,
  .builder-fields {
    grid-template-columns: 1fr;
  }

  .planner-head {
    display: grid;
  }

  .calendar-grid,
  .calendar-weekdays {
    gap: 4px;
  }

  .calendar-cell {
    min-height: 94px;
    padding: 4px;
  }

  .calendar-date {
    width: 30px;
    min-height: 28px;
    font-size: 0.72rem;
  }

  .workout-pill {
    font-size: 0.62rem;
    min-height: 30px;
    padding: 3px 4px;
  }

  .poster-panel {
    min-height: 300px;
  }

  .bottom-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .nav-button {
    min-height: 58px;
    font-size: 0.56rem;
  }

  .nav-icon {
    width: 20px;
    height: 20px;
  }

  .set-row {
    grid-template-columns: 28px repeat(2, minmax(0, 1fr)) 44px;
    gap: 6px;
  }

  .set-row.cols-1 {
    grid-template-columns: 28px minmax(0, 1fr) 44px;
  }

  .set-row.cols-3 {
    grid-template-columns: 28px repeat(3, minmax(0, 1fr)) 44px;
  }

  .stepper {
    grid-template-columns: 38px minmax(54px, 1fr) 38px;
  }

  .stepper button {
    min-height: 50px;
  }

  .stepper input {
    font-size: 1.35rem;
  }
}

@media (min-width: 960px) {
  .layout {
    padding-bottom: 0;
    padding-left: 92px;
  }

  .bottom-nav {
    top: 0;
    right: auto;
    width: 92px;
    bottom: 0;
    grid-template-columns: 1fr;
    grid-auto-rows: 76px;
    border-top: 0;
    border-right: var(--line);
  }

  .nav-button {
    border-right: 0;
    border-bottom: var(--line);
  }
}
