:root{
  --bg:#0d1015; --surface:#151a21; --surface2:#1c232d; --line:#283140; --text:#e9eef4; --muted:#8a95a7;
  --accent:#22d3a6; --accent-ink:#04261d;
  --locked:#ff5a5f; --amber:#ffb020; --fatigue:#ff8a3d; --fatigue-bg:#3a2a20; --ready:#22d3a6;
  --fresh:#3a4453; --sil:#1f2732; --sil-line:#2c3644; --head:#1f2732;
  --primary-hl:#ff5a5f; --secondary-hl:#ffb020; --under:#5b8def; --heat:#a08cff; --attn:#b57bff; --attn-line:#efe2ff; --ontrack:#4c5a6b; --injured:#8f98a6; --inj-bg:#2b3240;
  --radius:16px; --tab-h:64px;
  --font-d:'Barlow Condensed', system-ui, sans-serif; --font:'Inter', system-ui, sans-serif;
  color-scheme:dark;
}
:root[data-theme="light"]{
  --bg:#f3f5f8; --surface:#ffffff; --surface2:#eef1f5; --line:#dde3ea; --text:#141a22; --muted:#5d6878;
  --accent:#0fae86; --accent-ink:#ffffff;
  --fatigue-bg:#ffe6d4; --fresh:#c9d1dc; --sil:#e4e9ef; --sil-line:#cfd7e1; --head:#e4e9ef; --under:#3b6fd8; --heat:#6a52e0; --attn:#8a4fe0; --attn-line:#2b1450; --ontrack:#aeb9c6; --injured:#6b7480; --inj-bg:#dfe4ea;
  color-scheme:light;
}
@media (prefers-color-scheme: light){
  :root:not([data-theme="dark"]):not([data-theme="light"]).auto{
    --bg:#f3f5f8; --surface:#ffffff; --surface2:#eef1f5; --line:#dde3ea; --text:#141a22; --muted:#5d6878;
    --accent:#0fae86; --accent-ink:#ffffff;
    --fatigue-bg:#ffe6d4; --fresh:#c9d1dc; --sil:#e4e9ef; --sil-line:#cfd7e1; --head:#e4e9ef; --under:#3b6fd8; --heat:#6a52e0; --attn:#8a4fe0; --attn-line:#2b1450; --ontrack:#aeb9c6; --injured:#6b7480; --inj-bg:#dfe4ea;
    color-scheme:light;
  }
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;background:var(--bg);color:var(--text);font:15px/1.45 var(--font)}
body{min-height:100dvh;overscroll-behavior-y:none}
button,input,select,textarea{font:inherit;color:inherit}
h1,h2,h3{font-family:var(--font-d);font-weight:700;letter-spacing:.3px;margin:0}
h1{font-size:28px} h2{font-size:22px} h3{font-size:18px}
.muted{color:var(--muted)} .small{font-size:13px} .num{font-family:var(--font-d);font-variant-numeric:tabular-nums}
[hidden]{display:none!important}

/* ---------- top & tabs ---------- */
.topbar{position:sticky;top:0;z-index:20;display:flex;align-items:center;justify-content:space-between;
  padding:calc(10px + env(safe-area-inset-top)) 16px 10px;background:color-mix(in srgb,var(--bg) 88%,transparent);backdrop-filter:blur(10px)}
.brand{font-family:var(--font-d);font-size:22px;font-weight:600;display:flex;align-items:center;gap:8px;letter-spacing:.5px}
.brand b{color:var(--accent);font-weight:700}
.brand-mark{width:14px;height:14px;border-radius:4px;background:linear-gradient(135deg,var(--accent),var(--amber) 60%,var(--locked));transform:rotate(45deg)}
.top-actions{display:flex;align-items:center;gap:10px}
.sync-dot{width:9px;height:9px;border-radius:50%;background:var(--ready)}
.sync-dot.pending{background:var(--amber)} .sync-dot.offline{background:var(--muted)}
#view{padding:4px 16px calc(var(--tab-h) + 28px + env(safe-area-inset-bottom));max-width:1100px;margin:0 auto}
.tabbar{position:fixed;left:0;right:0;bottom:0;z-index:30;height:calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom:env(safe-area-inset-bottom);display:grid;grid-template-columns:repeat(5,1fr);align-items:center;
  background:color-mix(in srgb,var(--surface) 94%,transparent);backdrop-filter:blur(12px);border-top:1px solid var(--line)}
