/* Gym — instrument-grade training log.
   Graphite surfaces, one signal colour (lime) used only for state and primary actions,
   rounded tabular numerals like a sports watch, hairline borders instead of heavy shadows. */

:root {
  color-scheme: dark;
  --bg: #0e0f11;
  --surface: #17191c;
  --surface-2: #1f2226;
  --surface-3: #282c31;
  --line: #2a2d32;
  --line-soft: rgb(255 255 255 / 0.06);
  --text: #f2f1ed;
  --muted: #9a9da3;
  --faint: #6b6f76;
  --accent: #c8f24a;
  --accent-soft: rgb(200 242 74 / 0.13);
  --on-accent: #12160a;
  --danger: #ff7a6b;
  --danger-soft: rgb(255 122 107 / 0.12);
  --shadow: 0 18px 50px rgb(0 0 0 / 0.5);
  --r-card: 20px;
  --r-ctl: 14px;
  --gutter: 18px;
  --tabs-h: 66px;
  --tabs-gap: 10px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --num: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --series: var(--accent);
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f5f4f1;
    --surface: #ffffff;
    --surface-2: #efeee9;
    --surface-3: #e5e3dc;
    --line: #dfddd6;
    --line-soft: rgb(0 0 0 / 0.05);
    --text: #17181a;
    --muted: #666a70;
    --faint: #8c9096;
    --accent: #2f5d00;
    --accent-soft: rgb(47 93 0 / 0.1);
    --on-accent: #ffffff;
    --danger: #b3261e;
    --danger-soft: rgb(179 38 30 / 0.08);
    --shadow: 0 18px 50px rgb(30 30 20 / 0.16);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none;
}
body.sheet-open { overflow: hidden; }

main {
  max-width: 620px; margin: 0 auto; min-height: 100dvh; outline: none;
  padding: calc(env(safe-area-inset-top) + 18px) var(--gutter)
    calc(var(--tabs-h) + var(--tabs-gap) + env(safe-area-inset-bottom) + 40px);
}
body.resting main { padding-bottom: calc(var(--tabs-h) + var(--tabs-gap) + env(safe-area-inset-bottom) + 116px); }
body.focused main, body.bare main { padding-bottom: calc(env(safe-area-inset-bottom) + 40px); }
body.focused.resting main { padding-bottom: calc(env(safe-area-inset-bottom) + 120px); }
main.enter > * { animation: rise 0.32s var(--ease) both; }
main.enter > *:nth-child(2) { animation-delay: 0.03s; }
main.enter > *:nth-child(3) { animation-delay: 0.06s; }
main.enter > *:nth-child(n + 4) { animation-delay: 0.09s; }
/* Starts dimmed, never invisible: a page that stalls mid-animation still shows its content. */
@keyframes rise { from { opacity: 0.35; transform: translateY(8px); } }

