/* gym.softcupid.com — design system + components.
   Tokens are validated for WCAG AA contrast by bin/check-contrast.php. */

:root {
  --bg: #0B1020;
  --bg-2: #0E1428;
  --surface: #141B2D;
  --surface-2: #1C2740;
  --surface-3: #24314F;
  --border: #2A3758;
  --text: #EEF2FF;
  --text-2: #A9B4CF;
  --text-3: #8592B3;
  --mint: #42F5A1;
  --mint-2: #2BD98A;
  --mint-ink: #06281A;
  --blue: #4D8DFF;
  --purple: #A77BFF;
  --pink: #FF6FA8;
  --amber: #FFC857;
  --danger: #FF6B6B;
  --danger-bg: #3A1620;
  --ok-bg: #0F3326;
  --warn-bg: #3A2E12;
  --focus: #FFD166;
  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 26px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --glow: 0 0 0 1px rgba(66, 245, 161, .25), 0 8px 30px rgba(66, 245, 161, .18);
  --nav-h: 76px;
  --top-h: 60px;
  --gutter: 16px;
  --text-scale: 1;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

html[data-contrast="high"] {
  --text-2: #D5DCEE;
  --text-3: #C2CBE3;
  --border: #5B6D96;
  --surface: #10172A;
  --surface-2: #18223A;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: calc(16px * var(--text-scale)); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 600px at 80% -10%, rgba(77, 141, 255, .12), transparent 60%),
              radial-gradient(900px 500px at -10% 10%, rgba(167, 123, 255, .10), transparent 60%),
              var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  line-height: 1.45;
  min-height: 100vh;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--mint); text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; font-weight: 800; }
h2 { font-size: 1.2rem; font-weight: 750; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 .75rem; }
small, .muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 1000; background: var(--mint); color: var(--mint-ink);
  padding: 10px 14px; border-radius: 10px; font-weight: 700;
}
.skip-link:focus { top: 8px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }

/* ---- layout ------------------------------------------------------------------ */
.app { min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--top-h);
  display: flex; align-items: center; gap: 10px; padding: 0 var(--gutter);
  background: rgba(11, 16, 32, .82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(42, 55, 88, .5);
}
.topbar .brand { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--text); text-decoration: none; margin-right: auto; min-width: 0; }
.topbar .brand svg { width: 34px; height: 22px; }
.topbar .brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); cursor: pointer; text-decoration: none; flex: none;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 22px; height: 22px; }
.badge {
  position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--pink); color: #2B0716; font-size: .72rem; font-weight: 800; display: grid; place-items: center;
  border: 2px solid var(--bg);
}
.avatar {
  width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none;
  background: linear-gradient(135deg, var(--blue), var(--purple)); display: grid; place-items: center;
  font-weight: 800; color: #fff; border: 2px solid var(--mint); overflow: hidden; text-decoration: none; font-size: .95rem;
}
.avatar.sm { width: 36px; height: 36px; font-size: .8rem; border-width: 1.5px; }
.avatar.lg { width: 84px; height: 84px; font-size: 1.6rem; border-width: 3px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

main {
  max-width: 980px; margin: 0 auto; padding: 18px var(--gutter) calc(var(--nav-h) + 40px);
  outline: none;
}
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 4px 0 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }

/* bottom navigation (mobile) */
.bottom-nav {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: max(10px, env(safe-area-inset-bottom));
  width: min(560px, calc(100% - 20px)); height: var(--nav-h); z-index: 50;
  display: grid; grid-template-columns: 1fr 1fr 92px 1fr 1fr; align-items: center;
  background: rgba(20, 27, 45, .94); border: 1px solid var(--border); border-radius: 28px;
  box-shadow: var(--shadow); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); padding: 0 6px;
}
.nav-link {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 56px; border-radius: 16px; color: var(--text-2); text-decoration: none; font-size: .72rem; font-weight: 650;
}
.nav-link svg { width: 24px; height: 24px; }
.nav-link[aria-current="page"] { color: var(--mint); }
.nav-link:hover { color: var(--text); }
.nav-center {
  justify-self: center; width: 84px; height: 84px; margin-top: -34px; border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #22305a, #0d1427 70%); border: 2px solid rgba(66, 245, 161, .5);
  box-shadow: 0 0 0 6px rgba(11, 16, 32, .9), var(--glow); display: grid; place-items: center; text-decoration: none; color: var(--text);
}
.nav-center .mascot { width: 70px; }
.nav-center[aria-current="page"] { border-color: var(--mint); }