.tab{background:none;border:0;display:flex;flex-direction:column;align-items:center;gap:2px;font-size:11px;color:var(--muted);min-height:48px;cursor:pointer}
.tab svg{width:22px;height:22px;fill:currentColor;stroke:currentColor}
.tab.active{color:var(--accent)}
.tab-go .go{width:56px;height:56px;margin-top:-22px;border-radius:50%;display:grid;place-items:center;background:var(--accent);color:var(--accent-ink);
  box-shadow:0 6px 20px color-mix(in srgb,var(--accent) 45%,transparent)}
.tab-go .go svg{width:26px;height:26px}
.tab-go.live .go{background:var(--locked);color:#fff;animation:pulse 1.6s infinite}
@keyframes pulse{50%{box-shadow:0 0 0 10px color-mix(in srgb,var(--locked) 0%,transparent),0 6px 20px color-mix(in srgb,var(--locked) 45%,transparent)}}

/* ---------- generic UI ---------- */
.tabbar{grid-template-columns:repeat(4,1fr)}
.tab.has-live span::after{content:" •";color:var(--amber)}
.gear{width:40px;height:40px;color:var(--muted)} .gear.on{color:var(--accent);border-color:var(--accent)}

.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:14px}
.row{display:flex;align-items:center;gap:10px} .row.wrap{flex-wrap:wrap} .grow{flex:1;min-width:0}
.between{justify-content:space-between}
.stack>*+*{margin-top:12px}
.btn{border:1px solid var(--line);background:var(--surface2);border-radius:12px;padding:10px 14px;min-height:44px;cursor:pointer;font-weight:600}
.btn.primary{background:var(--accent);border-color:var(--accent);color:var(--accent-ink)}
.btn.danger{color:var(--locked);border-color:color-mix(in srgb,var(--locked) 40%,var(--line))}
.btn.ghost{background:transparent}
.btn.block{width:100%} .btn.sm{min-height:36px;padding:6px 12px;font-size:13px}
.btn:disabled{opacity:.5}
.icon-btn{width:44px;height:44px;border-radius:12px;border:1px solid var(--line);background:var(--surface2);display:grid;place-items:center;cursor:pointer;font-size:20px;line-height:1}
.pill{border:1px solid var(--line);background:var(--surface2);border-radius:999px;padding:6px 12px;font-size:13px;cursor:pointer;white-space:nowrap}
.pill.on{background:color-mix(in srgb,var(--accent) 18%,var(--surface2));border-color:var(--accent);color:var(--accent)}
.pill.live{background:var(--locked);border-color:var(--locked);color:#fff;font-weight:600}
.chips{display:flex;gap:8px;overflow-x:auto;padding-bottom:4px;scrollbar-width:none} .chips::-webkit-scrollbar{display:none}
.chips.wrap{flex-wrap:wrap;overflow:visible}
.seg{display:inline-flex;background:var(--surface2);border:1px solid var(--line);border-radius:12px;padding:3px}
.seg button{border:0;background:none;padding:7px 12px;border-radius:9px;font-size:13px;font-weight:600;color:var(--muted);cursor:pointer;min-height:36px}
.seg button.on{background:var(--surface);color:var(--text);box-shadow:0 1px 3px rgba(0,0,0,.25)}
input[type=text],input[type=number],input[type=password],input[type=search],input[type=datetime-local],select,textarea{
  width:100%;background:var(--surface2);border:1px solid var(--line);border-radius:12px;padding:10px 12px;min-height:44px;outline:none}
input:focus,select:focus,textarea:focus{border-color:var(--accent)}
textarea{min-height:80px;resize:vertical}
label.f{display:block;font-size:13px;color:var(--muted);margin:0 0 6px}
.section-title{display:flex;align-items:center;justify-content:space-between;margin:18px 0 10px}
.empty{text-align:center;color:var(--muted);padding:32px 12px}
.tag{display:inline-block;font-size:11px;padding:2px 8px;border-radius:999px;background:var(--surface2);border:1px solid var(--line);color:var(--muted)}
.tag.p{color:var(--primary-hl);border-color:color-mix(in srgb,var(--primary-hl) 45%,var(--line))}
.tag.s{color:var(--secondary-hl);border-color:color-mix(in srgb,var(--secondary-hl) 45%,var(--line))}
.stress{display:inline-flex;gap:3px;vertical-align:middle}
.stress i{width:7px;height:14px;border-radius:2px;background:var(--line)}
.stress i.on{background:linear-gradient(var(--amber),var(--locked))}

/* ---------- body map ---------- */
.body-head{display:flex;flex-wrap:wrap;gap:10px;align-items:center;justify-content:space-between;margin:6px 0 4px}
.stage{position:relative;touch-action:pan-y;user-select:none;-webkit-user-select:none}
.stage-inner{display:flex;justify-content:center;gap:4%;transform-origin:center top;transition:transform .2s}
.figure{position:relative;width:min(100%,360px);perspective:900px}
.figure .flip{transition:transform .5s cubic-bezier(.3,.7,.3,1);transform-style:preserve-3d}
.figure .label{position:absolute;top:6px;left:8px;font-family:var(--font-d);font-size:13px;letter-spacing:1px;color:var(--muted);text-transform:uppercase}
svg.body{width:100%;height:auto;display:block;overflow:visible}
svg.body .sil{fill:var(--sil);stroke:var(--sil-line);stroke-width:1}
svg.body .head{fill:var(--head);stroke:var(--sil-line);stroke-width:1}
svg.body .m{fill:var(--fresh);stroke:var(--bg);stroke-width:.7;stroke-linejoin:round;transition:fill .35s,opacity .2s,filter .2s;cursor:pointer}
svg.body .det{fill:none;stroke:var(--bg);stroke-width:.7;opacity:.55;pointer-events:none}
svg.body .m.sel{stroke:var(--text);stroke-width:1.4;filter:drop-shadow(0 0 4px color-mix(in srgb,var(--text) 60%,transparent))}
svg.body .m.dim{opacity:.35}
.stripe-bg{fill:var(--fatigue-bg)} .stripe-fg{fill:var(--fatigue)}
.both .figure{width:min(48%,340px)}
.zoom-ctl{position:absolute;right:0;top:0;display:flex;flex-direction:column;gap:6px;z-index:2}
.legend{display:flex;flex-wrap:wrap;gap:12px;font-size:12px;color:var(--muted);justify-content:center;margin:6px 0}
.legend span{display:inline-flex;align-items:center;gap:6px}
.legend i{width:12px;height:12px;border-radius:3px;display:inline-block}
.lg-locked{background:linear-gradient(90deg,var(--locked),var(--amber))} .lg-fat{background:repeating-linear-gradient(45deg,var(--fatigue) 0 3px,var(--fatigue-bg) 3px 6px)}
.lg-ready{background:var(--ready)} .lg-fresh{background:var(--fresh)}
.timeline{margin:6px 0 2px}
.timeline .row{font-size:13px}
input[type=range]{width:100%;accent-color:var(--accent);height:32px}
.tl-label{font-family:var(--font-d);font-size:18px;font-weight:600}
.ready-strip{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-top:10px}
.stat{background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:10px;text-align:center}
.stat b{display:block;font-family:var(--font-d);font-size:26px;line-height:1.1}
.stat span{font-size:12px;color:var(--muted)}
.stat.locked b{color:var(--locked)} .stat.fat b{color:var(--fatigue)} .stat.ready b{color:var(--ready)}
.mlist{display:flex;flex-direction:column;gap:8px}
.mrow{display:flex;align-items:center;gap:10px;padding:10px 12px;background:var(--surface);border:1px solid var(--line);border-radius:12px;cursor:pointer}
.mrow .dot{width:12px;height:12px;border-radius:4px;flex:none}
.mrow .bar{height:5px;border-radius:3px;background:var(--line);overflow:hidden;margin-top:5px}
.mrow .bar i{display:block;height:100%;background:linear-gradient(90deg,var(--locked),var(--amber))}
.mrow .bar.s i{background:var(--fatigue)}

/* ---------- library ---------- */
.lib-tools{position:sticky;top:calc(52px + env(safe-area-inset-top));z-index:10;background:var(--bg);padding:6px 0 8px}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:10px}
.ex-card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:10px;cursor:pointer;display:flex;flex-direction:column;gap:6px;min-height:230px;transition:transform .15s,border-color .15s}
.ex-card:active{transform:scale(.98)} .ex-card:hover{border-color:color-mix(in srgb,var(--accent) 50%,var(--line))}
.ex-card .thumbs{display:flex;justify-content:center;gap:4px;height:130px}
.ex-card .thumbs svg{height:100%;width:auto}
.ex-card h4{margin:0;font-size:14px;line-height:1.25;font-weight:600}
.ex-card .meta{display:flex;align-items:center;justify-content:space-between;gap:6px;margin-top:auto}
.ex-card .tagrow{display:flex;gap:4px;flex-wrap:wrap}
.thumbs svg .m{cursor:inherit}
.custom-badge{font-size:10px;color:var(--accent);font-weight:700;letter-spacing:.5px}

