/* Workouts design system: bold, colourful, friendly.
   Dark is the default theme; light is chosen in Settings (html[data-theme]).
   Feature colours: Calendar = sky, Workout = coral, Progress = lime,
   Share/PRs = mango. "-ink" variants are the text-safe shade of each colour
   for the current theme (all >= 4.5:1 on that theme's surfaces). */
:root {
  /* palette */
  --navy: #0F1024;
  --offwhite: #F7F7FB;
  --violet: #6C5CE7;
  --violet-tint: #8C7CF0;   /* violet lifted so navy text on it passes AA */
  --coral: #FF6B6B;
  --mango: #FFB547;
  --lime: #B8F23A;
  --sky: #2EC5FF;
  --on-colour: #0F1024;     /* text on any bright fill */

  --grad-primary: linear-gradient(135deg, var(--violet-tint) 0%, var(--sky) 100%);
  --grad-hero: linear-gradient(135deg, var(--violet) 0%, var(--sky) 100%);
  --grad-hot: linear-gradient(135deg, var(--coral) 0%, var(--mango) 100%);

  --shadow-violet: 0 12px 32px rgba(108, 92, 231, 0.25);
  --shadow-coral: 0 12px 32px rgba(255, 107, 107, 0.3);
  --shadow-sky: 0 12px 32px rgba(46, 197, 255, 0.25);
  --shadow-lime: 0 12px 32px rgba(184, 242, 58, 0.22);

  --radius: 24px;
  --radius-sm: 16px;
  --tab-h: 64px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --t: 220ms;
}

/* ---------- dark (default) ---------- */
:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0F1024;
  --surface: #1B1C3A;
  --surface-2: #262849;
  --surface-3: #31335A;
  --border: rgba(255, 255, 255, 0.08);
  --text: #F7F7FB;
  --text-2: #B9BBD6;
  --text-3: #9A9CC0;
  --violet-ink: #A29BFE;
  --sky-ink: #2EC5FF;
  --coral-ink: #FF8A8A;
  --lime-ink: #B8F23A;
  --mango-ink: #FFB547;
  --danger: #FF8A8A;
  --bar: rgba(15, 16, 36, 0.82);
  --card-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  --highlight: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0) 40%);
  --blob-opacity: 0.55;
}
/* ---------- light ---------- */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #F7F7FB;
  --surface: #FFFFFF;
  --surface-2: #EEEEF7;
  --surface-3: #E3E3F1;
  --border: rgba(15, 16, 36, 0.08);
  --text: #0F1024;
  --text-2: #4A4C68;
  --text-3: #5D5F7D;
  --violet-ink: #5443D6;
  --sky-ink: #086A92;
  --coral-ink: #B42A26;
  --lime-ink: #3F6600;
  --mango-ink: #8A5100;
  --danger: #B42A26;
  --bar: rgba(255, 255, 255, 0.86);
  --card-shadow: 0 12px 32px rgba(108, 92, 231, 0.12);
  --highlight: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0) 40%);
  --blob-opacity: 0.35;
}

/* Feature colour for whichever tab is open (body[data-view] set by app.js). */
body { --feat: var(--sky); --feat-ink: var(--sky-ink); --feat-shadow: var(--shadow-sky); }
body[data-view="workout"] { --feat: var(--coral); --feat-ink: var(--coral-ink); --feat-shadow: var(--shadow-coral); }
body[data-view="progress"] { --feat: var(--lime); --feat-ink: var(--lime-ink); --feat-shadow: var(--shadow-lime); }
body[data-view="crew"] { --feat: var(--violet-tint); --feat-ink: var(--violet-ink); --feat-shadow: var(--shadow-violet); }

@media (prefers-reduced-motion: reduce) {
  :root { --t: 0ms; }
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--text-2); }
.error { color: var(--danger); font-size: 15px; font-weight: 600; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }

.boot { min-height: 100dvh; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--text-2); }

/* ================================================================ buttons */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  min-height: 52px; padding: 0 22px; border: none; border-radius: 18px;
  font-size: 17px; font-weight: 700; margin-top: 12px;
  transition: transform 150ms var(--ease), box-shadow var(--t) var(--ease), opacity 150ms;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--grad-primary); color: var(--on-colour); box-shadow: var(--shadow-violet); }