h1 { font-size: 34px; line-height: 1.05; letter-spacing: -0.035em; margin: 0; font-weight: 700; }
h2 {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  font-size: 12px; font-weight: 650; letter-spacing: 0.09em; text-transform: uppercase; color: var(--faint); margin: 30px 2px 12px;
}
h2 .count, h2 .h2-link { letter-spacing: 0; text-transform: none; font-size: 14px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
h2 .h2-link { color: var(--accent); padding: 6px 0 6px 12px; margin: -6px 0; }
h3 { font-size: 17px; margin: 0; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0 0 12px; }
a { color: inherit; text-decoration: none; }
small { color: var(--muted); font-size: 14px; }
strong { font-weight: 650; }
.icon { flex: none; }
.eyebrow { color: var(--muted); font-size: 14px; margin: 0 0 4px; }
.hint { font-size: 13.5px; line-height: 1.5; color: var(--muted); margin: 10px 0 0; }
.hint.lead { margin: 0 2px 16px; }
.hint em { font-style: normal; color: var(--text); }

input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible, label:focus-within > input[type="file"] {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ---------- headers ---------- */

.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.daynav { display: flex; gap: 8px; }
.bar {
  position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 8px;
  margin: calc(env(safe-area-inset-top) * -1 - 18px) calc(var(--gutter) * -1) 14px;
  padding: calc(env(safe-area-inset-top) + 10px) var(--gutter) 10px;
  background: color-mix(in srgb, var(--bg) 86%, transparent); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
}
.bar h1 { font-size: 18px; letter-spacing: -0.01em; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }

.iconbtn {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center; padding: 0; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--line-soft); color: var(--text); cursor: pointer;
  transition: transform 0.15s var(--ease), background 0.15s;
}
.iconbtn:active { transform: scale(0.92); }
.iconbtn:disabled { opacity: 0.35; }
.iconbtn.ghost { visibility: hidden; }
.iconbtn.accent { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.iconbtn.small { width: 38px; height: 38px; }
.iconbtn.small .icon { width: 20px; height: 20px; }
.iconbtn.danger { color: var(--danger); }

/* ---------- buttons ---------- */

.btn, button.unit {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-size: 16px; font-weight: 650; color: var(--text); letter-spacing: -0.005em;
  min-height: 52px; padding: 12px 20px; border-radius: var(--r-ctl);
  border: 1px solid var(--line-soft); background: var(--surface-2); cursor: pointer;
  transition: transform 0.15s var(--ease), opacity 0.15s;
}
.btn:active, button.unit:active { transform: scale(0.975); }
.btn:disabled { opacity: 0.5; }
.btn .icon { width: 20px; height: 20px; }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--on-accent); }
.btn.danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.btn.danger-solid { background: var(--danger); color: #fff; border-color: transparent; }
.btn.small { min-height: 40px; padding: 8px 14px; font-size: 14px; }
.btn.dashed { width: 100%; background: none; border: 1.5px dashed var(--line); color: var(--muted); margin-top: 10px; }
button.unit { flex: none; width: 64px; padding: 0; font-family: var(--num); }
.actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.actions .primary { flex: 1; }
.actions.stack { flex-direction: column; }
.actions.stack > * { width: 100%; }
.actions.sticky {
  position: sticky; bottom: calc(env(safe-area-inset-bottom) + 12px); z-index: 4; margin-top: 26px; padding: 10px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--line-soft); border-radius: 20px;
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); box-shadow: var(--shadow);
}

/* ---------- cards ---------- */

.card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-card); padding: 18px; }
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.stack { display: grid; gap: 10px; }
.empty { border: 1.5px dashed var(--line); border-radius: var(--r-card); padding: 22px 18px; color: var(--muted); text-align: center; font-size: 15px; }
.empty a { color: var(--accent); font-weight: 650; }

.hero {
  position: relative; display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; align-items: center;
  padding: 20px; border-radius: 24px; border: 1px solid var(--line-soft);
  background: radial-gradient(120% 140% at 0% 0%, var(--accent-soft), transparent 58%), var(--surface);
}
.hero-ring { position: relative; width: 96px; height: 96px; }
.hero-num { position: absolute; inset: 0; display: grid; place-content: center; grid-auto-flow: column; align-items: baseline; font-family: var(--num); }
.hero-num b { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; }
.hero-num i { font-style: normal; font-size: 15px; font-weight: 600; color: var(--muted); }
.hero-kicker { margin: 0; font-size: 13px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.hero-title { margin: 3px 0 2px; font-family: var(--num); font-size: 28px; line-height: 1.1; font-weight: 700; letter-spacing: -0.03em; }
.hero-title i { font-style: normal; font-size: 16px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.hero-sub { margin: 0; color: var(--muted); font-size: 14px; }
.hero-progress { grid-column: 1 / -1; margin-top: 12px; }
.hero-focus { grid-column: 1 / -1; margin: 10px 0 0; color: var(--muted); font-size: 14px; }

.ring { display: block; }
.ring-track { fill: none; stroke: var(--surface-3); }
.ring-value { fill: none; stroke: var(--accent); stroke-linecap: round; transition: stroke-dasharray 0.5s var(--ease); }

progress { display: block; width: 100%; height: 5px; border: 0; border-radius: 3px; overflow: hidden; background: var(--surface-3); -webkit-appearance: none; appearance: none; }
progress::-webkit-progress-bar { background: var(--surface-3); }
progress::-webkit-progress-value { background: var(--accent); border-radius: 3px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 3px; }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
.tile { display: grid; gap: 1px; padding: 14px 14px 12px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line-soft); }
.tile span { font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--faint); }
.tile b { font-family: var(--num); font-size: 24px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.tile i { font-style: normal; font-size: 13px; color: var(--muted); }

.nudge-card {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px; margin-top: 10px; border-radius: var(--r-card);
  background: var(--surface); border: 1px solid var(--line-soft);
}
.nudge-card > .icon:first-child { color: var(--accent); width: 26px; height: 26px; }
.nudge-card > span { flex: 1; min-width: 0; display: grid; gap: 2px; }
.nudge-card > .icon:last-child, .wcard-side .icon, .nav-row > .icon:last-child, .profile-card > .icon { color: var(--faint); width: 20px; height: 20px; }

/* workout cards */
.wcard {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer;
  padding: 18px; min-height: 76px; border-radius: var(--r-card); background: var(--surface); border: 1px solid var(--line-soft);
  transition: transform 0.15s var(--ease); overflow: hidden;
}
.wcard:active { transform: scale(0.985); }
.wcard.featured { border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: linear-gradient(160deg, var(--accent-soft), transparent 55%), var(--surface); }
.wcard-main { flex: 1; min-width: 0; display: grid; gap: 3px; }
.wcard-main strong { font-size: 18px; letter-spacing: -0.015em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wcard-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wcard-side { display: flex; align-items: center; gap: 8px; font-family: var(--num); }
.wcard-side b { font-size: 20px; font-weight: 700; color: var(--accent); }
.wcard-side b i { font-style: normal; font-size: 14px; color: var(--muted); font-weight: 600; }
.wcard-side .go { font-family: inherit; font-size: 14px; font-weight: 650; color: var(--on-accent); background: var(--accent); padding: 7px 14px; border-radius: 999px; }
.wcard-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--surface-3); }
.wcard-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.5s var(--ease); }