/* sidebar (desktop) */
.sidebar { display: none; }
@media (min-width: 960px) {
  .bottom-nav { display: none; }
  .sidebar {
    display: flex; flex-direction: column; gap: 6px; position: fixed; top: var(--top-h); left: 0; bottom: 0; width: 232px;
    padding: 18px 14px; border-right: 1px solid rgba(42, 55, 88, .6); background: rgba(11, 16, 32, .6);
  }
  .sidebar .nav-link { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 14px; font-size: .95rem; min-height: 48px; }
  .sidebar .nav-link[aria-current="page"] { background: rgba(66, 245, 161, .1); }
  .sidebar .train-cta { margin: 6px 0 12px; }
  main { margin-left: 232px; max-width: 1040px; padding-bottom: 60px; }
  .topbar { padding-left: 24px; }
}

/* ---- surfaces ---------------------------------------------------------------- */
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .025), transparent 40%), var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; position: relative;
}
.card + .card, .stack > * + * { margin-top: 14px; }
.card.elevated { background: var(--surface-2); }
.card.hero {
  background: linear-gradient(135deg, rgba(77, 141, 255, .22), rgba(167, 123, 255, .18) 50%, rgba(66, 245, 161, .12)), var(--surface);
  border-color: rgba(167, 123, 255, .35); overflow: hidden;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-head h2, .card-head h3 { margin: 0; }
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--border); margin: 14px 0; border: 0; }

.stat { text-align: center; padding: 12px 6px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); min-width: 0; }
.stat .v { font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; overflow-wrap: anywhere; }
.stat .l { font-size: .76rem; color: var(--text-2); }
.stat svg { width: 22px; height: 22px; margin: 0 auto 4px; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid rgba(42, 55, 88, .6); min-width: 0; }
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .sub { color: var(--text-2); font-size: .85rem; }
.tile-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-3); flex: none; }
.tile-icon svg { width: 24px; height: 24px; }
.tile-icon.mint { background: rgba(66, 245, 161, .14); color: var(--mint); }
.tile-icon.blue { background: rgba(77, 141, 255, .16); color: var(--blue); }
.tile-icon.purple { background: rgba(167, 123, 255, .16); color: var(--purple); }
.tile-icon.pink { background: rgba(255, 111, 168, .14); color: var(--pink); }
.tile-icon.amber { background: rgba(255, 200, 87, .14); color: var(--amber); }