/* ---------- sheet ---------- */
.sheet-wrap{position:fixed;inset:0;z-index:50}
.sheet-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.5);opacity:0;transition:opacity .25s}
.sheet{position:absolute;left:0;right:0;bottom:0;max-height:92dvh;background:var(--surface);border-radius:22px 22px 0 0;border:1px solid var(--line);
  transform:translateY(100%);transition:transform .3s cubic-bezier(.2,.8,.2,1);display:flex;flex-direction:column;max-width:760px;margin:0 auto}
.sheet-wrap.open .sheet{transform:none} .sheet-wrap.open .sheet-backdrop{opacity:1}
.sheet-grip{padding:10px 0 6px;cursor:grab;touch-action:none}
.sheet-grip::before{content:"";display:block;width:44px;height:5px;border-radius:3px;background:var(--line);margin:0 auto}
.sheet-body{overflow-y:auto;padding:4px 16px calc(20px + env(safe-area-inset-bottom));overscroll-behavior:contain}
.sheet-head{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;margin-bottom:10px}
.detail-bodies{display:flex;gap:6px;justify-content:center;max-width:420px;margin:0 auto}
.detail-bodies>div{flex:1}
.cue-list{margin:6px 0 0;padding-left:18px} .cue-list li{margin:4px 0}
.status-box{border-radius:14px;padding:12px;background:var(--surface2);border:1px solid var(--line)}