/* checklist */
.check-list { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-card); overflow: hidden; }
.check-row { display: flex; align-items: center; gap: 14px; padding: 15px 18px; min-height: 58px; cursor: pointer; }
.check-row + .check-row { border-top: 1px solid var(--line-soft); }
.check-row input {
  flex: none; width: 28px; height: 28px; margin: 0; border-radius: 50%; -webkit-appearance: none; appearance: none;
  border: 2px solid var(--faint); background: none; display: grid; place-items: center; transition: background 0.2s, border-color 0.2s, transform 0.25s var(--ease);
}
.check-row input:checked { background: var(--accent); border-color: var(--accent); transform: scale(1.06); }
.check-row input:checked::after {
  content: ""; width: 11px; height: 6px; margin-top: -2px; border-left: 2.5px solid var(--on-accent); border-bottom: 2.5px solid var(--on-accent); transform: rotate(-45deg);
}
.check-row span { transition: color 0.2s; }
.check-row input:checked + span { color: var(--muted); }

/* ---------- forms ---------- */

form { margin: 0; }
.field { display: block; margin-top: 16px; min-width: 0; }
.form > .field:first-child, .card > .field:first-child, form.card > .field:first-of-type { margin-top: 0; }
.label { display: block; font-size: 13px; font-weight: 550; color: var(--muted); margin: 0 2px 7px; }
input[type="text"], input[type="date"], input[type="password"], select, textarea {
  width: 100%; min-height: 52px; padding: 12px 14px; font: inherit; font-size: 16px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--r-ctl);
  -webkit-appearance: none; appearance: none; font-variant-numeric: tabular-nums;
}
.card input[type="text"], .card input[type="date"], .card select, .card textarea, .ex input[type="text"], .ex select, .edit-ex input[type="text"], .edit-ex select, .edit-ex input[type="date"] { background: var(--bg); }
textarea { resize: vertical; line-height: 1.5; min-height: 120px; }
::placeholder { color: var(--faint); }
select {
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%239a9da3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.field-row { display: flex; gap: 8px; }
.field-row input { flex: 1; min-width: 0; }
.big-input { font-family: var(--num); font-size: 26px !important; font-weight: 700; letter-spacing: -0.02em; min-height: 60px !important; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.three { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0 12px; }

.seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line-soft); }
.seg.full { display: flex; }
.seg button {
  flex: 1; font: inherit; font-size: 15px; font-weight: 600; color: var(--muted); min-height: 44px; padding: 8px 12px;
  border: 0; border-radius: 12px; background: none; cursor: pointer; transition: background 0.2s, color 0.2s;
}
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

