:root {
  --bg: #f5f6f1;
  --surface: #ffffff;
  --ink: #16201b;
  --muted: #68736d;
  --line: #dfe5dd;
  --strong: #10231d;
  --accent: #21724f;
  --accent-soft: #e5f1ea;
  --amber: #9f6815;
  --red: #9b3932;
  --shadow: 0 14px 34px rgba(16, 35, 29, 0.08);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

button,
textarea,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  min-height: 100svh;
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: calc(88px + env(safe-area-inset-bottom));
}

.app-header {
  align-items: center;
  background: var(--strong);
  color: #f9fbf8;
  display: flex;
  justify-content: space-between;
  min-height: 116px;
  padding: calc(22px + env(safe-area-inset-top)) 18px 20px;
}

.eyebrow {
  color: #b7d4c5;
  font-size: 0.75rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  margin: 0 0 4px;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 1.9rem;
  letter-spacing: 0;
  line-height: 1.05;
}

h2 {
  color: var(--strong);
  font-size: 1.15rem;
  letter-spacing: 0;
  margin-bottom: 12px;
}

h3 {
  color: var(--strong);
  font-size: 1rem;
  letter-spacing: 0;
}

.week-pill {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 800;
  padding: 8px 12px;
}

main {
  padding: 18px 14px 0;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.week-controls {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: 64px 1fr 64px;
  margin-bottom: 14px;
}

.week-controls h2 {
  margin-bottom: 2px;
  text-align: center;
}

.week-controls p {
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
}

.quiet-button {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--strong);
  font-weight: 850;
  min-height: 42px;
}

.quiet-button:disabled {
  color: #a3aaa6;
}

.status-block,
.warmup-card,
.step-card,
.reference-card,
.history-card,
.workout-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.status-block {
  margin-bottom: 12px;
  padding: 14px;
}

.warmup-card {
  margin-bottom: 12px;
  padding: 14px;
}

.warmup-card h2 {
  margin-bottom: 10px;
}

.warmup-list {
  display: grid;
  gap: 1px;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.warmup-list div {
  background: #fbfdfb;
  padding: 12px;
}

.warmup-list div:nth-child(odd) {
  border-right: 1px solid var(--line);
}

.warmup-list div:nth-child(-n + 2) {
  border-bottom: 1px solid var(--line);
}

.warmup-list strong {
  color: var(--ink);
  display: block;
  font-size: 0.92rem;
  line-height: 1.25;
}

.status-line {
  color: var(--muted);
  display: flex;
  font-size: 0.86rem;
  font-weight: 750;
  justify-content: space-between;
  margin-bottom: 10px;
}

.meter {
  background: #edf1eb;
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
}

.meter span {
  background: var(--accent);
  display: block;
  height: 100%;
  transition: width 160ms ease;
  width: 0;
}

.label {
  color: var(--muted);
  display: block;
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.step-card strong {
  color: var(--ink);
  display: block;
  font-size: 1rem;
}

.stack {
  display: grid;
  gap: 10px;
  margin-bottom: 22px;
}

.workout-card {
  padding: 14px;
  transition: border-color 160ms ease, background 160ms ease;
}

.workout-card.is-complete {
  background: #fbfdfb;
  border-color: #bcd8c7;
}

.workout-top {
  align-items: start;
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr auto;
}

.workout-card p {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

.workout-details {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 12px;
  padding-top: 10px;
}

.workout-details li + li {
  margin-top: 7px;
}

.check-line {
  align-items: center;
  color: var(--ink);
  display: flex;
  font-weight: 750;
  gap: 10px;
  min-height: 36px;
}

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

.step-card {
  display: grid;
  gap: 8px;
  margin-bottom: 22px;
  padding: 14px;
}

.step-card-main {
  border-bottom: 1px solid var(--line);
  margin-bottom: 2px;
  padding-bottom: 10px;
}

textarea {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: var(--ink);
  min-height: 92px;
  padding: 12px;
  resize: vertical;
  width: 100%;
}

.subtle {
  color: var(--muted);
  font-size: 0.93rem;
  margin: -4px 0 16px;
}

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

.history-card {
  padding: 14px;
}

.history-row {
  align-items: baseline;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.history-card small {
  color: var(--muted);
  display: block;
  margin-top: 8px;
}

.history-card p {
  color: var(--muted);
  margin-top: 8px;
}

.badge {
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 850;
  padding: 4px 9px;
}

.badge.complete {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge.amber {
  background: #fff1d6;
  color: var(--amber);
}

.reference-card {
  margin-bottom: 12px;
  padding: 16px;
}

.reference-card h3 {
  margin-bottom: 8px;
}

.reference-card p,
.reference-card li {
  color: var(--muted);
  font-size: 0.93rem;
}

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

.reference-list div {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.reference-list div:first-child {
  border-top: 0;
  padding-top: 0;
}

.reference-list strong {
  color: var(--ink);
  display: block;
  font-size: 0.94rem;
  margin-bottom: 4px;
}

ul {
  margin: 0;
  padding-left: 1.15rem;
}

li + li {
  margin-top: 6px;
}

details {
  border-top: 1px solid var(--line);
  padding: 10px 0;
}

details:first-of-type {
  border-top: 0;
  padding-top: 0;
}

summary {
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
}

details p {
  margin-top: 8px;
}

.source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.source-links a {
  background: var(--accent-soft);
  border-radius: 999px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 850;
  padding: 7px 10px;
  text-decoration: none;
}

.bottom-nav {
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid var(--line);
  bottom: 0;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, 1fr);
  left: 50%;
  max-width: 480px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  position: fixed;
  transform: translateX(-50%);
  width: 100%;
  z-index: 5;
}

.tab-button {
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 850;
  min-height: 44px;
}

.tab-button.is-active {
  background: var(--strong);
  color: #ffffff;
}

@media (min-width: 481px) {
  body {
    background: #dfe5dd;
  }

  .app-shell {
    background: var(--bg);
    box-shadow: 0 0 0 1px rgba(16, 35, 29, 0.08);
  }
}

@media (max-width: 360px) {
  .warmup-list {
    grid-template-columns: 1fr;
  }

  .warmup-list div,
  .warmup-list div:nth-child(odd),
  .warmup-list div:nth-child(-n + 2) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .warmup-list div:last-child {
    border-bottom: 0;
  }
}
