* { box-sizing: border-box; margin: 0; padding: 0 }

/* The two PWA icon files public/assets ships are consumed by <link> tags
 * renderHeadOut emits (an HTML attribute, which can't hold CSS) — declared
 * here as real custom-property values, not comments, so the asset stays
 * documented in the one place that owns values instead of going untracked. */
:root {
  --icon-192: url(/assets/icon-192.png);
  --icon-512: url(/assets/icon-512.png);
}

html { min-height: 100%; background: var(--bg) }

body {
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
  padding: clamp(var(--space-5), 5vw, var(--space-7));
  background: var(--wash);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
}

.app {
  width: min(100%, 480px);
  margin: 0 auto;
  padding: var(--space-6) var(--space-5) var(--space-5);
}

h1 {
  color: var(--ink);
  font-size: var(--text-2xl);
  font-weight: 900;
  letter-spacing: -.03em;
  line-height: .98;
  text-transform: uppercase;
}

.app-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.eyebrow {
  margin-bottom: var(--space-1);
  color: var(--dim);
  font-size: var(--text-3xs);
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.phase-pill {
  flex-shrink: 0;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--raised);
  color: var(--dim);
  font-size: var(--text-3xs);
  font-weight: 760;
  text-transform: uppercase;
}

input[type=number],
input[type=text] {
  width: 100%;
  min-height: 52px;
  margin-bottom: var(--space-3);
  padding: 0 var(--space-1);
  border: 0;
  border-bottom: 2px solid rgb(var(--text-rgb) / .28);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-size: var(--text-md);
}

input[type=number]:focus,
input[type=text]:focus {
  outline: none;
  border-bottom-color: var(--accent);
}

input[type=number]::placeholder,
input[type=text]::placeholder {
  color: rgb(var(--text-rgb) / .45);
}

button,
.exercise-video {
  width: 100%;
  min-height: 56px;
  margin-bottom: var(--space-3);
  padding: 0 var(--space-4);
  border: 0;
  border-radius: var(--r-lg);
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  font-size: var(--text-base);
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  box-shadow: 0 4px 22px var(--glow);
  transition: transform var(--t) ease, background var(--t) ease;
}

button:focus-visible,
.exercise-video:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:active,
.exercise-video:active { transform: scale(.985) }

.btn-sync {
  background: var(--accent);
  color: var(--accent-ink);
}

/* Doctrine 4: glow belongs to the accent voice and renders only under
 * accent-filled elements — a disabled (gray) button must not carry it. */
.btn-sync:disabled {
  background: rgb(var(--text-rgb) / .1);
  color: var(--dim);
  cursor: not-allowed;
  opacity: 1;
  box-shadow: none;
}

.action-bar {
  position: sticky;
  bottom: 0;
  z-index: 10;
  margin: 0 calc(var(--space-2) * -1) calc(var(--space-2) * -1);
  padding: var(--space-3) var(--space-2) 0;
  background: linear-gradient(180deg, transparent, var(--bg) 40%);
}

.session-card,
.exercise-card {
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
}

/* .exercise-card gets its stacking gap from .exercise-list's grid gap; a bare
 * .session-card (nutrition's tally + food-log cards, workout's instruction
 * items) has no such wrapper, so it owns its own bottom margin like every
 * other card-level block here already does (.daily-standards, .logged-today,
 * .marker-grid). Without this, stacked session-cards touched with 0px gap. */
.session-card { margin-bottom: var(--space-5) }

.session-card { padding: var(--space-4) }