.chips { display: flex; gap: 6px; }
.chip {
  flex: 1; font: inherit; font-size: 14px; font-weight: 650; color: var(--muted); height: 44px; padding: 0; min-width: 0;
  border-radius: 12px; border: 1px solid var(--line-soft); background: var(--surface-2); cursor: pointer;
}
.edit-ex .chip { background: var(--bg); }
.chip span { display: none; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: transparent; color: var(--on-accent); }
@media (min-width: 430px) { .chip span { display: inline; } }

.switch-row { display: flex; align-items: flex-start; gap: 14px; margin-top: 18px; cursor: pointer; }
.card > .switch-row:first-child { margin-top: 0; }
.switch-row > span { display: grid; gap: 3px; font-weight: 600; }
.switch-row small { font-weight: 400; }
.switch-row input {
  flex: none; -webkit-appearance: none; appearance: none; width: 52px; height: 32px; margin: 0; border-radius: 999px; background: var(--surface-3);
  position: relative; transition: background 0.2s; cursor: pointer;
}
.switch-row input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.3); transition: transform 0.25s var(--ease); }
.switch-row input:checked { background: var(--accent); }
.switch-row input:checked::after { transform: translateX(20px); }
.switch-row input:disabled { opacity: 0.4; }

/* ---------- workout logging ---------- */

.wo-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.wo-meta p { margin: 0; color: var(--muted); font-size: 15px; min-width: 0; }
.wo-progress { color: var(--faint); font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; margin: 6px 2px 14px; }
.datechip { position: relative; display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line-soft); overflow: hidden; }
.datechip .icon { width: 20px; height: 20px; }
.datechip input { position: absolute; inset: 0; opacity: 0; min-height: 0; width: 100%; height: 100%; padding: 0; }