/* ---- controls ---------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font-weight: 750; cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform .08s ease, background .15s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(.98); }
.btn svg { width: 20px; height: 20px; }
.btn.primary { background: linear-gradient(180deg, #5BFFB4, var(--mint)); color: var(--mint-ink); border-color: transparent; box-shadow: 0 6px 24px rgba(66, 245, 161, .28); }
.btn.primary:hover { background: linear-gradient(180deg, #74FFC1, #4CF9A9); }
.btn.danger { background: var(--danger-bg); border-color: #6B2635; color: #FFB3B3; }
.btn.ghost { background: transparent; }
.btn.small { min-height: 38px; padding: 0 14px; font-size: .88rem; }
.btn.block { width: 100%; }
.btn.xl { min-height: 60px; font-size: 1.1rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.link-btn { background: none; border: 0; color: var(--mint); cursor: pointer; font-weight: 700; padding: 6px 4px; min-height: 32px; }

.tabs { display: flex; gap: 6px; padding: 5px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; overflow-x: auto; scrollbar-width: none; margin-bottom: 16px; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 1 0 auto; min-height: 42px; padding: 0 16px; border-radius: 999px; border: 0; background: transparent; color: var(--text-2); font-weight: 700; cursor: pointer; text-decoration: none; display: grid; place-items: center; }
.tab[aria-selected="true"], .tab[aria-current="page"] { background: var(--mint); color: var(--mint-ink); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text); cursor: pointer; font-weight: 650; font-size: .9rem;
}
.chip[aria-pressed="true"] { background: rgba(66, 245, 161, .16); border-color: var(--mint); color: var(--mint); }
.chip[aria-pressed="true"]::before { content: "✓"; font-weight: 900; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 750; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.pill.mint { background: rgba(66, 245, 161, .15); color: var(--mint); }
.pill.purple { background: rgba(167, 123, 255, .18); color: #CDB6FF; }
.pill.blue { background: rgba(77, 141, 255, .18); color: #A9C6FF; }
.pill.amber { background: rgba(255, 200, 87, .16); color: var(--amber); }
.pill.danger { background: var(--danger-bg); color: #FFB3B3; }

label { display: block; font-weight: 650; font-size: .9rem; margin-bottom: 6px; }
.field { margin-bottom: 14px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--bg-2); color: var(--text); font-size: 1rem;
}
textarea.input { min-height: 90px; resize: vertical; }
.input:focus { border-color: var(--mint); outline: 2px solid rgba(66, 245, 161, .35); outline-offset: 0; }
.input[aria-invalid="true"] { border-color: var(--danger); }
.field-error { color: #FF9C9C; font-size: .85rem; margin-top: 6px; }
.hint { color: var(--text-2); font-size: .82rem; margin-top: 5px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; cursor: pointer; }
.switch input { appearance: none; -webkit-appearance: none; width: 52px; height: 30px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border); position: relative; cursor: pointer; flex: none; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--text-2); transition: transform .15s; }
.switch input:checked { background: var(--mint); border-color: var(--mint); }
.switch input:checked::after { transform: translateX(22px); background: var(--mint-ink); }
.switch .txt { flex: 1; }
.switch .txt small { display: block; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.seg button { min-height: 40px; padding: 0 14px; border: 0; background: transparent; color: var(--text-2); font-weight: 700; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--mint); color: var(--mint-ink); }

.alert { padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); font-size: .92rem; }
.alert.error { background: var(--danger-bg); border-color: #6B2635; color: #FFD0D0; }
.alert.ok { background: var(--ok-bg); border-color: #1D5E44; color: #BDF7DD; }
.alert.warn { background: var(--warn-bg); border-color: #6B5520; color: #FFE6A8; }

/* progress */
.bar { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--mint-2), var(--mint)); width: 0; transition: width .5s ease; }
.bar.purple > span { background: linear-gradient(90deg, #7D5BFF, var(--purple)); }
.ring { position: relative; width: 84px; height: 84px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .v { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: 1rem; }

/* empty / loading / error states */
.empty { text-align: center; padding: 28px 12px; color: var(--text-2); }
.empty .mascot { width: 120px; margin: 0 auto 10px; }
.skeleton { background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius); min-height: 90px; }
.skeleton + .skeleton { margin-top: 14px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--mint); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* sync status pill */
.sync-pill { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px; border-radius: 999px; font-size: .75rem; font-weight: 750; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer; }
.sync-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); }
.sync-pill[data-state="pending"] .dot { background: var(--amber); }
.sync-pill[data-state="offline"] .dot { background: var(--text-3); }
.sync-pill[data-state="error"] .dot, .sync-pill[data-state="conflict"] .dot, .sync-pill[data-state="auth"] .dot { background: var(--danger); }
.offline-banner { position: sticky; top: var(--top-h); z-index: 30; text-align: center; padding: 8px; font-size: .85rem; background: var(--warn-bg); color: #FFE6A8; border-bottom: 1px solid #6B5520; }

/* dropdown / dialogs / toasts */
.dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); width: min(380px, calc(100vw - 24px)); max-height: 70vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px; z-index: 60;
}
.dropdown .item { display: block; padding: 12px; border-radius: 12px; color: var(--text); text-decoration: none; }
.dropdown .item:hover { background: var(--surface-2); }
.dropdown .item.unread { background: rgba(66, 245, 161, .07); }
.dropdown .item.unread .t::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--mint); margin-right: 8px; vertical-align: middle; }
dialog {
  border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--text);
  padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px); box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(4, 7, 16, .72); backdrop-filter: blur(3px); }
