/* 半月板卫士 · 竖屏单列，最大宽度 520px，底部 4 个标签（与小程序 tabBar 对应） */
:root{
  --bg:#F1F5F3; --surface:#FFFFFF; --surface-2:#E6EFEB; --fg:#1C2925; --muted:#55645E; --line:#D2DCD7;
  --primary:#1F7566; --primary-fg:#FFFFFF; --primary-soft:#D5EAE3;
  --warm:#DC7426; --warm-soft:#FBE6D4;
  --danger:#A6412C; --danger-soft:#F7E2DA;
  --limb:#2A3934; --limb-far:#A8B6B0; --prop:#97A6A0; --prop-fill:#DCE5E1;
  --font:"PingFang SC","Noto Sans SC","Hiragino Sans GB","Microsoft YaHei",system-ui,sans-serif;
  --r:20px; --fs:19px; --tab-h:68px;
  color-scheme:light;
}
@media (prefers-color-scheme: dark){:root:not([data-theme="light"]){
  --bg:#0F1613; --surface:#18211E; --surface-2:#22302A; --fg:#E6EEEA; --muted:#A5B5AE; --line:#2E3D38;
  --primary:#5CC0AC; --primary-fg:#0B1915; --primary-soft:#1C3832;
  --warm:#F2A160; --warm-soft:#3A2A1C; --danger:#EA927C; --danger-soft:#3A231D;
  --limb:#E3ECE8; --limb-far:#5D6D67; --prop:#6A7B74; --prop-fill:#283631; color-scheme:dark}}
:root[data-theme="dark"]{
  --bg:#0F1613; --surface:#18211E; --surface-2:#22302A; --fg:#E6EEEA; --muted:#A5B5AE; --line:#2E3D38;
  --primary:#5CC0AC; --primary-fg:#0B1915; --primary-soft:#1C3832;
  --warm:#F2A160; --warm-soft:#3A2A1C; --danger:#EA927C; --danger-soft:#3A231D;
  --limb:#E3ECE8; --limb-far:#5D6D67; --prop:#6A7B74; --prop-fill:#283631; color-scheme:dark}
:root.big{--fs:22px}

*{box-sizing:border-box}
html,body{margin:0}
body{background:var(--bg);color:var(--fg);font-family:var(--font);font-size:var(--fs);line-height:1.85;
  -webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}
h1,h2,h3,p{margin:0}
h1,h2,h3{line-height:1.4;text-wrap:balance}
ul{margin:0;padding:0;list-style:none}
a{color:inherit}
button{font:inherit;color:inherit;cursor:pointer}
:focus-visible{outline:3px solid var(--warm);outline-offset:3px}
img{max-width:100%}
[hidden]{display:none!important}
.num{font-variant-numeric:tabular-nums}

.app{max-width:520px;margin:0 auto;min-height:100vh}
.view{display:flex;flex-direction:column;gap:22px;outline:none;
  padding:calc(env(safe-area-inset-top,0px) + 20px) max(18px,env(safe-area-inset-right,0px)) calc(var(--tab-h) + env(safe-area-inset-bottom,0px) + 32px) max(18px,env(safe-area-inset-left,0px))}
.view.no-tab{padding-bottom:calc(env(safe-area-inset-bottom,0px) + 32px)}

/* tab bar */
.tabbar{position:fixed;left:0;right:0;bottom:0;z-index:20;background:var(--surface);border-top:1px solid var(--line);
  display:grid;grid-template-columns:repeat(4,1fr);padding:0 max(8px,env(safe-area-inset-right,0px)) env(safe-area-inset-bottom,0px) max(8px,env(safe-area-inset-left,0px))}
.tabbar a{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;height:var(--tab-h);
  text-decoration:none;color:var(--muted);font-size:15px;line-height:1.2}
.tabbar svg{width:28px;height:28px;fill:currentColor;stroke:currentColor}
.tabbar a[aria-current="page"]{color:var(--primary);font-weight:700}
@media (min-width:560px){.tabbar{left:50%;right:auto;width:520px;transform:translateX(-50%);border-left:1px solid var(--line);border-right:1px solid var(--line)}}

/* common */
.card{background:var(--surface);border-radius:var(--r);padding:22px;display:flex;flex-direction:column;gap:16px}
.eyebrow{font-size:.8em;color:var(--muted);letter-spacing:.08em}
.title{font-size:1.4em;font-weight:700}
.sub{color:var(--muted);font-size:.88em}
.row{display:flex;align-items:center;gap:14px}
.spread{display:flex;align-items:center;justify-content:space-between;gap:12px}
.btn{display:flex;align-items:center;justify-content:center;gap:8px;border:0;border-radius:16px;min-height:60px;padding:0 20px;
  font-size:1.05em;font-weight:700;background:var(--primary);color:var(--primary-fg);text-decoration:none;width:100%;line-height:1.3}
.btn.ghost{background:var(--surface-2);color:var(--fg)}
.btn.line{background:transparent;border:2px solid var(--line);color:var(--fg)}
.btn.warm{background:var(--warm);color:#fff}
.btn[disabled]{background:var(--primary-soft);color:var(--primary);cursor:default}
.btn.small{min-height:48px;font-size:.92em;border-radius:12px;width:auto}
.link{border:0;background:none;color:var(--primary);font-size:.9em;text-decoration:underline;min-height:44px;padding:0 6px}
.back{display:inline-flex;align-items:center;gap:6px;border:0;background:none;color:var(--muted);font-size:.92em;min-height:44px;padding:0;align-self:flex-start}
.chip{display:inline-block;font-size:.78em;border-radius:999px;padding:2px 12px;background:var(--surface-2);line-height:1.7;white-space:nowrap}
.chip.warm{background:var(--warm-soft)}
.chip.primary{background:var(--primary-soft);color:var(--primary);font-weight:600}
.chip.danger{background:var(--danger-soft);color:var(--danger);font-weight:600}
.brand{display:flex;align-items:center;gap:12px}
.brand b{font-size:1.25em}
.brand small{display:block;color:var(--muted);font-size:.78em;line-height:1.4}

/* level card */
.lv{border:2px solid var(--primary-soft)}
.lv.lv-0{border-color:var(--danger-soft)}
.lv-name{font-size:1.5em;font-weight:800;color:var(--primary);line-height:1.3}
.lv-0 .lv-name{color:var(--danger)}
.lv-1 .lv-name{color:var(--warm)}
.bar{height:16px;border-radius:8px;background:var(--surface-2);overflow:hidden}
.bar i{display:block;height:100%;background:var(--primary);border-radius:8px;transition:width .5s}
.do-dont{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.do-dont>div{background:var(--surface-2);border-radius:14px;padding:12px 14px;min-width:0}
.do-dont h3{font-size:.85em;margin-bottom:4px}
.do-dont li{font-size:.85em;line-height:1.7;padding:3px 0}
.do-dont .no h3{color:var(--danger)}
@media (max-width:360px){.do-dont{grid-template-columns:1fr}}

/* ring */
.ring{flex:none;position:relative;width:84px;height:84px}
.ring svg{transform:rotate(-90deg)}
.ring span{position:absolute;inset:0;display:grid;place-items:center;font-size:1.15em;font-weight:800}

/* move card */
.move{padding:0;overflow:hidden;gap:0}
.stage{background:var(--surface-2);position:relative;border:0;padding:0;width:100%;display:block;cursor:pointer}
.stage svg{display:block;width:100%;height:auto}
.stage .cue{position:absolute;left:12px;top:10px;display:flex;align-items:center;gap:8px;background:var(--surface);border-radius:999px;
  padding:2px 14px 2px 10px;font-size:.88em;font-weight:700;line-height:1.8}
.stage .cue i{width:10px;height:10px;border-radius:50%;background:var(--warm)}
.stage .replay{position:absolute;right:12px;bottom:12px;display:flex;align-items:center;gap:6px;background:var(--surface);border-radius:999px;
  padding:4px 14px 4px 8px;font-size:.8em;color:var(--muted);line-height:1.6}
.stage .replay svg{width:26px;height:26px}
.stage.is-playing .replay{display:none}
.move-body{padding:18px 20px 20px;display:flex;flex-direction:column;gap:14px}
.move-body h3{font-size:1.2em}
.dose{font-size:1.12em;font-weight:800;color:var(--primary)}
.sets{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.dot{width:26px;height:26px;border-radius:50%;border:3px solid var(--primary);display:grid;place-items:center}
.dot.on{background:var(--primary)}
.dot.on::after{content:"";width:9px;height:5px;border:solid var(--primary-fg);border-width:0 0 3px 3px;transform:translateY(-1px) rotate(-45deg)}
details.tips summary{list-style:none;cursor:pointer;color:var(--muted);font-size:.9em;display:flex;align-items:center;gap:6px;min-height:40px}
details.tips summary::-webkit-details-marker{display:none}
details.tips summary::after{content:"";width:8px;height:8px;border:solid currentColor;border-width:0 2px 2px 0;transform:rotate(45deg) translateY(-2px)}
details.tips[open] summary::after{transform:rotate(-135deg)}
details.tips li{font-size:.92em;padding:4px 0 4px 18px;position:relative}
details.tips li::before{content:"";position:absolute;left:2px;top:.85em;width:7px;height:7px;border-radius:50%;background:var(--primary)}
.btn-row{display:grid;grid-template-columns:1fr 1fr;gap:10px}

/* week / calendar */
.week{display:grid;grid-template-columns:repeat(7,1fr);gap:4px;text-align:center}
.wd{display:flex;flex-direction:column;align-items:center;gap:2px;font-size:.75em;color:var(--muted);line-height:1.5}
.wd b{width:40px;height:40px;border-radius:50%;display:grid;place-items:center;font-size:.95em;color:var(--fg);border:2px solid var(--line);font-weight:600}
.wd.done b{background:var(--primary);border-color:var(--primary);color:var(--primary-fg)}
.wd.part b{border-color:var(--primary);background:linear-gradient(to top,var(--primary-soft) 50%,transparent 50%)}
.wd.rest b{border-style:dashed}
.wd.today{color:var(--fg);font-weight:700}
.wd.blank{visibility:hidden}
.key{display:flex;flex-wrap:wrap;gap:2px 16px;font-size:.75em;color:var(--muted)}

/* quiz */
.progress{display:flex;align-items:center;gap:12px;font-size:.85em;color:var(--muted)}
.progress .bar{flex:1;height:10px}
.q{font-size:1.45em;font-weight:800;line-height:1.45}
.qpic{background:var(--surface-2);border-radius:var(--r)}
.qpic svg{display:block;width:100%;height:auto}
.opts{display:flex;flex-direction:column;gap:12px}
.opt{display:flex;align-items:center;gap:14px;border:2px solid var(--line);background:var(--surface);border-radius:16px;min-height:64px;
  padding:10px 18px;font-size:1.05em;text-align:left;line-height:1.5;width:100%}
.opt i{flex:none;width:26px;height:26px;border-radius:50%;border:3px solid var(--line)}
.opt.multi i{border-radius:7px}
.opt[aria-pressed="true"]{border-color:var(--primary);background:var(--primary-soft);font-weight:700}
.opt[aria-pressed="true"] i{border-color:var(--primary);background:var(--primary);box-shadow:inset 0 0 0 4px var(--primary-soft)}

/* learn */
.cats{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.cats button{border:2px solid var(--line);background:var(--surface);border-radius:999px;padding:4px 16px;font-size:.88em;min-height:44px}
.cats button[aria-pressed="true"]{border-color:var(--primary);background:var(--primary);color:var(--primary-fg);font-weight:700}
.alist{display:flex;flex-direction:column;gap:12px}
.aitem{display:flex;flex-direction:column;gap:6px;text-decoration:none;background:var(--surface);border-radius:16px;padding:16px 18px}
.aitem b{font-size:1.05em;line-height:1.5}
.aitem span{font-size:.85em;color:var(--muted);line-height:1.6}
.amain{font-size:1.3em;font-weight:800;line-height:1.6;background:var(--primary-soft);border-radius:var(--r);padding:20px}
.apts li{display:flex;gap:12px;align-items:flex-start;padding:10px 0;border-bottom:1px solid var(--line)}
.apts li:last-child{border-bottom:0}
.apts li em{font-style:normal;flex:none;width:30px;height:30px;border-radius:50%;background:var(--surface-2);display:grid;place-items:center;font-weight:800;font-size:.85em;color:var(--primary);margin-top:3px}
.aact{background:var(--warm-soft);border-radius:16px;padding:16px 18px;font-weight:700}

/* move library */
.mgrid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.mtile{display:flex;flex-direction:column;text-decoration:none;background:var(--surface);border-radius:16px;overflow:hidden}
.mtile .pic{background:var(--surface-2)}
.mtile svg{display:block;width:100%;height:auto}
.mtile div{padding:10px 12px 12px;display:flex;flex-direction:column;gap:2px}
.mtile b{font-size:.95em;line-height:1.4}
.mtile span{font-size:.75em;color:var(--muted)}

/* follow mode */
.follow{position:fixed;inset:0;z-index:40;background:var(--bg);display:flex;flex-direction:column;align-items:center;
  padding:calc(env(safe-area-inset-top,0px) + 16px) max(18px,env(safe-area-inset-right,0px)) calc(env(safe-area-inset-bottom,0px) + 20px) max(18px,env(safe-area-inset-left,0px));overflow-y:auto}
.follow-in{width:100%;max-width:520px;display:flex;flex-direction:column;gap:18px;flex:1}
.follow .stage{border-radius:var(--r);overflow:hidden;cursor:default}
.count{text-align:center;font-size:4.2em;font-weight:900;line-height:1.1;color:var(--primary)}
.count small{font-size:.32em;color:var(--muted);font-weight:600;display:block;line-height:1.6}
.follow .cue-big{text-align:center;font-size:1.5em;font-weight:800;min-height:1.6em}

/* misc */
.safe{background:var(--danger-soft);border-radius:var(--r);padding:16px 18px;font-size:.9em;line-height:1.8}
.safe b{color:var(--danger)}
.tip{background:var(--warm-soft);border-radius:var(--r);padding:18px 20px;display:flex;flex-direction:column;gap:6px;text-decoration:none}
.tip b{font-size:1.05em;line-height:1.6}
.stats{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;text-align:center}
.stats div{background:var(--surface-2);border-radius:14px;padding:12px 6px;display:flex;flex-direction:column;line-height:1.4}
.stats b{font-size:1.6em;font-weight:900}
.stats span{font-size:.75em;color:var(--muted)}
.badges{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.badge{display:flex;flex-direction:column;align-items:center;gap:4px;text-align:center;font-size:.78em;line-height:1.4;padding:10px 4px;border-radius:14px;background:var(--surface-2);color:var(--muted)}
.badge svg{width:46px;height:46px}
.badge.on{color:var(--fg);background:var(--warm-soft)}
.badge b{font-size:1.05em}
.setting{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:56px;border-bottom:1px solid var(--line)}
.setting:last-child{border-bottom:0}
.switch{position:relative;width:62px;height:36px;border-radius:18px;border:0;background:var(--line);flex:none;padding:0}
.switch::after{content:"";position:absolute;left:4px;top:4px;width:28px;height:28px;border-radius:50%;background:#fff;transition:left .2s}
.switch[aria-checked="true"]{background:var(--primary)}
.switch[aria-checked="true"]::after{left:30px}
.setting input[type=time]{font:inherit;font-size:.95em;border:2px solid var(--line);border-radius:12px;padding:4px 10px;background:var(--surface);color:var(--fg)}
.banner{background:var(--warm);color:#fff;border-radius:var(--r);padding:14px 18px;font-weight:700;display:flex;align-items:center;justify-content:space-between;gap:12px}
.banner a{color:#fff}
.history li{display:flex;justify-content:space-between;gap:10px;padding:8px 0;border-bottom:1px solid var(--line);font-size:.9em}
.history li:last-child{border-bottom:0}

/* celebration overlay */
.overlay{position:fixed;inset:0;z-index:50;background:rgb(10 20 16 / .72);display:flex;justify-content:center;overflow-y:auto;
  padding:calc(env(safe-area-inset-top,0px) + 16px) max(16px,env(safe-area-inset-right,0px)) calc(env(safe-area-inset-bottom,0px) + 16px) max(16px,env(safe-area-inset-left,0px))}
.celebrate{width:100%;max-width:460px;display:flex;flex-direction:column;gap:14px;align-items:stretch;margin:auto 0}
.celebrate h2{color:#fff;text-align:center;font-size:1.5em}
.celebrate p.hint{color:#e8efe9;text-align:center;font-size:.85em}
.poster-wrap{position:relative;border-radius:16px;overflow:hidden;background:#ddd;aspect-ratio:2/3;width:min(100%,56vh);align-self:center}
.poster-wrap img{display:block;width:100%;height:100%;object-fit:cover}
.celebrate .btn.ghost{background:rgb(255 255 255 / .16);color:#fff}
.confetti{position:fixed;inset:0;pointer-events:none;z-index:60}

.toast{position:fixed;left:50%;top:calc(env(safe-area-inset-top,0px) + 16px);transform:translateX(-50%);z-index:70;
  background:var(--fg);color:var(--bg);border-radius:999px;padding:10px 22px;font-size:.92em;font-weight:600;max-width:calc(100% - 32px);text-align:center;line-height:1.5}

/* figure strokes */
.fig line{stroke-linecap:round}
.fig .limb{stroke:var(--limb);stroke-width:6}
.fig .far{stroke:var(--limb-far);stroke-width:6}
.fig .work{stroke:var(--warm)}
.fig .glow{stroke:var(--warm);opacity:.22}
.fig .head{fill:var(--limb)}
.fig .pr{stroke:var(--prop);stroke-width:4;fill:none;stroke-linecap:round}
.fig .pr-fill{fill:var(--prop-fill)}
.fig .pr-box{fill:var(--prop-fill);stroke:var(--prop);stroke-width:3}
.fig .pr-towel{fill:var(--warm-soft);stroke:var(--prop);stroke-width:2}
.fig .pr-floor{stroke:var(--prop);stroke-width:3}
.fig .hatch{stroke:var(--prop);stroke-width:2}
.qpic .ill{stroke:var(--limb);stroke-width:5;fill:none;stroke-linecap:round;stroke-linejoin:round}
.qpic .ill-hot{stroke:var(--warm);fill:none;stroke-width:5;stroke-linecap:round}
.qpic .ill-fill{fill:var(--limb)}
.qpic .ill-soft{fill:var(--prop-fill);stroke:var(--prop);stroke-width:3}

@media (prefers-reduced-motion: reduce){.bar i,.switch::after{transition:none}}
