*{box-sizing:border-box;margin:0;padding:0}

:root{
  --bg:#0f1117;
  --surface:#1a1d26;
  --surface2:#242836;
  --surface3:#2e3244;
  --border:#2e3244;
  --border2:#3d4258;
  --teal:#2dd4a0;
  --teal-dim:#1a9e75;
  --teal-bg:rgba(45,212,160,.08);
  --teal-bg2:rgba(45,212,160,.15);
  --coral:#f07060;
  --coral-dim:#c0503a;
  --gray:#6b7280;
  --gray2:#9ca3af;
  --text:#e8eaf0;
  --text2:#a0a8b8;
  --text3:#6b7280;
  --skin:#d4a574;
  --skin2:#b8956a;
  --knee:#c4956a;
  --teal-svg:#9fe1cb;
  --radius:12px;
  --radius-sm:8px;
  --radius-pill:999px;
}

html{-webkit-tap-highlight-color:transparent}
body{
  font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Noto Sans Thai',sans-serif;
  background:var(--bg);
  color:var(--text);
  min-height:100vh;
  overscroll-behavior:none;
}

/* ─── App shell ─── */
.app{display:flex;flex-direction:column;height:100dvh;overflow:hidden}

/* ─── Header ─── */
.hdr{
  padding:14px 16px 10px;
  border-bottom:1px solid var(--border);
  background:var(--surface);
  flex-shrink:0;
}
.hdr-row{display:flex;align-items:center;justify-content:space-between;gap:12px}
.hdr-info{}
.hdr-title{font-size:15px;font-weight:600;color:var(--text);letter-spacing:.01em}
.hdr-sub{font-size:11.5px;color:var(--text3);margin-top:2px}

/* Mode toggle */
.mode-pill{
  display:flex;
  background:var(--bg);
  border:1px solid var(--border);
  border-radius:var(--radius-pill);
  padding:3px;
  gap:2px;
  flex-shrink:0;
}
.mp-btn{
  padding:5px 13px;
  border-radius:var(--radius-pill);
  font-size:12px;
  font-weight:500;
  cursor:pointer;
  background:transparent;
  color:var(--text3);
  border:none;
  transition:all .2s;
  white-space:nowrap;
  font-family:inherit;
}
.mp-btn.on{background:var(--teal-dim);color:var(--bg);font-weight:600}

/* ─── Pose tabs ─── */
.pose-scroll{
  overflow-x:auto;
  scrollbar-width:none;
  padding:10px 16px;
  border-bottom:1px solid var(--border);
  background:var(--surface);
  flex-shrink:0;
}
.pose-scroll::-webkit-scrollbar{display:none}
.pose-row{display:flex;gap:6px;width:max-content}
.pt{
  padding:6px 14px;
  border:1px solid var(--border2);
  border-radius:var(--radius-pill);
  font-size:12.5px;
  font-weight:500;
  background:transparent;
  color:var(--text3);
  cursor:pointer;
  white-space:nowrap;
  transition:all .18s;
  font-family:inherit;
}
.pt.on{background:var(--teal);border-color:var(--teal);color:var(--bg);font-weight:600}
.pt:hover:not(.on){background:var(--teal-bg);border-color:var(--teal-dim);color:var(--teal)}

/* ─── Panels ─── */
.panels{flex:1;overflow:hidden;min-height:0;position:relative}
#posePanels{height:100%;display:flex;flex-direction:column;min-height:0}
.pose-panel{display:none;min-height:0}
.pose-panel.on{display:flex;flex-direction:column;height:100%;overflow-y:auto;-webkit-overflow-scrolling:touch;scrollbar-width:thin;scrollbar-color:var(--border2) transparent}
.pose-panel::-webkit-scrollbar{width:4px}
.pose-panel::-webkit-scrollbar-track{background:transparent}
.pose-panel::-webkit-scrollbar-thumb{background:var(--border2);border-radius:4px}

/* ─── STEP BY STEP ─── */
.step-nums-wrap{
  padding:12px 16px 8px;
  border-bottom:1px solid var(--border);
  flex-shrink:0;
  background:var(--surface);
  position:sticky;top:0;z-index:10;
}
.step-nums{display:flex;gap:6px;flex-wrap:wrap}
.sn{
  width:34px;height:34px;border-radius:50%;
  border:1px solid var(--border2);
  background:transparent;
  color:var(--text3);
  font-size:11px;font-weight:600;
  cursor:pointer;
  display:flex;align-items:center;justify-content:center;
  transition:all .18s;
  flex-shrink:0;
}
.sn.on{background:var(--teal);border-color:var(--teal);color:var(--bg);transform:scale(1.08)}
.sn:hover:not(.on){background:var(--teal-bg);border-color:var(--teal-dim);color:var(--teal)}

.step-cards-wrap{padding:16px;padding-bottom:24px}
.step-card{display:none;border-radius:var(--radius);border:1px solid var(--border);background:var(--surface);overflow:hidden}
.step-card.on{display:block}

@media(min-width:520px){
  .step-card.on{display:grid;grid-template-columns:180px 1fr;grid-template-rows:1fr auto}
}