/* ---------- session ---------- */
.sess-head{display:flex;align-items:center;justify-content:space-between;margin:8px 0 12px}
.timer-big{font-family:var(--font-d);font-size:34px;font-weight:700;font-variant-numeric:tabular-nums}
.ex-block{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:12px;margin-bottom:12px}
.ex-block-head{display:flex;align-items:center;gap:8px;margin-bottom:8px}
.set-grid{display:grid;grid-template-columns:24px 1fr 1fr 44px 48px;gap:7px;align-items:center}
.set-grid .h{font-size:11px;color:var(--muted);text-transform:uppercase;letter-spacing:.6px}
.set-grid input{text-align:center;font-family:var(--font-d);font-size:20px;padding:6px;min-height:48px}
.set-no{font-family:var(--font-d);font-size:18px;color:var(--muted);text-align:center}
.tick{width:52px;height:48px;border-radius:12px;border:1px solid var(--line);background:var(--surface2);font-size:20px;cursor:pointer}
.tick.done{background:var(--accent);border-color:var(--accent);color:var(--accent-ink)}
.prev{font-size:12px;color:var(--muted)}
body.resting #view{padding-bottom:calc(var(--tab-h) + 130px + env(safe-area-inset-bottom))}
.rest-bar{position:fixed;left:12px;right:12px;bottom:calc(var(--tab-h) + 12px + env(safe-area-inset-bottom));z-index:35;max-width:520px;margin:0 auto;
  background:var(--surface2);border:1px solid var(--accent);border-radius:16px;padding:10px 14px;display:flex;align-items:center;gap:12px;box-shadow:0 10px 30px rgba(0,0,0,.4)}
.rest-bar .timer-big{font-size:30px;min-width:84px}
.rest-bar .prog{flex:1;height:6px;background:var(--line);border-radius:3px;overflow:hidden}
.rest-bar .prog i{display:block;height:100%;background:var(--accent);transition:width 1s linear}
.review-row{display:grid;grid-template-columns:1fr auto;gap:8px;align-items:center;padding:10px 0;border-bottom:1px solid var(--line)}
.stepper{display:inline-flex;align-items:center;gap:6px}
.stepper button{width:38px;height:38px;border-radius:10px;border:1px solid var(--line);background:var(--surface2);font-size:18px;cursor:pointer}
.stepper .v{min-width:58px;text-align:center;font-family:var(--font-d);font-size:20px;font-weight:600}

