:root {
  color-scheme: light;
  font-family: "DM Sans", Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  --paper: #f8f7f4;
  --ink: #31352f;
  --muted: #676c62;
  --line: #dcded4;
  --sage: #556047;
  --surface: #fdfcf9;
  --serif: "Hedvig Letters Serif", "Songti SC", "Noto Serif CJK SC", "SimSun", Georgia, serif;
  background: var(--paper);
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
button, input, select { font: inherit; }
button { color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled, input:disabled, select:disabled { cursor: default; opacity: .56; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid #68785b; outline-offset: 4px; }
button { touch-action: manipulation; }
[hidden] { display: none !important; }
.visually-hidden, .icon-bank {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.icon {
  width: 21px; height: 21px; display: block; flex-shrink: 0; fill: none; stroke: currentColor;
  stroke-width: 1.45; stroke-linecap: round; stroke-linejoin: round;
}
.app-bar {
  height: 76px; padding-inline: clamp(22px, 4.4vw, 82px);
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line); background: var(--surface);
}
.brand, .engine-state, .transport-left, .setting-name, .reset, .interaction-tip {
  display: flex; align-items: center;
}
.brand { gap: 10px; white-space: nowrap; }
.brand-mark { width: 32px; height: 32px; }
.wordmark { font-family: var(--serif); font-weight: 700; font-size: 24px; letter-spacing: .08em; }
.brand-divider { width: 1px; height: 17px; background: #cfcec4; margin-inline: 6px; transform: rotate(16deg); }
.workspace-name { font-size: 14px; letter-spacing: .08em; color: #62665b; }
.engine-state { gap: 8px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #9d9c8d; }
.engine-state[data-state="ready"] .status-dot { background: #778963; box-shadow: 0 0 0 3px #e9ede3; }
.engine-state[data-state="error"] .status-dot { background: #a56154; }
.desk {
  max-width: 1680px; margin: 0 auto; padding: clamp(18px, 2.6vw, 44px) clamp(20px, 4.4vw, 82px) clamp(20px, 3vw, 52px);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(255px, 300px);
  gap: clamp(22px, 2.6vw, 44px); align-items: start;
}
.preview {
  display: flex; flex-direction: column; min-width: 0;
  position: sticky; top: 10px; z-index: 1;
  overflow: hidden; border: 1px solid #d6d6cb; border-radius: 16px;
  background: var(--surface);
}
.stage {
  --corner-gap: clamp(13px, 1.4vw, 23px);
  position: relative; isolation: isolate; overflow: hidden;
  height: clamp(480px, calc(100svh - 205px), 950px); min-height: 0;
  background: radial-gradient(ellipse at 53% 38%, #faf8f0 0%, #f1efdf 49%, #e7e7d8 100%);
}
.paper-orbit {
  position: absolute; left: 50%; top: 42%; width: min(83%, 580px); aspect-ratio: 1;
  transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(circle at 40% 32%, #fffefa77, #fffdf433 69%, #fffdf409);
  border: 1px solid #fffef3b3;
  pointer-events: none;
}
.paper-orbit::after {
  content: ""; position: absolute; inset: -10px; border-radius: inherit;
  border: 1px solid #c6c6ad4a;
}
.frame-marks { position: absolute; inset: var(--corner-gap); pointer-events: none; }
.frame-marks i { position: absolute; width: 11px; height: 11px; border: 0 solid #90978081; }
.frame-marks i:nth-child(1) { top: 0; left: 0; border-width: 1px 0 0 1px; }
.frame-marks i:nth-child(2) { top: 0; right: 0; border-width: 1px 1px 0 0; }
.frame-marks i:nth-child(3) { bottom: 0; left: 0; border-width: 0 0 1px 1px; }
.frame-marks i:nth-child(4) { bottom: 0; right: 0; border-width: 0 1px 1px 0; }
#portrait { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.stage-heading {
  position: absolute; top: clamp(26px, 3.2vw, 50px); left: clamp(26px, 3vw, 46px);
  pointer-events: none; user-select: none;
}
.stage-label { display: flex; align-items: center; gap: 8px; color: #626953; font-size: 11px; letter-spacing: .15em; }
.stage-label span { background: #849176; display: inline-block; width: 18px; height: 1px; }
h1 { font: 500 clamp(30px, 2.7vw, 44px)/1.25 var(--serif); margin: 9px 0 0; letter-spacing: .05em; color: #434a39; }
.icon-button, .playback, .action-btn, .switch, .reset, .view-group button, .error-box button {
  appearance: none; border: none;
}
.icon-button { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; }
.fullscreen {
  position: absolute; top: calc(var(--corner-gap) + 10px); right: calc(var(--corner-gap) + 10px);
  background: #fffdf898; color: #555e4c; border: 1px solid #9aa08564;
}
.fullscreen .icon { width: 17px; height: 17px; }
.fullscreen:hover { background: #fffefb; }
.transport {
  min-height: 66px; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px clamp(16px, 2vw, 32px); border-top: 1px solid #cfcebe; background: var(--surface);
}
.transport-left { gap: 11px; }
.playback { width: 35px; height: 35px; border-radius: 50%; display: grid; place-items: center; background: #535d47; color: #fafcf7; }
.playback:hover { background: #3e4935; }
.playback .icon { width: 15px; height: 15px; }
.playback-label { color: #555d50; font-size: 13px; }
.view-group { display: flex; align-items: center; border: 1px solid #dedfd7; border-radius: 8px; background: #f1f2eb; padding: 3px; }
.view-group button { min-height: 29px; padding: 2px 11px; border-radius: 5px; font-size: 12px; background: transparent; color: #65695f; white-space: nowrap; }
.view-group button[aria-pressed="true"] { background: #fffefb; color: #404c36; box-shadow: 0 1px 3px #333b2b1c; font-weight: 600; }
.side-panel { min-width: 0; padding-top: clamp(7px, 1vw, 16px); }
.side-panel h2 { font: 600 23px/1.35 var(--serif); margin: 0 0 21px; letter-spacing: .07em; }
.mode-tabs { display: flex; gap: 4px; padding: 3px; border: 1px solid #dedfd4; border-radius: 9px; background: #eeeFE7; }
.mode-tabs button {
  flex: 1; min-height: 34px; padding: 3px 5px; border: 0; border-radius: 6px;
  background: transparent; color: #626b59; font-size: 13px;
}
.mode-tabs button[aria-selected="true"] { background: #fffefa; color: #394431; font-weight: 600; box-shadow: 0 1px 3px #414b3224; }
.tool-pane { margin-top: 17px; }
.posture-list { border-block: 1px solid var(--line); }
.posture-row { min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.posture-row + .posture-row { border-top: 1px solid #e5e6dd; }
.posture-name { color: #3f473a; font-size: 14px; line-height: 1.4; }
.posture-name small { display: block; color: #6d7663; font-size: 11px; }
.posture-button, .support-group button {
  border: 1px solid #d3d8c9; color: #4f5e43; background: var(--surface); border-radius: 6px; font-size: 12px;
}
.posture-button { min-width: 86px; min-height: 33px; padding: 5px 9px; }
.posture-button:hover, .support-group button:hover { border-color: #a9b395; }
.posture-button[data-active="true"], .support-group button[aria-pressed="true"] { border-color: #b5c1a6; background: #e8eddd; color: #3d4d33; }
.support-title, .section-heading h3, .joint-heading h3 { margin: 0; font: 600 17px/1.4 var(--serif); letter-spacing: .045em; }
.support-title { margin-block: 17px 11px; }
.support-study { margin-top: 12px; font-size: 13px; }
.support-study summary { color: var(--ink); cursor: pointer; width: fit-content; padding: 4px 0; }
.support-study figure { margin: 6px 0 0; }
.study-crop { overflow: hidden; border-radius: 5px; }
.study-crop img { width: 100%; height: auto; display: block; }
.support-study[data-side="-1"] img, .support-study[data-side="1"] img { width: 200%; max-width: none; }
.support-study[data-side="1"] img { transform: translateX(-50%); }
.support-study figcaption { margin-top: 6px; line-height: 1.55; color: var(--muted); }
#show-alignment, #alignment-dialog button { color:#3c5848; background:var(--surface); border:1px solid var(--line); border-radius:5px; padding:5px 9px; margin-top:6px; font:inherit; cursor:pointer; }
#alignment-dialog { padding:12px; width:min(96vw,1340px); max-height:94svh; border:1px solid var(--line); border-radius:10px; background:var(--paper); }
#alignment-dialog::backdrop { background:#26322c99; }
#alignment-dialog form { display:flex; justify-content:flex-end; margin-bottom:6px; }
#alignment-dialog img { display:block; width:100%; height:auto; }
.support-group { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.support-group button { min-height: 34px; padding: 3px 2px; }
.action-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.action-btn {
  min-height: 67px; border-radius: 9px; border: 1px solid #dcded3; background: var(--surface);
  position: relative; display: flex; align-items: center; justify-content: center; flex-direction: column;
  padding: 8px 4px; gap: 5px;
  transition: background .16s, border-color .16s, transform .16s;
}
.action-btn > .icon { width: 20px; height: 20px; color: #626c55; }
.action-btn span { font-size: 13px; line-height: 1.3; color: #3c4437; white-space: nowrap; }
.action-btn kbd {
  position: absolute; top: 5px; right: 5px; flex-shrink: 0; display: grid; place-items: center; width: 14px; height: 15px;
  font: 10px/1 "IBM Plex Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums;
  border-radius: 4px; color: #7d8274; background: #f1f2eb; border: 1px solid #e3e4da;
}
@media (hover:hover) { .action-btn:hover:not(:disabled) { background: #f1f3e9; border-color: #aeb8a0; transform: translateY(-1px); } }
.action-btn[data-firing="true"] { background: #e5eadb; border-color: #96a487; }
.action-btn[data-action="nearOffer"] {
  grid-column: 1 / -1; min-height: 44px; flex-direction: row; gap: 9px;
  background: #edf1e6; border-color: #c9d3bd;
}
.action-btn[data-action="nearOffer"] kbd { top: 50%; right: 12px; transform: translateY(-50%); }
.action-btn[data-action="nearOffer"][data-firing="true"] { background: #e0e8d5; border-color: #96a487; }
.action-btn:active:not(:disabled) { transform: translateY(1px); }
.parameters { margin-top: 23px; border-top: 1px solid var(--line); padding-top: 20px; }
.parameters h2 { font-size: 20px; margin-bottom: 19px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.section-heading h2 { margin: 0; flex-shrink: 0; }
.local-inspector { border-top: 1px solid var(--line); margin-top: 17px; padding-top: 16px; }
.section-heading select {
  min-width: 0; max-width: 60%; height: 34px; padding: 0 6px;
  font-size: 12px; color: #414c39; background: var(--surface);
  border: 1px solid #d9dccf; border-radius: 7px; cursor: pointer;
}
.pose-tools { display: flex; align-items: center; gap: 10px; }
.pose-clear {
  min-height: 28px; padding: 2px 0 2px 10px; color: #5d6853; background: transparent;
  border: 0; border-left: 1px solid var(--line); font-size: 12px;
}
.pose-clear:hover:enabled { text-decoration: underline; text-underline-offset: 3px; }
.setting-line { display: flex; align-items: center; justify-content: space-between; min-height: 28px; gap: 10px; }
.setting-name { gap: 9px; font-size: 14px; color: #444b3f; }
.setting-name .icon { width: 17px; height: 17px; color: #737b67; }
.switch { width: 38px; height: 22px; position: relative; background: #cbcec3; border-radius: 16px; transition: background .18s; }
.switch[aria-checked="true"] { background: #647254; }
.switch i { width: 16px; height: 16px; position: absolute; left: 3px; top: 3px; background: #fffefb; border-radius: 50%; transition: transform .18s; }
.switch[aria-checked="true"] i { transform: translateX(16px); }
.switch::before { content: ""; position: absolute; inset: -8px -2px; }
.range-setting { margin-top: 22px; }
output { font: 12px/1 "IBM Plex Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; color: #5a644f; }
input[type="range"] {
  --fill: 65%; appearance: none; display: block; width: 100%; height: 24px; margin: 5px 0 0;
  background: transparent; cursor: pointer; accent-color: #606e52; touch-action: pan-y;
}
#part-pose { --fill: 0%; }
.signed-range { --low: 50%; --high: 50%; }
.joint-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; margin-block: 9px 13px; }
.joint-groups button {
  min-height: 30px; padding: 2px; border: 1px solid #d3d8c9; border-radius: 5px;
  color: var(--muted); background: var(--surface); font-size: 12px;
}
.joint-groups button[aria-pressed="true"] { background: #e8eddd; border-color: #b5c1a6; color: #3d4d33; }
.joint-axis + .joint-axis { margin-top: 9px; }
.joint-axis .setting-line { min-height: 23px; }
.joint-axis .setting-name { font-size: 13px; }
.joint-axis .pose-clear { min-height: 23px; }
.joint-axis input[type="range"] { margin-top: 0; height: 21px; }
.axis-directions { display: flex; justify-content: space-between; color: #69725f; font-size: 10px; line-height: 1.3; }
.joint-note { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 10px 0 0; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; background: linear-gradient(to right, #7a886a var(--fill), #dcded3 var(--fill)); border-radius: 8px; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 15px; height: 15px; border-radius: 50%; margin-top: -5.5px; border: 2px solid var(--paper); background: #667457; box-shadow: 0 0 0 1px #77836b; }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 8px; background: #dcded3; }
input[type="range"]::-moz-range-progress { height: 4px; background: #7a886a; border-radius: 8px; }
input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border: 2px solid var(--paper); border-radius: 50%; background: #667457; box-shadow: 0 0 0 1px #77836b; }
input.signed-range::-webkit-slider-runnable-track {
  background: linear-gradient(to right, transparent 49.7%, #858f78 49.7% 50.3%, transparent 50.3%),
              linear-gradient(to right, #dcded3 var(--low), #7a886a var(--low) var(--high), #dcded3 var(--high));
}
input.signed-range::-moz-range-track { background: linear-gradient(to right, #dcded3 var(--low), #7a886a var(--low) var(--high), #dcded3 var(--high)); }
input.signed-range::-moz-range-progress { background: transparent; }
.reset { margin: 13px -3px 0 auto; min-height: 34px; gap: 5px; padding: 4px; color: #61695a; background: transparent; font-size: 12px; }
.reset:hover { color: #35452c; text-decoration: underline; text-underline-offset: 4px; }
.reset .icon { width: 15px; height: 15px; }
.interaction-tip { align-items: flex-start; gap: 8px; margin: 15px 0 0; padding-top: 18px; border-top: 1px solid var(--line); color: #727869; font-size: 12px; line-height: 1.65; }
.interaction-tip .icon { margin-top: 2px; width: 16px; height: 16px; }
.error-box { position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); min-width: 200px; max-width: 90%; padding: 18px; border-radius: 8px; display: grid; gap: 9px; background: #fffdf6; border: 1px solid var(--line); font-size: 13px; text-align: center; }
.error-box button { padding: 6px; background: #e6eadb; border-radius: 5px; }
.preview:fullscreen, .preview.expanded { width: 100%; height: 100%; border: 0; border-radius: 0; background: var(--paper); }
.preview:fullscreen .stage, .preview.expanded .stage { height: auto; flex: 1; }
.preview.expanded { position: fixed; inset: 0; z-index: 10; height: 100dvh; }
body.has-expanded { overflow: hidden; }
@media (min-width: 1600px) { .app-bar { padding-inline: max(72px, calc((100vw - 1536px) / 2)); } }
@media (max-width: 920px) and (min-width: 761px) {
  .desk { grid-template-columns: minmax(0, 1fr) 230px; gap: 18px; padding-inline: 20px; }
  .app-bar { padding-inline: 22px; }
  .action-btn { padding-inline: 9px; gap: 6px; }
  h1 { font-size: 26px; }
}
@media (min-width: 761px) and (max-width: 1060px) { .action-btn kbd { display: none; } }
@media (max-width: 760px) {
  .app-bar { height: 58px; padding-inline: 18px; }
  .wordmark { font-size: 21px; }
  .brand-mark { width: 28px; height: 28px; }
  .workspace-name { font-size: 12px; }
  .brand { gap: 7px; }
  .engine-state { font-size: 11px; }
  .desk { display: block; padding: 15px 14px 32px; }
  .preview { top: 0; }
  .stage { height: clamp(270px, 47svh, 480px); }
  .stage-heading { left: 24px; top: 24px; }
  .close-up .stage-heading { opacity: 0; }
  h1 { margin-top: 7px; font-size: 26px; }
  .stage-label { font-size: 10px; }
  .fullscreen { width: 34px; height: 34px; }
  .transport { min-height: 56px; padding-block: 8px; }
  .side-panel { padding: 0 3px; margin-top: 23px; }
  .side-panel h2 { font-size: 20px; margin-bottom: 13px; }
  .action-grid { gap: 7px; }
  .action-btn { min-height: 64px; flex-direction: column; justify-content: center; padding: 7px 3px; gap: 5px; }
  .action-btn span, .setting-name { font-size: 13px; }
  .action-btn kbd { display: none; }
  .parameters { margin-top: 20px; padding-top: 17px; }
  .range-setting { margin-top: 13px; }
  .interaction-tip { margin-top: 10px; }
}
@media (max-width: 760px) {
  .side-panel .control-title { display: none; }
  .posture-row { min-height: 49px; }
  .tool-pane { margin-top: 11px; }
}
@media (max-width: 540px) {
  .transport { padding-inline: 12px; gap: 6px; }
  .playback-label { display: none; }
  .view-group button { padding-inline: 8px; min-height: 31px; }
  .side-panel .section-heading h2 { margin-bottom: 0; }
}
@media (max-width: 760px) and (min-height: 681px) {
  .desk { height: calc(100svh - 58px); display: flex; flex-direction: column; align-items: stretch; gap: 16px; padding-bottom: 0; }
  .preview { position: relative; flex-shrink: 0; }
  .stage { height: clamp(270px, 42svh, 420px); }
  .side-panel {
    flex: 1; min-height: 0; margin-top: 0; padding-bottom: max(18px, env(safe-area-inset-bottom));
    overflow-y: auto; overscroll-behavior: contain;
  }
}
@media (max-height: 680px) and (max-width: 760px) { .preview { position: relative; } }
@media (max-width: 360px) {
  .desk { padding-inline: 8px; }
  .stage-heading { top: 20px; left: 20px; }
  h1 { font-size: 22px; }
  .workspace-name { letter-spacing: 0; }
  .view-group button { padding-inline: 6px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; }
}

#support-overlay { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; }
#support-overlay.editing { pointer-events:auto; touch-action:none; }
.support-tool { display:flex; flex-wrap:wrap; align-items:center; gap:6px 8px; padding:6px clamp(12px,2vw,26px); border-top:1px solid var(--line); }
#support-toggle, #handle-toggle, #support-caption { color:#47533e; background:#fffef5ed; border:1px solid #cbd0be; border-radius:6px; font-size:12px; }
#support-toggle, #handle-toggle { padding:5px 9px; pointer-events:auto; cursor:pointer; white-space:nowrap; }
#support-toggle[aria-pressed="true"], #handle-toggle[aria-pressed="true"] { background:#e4ecd9; border-color:#879a7a; }
#support-caption { border:0; background:transparent; }
#handle-panel { border-top:1px solid var(--line); padding:10px clamp(12px,2vw,26px); color:#425044; font-size:12px; }
.handle-heading, .handle-axes, .handle-axes label { display:flex; gap:8px; align-items:center; }
.handle-heading select, #handle-clear { padding:3px 7px; border:1px solid var(--line); border-radius:5px; background:#fffefa; color:inherit; font:inherit; }
#handle-clear { margin-left:auto; cursor:pointer; }
#handle-clear:disabled { opacity:.5; }
.handle-axes { margin-top:8px; gap:18px; }
.handle-axes label { flex:1; min-width:0; white-space:nowrap; }
.handle-axes input { min-width:28px; flex:1; width:100%; accent-color:#546f5c; }
.handle-axes output { min-width:44px; text-align:right; font-variant-numeric:tabular-nums; }
#handle-hint { margin:4px 0 0; color:var(--muted); }
@media (max-width:600px) {
  .support-tool { gap:3px 6px; }
  #support-caption { flex-basis:100%; min-height:2.75em; font-size:11px; line-height:1.35; }
  .handle-axes { gap:6px; }
  .handle-axes label { gap:3px; }
  .handle-axes output { min-width:36px; }
}

.take-review { margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--line); }
.take-heading, .take-scrub { display: flex; align-items: center; gap: 9px; }
.take-heading { justify-content: space-between; font-size: 13px; font-weight: 600; }
.take-heading output { font-size: 12px; font-variant-numeric: tabular-nums; color: #65705c; }
.take-scrub { margin: 8px 0; }
.take-scrub input { flex: 1; min-width: 30px; accent-color: #6c795e; }
.take-scrub button, .take-marks button { border: 1px solid var(--line); border-radius: 5px; background: #fafaf6; font: inherit; color: #4c5545; cursor: pointer; }
.take-scrub button { padding: 2px 8px; font-size: 12px; }
.take-scrub button:disabled { opacity: .5; }
.take-marks { display: flex; flex-wrap: wrap; gap: 5px; }
.take-marks button { font-size: 12px; padding: 3px 7px; }
.take-marks button[aria-current=true] { background: #e5eadb; border-color: #96a487; }