dialog .dlg-body { padding: 20px; overflow: auto; max-height: calc(100vh - 160px); }
dialog .dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px 0; }
dialog .dlg-head h2 { margin: 0; }
dialog .dlg-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 0 20px 20px; flex-wrap: wrap; }
@media (max-width: 600px) {
  dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 26px 26px 0 0; max-height: 92vh; }
  dialog .dlg-foot .btn { flex: 1; }
}
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 26px); z-index: 200; display: grid; gap: 8px; width: min(440px, calc(100vw - 24px)); pointer-events: none; }
@media (min-width: 960px) { .toasts { bottom: 24px; left: auto; right: 24px; transform: none; } }
.toast { pointer-events: auto; background: var(--surface-3); border: 1px solid var(--border); border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center; animation: toast-in .2s ease; }
.toast.ok { border-color: #1D5E44; }
.toast.error { border-color: #6B2635; background: var(--danger-bg); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---- charts ---------------------------------------------------------------- */
.chart { width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: rgba(169, 180, 207, .14); stroke-width: 1; }
.chart .axis { fill: var(--text-3); font-size: 11px; }
.chart .line { fill: none; stroke: var(--mint); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart .line.alt { stroke: var(--blue); stroke-dasharray: 5 5; stroke-width: 2; }
.chart .area { fill: url(#mintFade); }
.chart .dot { fill: var(--bg); stroke: var(--mint); stroke-width: 2.5; }
.chart .barv { fill: var(--blue); }
.chart .barv.current { fill: var(--mint); }
.chart .val { fill: var(--text-2); font-size: 11px; font-weight: 700; }
details.data-table summary { cursor: pointer; color: var(--text-2); font-size: .85rem; margin-top: 8px; min-height: 32px; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); }
th { color: var(--text-2); font-weight: 650; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- mascot ---------------------------------------------------------------- */
.mascot { width: 140px; aspect-ratio: 200 / 120; position: relative; user-select: none; -webkit-tap-highlight-color: transparent; }
.mascot svg { width: 100%; height: 100%; overflow: visible; }
.mascot .body { transform-origin: 100px 70px; transform-box: view-box; }
html[data-motion="full"] .mascot.idle .body { animation: m-bounce 3.2s ease-in-out infinite; }
html[data-motion="full"] .mascot.wobble .body { animation: m-wobble .6s ease; }
html[data-motion="reduced"] .mascot.wobble .body { animation: m-nod .4s ease; }
.mascot.celebrate .body { animation: m-jump .9s cubic-bezier(.3, 1.6, .5, 1) 2; }
html[data-motion="reduced"] .mascot.celebrate .body, html[data-motion="off"] .mascot.celebrate .body { animation: none; }
.mascot .spark { opacity: 0; }
.mascot.celebrate .spark { animation: m-spark 1.2s ease-out 2; }
html[data-motion="off"] .mascot.celebrate .spark, html[data-motion="reduced"] .mascot.celebrate .spark { animation: none; opacity: 1; }
.mascot .eyes-happy, .mascot .mouth-wow { display: none; }
.mascot.happy .eyes-open, .mascot.celebrate .eyes-open { display: none; }
.mascot.happy .eyes-happy, .mascot.celebrate .eyes-happy { display: inline; }
.mascot .blink { transform-origin: center; transform-box: fill-box; }
html[data-motion="full"] .mascot.idle .blink { animation: m-blink 5s infinite; }
.paused-animations .mascot * { animation-play-state: paused !important; }
@keyframes m-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes m-wobble { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-9deg); } 45% { transform: rotate(7deg); } 70% { transform: rotate(-4deg); } }
@keyframes m-nod { 50% { transform: translateY(2px); } }
@keyframes m-jump { 0%, 100% { transform: translateY(0) scale(1); } 30% { transform: translateY(-22px) scale(1.06, .96); } 60% { transform: translateY(0) scale(.96, 1.04); } }
@keyframes m-spark { 0% { opacity: 0; transform: scale(.4); } 30% { opacity: 1; } 100% { opacity: 0; transform: scale(1.3); } }
@keyframes m-blink { 0%, 94%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ---- workout ----------------------------------------------------------------- */
.workout-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.workout-top h1 { font-size: 1.3rem; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timer-ring { position: relative; width: 112px; height: 112px; flex: none; }
.timer-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-ring .t { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-variant-numeric: tabular-nums; }
.timer-ring .t b { display: block; font-size: 1.5rem; }
.timer-ring .t small { font-size: .7rem; }
.rest-banner {
  position: sticky; top: calc(var(--top-h) + 6px); z-index: 20; display: flex; align-items: center; gap: 12px;
  background: var(--surface-2); border: 1px solid var(--mint); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px; box-shadow: var(--glow);
}
.rest-banner .time { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 4ch; }
.ex-card { padding: 0; overflow: hidden; }
.ex-card .ex-head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 8px; }
.ex-card .ex-head h3 { margin: 0; font-size: 1.05rem; }
.ex-card.current { border-color: rgba(66, 245, 161, .55); box-shadow: var(--glow); }
.prev-perf { font-size: .82rem; color: var(--text-2); padding: 0 14px 6px; }
.set-table { width: 100%; }
.set-row {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) minmax(0, 1fr) 56px; gap: 8px; align-items: center;
  padding: 8px 12px; border-top: 1px solid rgba(42, 55, 88, .5);
}
.set-row.head { font-size: .72rem; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; padding-top: 6px; padding-bottom: 6px; }
.set-row.done { background: rgba(66, 245, 161, .06); }
.set-row.current { background: rgba(77, 141, 255, .08); }
.set-row .idx { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); font-weight: 800; font-size: .9rem; border: 0; color: var(--text); cursor: pointer; }
.set-row .idx.warmup { background: rgba(255, 200, 87, .18); color: var(--amber); }
.set-row .idx.dropset { background: rgba(167, 123, 255, .2); color: #CDB6FF; }
.set-row .idx.failure { background: var(--danger-bg); color: #FFB3B3; }
.num-input { display: flex; align-items: center; background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; min-width: 0; }
.num-input input { width: 100%; min-width: 0; min-height: 44px; border: 0; background: transparent; text-align: center; font-size: 1.05rem; font-weight: 750; font-variant-numeric: tabular-nums; padding: 0 2px; }
.num-input input:focus { outline: none; }
.num-input:focus-within { border-color: var(--mint); outline: 2px solid rgba(66, 245, 161, .3); }
.num-input .unit { color: var(--text-3); font-size: .72rem; padding-right: 8px; }
.check-btn { width: 52px; height: 44px; border-radius: 12px; border: 2px solid var(--border); background: var(--surface-2); display: grid; place-items: center; cursor: pointer; color: var(--text-2); }
.check-btn svg { width: 24px; height: 24px; }
.check-btn[aria-pressed="true"] { background: var(--mint); border-color: var(--mint); color: var(--mint-ink); }
.set-row .sync-mark { font-size: .7rem; color: var(--amber); grid-column: 2 / -1; margin-top: -4px; }
.adjust-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 8px 12px 12px; }
.adjust-bar .btn { min-height: 44px; padding: 0 6px; font-size: .9rem; }
.log-cta { position: sticky; bottom: calc(var(--nav-h) + 22px); z-index: 25; margin-top: 14px; }
@media (min-width: 960px) { .log-cta { bottom: 16px; } }
.ex-actions { display: flex; gap: 6px; padding: 0 12px 12px; flex-wrap: wrap; }
.substituted { font-size: .78rem; color: var(--amber); }
.workout-progress { display: flex; align-items: center; gap: 10px; font-size: .85rem; color: var(--text-2); margin: 8px 0 14px; }
.workout-progress .bar { flex: 1; }

/* celebration overlay */
.celebrate-overlay { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; background: rgba(4, 7, 16, .8); padding: 20px; }
.celebrate-overlay .card { max-width: 420px; width: 100%; text-align: center; }
.celebrate-overlay .mascot { width: 200px; margin: 0 auto 12px; }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -10px; width: 8px; height: 14px; border-radius: 2px; opacity: .9; }
html[data-motion="full"] .confetti i { animation: fall linear forwards; }
html:not([data-motion="full"]) .confetti { display: none; }
@keyframes fall { to { transform: translateY(105vh) rotate(540deg); } }

/* feed */
.feed-item .meta { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.feed-item .meta .grow { flex: 1; min-width: 0; }
.reactions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.reaction { min-height: 38px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; font-weight: 700; }
.reaction[aria-pressed="true"] { border-color: var(--mint); background: rgba(66, 245, 161, .12); }

/* messages */
.chat { display: flex; flex-direction: column; height: calc(100vh - var(--top-h) - var(--nav-h) - 80px); min-height: 360px; }
@media (min-width: 960px) { .chat { height: calc(100vh - var(--top-h) - 60px); } }
.chat-log { flex: 1; overflow-y: auto; padding: 8px 2px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 80%; padding: 10px 14px; border-radius: 18px; background: var(--surface-2); border: 1px solid var(--border); overflow-wrap: anywhere; white-space: pre-wrap; }
.msg.mine { align-self: flex-end; background: rgba(66, 245, 161, .14); border-color: rgba(66, 245, 161, .35); }
.msg .who { font-size: .75rem; color: var(--text-2); font-weight: 700; margin-bottom: 2px; }
.msg .when { font-size: .7rem; color: var(--text-3); margin-top: 4px; }
.chat-form { display: flex; gap: 8px; padding-top: 10px; }
.chat-form textarea { min-height: 48px; height: 48px; resize: none; }

/* leaderboard */
.lb-row { display: grid; grid-template-columns: 34px 40px 1fr auto; gap: 10px; align-items: center; padding: 10px 8px; border-radius: 14px; }
.lb-row.me { background: rgba(66, 245, 161, .1); border: 1px solid rgba(66, 245, 161, .3); }
.lb-rank { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--surface-3); font-size: .85rem; }
.lb-rank.r1 { background: #F4C542; color: #2B2000; }
.lb-rank.r2 { background: #C9D2E3; color: #1A2030; }
.lb-rank.r3 { background: #E09A5A; color: #2B1300; }

/* badges grid */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 12px; }
.badge-tile { text-align: center; padding: 12px 6px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); }
.badge-tile .hex { width: 58px; height: 58px; margin: 0 auto 6px; display: grid; place-items: center; clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0 50%); background: linear-gradient(135deg, var(--blue), var(--purple)); color: #fff; }
.badge-tile .hex svg { width: 26px; height: 26px; }
.badge-tile.locked { opacity: .55; }
.badge-tile.locked .hex { background: var(--surface-3); color: var(--text-3); }
.badge-tile .n { font-size: .78rem; font-weight: 750; }

.skin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.skin { text-align: center; padding: 12px; border-radius: 16px; background: var(--surface-2); border: 2px solid var(--border); cursor: pointer; color: var(--text); }
.skin[aria-pressed="true"] { border-color: var(--mint); }
.skin[disabled] { opacity: .5; cursor: not-allowed; }
.skin .mascot { width: 100%; }

/* widget editor */
.widget-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.widget-row .grow { flex: 1; }

/* auth pages */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px var(--gutter); }
.auth-card { width: min(440px, 100%); }
.auth-card .mascot { width: 160px; margin: 0 auto 6px; }
.auth-card h1 { text-align: center; }
.auth-card .lead { text-align: center; color: var(--text-2); margin-bottom: 18px; }
.auth-foot { text-align: center; margin-top: 14px; color: var(--text-2); font-size: .92rem; }
.check-row { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.check-row input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--mint); flex: none; }

/* onboarding */
.steps { display: flex; gap: 6px; margin-bottom: 16px; }
.steps span { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-3); }
.steps span.on { background: var(--mint); }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .dow { text-align: center; font-size: .72rem; color: var(--text-3); }
.cal .day { aspect-ratio: 1; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; font-size: .85rem; font-weight: 650; border: 1px solid transparent; color: var(--text); text-decoration: none; }
.cal .day.has { background: rgba(66, 245, 161, .18); border-color: rgba(66, 245, 161, .5); color: var(--mint); }
.cal .day.today { border-color: var(--blue); }
.cal .day.blank { background: transparent; }