.ex { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-card); transition: border-color 0.2s; }
.ex + .ex { margin-top: 10px; }
.ex[open] { border-color: var(--line); }
.ex summary { display: flex; align-items: center; gap: 14px; padding: 16px 18px; min-height: 72px; cursor: pointer; list-style: none; }
.ex summary::-webkit-details-marker { display: none; }
.ex-n {
  flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-family: var(--num); font-size: 14px; font-weight: 700;
  background: var(--surface-2); color: var(--muted); font-variant-numeric: tabular-nums;
}
.ex-n .icon { width: 18px; height: 18px; stroke-width: 2.6; }
.ex.done .ex-n { background: var(--accent); color: var(--on-accent); }
.ex-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.ex-main strong { letter-spacing: -0.01em; }
.ex-main small { font-variant-numeric: tabular-nums; }
.ex-state { font-family: var(--num); color: var(--accent); font-size: 15px; font-weight: 700; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ex-state em { font-style: normal; font-family: inherit; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; padding: 5px 9px; border-radius: 999px; background: var(--accent-soft); }
.ex-body { padding: 0 18px 18px; border-top: 1px solid var(--line-soft); }
.ex-note { color: var(--muted); font-size: 14px; margin: 14px 0 0; }
.last { font-size: 14px; margin: 14px 0 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.last b { color: var(--text); font-weight: 650; }
.nudge { margin: 12px 0 0; padding: 11px 14px; border-radius: 12px; font-size: 14px; font-weight: 600; background: var(--accent-soft); }
.sets { display: grid; grid-template-columns: repeat(auto-fit, minmax(58px, 1fr)); gap: 8px; }
.set { position: relative; display: block; }
.set span { position: absolute; top: 5px; left: 9px; font-size: 10px; font-weight: 700; color: var(--faint); font-family: var(--num); }
.set input { text-align: center; padding: 16px 4px 8px !important; font-family: var(--num); font-size: 20px !important; font-weight: 700; }
.ex input[name="load"] { font-family: var(--num); font-size: 22px; font-weight: 700; }
.history { margin-top: 16px; border-top: 1px solid var(--line-soft); }
.history-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; font-variant-numeric: tabular-nums; }
.history-row span:first-child { flex: none; width: 92px; color: var(--muted); }
.history-row span:nth-child(2) { flex: 1; min-width: 0; }

/* editors */
.edit-ex { border: 1px solid var(--line-soft); background: var(--surface); border-radius: 18px; padding: 14px; margin: 0 0 10px; min-width: 0; }
.edit-ex-head { display: flex; align-items: center; gap: 10px; }
.edit-ex-head input { flex: 1; min-width: 0; font-weight: 650; }
.edit-ex .field { margin-top: 12px; }
.edit-ex .chips { margin-top: 12px; }
.mini-actions { display: flex; gap: 6px; }

/* import */
.drop {
  display: grid; justify-items: center; gap: 6px; text-align: center; padding: 34px 20px; cursor: pointer;
  border-radius: 24px; border: 1.5px dashed color-mix(in srgb, var(--accent) 50%, var(--line));
  background: radial-gradient(90% 120% at 50% 0%, var(--accent-soft), transparent 70%), var(--surface);
}
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.drop .icon { width: 34px; height: 34px; color: var(--accent); margin-bottom: 6px; }
.drop strong { font-size: 19px; letter-spacing: -0.015em; }
.drop span { color: var(--muted); font-size: 14px; }
.or { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--faint); font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.review { display: flex; align-items: center; gap: 10px; padding: 14px 14px 14px 18px; border-radius: var(--r-card); background: var(--surface); border: 1px solid var(--line-soft); }
.review-main { flex: 1; min-width: 0; display: grid; gap: 3px; }
.review-ex { color: var(--faint); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.blank { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 46px 10px 10px; }
.blank > .icon { width: 44px; height: 44px; color: var(--faint); margin-bottom: 6px; }
.blank p { color: var(--muted); max-width: 320px; }
.blank .actions { width: 100%; }
.spinner { width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--accent); animation: spin 0.8s linear infinite; margin-bottom: 10px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- progress ---------- */

.statrow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 4px; }
.statrow.big { margin: 0 0 18px; }
.statrow div { display: grid; gap: 2px; min-width: 0; }
.statrow b { font-family: var(--num); font-size: 22px; line-height: 1.1; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.statrow.big b { font-size: 32px; }
.statrow b small { font-size: 15px; font-weight: 600; color: var(--muted); }
.statrow span { font-size: 12.5px; color: var(--muted); }
.grid100 { display: block; width: 100%; height: auto; }
.g-full { fill: var(--accent); }
.g-part { fill: var(--faint); }
.g-none { fill: none; stroke: var(--faint); stroke-width: 1.3; }
.g-future { fill: var(--surface-3); }
.g-today { stroke: var(--text); stroke-width: 2; }
.legend { display: flex; gap: 16px; margin: 14px 0 0; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.k-full { background: var(--accent); }
.k-part { background: var(--faint); }
.k-none { border: 1.5px solid var(--faint); }

.verdict .verdict-head { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; margin-bottom: 6px; }
.verdict .verdict-head b { color: var(--text); }
.verdict .verdict-action { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.35; margin: 0; }
.verdict.tone-ok { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }

.chart { position: relative; margin: 14px 0 16px; }
.chart svg { display: block; width: 100%; height: auto; touch-action: pan-y; overflow: visible; }
.c-grid { stroke: var(--line); stroke-width: 1; }
.c-axis { fill: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; font-family: var(--num); }
.c-area { fill: var(--accent-soft); opacity: 0.55; }
.c-line { fill: none; stroke: var(--series); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.c-dot { fill: var(--series); stroke: var(--bg); stroke-width: 2; }
.c-cross { stroke: var(--muted); stroke-width: 1; }
.c-tip {
  position: absolute; top: -6px; transform: translate(-50%, -100%); pointer-events: none; white-space: nowrap;
  background: var(--text); color: var(--bg); border-radius: 10px; padding: 7px 11px; font-size: 13px; display: grid; gap: 1px; font-variant-numeric: tabular-nums;
}
.c-tip[hidden] { display: none; }
.c-tip span { opacity: 0.75; font-size: 12px; }
.table { overflow-x: auto; margin: 0 calc(var(--gutter) * -1) 8px; padding: 0 var(--gutter); }
table { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line-soft); }
th { color: var(--faint); font-weight: 650; font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; }
td:first-child { font-weight: 650; }
td:last-child, th:last-child { padding-right: 0; }

/* ---------- photos ---------- */

.poses { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pose {
  position: relative; aspect-ratio: 3 / 4; border-radius: 14px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line-soft);
  display: grid; place-items: center; align-content: center; gap: 6px; color: var(--faint); font: inherit; font-size: 13px; font-weight: 550; padding: 0; text-transform: capitalize;
}
label.pose.add { border: 1.5px dashed var(--line); cursor: pointer; background: var(--bg); }
.pose.add .icon { width: 26px; height: 26px; }
.pose.add.filled { border-style: solid; }
.pose img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pose .tag { position: absolute; left: 6px; bottom: 6px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: #fff; background: rgb(0 0 0 / 0.55); padding: 3px 7px; border-radius: 7px; }
.pose input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.two > .pose { aspect-ratio: 3 / 4; }
.compare-picks { margin: 12px 0; }
.checkin { margin-top: 24px; }
h2 + .checkin { margin-top: 0; }
.checkin header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.checkin header h3 { flex: 1; }
.checkin-note { color: var(--muted); font-size: 14px; margin: 8px 2px 0; }
.viewer { position: fixed; inset: 0; z-index: 60; background: rgb(0 0 0 / 0.95); display: grid; place-items: center; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); animation: fade 0.2s; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }
@keyframes fade { from { opacity: 0; } }

/* ---------- you ---------- */

.avatar {
  flex: none; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-family: var(--num); font-size: 24px; font-weight: 700;
  background: var(--accent); color: var(--on-accent);
}
.avatar.small { width: 40px; height: 40px; font-size: 17px; background: var(--surface-3); color: var(--text); }
.profile-card { display: flex; align-items: center; gap: 16px; padding: 18px; border-radius: 24px; background: var(--surface); border: 1px solid var(--line-soft); }
.profile-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.profile-main strong { font-size: 20px; letter-spacing: -0.02em; }
.nav-list { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-card); overflow: hidden; }
.nav-row { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; min-height: 64px; text-align: left; font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.nav-row + .nav-row { border-top: 1px solid var(--line-soft); }
a.nav-row:active, button.nav-row:active { background: var(--surface-2); }
.nav-icon { flex: none; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--accent); }
.nav-icon .icon { width: 20px; height: 20px; }
.nav-main { flex: 1; min-width: 0; display: grid; gap: 1px; }
.nav-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fineprint { display: flex; gap: 10px; align-items: flex-start; color: var(--faint); font-size: 13px; line-height: 1.5; margin: 22px 4px 0; }
.fineprint .icon { width: 18px; height: 18px; margin-top: 1px; }

.prose { font-size: 16.5px; line-height: 1.6; }
.prose h3 { margin: 22px 0 8px; }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 14px; }
.prose li { margin-bottom: 7px; }

/* ---------- auth & onboarding ---------- */

.auth { min-height: calc(100dvh - 120px); display: grid; align-content: center; gap: 4px; max-width: 420px; margin: 0 auto; }
.auth.wide { align-content: start; padding-top: 12px; }
.auth h1 { margin-bottom: 10px; }
.auth > p { color: var(--muted); font-size: 16.5px; line-height: 1.5; margin-bottom: 16px; }
.auth .form { margin-top: 4px; }
.dots { display: flex; gap: 6px; margin-bottom: 24px; }
.dots i { width: 22px; height: 4px; border-radius: 2px; background: var(--surface-3); }
.dots i.on { background: var(--accent); }

/* ---------- bottom sheet ---------- */

#sheet { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
#sheet:empty { display: none; }
.sheet-backdrop { position: absolute; inset: 0; background: rgb(0 0 0 / 0.55); opacity: 0; transition: opacity 0.25s; pointer-events: auto; }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-width: 620px; margin: 0 auto; max-height: 86dvh; overflow-y: auto; pointer-events: auto;
  background: var(--surface); border-radius: 28px 28px 0 0; border: 1px solid var(--line-soft); border-bottom: 0;
  padding: 10px 20px calc(env(safe-area-inset-bottom) + 22px); transform: translateY(100%); transition: transform 0.34s var(--ease); box-shadow: var(--shadow);
}
.sheet-panel::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--surface-3); margin: 0 auto 10px; }
#sheet.open .sheet-backdrop { opacity: 1; }
#sheet.open .sheet-panel { transform: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-head h2 { font-size: 21px; letter-spacing: -0.02em; text-transform: none; color: var(--text); margin: 0; font-weight: 700; }
.sheet-text { color: var(--muted); font-size: 16px; line-height: 1.5; margin: 10px 0 4px; }
.sheet-body input[readonly] { background: var(--bg); font-size: 14px; margin-top: 8px; }