/* ---------- calendar ---------- */
.cal{display:grid;grid-template-columns:repeat(7,1fr);gap:4px;text-align:center}
.cal .dow{font-size:11px;color:var(--muted);padding:4px 0}
.cal .d{aspect-ratio:1;border-radius:10px;display:flex;flex-direction:column;align-items:center;justify-content:center;font-size:14px;cursor:pointer;border:1px solid transparent}
.cal .d.other{opacity:.3} .cal .d.today{border-color:var(--accent)}
.cal .d.has{background:color-mix(in srgb,var(--accent) 16%,var(--surface))}
.cal .d.has::after{content:"";width:5px;height:5px;border-radius:50%;background:var(--accent);margin-top:2px}
.cal .d.sel{background:var(--accent);color:var(--accent-ink)}

/* ---------- lock & toast ---------- */
.lock{position:fixed;inset:0;display:grid;place-items:center;padding:24px;background:radial-gradient(circle at 50% 20%,color-mix(in srgb,var(--accent) 14%,var(--bg)),var(--bg) 60%)}
.lock-card{width:100%;max-width:340px;text-align:center}
.lock-card .brand{justify-content:center;font-size:32px;margin-bottom:8px}
.lock-card input{text-align:center;font-family:var(--font-d);font-size:30px;letter-spacing:10px;margin:8px 0 12px;min-height:58px}
.lock-msg{min-height:22px;color:var(--locked);font-size:14px}
.lock-card.shake{animation:shake .4s}
@keyframes shake{25%{transform:translateX(-8px)}50%{transform:translateX(8px)}75%{transform:translateX(-4px)}}
.toast{position:fixed;left:50%;bottom:calc(var(--tab-h) + 20px + env(safe-area-inset-bottom));transform:translate(-50%,20px);opacity:0;z-index:60;
  background:var(--text);color:var(--bg);padding:10px 16px;border-radius:12px;font-weight:600;font-size:14px;transition:.25s;pointer-events:none;max-width:90vw}
.toast.show{opacity:1;transform:translate(-50%,0)}
.settings-group{margin-bottom:16px}
.settings-group h3{margin-bottom:8px}
.kv{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 0;border-bottom:1px solid var(--line)}
.kv:last-child{border-bottom:0}
.check{display:flex;align-items:center;gap:10px;padding:8px 0;cursor:pointer}
.check input{width:22px;height:22px;accent-color:var(--accent)}
.list-item{display:flex;align-items:center;gap:10px;padding:12px;background:var(--surface);border:1px solid var(--line);border-radius:14px;margin-bottom:8px;cursor:pointer}

@media (min-width:760px){
  .sheet{bottom:auto;top:50%;transform:translateY(-40%) scale(.97);opacity:0;border-radius:22px;max-height:86dvh;transition:transform .25s,opacity .25s}
  .sheet-wrap.open .sheet{transform:translateY(-50%);opacity:1}
  .sheet-grip{display:none}
  .sheet-body{padding-top:18px}
}
@media (prefers-reduced-motion: reduce){ *{animation:none!important;transition:none!important} }