.session-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.session-meta span {
  color: var(--dim);
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.session-meta strong {
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.session-card p {
  color: var(--muted);
  font-size: var(--text-base);
  line-height: 1.5;
}

.exercise-list {
  display: grid;
  gap: var(--space-5);
}

.exercise-card { padding: var(--space-4) }

.exercise-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.exercise-head p {
  margin-bottom: var(--space-1);
  color: var(--dim);
  font-size: var(--text-3xs);
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.exercise-head h2 {
  color: var(--ink);
  font-size: 1.3rem;
  font-weight: 850;
  letter-spacing: 0;
  line-height: 1.15;
  text-transform: uppercase;
}

.exercise-head span {
  flex-shrink: 0;
  padding: var(--space-2) var(--space-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--raised);
  color: var(--dim);
  font-size: var(--text-2xs);
  font-weight: 760;
}

.exercise-media {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin: 0 0 var(--space-3);
}

.exercise-video {
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  text-decoration: none;
}

.cue,
.exercise-note {
  margin: 0 0 var(--space-1);
  color: var(--muted);
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.45;
}

.cue-list,
.note-box {
  margin: 0 0 var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 2px solid var(--line);
  border-radius: var(--r-lg);
  background: transparent;
}

/* One of the two raised-level surfaces (SDD R3): emphasis via the third
 * surface color and the strong border, not a heavier rule. */
.last-time-box {
  margin: 0 0 var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--raised);
}

.cue-list .cue:last-child,
.note-box .exercise-note,
.last-time-box .last-time {
  margin-bottom: 0;
}

.last-time {
  margin: 0 0 var(--space-3);
  color: rgb(var(--text-rgb) / .78);
  font-size: var(--text-base);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.log-grid {
  display: grid;
  gap: var(--space-1);
}

.log-labels,
.log-row {
  display: grid;
  grid-template-columns: 26px 1.8fr 1fr 1fr 1fr;
  align-items: center;
  gap: var(--space-2);
}

.log-labels {
  padding: 0 var(--space-1);
  color: rgb(var(--text-rgb) / .82);
  font-size: var(--text-3xs);
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-align: center;
}

.log-labels span:first-child {
  text-align: left;
}

.log-row span {
  display: grid;
  min-height: 44px;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--dim);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.log-row input {
  min-height: 48px;
  margin: 0;
  padding: 0;
  font-size: 1.3rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.log-row input::placeholder {
  font-size: var(--text-base);
}

.set-target {
  display: grid;
  min-height: 44px;
  padding: var(--space-1) var(--space-1);
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  line-height: 1.18;
  text-align: center;
}

.set-target small {
  display: block;
  margin-top: var(--space-1);
  color: var(--text);
  font-size: var(--text-base);
  font-weight: 850;
}

.set-target .rir-hard { color: var(--rir-hard) }
.set-target .rir-mod { color: var(--rir-mod) }
.set-target .rir-easy { color: var(--rir-easy) }

.instr-title {
  margin-bottom: var(--space-2);
  color: var(--ink);
  font-size: var(--text-md);
  font-weight: 850;
  line-height: 1.2;
}

.instr-text {
  color: var(--muted);
  font-size: var(--text-base);
  line-height: 1.52;
}

.instr-btn {
  min-height: 56px;
  margin-top: var(--space-4);
  margin-bottom: 0;
}

.daily-standards {
  margin-bottom: var(--space-5);
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
}

.standards-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.standards-head .eyebrow { margin-bottom: 0 }

.standard-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.standard-row:last-child { margin-bottom: 0 }
.standard-row .marker-field { flex: 1 1 60% }

.standard-row .standards-btn {
  flex: 0 0 auto;
  width: auto;
  min-width: 92px;
}

.standard-row .sync-status { flex-basis: 100% }

.logged-today {
  margin: var(--space-1) 0 var(--space-3);
  padding: var(--space-4) var(--space-4);
  border: 1px solid rgb(var(--accent-rgb) / .5);
  border-radius: var(--r-lg);
  background: transparent;
  color: var(--accent);
  font-size: var(--text-md);
  font-weight: 760;
  text-align: center;
  animation: rise-in var(--t) ease-out;
}

.standards-btn {
  min-height: 56px;
  margin: var(--space-1) 0 0;
}

.ack-card {
  margin-bottom: var(--space-5);
  padding: var(--space-4);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-card);
  background: var(--raised);
}

.ack-card .eyebrow { margin-bottom: var(--space-2) }

.ack-card p {
  margin-bottom: var(--space-3);
  color: var(--muted);
  font-size: var(--text-base);
}

.week-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--space-1);
  margin-bottom: var(--space-5);
}

.week-chip {
  padding: var(--space-2) 0;
  border: 1px solid var(--line);
  border-radius: var(--r-chip);
  background: var(--surface);
  color: var(--dim);
  font-size: var(--text-3xs);
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
}

.week-chip.today {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 4px 22px var(--glow);
}

.meal-label {
  margin-bottom: var(--space-2);
  color: var(--dim);
  font-size: var(--text-3xs);
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.meal-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-1);
}

.meal-item span {
  color: var(--muted);
  font-weight: 600;
  font-size: var(--text-base);
}