/* ---------- tab bar, rest dock, toasts ---------- */

#tabs {
  position: fixed; z-index: 20; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + var(--tabs-gap));
  width: min(calc(100% - 24px), 480px); height: var(--tabs-h); display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px;
  border-radius: 26px; background: color-mix(in srgb, var(--surface) 82%, transparent); border: 1px solid var(--line-soft);
  -webkit-backdrop-filter: blur(22px) saturate(1.4); backdrop-filter: blur(22px) saturate(1.4); box-shadow: var(--shadow);
}
#tabs a { display: grid; place-items: center; align-content: center; gap: 3px; border-radius: 20px; color: var(--faint); font-size: 11px; font-weight: 650; letter-spacing: 0.01em; transition: color 0.2s, background 0.25s; }
#tabs a .icon { width: 24px; height: 24px; transition: transform 0.25s var(--ease); }
#tabs a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
#tabs a[aria-current="page"] .icon { transform: translateY(-1px) scale(1.06); }
#tabs a:active .icon { transform: scale(0.9); }
body.bare #tabs, body.focused #tabs { display: none; }

#rest {
  position: fixed; z-index: 21; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + var(--tabs-gap) + var(--tabs-h) + 10px);
  width: min(calc(100% - 24px), 480px); display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 12px;
  border-radius: 24px; background: var(--text); color: var(--bg); box-shadow: var(--shadow);
}
body.focused #rest, body.bare #rest { bottom: calc(env(safe-area-inset-bottom) + 12px); }
#rest[hidden] { display: none; }
.rest-ring { flex: none; }
.rest-track { fill: none; stroke: color-mix(in srgb, var(--bg) 16%, transparent); stroke-width: 5; }
.rest-arc { fill: none; stroke: var(--bg); stroke-width: 5; stroke-linecap: round; transition: stroke-dasharray 0.25s linear; }
.rest-text { flex: 1; min-width: 0; display: grid; }
.rest-text strong { font-family: var(--num); font-size: 26px; line-height: 1.05; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.rest-text span { font-size: 12.5px; opacity: 0.7; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#rest button {
  font: inherit; font-family: var(--num); font-size: 15px; font-weight: 700; color: var(--bg); min-width: 48px; height: 44px; padding: 0 10px;
  border: 0; border-radius: 14px; background: color-mix(in srgb, var(--bg) 13%, transparent); cursor: pointer;
}
#rest button.skip { font-family: inherit; font-size: 14px; }
#rest.over { background: var(--accent); color: var(--on-accent); }
#rest.over .rest-arc { stroke: var(--on-accent); }
#rest.over button:not(.skip) { display: none; }
#rest.over button.skip { color: var(--on-accent); }

#sync {
  position: fixed; z-index: 30; left: 50%; transform: translateX(-50%); top: calc(env(safe-area-inset-top) + 6px);
  padding: 6px 14px; border-radius: 999px; font-size: 12px; font-weight: 650; white-space: nowrap;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
}
#sync[hidden] { display: none; }
#toast {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 14px); transform: translate(-50%, -16px); z-index: 70;
  background: var(--text); color: var(--bg); font-size: 15px; font-weight: 650; padding: 11px 18px; border-radius: 999px; opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease, transform 0.3s var(--ease); max-width: calc(100vw - 32px); box-shadow: var(--shadow);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

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