.btn.hot { background: var(--grad-hot); color: var(--on-colour); box-shadow: var(--shadow-coral); }
.btn.secondary { background: var(--surface-2); color: var(--feat-ink); }
.btn.text { background: none; color: var(--feat-ink); }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: 0.55; }
.btn-link { background: none; border: none; color: var(--violet-ink); font-size: 17px; font-weight: 700; min-height: 44px; min-width: 44px; padding: 0 4px; }
.pill-btn {
  min-height: 44px; padding: 0 18px; border: none; border-radius: 999px;
  background: color-mix(in srgb, var(--feat) 16%, transparent); color: var(--feat-ink);
  font-size: 15px; font-weight: 700;
  transition: transform 150ms var(--ease), background-color var(--t);
}
.pill-btn:active { transform: scale(0.96); }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: none; flex: none;
  background: var(--surface-2); color: var(--text-2); display: grid; place-items: center; font-size: 26px; line-height: 1;
  transition: transform 150ms var(--ease);
}
.icon-btn:active { transform: scale(0.92); }
.icon-btn svg { width: 22px; height: 22px; fill: currentColor; stroke: none; }
.icon-btn.plain { background: none; font-size: 30px; color: var(--feat-ink); }
.icon-btn.small { background: none; color: var(--text-3); font-size: 18px; }
.icon-btn.small svg { width: 18px; height: 18px; fill: none; stroke: currentColor; }
.icon-btn:disabled { opacity: 0.35; }

.card {
  background: var(--highlight), var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
}

/* ================================================================ app shell */
#app {
  position: relative;
  max-width: 680px;
  margin: 0 auto;
  padding: 0 20px calc(var(--tab-h) + env(safe-area-inset-bottom) + 104px);
}
.view { animation: rise var(--t) var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.large-header {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 28px) 0 18px;
}
.large-header h1 { font-size: 36px; line-height: 1.05; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.large-header h1::before {
  content: ""; display: block; width: 36px; height: 6px; border-radius: 3px; margin-bottom: 10px;
  background: var(--feat); box-shadow: var(--feat-shadow);
}
.subtitle { margin: 6px 0 0; color: var(--text-2); font-size: 15px; font-weight: 600; }

/* Floating Start button + tab bar */
.fab {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 16px); z-index: 20;
  min-height: 54px; padding: 0 30px; border: none; border-radius: 999px;
  background: var(--grad-hot); color: var(--on-colour); font-size: 17px; font-weight: 800;
  box-shadow: var(--shadow-coral);
  transition: transform 150ms var(--ease);
}
.fab:active { transform: translateX(-50%) scale(0.95); }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  padding: 6px 8px calc(env(safe-area-inset-bottom) + 6px);
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--border);
}
.tabbar button {
  height: calc(var(--tab-h) - 12px); border: none; border-radius: 16px; background: none; color: var(--text-2);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 12px; font-weight: 700; transition: color var(--t), background-color var(--t);
}
.tabbar svg { width: 24px; height: 24px; stroke-width: 2.1; }
.tabbar button[data-view="calendar"] { --c: var(--sky); --ci: var(--sky-ink); }
.tabbar button[data-view="workout"] { --c: var(--coral); --ci: var(--coral-ink); }
.tabbar button[data-view="progress"] { --c: var(--lime); --ci: var(--lime-ink); }
.tabbar button[data-view="crew"] { --c: var(--violet-tint); --ci: var(--violet-ink); }
.tabbar button.on { color: var(--ci); background: color-mix(in srgb, var(--c) 16%, transparent); }
@media (min-width: 700px) {
  .tabbar { left: 50%; right: auto; transform: translateX(-50%); width: 520px; bottom: 16px; border-radius: 24px; border: 1px solid var(--border); padding-bottom: 6px; box-shadow: var(--card-shadow); }
  .fab { bottom: calc(var(--tab-h) + 40px); }
}

/* ================================================================ calendar (sky) */
.cal-card { padding: 14px 12px 16px; }
.cal-nav { display: flex; align-items: center; gap: 0; margin-bottom: 8px; }
.cal-nav h2 { flex: 1; min-width: 0; margin: 0 0 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 17px; font-weight: 800; order: -1; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.cal-weekdays span { text-align: center; font-size: 12px; font-weight: 700; color: var(--text-3); text-transform: uppercase; padding: 4px 0; }
.cal-day {
  min-height: 50px; min-width: 0; padding: 0; border: none; background: none; border-radius: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums;
  transition: background-color var(--t), transform 150ms var(--ease);
}
.cal-day:active { transform: scale(0.92); }
.cal-day .n { width: 36px; max-width: 100%; height: 36px; display: grid; place-items: center; border-radius: 50%; border: 2px solid transparent; }
.cal-day.today .n {
  background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--grad-hero) border-box;
  font-weight: 800; color: var(--text);
}
.cal-day.selected .n { background: var(--sky); color: var(--on-colour); font-weight: 800; box-shadow: var(--shadow-sky); }
.cal-day.today.selected .n { background: linear-gradient(var(--sky), var(--sky)) padding-box, var(--grad-hero) border-box; }
.cal-day .marks { display: flex; gap: 3px; height: 8px; }
.cal-blank { min-height: 50px; }
.cal-nav .pill-btn { padding: 0 14px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.done { background: var(--sky); }
.dot.planned { border: 2px solid var(--mango); }
.cal-legend { display: flex; gap: 18px; justify-content: center; margin-top: 10px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }

.day-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 28px 0 12px; }
.day-head h2 { margin: 0; font-size: 24px; font-weight: 800; }

