/* YoPulse: calm, clinical-clean look with soft colour, light and dark. */
:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --card-2: #f8fafc;
  --text: #0f172a;
  --muted: #475569;
  --line: #dde4ee;
  --primary: #0f766e;
  --primary-dark: #0b5952;
  --primary-soft: #e6f4f2;
  --accent: #4f46e5;
  --focus: #f59e0b;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 24px rgba(15, 23, 42, .06);
  --radius: 18px;

  --ok-bg: #dcfce7; --ok-fg: #14532d;
  --warn-bg: #ffedd5; --warn-fg: #7c2d12;
  --bad-bg: #fee2e2; --bad-fg: #7f1d1d;
  --info-bg: #e0e7ff; --info-fg: #312e81;
  --neutral-bg: #e2e8f0; --neutral-fg: #334155;

  --blob-1: rgba(20, 184, 166, .20);
  --blob-2: rgba(99, 102, 241, .16);
  --bar-sleep: #0f766e; --bar-low: #c2410c; --bar-load: #64748b; --chart-line: #4f46e5;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --card: #111a2c;
    --card-2: #0f1727;
    --text: #e5edf7;
    --muted: #a3b1c6;
    --line: #23314a;
    --primary: #2dd4bf;
    --primary-dark: #5eead4;
    --primary-soft: #0f2e33;
    --accent: #a5b4fc;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);

    --ok-bg: #12351f; --ok-fg: #86efac;
    --warn-bg: #3b2410; --warn-fg: #fdba74;
    --bad-bg: #3a1618; --bad-fg: #fca5a5;
    --info-bg: #1e2350; --info-fg: #c7d2fe;
    --neutral-bg: #1e293b; --neutral-fg: #cbd5e1;

    --blob-1: rgba(45, 212, 191, .12);
    --blob-2: rgba(129, 140, 248, .12);
    --bar-sleep: #2dd4bf; --bar-low: #fb923c; --bar-load: #94a3b8; --chart-line: #a5b4fc;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  position: relative;
  overflow-x: hidden;
}

/* Soft colour blobs behind the page. */
body::before, body::after {
  content: "";
  position: fixed;
  z-index: -1;
  width: 620px; height: 620px;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
}
body::before { top: -220px; right: -160px; background: var(--blob-1); }
body::after { bottom: -260px; left: -200px; background: var(--blob-2); }

.wrap { max-width: 780px; margin: 0 auto; padding: 0 16px; }

/* ---------- Header ---------- */
.top {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.top-row { display: flex; align-items: center; gap: 20px; min-height: 64px; flex-wrap: wrap; }
.top .wrap { max-width: 1200px; } /* the menu needs more room than the text column (up to seven tabs) */
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 19px; letter-spacing: -.02em;
  color: var(--text); text-decoration: none;
}
.logo {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, #14b8a6, #4f46e5);
  display: grid; place-items: center;
  box-shadow: 0 4px 12px rgba(79, 70, 229, .3);
}
.logo svg { width: 18px; height: 18px; }

.nav { display: flex; gap: 4px; margin-right: auto; }
.nav a {
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: 15px;
  padding: 7px 10px; border-radius: 999px; white-space: nowrap;
}
.nav a:hover { color: var(--text); background: var(--card); }
.nav a[aria-current="page"] { color: var(--primary-dark); background: var(--primary-soft); }