.fig-area{
  background:var(--surface2);
  padding:18px;
  display:flex;flex-direction:column;align-items:center;gap:10px;
  border-bottom:1px solid var(--border);
}
@media(min-width:520px){
  .fig-area{border-bottom:none;border-right:1px solid var(--border);grid-row:1}
}
.fig-area svg{width:100%;max-width:200px;height:auto}
.lgd-row{display:flex;gap:8px;flex-wrap:wrap;justify-content:center}
.lg-item{display:flex;align-items:center;gap:4px;font-size:10.5px;color:var(--text2);font-weight:500}
.lg-dot{width:18px;height:3px;border-radius:3px}

.info-area{padding:18px}
@media(min-width:520px){.info-area{grid-column:2}}
.step-badge{
  display:inline-flex;align-items:center;gap:5px;
  background:var(--teal-bg);
  color:var(--teal);
  font-size:11px;font-weight:600;
  padding:4px 10px;border-radius:var(--radius-pill);
  margin-bottom:10px;border:1px solid rgba(45,212,160,.2);
}
.step-badge .dot{width:5px;height:5px;border-radius:50%;background:var(--teal)}
.stitle{font-size:14px;font-weight:500;color:var(--text);line-height:1.5;margin-bottom:6px}
.sdesc{font-size:13px;color:var(--text2);line-height:1.65}
.subl{list-style:none;margin-top:10px;border-top:1px solid var(--border);padding-top:8px}
.subl li{
  display:flex;gap:8px;padding:5px 0;
  font-size:12.5px;color:var(--text2);line-height:1.5;
  border-bottom:1px solid var(--border);
}
.subl li:last-child{border-bottom:none}
.subl li::before{content:"◆";font-size:8px;color:var(--teal);flex-shrink:0;margin-top:3px}

.nav-area{
  display:flex;align-items:center;gap:8px;
  padding:12px 16px;
  border-top:1px solid var(--border);
  background:var(--surface2);
}
@media(min-width:520px){.nav-area{grid-column:1/-1}}
.nb{
  flex:1;padding:10px 0;
  border:1px solid var(--border2);
  border-radius:var(--radius-sm);
  font-size:13px;font-weight:500;
  background:transparent;color:var(--text2);
  cursor:pointer;transition:all .15s;
  font-family:inherit;text-align:center;
}
.nb:hover:not(:disabled){background:var(--surface3);color:var(--text)}
.nb:disabled{opacity:.3;cursor:default}
.nb.p{background:var(--teal);color:var(--bg);border-color:var(--teal)}
.nb.p:hover:not(:disabled){background:#24b88a}
.prog-pill{
  background:var(--teal-bg);color:var(--teal);
  font-size:11px;font-weight:600;
  padding:4px 10px;border-radius:var(--radius-pill);
  white-space:nowrap;border:1px solid rgba(45,212,160,.2);
  flex-shrink:0;
}

/* ─── OVERVIEW ─── */
.ov-list{padding:0 16px 40px}
.ov-item{
  display:flex;align-items:flex-start;gap:12px;
  padding:12px 0;
  border-bottom:1px solid var(--border);
  transition:background .12s;
}
.ov-item:last-child{border-bottom:none}
.ov-num{
  width:28px;height:28px;border-radius:50%;
  background:var(--teal-bg);
  color:var(--teal);
  font-size:12px;font-weight:600;
  display:flex;align-items:center;justify-content:center;
  flex-shrink:0;margin-top:1px;
  border:1px solid rgba(45,212,160,.2);
}
.ov-body{flex:1;min-width:0}
.ov-text{font-size:13.5px;color:var(--text);line-height:1.5}
.ov-sub{font-size:12px;color:var(--text3);margin-top:4px;line-height:1.45}
.ov-sub span{display:block;padding:1.5px 0}
.ov-sub span::before{content:"◆ ";font-size:8px;color:var(--teal-dim)}
.ov-jump{
  flex-shrink:0;
  padding:5px 11px;
  border:1px solid var(--border2);
  border-radius:var(--radius-sm);
  font-size:12px;font-weight:500;
  color:var(--teal);background:var(--teal-bg);
  cursor:pointer;transition:all .15s;
  font-family:inherit;margin-top:1px;white-space:nowrap;
}
.ov-jump:hover{background:var(--teal-bg2);border-color:var(--teal)}

/* ─── Animations ─── */
@keyframes up{0%{stroke-dashoffset:80}100%{stroke-dashoffset:0}}
@keyframes dn{0%{stroke-dashoffset:-80}100%{stroke-dashoffset:0}}
@keyframes sd{0%{stroke-dashoffset:60}100%{stroke-dashoffset:0}}
@keyframes sp{0%{stroke-dashoffset:220}100%{stroke-dashoffset:0}}
@keyframes bl{0%,100%{opacity:.9}50%{opacity:.2}}
@keyframes pu{0%,100%{r:4;opacity:.9}50%{r:7;opacity:.4}}
.au{animation:up 1.2s ease-in-out infinite;stroke-dasharray:12,4}
.ad{animation:dn 1.2s ease-in-out infinite;stroke-dasharray:12,4}
.as{animation:sd 1s ease-in-out infinite;stroke-dasharray:10,4}
.asp{animation:sp 2.2s linear infinite;stroke-dasharray:220}
.abl{animation:bl 1s ease-in-out infinite}
.apu{animation:pu 1.5s ease-in-out infinite}