@media (max-width: 380px) {
  h1 { font-size: 1.5rem; }
  .grid.three { gap: 6px; }
  .stat .v { font-size: 1.1rem; }
  .bottom-nav { grid-template-columns: 1fr 1fr 80px 1fr 1fr; }
  .nav-link { font-size: .66rem; }
  .set-row { grid-template-columns: 36px minmax(0, 1fr) minmax(0, 1fr) 48px; gap: 6px; padding: 8px; }
  .check-btn { width: 46px; }
}
@media print { .bottom-nav, .sidebar, .topbar { display: none; } main { margin: 0; } }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.rel { position: relative; }
.plain-fieldset { border: 0; padding: 0; margin: 0 0 14px; }
.narrow { max-width: 760px; }
.grow { flex: 1; min-width: 0; }
.stack { margin-top: 14px; }
.stack:first-child { margin-top: 0; }
button.mascot { background: none; border: 0; padding: 0; cursor: pointer; color: inherit; border-radius: 20px; }
.workout-mascot { width: 120px; margin-left: auto; }
.card.hero .mascot { flex: none; }
.chart-fig { margin: 0; }
dialog.wide { width: min(760px, calc(100vw - 24px)); }
.list > li > a.grow, .list > li > a.row { color: inherit; text-decoration: none; }
a.card { display: block; color: inherit; text-decoration: none; }
a.card:hover { border-color: var(--surface-3); }
.lb-row > a { color: var(--text); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-head .row h1 { margin: 0; overflow: hidden; text-overflow: ellipsis; }
.feed-item .meta a { font-weight: 750; color: var(--text); text-decoration: none; }
.dropdown h2 { padding: 6px 8px; margin: 0; font-size: 1rem; }
.empty h1 { font-size: 1.4rem; }
.rest-banner > svg { width: 28px; height: 28px; flex: none; color: var(--mint); }
.rest-banner .grow { line-height: 1.1; }
.card-head { flex-wrap: wrap; }
.card-head .pill { white-space: normal; }
p, li, td, th, .sub, .title, h1, h2, h3 { overflow-wrap: anywhere; }
.toast > svg { width: 22px; height: 22px; flex: none; color: var(--mint); }
.toast.error > svg { color: #FFB3B3; }
.toast .grow { line-height: 1.35; }
h1[tabindex="-1"]:focus { outline: none; }
.chart { max-height: 260px; }
/* Keep focused controls clear of the sticky header, log button and bottom nav (WCAG 2.4.11). */
html { scroll-padding-top: calc(var(--top-h) + 16px); scroll-padding-bottom: calc(var(--nav-h) + 110px); }