.lang { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.lang button {
  border: 0; background: transparent; color: var(--muted);
  padding: 5px 12px; font: inherit; font-size: 13px; font-weight: 700;
  border-radius: 999px; cursor: pointer;
}
.lang button[aria-pressed="true"] { background: var(--primary); color: #fff; }
@media (prefers-color-scheme: dark) { .lang button[aria-pressed="true"] { color: #042f2e; } }

/* ---------- Type ---------- */
.hero { padding: 44px 0 12px; }
h1 {
  font-size: clamp(30px, 5vw, 42px); line-height: 1.12; letter-spacing: -.03em;
  margin: 0 0 14px; font-weight: 800;
}
h2 { font-size: 20px; letter-spacing: -.01em; margin: 32px 0 10px; }
.lead { color: var(--muted); margin: 0 0 20px; font-size: 18px; max-width: 62ch; }

/* ---------- Cards and form ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

.drop {
  display: block; position: relative;
  border: 2px dashed color-mix(in srgb, var(--primary) 45%, var(--line));
  background: var(--card-2);
  border-radius: 14px;
  padding: 32px 16px;
  text-align: center; cursor: pointer;
  transition: background .15s, border-color .15s, transform .15s;
}
.drop::before {
  content: ""; display: block; width: 44px; height: 44px; margin: 0 auto 10px;
  border-radius: 12px; background: var(--primary-soft);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230f766e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 16V4'/%3E%3Cpath d='m6 10 6-6 6 6'/%3E%3Cpath d='M4 20h16'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center; background-size: 22px;
}
.drop:hover, .drop.over, .drop:focus-within { border-color: var(--primary); background: var(--primary-soft); }
.drop.over { transform: scale(1.01); }
.drop-title { display: block; font-weight: 700; }
.drop-sub { display: block; color: var(--muted); font-size: 14px; margin-top: 4px; }
.drop-file { display: block; margin-top: 10px; font-weight: 700; color: var(--primary-dark); word-break: break-all; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.consent { display: flex; gap: 12px; align-items: flex-start; margin: 18px 0; font-size: 15px; color: var(--muted); }
.consent input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--primary); }

.actions { display: flex; gap: 12px; flex-wrap: wrap; }
button.primary, button.ghost {
  font: inherit; font-weight: 700; font-size: 16px;
  border-radius: 12px; padding: 13px 22px; cursor: pointer;
  transition: transform .12s, box-shadow .12s, background .12s;
}
button.primary {
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 70%, var(--accent)));
  color: #fff; border: 0;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 35%, transparent);
}
@media (prefers-color-scheme: dark) { button.primary { color: #042f2e; } }
button.primary:hover { transform: translateY(-1px); box-shadow: 0 10px 22px color-mix(in srgb, var(--primary) 40%, transparent); }
button.primary:disabled { background: var(--neutral-bg); color: var(--neutral-fg); box-shadow: none; transform: none; cursor: not-allowed; }
button.ghost { background: transparent; color: var(--primary-dark); border: 1.5px solid var(--primary); }
button.ghost:hover { background: var(--primary-soft); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.error { color: var(--bad-fg); background: var(--bad-bg); font-weight: 600; margin: 14px 0 0; padding: 10px 14px; border-radius: 10px; }
.busy { color: var(--muted); margin: 14px 0 0; display: flex; align-items: center; gap: 10px; }
.busy:not([hidden])::before {
  content: ""; width: 16px; height: 16px; flex: none; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--primary);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.notice, .warn, .tag { border-radius: 12px; padding: 12px 16px; margin: 16px 0; font-size: 15px; }
.notice { background: var(--neutral-bg); color: var(--neutral-fg); }
.warn { background: var(--warn-bg); color: var(--warn-fg); font-weight: 600; }
.tag { background: var(--info-bg); color: var(--info-fg); font-weight: 600; }

.balance { margin: 0 0 14px; font-size: 14px; color: var(--muted); }
.buy { margin-top: 16px; border: 1.5px solid var(--primary); background: linear-gradient(180deg, var(--primary-soft), var(--card) 60%); }
.buy h2 { margin-top: 0; }
.card > h2:first-child, .card > :first-child > h2:first-child { margin-top: 0; } /* no empty band at the top of a card */

/* ---------- Results ---------- */
.result { padding: 8px 0 24px; }
.check { color: var(--muted); font-size: 14px; margin: 0 0 12px; }

.items { display: grid; gap: 10px; }
.item {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.item-head { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; flex-wrap: wrap; }
.item-name { font-weight: 700; }
.item-nums { color: var(--muted); font-size: 15px; margin: 4px 0 6px; }
.item-nums b { color: var(--text); }
.item p { margin: 0; }

.chip { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; letter-spacing: .01em; }
.chip.normal { background: var(--neutral-bg); color: var(--neutral-fg); }
.chip.good { background: var(--ok-bg); color: var(--ok-fg); }
.chip.low, .chip.high { background: var(--warn-bg); color: var(--warn-fg); }
.chip.abnormal { background: var(--bad-bg); color: var(--bad-fg); }
.chip.unknown { background: var(--neutral-bg); color: var(--neutral-fg); }

.terms dt { font-weight: 700; margin-top: 12px; }
.terms dd { margin: 2px 0 0; color: var(--muted); }

.disclaimer {
  margin-top: 28px; padding: 14px 16px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  font-size: 14px; color: var(--muted);
}

.foot { color: var(--muted); font-size: 13px; padding: 28px 16px 48px; }

/* ---------- Coach page ---------- */
.how { margin-bottom: 16px; font-size: 15px; }
.how summary { cursor: pointer; font-weight: 700; color: var(--primary-dark); }
.how ol { margin: 8px 0 0; padding-left: 22px; color: var(--muted); }

.verdict {
  position: relative; overflow: hidden;
  border-radius: 22px; padding: 26px 24px 22px; margin: 8px 0 16px;
  color: #fff; box-shadow: var(--shadow);
  background: linear-gradient(135deg, #334155, #475569);
}
.verdict::after {
  content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px;
  border-radius: 50%; background: rgba(255, 255, 255, .12);
}
.verdict h2 { margin: 2px 0 8px; font-size: 30px; letter-spacing: -.02em; }
.verdict p { margin: 0 0 8px; max-width: 56ch; }
.verdict-date { opacity: .9; font-size: 14px; text-transform: capitalize; }
.verdict-session { background: rgba(255, 255, 255, .16); border-radius: 12px; padding: 10px 14px; margin-top: 14px !important; }
.verdict.hard { background: linear-gradient(135deg, #047857, #0f766e); }
.verdict.moderate { background: linear-gradient(135deg, #1d4ed8, #4338ca); }
.verdict.easy { background: linear-gradient(135deg, #b45309, #9a3412); }
.verdict.rest { background: linear-gradient(135deg, #b91c1c, #881337); }

.sleep-card { background: linear-gradient(135deg, var(--info-bg), var(--card) 70%); }
.sleep-card h2 { margin-top: 0; }

.chart { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; box-shadow: var(--shadow); }
.chart-svg { width: 100%; height: auto; max-height: 210px; display: block; }
.bar-sleep { fill: var(--bar-sleep); }
.bar-low { fill: var(--bar-low); }
.bar-load { fill: var(--bar-load); }
.chart-target { stroke: var(--chart-line); stroke-dasharray: 3 3; stroke-width: 1.2; }
.chart-label { font-size: 9px; fill: var(--muted); }
.chart-legend { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.key-sleep { background: var(--bar-sleep); }
.key-load { background: var(--bar-load); margin-left: 12px; }

/* ---------- Workout ---------- */
.verdict-go {
  display: inline-block; margin-top: 12px; padding: 10px 16px; border-radius: 12px;
  background: #fff; color: #0f172a; font-weight: 800; text-decoration: none;
}
.verdict-go:hover { background: #e2e8f0; }

.stage { position: relative; overflow: hidden; padding-top: 14px; margin-bottom: 16px;
  background: radial-gradient(120% 80% at 50% 100%, var(--primary-soft), var(--card) 70%); }
.stage-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 26px; }
.stage-step { font-size: 14px; color: var(--muted); font-weight: 600; }
.avatar-wrap { width: min(100%, 320px); margin: 0 auto; aspect-ratio: 240 / 320; }
.avatar-svg { width: 100%; height: 100%; display: block; }
.hud { text-align: center; margin-top: 4px; }
.hud-ex { margin: 0; font-weight: 800; font-size: 20px; }
.hud-count { margin: 2px 0 8px; font-size: 34px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--primary-dark); }
.hud-next { margin: 8px 0 0; font-size: 14px; color: var(--muted); }
/* After the workout: the summary is a sentence, not a counter, and the points line must stay in view. */
.hud.finished .hud-count { font-size: 16px; font-weight: 600; letter-spacing: 0; color: var(--text); margin-bottom: 0; }
.hud.finished .bar, .hud.finished .hud-next { display: none; }
.bar { height: 8px; border-radius: 999px; background: var(--neutral-bg); overflow: hidden; max-width: 360px; margin: 0 auto; }
.bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width .2s linear; }
.speech {
  position: absolute; top: 46px; left: 50%; transform: translateX(-50%); max-width: 86%;
  background: var(--card); color: var(--text); border: 1px solid var(--line); box-shadow: var(--shadow);
  padding: 10px 14px; border-radius: 16px; font-weight: 600; text-align: center; margin: 0;
}
.stage .actions { justify-content: center; margin-top: 14px; }
.talk { margin-top: 14px; display: grid; gap: 10px; justify-items: center; }
.mic {
  font: inherit; font-weight: 800; font-size: 16px; border: 0; cursor: pointer; touch-action: none; user-select: none;
  padding: 14px 24px; border-radius: 999px; color: #fff; min-width: 220px;
  background: linear-gradient(135deg, var(--accent), var(--primary));
}
@media (prefers-color-scheme: dark) { .mic { color: #0b1220; } }
.mic[aria-pressed="true"] { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.06); box-shadow: 0 0 0 10px color-mix(in srgb, var(--accent) 25%, transparent); } }
.talk-form { display: flex; gap: 8px; width: 100%; max-width: 420px; }
.talk-form input { flex: 1; min-width: 0; font: inherit; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); }
.talk-form button.small { margin-top: 0; }
.talk .check { margin: 0; text-align: center; }

.field-row { display: flex; align-items: center; gap: 12px; margin: 10px 0; flex-wrap: wrap; }
.field-row label { font-weight: 700; min-width: 110px; }
.field-row select { font: inherit; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); }
.plan-list { margin: 14px 0 0; padding-left: 20px; color: var(--muted); }
#look { margin-top: 16px; }
.small-drop { padding: 18px 16px; }
.traits { display: grid; gap: 10px; margin-top: 12px; }
.trait-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.trait-name { font-weight: 700; font-size: 14px; min-width: 110px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; padding: 0; }
.swatch[aria-checked="true"] { outline: 3px solid var(--primary); outline-offset: 2px; }
.pill { font: inherit; font-size: 14px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; }
.pill[aria-checked="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
@media (prefers-color-scheme: dark) { .pill[aria-checked="true"] { color: #042f2e; } }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 3D character: the canvas fills the same box the 2D drawing used. */
.avatar-3d-holder { position: absolute; inset: 0; visibility: hidden; }
.avatar-wrap { position: relative; }
.avatar-wrap.is-3d .avatar-3d-holder { position: static; visibility: visible; width: 100%; height: 100%; }
.avatar-canvas { width: 100%; height: 100%; display: block; touch-action: pan-y; }

/* ---------- My body ---------- */
.compare { display: grid; gap: 10px; }
.morph-avatar { width: min(100%, 340px); }
.morph-hint { margin: 0; text-align: center; color: var(--muted); font-size: 13px; }
.morph-labels { display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; gap: 8px; }
.morph-labels .compare-arrow { align-self: center; }
.morph-col {
  font: inherit; display: grid; gap: 2px; align-content: start; text-align: center; cursor: pointer;
  padding: 10px 8px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card-2); color: var(--muted); font-size: 14px;
  transition: border-color .15s, background .15s;
}
.morph-col b { color: var(--text); font-size: 16px; }
.morph-col[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); }
.morph-col[aria-pressed="true"] b { color: var(--primary-dark); }
.morph-col:hover { border-color: var(--primary); }
.compare-arrow { font-size: 28px; color: var(--primary); font-weight: 800; }
.compare-progress, .compare > .check { grid-column: 1 / -1; }
.compare-progress .bar { max-width: none; }
.compare-progress .check { margin-top: 6px; text-align: center; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 10px; }
.grid-form label { display: grid; gap: 4px; font-size: 14px; font-weight: 700; }
.grid-form input, .grid-form select { font: inherit; font-weight: 400; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); }
.grid-form .wide { grid-column: 1 / -1; }
.grid-form .consent { display: flex; font-weight: 400; margin: 0; }
.history { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 6px; }
.history li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card-2); }
@media (max-width: 560px) { .compare-arrow { font-size: 20px; } }

.key-form { display: grid; gap: 8px; margin: 12px 0; }
.key-form label { font-weight: 700; font-size: 14px; }
.key-form input { font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); }
.key-form button.small { margin-top: 0; justify-self: start; }

/* ---------- Phone setup checklist ---------- */
.steps { list-style: none; margin: 16px 0 18px; padding: 0; display: grid; gap: 10px; }
.step { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card-2); }
.step-mark {
  flex: none; width: 26px; height: 26px; border-radius: 50%; margin-top: 1px;
  border: 2px solid var(--line); background: var(--card);
  display: grid; place-items: center; font-size: 14px; font-weight: 800;
}
.step.ok .step-mark { background: var(--ok-bg); border-color: var(--ok-fg); color: var(--ok-fg); }
.step.ok .step-mark::after { content: "✓"; }
.step.todo:not(.locked) { border-color: var(--primary); background: var(--primary-soft); }
.step.todo:not(.locked) .step-mark { border-color: var(--primary); }
.step.locked { opacity: .6; }
.step-body { flex: 1; min-width: 0; }
.step-text { margin: 2px 0 0; font-size: 15px; color: var(--muted); }
.step-text:empty { display: none; }
.step-how { margin: 8px 0 0; padding-left: 20px; font-size: 14px; color: var(--muted); }
.step-how li { margin-bottom: 4px; }
.step-actions { display: flex; gap: 8px; flex-wrap: wrap; }
button.small { font-size: 14px; padding: 8px 14px; margin-top: 10px; border-radius: 10px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Tablets and small laptops: the menu (up to seven tabs when signed in) gets its own row under the logo. */
@media (max-width: 1180px) {
  .top-row { gap: 12px; padding: 8px 0; }
  .nav { order: 3; width: 100%; margin-right: 0; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  /* When the tabs do not all fit, the row scrolls sideways; the fading right edge shows there is more. */
  .nav { padding-right: 28px; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
  .account-btn { margin-left: auto; }
}
@media (max-width: 560px) {
  .top-row { gap: 10px; padding: 8px 0; }
  /* Four tabs on a phone: tighter, and the row scrolls sideways if a language needs more room. */
  .nav { order: 3; width: 100%; margin-right: 0; gap: 2px; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { padding: 7px 6px; font-size: 13.5px; }
  .lang { margin-left: auto; }
  .hero { padding-top: 28px; }
  .card { padding: 18px; }
  .actions button { width: 100%; }
  .verdict h2 { font-size: 25px; }
}

.card-gap { margin-top: 16px; }
.saved-note { margin: 10px 0 0; color: var(--primary-dark); font-weight: 700; font-size: 14px; }

/* ---------- 3D character loading: soft glow instead of the 2D drawing ---------- */
.avatar-loading > :not(.avatar-3d-holder) { visibility: hidden; }
.avatar-loading::after {
  content: ""; position: absolute; inset: 18% 30% 8%; border-radius: 45% 45% 20% 20%;
  background: radial-gradient(ellipse at 50% 30%, color-mix(in srgb, var(--primary) 30%, transparent), transparent 70%);
  animation: avatarGlow 1.4s ease-in-out infinite alternate; pointer-events: none;
}
@keyframes avatarGlow { from { opacity: .35; } to { opacity: .9; } }
@media (prefers-reduced-motion: reduce) { .avatar-loading::after { animation: none; opacity: .6; } }

/* ---------- Workout: plan and coach set from the watch data (read-only) ---------- */
.from-data { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 6px; }
.from-data > div { background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.from-data dt { font-size: 13px; color: var(--muted); font-weight: 600; }
.from-data dd { margin: 2px 0 0; font-size: 17px; font-weight: 800; color: var(--text); }
.connect-link { display: inline-block; margin: 4px 0 10px; color: var(--primary-dark); font-weight: 700; text-decoration: none; }
.connect-link:hover { text-decoration: underline; }
#startBtn:disabled { opacity: .6; cursor: wait; }

/* ---------- Workout: character beside the settings on wide screens ---------- */
@media (min-width: 900px) {
  .wide .wrap { max-width: 1080px; }
  .wide .hero .lead { max-width: 62ch; }
  .workout-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 20px; align-items: start; }
  .workout-grid .stage { position: sticky; top: 16px; margin-bottom: 0; }
  .workout-grid .stage .avatar-wrap { width: min(100%, 400px); }
  .workout-side > .card:first-child { margin-top: 0; }
  /* During a workout the settings are hidden: the character gets the whole width, centred. */
  .workout-grid:has(#setup[hidden]) { grid-template-columns: minmax(0, 720px); justify-content: center; }
  .workout-grid:has(#setup[hidden]) .stage { position: relative; top: 0; }
  .workout-grid:has(#setup[hidden]) .stage .avatar-wrap { width: min(100%, 440px); }
}

/* ---------- Accounts ---------- */
.account-btn {
  flex: none; display: inline-flex; align-items: center; justify-content: center; min-height: 34px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--text);
  font-weight: 700; font-size: 14px; text-decoration: none; white-space: nowrap;
}
.account-btn:hover { border-color: var(--primary); }
.account-btn.in { width: 34px; padding: 0; background: linear-gradient(135deg, #14b8a6, #4f46e5); color: #fff; border: 0; }
.account-btn[aria-current="page"] { outline: 2px solid var(--primary); outline-offset: 2px; }
.wrap.narrow { max-width: 620px; }
.seg { display: inline-flex; background: var(--card-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; margin-bottom: 14px; }
.seg button { font: inherit; font-weight: 700; font-size: 15px; border: 0; background: transparent; color: var(--muted); padding: 8px 16px; border-radius: 999px; cursor: pointer; }
.seg button[aria-selected="true"] { background: var(--primary); color: #fff; }
@media (prefers-color-scheme: dark) { .seg button[aria-selected="true"] { color: #042f2e; } }
/* My body: character beside its settings, pinned so every change shows while you scroll the settings. */
.body-studio { display: grid; gap: 0; align-items: start; }
.studio-stage { position: sticky; top: var(--top-h, 64px); z-index: 2; }
@media (min-width: 900px) {
  .body-studio { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px; }
  .studio-stage { top: calc(var(--top-h, 64px) + 12px); }
  /* As big as the screen height allows (the Now / Goal buttons stay in view under it). */
  .studio-stage .morph-avatar { width: min(100%, 480px, calc((100vh - var(--top-h, 64px) - 300px) * 0.75)); }
}
@media (max-width: 899px) {
  /* Phone: the character stays at the top while the settings scroll under it. */
  .studio-stage { box-shadow: 0 10px 18px -10px rgba(0, 0, 0, .55); padding-top: 8px; padding-bottom: 10px; gap: 6px; }
  .studio-stage .morph-avatar { width: auto; height: 34vh; height: 34svh; }
  .studio-stage #trainingLine, .studio-stage .morph-hint, .studio-stage .compare-progress { display: none; }
  .studio-stage .morph-col { align-content: center; gap: 0; padding: 5px 6px; font-size: 12.5px; }
  .studio-stage .morph-col b { font-size: 14px; }
  .studio-stage .compare-arrow { font-size: 16px; }
}
/* Character look editor (My body + Workout) */
.look-tabs { display: flex; max-width: 100%; overflow-x: auto; }
.look-tabs button { flex: 1 1 auto; padding: 8px 12px; }
.look-panel { display: grid; gap: 14px; }
.look-panel > .check { margin: 0; }
.look-row { display: grid; gap: 6px; }
.look-label { font-weight: 700; font-size: 14px; }
.look-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.look-pills .pill, .look-pills .swatch { min-height: 36px; }
.look-pills .swatch { width: 36px; }
.look-slider { display: grid; gap: 4px; }
.look-slider input[type="range"] { width: 100%; accent-color: var(--primary); min-height: 28px; }
.look-ends { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.look-panel > .ghost.small { justify-self: start; }
.stack { display: grid; gap: 12px; }
.stack label:not(.consent) { display: grid; gap: 4px; font-size: 14px; font-weight: 700; }
.stack input:not([type="checkbox"]) {
  font: inherit; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card-2); color: var(--text); width: 100%;
}
.stack .consent { margin: 0; }
button.ghost.danger { color: var(--bad-fg); border-color: var(--bad-fg); }
button.ghost.danger:hover { background: var(--bad-bg); }
@media (max-width: 560px) { .lang { margin-left: 0; } .account-btn { margin-left: auto; } }

/* ---------- Friends ---------- */
.nav a { position: relative; }
.nav a.nav-chat { display: inline-flex; align-items: center; gap: 5px; }
.nav-chat svg { flex: none; }
.nav-chat .nav-dot { background: #e11d48; }
/* Phones: the chat icon moves from the menu row to the top bar, next to the profile circle. */
.top-chat { display: none; position: relative; width: 40px; height: 40px; border-radius: 50%; place-items: center; color: var(--text); }
.top-chat:hover { background: var(--card); }
.top-chat svg { width: 24px; height: 24px; }
.top-chat .nav-dot { top: 6px; right: 6px; width: 9px; height: 9px; background: #e11d48; box-shadow: 0 0 0 2px var(--bg); }
.top-chat:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
@media (max-width: 560px) {
  .nav a.nav-chat { display: none; }
  .top-chat { display: grid; margin-left: auto; }
  .top-chat + .account-btn { margin-left: 0; }
}
.nav-dot { position: absolute; top: 4px; right: 2px; width: 8px; height: 8px; border-radius: 50%; background: #f59e0b; }
h3.sub { margin: 18px 0 4px; font-size: 16px; }
.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row input { flex: 1; min-width: 0; font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card-2); color: var(--text); }
.share-list { display: grid; gap: 2px; }
.share-list .consent { margin: 8px 0; }
.req { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px; margin-top: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--card-2); }
.req span { flex: 1; min-width: 160px; font-weight: 600; }
.board { list-style: none; counter-reset: rank; padding: 0; margin: 6px 0 0; display: grid; gap: 6px; }
.board li { counter-increment: rank; display: grid; grid-template-columns: 30px 1fr auto; gap: 8px; align-items: center; padding: 9px 12px; border-radius: 10px; background: var(--card-2); border: 1px solid var(--line); }
.board li::before { content: counter(rank); font-weight: 800; color: var(--primary-dark); }
.board li.me { border-color: var(--primary); }
.board li span { color: var(--muted); font-size: 14px; }
.friends { display: grid; gap: 10px; }
.friend { display: grid; grid-template-columns: 56px 1fr; gap: 6px 12px; align-items: center; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--card-2); }
.friend-face { width: 56px; height: 74px; border-radius: 12px; overflow: hidden; background: var(--card); }
.friend-face svg { width: 100%; height: 100%; }
.friend-face.initial { height: 56px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 22px; color: #fff; background: linear-gradient(135deg, #14b8a6, #4f46e5); }
.friend-text p { margin: 2px 0 0; }
.friend-handle { color: var(--muted); font-size: 14px; margin-left: 6px; }
.friend-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
button.ghost.quiet { border-color: var(--line); color: var(--muted); }
button.has-new { border-color: #f59e0b; }
.challenge { padding: 12px; margin: 10px 0; border-radius: 14px; border: 1px solid var(--line); background: var(--card-2); }
.challenge-head { display: grid; gap: 2px; margin-bottom: 8px; }
.challenge-row { display: grid; grid-template-columns: minmax(80px, 1fr) 2fr auto; gap: 10px; align-items: center; margin: 6px 0; font-size: 14px; }
.challenge-row .bar { max-width: none; margin: 0; }
.challenge-count { color: var(--muted); font-variant-numeric: tabular-nums; }
/* ---------- Messages (Instagram-style) ---------- */
:root { --ig-theirs: #eef1f5; --ig-link: #4338ca; }
@media (prefers-color-scheme: dark) { :root { --ig-theirs: #1e293b; --ig-link: #a5b4fc; } }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.card-head button { margin-top: 0; display: inline-flex; align-items: center; gap: 8px; }
.ig-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #e11d48; color: #fff; font-size: 12px; font-weight: 800; display: inline-grid; place-items: center; }
body.ig-open { overflow: hidden; }
.ig { position: fixed; inset: 0; z-index: 60; background: rgba(2, 6, 23, .6); display: grid; place-items: center; padding: 24px; }
.ig[hidden] { display: none; }
.ig-box {
  width: min(940px, 100%); height: min(680px, calc(100vh - 48px)); display: grid; grid-template-columns: 340px 1fr;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}
.ig-inbox { display: grid; grid-template-rows: auto 1fr; border-right: 1px solid var(--line); min-height: 0; }
.ig-thread { display: grid; grid-template-rows: auto 1fr auto; min-height: 0; min-width: 0; position: relative; }
.ig-bar { display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 8px 12px 8px 18px; border-bottom: 1px solid var(--line); }
.ig-title { font-size: 20px; flex: 1; }
.ig-icon { font: inherit; font-size: 28px; line-height: 1; width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: var(--text); cursor: pointer; display: grid; place-items: center; }
.ig-icon:hover { background: var(--card-2); }
.ig-icon:focus-visible, .ig-row:focus-visible, .ig-cheer:focus-visible, .ig-send:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.ig-thread .ig-close { display: none; }      /* wide screens: one close button, on the inbox */
#igBack { display: none; }                    /* only on phones */
.ig-who { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.ig-names { display: grid; min-width: 0; }
.ig-names b, .ig-names span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ig-names span { font-size: 13px; color: var(--muted); }
.ig-list { overflow-y: auto; padding: 6px 0; }
.ig-row { font: inherit; color: var(--text); width: 100%; display: flex; align-items: center; gap: 12px; padding: 9px 18px; border: 0; background: transparent; text-align: left; cursor: pointer; }
.ig-row:hover { background: var(--card-2); }
.ig-row.active { background: var(--primary-soft); }
.ig-row-text { flex: 1; display: grid; gap: 2px; min-width: 0; }
.ig-row-text b { font-weight: 600; }
.ig-row-last { display: flex; min-width: 0; font-size: 14px; color: var(--muted); }
.ig-row-msg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ig-row-time { flex: none; white-space: nowrap; margin-left: 5px; }
.ig-row.unread b, .ig-row.unread .ig-row-last { font-weight: 800; color: var(--text); }
.ig-dot { width: 9px; height: 9px; border-radius: 50%; background: #4f46e5; flex: none; }
@media (prefers-color-scheme: dark) { .ig-dot { background: #818cf8; } }
/* Round letter picture; unread chats get the gradient ring. */
.ig-ava { width: var(--s); height: var(--s); flex: none; border-radius: 50%; display: inline-grid; place-items: center; }
.ig-ava.ring { padding: 2px; background: linear-gradient(45deg, #f59e0b, #e11d48, #9333ea); }
.ig-ava-in { width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: calc(var(--s) * .42); background: linear-gradient(135deg, var(--a), var(--b)); }
.ig-ava.ring .ig-ava-in { box-shadow: 0 0 0 2px var(--card); }
.ig-ava-gap { width: 28px; flex: none; }
/* Conversation */
.ig-log { overflow-y: auto; padding: 16px 16px 8px; display: flex; flex-direction: column; gap: 2px; overscroll-behavior: contain; }
.ig-pick { position: absolute; inset: 60px 0 0; display: grid; place-items: center; margin: 0; color: var(--muted); padding: 20px; text-align: center; }
.ig-pick[hidden] { display: none; }
.ig-hello { margin: auto 0 12px; display: grid; justify-items: center; gap: 6px; text-align: center; color: var(--muted); padding: 24px 0; }
.ig-hello b { color: var(--text); font-size: 18px; }
.ig-time { align-self: center; margin: 14px 0 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
.ig-msg { display: flex; align-items: flex-end; gap: 8px; max-width: 78%; }
.ig-msg.mine { align-self: flex-end; justify-content: flex-end; }
.ig-msg.theirs { align-self: flex-start; }
.ig-msg.first { margin-top: 6px; }
.ig-bubble { padding: 8px 14px; border-radius: 22px; font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; white-space: pre-wrap; }
.theirs .ig-bubble { background: var(--ig-theirs); color: var(--text); }
.mine .ig-bubble { background: linear-gradient(135deg, #4f46e5, #7e22ce); color: #fff; background-attachment: fixed; }
/* Grouped bubbles: the corners facing the next bubble from the same person are tighter. */
.mine:not(.last) .ig-bubble { border-bottom-right-radius: 6px; }
.mine:not(.first) .ig-bubble { border-top-right-radius: 6px; }
.theirs:not(.last) .ig-bubble { border-bottom-left-radius: 6px; }
.theirs:not(.first) .ig-bubble { border-top-left-radius: 6px; }
.ig-big { font-size: 44px; line-height: 1.1; }
.ig-cheer-msg { display: grid; justify-items: center; gap: 2px; }
.mine .ig-cheer-msg { justify-items: end; }
.theirs .ig-cheer-msg { justify-items: start; }
.ig-cheer-note { font-size: 12px; color: var(--muted); }
.ig-seen { align-self: flex-end; font-size: 12px; color: var(--muted); margin: 2px 4px 0 0; }
.ig-compose { display: flex; align-items: center; gap: 6px; margin: 10px 14px 14px; padding: 4px 6px 4px 18px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); }
.ig-compose[hidden] { display: none; }
.ig-compose:focus-within { border-color: var(--muted); }
.ig-compose input { flex: 1; min-width: 0; font: inherit; font-size: 15px; padding: 10px 0; border: 0; background: transparent; color: var(--text); outline: none; }
.ig-compose input::placeholder { color: var(--muted); opacity: 1; }
.ig-cheer { font-size: 22px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
.ig-cheer:hover { background: var(--card-2); }
.ig-send { font: inherit; font-weight: 800; color: var(--ig-link); background: transparent; border: 0; padding: 8px 12px; border-radius: 999px; cursor: pointer; }
.ig-cheer[hidden], .ig-send[hidden] { display: none; }
/* Phones: full screen, inbox or one conversation at a time. */
@media (max-width: 760px) {
  .ig { padding: 0; place-items: stretch; }
  .ig-box { width: 100%; height: 100%; height: 100dvh; border-radius: 0; border: 0; grid-template-columns: 1fr; }
  .ig-inbox { border-right: 0; }
  .ig.in-thread .ig-inbox, .ig:not(.in-thread) .ig-thread { display: none; }
  .ig-thread .ig-close { display: grid; }
  #igBack { display: grid; }
  .ig-bar { padding-left: 8px; }
  .ig-inbox .ig-bar { padding-left: 18px; }
  .ig-msg { max-width: 86%; }
}
@media (max-width: 560px) { .copy-row { flex-wrap: wrap; } .copy-row button { width: auto; } }

/* ---------- Shop (links to independent shops, by country) ---------- */
.shop-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 12px; }
.shop-country { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; }
.shop-country { min-width: 0; max-width: 100%; }
.shop-country span { white-space: nowrap; }
.shop-country select { font: inherit; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card-2); color: var(--text); min-width: 0; max-width: 100%; }
@media (max-width: 560px) { .shop-country { display: grid; gap: 6px; width: 100%; } .shop-country select { width: 100%; } }
.shop-top .check { margin: 0; }
.shop-notice { display: block; margin: 0 0 16px; }
.shop-tabs { display: flex; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.shop-tabs::-webkit-scrollbar { display: none; }
.shop-tabs button { white-space: nowrap; flex: 1 1 auto; }
#panel > .shop-sub:first-child { margin-top: 4px; }
h3.shop-sub { font-size: 16px; }
@media (max-width: 560px) { .shop-tabs button { padding: 8px 9px; font-size: 14px; } }
.shop-ideas { margin: 8px 0 14px; padding-left: 20px; display: grid; gap: 6px; }
.shop-sub { font-size: 18px; margin: 18px 0 10px; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.shop { display: grid; gap: 8px; align-content: start; padding: 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--card-2); }
.shop-head { display: flex; align-items: center; gap: 8px; font-size: 17px; }
.shop .check { margin: 0; }
.shop a.btn { justify-self: start; margin-top: 4px; padding: 8px 14px; font-size: 14px; border-radius: 10px; }
.shop-partner { padding: 1px 8px; border-radius: 999px; background: var(--info-bg); color: var(--info-fg); font-size: 12px; font-weight: 800; }

/* ---------- Points and rewards ---------- */
/* The balance in the top bar. */
.points-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 6px 11px; border-radius: 999px; text-decoration: none;
  background: var(--warn-bg); color: var(--warn-fg); font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.points-chip:hover { filter: brightness(1.06); }
.points-chip[aria-current="page"] { box-shadow: 0 0 0 2px var(--warn-fg); }
.points-chip:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
/* Where the menu has its own row, the chip leads the group on the right (chip, chat, profile, language). */
@media (max-width: 1180px) { .points-chip { margin-left: auto; } .points-chip ~ .account-btn, .points-chip + .top-chat { margin-left: 0; } }
@media (max-width: 560px) { .points-chip { padding: 5px 9px; } }
/* After a workout. */
.points-earned { margin-top: 10px; padding: 10px 14px; border-radius: 14px; background: var(--warn-bg); color: var(--warn-fg); display: grid; gap: 2px; justify-items: center; text-align: center; font-size: 14px; }
.points-earned a { color: inherit; font-weight: 700; }
.points-big { font-size: 24px; line-height: 1.1; }
.points-parts { font-size: 13px; }
.points-level { font-size: 16px; }
/* Rewards page. */
.points-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.points-label { margin: 0; color: var(--muted); font-weight: 700; font-size: 14px; }
.points-balance { margin: 0; font-size: 44px; font-weight: 800; line-height: 1.05; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.points-unit { font-size: 16px; font-weight: 700; color: var(--muted); letter-spacing: 0; }
.points-head .points-level { display: grid; justify-items: end; gap: 4px; font-size: 14px; }
.level-chip { display: inline-block; padding: 6px 12px; border-radius: 999px; background: var(--info-bg); color: var(--info-fg); font-weight: 800; font-size: 14px; }
.points-bar { max-width: none; margin: 14px 0 6px; height: 10px; }
.points-bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #0f766e, #4f46e5); }
.points-stats { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.points-card .actions { margin-top: 16px; }
.points-stats li { padding: 5px 11px; border-radius: 999px; background: var(--card-2); border: 1px solid var(--line); font-size: 13.5px; color: var(--text); }
.reward-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin: 10px 0 4px; }
.reward { display: grid; gap: 6px; align-content: start; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--card-2); }
.reward.owned { border-color: var(--primary); }
.reward-cost { font-weight: 700; color: var(--warn-fg); font-size: 14px; }
.reward-state { margin: 0; font-size: 14px; color: var(--muted); }
.reward.owned .reward-state { color: var(--primary-dark); font-weight: 700; }
.reward a { font-size: 14px; color: var(--primary-dark); font-weight: 700; text-decoration: none; }
.reward a:hover { text-decoration: underline; }
.reward button.small, .reward-row button.small { margin-top: 2px; justify-self: start; }
.reward-row { display: grid; gap: 6px; justify-items: start; margin-bottom: 6px; }
.reward-row .check { margin: 0; }
.badge-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.badge { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--card-2); }
.badge-icon { font-size: 28px; line-height: 1; filter: grayscale(1); opacity: .55; }
.badge.done { border-color: var(--primary); background: var(--primary-soft); }
.badge.done .badge-icon { filter: none; opacity: 1; }
.badge-text { display: grid; gap: 2px; font-size: 13.5px; color: var(--muted); min-width: 0; }
.badge-text b { color: var(--text); font-size: 15px; }
.badge.done .badge-text span { color: var(--primary-dark); font-weight: 700; }
.points-history { list-style: none; margin: 0; padding: 0; display: grid; }
.points-history li { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.points-history li:last-child { border-bottom: 0; }
.points-when { color: var(--muted); font-size: 13px; }
.points-history b { font-variant-numeric: tabular-nums; }
.points-history .plus b { color: var(--ok-fg); }
.points-history .minus b { color: var(--muted); }
.earn-list { margin: 0 0 10px; padding-left: 20px; display: grid; gap: 6px; }
/* Locked items in the look editor. */
.pill.locked { border-style: dashed; color: var(--muted); }
.look-unlock { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; border-radius: 12px; background: var(--warn-bg); color: var(--warn-fg); font-size: 14px; }
.look-unlock a { color: inherit; font-weight: 700; }
.look-unlock button.small { margin-top: 0; }
/* Level next to a friend's name. */
.level-tag { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--info-bg); color: var(--info-fg); font-size: 12px; font-weight: 800; vertical-align: 2px; }

/* ---------- First-run setup: step bar at the bottom of the screen ---------- */
.has-setup-bar { padding-bottom: 104px; }
.setup-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px; padding: 12px max(16px, calc((100vw - 1048px) / 2));
  background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(0, 0, 0, .18);
}
.setup-info { flex: 1; min-width: 0; }
.setup-step { margin: 0; font-weight: 800; font-size: 15px; color: var(--text); }
.setup-hint { margin: 2px 0 6px; font-size: 13px; color: var(--muted); }
.setup-dots { display: flex; gap: 6px; }
.setup-dots span { width: 28px; height: 5px; border-radius: 3px; background: var(--line); }
.setup-dots span.done { background: color-mix(in srgb, var(--primary) 55%, var(--line)); }
.setup-dots span.now { background: var(--primary); }
.setup-actions { display: flex; gap: 8px; flex: none; }
button.small { padding: 10px 16px; font-size: 15px; }
.setup-exit { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; }
.setup-exit:hover { color: var(--text); border-color: var(--muted); }
@media (max-width: 560px) {
  .has-setup-bar { padding-bottom: 150px; }
  .setup-bar { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .setup-info { flex-basis: calc(100% - 44px); }
  .setup-exit { order: 2; }
  .setup-actions { order: 3; width: 100%; }
  .setup-actions button { flex: 1; width: auto; }
}

/* ---------- Start page (the four steps) ---------- */
.start-steps { list-style: none; padding: 0; margin: 20px 0; display: grid; gap: 12px; counter-reset: st; }
.start-steps li {
  counter-increment: st; display: grid; grid-template-columns: 44px 1fr; column-gap: 14px; align-items: start;
  padding: 16px; border-radius: 16px; background: var(--card); border: 1px solid var(--line);
}
.start-steps li::before {
  content: counter(st); grid-row: span 2; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary-dark); font-weight: 800; font-size: 18px;
}
.start-steps b { font-size: 17px; }
.start-steps li > span { color: var(--muted); font-size: 15px; }
.start-steps em { font-style: normal; font-size: 12px; font-weight: 700; color: var(--primary-dark); background: var(--primary-soft); border-radius: 999px; padding: 2px 8px; margin-left: 6px; }

/* ---------- Insight report ---------- */
.take { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 10px; }
.take li { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; }
.take .chip { margin-top: 2px; }
.metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin: 16px 0; }
.metric { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.metric h3 { margin: 0 0 6px; font-size: 15px; color: var(--muted); font-weight: 700; }
.metric .big { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.metric .big small { font-size: 15px; font-weight: 700; color: var(--muted); margin-left: 4px; }
.metric p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.spark { display: block; width: 100%; height: 44px; margin-top: 10px; }
.spark rect { fill: color-mix(in srgb, var(--primary) 70%, transparent); }
.spark rect.last7 { fill: var(--primary); }
.spark rect.low { fill: var(--accent); }
@media (max-width: 680px) { .metrics { grid-template-columns: 1fr; } }

/* ---------- Home ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
a.btn {
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
  font-weight: 700; font-size: 16px; border-radius: 12px; padding: 13px 22px;
  transition: transform .12s, box-shadow .12s, background .12s;
}
a.btn.primary {
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 70%, var(--accent)));
  color: #fff; box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 35%, transparent);
}
@media (prefers-color-scheme: dark) { a.btn.primary { color: #042f2e; } }
a.btn.primary:hover { transform: translateY(-1px); }
a.btn.ghost { color: var(--primary-dark); border: 1.5px solid var(--primary); }
a.btn.ghost:hover { background: var(--primary-soft); }

.home-hero { display: grid; grid-template-columns: 1.15fr .85fr; gap: 24px; align-items: center; padding: 40px 0 12px; }
.home-hero h1 { margin: 6px 0 14px; }
.eyebrow { margin: 0; color: var(--primary-dark); font-weight: 800; font-size: 14px; letter-spacing: .06em; text-transform: uppercase; }
.home-small { color: var(--muted); font-size: 14px; margin: 14px 0 0; }
.home-hero-coach { margin: 0; text-align: center; }
.home-hero-coach .avatar-wrap {
  width: 100%; max-width: 300px; border-radius: 24px;
  background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--primary) 18%, transparent), transparent 70%);
}
.home-hero-coach figcaption { min-height: 1.5em; color: var(--muted); font-weight: 700; font-size: 15px; }

.features { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin: 24px 0; }
.feature {
  display: grid; gap: 6px; align-content: start; padding: 20px; border-radius: 16px; text-decoration: none; color: var(--text);
  background: var(--card); border: 1px solid var(--line); transition: border-color .12s, transform .12s;
}
.feature:hover { border-color: var(--primary); transform: translateY(-2px); }
.feature h3 { margin: 4px 0 0; font-size: 18px; }
.feature p { margin: 0; color: var(--muted); font-size: 15px; }
.feature-go { color: var(--primary-dark); font-weight: 700; font-size: 15px; margin-top: 6px; }
.feature-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); }
.feature-icon svg { width: 22px; height: 22px; fill: none; stroke: var(--primary-dark); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.steps ol { list-style: none; counter-reset: step; padding: 0; margin: 8px 0 0; display: grid; gap: 14px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 36px 1fr; column-gap: 12px; }
.steps li::before {
  content: counter(step); grid-row: span 2; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary-dark); font-weight: 800;
}
.steps li span { color: var(--muted); font-size: 15px; }

.trust { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 28px 0 8px; }
.trust h3 { margin: 0 0 4px; font-size: 16px; }
.trust p { margin: 0; color: var(--muted); font-size: 14px; }

@media (max-width: 680px) {
  .home-hero { grid-template-columns: 1fr; padding-top: 24px; }
  .home-hero-coach .avatar-wrap { max-width: 230px; }
  .home-hero .actions a { width: 100%; }
  .features, .trust { grid-template-columns: 1fr; }
}