/* ---------- the mark ---------- */

.mark { display: block; }
.mark-ring { stroke: var(--accent); }
.mark-hub { fill: var(--text); }
.brandmark { width: 76px; height: 76px; border-radius: 22px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line-soft); margin-bottom: 26px; }
.brandmark .mark { width: 46px; height: 46px; }

/* ---------- opening animation ----------
   Act 1: a barbell is assembled. The bar draws out from the centre, the plates slide on and seat
   with a small overshoot, the clips lock, a glint runs across the steel.
   Act 2: the barbell turns to face you. Seen end-on, its plate is the Carga mark.
   Act 3: the name rises and the app appears.
   --k scales every duration (short version on repeat launches). */

:root { --k: 1; }
:root.quick { --k: 0.3; }

#splash {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: radial-gradient(60% 42% at 50% 44%, var(--accent-soft), transparent 70%), var(--bg);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease), visibility 0s 0.5s;
}
#splash.out { opacity: 0; transform: scale(1.06); visibility: hidden; pointer-events: none; }
.splash-stage { display: grid; justify-items: center; gap: 18px; padding-bottom: 6vh; }
.splash-art { position: relative; width: min(74vw, 320px); aspect-ratio: 280 / 150; display: grid; place-items: center; perspective: 700px; }
.splash-bar, .splash-mark { grid-area: 1 / 1; }
.splash-bar { width: 100%; height: auto; overflow: visible; animation: sp-turn-out calc(var(--k) * 0.32s) cubic-bezier(0.5, 0, 0.9, 0.4) calc(var(--k) * 1.3s) both; }
.splash-mark { width: 44%; height: auto; overflow: visible; animation: sp-turn-in calc(var(--k) * 0.55s) cubic-bezier(0.15, 1.25, 0.35, 1) calc(var(--k) * 1.58s) both; }
.splash-mark .mark-hub { transform-box: fill-box; transform-origin: center; animation: sp-pop calc(var(--k) * 0.4s) cubic-bezier(0.2, 1.8, 0.4, 1) calc(var(--k) * 1.86s) both; }

