* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
}

body {
  font-family: var(--font-heading);
  color: var(--color-text);
}

a {
  color: var(--color-accent);
  text-decoration: none;
}
a:hover {
  color: var(--color-accent-hover);
}

::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.page {
  min-height: 100vh;
  /* 100vh assumes browser chrome is fully hidden — mobile Safari's floating
     bottom toolbar sits on top of that, cutting off page-bottom content
     (e.g. the landing CTA button). 100dvh tracks the actually-visible
     viewport as the toolbar shows/hides. Kept vh above as a fallback for
     browsers predating dvh support (Safari <15.4) — this second
     declaration simply overrides it wherever dvh is understood. */
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg-gradient);
}

.page-content {
  flex: 1;
  padding: 64px var(--space-page-x) 0;
  overflow: auto;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.h1 {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 8px 0 0;
}

.subtitle {
  font-size: 15px;
  color: var(--color-text-muted);
  margin-top: 6px;
  line-height: 1.45;
}

.flash-banner {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--color-warning-bg);
  border: 1px solid var(--color-warning-border);
  color: var(--color-warning-text);
  font-size: 13px;
  line-height: 1.4;
}

.flash-banner-success {
  background: var(--color-accent-bg-strong);
  border-color: rgba(204, 255, 51, 0.25);
  color: var(--color-accent);
  display: flex;
  align-items: center;
  gap: 8px;
}

.empty-state {
  padding: 40px 20px;
}

.empty-icon-box {
  border-radius: 20px;
  border: 1.5px dashed var(--color-border-strong);
}

.status-bar {
  width: 6px;
  height: 38px;
  border-radius: 3px;
  flex-shrink: 0;
  background: var(--color-border-strong);
}

.status-bar.is-done {
  background: var(--color-accent);
}

/* Cards */

.card {
  border: 1.5px solid var(--color-border);
  background: var(--color-card);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.card-dim {
  background: var(--color-card-dim);
  opacity: 0.72;
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Buttons */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 54px;
  border-radius: var(--radius-lg);
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  width: 100%;
}

.btn-primary {
  background: var(--color-accent);
  color: var(--color-on-accent);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--color-border-strong);
  color: var(--color-text);
  font-weight: 600;
}

.btn-sm {
  height: auto;
  width: auto;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  gap: 6px;
}

.btn-danger-outline {
  background: transparent;
  border: 1.5px solid rgba(255, 107, 94, 0.3);
  color: var(--color-danger-text);
  font-weight: 600;
  height: 52px;
}

.page-footer {
  /* No horizontal padding — .page-content already applies var(--space-page-x), and
     every usage of this class was overriding it to 0 anyway. */
  padding: 14px 0 40px;
  background: linear-gradient(180deg, rgba(11, 11, 13, 0) 0%, var(--color-surface) 30%);
  margin-top: auto;
}

/* Full-height hero layout (Landing, permission-required) */

.hero-page {
  min-height: calc(100vh - 64px);
  min-height: calc(100dvh - 64px); /* see .page's comment on 100vh vs 100dvh */
  display: flex;
  flex-direction: column;
}

.cta-footer {
  padding: 48px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 340px;
}

.cta-caption {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--color-text-dim);
  text-align: center;
  line-height: 1.6;
}

/* Onboarding flow-form layout (goal picker, equipment checklist) */

.onboarding-page {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 240px);
  min-height: calc(100dvh - 240px); /* see .page's comment on 100vh vs 100dvh */
}

/* Avatar — circular photo-or-icon container (Today header, Settings) */

.avatar {
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-accent);
  flex-shrink: 0;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Settings row — linked card with an eyebrow label + value + chevron */

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  color: inherit;
}

.settings-row-value {
  font-size: 15px;
  font-weight: 600;
  margin-top: 4px;
}

/* Selectable option rows (goal picker, equipment checklist) — native
   radio/checkbox inputs, visually hidden, styled via the sibling label so
   selection needs zero JS. */

.option-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.option-list.is-compact {
  gap: 8px;
}

.option-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.option-row {
  display: block;
  border: 1.5px solid var(--color-border);
  background: var(--color-card);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
}

.option-input:checked + .option-row {
  border-color: var(--color-accent);
  background: var(--color-accent-bg);
}

.option-input:disabled + .option-row {
  opacity: 0.4;
  cursor: not-allowed;
}

.option-row-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 17px;
  font-weight: 600;
}

.option-row-desc {
  font-size: 13.5px;
  color: var(--color-text-muted);
  margin-top: 6px;
  line-height: 1.45;
}

.option-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--color-border-strong);
  flex-shrink: 0;
}

.option-input:checked + .option-row .option-check {
  background: var(--color-accent);
  border-color: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Compact row variant (equipment checklist) */

.option-row.is-compact {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
}

.option-row.is-compact .option-row-title {
  flex: 1;
  font-size: 16px;
}

.option-check.is-square {
  border-radius: var(--radius-xs);
}

/* Coach-decide card + focus-area grid (Today page body-part picker) */

.coach-decide-card {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1.5px solid var(--color-border);
  background: var(--color-card);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
}

.option-input:checked + .coach-decide-card {
  border-color: var(--color-accent);
  background: var(--color-accent-bg);
}

.coach-decide-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-accent-bg-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.best-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #0a0a0b;
  background: var(--color-accent);
  border-radius: 999px;
  padding: 4px 10px;
  flex-shrink: 0;
}

