/* Neck Flow: a bright, calm studio. Soft off-white canvas, white surfaces
   that step instead of outlining, one teal primary action, and colour only
   where state must be read at a glance. */
:root{
 --canvas:#eef1ef;--surface:#ffffff;--raised:#f3f5f3;--active:#e2ece8;--border:#dfe5e2;
 --text:#14211e;--body:#3b4945;--muted:#6c7975;--faint:#a3ada9;
 --accent:#1f7f71;--accent-hover:#196b5f;--hold:#2d8fd6;--done:#2fa36b;
 --r-control:12px;--r-card:18px;
 font-family:"Segoe UI","Microsoft YaHei UI","PingFang SC","Microsoft YaHei",system-ui,sans-serif;
 color:var(--text);background:var(--canvas);font-synthesis:none;-webkit-font-smoothing:antialiased;
 color-scheme:light;
}
*{box-sizing:border-box}
html,body{margin:0;height:100%;background:var(--canvas)}
button{font:inherit;color:inherit;border:0;background:none;cursor:pointer;-webkit-tap-highlight-color:transparent}
button:disabled{cursor:default;opacity:.45}
:focus-visible{outline:2px solid var(--hold);outline-offset:3px}
[hidden]{display:none!important}
svg{display:block}

/* Layout: the figure is the largest object, the panel sits beside it. */
.app{display:grid;grid-template-columns:minmax(0,1fr) 400px;gap:16px;height:100vh;height:100dvh;padding:28px}
.stage{position:relative;border-radius:var(--r-card);overflow:hidden;background:#e7ebe9;box-shadow:0 1px 2px rgba(20,33,30,.05),0 8px 28px rgba(20,33,30,.06);isolation:isolate;min-height:0}
#model-container{position:absolute;inset:0}
canvas{display:block;width:100%;height:100%;touch-action:none}
#model-loading{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;color:var(--muted);font-size:15px;text-align:center;padding:24px}

.stage-tools{position:absolute;top:14px;right:14px;display:flex;gap:8px}
.tool{height:40px;padding:0 12px 0 10px;display:flex;align-items:center;gap:6px;font-size:13px;border-radius:var(--r-control);background:rgba(255,255,255,.78);box-shadow:0 1px 3px rgba(20,33,30,.08);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);color:var(--body)}
.tool svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.tool[aria-pressed=true]{background:var(--accent);color:#fff}
.chip{height:36px;padding:0 16px;border-radius:999px;background:var(--accent);color:#fff;font-size:14px}

/* One bar per exercise, filled as the session moves through it. */
.strip{position:absolute;left:16px;right:16px;bottom:16px;display:flex;gap:4px;align-items:center}
.strip span{flex:var(--w) 1 0;height:4px;border-radius:2px;background:rgba(20,33,30,.12);overflow:hidden}
.strip span i{display:block;height:100%;width:calc(var(--p,0)*100%);background:var(--accent);border-radius:inherit}

.panel{display:flex;flex-direction:column;min-height:0;background:var(--surface);border-radius:var(--r-card);box-shadow:0 1px 2px rgba(20,33,30,.05),0 8px 28px rgba(20,33,30,.06)}
.view{flex:1;min-height:0;overflow:auto;padding:24px 24px 8px;scrollbar-width:thin;scrollbar-color:var(--active) transparent}
.brand{display:flex;align-items:center;gap:10px;font-size:17px;margin:0 0 10px}
.need{margin:6px 0 0;font-size:14px;color:var(--muted)}
.brand img{border-radius:8px}
.section{font-size:13px;font-weight:600;color:var(--muted);margin:24px 0 8px}


/* Moves: one row each, in session order. */
.moves{list-style:none;margin:0;padding:0;display:grid;gap:2px}
.move{width:100%;display:grid;grid-template-columns:40px 1fr;align-items:center;gap:12px;text-align:left;padding:10px 12px 10px 8px;border-radius:var(--r-control);min-height:56px}
.move:hover{background:var(--raised)}
.move[aria-pressed=true] strong{color:var(--accent)}
.move[aria-pressed=true]{background:var(--active)}
.move .glyph{width:40px;height:40px;border-radius:10px;background:var(--raised);display:grid;place-items:center;color:var(--body)}
.move[aria-pressed=true] .glyph{background:var(--accent);color:#fff}
.move .glyph svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
.move strong{display:block;font-size:15px;font-weight:600}
.move small{display:block;font-size:13px;color:var(--muted);margin-top:2px}
.move time{font-size:14px;color:var(--muted);font-variant-numeric:tabular-nums}

/* Session: what to do now, how far along, one instruction; what comes next
   sits on the bottom edge. Details open in a quiet card. */
#session:not([hidden]){display:flex;flex-direction:column}
.now{display:flex;flex-direction:column;align-items:center;text-align:center;gap:18px;padding-top:4px}
.step{margin:0 0 6px;font-size:13px;font-weight:600;color:var(--muted);font-variant-numeric:tabular-nums}
.now h1{font-size:26px;line-height:1.25;margin:0}
.ring{position:relative;flex:none;width:200px;height:200px}
.ring svg{width:100%;height:100%;transform:rotate(-90deg)}
.ring circle{fill:none;stroke-width:5}
.ring .track{stroke:var(--active)}
.ring .arc{stroke:var(--faint);stroke-linecap:round;stroke-dasharray:1;stroke-dashoffset:calc(1 - var(--left,1));transition:stroke .3s}
.ring.hold .arc{stroke:var(--accent)}
.count{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px}
.count time{font-size:64px;line-height:1;font-weight:700;font-variant-numeric:tabular-nums;letter-spacing:-.02em}
.count small{font-size:15px;color:var(--muted);min-height:1.2em}
.phase{margin:-4px 0 0;font-size:15px;font-weight:600;color:var(--accent);font-variant-numeric:tabular-nums;min-height:1.4em}
.cue{font-size:16px;line-height:1.65;color:var(--text);margin:18px 0 0;text-align:center;text-wrap:pretty}
.next{display:flex;align-items:baseline;gap:10px;font-size:14px;color:var(--muted);margin:auto 0 0;padding-top:20px}
.next strong{color:var(--text);font-weight:600}

.tips{margin-top:14px;font-size:14px;line-height:1.65;color:var(--body);text-align:left}
.tips summary{display:flex;justify-content:center;align-items:center;gap:6px;min-height:36px;color:var(--muted);cursor:pointer;list-style:none}
.tips summary::-webkit-details-marker{display:none}
.tips summary::after{content:"";width:7px;height:7px;border:solid currentColor;border-width:0 1.5px 1.5px 0;transform:rotate(45deg) translate(-2px,-2px)}
.tips[open] summary::after{transform:rotate(-135deg) translate(-2px,-2px)}
.tips[open]{background:var(--raised);border-radius:var(--r-control);padding:4px 16px 14px}
.tips ol{padding-left:1.2em;margin:4px 0 10px}
.tips li+li{margin-top:4px}
.tips p{margin:6px 0 0;font-size:13px;color:var(--muted)}
.tips .avoid{color:var(--body)}
.tips .links{display:flex;gap:14px;margin-top:10px}
.tips a{color:var(--muted);text-underline-offset:3px}

/* Done: a completed ring beside the summary. */
.status{display:flex;align-items:center;gap:18px}
.status .ring{width:108px;height:108px}
.ring.complete .arc{stroke:var(--done);stroke-dashoffset:0;stroke-width:6}
.ring.complete svg{transform:none}
.ring .tick{fill:none;stroke:var(--done);stroke-width:6;stroke-linecap:round;stroke-linejoin:round}
.heading{min-width:0}
.heading h1{font-size:25px;line-height:1.3;margin:0}
.heading p{margin:4px 0 0;font-size:15px;color:var(--body);font-variant-numeric:tabular-nums}

/* Actions stay on the bottom edge: one white primary, the rest on surfaces. */
.actions{padding:16px 24px 24px}
.group{display:flex;gap:8px;align-items:center}
.primary,.secondary{height:52px;border-radius:var(--r-control);font-size:16px;font-weight:700;padding:0 20px}
.primary{flex:1;background:var(--accent);color:#fff}
.primary:hover{background:var(--accent-hover)}
.secondary{background:var(--raised);color:var(--text)}
.icon{width:52px;height:52px;flex:none;border-radius:var(--r-control);background:var(--raised);display:grid;place-items:center;color:var(--body)}
.icon svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.icon[aria-pressed=false]{color:var(--faint)}

/* Phones: the figure on top, the panel under it, actions within thumb reach. */
@media (max-width:820px){
 .app{display:block;height:auto;min-height:100dvh;padding:0}
 .stage{position:sticky;top:0;z-index:1;height:52svh;border-radius:0 0 22px 22px}
 .app[data-mode=session] .stage{height:58svh}
 .panel{background:none;border-radius:0;min-height:calc(48svh + 1px)}
 .view{overflow:visible;padding:20px 18px 8px}
 .brand{display:none}
 .section:first-of-type{margin-top:12px}
 .section{margin-top:20px}
 .now{display:grid;grid-template-columns:auto 1fr;grid-template-areas:"ring heading" "ring phase";align-items:center;text-align:left;gap:2px 16px;padding-top:0}
 .now .heading{grid-area:heading;align-self:end}
 .now .ring{grid-area:ring;width:104px;height:104px}
 .now .phase{grid-area:phase;align-self:start;margin:0}
 .now h1{font-size:22px}
 .step{margin-bottom:2px}
 .count time{font-size:34px}
 .count small{font-size:12px}
 .cue{text-align:left;margin-top:14px}
 .tips summary{justify-content:flex-start}
 .next{margin-top:12px;padding-top:0}
 #session:not([hidden]){padding-bottom:20px}
 .status .ring{width:88px;height:88px}
 .heading h1{font-size:22px}
 .actions{position:sticky;bottom:0;z-index:2;padding:12px 18px calc(12px + env(safe-area-inset-bottom));background:var(--canvas)}
 .actions .icon,.actions .secondary{background:var(--surface);box-shadow:0 1px 3px rgba(20,33,30,.08)}
 .move .glyph{background:var(--surface)}
 .strip{bottom:12px;left:14px;right:14px}
 .stage-tools{top:10px;right:10px}
}
@media (prefers-reduced-motion:reduce){.ring .arc{transition:none}}
