:root {
  --primary: #0F766E; --primary-ink: #FFFFFF; --accent: #C2410C; --accent-ink: #FFFFFF;
  --bg: #F8FAFC; --surface: #FFFFFF; --text: #0F172A; --muted: #475569; --line: #E2E8F0;
  --good: #15803D; --warn: #B45309; --bad: #B91C1C; --soft: #F0FDFA;
  --radius: 14px; --shadow: 0 1px 2px rgba(15,23,42,.06), 0 4px 16px rgba(15,23,42,.06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --primary: #2DD4BF; --primary-ink: #0B1215; --accent: #FB923C; --accent-ink: #0B1215;
    --bg: #0B1215; --surface: #151F24; --text: #E2E8F0; --muted: #94A3B8; --line: #263238;
    --good: #4ADE80; --warn: #FBBF24; --bad: #F87171; --soft: #10302C;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 Inter, "Segoe UI", system-ui, sans-serif; }
.num, input[type=number] { font-variant-numeric: tabular-nums; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 700; font-size: 18px; }
nav { display: flex; gap: 4px; flex-wrap: wrap; }
nav button { background: none; border: 0; color: var(--muted); padding: 8px 12px; border-radius: 10px; font: inherit; cursor: pointer; }
nav button.active { color: var(--primary); background: var(--soft); font-weight: 600; }
main { max-width: 980px; margin: 0 auto; padding: 24px 16px 80px; }
h1 { font-size: 28px; line-height: 1.2; margin: 0 0 8px; }
h2 { font-size: 20px; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 0 0 8px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.hint { font-size: 13px; color: var(--muted); margin-top: 4px; }
input, select { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: var(--surface); color: var(--text); }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin-bottom: 10px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--primary); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn.cta { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: 7px 12px; font-size: 14px; }
.stat { padding: 14px; border-radius: 12px; background: var(--soft); }
.stat .v { font-size: 26px; font-weight: 700; }
.stat .l { font-size: 13px; color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; border: 1px solid currentColor; }
.pill.met { color: var(--good); } .pill.partly { color: var(--warn); } .pill.missed { color: var(--bad); } .pill.upcoming { color: var(--muted); } .pill.not-needed { color: var(--muted); }
.notice { border-left: 4px solid var(--warn); background: var(--surface); padding: 12px 14px; border-radius: 8px; margin: 10px 0; }
.notice.bad { border-color: var(--bad); } .notice.good { border-color: var(--good); } .notice.info { border-color: var(--primary); }
.photos { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.photo-slot { border: 2px dashed var(--line); border-radius: 12px; padding: 12px; text-align: center; min-height: 160px; }
.photo-slot img, .figure img { max-width: 100%; border-radius: 10px; display: block; margin: 0 auto 8px; }
.figure { text-align: center; }
.figure figcaption { font-size: 13px; color: var(--muted); }
.camera { position: fixed; inset: 0; background: #000; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.camera .stage { position: relative; height: 78vh; aspect-ratio: 3/4; max-width: 96vw; }
.camera video { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; transform: scaleX(-1); }
.camera svg.guide { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.camera .count { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 120px; font-weight: 800; color: #fff; text-shadow: 0 4px 24px rgba(0,0,0,.6); }
.camera .bar { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; justify-content: center; }
.camera .tip { color: #E2E8F0; margin-top: 8px; font-size: 14px; text-align: center; max-width: 560px; padding: 0 12px; }
.ring { width: 120px; height: 120px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 15px; }
th { font-size: 13px; color: var(--muted); font-weight: 600; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 30; max-width: 90vw; }
#toast.show { opacity: 1; }
.spinner { width: 18px; height: 18px; border: 3px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.stepper { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.stepper span { font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--line); color: var(--muted); }
.stepper span.on { background: var(--primary); color: var(--primary-ink); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .split { grid-template-columns: 1fr; } h1 { font-size: 24px; } main { padding: 16px 16px 80px; } }
.workout { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.workout ul { margin: 6px 0 0; padding-left: 18px; }
.range { display: flex; align-items: center; gap: 12px; }
.range input { flex: 1; accent-color: var(--primary); }
.camera .status { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); background: rgba(185,28,28,.88); color: #fff; padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: 15px; white-space: nowrap; }
.camera .status.ok { background: rgba(21,128,61,.9); }
.camera video { transform: none; }
a { color: var(--primary); }
code { background: var(--soft); padding: 1px 5px; border-radius: 4px; }

/* ---------- live workout ---------- */
.live { position: fixed; inset: 0; z-index: 25; background: var(--bg); overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.live-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.live-top h2 { margin: 2px 0; font-size: 24px; }
.live-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); gap: 16px; align-items: start; }
.live-cam { position: relative; background: #000; border-radius: 14px; overflow: hidden; }
.live-cam video { display: block; width: 100%; height: auto; max-height: 72vh; }
.live-cam canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.live-cam.mirror video, .live-cam.mirror canvas { transform: scaleX(-1); }
.live-cue { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); background: rgba(21,128,61,.9); color: #fff; padding: 8px 16px; border-radius: 999px; font-weight: 700; font-size: 17px; text-align: center; max-width: 92%; }
.live-cue.warn { background: rgba(180,83,9,.92); }
.live-side { display: flex; flex-direction: column; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.live-ring { display: flex; justify-content: center; }
.live-list { display: flex; gap: 8px; flex-wrap: wrap; }
.live-chip { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; background: var(--surface); }
.live-chip.on { border-color: var(--primary); font-weight: 700; }
.live-rest { position: fixed; inset: 0; z-index: 26; background: rgba(11,18,21,.72); display: flex; align-items: center; justify-content: center; padding: 16px; }
.live-rest[hidden] { display: none; }
.live-rest-card { background: var(--surface); color: var(--text); border-radius: 18px; padding: 24px; text-align: center; max-width: 420px; width: 100%; box-shadow: var(--shadow); }
.live-rest-card table { margin-top: 8px; }
.segring { display: block; }
.segring .seg-on { filter: drop-shadow(0 0 4px rgba(251,146,60,.45)); }
@media (max-width: 760px) { .live-grid { grid-template-columns: 1fr; } .live-top h2 { font-size: 20px; } }
.workout-head { display: flex; align-items: center; gap: 12px; }

/* ---------- public homepage ---------- */
.hero { display: grid; grid-template-columns: 1.15fr 1fr; gap: 32px; align-items: start; padding: 16px 0 32px; }
.eyebrow { display: inline-block; font-size: 13px; font-weight: 600; color: var(--primary); background: var(--soft); padding: 4px 12px; border-radius: 999px; margin-bottom: 14px; }
.hero-title { font-size: clamp(30px, 4.4vw, 44px); line-height: 1.1; letter-spacing: -0.02em; margin-bottom: 14px; }
.hero-sub { font-size: 17px; color: var(--muted); max-width: 520px; }
.hero-rings { position: relative; height: 250px; max-width: 420px; margin-top: 12px; }
.hero-rings .hr-main { position: absolute; left: 0; top: 10px; }
.hero-rings .hr-small { position: absolute; background: var(--surface); border: 1px solid var(--line); border-radius: 50%; box-shadow: var(--shadow); padding: 6px; line-height: 0; }
.hero-rings .hr-a { left: 210px; top: 0; }
.hero-rings .hr-b { left: 250px; top: 128px; }
.auth-card { position: sticky; top: 76px; padding: 22px; }
.auth-tabs { display: flex; gap: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 4px; margin-bottom: 18px; }
.auth-tabs button { flex: 1; background: none; border: 0; padding: 8px 6px; border-radius: 9px; font: inherit; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; }
.auth-tabs button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.btn.wide { width: 100%; }
.sso-list { display: grid; gap: 10px; }
.sso { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 46px; padding: 10px 16px; border-radius: 10px; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; border: 1px solid transparent; }
.sso-logo { width: 20px; height: 20px; }
.sso-google { background: #FFFFFF; color: #1F1F1F; border-color: #747775; }
.sso-apple { background: #000000; color: #FFFFFF; border-color: #000000; }
.sso-facebook { background: #1877F2; color: #FFFFFF; border-color: #1877F2; }
@media (prefers-color-scheme: dark) { .sso-apple { background: #FFFFFF; color: #000000; border-color: #FFFFFF; } .sso-google { background: #131314; color: #E3E3E3; border-color: #8E918F; } }
.sso:hover:not(:disabled) { filter: brightness(0.95); }
.sso:disabled { opacity: .38; cursor: not-allowed; }
.sso-note { margin: 8px 0 0; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 16px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.how { padding: 8px 0 24px; }
.how h2, .promise h2 { font-size: 24px; }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.step-n { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 700; margin-bottom: 8px; }
.ticks { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 8px; }
.ticks li { padding-left: 28px; position: relative; }
.ticks li::before { content: "✓"; position: absolute; left: 0; top: 0; width: 20px; height: 20px; border-radius: 50%; background: var(--soft); color: var(--good); font-size: 13px; font-weight: 700; display: grid; place-items: center; }
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; gap: 20px; }
  .auth-card { position: static; }
  .hero-rings { height: 200px; transform: scale(.8); transform-origin: left top; }
}

/* ---------- exercise pictures ---------- */
.xp { display: block; max-width: 100%; height: auto; overflow: visible; }
.xp line { stroke-linecap: round; }
.xp-near, .xp-body { stroke: var(--primary); stroke-width: 4.2; }
.xp-far { stroke: var(--primary); stroke-width: 4.2; opacity: .38; }
.xp-head { fill: var(--primary); }
.xp-ground { stroke: var(--line); stroke-width: 1.5; }
.xp-eq { fill: var(--line); }
.xp-eqline { stroke: var(--muted); }
.xp-metal { fill: var(--accent); }
.xp-hole { fill: var(--surface); }
.xp-cable { stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 3 2; }
.xp-arrow { stroke: var(--accent); stroke-width: 2.2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.xp-label { font-size: 7px; fill: var(--muted); font-weight: 600; }
.xp-anim .xp-f0 { animation: xpA 2.6s ease-in-out infinite; }
.xp-anim .xp-f1 { animation: xpB 2.6s ease-in-out infinite; }
@keyframes xpA { 0%, 38% { opacity: 1; } 50%, 88% { opacity: 0; } 100% { opacity: 1; } }
@keyframes xpB { 0%, 38% { opacity: 0; } 50%, 88% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .xp-anim .xp-f0 { animation: none; } .xp-anim .xp-f1 { animation: none; opacity: 0; } }
.howto-pics { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; justify-content: center; }
.howto-steps { padding-left: 22px; margin: 0 0 12px; display: grid; gap: 6px; }
.howto-avoid { padding-left: 20px; margin: 0; color: var(--muted); font-size: 14px; display: grid; gap: 4px; }
.ex-item { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.ex-item:first-child { border-top: 0; }
.ex-thumb { flex: none; width: 50px; height: 42px; display: grid; place-items: center; background: var(--bg); border-radius: 8px; border: 1px solid var(--line); overflow: hidden; }
.ex-thumb .xp { width: 46px; height: 38px; }
.ex-item .ex-text { flex: 1; font-size: 14px; line-height: 1.35; min-width: 0; overflow-wrap: anywhere; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--primary); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: underline; }
dialog.sheet { border: 0; border-radius: 16px; padding: 0; width: min(640px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog.sheet::backdrop { background: rgba(15,23,42,.55); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px 0; }
.sheet-body { padding: 12px 20px 20px; max-height: 75vh; overflow: auto; }
.live-howto { display: flex; gap: 12px; align-items: center; margin-top: 6px; }
.live-howto .xp { background: var(--bg); border-radius: 10px; }

/* ---------- shared bits ---------- */
.seg { display: inline-flex; gap: 2px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 3px; flex-wrap: wrap; }
.seg button { background: none; border: 0; padding: 6px 12px; border-radius: 8px; font: inherit; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--soft); font-size: 14px; }
.chip-x { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 2px; }
.live-pill { color: var(--bad); border-color: var(--bad); }
.live-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* ---------- live group session ---------- */
.group-live { overflow: auto; }
.gl-coach { margin: 0 0 12px; padding: 12px 14px; }
.gl-coach select, .gl-coach input { width: auto; }
.gl-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.gl-grid[data-n="1"] { grid-template-columns: minmax(260px, 720px); justify-content: center; }
.gl-grid[data-n="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gl-tile { position: relative; background: #000; border-radius: 14px; overflow: hidden; aspect-ratio: 16 / 10; }
.gl-tile video, .gl-tile canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.gl-tile.me video, .gl-tile.me canvas { transform: scaleX(-1); }
.gl-wait { position: absolute; inset: 0; display: grid; place-items: center; color: #CBD5E1; font-size: 14px; text-align: center; padding: 16px; }
.gl-ring { position: absolute; top: 8px; right: 8px; background: rgba(11,18,21,.72); border-radius: 50%; padding: 4px; line-height: 0; --text: #E2E8F0; --muted: #94A3B8; --line: #334155; }
.gl-ring:empty { display: none; }
.gl-label { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 12px 10px; background: linear-gradient(transparent, rgba(0,0,0,.75)); color: #fff; }
.gl-status { color: #CBD5E1; }
.gl-status.warn { color: #FBBF24; }
.gl-status.good { color: #4ADE80; }
.gl-plus { position: absolute; top: 10px; left: 10px; }
.gl-foot { text-align: center; margin-top: 10px; }

/* ---------- community board ---------- */
.board { list-style: none; margin: 0; padding: 0; }
.board-row { display: grid; grid-template-columns: 40px 1fr auto auto; gap: 14px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.board-row:first-child { border-top: 0; }
.board-rank { font-size: 22px; font-weight: 800; color: var(--muted); text-align: center; }
.board-row.top1 .board-rank { color: var(--accent); }
.board-bar { height: 6px; border-radius: 3px; background: var(--line); margin-top: 6px; overflow: hidden; }
.board-bar span { display: block; height: 100%; background: var(--primary); border-radius: 3px; }
.board-nums { display: grid; gap: 2px; color: var(--muted); text-align: right; }
.board-nums b { color: var(--text); }
@media (max-width: 640px) { .board-row { grid-template-columns: 32px 1fr auto; } .board-nums { display: none; } }

@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; padding: 10px 16px 0; }
  .topbar nav { order: 3; width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 8px; margin: 0 -4px; }
  .topbar nav::-webkit-scrollbar { display: none; }
  .topbar nav button { flex: none; }
}

.update-bar { background: var(--warn); color: #fff; padding: 12px 20px; font-size: 15px; line-height: 1.45; }
@media (prefers-color-scheme: dark) { .update-bar { color: #0B1215; } }

/* ---------- admin dashboard ---------- */
.dash-filters { margin-top: 4px; }
.dash-hero { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.hero-num { font-size: 56px; font-weight: 700; line-height: 1.05; letter-spacing: -0.02em; margin: 4px 0; }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi-row.inner { margin-bottom: 0; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.kpi-row.inner .kpi { background: var(--bg); }
.kpi-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi-value { font-size: 26px; font-weight: 600; margin-top: 2px; }
.kpi-sub { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); gap: 16px; }
.dash-grid > * { min-width: 0; }
.dash-grid > .card { margin-bottom: 16px; }
@media (max-width: 480px) { .dash-grid { grid-template-columns: 1fr; } }
.dash-card h2 { margin-bottom: 2px; }
.dash-card > .small.muted { margin-bottom: 12px; }
.cohort td, .cohort th { white-space: nowrap; }
.ch { display: block; overflow: visible; }
.ch-grid { stroke: var(--line); stroke-width: 1; }
.ch-axis { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.ch-label { font-size: 13px; fill: var(--text); }
.ch-value { font-size: 12px; fill: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.ch-mark { fill: var(--primary); }
.ch-line { fill: none; stroke: var(--primary); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ch-area { fill: var(--primary); opacity: .1; }
.ch-dot { fill: var(--primary); stroke: var(--surface); stroke-width: 2; }
.ch-cross { stroke: var(--muted); stroke-width: 1; }
.ch-hit { fill: transparent; outline: none; cursor: default; }
.ch-hit:focus-visible { stroke: var(--primary); stroke-width: 1.5; }
.ch-tip { position: fixed; z-index: 50; display: none; pointer-events: none; background: var(--text); color: var(--bg); padding: 6px 10px; border-radius: 8px; font-size: 13px; box-shadow: var(--shadow); }
.ch-tip strong { display: block; font-size: 14px; }
.ch-table { margin-top: 8px; font-size: 13px; }
.ch-table summary { cursor: pointer; color: var(--muted); }
.ch-table table { margin-top: 6px; }

.kpi-row.six { grid-template-columns: repeat(6, 1fr); }
@media (max-width: 1040px) { .kpi-row.six { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .kpi-row.six { grid-template-columns: repeat(2, 1fr); } }

/* ---------- account menu ---------- */
.acct { position: relative; margin-left: 6px; }
.acct-btn { padding: 4px !important; border-radius: 50% !important; }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: var(--primary-ink); font-weight: 700; font-size: 13px; }
.acct-btn.active .avatar { box-shadow: 0 0 0 3px var(--soft), 0 0 0 5px var(--primary); }
.acct-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 40px rgba(15,23,42,.18); padding: 6px; z-index: 30; display: grid; }
.acct-menu button, .acct-menu a { text-align: left; padding: 10px 12px; border-radius: 8px; color: var(--text); text-decoration: none; font: inherit; background: none; border: 0; cursor: pointer; }
.acct-menu button:hover, .acct-menu a:hover, .acct-menu .active { background: var(--soft); }
.acct-who { display: grid; padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
@media (max-width: 760px) { .acct { position: static; margin-left: auto; } .acct-menu { right: 12px; top: 56px; } }

/* ---------- website ---------- */
.site-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.site-nav a:not(.btn) { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 10px; font-weight: 500; }
.site-nav a:not(.btn):hover, .site-nav a[aria-current] { color: var(--primary); background: var(--soft); }
.site-nav .btn { margin-left: 6px; }
.site-main { max-width: 980px; margin: 0 auto; padding: 24px 16px 48px; }
.site-hero { padding: 32px 0 24px; max-width: 760px; }
.site-hero.center { text-align: center; margin: 0 auto; }
.site-hero h1 { font-size: clamp(30px, 4.6vw, 46px); line-height: 1.1; letter-spacing: -0.02em; }
.feature { display: grid; grid-template-columns: 220px 1fr; gap: 28px; align-items: center; padding: 26px 0; border-top: 1px solid var(--line); }
.feature-pic { display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; min-height: 190px; padding: 16px; }
.feature h2 { font-size: 24px; }
.site-grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 16px; margin-bottom: 16px; }
.site-cta { text-align: center; margin-top: 24px; }
.price-wrap { display: flex; justify-content: center; margin-bottom: 20px; }
.price-card { max-width: 420px; width: 100%; }
.price { font-size: 44px; font-weight: 700; margin: 4px 0 14px; }
.faq details { border-top: 1px solid var(--line); padding: 12px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 8px 0 0; color: var(--muted); }
textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: var(--surface); color: var(--text); resize: vertical; }
.legal h2 { font-size: 18px; margin-top: 22px; }
.legal p, .legal li { line-height: 1.6; }
.site-footer { border-top: 1px solid var(--line); background: var(--surface); margin-top: 32px; }
.site-footer-in { max-width: 980px; margin: 0 auto; padding: 28px 16px 8px; display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 20px; }
.site-footer h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.site-footer a:not(.brand) { display: block; color: var(--text); text-decoration: none; padding: 3px 0; font-size: 15px; }
.site-footer a:not(.brand):hover { color: var(--primary); }
.site-copy { max-width: 980px; margin: 0 auto; padding: 8px 16px 24px; }
main#app .site-footer { margin: 32px calc(50% - 50vw) -80px; }
.msg { border-top: 1px solid var(--line); padding: 12px 0; }
@media (max-width: 760px) {
  .feature { grid-template-columns: 1fr; gap: 14px; }
  .site-footer-in { grid-template-columns: 1fr 1fr; }
  .site-top .site-nav { order: 3; width: 100%; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 8px; }
  .site-top .site-nav a { flex: none; }
}
html, body { overflow-x: clip; }
@media (max-width: 760px) { .topbar nav .site-nav { flex-wrap: nowrap; } .topbar nav .site-nav > * { flex: none; } }

/* ---------- build your own workout: 3D blocks and the puzzle track ---------- */
.bld-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; align-items: end; margin-top: 12px; }
.bld-controls label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 600; }
.bld-controls input, .bld-controls select { width: 100%; }
.bld-track { display: flex; flex-wrap: wrap; gap: 14px 6px; align-items: flex-start; min-height: 170px; margin-top: 12px; padding: 14px 12px; border-radius: 14px;
  background: repeating-linear-gradient(90deg, transparent 0 22px, color-mix(in srgb, var(--line) 55%, transparent) 22px 23px), var(--bg); border: 1px dashed var(--line); transition: border-color .2s, background-color .2s; }
.bld-track.drop-on { border-color: var(--primary); }
.bld-palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.blk { --blk: var(--primary); position: relative; display: grid; gap: 6px; justify-items: center; width: 150px; padding: 10px 8px 8px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
  user-select: none; -webkit-user-select: none; touch-action: none; cursor: grab; perspective: 600px; transition: transform .15s, box-shadow .15s, opacity .2s; }
.blk:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.blk.dim { opacity: .55; }
.blk.pal { width: auto; }
.blk-lifted { opacity: .35; }
.blk-ghost { position: fixed; left: 0; top: 0; z-index: 1000; pointer-events: none; width: 150px; box-shadow: 0 30px 50px rgba(0,0,0,.35); cursor: grabbing; }
.blk.g-legs { --blk: #0F766E; } .blk.g-push { --blk: #C2410C; } .blk.g-pull { --blk: #1D4ED8; } .blk.g-core { --blk: #7C3AED; } .blk.g-cardio { --blk: #B45309; }
@media (prefers-color-scheme: dark) { .blk.g-legs { --blk: #2DD4BF; } .blk.g-push { --blk: #FB923C; } .blk.g-pull { --blk: #60A5FA; } .blk.g-core { --blk: #A78BFA; } .blk.g-cardio { --blk: #FBBF24; } }
/* the 3D tile: front face with the moving figure, a lit top and a shaded side, tilted slightly */
.blk-3d { position: relative; width: 112px; height: 100px; transform-style: preserve-3d; transform: rotateX(14deg) rotateY(-18deg); transition: transform .25s ease; }
.blk:hover .blk-3d, .blk:focus-within .blk-3d { transform: rotateX(8deg) rotateY(-26deg) translateZ(6px); }
.blk-face { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; padding: 4px; border-radius: 10px; background: linear-gradient(160deg, color-mix(in srgb, var(--blk) 16%, var(--surface)), color-mix(in srgb, var(--blk) 4%, var(--surface)));
  border: 1.5px solid color-mix(in srgb, var(--blk) 45%, var(--line)); box-shadow: 0 10px 22px rgba(0,0,0,.18); transform: translateZ(10px); }
.blk-face .xp { width: 100%; height: 100%; } .blk-face .xp-near, .blk-face .xp-body, .blk-face .xp-far { stroke: var(--blk); } .blk-face .xp-head { fill: var(--blk); }
.blk-top { position: absolute; left: 0; right: 0; top: 0; height: 20px; border-radius: 10px 10px 0 0; background: color-mix(in srgb, var(--blk) 55%, white); transform-origin: top; transform: rotateX(90deg) translateZ(-10px); }
.blk-side { position: absolute; top: 0; bottom: 0; right: 0; width: 20px; border-radius: 0 10px 10px 0; background: color-mix(in srgb, var(--blk) 70%, black); transform-origin: right; transform: rotateY(90deg) translateZ(-10px); }
.blk-name { font-weight: 700; font-size: 14px; text-align: center; line-height: 1.2; }
.blk-amt { display: flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 600; flex-wrap: wrap; justify-content: center; }
.blk-amt span { min-width: 44px; text-align: center; }
.blk-step, .blk-tool { width: 24px; height: 24px; border-radius: 7px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; line-height: 1; }
.blk-step:hover, .blk-tool:hover { border-color: var(--blk); color: var(--blk); }
.blk-tools { display: flex; gap: 4px; }
.blk-tool.danger:hover { border-color: #DC2626; color: #DC2626; }
/* puzzle shape: a tab on the right, a notch on the left, so pieces on the track interlock */
.bld-track .piece { clip-path: path('M 0 0 H 150 V 52 a 11 11 0 0 1 0 22 V 400 H 0 V 74 a 11 11 0 0 0 0 -22 Z'); padding-right: 14px; margin-right: -4px; border-radius: 12px 0 0 12px; }
.bld-track .piece.insert-before, .blk-drop.insert-before { box-shadow: -4px 0 0 0 var(--primary); }
.blk-drop { display: flex; align-items: center; justify-content: center; width: 150px; min-height: 150px; border: 2px dashed var(--line); border-radius: 12px; color: var(--muted); font-size: 13px; text-align: center; padding: 8px; }
.blk-drop.empty { width: 100%; min-height: 140px; font-size: 15px; }
.blk-drop small { display: block; margin-top: 4px; font-size: 12px; }
.bld-balance { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.bld-balance .pill { --blk: var(--primary); background: color-mix(in srgb, var(--blk) 14%, transparent); color: var(--blk); border: 1px solid color-mix(in srgb, var(--blk) 40%, transparent); }
.bld-balance .pill.g-legs { --blk: #0F766E; } .bld-balance .pill.g-push { --blk: #C2410C; } .bld-balance .pill.g-pull { --blk: #1D4ED8; } .bld-balance .pill.g-core { --blk: #7C3AED; } .bld-balance .pill.g-cardio { --blk: #B45309; }
@media (prefers-color-scheme: dark) { .bld-balance .pill.g-legs { --blk: #2DD4BF; } .bld-balance .pill.g-push { --blk: #FB923C; } .bld-balance .pill.g-pull { --blk: #60A5FA; } .bld-balance .pill.g-core { --blk: #A78BFA; } .bld-balance .pill.g-cardio { --blk: #FBBF24; } }
.bld-balance .pill.off { opacity: .45; }
.bld-mini { display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap; }
.bld-mini .mini { --blk: var(--primary); display: inline-flex; width: 50px; height: 46px; align-items: flex-end; justify-content: center; border-radius: 8px; background: color-mix(in srgb, var(--blk) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--blk) 35%, var(--line)); padding: 2px; }
.bld-mini .mini.g-legs { --blk: #0F766E; } .bld-mini .mini.g-push { --blk: #C2410C; } .bld-mini .mini.g-pull { --blk: #1D4ED8; } .bld-mini .mini.g-core { --blk: #7C3AED; } .bld-mini .mini.g-cardio { --blk: #B45309; }
.bld-mini .xp { width: 100%; height: 100%; } .bld-mini .xp-near, .bld-mini .xp-body, .bld-mini .xp-far { stroke: var(--blk); } .bld-mini .xp-head { fill: var(--blk); }
@media (max-width: 520px) { .blk, .blk-drop, .blk-ghost { width: calc(50% - 6px); } .bld-track .piece { clip-path: none; padding-right: 8px; margin-right: 0; border-radius: 12px; } .bld-palette { grid-template-columns: repeat(2, 1fr); } }
@media (prefers-reduced-motion: reduce) { .blk-3d, .blk { transition: none; } }