.option-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}

.option-divider::before,
.option-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.option-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.option-row.is-grid-tile {
  padding: 16px 14px;
}

.option-row.is-grid-tile .option-row-title {
  font-size: 15px;
}

.check-icon {
  display: none;
  flex-shrink: 0;
}

.option-input:checked + .option-row.is-grid-tile .option-row-title {
  color: var(--color-text);
  font-weight: 700;
}

.option-input:checked + .option-row.is-grid-tile .check-icon {
  display: inline-flex;
}

/* Pill button groups (reaction / difficulty) */

.pill-group {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.pill-label {
  flex: 1;
  height: 40px;
  border-radius: 11px;
  border: 1px solid var(--color-border-strong);
  color: var(--color-text-muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.option-input:checked + .pill-label {
  border: 1.5px solid var(--color-accent);
  background: var(--color-accent-bg-strong);
  color: var(--color-accent);
  font-weight: 600;
}

.option-input:checked + .pill-label.is-danger {
  border-color: var(--color-danger);
  background: var(--color-danger-bg);
  color: var(--color-danger-text);
}

/* Badges */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 5px 10px;
  border-radius: var(--radius-xs);
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.badge-accent {
  background: var(--color-accent-bg-strong);
  border: 1px solid rgba(204, 255, 51, 0.25);
  color: var(--color-accent);
}
.badge-accent .badge-dot {
  background: var(--color-accent);
}

.badge-warning {
  background: var(--color-warning-bg);
  border: 1px solid var(--color-warning-border);
  color: var(--color-warning-text);
}
.badge-warning .badge-dot {
  background: var(--color-warning-text);
}

.badge-neutral {
  border: 1px solid var(--color-border-strong);
  color: var(--color-text-muted);
}

.feedback-row {
  margin: -4px 0 10px;
}

.feedback-status {
  font-weight: 600;
  color: var(--color-text-muted);
}

.feedback-status.is-hated {
  color: var(--color-danger-text);
}

.feedback-status.is-liked {
  color: var(--color-accent);
}

/* Stats */

.stat-row {
  display: flex;
  gap: 22px;
  margin-top: 12px;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
}

.stat-label {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.stat-divider {
  width: 1px;
  background: var(--color-border);
}

/* Tab bar */

.tab-bar {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 12px 24px 34px;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  color: var(--color-text-faint);
}

.tab-item.is-active {
  color: var(--color-accent);
}

.tab-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 1px;
}

/* ==========================================================================
   Utilities — small, composable, reused across pages instead of inline
   styles. Values here are drawn directly from what the templates actually
   use, not a speculative scale. Genuinely dynamic values (computed per
   request from data, or macro parameters like avatar()'s size/bg) are the
   one deliberate exception that still needs a real inline style — a static
   utility class can't express a value that isn't known until render time.
   ========================================================================== */

/* Display / flex */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1; }
.shrink-0 { flex-shrink: 0; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-baseline { align-items: baseline; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }

/* Spacing */
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 2px; }
.mt-3 { margin-top: 3px; }
.mt-6 { margin-top: 6px; }
.mt-12 { margin-top: 12px; }
.mt-14 { margin-top: 14px; }
.mt-16 { margin-top: 16px; }
.mt-18 { margin-top: 18px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mt-40 { margin-top: 40px; }
.mt-auto { margin-top: auto; }
.mb-8 { margin-bottom: 8px; }
.mb-10 { margin-bottom: 10px; }
.pb-12 { padding-bottom: 12px; }
.pb-24 { padding-bottom: 24px; }
.px-4 { padding-left: 4px; padding-right: 4px; }
.overflow-auto { overflow: auto; }
.gap-2 { gap: 2px; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-9 { gap: 9px; }
.gap-12 { gap: 12px; }
.gap-14 { gap: 14px; }

/* Font size / weight */
.fs-10 { font-size: 10px; }
.fs-11 { font-size: 11px; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.fs-14 { font-size: 14px; }
.fs-15 { font-size: 15px; }
.fs-16 { font-size: 16px; }
.fs-17 { font-size: 17px; }
.fs-19 { font-size: 19px; }
.fs-20 { font-size: 20px; }
.fs-52 { font-size: 52px; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

/* Text color / typography */
.text-default { color: var(--color-text); }
.text-muted { color: var(--color-text-muted); }
.text-dim { color: var(--color-text-dim); }
.text-faint { color: var(--color-text-faint); }
.text-accent { color: var(--color-accent); }
.text-inherit { color: inherit; }
.text-center { text-align: center; }
.no-underline { text-decoration: none; }
.font-mono { font-family: var(--font-mono); }
.leading-tight { line-height: 0.95; }
.leading-snug { line-height: 1.4; }
.leading-normal { line-height: 1.5; }
.tracking-tight { letter-spacing: -1px; }
.tracking-wide { letter-spacing: 0.5px; }
.tracking-wider { letter-spacing: 1px; }

/* Sizing */
.w-32 { width: 32px; }
.h-32 { height: 32px; }
.w-64 { width: 64px; }
.h-64 { height: 64px; }
.bg-accent-strong { background: var(--color-accent-bg-strong); }
.min-w-0 { min-width: 0; }
.max-w-280 { max-width: 280px; }
.max-w-340 { max-width: 340px; }
.max-w-380 { max-width: 380px; }
.max-w-420 { max-width: 420px; }