.meal-item strong {
  color: var(--ink);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-size: var(--text-base);
}

.meal-until {
  margin-top: var(--space-4);
  color: var(--dim);
  font-size: var(--text-xs);
  text-align: center;
}

.cockpit {
  display: grid;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.cockpit-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  padding: var(--space-4);
  gap: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--r-row);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  transition: background-color var(--t);
}

.cockpit-card:active {
  background: rgb(var(--text-rgb) / .08);
}

.cockpit-card-label {
  font-size: var(--text-md);
  font-weight: 800;
}

.cockpit-card-state {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--dim);
  font-size: var(--text-xs);
  font-weight: 700;
}

.cockpit-card-state::after {
  content: "\203A";
  color: var(--accent);
  font-size: var(--text-md);
  font-weight: 700;
}

.back-link {
  display: inline-block;
  margin-bottom: var(--space-5);
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 700;
  text-decoration: none;
}

.checkin-body {
  width: min(100%, 520px);
  margin: 0 auto;
  padding: var(--space-5) var(--space-4) var(--space-action-clearance);
  flex: 1;
  overflow-y: auto;
  scrollbar-width: none;
}

.checkin-body::-webkit-scrollbar { display: none }

.section-title {
  margin: var(--space-7) 0 var(--space-2);
  color: var(--dim);
  font-size: var(--text-3xs);
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.section-title:first-child { margin-top: 0 }

.marker-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.marker-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4) 0;
  border: 0;
  background: transparent;
}

.marker-field span {
  display: flex;
  align-items: flex-end;
  min-height: 28px;
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 800;
  line-height: 1.18;
}

.marker-field input {
  min-height: 48px;
  margin: 0;
  padding: 0 var(--space-1);
  font-size: var(--text-md);
  font-weight: 760;
}

.marker-field input { text-align: center }

/* nutrition's food-log form stacks two bare .marker-field labels + a button
 * directly in a .session-card, with no grid/flex wrapper to gap them (unlike
 * checkin's .marker-grid or cockpit's .standard-row, which supply gap
 * themselves) - so each one needs its own top spacing here. */
.session-card > .marker-field + * {
  margin-top: var(--space-3);
}

.outcomes-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.outcomes-row input { margin-bottom: 0 }

textarea,
.note {
  width: 100%;
  min-height: 82px;
  margin-bottom: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: var(--text-base);
  line-height: 1.5;
  resize: none;
}

textarea::placeholder { color: rgb(var(--text-rgb) / .26) }

textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.status {
  min-height: 18px;
  margin: var(--space-1) 0 var(--space-3);
  color: rgb(var(--text-rgb) / .56);
  font-size: var(--text-xs);
  text-align: center;
}

.status.ok { color: var(--accent) }
.status.err { color: var(--danger) }

.sync-status {
  display: none;
  padding: var(--space-2) 0 var(--space-1);
  font-size: var(--text-xs);
  font-weight: 600;
  text-align: center;
  transition: color var(--t), opacity var(--t);
}

.sync-status:not(:empty) {
  display: block;
  animation: rise-in var(--t) ease-out;
}

.sync-status[data-sync-state="saving"] { color: rgb(var(--text-rgb) / .5) }
.sync-status[data-sync-state="queued"] { color: var(--danger) }
.sync-status[data-sync-state="synced"] { color: var(--accent) }
.sync-status[data-sync-state="error"] { color: var(--danger) }

@keyframes rise-in {
  from { opacity: 0; transform: translateY(4px) }
  to { opacity: 1; transform: translateY(0) }
}

/* Motion is functional feedback only (set logged, sync-status changes, the
 * logged-today banner) - 100-400ms, same action always the same motion, per
 * dropdown-and-motion-patterns-2026-07.md. Disabled entirely below. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}


@media (max-width: 360px) {
  body { padding: var(--space-3) }
  .app { padding: var(--space-5) var(--space-4) }
  .exercise-head { flex-direction: column }
  .exercise-head span { align-self: flex-start }
  .log-labels,
  .log-row {
    grid-template-columns: 26px 1.8fr 1fr 1fr 1fr;
    gap: var(--space-1);
  }
  .checkin-body { padding: var(--space-4) var(--space-3) var(--space-action-clearance) }
  .marker-field { padding: var(--space-3) }
  .outcomes-row,
  .marker-grid { grid-template-columns: 1fr }
}