.workout-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.workout-card {
  width: 100%; text-align: left; padding: 16px 18px 16px 22px; display: block; position: relative; overflow: hidden;
  transition: transform 150ms var(--ease);
}
.workout-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--sky); }
.workout-card:active { transform: scale(0.985); }
.workout-card .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.workout-card strong { font-size: 17px; font-weight: 800; }
.workout-card .ex { color: var(--text-2); font-size: 15px; margin: 0; padding-right: 72px; }
.badge { font-size: 12px; font-weight: 800; padding: 4px 10px; border-radius: 999px; background: color-mix(in srgb, var(--sky) 18%, transparent); color: var(--sky-ink); }
.badge.planned { color: var(--mango-ink); background: color-mix(in srgb, var(--mango) 18%, transparent); }
.empty { color: var(--text-2); text-align: center; padding: 24px 0; margin: 0; }
.empty-state { text-align: center; padding: 16px 16px 40px; color: var(--text-2); position: relative; }
.empty-state .art { width: 150px; height: auto; display: block; margin: 0 auto 12px; animation: float 4s ease-in-out infinite; }
.empty-state p { margin: 0 0 6px; font-size: 17px; }
.empty-state .lead { color: var(--text); font-size: 20px; font-weight: 800; }
.empty-state .btn { max-width: 320px; margin: 20px auto 0; }

.workout-item { position: relative; }
.workout-item .card-share {
  position: absolute; right: 12px; bottom: 10px; min-height: 44px; padding: 0 16px;
  border: none; border-radius: 999px; background: color-mix(in srgb, var(--mango) 18%, transparent);
  color: var(--mango-ink); font-size: 15px; font-weight: 800;
}

/* ================================================================ workout (coral) */
.exercise-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.exercise { padding: 14px 14px 10px; position: relative; overflow: hidden; }
.exercise::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: var(--grad-hot); }
.ex-head { display: flex; align-items: center; gap: 2px; }
.ex-head input {
  flex: 1; min-width: 0; min-height: 44px; border: none; background: none; padding: 0 4px;
  font-size: 21px; font-weight: 800; outline: none;
}
.ex-head input::placeholder { color: var(--text-3); }
.set-grid { display: grid; grid-template-columns: 36px minmax(0, 1fr) minmax(0, 1fr) 44px; gap: 8px; align-items: center; }
.set-labels { margin: 8px 0 6px; font-size: 12px; font-weight: 800; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; }
.set-labels span { text-align: center; }
.set-row { margin-bottom: 8px; }
.set-row .idx {
  width: 32px; height: 32px; justify-self: center; display: grid; place-items: center; border-radius: 10px;
  background: var(--coral); color: var(--on-colour); font-variant-numeric: tabular-nums; font-weight: 800; font-size: 15px;
}
.set-row:nth-child(4n+2) .idx { background: var(--mango); }
.set-row:nth-child(4n+3) .idx { background: var(--sky); }
.set-row:nth-child(4n+4) .idx { background: var(--lime); }
.set-row input {
  width: 100%; min-height: 46px; border: 2px solid transparent; border-radius: 14px; background: var(--surface-2);
  text-align: center; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; outline: none;
  transition: border-color var(--t), background-color var(--t);
}
.set-row input::placeholder { color: var(--text-3); font-weight: 600; }
.set-row input:focus { border-color: var(--coral); background: var(--surface-3); }
.set-row input[aria-invalid="true"] { border-color: var(--danger); }
.add-set { width: 100%; min-height: 44px; border: none; background: none; color: var(--coral-ink); font-weight: 800; font-size: 15px; }
.last-time { margin: 0 4px 6px; font-size: 14px; font-weight: 600; color: var(--mango-ink); }
.last-time:empty { display: none; }
.wk-actions { margin-top: 24px; }
#wk-finish { min-height: 60px; font-size: 19px; font-weight: 800; border-radius: 20px; }

/* Celebration burst on Finish */
.burst { position: fixed; left: 50%; top: 40%; width: 0; height: 0; z-index: 200; pointer-events: none; }
.burst i {
  position: absolute; left: 0; top: 0; width: 10px; height: 14px; border-radius: 3px;
  animation: burst 400ms var(--ease) forwards;
}
@keyframes burst {
  from { transform: translate(-50%, -50%) rotate(0) scale(0.4); opacity: 1; }
  to { transform: translate(var(--x), var(--y)) rotate(var(--r)) scale(1); opacity: 0; }
}

