:root{
  --p:#226E93; --p-dk:#174E69; --a:#7A1438; --rust:#7E2C2C;
  --ink:#13262E; --body:#3D4B57; --muted:#5B6A73; --line:#E2E7EA; --soft:#F3F5F6; --white:#fff;
  --ok:#1F7A4D;
  --radius:20px;
  --safe-b:env(safe-area-inset-bottom,0px); --safe-t:env(safe-area-inset-top,0px);
}
*{box-sizing:border-box}
html,body{margin:0;height:100%}
body{font-family:'DM Sans',system-ui,-apple-system,'Segoe UI',sans-serif;color:var(--ink);background:var(--soft);-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:transparent}
h1,h2,h3{font-family:'Sora',system-ui,sans-serif;letter-spacing:-0.02em;margin:0}
p{margin:0}
button{font:inherit;cursor:pointer}
a{color:var(--p)}
.shell{max-width:560px;margin:0 auto;min-height:100%;display:flex;flex-direction:column;background:var(--soft)}

/* header */
.top{position:sticky;top:0;z-index:20;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:calc(12px + var(--safe-t)) 18px 12px;background:var(--ink);color:#fff}
.brand{display:flex;align-items:center;gap:10px;color:#fff;text-decoration:none;font-family:'Sora',sans-serif;font-weight:700;font-size:18px}
.brand em{font-style:normal;font-weight:600;color:#9CC6DA}
.chip-btn{border:1px solid rgba(255,255,255,.35);background:transparent;color:#fff;border-radius:999px;padding:8px 14px;font-weight:700;font-size:13px;min-height:36px}

main{flex:1;padding:18px 16px calc(96px + var(--safe-b));outline:none}

/* bottom tabs */
.tabs{position:fixed;left:50%;transform:translateX(-50%);bottom:0;width:100%;max-width:560px;z-index:30;display:grid;grid-template-columns:repeat(4,1fr);background:#fff;border-top:1px solid var(--line);padding:6px 6px calc(6px + var(--safe-b))}
.tabs a{display:flex;flex-direction:column;align-items:center;gap:3px;padding:6px 0;min-height:52px;justify-content:center;color:var(--muted);text-decoration:none;font-size:12px;font-weight:700;border-radius:12px}
.tabs a svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.tabs a.on{color:var(--p);background:#EAF3F7}
body.in-session .tabs{display:none}

/* building blocks */
.card{background:#fff;border:1px solid var(--line);border-radius:var(--radius);padding:18px}
.stack{display:flex;flex-direction:column;gap:14px}
.row{display:flex;align-items:center;gap:12px}
.eyebrow{font-size:12px;font-weight:700;letter-spacing:.1em;text-transform:uppercase;color:var(--a)}
.muted{color:var(--muted)}
.small{font-size:14px}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:52px;padding:0 22px;border-radius:999px;border:0;background:var(--p);color:#fff;font-weight:700;font-size:16px;text-decoration:none;transition:transform .15s ease,background .15s ease}
.btn:active{transform:scale(.98)}
.btn.block{width:100%}
.btn.wine{background:var(--a)}
.btn.ghost{background:#fff;color:var(--ink);border:1.5px solid var(--ink)}
.btn.light{background:#fff;color:var(--p)}
.btn.link{background:transparent;color:var(--p);min-height:44px;padding:0 8px}
.btn[disabled]{opacity:.5}
.pill{display:inline-flex;align-items:center;gap:6px;padding:5px 11px;border-radius:999px;background:var(--soft);font-size:13px;font-weight:700;color:var(--body)}
.notice{display:flex;gap:10px;align-items:flex-start;background:#FFF7E8;border:1px solid #F1DDB2;color:#5A4410;border-radius:14px;padding:12px 14px;font-size:14px}
.notice svg{flex:none;width:20px;height:20px;margin-top:1px;stroke:#A26B00;fill:none;stroke-width:2}

/* hero */
.hero{background:linear-gradient(160deg,#0F2229,var(--ink) 55%,#16343D);color:#fff;border-radius:24px;padding:22px;position:relative;overflow:hidden}
.hero::after{content:"";position:absolute;right:-60px;top:-60px;width:200px;height:200px;border-radius:50%;background:radial-gradient(closest-side,rgba(34,110,147,.55),transparent)}
.hero h1{font-size:26px;line-height:1.15;position:relative;z-index:1}
.hero p{color:#C9D6DB;position:relative;z-index:1}

/* code input */
.code-input{width:100%;font-family:'Sora',sans-serif;font-weight:700;font-size:24px;letter-spacing:.14em;text-transform:uppercase;text-align:center;padding:14px;border-radius:16px;border:2px solid var(--line);background:#fff;color:var(--ink)}
.code-input:focus{outline:none;border-color:var(--p);box-shadow:0 0 0 4px rgba(34,110,147,.15)}
.err{color:#A3122F;font-size:14px;font-weight:700;min-height:20px;text-align:center}
label.lbl{font-weight:700;font-size:14px}

/* progress ring + stats */
.ring{position:relative;width:96px;height:96px;flex:none}
.ring svg{width:96px;height:96px;transform:rotate(-90deg)}
.ring .val{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;font-family:'Sora',sans-serif;font-weight:700;font-size:22px;color:#fff}
.ring .val small{font-family:'DM Sans',sans-serif;font-size:11px;font-weight:700;color:#9CC6DA;letter-spacing:.06em}
.stats{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.stat{background:#fff;border:1px solid var(--line);border-radius:16px;padding:12px;text-align:center}
.stat b{display:block;font-family:'Sora',sans-serif;font-size:22px}
.stat span{font-size:12px;color:var(--muted);font-weight:700}

/* exercise list */
.ex{display:flex;align-items:center;gap:12px;background:#fff;border:1px solid var(--line);border-radius:18px;padding:10px;text-decoration:none;color:inherit}
.ex .thumb{width:76px;height:56px;flex:none;border-radius:12px;background:var(--soft);display:flex;align-items:center;justify-content:center;overflow:hidden}
.ex .thumb svg{width:76px;height:52px}
.ex .thumb img.mp-art{width:76px;height:56px;object-fit:cover}
.ex .info{flex:1;min-width:0}
.ex .info b{display:block;font-size:16px}
.ex .info span{font-size:13px;color:var(--muted)}
.ex .check{width:30px;height:30px;flex:none;border-radius:50%;border:2px solid var(--line);display:flex;align-items:center;justify-content:center}
.ex.done .check{background:var(--ok);border-color:var(--ok)}
.ex.done .check svg{display:block}
.ex .check svg{display:none;width:16px;height:16px;stroke:#fff;fill:none;stroke-width:3}
.ex.done .info b{color:var(--muted)}

/* demo svg */
.mp-demo{width:100%;height:auto;display:block}
img.mp-art{border-radius:14px;background:#F1F5F8}
.tile .thumb img.mp-art{aspect-ratio:3/2;object-fit:cover}
.mp-body{stroke:var(--p);stroke-width:9;fill:none;stroke-linecap:round;stroke-linejoin:round}
.mp-move{stroke:var(--a);stroke-width:9;fill:none;stroke-linecap:round;stroke-linejoin:round}
.mp-head{fill:#fff;stroke:var(--p);stroke-width:6}
.mp-prop{fill:#DCE3E7}
.mp-guide{stroke:#AEB9BF;stroke-width:2}
.demo-box{background:linear-gradient(180deg,#fff,#F3F7F9);border:1px solid var(--line);border-radius:22px;padding:12px}

/* filters */
.chips{display:flex;gap:8px;overflow-x:auto;padding-bottom:2px;scrollbar-width:none}
.chips::-webkit-scrollbar{display:none}
.chip{flex:none;border:1.5px solid var(--line);background:#fff;color:var(--body);border-radius:999px;padding:8px 14px;font-weight:700;font-size:14px;min-height:40px}
.chip.on{background:var(--ink);color:#fff;border-color:var(--ink)}
.grid2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.tile{background:#fff;border:1px solid var(--line);border-radius:18px;padding:10px;text-decoration:none;color:inherit;display:flex;flex-direction:column;gap:6px}
.tile .thumb{background:var(--soft);border-radius:12px}
.tile b{font-size:15px;line-height:1.2}
.tile span{font-size:12px;color:var(--muted);font-weight:700}

/* steps */
ol.steps{margin:0;padding:0;list-style:none;counter-reset:s;display:flex;flex-direction:column;gap:10px}
ol.steps li{counter-increment:s;display:flex;gap:12px;align-items:flex-start;font-size:16px;color:var(--body)}
ol.steps li::before{content:counter(s);flex:none;width:28px;height:28px;border-radius:50%;background:#EAF3F7;color:var(--p);font-weight:700;display:flex;align-items:center;justify-content:center;font-size:14px}

/* player */
.player{display:flex;flex-direction:column;gap:14px}
.player-top{display:flex;align-items:center;justify-content:space-between;gap:10px}
.bar{height:6px;border-radius:99px;background:var(--line);overflow:hidden;flex:1}
.bar i{display:block;height:100%;background:var(--p);border-radius:99px;transition:width .3s ease}
.big-timer{position:relative;width:190px;height:190px;margin:0 auto}
.big-timer svg{width:190px;height:190px;transform:rotate(-90deg)}
.big-timer .t{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center}
.big-timer .t b{font-family:'Sora',sans-serif;font-size:56px;line-height:1}
.big-timer .t span{font-weight:700;color:var(--muted);font-size:14px;margin-top:6px;text-transform:uppercase;letter-spacing:.08em}
.tap{width:180px;height:180px;border-radius:50%;margin:0 auto;border:0;background:radial-gradient(circle at 30% 30%,#2E86B0,var(--p) 60%,var(--p-dk));color:#fff;box-shadow:0 18px 40px rgba(34,110,147,.35);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;transition:transform .1s ease}
.tap:active{transform:scale(.96)}
.tap b{font-family:'Sora',sans-serif;font-size:60px;line-height:1}
.tap span{font-size:14px;font-weight:700;opacity:.85}
.phase-rest .big-timer circle.fg{stroke:var(--ok)}
.setdots{display:flex;gap:8px;justify-content:center}
.setdots i{width:34px;height:8px;border-radius:99px;background:var(--line)}
.setdots i.on{background:var(--a)}
.center{text-align:center}
.celebrate{text-align:center;padding:28px 18px}
.celebrate .badge{width:110px;height:110px;margin:0 auto 14px;border-radius:50%;background:radial-gradient(circle at 30% 30%,#A3274B,var(--a));display:flex;align-items:center;justify-content:center;box-shadow:0 18px 40px rgba(122,20,56,.35);animation:pop .6s cubic-bezier(.2,1.4,.4,1) both}
.celebrate .badge svg{width:56px;height:56px;stroke:#fff;fill:none;stroke-width:3}
@keyframes pop{from{transform:scale(.4);opacity:0}to{transform:none;opacity:1}}

/* calendar */
.cal{display:grid;grid-template-columns:repeat(7,1fr);gap:6px}
.cal div{aspect-ratio:1;border-radius:8px;background:var(--line);display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:700;color:var(--muted)}
.cal div.l1{background:#BFDCEA;color:var(--ink)}
.cal div.l2{background:var(--p);color:#fff}
.cal div.today{outline:2px solid var(--a);outline-offset:1px}
.cal .hd{background:none;aspect-ratio:auto}

.sheet{position:fixed;inset:0;z-index:50;background:rgba(19,38,46,.55);display:flex;align-items:flex-end;justify-content:center}
.sheet .panel{background:#fff;width:100%;max-width:560px;border-radius:24px 24px 0 0;padding:22px 18px calc(22px + var(--safe-b));display:flex;flex-direction:column;gap:12px}
@media (prefers-reduced-motion: reduce){ .mp-demo animate{display:none} *{animation:none!important;transition:none!important} }

.player{gap:10px}
.player .demo-box{padding:6px}
.player .demo-box svg{max-height:24vh}
.player .demo-box img.mp-art{max-height:30vh;width:auto;max-width:100%;margin:0 auto}
.player h1{font-size:22px!important}

/* v2: tappable tick + status */
.ex{padding:8px 8px 8px 10px}
.ex .ex-main{display:flex;align-items:center;gap:12px;flex:1;min-width:0;text-decoration:none;color:inherit}
.ex button.check{width:44px;height:44px;border-radius:50%;border:2px solid #C7D1D6;background:#fff;padding:0;display:flex;align-items:center;justify-content:center;flex:none}
.ex button.check svg{width:20px;height:20px}
.ex.done button.check{background:var(--ok);border-color:var(--ok)}
.ex .st{display:block;font-style:normal;font-size:12px;font-weight:700;margin-top:2px}
.ex .st.ok{color:var(--ok)}
.ex .st.part{color:var(--a)}
ul.activity{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:10px}
ul.activity li{border-bottom:1px solid var(--line);padding-bottom:10px;display:flex;flex-direction:column;gap:4px}
ul.activity li:last-child{border-bottom:0;padding-bottom:0}
ul.donelist{list-style:none;margin:8px 0 0;padding:0;display:flex;flex-direction:column;gap:4px;font-size:15px}
ul.donelist li.y{color:var(--ok);font-weight:700}
ul.donelist li.n{color:var(--muted)}

/* v3: own photos + video link */
.photos{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.photos figure{margin:0;background:#fff;border:1px solid var(--line);border-radius:16px;overflow:hidden}
.photos img{display:block;width:100%;aspect-ratio:4/3;object-fit:cover}
.photos figcaption{font-size:12px;font-weight:700;color:var(--muted);padding:6px 10px;text-transform:uppercase;letter-spacing:.06em}
.video-btn{gap:8px}
