:root{
  --sans:'IBM Plex Sans Thai','Noto Sans Thai',system-ui,-apple-system,'Segoe UI',sans-serif;
  --ink:#191a24; --muted:#6b6c7e; --line:#e6e3dc; --surface:#fff; --bg:#f5f4ef;
  --brand:#2e7d88; --brand-ink:#1f5f68; --brand-soft:#dcecee; --ok:#129a72; --warn:#d68a17; --danger:#e2564a;
}
*{box-sizing:border-box}
html,body{margin:0;height:100%;overflow:hidden}
body{font-family:var(--sans);color:var(--ink);background:var(--bg);display:flex;flex-direction:column;-webkit-font-smoothing:antialiased;user-select:none;-webkit-user-select:none}
#stage{position:relative;flex:1;min-height:0;background:#eaf0f6}
#webgl-canvas{width:100%;height:100%;display:block;touch-action:none}
.status{position:absolute;left:12px;top:12px;right:96px;background:rgba(255,255,255,.95);border:1px solid var(--line);border-radius:12px;padding:8px 13px;font-size:.82rem;box-shadow:0 4px 14px rgba(25,26,36,.08);pointer-events:none;max-width:min(560px,calc(100% - 120px));line-height:1.5}
.status.ok{border-color:#bfe9da;color:#0a6b50;background:#f0fbf7}
.status.bad{border-color:#f6cdc9;color:#8f2018;background:#fdf3f2}
.status.warn{border-color:#f7e2bd;color:#7d5209;background:#fffaf0}
#panel{flex:none;background:var(--surface);border-top:1px solid var(--line);padding:12px 14px 14px;display:flex;flex-direction:column;gap:9px;max-height:54vh;overflow-y:auto}
.panel-head{display:flex;align-items:baseline;gap:10px}
.panel-title{font-weight:700;font-size:.92rem}
.goal{font-size:.78rem;color:var(--muted);margin-left:auto;text-align:right}
#panel .btn-switch{flex:none;align-self:stretch;width:100%;padding:10px 14px;text-align:center}
.hint{margin:0;font-size:.74rem;color:var(--muted);line-height:1.5}
.order-list{display:flex;flex-direction:column;gap:5px}
.org-row{display:flex;align-items:center;gap:8px;background:var(--bg);border:1px solid var(--line);border-left:3px solid var(--brand);border-radius:9px;padding:6px 8px;touch-action:none}
.org-row.ok{border-left-color:var(--ok);background:#eefbf5}
.org-row.dragging{opacity:.85;box-shadow:0 6px 18px rgba(25,26,36,.18);border-color:var(--brand);cursor:grabbing;position:relative;z-index:5}
.org-grip{cursor:grab;color:var(--muted);font-size:1rem;line-height:1;width:14px;text-align:center;user-select:none;-webkit-user-select:none}
.org-ico{font-size:1.05rem;width:22px;text-align:center}
.org-name{font-size:.8rem;font-weight:600;flex:1}
.org-fn{font-size:.68rem;color:var(--muted);flex-basis:100%;margin-left:30px}
.mv{border:1px solid var(--line);background:#fff;border-radius:7px;width:26px;height:26px;cursor:pointer;font-size:.85rem;color:var(--brand-ink)}
.mv[disabled]{opacity:.3}
.btn-check{background:var(--brand-soft);color:var(--brand-ink);border:none;align-self:flex-start;padding:7px 14px;font-size:.78rem}
.fnquiz{display:flex;flex-direction:column;gap:6px;background:var(--bg);border:1px solid var(--line);border-radius:12px;padding:9px 11px}
.fq-q{font-size:.76rem;font-weight:600}
.fq-opts{display:flex;flex-direction:column;gap:4px}
.fq-opt{border:1px solid var(--line);background:#fff;border-radius:9px;padding:6px 10px;font-family:inherit;font-size:.76rem;cursor:pointer;text-align:left}
.fq-opt.correct{background:#e9f8f2;border-color:var(--ok);color:#0a6b50}
.fq-opt.wrong{background:#fdf3f2;border-color:var(--danger);color:#8f2018}
.tasks{display:flex;flex-direction:column;gap:5px}
.tk-head{font-size:.78rem;font-weight:600;color:var(--muted)}
.tk-head span:last-child{background:var(--brand-soft);color:var(--brand-ink);padding:1px 8px;border-radius:999px;font-size:.72rem}
.task-list{display:flex;flex-direction:column;gap:4px}
.task-item{display:flex;align-items:center;gap:7px;font-size:.76rem;padding:6px 9px;border-radius:8px;background:var(--bg)}
.task-item.is-done{background:#e9f8f2;color:#0a6b50}
.task-check{width:16px;height:16px;border-radius:50%;border:2px solid var(--line);flex:none}
.task-item.is-done .task-check{background:var(--ok);border-color:var(--ok)}
.actions{display:flex;gap:8px}
.btn{padding:10px 14px;border-radius:999px;border:1px solid transparent;font-family:inherit;font-size:.84rem;font-weight:600;cursor:pointer;box-shadow:0 2px 6px rgba(25,26,36,.12)}
.btn:active{transform:translateY(1px)}
.btn[disabled]{opacity:.45;pointer-events:none}
.btn-ghost{background:var(--surface);border-color:var(--line);color:var(--ink)}
.btn-run{background:var(--brand);color:#fff;flex:1}
.btn-submit{background:var(--ok);color:#fff;flex:1}
.chooser{position:absolute;inset:0;background:rgba(234,240,246,.97);display:flex;align-items:center;justify-content:center;padding:20px;z-index:10}
.chooser[hidden]{display:none}
.chooser-box{max-width:560px;width:100%}
.chooser-title{font-size:1.3rem;margin:0 0 4px}
.chooser-sub{font-size:.84rem;color:var(--muted);margin:0 0 16px}
.chooser-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:10px}
.choice{display:flex;flex-direction:column;gap:4px;padding:14px;border:1px solid var(--line);border-radius:14px;background:#fff;cursor:pointer;text-align:left;font-family:inherit;transition:border-color .15s,transform .1s}
.choice:hover{border-color:var(--brand);transform:translateY(-2px)}
.choice .ico{font-size:1.6rem}
.choice .nm{font-weight:700;font-size:.9rem}
@media (min-width:900px){body{flex-direction:row}#panel{width:342px;max-height:none;height:100%;border-top:none;border-left:1px solid var(--line);padding:16px}}
@media (max-width:560px){.status{position:static;margin:8px 12px;max-width:none;right:auto}#stage{display:flex;flex-direction:column;min-height:44vh}#webgl-canvas{flex:1;min-height:170px}}

/* ---------- แผงออกกำลังกาย: หัวใจ การหายใจ การกระจายเลือด ---------- */
.exer{display:flex;flex-direction:column;gap:7px;border:1px solid var(--line);border-radius:12px;
  padding:9px 11px;background:var(--bg)}
.ex-head{display:flex;align-items:center;gap:8px;font-size:.78rem;font-weight:600;color:var(--muted)}
.ex-zone{margin-left:auto;font-size:.68rem;font-weight:700;padding:1px 9px;border-radius:999px;
  background:var(--brand-soft);color:var(--brand-ink)}
.ex-zone.hot{background:#fdeceb;color:#a5251b}

.ex-acts{display:flex;flex-wrap:wrap;gap:5px}
.ex-act{border:1px solid var(--line);background:#fff;border-radius:999px;padding:4px 11px;
  font-size:.73rem;font-family:inherit;cursor:pointer;color:var(--ink)}
.ex-act:hover{border-color:var(--brand)}
.ex-act.on{border-color:var(--brand);background:var(--brand);color:#fff;font-weight:600}
.ex-knobs{display:flex;flex-direction:column;gap:7px}

.ex-read{display:grid;grid-template-columns:1fr auto;gap:2px 10px;font-size:.75rem;align-items:baseline}
.ex-k{color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ex-v{font-variant-numeric:tabular-nums;font-weight:700;text-align:right}
.ex-v.hot{color:#c0392b}
.ex-v.cool{color:#0a6b50}

.ex-flow-head{font-size:.74rem;font-weight:600;color:var(--muted);margin-top:2px}
.ex-flow{display:flex;flex-direction:column;gap:3px}
.fl-row{display:grid;grid-template-columns:82px 1fr 108px;gap:7px;align-items:center;font-size:.7rem}
.fl-k{color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.fl-bar{height:9px;border-radius:999px;background:#e7e4dc;overflow:hidden}
.fl-bar i{display:block;height:100%;border-radius:999px;background:var(--brand);transition:width .25s}
.fl-row.muscle .fl-bar i{background:#e2564a}
.fl-v{text-align:right;font-variant-numeric:tabular-nums;color:var(--ink)}