.sp-bar { fill: var(--text); transform-box: fill-box; transform-origin: center; animation: sp-bar calc(var(--k) * 0.5s) var(--ease) both; }
.sp-plate, .sp-clip { transform-box: fill-box; animation: sp-slide calc(var(--k) * 0.46s) cubic-bezier(0.2, 1.5, 0.4, 1) both; }
.sp-plate { fill: var(--accent); }
.sp-plate.sp-out { fill: color-mix(in srgb, var(--accent) 72%, var(--bg)); }
.sp-clip { fill: var(--muted); }
.sp-left { --from: -64px; }
.sp-right { --from: 64px; }
.sp-in { animation-delay: calc(var(--k) * 0.36s); }
.sp-out { animation-delay: calc(var(--k) * 0.56s); }
.sp-clip { animation-delay: calc(var(--k) * 0.78s); animation-duration: calc(var(--k) * 0.3s); }
.sp-glint { fill: #fff; opacity: 0; transform: skewX(-20deg); animation: sp-glint calc(var(--k) * 0.5s) ease-in-out calc(var(--k) * 1s) both; }
.sp-shadow { fill: #000; opacity: 0; animation: sp-shadow calc(var(--k) * 0.5s) ease-out calc(var(--k) * 0.3s) both, sp-shadow-out calc(var(--k) * 0.3s) ease-in calc(var(--k) * 1.3s) forwards; }

.splash-brand {
  margin: 0; min-height: 40px; font-family: var(--num); font-size: 34px; font-weight: 800; letter-spacing: -0.05em; line-height: 1.1;
  animation: sp-rise calc(var(--k) * 0.45s) var(--ease) calc(var(--k) * 1.82s) both;
}
.splash-brand:empty { display: none; }
.splash-line { width: 120px; height: 3px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.splash-line i { display: block; height: 100%; border-radius: 2px; background: var(--accent); transform-origin: left; animation: sp-fill calc(var(--k) * 2.4s) cubic-bezier(0.4, 0, 0.2, 1) both; }

@keyframes sp-bar { from { transform: scaleX(0); opacity: 0.4; } }
@keyframes sp-slide { from { transform: translateX(var(--from)); opacity: 0; } }
@keyframes sp-glint { 0% { opacity: 0; transform: translateX(0) skewX(-20deg); } 30% { opacity: 0.55; } 100% { opacity: 0; transform: translateX(380px) skewX(-20deg); } }
@keyframes sp-turn-out { to { transform: rotateY(88deg) scale(0.9); opacity: 0; } }
@keyframes sp-turn-in { from { transform: rotateY(-88deg) scale(0.86); opacity: 0; } }
@keyframes sp-pop { from { transform: scale(0); } }
@keyframes sp-shadow { to { opacity: 0.28; } }
@keyframes sp-shadow-out { to { opacity: 0; } }
@keyframes sp-rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes sp-fill { from { transform: scaleX(0); } }

@media (prefers-color-scheme: light) { .sp-shadow { fill: #1b1c1f; } }
@media (prefers-reduced-motion: reduce) { #splash * { animation: none !important; } .splash-bar { display: none; } }