/* ================================================================ progress (lime) */
.field-label { display: block; font-size: 13px; font-weight: 800; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; margin: 0 0 8px 4px; }
select {
  width: 100%; min-height: 52px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 18px;
  background: var(--surface); box-shadow: var(--card-shadow); font-size: 17px; font-weight: 700;
  appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%);
  background-position: calc(100% - 24px) 50%, calc(100% - 18px) 50%;
  background-size: 6px 6px; background-repeat: no-repeat;
}
.segmented {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px;
  margin: 16px 0;
}
.segmented button {
  min-height: 44px; border: 2px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text-2);
  font-size: 15px; font-weight: 700;
  transition: background-color var(--t), color var(--t), transform 150ms var(--ease);
}
.segmented button:active { transform: scale(0.96); }
.segmented button[aria-checked="true"] { background: var(--seg, var(--lime)); border-color: transparent; color: var(--on-colour); box-shadow: 0 8px 20px color-mix(in srgb, var(--seg, var(--lime)) 35%, transparent); }
#prog-metric [data-metric="e1rm"] { --seg: var(--lime); }
#prog-metric [data-metric="volume"] { --seg: var(--sky); }
#prog-metric [data-metric="top"] { --seg: var(--mango); }
.segmented.small { margin: 0; min-width: 130px; gap: 6px; }
.segmented.small button { min-height: 44px; padding: 0 12px; }
.segmented.small button[aria-checked="true"] { --seg: var(--violet-tint); }