/* ---------- phase 2 ---------- */
.eff{width:44px;height:48px;border-radius:12px;border:1px solid var(--line);background:var(--surface2);font-family:var(--font-d);font-size:18px;font-weight:700;cursor:pointer;color:var(--muted)}
.eff-e{color:var(--ready);border-color:color-mix(in srgb,var(--ready) 50%,var(--line))}
.eff-h{color:var(--amber);border-color:color-mix(in srgb,var(--amber) 50%,var(--line))}
.eff-f{color:#fff;background:var(--locked);border-color:var(--locked)}
.prev.tgt{color:var(--text);margin-top:2px}
.vbar{position:relative;height:8px;border-radius:4px;background:var(--surface2);margin-top:6px;overflow:hidden}
.vbar .zone{position:absolute;top:0;bottom:0;background:color-mix(in srgb,var(--ready) 22%,transparent);border-left:1px solid var(--ready);border-right:1px solid var(--ready)}
.vbar i{position:relative;display:block;height:100%;border-radius:4px;opacity:.9}
.insight{background:var(--surface);border:1px solid var(--line);border-left:4px solid var(--amber);border-radius:12px;padding:10px 12px;margin-bottom:8px}
.chart{position:relative}
.chart svg{width:100%;height:auto;display:block;touch-action:pan-y}
.ch-grid{stroke:var(--line);stroke-width:1}
.ch-ax{fill:var(--muted);font-size:10px;font-family:var(--font)}
.ch-line{fill:none;stroke:var(--accent);stroke-width:2;stroke-linejoin:round;stroke-linecap:round}
.ch-dot{fill:var(--accent);stroke:var(--surface);stroke-width:2}
.ch-dot.best{fill:var(--amber)}
.ch-dot.hot{r:6}
.ch-cross{stroke:var(--muted);stroke-width:1;stroke-dasharray:3 3}
.ch-tip{position:absolute;top:0;width:110px;background:var(--surface2);border:1px solid var(--line);border-radius:10px;padding:6px 8px;font-size:12px;pointer-events:none;box-shadow:0 4px 14px rgba(0,0,0,.25)}
.ch-tip span{color:var(--muted)}

/* ---------- phase 3: unified status ---------- */
.inj-bg{fill:var(--inj-bg)} .inj-fg{stroke:var(--injured);stroke-width:1.2}
svg.body .m[data-st="attention"]{stroke:var(--attn-line);stroke-width:1.2;stroke-dasharray:2.2 1.6}
svg.body .m[data-st="ontrack"]{opacity:.8}
.lg-st{border-radius:3px}
.lg-rest{background:linear-gradient(90deg,var(--locked),var(--amber))}
.lg-light{background:repeating-linear-gradient(45deg,var(--fatigue) 0 3px,var(--fatigue-bg) 3px 6px)}
.lg-train{background:var(--ready)} .lg-ontrack{background:var(--ontrack)}
.lg-attention{background:var(--attn);outline:1.5px dashed var(--attn-line);outline-offset:-3px}
.lg-injured{background:repeating-linear-gradient(45deg,var(--injured) 0 1.5px,var(--inj-bg) 1.5px 4px),repeating-linear-gradient(-45deg,var(--injured) 0 1.5px,transparent 1.5px 4px)}
.summary-line{margin:4px 0 10px;padding:10px 12px;background:var(--surface);border:1px solid var(--line);border-radius:12px;font-size:14px;line-height:1.5}
.c-rest{color:var(--locked)} .c-train{color:var(--ready)} .c-attn{color:var(--attn)}
.st-pill-train{border-color:var(--ready)}
.st-chip{display:inline-flex;align-items:center;gap:6px;padding:5px 12px;border-radius:999px;font-weight:700;font-size:14px;border:1.5px solid}
.st-chip i{font-style:normal;font-size:12px}
.st-rest{color:var(--locked);border-color:var(--locked);background:color-mix(in srgb,var(--locked) 12%,transparent)}
.st-light{color:var(--fatigue);border-color:var(--fatigue);background:repeating-linear-gradient(45deg,color-mix(in srgb,var(--fatigue) 14%,transparent) 0 4px,transparent 4px 8px)}
.st-train{color:var(--ready);border-color:var(--ready);background:color-mix(in srgb,var(--ready) 12%,transparent)}
.st-attention{color:var(--attn);border-color:var(--attn);border-style:dashed;background:color-mix(in srgb,var(--attn) 12%,transparent)}
.st-ontrack{color:var(--muted);border-color:var(--ontrack)}
.st-injured{color:var(--injured);border-color:var(--injured);background:repeating-linear-gradient(45deg,color-mix(in srgb,var(--injured) 18%,transparent) 0 2px,transparent 2px 6px)}
.status-hero{border-radius:16px;padding:12px 14px;background:var(--surface2);border:1px solid var(--line);border-left-width:5px}
.status-hero p{margin:8px 0 0}
.st-border-rest{border-left-color:var(--locked)} .st-border-light{border-left-color:var(--fatigue)} .st-border-train{border-left-color:var(--ready)}
.st-border-attention{border-left-color:var(--attn)} .st-border-ontrack{border-left-color:var(--ontrack)} .st-border-injured{border-left-color:var(--injured)}
.seg-full{display:flex} .seg-full button{flex:1}
.closeup{display:flex;gap:8px;justify-content:center;margin:12px 0 0}
.closeup>div{flex:1;max-width:220px;background:var(--surface2);border-radius:14px;padding:6px}
.closeup svg{height:190px;width:100%;overflow:hidden}
.closeup>div{overflow:hidden}
.rec-card{margin-top:12px}
.ring{width:84px;height:84px;flex:none}
.ring-bg{fill:none;stroke:var(--surface2);stroke-width:8}
.ring-fg{fill:none;stroke-width:8;stroke-linecap:round;transform:rotate(-90deg);transform-origin:42px 42px;transition:stroke-dasharray .5s}
.ring-v{fill:var(--text);font-family:var(--font-d);font-size:20px;font-weight:700;text-anchor:middle}
.ring-l{fill:var(--muted);font-size:9px;text-anchor:middle}
.forecast{display:grid;grid-template-columns:repeat(8,1fr);gap:4px}
.fc-day{display:flex;flex-direction:column;align-items:center;gap:3px}
.fc-cell{width:100%;aspect-ratio:1;max-width:38px;border-radius:9px;display:grid;place-items:center;font-size:12px;color:#fff;font-weight:700}
.fc-l{font-size:10px;color:var(--muted)}
.st-bg-light{background:repeating-linear-gradient(45deg,var(--fatigue) 0 3px,var(--fatigue-bg) 3px 6px)}
.st-bg-train{background:var(--ready);color:var(--accent-ink)} .st-bg-ontrack{background:var(--ontrack)}
.st-bg-attention{background:var(--attn);outline:1.5px dashed var(--attn-line);outline-offset:-4px}
.st-bg-injured{background:var(--injured)}
.cal30-wrap{display:grid;grid-template-columns:repeat(15,1fr);gap:4px}
.cal30{aspect-ratio:1;border-radius:4px;background:var(--surface2);border:1px solid var(--line);width:100%;min-width:12px;height:auto}
.legend .cal30{width:12px;height:12px;min-width:12px}
.cal30.p{background:var(--accent);border-color:var(--accent)}
.cal30.s{background:repeating-linear-gradient(45deg,var(--accent) 0 2px,transparent 2px 5px);border-color:var(--accent)}
.balbar{height:8px;border-radius:4px;background:var(--surface2);overflow:hidden;margin-top:6px;position:relative}
.balbar i{display:block;height:100%;background:var(--muted);border-right:2px solid var(--surface)}
.more-box{background:var(--surface2);border:1px solid var(--line);border-radius:12px;padding:10px 12px;margin-top:12px}
.more-box summary{cursor:pointer;font-weight:600}
.more-box p{margin:10px 0 0}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.grid2 .stat b{font-size:22px;margin:2px 0}
.bmi-bar{position:relative;height:12px;border-radius:6px;overflow:hidden;background:var(--surface2);margin-top:6px}
.bmi-seg{position:absolute;top:0;bottom:0;border-right:2px solid var(--surface)}
.bmi-0{background:var(--under)} .bmi-1{background:var(--ready)} .bmi-2{background:var(--amber)} .bmi-3{background:var(--locked)}
.bmi-mark{position:absolute;top:-3px;bottom:-3px;width:4px;margin-left:-2px;background:var(--text);border-radius:2px;box-shadow:0 0 0 2px var(--surface)}
.bmi-ticks{position:relative;height:16px}
.bmi-ticks span{position:absolute;transform:translateX(-50%);top:2px}
.bmi-tag-0{color:var(--under);border-color:var(--under)} .bmi-tag-1{color:var(--ready);border-color:var(--ready)}
.bmi-tag-2{color:var(--amber);border-color:var(--amber)} .bmi-tag-3{color:var(--locked);border-color:var(--locked)}
.mdet{display:block} .mdet summary{list-style:none;cursor:pointer} .mdet summary::-webkit-details-marker{display:none}
.ch-ref{stroke:var(--muted);stroke-width:1.5;stroke-dasharray:5 4}
.intro-legend{display:flex;flex-direction:column;gap:8px;margin:12px 0}
.intro-legend>div{display:flex;align-items:center;gap:10px}
.intro-legend .st-chip{min-width:150px}

/* ---------- undo toast, notes ---------- */
.toast.act{pointer-events:auto;display:flex;align-items:center;gap:12px}
.toast-btn{background:none;border:0;color:var(--accent);font-weight:700;cursor:pointer;padding:4px 2px;font-size:14px}
:root[data-theme="light"] .toast-btn{color:#7cf0cf}
.note-card{margin-top:10px;padding:10px 12px;border-radius:12px;background:var(--surface2);border:1px dashed var(--line)}
.note-text{margin:6px 0 0;white-space:pre-wrap}