.chart-card { position: relative; padding: 18px 8px 8px; }
.chart-caption { margin: 0 12px 4px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.chart { height: 280px; touch-action: pan-y; }
.chart svg { outline: none; display: block; width: 100%; height: 100%; overflow: visible; }
.chart rect { stroke: none; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--text-2); stroke: none; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart .line { stroke: var(--lime-ink); stroke-width: 3; }
.chart .area { fill: url(#lime-fill); stroke: none; opacity: 1; }
.chart .pt { fill: var(--lime-ink); stroke: var(--surface); stroke-width: 2; }
.chart .cross { stroke: var(--text-3); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .best { fill: var(--text); stroke: none; font-size: 12px; font-weight: 800; }
.chart-tip {
  position: absolute; top: 8px; transform: translateX(-50%); pointer-events: none;
  background: var(--lime); color: var(--on-colour); border-radius: 12px; padding: 6px 12px;
  box-shadow: var(--shadow-lime); font-size: 13px; font-weight: 600; white-space: nowrap; text-align: center;
}
.chart-tip b { display: block; font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ================================================================ sheets */
dialog.sheet {
  width: 100%; max-width: 640px; max-height: 90dvh; margin: auto auto 0;
  padding: 10px 20px calc(env(safe-area-inset-bottom) + 20px);
  border: 1px solid var(--border); border-radius: 28px 28px 0 0; background: var(--bg); color: var(--text); overflow-y: auto;
}
dialog.sheet[open] { animation: sheet-up 300ms var(--ease); }
dialog.sheet::backdrop { background: rgba(8, 8, 20, 0.55); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
@keyframes sheet-up { from { transform: translateY(100%); } }
@media (min-width: 700px) { dialog.sheet { margin: auto; border-radius: 28px; } }
.sheet-head { display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; text-align: center; margin-bottom: 14px; }
.sheet-head strong { font-size: 18px; font-weight: 800; }
.sheet-head .btn-link { justify-self: end; }
.detail-ex { padding: 14px 16px; margin-bottom: 12px; }
.detail-ex h3 { margin: 0 0 8px; font-size: 17px; font-weight: 800; }
.detail-ex table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 15px; }
.detail-ex td { padding: 7px 0; border-top: 1px solid var(--border); }
.detail-ex td:first-child { color: var(--text-2); width: 60px; font-weight: 600; }
.detail-ex td:last-child { text-align: right; font-weight: 700; }
#detail-share { background: var(--grad-hot); box-shadow: var(--shadow-coral); }
.settings-card .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; padding: 8px 16px; font-weight: 700; }
.settings-card .row + .row { border-top: 1px solid var(--border); }

.share-preview {
  display: block; width: 100%; max-width: 340px; margin: 0 auto; aspect-ratio: 4 / 5;
  border-radius: 20px; background: var(--navy); box-shadow: 0 16px 40px rgba(255, 181, 71, 0.25);
}
.two-up { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.two-up .btn { margin-top: 16px; }
#share-go { background: var(--grad-hot); box-shadow: var(--shadow-coral); }

.toast {
  position: fixed; inset: auto; margin: 0; border: none; width: max-content; max-width: calc(100vw - 32px); text-align: center;
  left: 50%; top: calc(env(safe-area-inset-top) + 12px); transform: translateX(-50%); z-index: 100;
  background: var(--surface); color: var(--text); box-shadow: var(--card-shadow); border: 1px solid var(--border);
  padding: 12px 20px; border-radius: 20px; font-size: 15px; font-weight: 700;
  animation: rise var(--t) var(--ease);
}
.toast.pr { background: var(--grad-hot); color: var(--on-colour); border-color: transparent; box-shadow: var(--shadow-coral); }

/* ================================================================ landing page */
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

.landing { overflow-x: hidden; }
.lp-wrap { max-width: 1160px; margin: 0 auto; padding: 0 20px; }
.blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: var(--blob-opacity); pointer-events: none; z-index: 0; }
.blob.v { background: var(--violet); } .blob.s { background: var(--sky); } .blob.c { background: var(--coral); }
.blob.m { background: var(--mango); } .blob.l { background: var(--lime); }

.lp-nav { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; padding: calc(env(safe-area-inset-top) + 16px) 0 8px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: -0.01em; color: var(--text); text-decoration: none; }
.brand img { width: 34px; height: 34px; border-radius: 10px; box-shadow: var(--shadow-violet); }
.lp-nav .btn { width: auto; margin: 0; min-height: 44px; padding: 0 18px; font-size: 15px; box-shadow: none; }

.hero { position: relative; padding: 24px 0 56px; }
.hero .blob.v { width: 320px; height: 320px; left: -120px; top: 40px; }
.hero .blob.s { width: 300px; height: 300px; right: -120px; top: 260px; }
.hero .blob.m { width: 200px; height: 200px; left: 40%; bottom: 0; }
.hero-grid { position: relative; z-index: 1; display: grid; gap: 28px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--lime) 18%, transparent); color: var(--lime-ink); font-size: 13px; font-weight: 800; letter-spacing: 0.02em; text-transform: uppercase;
}
.eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 4px color-mix(in srgb, var(--lime) 30%, transparent); }
.hero h1 { font-size: 44px; line-height: 1.02; font-weight: 800; letter-spacing: -0.03em; margin: 16px 0 14px; }
.grad-text { background: var(--grad-hero); -webkit-background-clip: text; background-clip: text; color: transparent; }
:root[data-theme="light"] .grad-text { background: linear-gradient(135deg, var(--violet-ink), var(--sky-ink)); -webkit-background-clip: text; background-clip: text; }
.hero .sub { font-size: 18px; color: var(--text-2); margin: 0 0 24px; max-width: 34ch; }
.hero .cta-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.hero .cta-row .btn { width: auto; margin: 0; padding: 0 28px; min-height: 56px; font-size: 18px; }
.hero .cta-row .note { font-size: 14px; color: var(--text-2); font-weight: 600; }
.hero-art { position: relative; height: 470px; }
.hero-art .athlete { position: absolute; height: 460px; width: auto; left: 2%; bottom: 0; z-index: 2; animation: float 4s ease-in-out infinite; filter: drop-shadow(0 20px 30px rgba(0, 0, 0, 0.25)); }
.hero-art .phone { position: absolute; right: 8px; top: 40px; z-index: 1; transform: rotate(6deg); width: 196px; height: 392px; }
.hero-art .chip {
  position: absolute; z-index: 3; padding: 10px 14px; border-radius: 16px; font-size: 14px; font-weight: 800;
  color: var(--on-colour); box-shadow: var(--shadow-coral); animation: float 4s ease-in-out infinite; animation-delay: -2s;
}
.hero-art .chip.pr { background: var(--sky); box-shadow: var(--shadow-sky); left: 48%; top: 14px; padding: 7px 11px; font-size: 12px; border-radius: 12px; }
.hero-art .chip.streak { background: var(--lime); right: 6%; bottom: 40px; box-shadow: var(--shadow-lime); animation-delay: -1s; }

/* Phone mockup (pure HTML/CSS) */
.phone {
  width: 220px; height: 440px; border-radius: 38px; padding: 10px; background: #08081A;
  box-shadow: 0 30px 60px rgba(8, 8, 26, 0.45), inset 0 0 0 2px rgba(255, 255, 255, 0.08), var(--shadow-violet);
}
.phone .screen {
  position: relative; width: 100%; height: 100%; border-radius: 30px; overflow: hidden; background: #0F1024; color: #F7F7FB;
  padding: 34px 14px 14px; font-size: 11px; line-height: 1.35;
}
.phone .screen::before { content: ""; position: absolute; top: 9px; left: 50%; width: 70px; height: 18px; border-radius: 10px; transform: translateX(-50%); background: #08081A; }
.m-title { font-size: 20px; font-weight: 800; margin: 2px 0 10px; letter-spacing: -0.02em; }
.m-title::before { content: ""; display: block; width: 22px; height: 4px; border-radius: 2px; background: var(--c, #FF6B6B); margin-bottom: 6px; }
.m-card { background: #1B1C3A; border-radius: 14px; padding: 9px 10px; margin-bottom: 8px; }
.m-card b { display: block; font-size: 12px; margin-bottom: 6px; }
.m-row { display: grid; grid-template-columns: 18px 1fr 1fr; gap: 5px; align-items: center; margin-bottom: 5px; }
.m-row i { width: 16px; height: 16px; border-radius: 5px; display: grid; place-items: center; font-style: normal; font-weight: 800; font-size: 9px; color: #0F1024; }
.m-row span { background: #262849; border-radius: 7px; text-align: center; padding: 4px 0; font-weight: 700; }
.m-btn { border-radius: 12px; text-align: center; padding: 9px 0; font-weight: 800; color: #0F1024; background: linear-gradient(135deg, #FF6B6B, #FFB547); margin-top: 6px; }
.m-hint { color: #FFB547; font-weight: 700; font-size: 10px; margin: -2px 0 6px; }
.m-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; text-align: center; font-weight: 700; font-size: 10px; }
.m-cal span { height: 22px; display: grid; place-items: center; border-radius: 50%; position: relative; color: #B9BBD6; }
.m-cal .d::after { content: ""; position: absolute; bottom: 0; width: 4px; height: 4px; border-radius: 50%; background: #2EC5FF; }
.m-cal .p::after { content: ""; position: absolute; bottom: -1px; width: 3px; height: 3px; border-radius: 50%; border: 1.5px solid #FFB547; }
.m-cal .t { background: #2EC5FF; color: #0F1024; }
.m-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-bottom: 8px; }
.m-seg span { border-radius: 999px; padding: 5px 0; text-align: center; font-weight: 800; background: #1B1C3A; color: #B9BBD6; }
.m-seg .on { background: #B8F23A; color: #0F1024; }
.m-stat { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.m-stat div { background: #1B1C3A; border-radius: 12px; padding: 8px; }
.m-stat strong { display: block; font-size: 16px; }
.m-stat em { font-style: normal; color: #B9BBD6; font-size: 10px; font-weight: 600; }
.m-tab { position: absolute; left: 10px; right: 10px; bottom: 10px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: #1B1C3A; border-radius: 14px; padding: 5px; }
.m-tab span { text-align: center; padding: 5px 0; border-radius: 10px; font-weight: 800; font-size: 9px; color: #B9BBD6; }
.m-tab .on { background: color-mix(in srgb, var(--c) 22%, transparent); color: var(--c); }

/* Sections */
.lp-section { position: relative; padding: 56px 0; }
.lp-section h2 { font-size: 34px; line-height: 1.08; font-weight: 800; letter-spacing: -0.025em; margin: 0 0 10px; }
.lp-section .lede { color: var(--text-2); font-size: 17px; margin: 0 0 28px; max-width: 46ch; }
.feature-grid { display: grid; gap: 16px; }
.feature { position: relative; padding: 22px; overflow: hidden; }
.feature .ic { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; margin-bottom: 14px; background: var(--c); color: var(--on-colour); box-shadow: 0 10px 24px color-mix(in srgb, var(--c) 40%, transparent); }
.feature .ic svg { width: 28px; height: 28px; stroke-width: 2.2; }
.feature h3 { margin: 0 0 6px; font-size: 20px; font-weight: 800; }
.feature p { margin: 0; color: var(--text-2); }
.feature::after { content: ""; position: absolute; right: -40px; top: -40px; width: 120px; height: 120px; border-radius: 50%; background: var(--c); opacity: 0.12; }
.feature.sky { --c: var(--sky); } .feature.coral { --c: var(--coral); } .feature.lime { --c: var(--lime); } .feature.mango { --c: var(--mango); }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; counter-reset: step; }
.steps li { display: grid; grid-template-columns: 60px 1fr; gap: 16px; align-items: center; padding: 18px; }
.steps .num { width: 60px; height: 60px; border-radius: 20px; display: grid; place-items: center; font-size: 26px; font-weight: 800; color: var(--on-colour); background: var(--c); box-shadow: 0 10px 24px color-mix(in srgb, var(--c) 40%, transparent); }
.steps h3 { margin: 0 0 4px; font-size: 19px; font-weight: 800; }
.steps p { margin: 0; color: var(--text-2); }

.preview-row {
  display: grid; grid-auto-flow: column; grid-auto-columns: 240px; gap: 20px;
  overflow-x: auto; scroll-snap-type: x mandatory; padding: 12px 20px 28px; margin: 0 -20px;
  scrollbar-width: none;
}
.preview-row::-webkit-scrollbar { display: none; }
.preview-row figure { margin: 0; scroll-snap-align: center; display: grid; justify-items: center; gap: 12px; }
.preview-row figcaption { font-weight: 800; color: var(--text-2); font-size: 15px; }
.preview-row .phone { width: 230px; height: 460px; }

.lp-cta { position: relative; text-align: center; padding: 64px 24px; margin: 24px 0 40px; border-radius: 32px; overflow: hidden; background: var(--grad-primary); color: #0F1024; box-shadow: var(--shadow-violet); }
.lp-cta h2 { font-size: 40px; margin: 0 0 10px; font-weight: 800; letter-spacing: -0.03em; color: #0F1024; }
.lp-cta p { margin: 0 auto; max-width: 36ch; color: #0F1024; font-weight: 600; }
.lp-cta .btn { width: auto; display: inline-flex; margin: 24px auto 14px; padding: 0 32px; min-height: 56px; background: #0F1024; color: #F7F7FB; box-shadow: 0 12px 32px rgba(15, 16, 36, 0.4); }
.lp-cta .invite { font-size: 14px; font-weight: 700; color: #0F1024; }

.lp-footer { padding: 24px 0 calc(env(safe-area-inset-bottom) + 32px); color: var(--text-2); font-size: 14px; font-weight: 600; display: flex; justify-content: space-between; border-top: 1px solid var(--border); }

/* scroll reveal */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 400ms var(--ease), transform 400ms var(--ease); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }

@media (min-width: 760px) {
  .lp-wrap { padding: 0 40px; }
  .hero { padding: 48px 0 80px; }
  .hero-grid { grid-template-columns: 1.05fr 1fr; align-items: center; gap: 40px; }
  .hero h1 { font-size: 64px; }
  .hero h1 .ln { display: block; }
  .hero .sub { font-size: 20px; }
  .hero-art { height: 560px; }
  .hero-art .athlete { height: 540px; }
  .hero-art .phone { width: 250px; height: 500px; }
  .lp-section { padding: 80px 0; }
  .lp-section h2 { font-size: 46px; }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .steps li { grid-template-columns: 1fr; align-items: start; }
  .preview-row { grid-auto-flow: row; grid-template-columns: repeat(3, 1fr); grid-auto-columns: auto; overflow: visible; margin: 0; padding: 12px 0 28px; justify-items: center; }
  .lp-cta { padding: 88px 40px; }
  .lp-cta h2 { font-size: 56px; }
  }
@media (min-width: 1100px) {
  .hero h1 { font-size: 80px; }
  .feature-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ================================================================ crew (violet) */
.text-input {
  width: 100%; min-height: 50px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 16px;
  background: var(--surface); color: var(--text); font-size: 17px; font-weight: 600;
}
.text-input:focus { outline: none; border-color: var(--violet-tint); box-shadow: 0 0 0 3px color-mix(in srgb, var(--violet-tint) 30%, transparent); }
dialog .field-label { margin-top: 14px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hint { font-size: 14px; color: var(--text-2); margin: 10px 4px 0; }
.lead-text { font-size: 24px; font-weight: 800; margin: 8px 0; }
.notice { background: color-mix(in srgb, var(--mango) 16%, transparent); color: var(--text); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 15px; margin: 0 0 12px; }
.empty-card { list-style: none; color: var(--text-2); padding: 18px; border: 2px dashed var(--border); border-radius: var(--radius); text-align: center; }
#crew-tabs { margin: 0 0 18px; }
#crew-tabs button[aria-selected="true"] { background: var(--violet-tint); color: var(--on-colour); border-color: transparent; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 0 12px; }
.section-head:first-child { margin-top: 0; }
.section-head h2 { margin: 0; font-size: 22px; font-weight: 800; }
.goal-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.goal { display: grid; grid-template-columns: 60px 1fr auto; gap: 14px; align-items: center; padding: 12px 12px 12px 14px; }
.goal.done { background: var(--highlight), color-mix(in srgb, var(--mango) 12%, var(--surface)); }
.goal-body strong { display: block; font-size: 16px; font-weight: 800; }
.goal-body span { font-size: 14px; color: var(--text-2); font-weight: 600; }
.ring-t { fill: #F7F7FB; font-size: 13px; font-weight: 800; }
.member-goals { list-style: none; margin-bottom: 14px; }
.who { display: flex; align-items: center; gap: 10px; margin: 0 0 8px 4px; font-size: 16px; }
.avatar { flex: none; display: block; }
.cheer {
  min-height: 44px; padding: 0 14px; border: none; border-radius: 999px; font-weight: 800; font-size: 14px;
  background: color-mix(in srgb, var(--mango) 18%, transparent); color: var(--mango-ink);
  transition: transform 150ms var(--ease);
}
.cheer:active { transform: scale(0.94); }
.cheer.small { min-width: 44px; padding: 0 10px; }
.cheer.sent { background: var(--surface-2); color: var(--text-2); }

.comp { padding: 18px; margin-bottom: 14px; }
.comp-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.eyebrow-sm { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--violet-ink); }
.comp h3 { margin: 6px 0 2px; font-size: 21px; font-weight: 800; }
.small { font-size: 14px; }
.badge.live { color: var(--lime-ink); background: color-mix(in srgb, var(--lime) 18%, transparent); }
.podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; align-items: end; margin: 18px 0 8px; }
.podium .step { display: grid; justify-items: center; gap: 4px; text-align: center; min-width: 0; }
.podium .step strong { font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium .step > span { font-size: 13px; font-weight: 700; color: var(--text-2); }
.podium .block {
  width: 100%; border-radius: 14px 14px 6px 6px; display: grid; place-items: center; font-size: 22px; font-weight: 800;
  color: var(--on-colour); background: linear-gradient(180deg, var(--pc), color-mix(in srgb, var(--pc) 70%, #0F1024));
}
.podium .p1 .block { height: 84px; } .podium .p2 .block { height: 62px; } .podium .p3 .block { height: 48px; }
.podium .me strong { color: var(--violet-ink); }
.standings { list-style: none; margin: 10px 0 0; padding: 0; }
.standings li { display: grid; grid-template-columns: 28px 28px 1fr auto auto; gap: 10px; align-items: center; min-height: 48px; border-top: 1px solid var(--border); }
.standings .rank { font-weight: 800; color: var(--text-2); text-align: center; }
.standings .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.standings .score { font-weight: 800; font-variant-numeric: tabular-nums; }
.joined { margin: 12px 0 0; font-weight: 700; color: var(--lime-ink); }
.past summary { cursor: pointer; font-weight: 800; color: var(--violet-ink); min-height: 44px; display: flex; align-items: center; }

.feed-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.feed-item { display: grid; grid-template-columns: 32px 1fr; gap: 12px; align-items: start; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.feed-item p { margin: 0; font-size: 15px; }
.feed-item .when { display: block; font-size: 13px; color: var(--text-2); margin-top: 2px; font-weight: 600; }

/* settings */
.settings-card { margin-top: 14px; }
.settings-card .row.col { flex-direction: column; align-items: stretch; gap: 8px; }
.settings-card .inline { display: flex; gap: 8px; }
.settings-card .inline input { flex: 1; min-height: 44px; border: 1px solid var(--border); border-radius: 12px; padding: 0 12px; background: var(--surface-2); font-weight: 600; }
.settings-card .hint { margin: 0 16px 14px; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 44px; height: 44px; border-radius: 50%; border: 3px solid transparent; background: var(--sw); display: grid; place-items: center; padding: 0; }
.swatch[aria-checked="true"] { border-color: var(--text); background: #0F1024; }
.swatch:disabled { opacity: 0.25; cursor: not-allowed; }
.switch { appearance: none; -webkit-appearance: none; width: 52px; height: 32px; border-radius: 999px; background: var(--surface-3); position: relative; cursor: pointer; flex: none; transition: background-color var(--t); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.3); transition: transform var(--t) var(--ease); }
.switch:checked { background: var(--lime); }
.switch:checked::after { transform: translateX(20px); }

/* progress: Me | Crew + chips + crew chart (always on navy so person colours read the same in both themes) */
#prog-mode { margin: 0 0 16px; }
#prog-mode button[aria-checked="true"] { background: var(--violet-tint); color: var(--on-colour); border-color: transparent; }
#prog-metric [data-metric="pct"] { --seg: var(--violet-tint); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px 0 6px; border-radius: 999px;
  border: 2px solid var(--border); background: var(--surface); color: var(--text-2); font-weight: 700; font-size: 15px;
}
.chip[aria-pressed="true"] { border-color: var(--pc); color: var(--text); background: color-mix(in srgb, var(--pc) 14%, var(--surface)); }
.chip[aria-pressed="false"] .avatar { opacity: 0.45; }
.chart-card.crew-mode { background: #0F1024; border-color: rgba(255,255,255,.08); }
.chart-card.crew-mode .chart-caption { color: #B9BBD6; }
.chart-card.crew-mode .chart .axis { fill: #B9BBD6; }
.chart-card.crew-mode .chart .grid { stroke: rgba(255,255,255,.08); }
.chart .zero { stroke: rgba(255,255,255,.35); stroke-width: 1; stroke-dasharray: 4 4; }
.chart .pline { fill: none; stroke-linejoin: round; stroke-linecap: round; }
.chart .hit { fill: none; stroke: transparent; stroke-width: 18; cursor: pointer; }
.chart .lead { stroke-width: 1; stroke-dasharray: 2 3; opacity: 0.6; }
.chart .plabel { stroke: none; font-size: 12px; font-weight: 800; cursor: pointer; }
.chart .person { transition: opacity var(--t); cursor: pointer; }
.chart-card.crew-mode .chart-tip { background: #1B1C3A; color: #F7F7FB; box-shadow: 0 8px 24px rgba(0,0,0,.4); text-align: left; display: grid; gap: 2px; }
.chart-tip .tdate { font-size: 12px; color: #B9BBD6; font-weight: 700; }
.chart-tip .trow { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; }
.chart-tip .trow i { color: #B9BBD6; font-weight: 600; }
/* "Have an invite?" buttons: coral to mango, navy text (6.8:1+) */
.hero .cta-row .invite-btn { min-height: 44px; padding: 0 18px; font-size: 15px; box-shadow: var(--shadow-coral); }
.lp-cta .invite-btn { display: flex; width: auto; margin: 0 auto 14px; padding: 0 18px; min-height: 44px; font-size: 15px; background: var(--grad-hot); color: var(--on-colour); box-shadow: 0 10px 22px rgba(15, 16, 36, 0.3); }
#prog-metric { gap: 6px; }
#prog-metric button { white-space: nowrap; font-size: 14px; padding: 0 6px; }
