/*! MorphonLink | Copyright (c) 2026 Zumasa. Original portions only: LICENSE.txt. Third-party materials: ASSET_LICENSES.md. */
:root {
  color-scheme: light;
  --bg: #f5f4ef;
  --paper: #fffdf8;
  --ink: #24201c;
  --muted: #716a61;
  --line: #d6d0c6;
  --bone: #e7ddc9;
  --bone-line: #826f55;
  --muscle: #cf5d49;
  --muscle-deep: #8f3e52;
  --nerve: #2f7a7b;
  --joint: #39699b;
  --active: #1f5f68;
  --active-soft: #dceff0;
  --related: #e7a640;
  --pose: #39699b;
  --shadow: 0 18px 60px rgba(43, 36, 26, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  overflow: visible;
}

body {
  margin: 0;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(31, 95, 104, 0.08), transparent 34%),
    radial-gradient(circle at 92% 8%, rgba(207, 93, 73, 0.13), transparent 28%),
    var(--bg);
  color: var(--ink);
  font-family:
    "Yu Gothic UI",
    "Hiragino Kaku Gothic ProN",
    Meiryo,
    system-ui,
    sans-serif;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button,
summary,
[role="button"],
[role="tab"],
.pose3d-panel {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

input,
textarea,
[contenteditable]:not([contenteditable="false"]) {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

.app-shell {
  width: min(1920px, 100%);
  height: 100dvh;
  margin: 0 auto;
  padding: 8px 20px 8px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 0 2px 6px;
}

.brand-row {
  display: flex;
  align-items: end;
  gap: 18px;
  flex-wrap: wrap;
}

.brand-copy {
  display: grid;
  gap: 0;
}

.eyebrow,
.section-label {
  margin: 0;
  color: var(--active);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 2.5vw, 2.35rem);
  line-height: 1.15;
}

h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 12px;
  flex-wrap: wrap;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, minmax(46px, 1fr));
  gap: 4px;
  width: 250px;
  max-width: 100%;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.82);
}

.mode-btn {
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  font-weight: 800;
}

.mode-btn.is-active {
  color: white;
}

.mode-btn[data-mode="bones"] {
  color: var(--bone-line);
}

.mode-btn[data-mode="muscles"] {
  color: var(--muscle);
}

.mode-btn[data-mode="links"] {
  color: #9a6b18;
}

.mode-btn[data-mode="pose"] {
  color: var(--pose);
}

.mode-btn[data-mode="bones"].is-active {
  background: var(--bone-line);
  color: white;
}

.mode-btn[data-mode="muscles"].is-active {
  background: var(--muscle);
  color: white;
}

.mode-btn[data-mode="links"].is-active {
  background: var(--related);
  color: white;
}

.mode-btn[data-mode="pose"].is-active {
  background: var(--pose);
  color: white;
}

.variant-toggle {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(50px, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.82);
}


.variant-btn,
.proportion-btn {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 900;
}


.variant-btn.is-active,
.proportion-btn.is-active {
  background: var(--active);
  color: white;
}

.search {
  display: grid;
  grid-template-columns: auto minmax(230px, 320px);
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.search input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: rgba(255, 253, 248, 0.92);
  color: var(--ink);
}

.table-search {
  grid-template-columns: minmax(0, 1fr);
  max-width: none;
  min-width: 0;
  margin-left: 0;
  font-size: 0.78rem;
}

.table-search span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.table-search input {
  min-height: 32px;
  border-radius: 7px;
  padding: 0 9px;
  font-size: 0.82rem;
}

.focus-toggle,
.focus-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.82);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.focus-toggle input,
.focus-switch input {
  width: 16px;
  height: 16px;
  accent-color: var(--active);
}

.focus-switch {
  min-height: 38px;
  justify-content: space-between;
  width: max-content;
}

.focus-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.focus-switch span {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.focus-switch span::before {
  content: "";
  width: 34px;
  height: 19px;
  border-radius: 999px;
  background: rgba(36, 32, 28, 0.18);
  box-shadow: inset 0 0 0 1px rgba(36, 32, 28, 0.12);
}

.focus-switch span::after {
  content: "";
  position: absolute;
  left: 3px;
  width: 13px;
  height: 13px;
  border-radius: 999px;
  background: white;
  box-shadow: 0 1px 5px rgba(36, 32, 28, 0.25);
  transition: transform 140ms ease;
}

.focus-switch input:checked + span::before {
  background: var(--active);
}

.focus-switch input:checked + span::after {
  transform: translateX(15px);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(260px, 292px) minmax(680px, 1fr);
  gap: 0;
  align-items: stretch;
  min-height: 0;
  overflow: visible;
  transition: grid-template-columns 180ms ease, gap 180ms ease;
}

.workspace.is-left-pane-collapsed {
  grid-template-columns: 0 minmax(680px, 1fr);
  gap: 0;
}

.app-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  min-height: 20px;
  padding: 5px 2px 0;
}

.app-copyright {
  color: var(--muted);
  font-size: 0.68rem;
  white-space: nowrap;
}

.attribution {
  position: relative;
  justify-self: end;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.15;
}

.attribution a {
  color: var(--active);
}

.attribution-label {
  cursor: help;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}

.attribution-details {
  position: absolute;
  right: 0;
  bottom: calc(100% + 7px);
  z-index: 20;
  display: block;
  width: max-content;
  max-width: min(560px, 72vw);
  padding: 8px 10px;
  border: 1px solid rgba(36, 32, 28, 0.12);
  border-radius: 6px;
  background: rgba(255, 253, 248, 0.96);
  box-shadow: var(--shadow);
  color: var(--muted);
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition:
    opacity 120ms ease,
    transform 120ms ease;
}

.attribution:hover .attribution-details,
.attribution:focus-within .attribution-details {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.diagram-area,
.data-area {
  min-width: 0;
  min-height: 0;
}

.diagram-area {
  display: grid;
  gap: 0;
  grid-column: 2;
  grid-row: 1;
  overflow: hidden;
}

.detail-panel,
.table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.88);
  box-shadow: var(--shadow);
}

.selection-badge {
  max-width: 44%;
  border-radius: 999px;
  background: var(--active-soft);
  color: #174d55;
  padding: 8px 12px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.diagram-stage {
  position: relative;
  height: 100%;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.95), rgba(246, 241, 232, 0.9)),
    repeating-linear-gradient(0deg, transparent, transparent 31px, rgba(36, 32, 28, 0.035) 32px);
  box-shadow: var(--shadow);
}

.diagram-stage.is-3d {
  overflow: hidden;
}

.diagram-stage.is-3d .diagram-layout {
  min-height: 100%;
}

.diagram-stage.is-3d .figure-panel,
.diagram-stage.is-3d .viewer3d-panel {
  min-height: 100%;
}

.diagram-layout {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(300px, 1fr);
  gap: 10px;
  height: 100%;
  padding: 12px;
}

.diagram-layout.single {
  grid-template-columns: minmax(0, 1fr);
  justify-content: stretch;
}

.diagram-layout.stacked {
  grid-template-columns: minmax(0, 1fr);
  justify-content: stretch;
}

.figure-panel {
  position: relative;
  min-height: 508px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.48);
}

.overlay-panel {
  background: rgba(255, 255, 255, 0.64);
}

.figure-panel svg {
  width: 100%;
  height: 100%;
  min-height: 480px;
  display: block;
}

.viewer3d-panel {
  min-height: 508px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.88), rgba(238, 232, 220, 0.78)),
    radial-gradient(circle at 50% 38%, rgba(31, 95, 104, 0.12), transparent 42%);
}

.viewer3d-controls {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  justify-items: start;
  width: 320px;
  max-width: calc(100% - 24px);
}

.viewer3d-controls:empty {
  display: none;
}

.viewer3d {
  position: absolute;
  inset: 0;
  overscroll-behavior: contain;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.viewer3d canvas {
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  -webkit-user-select: none;
}

.viewport-orientation {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 8;
  width: 84px;
  height: 84px;
  pointer-events: none;
  user-select: none;
}

.viewport-orientation.is-docked {
  position: relative;
  inset: auto;
}

.viewport-orientation canvas {
  display: block;
  width: 84px;
  height: 84px;
}

.viewport-orientation-slot {
  position: relative;
  width: 64px;
  height: 40px;
  pointer-events: none;
}

.viewport-mode-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px;
  align-items: center;
  gap: 6px;
  width: 320px;
  max-width: 100%;
}

.viewport-orientation-slot .viewport-orientation {
  position: absolute;
  left: 0;
  top: 50%;
  width: 64px;
  height: 64px;
  transform: translateY(-50%);
}

.viewport-orientation-slot canvas {
  width: 100%;
  height: 100%;
}

.pose-mode-overlay .viewport-mode-row .segmented,
.viewer3d-controls .viewport-mode-row .segmented {
  width: 100%;
  min-width: 0;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.pose-viewer.is-lights-off {
  background: #000;
}

.pose-axis-guide {
  position: absolute;
  z-index: 8;
  width: 148px;
  height: 64px;
  color: #cc4148;
  pointer-events: none;
  font-size: 12px;
  font-weight: 800;
}

.pose-axis-guide[hidden] { display: none; }
.pose-axis-guide[data-axis="y"] { color: #24884d; }
.pose-axis-guide[data-axis="z"] { color: #2867cf; }

.pose-axis-guide-value {
  width: max-content;
  max-width: 148px;
  margin: 0 auto;
  padding: 3px 5px;
  border: 1px solid currentColor;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.96);
  text-align: center;
  line-height: 16px;
}

.pose-axis-guide-track {
  position: absolute;
  left: 39px;
  top: 47px;
  width: 70px;
  height: 2px;
  background: currentColor;
  transform-origin: 35px 1px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.8);
}

.pose-axis-guide-track::before,
.pose-axis-guide-track::after {
  position: absolute;
  top: -4px;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  content: "";
}

.pose-axis-guide-track::before { left: -1px; border-right: 7px solid currentColor; }
.pose-axis-guide-track::after { right: -1px; border-left: 7px solid currentColor; }

.pose-axis-guide-plus,
.pose-axis-guide-minus {
  position: absolute;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%);
  line-height: 1;
}

.pose-viewer.is-lights-off canvas {
  filter:
    drop-shadow(0 0 5px rgba(133, 255, 153, 0.9))
    drop-shadow(0 0 17px rgba(75, 255, 117, 0.64));
}

.pose-viewer.is-lights-off[data-blue-glow="true"] canvas {
  filter:
    drop-shadow(0 0 5px rgba(224, 246, 255, 0.45))
    drop-shadow(0 0 17px rgba(235, 248, 255, 0.28));
}

.pose-light-handle {
  position: absolute;
  z-index: 18;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 2px solid #a76512;
  border-radius: 50%;
  background: #fff7db;
  color: #a76512;
  box-shadow: 0 2px 9px rgba(64, 41, 10, 0.28);
  cursor: grab;
  font-size: 1.3rem;
  line-height: 1;
  touch-action: none;
  user-select: none;
  transform: translate(-50%, -50%);
}

.pose-light-handle[hidden] {
  display: none;
}

.pose-light-handle:active {
  cursor: grabbing;
}

.is-touch-layout .pose-light-handle {
  width: 44px;
  height: 44px;
}

.pose-image-landmark-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0.96;
}

.pose-image-bone-line {
  stroke: rgba(231, 166, 64, 0.9);
  stroke-width: 5.5;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 1px 3px rgba(36, 32, 28, 0.22));
}

.pose-image-landmark {
  fill: #fff6d2;
  stroke: #e7a640;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 1px 3px rgba(36, 32, 28, 0.26));
}

.pose-image-landmark.is-head {
  fill: #fffdf8;
}

.pose-image-drop-hint {
  position: absolute;
  inset: 72px 72px;
  z-index: 8;
  display: grid;
  place-items: center;
  border: 2px dashed rgba(231, 166, 64, 0.75);
  border-radius: 18px;
  background: rgba(255, 253, 248, 0.6);
  color: var(--pose);
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1.55;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.985);
  transition: opacity 140ms ease, transform 140ms ease;
  backdrop-filter: blur(4px);
}

.pose-image-drop-hint small {
  color: var(--muted);
  font-size: 0.78rem;
}

.pose3d-panel.is-pose-image-dragover .pose-image-drop-hint,
.pose3d-panel.is-pose-image-processing .pose-image-drop-hint {
  opacity: 1;
  transform: scale(1);
}

.pose-image-toolbar {
  display: grid;
  gap: 4px;
  width: 132px;
  pointer-events: auto;
}

.pose-image-status {
  max-width: 100%;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.86);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.25;
  pointer-events: none;
  backdrop-filter: blur(5px);
}

.pose-image-status[data-tone="busy"] {
  color: var(--pose);
}

.pose-image-status[data-tone="ok"] {
  color: var(--active);
}

.pose-image-status[data-tone="error"] {
  color: var(--muscle-deep);
  border-color: rgba(143, 62, 82, 0.28);
}

.pose-image-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-start;
}

.pose-image-actions[hidden] {
  display: none;
}

.pose-image-actions button {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(57, 105, 155, 0.22);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--pose);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 900;
  cursor: pointer;
}

.viewer3d-label-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.viewer3d-attachment-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  overflow: visible;
}

.attachment-flow {
  fill: none;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.86;
}

.attachment-flow.is-origin {
  stroke: rgba(231, 166, 64, 0.9);
  stroke-dasharray: 5 5;
}

.attachment-flow.is-insertion {
  stroke: rgba(154, 43, 36, 0.82);
}

.attachment-arrow-head {
  fill: rgba(154, 43, 36, 0.86);
}

.attachment-zone circle {
  fill: rgba(255, 253, 248, 0.82);
  stroke-width: 3;
  filter: drop-shadow(0 4px 10px rgba(36, 32, 28, 0.18));
}

.attachment-zone.is-origin circle {
  stroke: var(--related);
}

.attachment-zone.is-insertion circle {
  stroke: var(--muscle-deep);
}

.attachment-zone text,
.attachment-note {
  fill: var(--ink);
  paint-order: stroke;
  stroke: rgba(255, 253, 248, 0.92);
  stroke-width: 4px;
  stroke-linejoin: round;
  font-size: 0.74rem;
  font-weight: 900;
}

.attachment-note {
  fill: var(--muscle-deep);
}

.viewer3d-label-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  overflow: visible;
}

.viewer3d-label-lines[hidden] {
  display: none;
}

.viewer3d-label-line {
  stroke: rgba(36, 32, 28, 0.42);
  stroke-width: 1.3;
  stroke-linecap: round;
}

.viewer3d-label-line.is-muscle {
  stroke: rgba(154, 43, 36, 0.78);
}

.viewer3d-label-line.is-bone {
  stroke: rgba(130, 111, 85, 0.52);
}

.viewer3d-label {
  position: absolute;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(36, 32, 28, 0.45);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.92);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
  pointer-events: auto;
  cursor: pointer;
  transform: translate(-50%, -50%);
  box-shadow: 0 7px 18px rgba(36, 32, 28, 0.14);
  transition:
    background-color 120ms ease,
    border-color 120ms ease,
    color 120ms ease,
    box-shadow 120ms ease,
    transform 120ms ease;
}

.viewer3d-label.is-bone {
  border-color: rgba(130, 111, 85, 0.72);
}

.viewer3d-label.is-muscle {
  border-color: rgba(207, 93, 73, 0.8);
}

.viewer3d-label.is-selected {
  background: var(--active);
  border-color: var(--active);
  color: white;
}

.viewer3d-label.is-related {
  background: #ffe1a5;
  border-color: var(--related);
}

.viewer3d-label:hover {
  box-shadow: 0 10px 24px rgba(36, 32, 28, 0.22);
  transform: translate(-50%, -50%) scale(1.08);
}

.viewer3d-label.is-bone:hover {
  background: var(--bone-line);
  border-color: var(--bone-line);
  color: white;
}

.viewer3d-label.is-muscle:hover {
  background: var(--muscle);
  border-color: var(--muscle);
  color: white;
}

.viewer3d-label.is-related:hover {
  background: var(--related);
  border-color: var(--related);
  color: white;
}

.viewer3d-label.is-selected:hover {
  background: var(--active);
  border-color: var(--active);
  color: white;
}

.viewer3d-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 900;
}

.viewer3d-meta {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 5;
  display: grid;
  gap: 8px;
  justify-items: start;
}

.viewer3d-legend {
  padding: 9px 10px;
  border: 1px solid rgba(36, 32, 28, 0.12);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.82);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  backdrop-filter: blur(8px);
}

.viewer3d-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  width: max-content;
}

.pose-controls {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 8;
  display: grid;
  width: 104px;
  gap: 6px;
  pointer-events: auto;
}

.pose-btn {
  min-height: 32px;
  width: 100%;
  border: 1px solid rgba(57, 105, 155, 0.22);
  border-radius: 6px;
  background: rgba(255, 253, 248, 0.72);
  color: var(--pose);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0 10px;
  backdrop-filter: blur(6px);
}

.pose-btn.is-active {
  background: var(--pose);
  color: white;
}

.joint-control-panel {
  --joint-panel-action-col: 30px;
  --joint-panel-tab-col: 49px;
  --joint-panel-side-col: 47px;
  --joint-panel-gap: 3px;
  --joint-panel-inner-width: 310px;
  position: absolute;
  left: 128px;
  bottom: 12px;
  z-index: 8;
  display: grid;
  grid-template-rows: auto auto;
  gap: 8px;
  width: calc(var(--joint-panel-inner-width) + 24px);
  max-height: min(430px, calc(100% - 96px));
  overflow: hidden;
  scrollbar-gutter: auto;
  padding: 10px 12px;
  border: 1px solid rgba(72, 72, 66, 0.16);
  border-radius: 6px;
  background: rgba(255, 253, 248, 0.9);
  box-shadow: 0 8px 22px rgba(56, 52, 44, 0.08);
  backdrop-filter: blur(8px);
  pointer-events: auto;
}

.joint-control-panel.is-collapsed {
  display: block;
}

.joint-sheet-grabber {
  display: none;
}

.joint-control-row {
  display: grid;
  align-items: center;
}

.joint-panel-tabs {
  position: relative;
  --joint-part-grid-gap: var(--joint-panel-gap);
  display: grid;
  grid-template-columns: repeat(5, var(--joint-panel-tab-col));
  grid-template-rows: repeat(2, 26px);
  gap: var(--joint-panel-gap);
}

.joint-panel-side-mark {
  position: absolute;
  z-index: 1;
  top: 50%;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: #fff;
  color: #39699b;
  font: 700 10px/1 system-ui, sans-serif;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.joint-panel-side-mark.is-right { left: calc(20% - var(--joint-part-grid-gap) * 0.3); }
.joint-panel-side-mark.is-left { left: calc(80% + var(--joint-part-grid-gap) * 0.3); color: #1f5f68; }

.joint-panel-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  min-height: 26px;
  padding: 0 4px;
  border: 1px solid rgba(57, 105, 155, 0.2);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--pose);
  cursor: pointer;
  font-size: 0.6rem;
  font-weight: 800;
}

.joint-panel-tab.is-active {
  background: var(--pose);
  color: white;
}

.joint-panel-tab[data-joint-panel="rightHand"],
.joint-panel-tab[data-joint-panel="rightUpper"],
.joint-panel-tab[data-joint-panel="rightFoot"],
.joint-panel-tab[data-joint-panel="rightLower"] {
  border-color: rgba(57, 105, 155, 0.28);
  color: #39699b;
}

.joint-panel-tab[data-joint-panel="leftHand"],
.joint-panel-tab[data-joint-panel="leftUpper"],
.joint-panel-tab[data-joint-panel="leftFoot"],
.joint-panel-tab[data-joint-panel="leftLower"] {
  border-color: rgba(31, 95, 104, 0.28);
  color: #1f5f68;
}

.joint-panel-tab[data-joint-panel="trunkPelvis"] {
  border-color: rgba(154, 107, 24, 0.28);
  color: #9a6b18;
}

.joint-panel-tab[data-joint-panel="head"] {
  border-color: rgba(207, 93, 73, 0.28);
  color: #a54c3b;
}

.joint-panel-tab[data-joint-panel].is-active {
  color: white;
}

.joint-panel-tab[data-joint-panel="rightHand"].is-active,
.joint-panel-tab[data-joint-panel="rightUpper"].is-active,
.joint-panel-tab[data-joint-panel="rightFoot"].is-active,
.joint-panel-tab[data-joint-panel="rightLower"].is-active {
  background: #39699b;
}

.joint-panel-tab[data-joint-panel="leftHand"].is-active,
.joint-panel-tab[data-joint-panel="leftUpper"].is-active,
.joint-panel-tab[data-joint-panel="leftFoot"].is-active,
.joint-panel-tab[data-joint-panel="leftLower"].is-active {
  background: #1f5f68;
}

.joint-panel-tab[data-joint-panel="trunkPelvis"].is-active {
  background: #9a6b18;
}

.joint-panel-tab[data-joint-panel="head"].is-active {
  background: #a54c3b;
}

.joint-panel-body {
  display: grid;
  gap: 0;
  width: 100%;
  max-width: 100%;
  min-height: 0;
  overflow: visible;
  padding-right: 0;
}

.joint-control-panel:has(.scapula-axis-edit.is-active) {
  max-height: min(600px, calc(100% - 96px));
}

.scapula-axis-edit {
  display: grid;
  gap: 5px;
  margin-bottom: 5px;
}

.scapula-axis-edit-toggle,
.scapula-axis-keyframe {
  min-height: 26px;
  border: 1px solid rgba(57, 105, 155, 0.28);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.56);
  color: #39699b;
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 800;
}

.scapula-axis-edit-toggle.is-active,
.scapula-axis-keyframe.is-active {
  background: #39699b;
  color: white;
}

.scapula-axis-keyframes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.trunk-scapula-side-tabs {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.trunk-scapula-mirror-btn {
  min-height: 24px;
}

.scapula-axis-group {
  margin-bottom: 0;
}

.joint-panel-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
  gap: 5px;
  width: 100%;
  min-width: 0;
}

.hand-gesture-tools {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 30px 56px;
  align-items: stretch;
  gap: 4px;
  width: 100%;
  min-width: 0;
}

.hand-gesture-presets {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3px;
  flex: 1 1 auto;
  min-width: 0;
}

.hand-gesture-presets.is-paged {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, 24px);
  align-self: stretch;
}

.hand-gesture-item {
  position: relative;
  min-width: 0;
}

.hand-gesture-placeholder {
  min-width: 0;
  min-height: 24px;
}

.whole-body-presets {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.hand-gesture-btn {
  width: 100%;
  min-width: 0;
  min-height: 24px;
  padding: 0 3px;
  overflow: hidden;
  border: 1px solid rgba(57, 105, 155, 0.2);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.5);
  color: #39699b;
  cursor: pointer;
  font-size: 0.56rem;
  font-weight: 800;
  text-overflow: clip;
  white-space: nowrap;
}

.hand-gesture-btn[draggable="true"] {
  cursor: grab;
}

.hand-gesture-btn[draggable="true"]:active {
  cursor: grabbing;
}

.hand-gesture-btn.is-dragging {
  opacity: 0.42;
}

.hand-gesture-btn.is-drop-before {
  box-shadow: inset 2px 0 0 #a96f0d, 0 0 0 1px rgba(169, 111, 13, 0.18);
}

.hand-gesture-btn.is-drop-after {
  box-shadow: inset -2px 0 0 #a96f0d, 0 0 0 1px rgba(169, 111, 13, 0.18);
}

.hand-gesture-btn.is-active {
  border-color: #39699b;
  background: #39699b;
  color: white;
}

.hand-gesture-item.is-editing .hand-gesture-btn {
  padding-right: 18px;
}

.hand-gesture-delete-btn {
  position: absolute;
  top: -4px;
  right: -4px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid rgba(207, 93, 73, 0.45);
  border-radius: 50%;
  background: rgba(255, 253, 248, 0.94);
  color: #a54c3b;
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(56, 52, 44, 0.12);
}

.hand-gesture-delete-btn:disabled {
  border-color: rgba(72, 72, 66, 0.18);
  color: rgba(72, 72, 66, 0.45);
  cursor: not-allowed;
}

.hand-preset-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 3px;
}

.hand-preset-page-btn {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 1px solid rgba(154, 107, 24, 0.28);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.58);
  color: #9a6b18;
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 900;
}

.hand-preset-page-btn:disabled {
  color: rgba(154, 107, 24, 0.32);
  cursor: default;
}

.hand-preset-page-next {
  grid-template-rows: 1fr auto;
  padding: 5px 0 3px;
}

.hand-preset-page-next small {
  font-size: 0.5rem;
  font-weight: 900;
  line-height: 1;
}

.hand-preset-action-btn {
  min-width: 0;
  min-height: 24px;
  padding: 0 4px;
  overflow: hidden;
  border: 1px solid rgba(154, 107, 24, 0.28);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.58);
  color: #9a6b18;
  cursor: pointer;
  font-size: 0.58rem;
  font-weight: 800;
  text-overflow: clip;
  white-space: nowrap;
}

.hand-preset-action-btn:active {
  background: rgba(154, 107, 24, 0.16);
}

.hand-preset-action-btn.is-active {
  border-color: #9a6b18;
  background: #9a6b18;
  color: white;
}

.joint-mirror-toggle {
  flex: 0 0 auto;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(57, 105, 155, 0.22);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--pose);
  cursor: pointer;
  font-size: 0.66rem;
  font-weight: 800;
}

.joint-mirror-toggle.is-active {
  background: var(--pose);
  color: white;
}

.joint-panel-empty {
  display: grid;
  gap: 5px;
  min-height: 150px;
  align-content: center;
  color: #68645d;
  font-size: 0.72rem;
  text-align: center;
}

.joint-panel-empty strong {
  color: var(--pose);
  font-size: 0.82rem;
}

.joint-reset-btn {
  width: 30px;
  height: 26px;
  border: 1px solid rgba(57, 105, 155, 0.2);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--pose);
  cursor: pointer;
  font-size: 1rem;
}

.joint-panel-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  justify-content: start;
  gap: var(--joint-panel-gap);
  width: 100%;
  max-width: 100%;
}

.joint-panel-footer .joint-panel-tabs {
  width: 100%;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(2, 32px);
}

.joint-panel-footer .joint-panel-tabs .joint-panel-tab {
  padding-inline: 1px;
  font-size: 0.56rem;
  white-space: nowrap;
  position: relative;
}

.joint-panel-footer .joint-panel-tab {
  flex-direction: column;
  gap: 0;
  height: 32px;
  min-height: 32px;
  padding: 0 1px;
}

.pose3d-panel .joint-part-icon {
  display: block;
  flex: 0 0 auto;
  width: 22px;
  height: 24px;
  min-height: 0;
  max-height: 24px;
  pointer-events: none;
}

.pose3d-panel .joint-panel-tab[data-joint-panel="trunkPelvis"] .joint-part-icon { width: 28px; }

.joint-part-label { font-size: 10px; line-height: 12px; white-space: nowrap; pointer-events: none; }

.joint-panel-tab.is-locked {
  border-color: rgba(222, 146, 36, 0.72);
  background: rgba(255, 213, 132, 0.42);
  color: #754b09;
}

.joint-panel-lock-mark {
  position: absolute;
  right: 1px;
  top: 1px;
  font-size: 0.48rem;
  line-height: 1;
  pointer-events: none;
}

.joint-panel-tab.is-lock-limited { outline: 2px solid #bd8832; outline-offset: -2px; }
.joint-control-row input:disabled { opacity: 0.5; cursor: not-allowed; }

.joint-panel-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: 28px;
  gap: var(--joint-panel-gap);
  width: 100%;
}

.joint-panel-footer .joint-panel-actions > button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: 100%;
  min-width: 0;
  height: 28px;
  min-height: 28px;
  padding: 0 1px;
  border: 1px solid rgba(57, 105, 155, 0.2);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--pose);
  cursor: pointer;
}

.joint-panel-footer .joint-panel-actions > .is-active { color: white; background: var(--pose); border-color: var(--pose); }
.pose3d-panel .joint-panel-actions svg { width: 18px; height: 18px; min-height: 0; max-height: 18px; flex: 0 0 auto; pointer-events: none; }

.joint-panel-toggle {
  min-height: 26px;
  border: 1px solid rgba(57, 105, 155, 0.2);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--pose);
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 800;
}

.joint-panel-toggle.wide {
  width: 38px;
  min-height: 86px;
  padding: 8px 0;
  background: rgba(255, 253, 248, 0.82);
  backdrop-filter: blur(6px);
  writing-mode: vertical-rl;
  letter-spacing: 0.08em;
}

.joint-control-row {
  grid-template-columns: 24px 34px minmax(0, 1fr) 34px 44px;
  gap: 4px;
  width: 100%;
  min-height: 28px;
  font-size: 0.68rem;
}

.joint-control-row label {
  font-weight: 700;
}

.joint-control-row-group {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 5px;
  align-items: stretch;
  width: 100%;
  margin-bottom: 2px;
  padding: 5px;
  border: 1px solid rgba(57, 105, 155, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.34);
}

.joint-control-group-label {
  display: grid;
  align-items: center;
  justify-items: center;
  color: #2f3638;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  text-orientation: upright;
  writing-mode: vertical-rl;
}

.joint-control-group-rows {
  display: grid;
  gap: 0;
  min-width: 0;
}

.joint-control-row.is-grouped {
  grid-template-columns: 34px minmax(0, 1fr) 34px 44px;
}

.joint-control-row.is-grouped.has-control-label {
  grid-template-columns: 25px 22px minmax(0, 1fr) 22px 44px;
}

.whole-body-control-label {
  color: #2f3638;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.joint-control-group-rows.has-row-labels .joint-control-direction {
  text-align: center;
}

.joint-control-direction {
  color: #68645d;
  text-align: right;
  white-space: nowrap;
}

.joint-control-direction.end {
  text-align: left;
}

.joint-control-row.is-condensed-directions .joint-control-direction {
  display: inline-block;
  transform: scaleX(0.8);
}

.joint-control-row.is-condensed-directions .joint-control-direction:not(.end) {
  transform-origin: right center;
}

.joint-control-row.is-condensed-directions .joint-control-direction.end {
  transform-origin: left center;
}

.joint-control-row input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 28px;
  margin: -5px 0;
  background: transparent;
  cursor: pointer;
  touch-action: none;
}

.joint-control-row.is-reversed input[type="range"] {
  direction: rtl;
}

.joint-control-row input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background:
    linear-gradient(
      to right,
      transparent 0,
      transparent calc(var(--range-zero, 0%) - 1px),
      rgba(35, 42, 43, 0.48) calc(var(--range-zero, 0%) - 1px),
      rgba(35, 42, 43, 0.48) calc(var(--range-zero, 0%) + 1px),
      transparent calc(var(--range-zero, 0%) + 1px),
      transparent 100%
    ),
    linear-gradient(
      to right,
      #d7d9d8 0,
      #d7d9d8 var(--range-fill-start, var(--range-progress)),
      var(--pose) var(--range-fill-start, var(--range-progress)),
      var(--pose) var(--range-fill-end, var(--range-progress)),
      #d7d9d8 var(--range-fill-end, var(--range-progress)),
      #d7d9d8 100%
    );
}

.joint-control-row input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -7px;
  border: 2px solid var(--pose);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(35, 42, 43, 0.18);
}

.joint-control-row input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background:
    linear-gradient(
      to right,
      transparent 0,
      transparent calc(var(--range-zero, 0%) - 1px),
      rgba(35, 42, 43, 0.48) calc(var(--range-zero, 0%) - 1px),
      rgba(35, 42, 43, 0.48) calc(var(--range-zero, 0%) + 1px),
      transparent calc(var(--range-zero, 0%) + 1px),
      transparent 100%
    ),
    linear-gradient(
      to right,
      #d7d9d8 0,
      #d7d9d8 var(--range-fill-start, var(--range-progress)),
      var(--pose) var(--range-fill-start, var(--range-progress)),
      var(--pose) var(--range-fill-end, var(--range-progress)),
      #d7d9d8 var(--range-fill-end, var(--range-progress)),
      #d7d9d8 100%
    );
}

.joint-control-row input[type="range"]::-moz-range-progress {
  background: transparent;
}

.joint-control-row input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 2px solid var(--pose);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(35, 42, 43, 0.18);
}

.joint-control-number {
  width: 44px;
  height: 24px;
  border: 1px solid rgba(57, 105, 155, 0.2);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.68rem;
  text-align: right;
}

.viewer3d-options {
  display: grid;
  gap: 6px;
  justify-items: start;
  width: max-content;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  user-select: none;
  -webkit-user-select: none;
}

.viewer3d-options .focus-switch {
  min-height: 28px;
  width: auto;
  padding: 0;
  border: 0;
  background: transparent;
}

.muscle-display-controls {
  display: grid;
  gap: 6px;
  justify-items: start;
  width: max-content;
}

.muscle-display-controls .colorize-switch {
  min-height: 26px;
  padding: 0;
  border: 0;
  background: transparent;
}

.layer-toggle {
  display: grid;
  grid-template-columns: repeat(4, minmax(38px, 1fr));
  gap: 3px;
  padding: 3px;
  border: 1px solid rgba(36, 32, 28, 0.14);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.78);
  backdrop-filter: blur(7px);
}

.layer-btn {
  min-height: 25px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 900;
  white-space: nowrap;
}

.layer-btn.is-active {
  background: var(--muscle);
  color: white;
}

.viewer3d-status {
  min-width: 0;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 500;
  line-height: 1.15;
  opacity: 0.72;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.viewer3d-status:empty {
  min-height: 1em;
}

.viewer3d-status strong {
  color: var(--ink);
  font-weight: 600;
}

.viewer3d-progress {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 78px;
  z-index: 4;
  border: 1px solid rgba(36, 32, 28, 0.12);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.86);
  padding: 9px 10px;
  backdrop-filter: blur(8px);
}

.viewer3d-progress[hidden] {
  display: none;
}

.viewer3d-progress-track {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(36, 32, 28, 0.1);
}

.viewer3d-progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--active);
  transition: width 140ms ease;
}

.viewer3d-progress[data-indeterminate="true"] .viewer3d-progress-track span {
  width: 36%;
  animation: pose-loading-sweep 1.15s ease-in-out infinite;
  transition: none;
}

@keyframes pose-loading-sweep {
  from { transform: translateX(-100%); }
  to { transform: translateX(278%); }
}

.pose-viewer > canvas:not(.pose-first-frame) {
  opacity: 0;
}

.pose-viewer canvas.pose-first-frame {
  animation: pose-first-frame 650ms ease-in-out both;
}

@keyframes pose-first-frame {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .viewer3d-progress[data-indeterminate="true"] .viewer3d-progress-track span,
  .pose-viewer canvas.pose-first-frame { animation: none; }
  .viewer3d-progress-track span { transition: none; }
}

.viewer3d-progress p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.viewer3d-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  display: inline-block;
  box-shadow: inset 0 0 0 1px rgba(36, 32, 28, 0.2);
}

.viewer3d-dot.bone {
  background: #e7ddc9;
}

.viewer3d-dot.muscle {
  background: #cf5d49;
}

.viewer3d-dot.selected {
  background: #1f5f68;
}

.viewer3d-dot.related {
  background: #e7a640;
}

.figure-caption {
  position: absolute;
  top: 12px;
  left: 12px;
  color: var(--muted);
  font-weight: 900;
  font-size: 0.86rem;
}

.view-title {
  fill: var(--muted);
  font-size: 18px;
  font-weight: 900;
  text-anchor: middle;
}

.bone-shape {
  fill: var(--bone);
  stroke: var(--bone-line);
  stroke-width: 4.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  cursor: pointer;
  transition: fill 160ms ease, stroke 160ms ease, opacity 160ms ease;
}

.bone-shape.related {
  fill: #ffe1a5;
  stroke: var(--related);
}

.bone-shape.selected {
  fill: #a6d8dd;
  stroke: var(--active);
}

.bone-line {
  fill: none;
}

.bone-line.heavy {
  stroke-width: 7;
}

.bone-hole {
  fill: rgba(255, 253, 248, 0.88);
  stroke: rgba(130, 111, 85, 0.8);
  stroke-width: 2.4;
}

.skeleton-guide {
  fill: rgba(36, 32, 28, 0.025);
  stroke: rgba(36, 32, 28, 0.09);
  stroke-width: 2;
}

.muscle-shape {
  fill: rgba(207, 93, 73, 0.56);
  stroke: #772e36;
  stroke-width: 2.6;
  cursor: pointer;
  transition: opacity 160ms ease, fill 160ms ease, stroke 160ms ease;
}

.muscle-shape.region-head {
  fill: rgba(47, 122, 123, 0.54);
}

.muscle-shape.region-trunk {
  fill: rgba(207, 93, 73, 0.6);
}

.muscle-shape.region-arm {
  fill: rgba(219, 137, 52, 0.58);
}

.muscle-shape.region-leg {
  fill: rgba(74, 111, 166, 0.55);
}

.muscle-shape.related {
  opacity: 0.92;
  stroke: var(--related);
  stroke-width: 4;
}

.muscle-shape.selected {
  fill: rgba(31, 95, 104, 0.74);
  stroke: #123f45;
  stroke-width: 5;
}

.overlay-skeleton .skeleton-guide {
  fill: rgba(36, 32, 28, 0.018);
  stroke: rgba(36, 32, 28, 0.08);
}

.overlay-skeleton .bone-shape {
  opacity: 0.7;
}

.overlay-skeleton .bone-shape.selected,
.overlay-skeleton .bone-shape.related {
  opacity: 1;
  stroke-width: 5;
}

.overlay-muscles .muscle-shape {
  opacity: 0.16;
}

.overlay-muscles .muscle-shape.selected,
.overlay-muscles .muscle-shape.related {
  opacity: 0.82;
  mix-blend-mode: multiply;
}

.muscle-asset-layer image {
  opacity: 0.92;
}

.asset-backed .muscle-shape:not(.selected):not(.related) {
  fill: rgba(207, 93, 73, 0.08);
  stroke: rgba(119, 46, 54, 0.12);
  stroke-width: 1.2;
}

.asset-backed .muscle-shape:not(.selected):not(.related) .muscle-fiber {
  opacity: 0;
}

.overlay-panel .muscle-asset-layer image {
  opacity: 0.42;
  mix-blend-mode: multiply;
}

.overlay-markers .marker circle {
  filter: drop-shadow(0 2px 5px rgba(36, 32, 28, 0.18));
}

.muscle-shape path {
  vector-effect: non-scaling-stroke;
}

.surface-muscle {
  fill: rgba(207, 93, 73, 0.42);
  stroke: rgba(119, 46, 54, 0.72);
  stroke-width: 2;
  stroke-linejoin: round;
}

.muscle-fiber {
  fill: none;
  stroke: rgba(255, 253, 248, 0.58);
  stroke-width: 1.25;
  pointer-events: none;
}

.muscle-fiber.strong {
  stroke: rgba(255, 253, 248, 0.72);
  stroke-width: 1.65;
}

.dimmed .muscle-shape:not(.selected):not(.related),
.dimmed .bone-shape:not(.selected):not(.related) {
  opacity: 0.24;
}

.marker {
  cursor: pointer;
}

.marker circle {
  fill: rgba(255, 253, 248, 0.94);
  stroke: var(--ink);
  stroke-width: 2;
}

.marker text {
  font-size: 13px;
  font-weight: 900;
  text-anchor: middle;
  dominant-baseline: central;
  fill: var(--ink);
  pointer-events: none;
}

.marker.selected circle {
  fill: var(--active);
  stroke: var(--active);
}

.marker.selected text {
  fill: white;
}

.marker.related circle {
  fill: #ffe1a5;
  stroke: var(--related);
}

.label-line {
  stroke: rgba(36, 32, 28, 0.34);
  stroke-width: 1.5;
}

.body-guide {
  fill: rgba(109, 72, 61, 0.055);
  stroke: rgba(36, 32, 28, 0.16);
  stroke-width: 2;
}

.body-line {
  fill: none;
  stroke: rgba(36, 32, 28, 0.16);
  stroke-width: 1.5;
  stroke-linecap: round;
}

.data-area {
  display: grid;
  --detail-pane-height: 180px;
  grid-template-rows: min(var(--detail-pane-height), 48dvh) minmax(0, 1fr);
  gap: 12px;
  position: relative;
  overflow: hidden;
  grid-column: 1;
  grid-row: 1;
  padding: 0;
  transition: min-width 180ms ease;
}

.workspace:has(#diagramStage[data-rendered-mode="muscles"]) .data-area {
  --detail-pane-height: 140px;
}

.workspace:has(#diagramStage[data-rendered-mode="links"]) .data-area {
  --detail-pane-height: 260px;
}

.detail-panel {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.workspace:has(#diagramStage[data-rendered-mode="links"]) .chip-list {
  gap: 4px;
  margin-top: 8px;
}

.workspace:has(#diagramStage[data-rendered-mode="links"]) .chip {
  padding: 3px 6px;
  font-size: 0.76rem;
}

.left-pane-toggle {
  position: relative;
  grid-column: 1;
  grid-row: 1;
  align-self: start;
  justify-self: end;
  z-index: 30;
  display: grid;
  place-items: center;
  width: 24px;
  height: 52px;
  min-height: 24px;
  margin: 12px 0 0;
  padding: 1px;
  border: 1px solid #9bbabe;
  border-radius: 4px;
  background: #f7fbfa;
  color: var(--active);
  box-shadow: none;
  cursor: pointer;
  transform: translateX(50%);
}

.left-pane-toggle:hover {
  border-color: #b7ced0;
  background: #f0f6f6;
  color: var(--active);
}

.left-pane-toggle:focus-visible {
  outline: 2px solid var(--active);
  outline-offset: -4px;
}

.left-pane-toggle-icon {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  transform: rotate(90deg);
}

.left-pane-toggle-icon svg {
  display: block;
  width: 20px;
  height: 20px;
}

html[data-site-view="page"] .left-pane-toggle {
  display: none;
}

.workspace.is-left-pane-collapsed .data-area {
  min-width: 0;
  overflow: hidden;
}

.workspace.is-left-pane-collapsed .detail-panel,
.workspace.is-left-pane-collapsed .table-wrap {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.pose-preset-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 5px;
  width: 104px;
  height: auto;
  max-height: 100%;
  align-self: flex-start;
  overflow: visible;
  pointer-events: auto;
}

.pose-mode-overlay,
.pose-joint-overlay,
.pose-overlay-right {
  position: absolute;
  z-index: 9;
  pointer-events: auto;
}

.pose-mode-overlay {
  left: 12px;
  top: 12px;
}

.pose-tool-feedback {
  position: absolute;
  z-index: 21;
  left: 50%;
  bottom: 16px;
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffefa;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  transform: translateX(-50%);
  pointer-events: none;
  box-shadow: 0 3px 12px rgba(30, 36, 35, 0.16);
}

.pose-tool-feedback[hidden] {
  display: none;
}

.pose3d-panel:has(.pose-tools-menu[open]) > .pose-tool-feedback {
  display: none;
}

.pose-tool-feedback[data-tone="error"] {
  color: var(--muscle-deep);
}

.pose-tool-menu-feedback {
  padding: 3px 2px;
  color: var(--active);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.3;
}

.pose-tool-menu-feedback[hidden] {
  display: none;
}

.pose-tool-menu-feedback[data-tone="error"] {
  color: var(--muscle-deep);
}

.pose-joint-overlay {
  left: 12px;
  top: 12px;
  bottom: 12px;
  width: 364px;
  max-width: calc(100% - 24px);
  display: flex;
  align-items: flex-end;
  pointer-events: none;
}

.pose-joint-overlay:has(.hand-control-panel) {
  width: min(600px, calc(100% - 24px));
}

.pose-overlay-right {
  right: 12px;
  top: 12px;
  bottom: 12px;
  z-index: 12;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  width: 112px;
  pointer-events: none;
}

.pose-mode-overlay .segmented {
  width: 250px;
}

.pose-camera-tools {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin-top: 6px;
}

.pose-camera-utility-stack {
  display: grid;
  grid-template-columns: 72px 32px 32px minmax(0, 1fr);
  width: 250px;
  max-width: 100%;
  align-items: flex-start;
  gap: 5px;
}

.pose-undo-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 253, 248, 0.94);
  color: var(--pose);
  cursor: pointer;
  font-family: inherit;
  font-size: 1.2rem;
  line-height: 1;
}

.pose-undo-button:hover,
.pose-undo-button:focus-visible {
  border-color: var(--pose);
}

.pose-mode-overlay > .pose-image-toolbar {
  margin-top: 4px;
}

.pose-mode-overlay .pose-image-status[data-tone="idle"] {
  display: none;
}

.pose-mode-overlay:has(.pose-tools-menu[open]) > .pose-image-toolbar {
  display: none;
}

.pose-mode-overlay:has(.pose-tools-menu[open]) {
  z-index: 20;
}

.pose-tools-menu {
  position: static;
  width: max-content;
}

.pose-tools-menu summary {
  display: grid;
  place-items: center;
  min-width: 72px;
  min-height: 32px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 253, 248, 0.94);
  color: var(--pose);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 800;
  list-style: none;
}

.pose-tools-menu summary::-webkit-details-marker {
  display: none;
}

.pose-tools-menu[open] summary,
.pose-tools-menu summary:hover {
  border-color: var(--pose);
}

.pose-tools-popover {
  --pose-tools-width: 184px;
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  display: grid;
  gap: 1px;
  width: var(--pose-tools-width);
  max-width: calc(100vw - 16px);
  max-height: min(560px, var(--pose-tools-height, 560px), calc(100dvh - var(--pose-tools-top, 173px) - 12px));
  overflow-y: auto;
  scrollbar-width: thin;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fffefa;
  box-shadow: 0 8px 24px rgba(30, 36, 35, 0.18);
}

.pose-tools-popover button {
  min-height: 28px;
  padding: 3px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
}

.pose-tools-popover button:hover,
.pose-tools-popover button:focus-visible {
  border-color: var(--pose);
  color: var(--pose);
}


.pose-tools-popover .variant-toggle,
.pose-tools-popover .focus-switch,
.pose-tools-popover .balance-toggle {
  width: 100%;
}

.pose-tools-popover .variant-toggle {
  gap: 2px;
  padding: 2px;
}

.pose-tools-popover .proportion-toggle {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pose-tools-popover .proportion-toggle .proportion-btn {
  min-width: 0;
  white-space: nowrap;
}

.is-touch-layout .pose-tools-popover .proportion-toggle .proportion-btn {
  min-height: 44px;
}

.pose-tools-popover .variant-btn,
.pose-tools-popover .proportion-btn {
  min-height: 28px;
}

.pose-tools-popover .focus-switch {
  min-height: 28px;
  padding: 2px 5px;
  border-radius: 6px;
  background: #fff;
  font-size: 0.7rem;
}

.pose-tools-toggle-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
}

.pose-tools-popover .pose-model-size-button svg {
  width: 16px;
  height: 16px;
  max-height: 16px;
  transform: translateY(-8px);
}

.pose-model-size-button [data-model-size-value] {
  position: absolute;
  bottom: 3px;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 12px;
  pointer-events: none;
}

.is-touch-layout .pose-tools-popover .pose-model-size-button svg {
  width: 22px;
  height: 22px;
  max-height: 22px;
  transform: translateY(-10px);
}

.is-touch-layout .pose-model-size-button [data-model-size-value] {
  bottom: 3px;
  font-size: 14px;
  line-height: 16px;
}

.pose-tools-popover .pose-display-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  min-width: 0;
  min-height: 0;
  padding: 0;
  color: #657a7d;
  touch-action: manipulation;
}

.pose3d-panel .pose-display-button svg {
  width: 20px;
  height: 20px;
  min-height: 0;
  max-height: 20px;
  pointer-events: none;
}

.pose3d-panel .pose-display-button[data-pose-display="mannequin"] svg {
  width: 24px;
  height: 24px;
  max-height: 24px;
}

.is-touch-layout .pose3d-panel .pose-display-button[data-pose-display="mannequin"] svg {
  width: 28px;
  height: 28px;
  max-height: 28px;
}

.pose-tools-popover .pose-display-button[aria-pressed="true"] {
  border-color: var(--pose);
  background: var(--pose);
  color: #fff;
}

.pose-tools-popover .pose-display-button:focus-visible {
  outline: 2px solid var(--pose);
  outline-offset: 2px;
  z-index: 2;
}

.pose-display-tooltip {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  z-index: 4;
  width: max-content;
  padding: 4px 6px;
  border-radius: 4px;
  background: #27383a;
  color: #fff;
  font-size: 0.68rem;
  line-height: 1.3;
  white-space: nowrap;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.pose-display-button:nth-child(n + 4):not([data-pose-display="light"]) .pose-display-tooltip {
  right: 0;
  left: auto;
}

.pose-display-button:focus-visible .pose-display-tooltip {
  visibility: visible;
  opacity: 1;
}

@media (hover: hover) {
  .pose-display-button:hover .pose-display-tooltip {
    visibility: visible;
    opacity: 1;
  }
}

.is-touch-layout .pose-tools-popover {
  --pose-tools-width: 244px;
}

.is-touch-layout .pose-tools-popover .pose-display-button {
  min-height: 53px;
}

.is-touch-layout .pose3d-panel .pose-display-button svg {
  width: 26px;
  height: 26px;
  max-height: 26px;
}

.pose-body-cycle-button [data-body-cycle-icon] {
  display: grid;
  place-items: center;
  pointer-events: none;
}

.pose-body-cycle-button[data-pose-body-cycle="proportion"] [data-body-cycle-icon] {
  transform: translateY(-10px);
}

.pose3d-panel .pose-body-cycle-button[data-pose-body-cycle="proportion"] svg {
  width: 18px;
  height: 18px;
  max-height: 18px;
}

.pose-body-cycle-badge {
  position: absolute;
  bottom: 2px;
  left: 2px;
  right: 2px;
  color: var(--pose);
  font-size: 16px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.is-touch-layout .pose-body-cycle-button[data-pose-body-cycle="proportion"] [data-body-cycle-icon] {
  transform: translateY(-10px);
}

.is-touch-layout .pose3d-panel .pose-body-cycle-button[data-pose-body-cycle="proportion"] svg {
  width: 22px;
  height: 22px;
  max-height: 22px;
}

.is-touch-layout .pose-body-cycle-badge {
  font-size: 18px;
  line-height: 20px;
}

.pose-tools-popover .pose-body-cycle-button[data-pose-body-cycle="variant"][data-body-value="male"] {
  color: #24566b;
  border-color: #9cbac6;
  background: #edf4f7;
}

.pose-tools-popover .pose-body-cycle-button[data-pose-body-cycle="variant"][data-body-value="female"] {
  color: #943e56;
  border-color: #cba0ae;
  background: #fcf0f4;
}

.pose3d-panel .pose-body-cycle-button[data-pose-body-cycle="variant"] svg {
  width: 30px;
  height: 30px;
  max-height: 30px;
}

.is-touch-layout .pose3d-panel .pose-body-cycle-button[data-pose-body-cycle="variant"] svg {
  width: 32px;
  height: 32px;
  max-height: 32px;
}

.pose-tools-popover .focus-switch:has(input:focus-visible) {
  outline: 2px solid var(--pose);
  outline-offset: 2px;
}

.pose-tools-heading {
  padding-top: 0;
  color: var(--muted);
  font-size: 0.69rem;
  font-weight: 800;
}

.pose-tools-numpad {
  display: grid;
  width: 100%;
  height: 132px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  justify-self: center;
}

[data-pose-tool="fov"],
[data-pose-tool="zoom"] {
  touch-action: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.is-touch-layout .pose-tools-numpad {
  height: 205px;
}

.pose-tools-numpad-column {
  display: grid;
  min-height: 0;
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: 3px;
}

.pose-tools-numpad-column > [data-pose-tool="view"] { grid-row: 2; }
.pose-tools-numpad-column > [data-pose-tool="zoom"] { grid-row: 4; }
.pose-tools-numpad-center > [data-pose-tool="view"] { grid-row: auto; }

.pose-tools-numpad-center {
  grid-template-rows: repeat(4, minmax(0, 1fr));
}

.pose-tools-popover .pose-tools-numpad button {
  min-height: 0;
  width: 100%;
}

.pose-tools-file-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: 32px;
  gap: 3px;
  align-self: start;
}

.pose-tools-file-grid.is-export-only { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.pose-tools-settings-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
}

.pose-tools-settings-row button { min-width: 0; overflow-wrap: anywhere; }
.is-touch-layout .pose-tools-popover .pose-tools-settings-row button { min-height: 49px; }

.pose-tools-popover .pose-tools-file-grid button {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 32px;
  padding: 4px;
}

.pose3d-panel .pose-tools-file-grid svg {
  width: 18px;
  height: 18px;
  min-height: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.is-touch-layout .pose-tools-popover .pose-tools-file-grid button {
  min-height: 49px;
}

.is-touch-layout .pose-tools-file-grid {
  grid-template-rows: 49px;
}

.pose-paste-fallback {
  display: grid;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  font-size: 0.7rem;
}

.pose-paste-fallback[hidden] {
  display: none;
}

@media (max-width: 600px) {
  .pose-tools-numpad { width: 100%; }
  .pose-tools-popover {
    position: fixed;
    top: var(--pose-tools-top, 258px);
    left: 8px;
    right: auto;
    width: min(var(--pose-tools-width), calc(100vw - 16px));
    max-height: min(var(--pose-tools-height, 100dvh), calc(100dvh - var(--pose-tools-top, 258px) - 8px));
  }

  .pose-tools-popover button {
    min-height: 36px;
  }

}

.luminous-mode-switch {
  min-height: 30px;
  width: max-content;
  padding: 3px 8px;
  border-radius: 7px;
  background: rgba(255, 253, 248, 0.88);
  font-size: 0.74rem;
}

.balance-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 0;
  padding: 6px 10px 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.88);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 900;
  user-select: none;
  backdrop-filter: blur(5px);
  font-family: inherit;
}

.balance-toggle.is-active {
  border-color: rgba(31, 95, 104, 0.45);
  color: var(--pose);
}

.balance-toggle-track {
  position: relative;
  width: 34px;
  height: 18px;
  border-radius: 999px;
  background: #c9c4ba;
  transition: background 180ms ease;
}

.balance-toggle-track span {
  position: absolute;
  left: 2px;
  top: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(42, 39, 32, 0.28);
  transition: transform 180ms ease;
}

.balance-toggle.is-active .balance-toggle-track {
  background: var(--pose);
}

.balance-toggle.is-active .balance-toggle-track span {
  transform: translateX(16px);
}

.camera-lens-readout {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 5ch;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  min-height: 32px;
  padding: 0 4px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
  user-select: none;
}

.camera-lens-readout strong {
  color: var(--pose);
  font-size: 0.78rem;
  font-weight: 900;
  text-align: right;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.camera-lens-readout input[type="range"] {
  width: 100%;
  min-width: 0;
  height: 32px;
  margin: 0;
  accent-color: var(--pose);
  cursor: pointer;
}

.camera-lens-readout input:disabled { cursor: wait; }
.camera-lens-readout input:focus-visible { outline: 2px solid var(--pose); outline-offset: 2px; }

/* Scale controls independently of the model canvas; tablets retain their current sizing. */
:root { --pose-ui-scale: 1; }
@media (pointer: coarse) and (max-width: 600px),
       (pointer: coarse) and (max-width: 980px) and (max-height: 500px) {
  :root { --pose-ui-scale: 0.65; }
}
.pose-mode-overlay,
.pose-joint-overlay,
.pose-overlay-right,
.pose-touch-axis-bar,
.pose-reset-control,
.viewer3d-controls,
.viewer3d-meta {
  zoom: var(--pose-ui-scale);
}

/* Collapsible tool rail; floating submenus stay outside its scroll viewport. */
.pose3d-panel .pose-camera-tools { width: max-content; max-width: 100%; }
.pose3d-panel .pose-camera-tools .pose-camera-utility-stack {
  display: flex;
  width: max-content;
  max-width: none;
  align-items: flex-start;
  gap: 5px;
}
.pose3d-panel .pose-camera-tools .pose-tools-menu { width: max-content; }
.pose3d-panel .pose-tools-menu > summary { min-height: 32px; }
.pose-tool-rail.pose-tools-popover {
  --rail-button-size: var(--pose-rail-button-size, 36px);
  position: absolute;
  inset: calc(100% + 5px) auto auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: var(--pose-rail-width, 54px);
  max-height: var(--pose-rail-height, 420px);
  padding: 4px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-gutter: stable;
  scrollbar-color: #9caead transparent;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.pose-tool-rail .pose-tools-toggle-grid { display: contents; }
.pose-tool-rail.pose-tools-popover .pose-display-button {
  flex: 0 0 var(--rail-button-size);
  width: var(--rail-button-size);
  height: var(--rail-button-size);
  min-height: var(--rail-button-size);
  aspect-ratio: 1;
  border-radius: 4px;
}
.pose-tool-rail.pose-tools-popover .pose-display-button[aria-pressed="true"],
.pose-tool-rail.pose-tools-popover .pose-display-button.is-active {
  background: var(--pose);
  border-color: var(--pose);
  color: #fffefa;
}
.pose-tool-rail.pose-tools-popover .pose-display-button[aria-expanded="true"] {
  outline: 2px solid var(--pose);
  outline-offset: -2px;
  background: #edf5f4;
  color: var(--pose);
}
.pose-tool-rail .pose-display-tooltip { display: none; }
.pose-tool-rail strong { color: inherit; font-size: 11px; font-variant-numeric: tabular-nums; }
.pose-submenu-indicator {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-bottom: 4px solid currentColor;
  opacity: .7;
}
.pose-model-number { position: absolute; right: 2px; top: 1px; padding: 0 2px; background: inherit; font-size: 10px; line-height: 12px; }
.pose-toolbar-submenu {
  position: fixed;
  z-index: 30;
  display: grid;
  gap: 8px;
  width: 238px;
  max-width: calc(100vw - 88px);
  max-height: calc(100dvh - 16px);
  padding: 10px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffefa;
  box-shadow: 0 5px 18px rgba(30, 36, 35, .18);
  color: var(--ink);
}
.pose-toolbar-submenu[hidden] { display: none; }
.pose-toolbar-submenu button {
  min-height: 34px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--pose);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  touch-action: manipulation;
}
.pose-toolbar-submenu button:hover:not(:disabled),
.pose-toolbar-submenu button:focus-visible { border-color: var(--pose); outline: 1px solid var(--pose); outline-offset: -1px; }
.pose-toolbar-submenu button:disabled { opacity: .4; cursor: default; }
.pose-toolbar-submenu button.is-active { color: #fffefa; background: var(--pose); }
.pose3d-panel .pose-toolbar-submenu .pose-model-toolbar { width: 100%; grid-template-columns: minmax(0, 1fr) 32px 32px; }
.pose3d-panel .pose-toolbar-submenu .pose-model-buttons { grid-column: 1; }
.pose3d-panel .pose-toolbar-submenu .pose-model-tool { width: 32px; height: 34px; }
.pose3d-panel .pose-toolbar-submenu .pose-model-buttons button { height: 34px; font-size: 11px; }
.pose-toolbar-submenu svg { width: 20px; height: 20px; min-height: 0; max-height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pose-toolbar-submenu .pose-model-color-row { grid-template-columns: 32px 62px minmax(0, 1fr) 28px; }
.pose-toolbar-submenu .pose-model-color-row input,
.pose-toolbar-submenu .pose-model-color-row button { min-width: 0; height: 34px; padding: 3px; }
.pose-toolbar-submenu .pose-tools-file-grid button { display: grid; place-items: center; }
.pose-view-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(4, 36px); gap: 4px; }
.pose-view-grid [data-view="top"] { grid-area: 1 / 2; }
.pose-view-grid [data-view="left"] { grid-area: 2 / 1; }
.pose-view-grid [data-view="front"] { grid-area: 2 / 2; }
.pose-view-grid [data-view="right"] { grid-area: 2 / 3; }
.pose-view-grid [data-view="bottom"] { grid-area: 3 / 2; }
.pose-view-grid [data-view="back"] { grid-area: 4 / 2; }
.pose-view-zoom { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding-top: 8px; border-top: 1px solid var(--line); }
.pose-toolbar-submenu.pose-focal-submenu { width: 88px; }
.pose-focal-vertical { display: grid; justify-items: center; gap: 5px; font-size: 11px; color: var(--muted); }
.pose-focal-vertical input[type="range"] {
  writing-mode: vertical-lr;
  direction: rtl;
  width: 36px;
  height: 174px;
  margin: 0;
  accent-color: var(--pose);
  touch-action: none;
  cursor: pointer;
}
.pose-focal-vertical input:focus-visible { outline: 2px solid var(--pose); outline-offset: 2px; }

@media (pointer: coarse) {
  .pose3d-panel .pose-tools-menu > summary { min-width: 54px; min-height: 44px; }
  .pose3d-panel .pose-camera-utility-stack .pose-undo-button { width: 44px; height: 44px; }
  .pose-tool-rail.pose-tools-popover { --rail-button-size: 44px; }
  .pose-toolbar-submenu button { min-height: 44px; }
  .pose-view-grid { grid-template-rows: repeat(4, 44px); }
  .pose3d-panel .pose-toolbar-submenu .pose-model-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pose3d-panel .pose-toolbar-submenu .pose-model-buttons { grid-column: 1 / -1; }
  .pose3d-panel .pose-toolbar-submenu .pose-model-tool,
  .pose3d-panel .pose-toolbar-submenu .pose-model-buttons button { width: 100%; height: 44px; }
  .pose-focal-vertical input[type="range"] { width: 44px; }
}

.child45-skull-rotation-control {
  display: grid;
  gap: 4px;
  width: 250px;
  margin-top: 6px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.9);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  backdrop-filter: blur(5px);
}

.child45-skull-rotation-control:not(.is-active) {
  opacity: 0.72;
}

.child45-skull-rotation-title {
  color: var(--pose);
  line-height: 1;
}

.child45-skull-rotation-row {
  display: grid;
  grid-template-columns: 14px minmax(86px, 1fr) 44px;
  align-items: center;
  gap: 5px;
}

.child45-skull-rotation-row input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 18px;
  margin: 0;
  background: transparent;
}

.child45-skull-rotation-row input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background:
    linear-gradient(
      to right,
      transparent 0,
      transparent calc(var(--range-zero, 0%) - 1px),
      rgba(35, 42, 43, 0.48) calc(var(--range-zero, 0%) - 1px),
      rgba(35, 42, 43, 0.48) calc(var(--range-zero, 0%) + 1px),
      transparent calc(var(--range-zero, 0%) + 1px),
      transparent 100%
    ),
    linear-gradient(
      to right,
      #d7d9d8 0,
      #d7d9d8 var(--range-fill-start, var(--range-progress)),
      var(--pose) var(--range-fill-start, var(--range-progress)),
      var(--pose) var(--range-fill-end, var(--range-progress)),
      #d7d9d8 var(--range-fill-end, var(--range-progress)),
      #d7d9d8 100%
    );
}

.child45-skull-rotation-row input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border: 2px solid var(--pose);
  border-radius: 50%;
  background: #fff;
}

.child45-skull-rotation-row input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background:
    linear-gradient(
      to right,
      transparent 0,
      transparent calc(var(--range-zero, 0%) - 1px),
      rgba(35, 42, 43, 0.48) calc(var(--range-zero, 0%) - 1px),
      rgba(35, 42, 43, 0.48) calc(var(--range-zero, 0%) + 1px),
      transparent calc(var(--range-zero, 0%) + 1px),
      transparent 100%
    ),
    linear-gradient(
      to right,
      #d7d9d8 0,
      #d7d9d8 var(--range-fill-start, var(--range-progress)),
      var(--pose) var(--range-fill-start, var(--range-progress)),
      var(--pose) var(--range-fill-end, var(--range-progress)),
      #d7d9d8 var(--range-fill-end, var(--range-progress)),
      #d7d9d8 100%
    );
}

.child45-skull-rotation-row input[type="range"]::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: 2px solid var(--pose);
  border-radius: 50%;
  background: #fff;
}

.child45-skull-rotation-number {
  width: 44px;
  height: 22px;
  border: 1px solid rgba(57, 105, 155, 0.2);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--text);
  font-size: 0.68rem;
  text-align: right;
}

.patella-edit-control {
  display: grid;
  gap: 5px;
  width: 300px;
  margin-top: 6px;
  padding: 7px 8px;
  border: 1px solid rgba(57, 105, 155, 0.18);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.9);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  backdrop-filter: blur(5px);
}

.patella-edit-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--pose);
  line-height: 1;
}

.patella-edit-head small {
  display: inline-block;
  margin-left: 4px;
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(31, 95, 104, 0.1);
  color: var(--pose);
  font-size: 0.58rem;
  vertical-align: middle;
}

.patella-keyframe-toggle {
  display: flex;
  gap: 4px;
}

.patella-keyframe-btn {
  min-width: 42px;
  padding: 3px 7px;
  border: 1px solid rgba(57, 105, 155, 0.22);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--pose);
  font: inherit;
  font-size: 0.66rem;
  cursor: pointer;
}

.patella-keyframe-btn.is-active {
  border-color: rgba(31, 95, 104, 0.45);
  background: var(--pose);
  color: #fff;
}

.patella-edit-row {
  display: grid;
  grid-template-columns: 28px 12px minmax(100px, 1fr) 12px 44px;
  align-items: center;
  gap: 5px;
}

.patella-edit-min,
.patella-edit-max {
  color: rgba(88, 98, 102, 0.78);
  font-size: 0.62rem;
  text-align: center;
}

.patella-edit-row input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 18px;
  margin: 0;
  background: transparent;
}

.patella-edit-row input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background:
    linear-gradient(
      to right,
      transparent 0,
      transparent calc(var(--range-zero, 0%) - 1px),
      rgba(35, 42, 43, 0.48) calc(var(--range-zero, 0%) - 1px),
      rgba(35, 42, 43, 0.48) calc(var(--range-zero, 0%) + 1px),
      transparent calc(var(--range-zero, 0%) + 1px),
      transparent 100%
    ),
    linear-gradient(
      to right,
      #d7d9d8 0,
      #d7d9d8 var(--range-fill-start, var(--range-progress)),
      var(--pose) var(--range-fill-start, var(--range-progress)),
      var(--pose) var(--range-fill-end, var(--range-progress)),
      #d7d9d8 var(--range-fill-end, var(--range-progress)),
      #d7d9d8 100%
    );
}

.patella-edit-row input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border: 2px solid var(--pose);
  border-radius: 50%;
  background: #fff;
}

.patella-edit-row input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background:
    linear-gradient(
      to right,
      transparent 0,
      transparent calc(var(--range-zero, 0%) - 1px),
      rgba(35, 42, 43, 0.48) calc(var(--range-zero, 0%) - 1px),
      rgba(35, 42, 43, 0.48) calc(var(--range-zero, 0%) + 1px),
      transparent calc(var(--range-zero, 0%) + 1px),
      transparent 100%
    ),
    linear-gradient(
      to right,
      #d7d9d8 0,
      #d7d9d8 var(--range-fill-start, var(--range-progress)),
      var(--pose) var(--range-fill-start, var(--range-progress)),
      var(--pose) var(--range-fill-end, var(--range-progress)),
      #d7d9d8 var(--range-fill-end, var(--range-progress)),
      #d7d9d8 100%
    );
}

.patella-edit-row input[type="range"]::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: 2px solid var(--pose);
  border-radius: 50%;
  background: #fff;
}

.patella-edit-number {
  width: 44px;
  height: 22px;
  border: 1px solid rgba(57, 105, 155, 0.2);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--text);
  font-size: 0.68rem;
  text-align: right;
}

.joint-control-dock {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  width: max-content;
  max-width: 100%;
  max-height: 100%;
  pointer-events: auto;
}

.pose-joint-overlay .joint-control-panel {
  position: static;
  left: auto;
  bottom: auto;
  z-index: auto;
  width: calc(var(--joint-panel-inner-width) + 24px);
  max-width: 100%;
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: hidden;
  min-height: 0;
  padding: 10px 12px;
}

.pose-joint-overlay .joint-control-dock {
  height: 100%;
  min-height: 0;
  pointer-events: none;
}

.pose-joint-overlay .joint-control-panel:not(.is-collapsed) {
  display: flex;
  flex-direction: column;
}

.pose-joint-overlay .joint-panel-body {
  flex: 0 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.pose-joint-overlay .joint-panel-toolbar,
.pose-joint-overlay .joint-panel-footer,
.pose-joint-overlay .joint-sheet-grabber {
  flex: 0 0 auto;
}

.pose-joint-overlay .hand-control-panel {
  max-height: 100%;
  min-height: 0;
  pointer-events: auto;
}

.pose-joint-overlay .joint-control-panel.is-collapsed {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  pointer-events: none;
}

.joint-control-panel.is-collapsed .joint-panel-actions > button {
  pointer-events: auto;
}

.pose-joint-overlay .joint-control-panel.is-collapsed .joint-panel-footer {
  grid-template-rows: auto;
}

.hand-control-panel {
  --hand-control-accent: #9a6b18;
  display: grid;
  grid-template-rows: auto auto auto auto;
  gap: 7px;
  width: 244px;
  max-height: min(560px, calc(100vh - 120px));
  padding: 10px;
  overflow: auto;
  border: 1px solid rgba(72, 72, 66, 0.16);
  border-radius: 6px;
  background: rgba(255, 253, 248, 0.92);
  box-shadow: 0 8px 22px rgba(56, 52, 44, 0.08);
  backdrop-filter: blur(8px);
}

.hand-control-panel-header {
  display: grid;
  grid-template-columns: 1fr auto 24px;
  align-items: center;
  gap: 6px;
  color: var(--hand-control-accent);
  font-size: 0.68rem;
  font-weight: 800;
}

.hand-control-panel-header span {
  color: rgba(72, 72, 66, 0.72);
  font-size: 0.6rem;
}

.hand-control-panel-close {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid rgba(154, 107, 24, 0.24);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--hand-control-accent);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 900;
}

.hand-control-tabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 2px;
  align-self: end;
}

.hand-control-tab {
  min-width: 0;
  min-height: 24px;
  padding: 0 2px;
  border: 1px solid rgba(154, 107, 24, 0.24);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--hand-control-accent);
  cursor: pointer;
  font-size: 0.55rem;
  font-weight: 800;
}

.hand-control-tab.is-active {
  background: var(--hand-control-accent);
  color: white;
}

.hand-control-pad-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 6px;
  align-items: stretch;
}

.hand-control-pad-actions {
  display: grid;
  grid-template-rows: repeat(2, 1fr);
  gap: 5px;
}

.hand-control-pad-action {
  min-width: 0;
  min-height: 0;
  padding: 0 3px;
  border: 1px solid rgba(154, 107, 24, 0.24);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--hand-control-accent);
  cursor: pointer;
  font-size: 0.55rem;
  font-weight: 800;
  line-height: 1.15;
}

.hand-control-pad-action:hover {
  background: rgba(154, 107, 24, 0.08);
}

.hand-control-pad {
  position: relative;
  height: 96px;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(154, 107, 24, 0.24);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.58);
  touch-action: none;
  cursor: crosshair;
}

.hand-control-pad-grid {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(154, 107, 24, 0.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(154, 107, 24, 0.14) 1px, transparent 1px);
  background-size: 50% 50%;
}

.hand-control-pad-thumb {
  position: absolute;
  left: calc(50% + var(--hand-pad-x, 0%));
  top: calc(50% - var(--hand-pad-y, 0%));
  width: 18px;
  height: 18px;
  border: 2px solid var(--hand-control-accent);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(56, 52, 44, 0.16);
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: box-shadow 120ms ease, transform 120ms ease;
}

.hand-control-pad.is-dragging .hand-control-pad-thumb {
  box-shadow: 0 3px 12px rgba(56, 52, 44, 0.24);
  transform: translate(-50%, -50%) scale(1.06);
}

.hand-control-rows {
  display: grid;
  gap: 4px;
}

.hand-control-temp-panel {
  display: grid;
  grid-template-rows: auto auto;
  gap: 4px;
  padding-top: 6px;
  border-top: 1px solid rgba(154, 107, 24, 0.18);
}

.hand-control-temp-title {
  color: var(--hand-control-accent);
  font-size: 0.66rem;
  font-weight: 800;
}

.hand-control-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 38px;
  align-items: center;
  gap: 4px;
  color: rgba(72, 72, 66, 0.78);
  font-size: 0.58rem;
  font-weight: 800;
}

.hand-control-row input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 28px;
  margin: -5px 0;
  background: transparent;
  cursor: pointer;
  touch-action: none;
}

.hand-control-row input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background:
    linear-gradient(
      to right,
      transparent 0,
      transparent calc(var(--range-zero, 0%) - 1px),
      rgba(35, 42, 43, 0.48) calc(var(--range-zero, 0%) - 1px),
      rgba(35, 42, 43, 0.48) calc(var(--range-zero, 0%) + 1px),
      transparent calc(var(--range-zero, 0%) + 1px),
      transparent 100%
    ),
    linear-gradient(
      to right,
      #d7d9d8 0,
      #d7d9d8 var(--range-fill-start, var(--range-progress)),
      var(--hand-control-accent) var(--range-fill-start, var(--range-progress)),
      var(--hand-control-accent) var(--range-fill-end, var(--range-progress)),
      #d7d9d8 var(--range-fill-end, var(--range-progress)),
      #d7d9d8 100%
    );
}

.hand-control-row input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -7px;
  border: 2px solid var(--hand-control-accent);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(35, 42, 43, 0.18);
}

.hand-control-row input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background:
    linear-gradient(
      to right,
      transparent 0,
      transparent calc(var(--range-zero, 0%) - 1px),
      rgba(35, 42, 43, 0.48) calc(var(--range-zero, 0%) - 1px),
      rgba(35, 42, 43, 0.48) calc(var(--range-zero, 0%) + 1px),
      transparent calc(var(--range-zero, 0%) + 1px),
      transparent 100%
    ),
    linear-gradient(
      to right,
      #d7d9d8 0,
      #d7d9d8 var(--range-fill-start, var(--range-progress)),
      var(--hand-control-accent) var(--range-fill-start, var(--range-progress)),
      var(--hand-control-accent) var(--range-fill-end, var(--range-progress)),
      #d7d9d8 var(--range-fill-end, var(--range-progress)),
      #d7d9d8 100%
    );
}

.hand-control-row input[type="range"]::-moz-range-progress {
  background: transparent;
}

.hand-control-row input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 2px solid var(--hand-control-accent);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(35, 42, 43, 0.18);
}

.hand-control-toggle-row input[type="checkbox"] {
  justify-self: start;
  width: 16px;
  height: 16px;
  accent-color: var(--hand-control-accent);
}

.hand-control-row input[type="number"] {
  width: 38px;
  min-width: 0;
  padding: 2px 3px;
  border: 1px solid rgba(154, 107, 24, 0.2);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.62);
  color: rgba(72, 72, 66, 0.72);
  font-size: 0.58rem;
  text-align: right;
}

.pose-preset-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.pose-preset-registration {
  position: absolute;
  z-index: 25;
  top: 32px;
  right: 0;
  display: grid;
  gap: 8px;
  width: min(224px, calc(100vw - 24px));
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(30, 50, 52, 0.18);
}

.pose-preset-registration > input {
  width: 100%;
  min-width: 0;
  min-height: 32px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font: inherit;
  font-size: 12px;
}

.pose-preset-scope,
.pose-preset-registration-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin: 0;
  padding: 0;
  border: 0;
}

.pose-preset-scope label {
  position: relative;
  cursor: pointer;
}

.pose-preset-scope input { position: absolute; opacity: 0; }
.pose-preset-scope span {
  display: grid;
  place-items: center;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 12px;
}
.pose-preset-scope input:checked + span { background: var(--pose); color: #fff; }
.pose-preset-scope input:focus-visible + span { outline: 2px solid var(--pose); outline-offset: 2px; }
.pose-preset-scope input:disabled + span { opacity: 0.4; cursor: default; }
.pose-preset-registration-actions button { min-height: 32px; }
.preset-scene-icon { display: flex; flex-shrink: 0; }
.custom-pose-btn .preset-scene-icon svg { width: 14px; height: 14px; min-height: 0; max-height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.custom-pose-btn:disabled { opacity: 0.4; cursor: default; }
@media (max-width: 600px) {
  .pose-preset-scope span,
  .pose-preset-registration > input,
  .pose-preset-registration-actions button { min-height: 40px; }
}

.pose-preset-view-toggle {
  grid-column: 1 / -1;
  justify-content: center;
  width: 100%;
  min-width: 0;
  min-height: 26px;
  padding: 3px 6px;
  border-radius: 5px;
  font-size: 12px;
}

.pose-preset-view-toggle span {
  gap: 6px;
}

.pose-preset-view-toggle span::before {
  width: 26px;
  height: 15px;
  flex-shrink: 0;
}

.pose-preset-view-toggle span::after {
  left: 2px;
  width: 11px;
  height: 11px;
}

.pose-preset-view-toggle input:checked + span::before {
  background: var(--pose);
}

.pose-preset-view-toggle input:checked + span::after {
  transform: translateX(11px);
}

.pose-preset-view-toggle:has(input:focus-visible) {
  outline: 2px solid var(--pose);
  outline-offset: 2px;
}

.pose3d-panel .pose-undo-button svg {
  width: 18px;
  height: 18px;
  min-height: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pose-undo-button:disabled {
  opacity: 0.35;
  cursor: default;
}

.pose-animation-flyout {
  position: absolute;
  top: 0;
  right: calc(100% + 4px);
  z-index: 2;
  display: grid;
  width: 54px;
  gap: 4px;
  pointer-events: auto;
}

.pose-animation-progress {
  --animation-progress: 0%;
  position: absolute;
  top: 5px;
  right: calc(100% + 8px);
  width: 96px;
  height: 16px;
  border-radius: 999px;
  background: rgba(57, 105, 155, 0.14);
  box-shadow: inset 0 0 0 1px rgba(57, 105, 155, 0.2);
  cursor: pointer;
  pointer-events: auto;
  touch-action: none;
}

.pose-animation-progress span {
  position: absolute;
  left: var(--animation-progress);
  top: 50%;
  width: 16px;
  height: 16px;
  border: 2px solid #fffdf8;
  border-radius: 50%;
  background: var(--pose);
  box-shadow: 0 2px 6px rgba(43, 36, 26, 0.28);
  transform: translate(-50%, -50%);
}

.pose-animation-main {
  min-height: 26px;
}

.pose-animation-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
}

.pose-preset-action {
  min-height: 26px;
  border: 1px solid rgba(57, 105, 155, 0.22);
  border-radius: 5px;
  background: rgba(255, 253, 248, 0.72);
  color: var(--pose);
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 800;
}

.pose-preset-action:disabled {
  opacity: 0.45;
  cursor: default;
}

.pose-preset-action.is-active {
  background: var(--pose);
  color: white;
}

.pose-preset-list {
  display: grid;
  align-content: start;
  gap: 5px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 0 1px 5px 0;
}

.pose-preset-list:has(.custom-pose-btn.is-dragging) {
  cursor: grabbing;
}

.pose-preset-panel.is-editing {
  border-radius: 6px;
  background: rgba(224, 240, 232, 0.92);
  box-shadow: inset 0 0 0 1px #83aa98;
}

.pose-preset-panel.is-editing .pose-folder-heading {
  border-bottom-color: #9db9aa;
}

.pose-preset-panel.is-editing [data-preset-edit] {
  border-color: #437e64;
  background: #437e64;
  color: #fff;
}

.pose-preset-drop-palette {
  position: fixed;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  width: 132px;
  max-width: calc(100vw - 16px);
  max-height: calc(100dvh - 16px);
  padding: 5px;
  border: 1px solid #89a99a;
  border-radius: 6px;
  background: #f5faf7;
  box-shadow: 0 4px 18px rgba(33, 60, 49, 0.18);
}

.pose-preset-drop-folders {
  display: grid;
  min-height: 0;
  gap: 3px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.pose-preset-drop-palette button {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 6px;
  min-width: 0;
  min-height: 38px;
  padding: 5px 7px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: #365b49;
  font-size: 12px;
  text-align: left;
}

.pose-preset-drop-palette button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pose-preset-drop-palette button.is-drop-target {
  border-color: #559978;
  background: #cce6d7;
  box-shadow: inset 3px 0 #437e64;
}

.pose-preset-drop-palette .pose-preset-drop-trash {
  margin-top: 5px;
  border-top-color: #d8bdb9;
  color: #a04842;
}

.pose-preset-drop-trash.is-drop-target {
  border-color: #bf6b62 !important;
  background: #f2d9d4 !important;
  box-shadow: inset 3px 0 #a04842 !important;
}

.pose-preset-drop-palette svg,
.pose-preset-delete-toast svg {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  min-height: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pose-preset-delete-toast {
  position: fixed;
  right: 16px;
  bottom: 20px;
  z-index: 10001;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 32px);
  padding: 6px 8px 6px 12px;
  border: 1px solid #9db9aa;
  border-radius: 6px;
  background: #f5faf7;
  color: #365b49;
  font-size: 12px;
  box-shadow: 0 4px 18px rgba(33, 60, 49, 0.16);
}

.pose-preset-delete-toast span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pose-preset-delete-toast button {
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  width: 40px;
  height: 36px;
  padding: 0;
  border: 1px solid #a7c6b5;
  border-radius: 4px;
  background: #e4f0e9;
  color: #365b49;
  cursor: pointer;
}

.pose-preset-folder,
.pose-folder-items,
.pose-preset-item {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.pose-folder-items {
  gap: 3px;
}

.pose-folder-items[hidden] {
  display: none;
}

.pose-folder-heading {
  display: grid;
  min-width: 0;
  border-bottom: 1px solid #d7dddf;
}

.pose-folder-toggle.is-reorderable {
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.pose-preset-folder.is-folder-dragging {
  opacity: 0.45;
}

.pose-preset-folder.is-folder-drop-before {
  box-shadow: 0 -3px #438369;
}

.pose-preset-folder.is-folder-drop-after {
  box-shadow: 0 3px #438369;
}

.pose-folder-toggle {
  display: flex;
  align-items: center;
  gap: 3px;
  width: 100%;
  min-width: 0;
  min-height: 28px;
  padding: 3px 1px;
  border: 0;
  background: transparent;
  color: #50666b;
  font-size: 11px;
  text-align: left;
  cursor: pointer;
}

.pose-folder-toggle span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pose-folder-toggle small {
  margin-left: auto;
  font-size: 10px;
  color: #77878c;
}

.pose3d-panel .pose-folder-toggle svg,
.pose3d-panel .pose-folder-tools svg,
.pose3d-panel .pose-folder-create svg {
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  min-height: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pose-preset-item.is-editing .custom-pose-btn {
  touch-action: pan-y pinch-zoom;
}

.pose-preset-item-menu {
  grid-column: 1 / -1;
  display: grid;
  min-width: 0;
  gap: 2px;
}

.pose-folder-toggle.is-expanded svg {
  transform: rotate(90deg);
}

.pose-folder-toggle:hover,
.pose-folder-tools button:hover {
  background: #e8eff0;
}

.pose-folder-tools {
  display: flex;
  justify-content: flex-end;
}

.pose-folder-tools button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #50666b;
  cursor: pointer;
}

.pose-folder-create {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.pose-folder-form {
  grid-column: 1 / -1;
  display: grid;
  min-width: 0;
  gap: 2px;
}

.pose-folder-form input {
  width: 100%;
  min-width: 0;
  height: 28px;
  padding: 3px;
  border: 1px solid #aebec5;
  border-radius: 4px;
  font-size: 12px;
}

.pose-folder-delete-confirm {
  overflow-wrap: anywhere;
  font-size: 11px;
  color: #9d4343;
}

.pose-preset-item .custom-pose-btn {
  width: 100%;
  min-width: 0;
}

.pose-preset-folder-select {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
  height: 26px;
  padding: 2px;
  border: 1px solid #cbd5d9;
  border-radius: 4px;
  background: #fff;
  color: #50666b;
  font-size: 11px;
}

.pose-preset-category {
  display: grid;
  gap: 4px;
}

.pose-preset-category + .pose-preset-category {
  margin-top: 3px;
}

.pose-preset-category-heading {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 20px;
  padding: 2px 6px;
  border: 1px solid rgba(57, 105, 155, 0.12);
  border-radius: 5px;
  background: rgba(246, 242, 234, 0.92);
  color: #776f63;
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.pose-preset-category-heading span:last-child {
  color: rgba(57, 105, 155, 0.72);
  font-size: 0.56rem;
}

.pose-preset-category-items {
  display: grid;
  gap: 5px;
}

.custom-pose-btn {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px;
  transition: background-color 100ms, border-color 100ms, color 100ms;
}

@media (hover: hover) and (pointer: fine) {
  .custom-pose-btn:hover:not(.is-active):not(.is-animation-selected) {
    border-color: #79a4c5;
    background: #e2eef6;
  }

  .custom-pose-btn.is-active:hover {
    border-color: #2f5b85;
    background: #2f5b85;
  }

  .custom-pose-btn.is-animation-selected:hover {
    border-color: #db9237;
    background: #ffe2b9;
    color: var(--pose);
  }
}

.custom-pose-btn[draggable="true"] {
  cursor: grab;
}

.custom-pose-btn[draggable="true"]:active {
  cursor: grabbing;
}

.custom-pose-btn.is-dragging {
  opacity: 0.42;
}

.pose-preset-item.is-dragging {
  opacity: 0.42;
}

.custom-pose-btn.is-drop-before {
  box-shadow: inset 0 2px 0 #f0a33a, 0 0 0 1px rgba(240, 163, 58, 0.18);
}

.custom-pose-btn.is-drop-after {
  box-shadow: inset 0 -2px 0 #f0a33a, 0 0 0 1px rgba(240, 163, 58, 0.18);
}

.custom-pose-btn.is-animation-selected {
  border-color: rgba(237, 145, 36, 0.72);
  background: rgba(255, 183, 77, 0.14);
  box-shadow: inset 0 0 0 1px rgba(237, 145, 36, 0.22);
}

.custom-pose-btn.is-drop-before,
.custom-pose-btn.is-animation-selected.is-drop-before {
  box-shadow: inset 0 2px 0 #f0a33a, 0 0 0 1px rgba(240, 163, 58, 0.18);
}

.custom-pose-btn.is-drop-after,
.custom-pose-btn.is-animation-selected.is-drop-after {
  box-shadow: inset 0 -2px 0 #f0a33a, 0 0 0 1px rgba(240, 163, 58, 0.18);
}

.custom-pose-btn span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preset-animation-order {
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #f0a33a;
  color: white;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
}

.preset-delete {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: rgba(36, 32, 28, 0.12);
  color: #6c5147;
  font-size: 0.76rem;
  line-height: 1;
}

.detail-panel {
  padding: 16px;
}

.detail-kicker {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.detail-title {
  margin: 4px 0 10px;
  font-size: 1.28rem;
  line-height: 1.25;
}

.detail-grid {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 12px;
  margin: 12px 0 0;
}

.detail-grid dt {
  color: var(--muted);
  font-weight: 900;
}

.detail-grid dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  padding: 5px 9px;
  font-size: 0.86rem;
  font-weight: 800;
}

.chip.is-clickable {
  cursor: pointer;
}

.table-wrap {
  overflow: hidden;
}

.table-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.table-head h2 {
  grid-column: 1;
  white-space: nowrap;
}

.table-head > span {
  grid-column: 3;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.table-head .table-search {
  grid-column: 2;
}

.data-list {
  height: 100%;
  max-height: none;
  min-height: 0;
  overflow: auto;
}

.table-wrap {
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.row {
  width: 100%;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 6px;
  align-items: start;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.72);
  padding: 9px 10px;
  text-align: left;
  cursor: pointer;
}

.row:hover,
.row.is-selected {
  background: var(--active-soft);
}

.row.is-related:not(.is-selected) {
  background: #fff2d5;
}

.row-code {
  display: inline-grid;
  place-items: center;
  width: 29px;
  height: 29px;
  margin-top: 1px;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  font-size: 0.84rem;
  font-weight: 900;
}

.row[data-select-type="bone"] .row-code {
  background: #b88a1d;
  color: var(--paper);
}

.row[data-select-type="muscle"] .row-code {
  background: var(--muscle);
  color: var(--paper);
}

.row.is-selected .row-code {
  background: var(--active);
  color: var(--paper);
}

.row-main {
  min-width: 0;
}

.row-name {
  display: block;
  font-size: 0.9rem;
  font-weight: 900;
  line-height: 1.3;
}

.row-meta {
  display: block;
  color: var(--muted);
  margin-top: 1px;
  font-size: 0.74rem;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
}

.empty {
  padding: 24px;
  color: var(--muted);
  font-weight: 800;
}

@media (max-width: 1020px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar .viewer3d-status {
    align-self: flex-end;
    max-width: min(470px, 100%);
  }

  .toolbar {
    justify-content: stretch;
  }

  .search {
    flex: 1;
    grid-template-columns: auto minmax(0, 1fr);
  }
}

@media (max-width: 1100px) {
  html,
  body {
    height: auto;
    min-height: 100%;
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(520px, 77.2dvh) minmax(216px, 22.8dvh);
    overflow: visible;
  }

  .workspace.is-left-pane-collapsed {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) 0;
    gap: 0;
    min-height: calc(100dvh - 72px);
  }

  .diagram-area {
    grid-column: 1;
    grid-row: 1;
  }

  .data-area {
    grid-column: 1;
    grid-row: 2;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    min-height: 216px;
    padding: 0;
  }

  .data-area > .detail-panel {
    grid-column: 1;
    grid-row: 1;
  }

  .data-area > .table-wrap {
    grid-column: 2;
    grid-row: 1;
  }

  .left-pane-toggle {
    grid-row: 2;
    justify-self: center;
    width: 64px;
    height: 24px;
    margin: 0;
    transform: translateY(-50%);
  }

  .left-pane-toggle-icon {
    transform: none;
  }

  .workspace.is-left-pane-collapsed .data-area {
    min-height: 0;
    padding: 0;
  }

  .app-shell:has(.workspace.is-left-pane-collapsed) .viewer3d-status {
    max-width: calc(50vw - 72px);
  }

  .diagram-stage {
    min-height: 0;
  }
}

@media (max-width: 760px) {
  .data-list {
    max-height: 560px;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 8px;
    gap: 8px;
  }

  .topbar {
    padding-bottom: 2px;
  }

  .eyebrow {
    font-size: 0.72rem;
  }

  .workspace {
    gap: 0;
    grid-template-rows: minmax(430px, 74.8dvh) minmax(228px, 25.2dvh);
  }

  .workspace.is-left-pane-collapsed {
    grid-template-rows: minmax(0, 1fr) 0;
    gap: 0;
    min-height: calc(100dvh - 54px);
  }

  .workspace.is-left-pane-collapsed .data-area {
    min-height: 0;
  }

  .data-area {
    gap: 8px;
  }

  .data-area .detail-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .data-area .table-head {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .data-area .table-head h2 {
    grid-column: 1;
    grid-row: 1;
    font-size: 0.9rem;
  }

  .data-area .table-head > span {
    grid-column: 2;
    grid-row: 1;
  }

  .data-area .table-head .table-search {
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: minmax(0, 1fr);
  }

  .selection-badge {
    max-width: none;
  }

  .diagram-layout,
  .diagram-layout.single {
    grid-template-columns: 1fr;
  }

  .diagram-layout.single {
    min-width: 0;
  }

  .diagram-stage {
    min-height: 0;
    overflow: hidden;
  }

  .figure-panel,
  .figure-panel svg {
    min-height: 430px;
  }

  .viewer3d-panel {
    min-height: 430px;
  }

  .diagram-stage.is-3d .figure-panel,
  .diagram-stage.is-3d .viewer3d-panel {
    min-height: 100%;
  }

  .viewer3d-controls {
    left: 8px;
    top: 8px;
    gap: 6px;
    max-width: calc(100% - 16px);
  }

  .segmented {
    grid-template-columns: repeat(4, minmax(46px, 1fr));
    gap: 3px;
    padding: 3px;
  }

  .mode-btn {
    min-height: 32px;
    font-size: 0.82rem;
  }

  .variant-toggle {
    grid-template-columns: repeat(2, minmax(44px, 1fr));
    padding: 3px;
  }

  .variant-btn,
  .proportion-btn {
    min-height: 28px;
    font-size: 0.72rem;
  }

  .viewer3d-meta {
    left: auto;
    right: 8px;
    top: 8px;
    max-width: calc(100% - 230px);
    justify-items: start;
  }

  .viewer3d-legend {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 5px;
    padding: 7px 8px;
    font-size: 0.72rem;
    white-space: normal;
  }

  .viewer3d-options {
    gap: 4px;
    font-size: 0.74rem;
  }

  .viewer3d-options .focus-switch {
    min-height: 24px;
  }

  .pose-controls {
    left: 8px;
    bottom: 8px;
    width: 86px;
    gap: 4px;
  }

  .joint-control-panel {
    left: 8px;
    bottom: 178px;
    width: calc(100% - 16px);
    max-height: calc(100% - 196px);
    overflow: hidden;
    padding: 8px;
  }

  .pose-mode-overlay {
    left: 8px;
    top: 8px;
  }

  .pose-mode-overlay .segmented {
    width: min(250px, calc(100vw - 122px));
  }

  .pose-joint-overlay {
    left: 8px;
    top: 8px;
    bottom: 8px;
    width: calc(100% - 16px);
  }

  .pose-joint-overlay:has(.hand-control-panel) {
    width: calc(100% - 16px);
  }

  .joint-control-dock {
    display: grid;
    gap: 6px;
    width: 100%;
    max-height: 100%;
  }

  .pose-joint-overlay .joint-control-panel {
    left: auto;
    bottom: auto;
    width: 100%;
    max-height: 100%;
    overflow-x: hidden;
    overflow-y: hidden;
  }

  .hand-control-panel {
    width: 100%;
    max-height: 100%;
    padding: 8px;
  }

  .joint-panel-tabs {
    --joint-part-grid-gap: 4px;
    gap: 4px;
  }

  .joint-panel-tab {
    min-height: 26px;
    font-size: 0.66rem;
  }

  .joint-panel-empty {
    min-height: 140px;
    font-size: 0.66rem;
  }

  .joint-control-row {
    grid-template-columns: 28px 30px minmax(72px, 1fr) 30px 46px;
    gap: 3px;
    font-size: 0.62rem;
  }

  .pose-btn {
    min-height: 30px;
    padding: 0 8px;
    font-size: 0.72rem;
  }

  .viewer3d-label {
    width: 27px;
    height: 27px;
    font-size: 0.72rem;
  }

  .table-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: 8px;
    gap: 6px;
  }

  .table-search {
    order: 0;
    grid-column: 2;
    max-width: none;
    flex-basis: auto;
  }

  .table-search input {
    min-height: 30px;
    font-size: 0.78rem;
  }

  .detail-panel {
    padding: 12px;
  }

  .detail-title {
    font-size: 1.08rem;
  }

  .row {
    grid-template-columns: 32px minmax(0, 1fr);
    padding: 8px;
  }

  .row-code {
    width: 27px;
    height: 27px;
    font-size: 0.78rem;
  }

  .row-name {
    font-size: 0.84rem;
  }

  .row-meta {
    font-size: 0.7rem;
  }
}

@media (max-width: 430px) {
  :root:not(.is-touch-layout) .pose-overlay-right {
    top: 88px;
  }

  .workspace {
    grid-template-rows: minmax(390px, 73.6dvh) minmax(216px, 26.4dvh);
  }

  .workspace.is-left-pane-collapsed {
    grid-template-rows: minmax(0, 1fr) 0;
    min-height: calc(100dvh - 54px);
  }

  .figure-panel,
  .figure-panel svg,
  .viewer3d-panel {
    min-height: 390px;
  }

  .viewer3d-meta {
    max-width: calc(100% - 200px);
    top: 76px;
  }

  .viewer3d-legend {
    max-width: 150px;
  }

  .viewer3d-options {
    justify-items: start;
  }

  .segmented {
    grid-template-columns: repeat(4, minmax(40px, 1fr));
  }

  .mode-btn {
    font-size: 0.76rem;
  }

  .table-head {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .table-head > span {
    grid-column: 1 / -1;
    justify-self: end;
  }
}

@media (max-width: 980px) {
  .is-touch-layout .pose-joint-overlay {
    top: auto;
    bottom: max(8px, env(safe-area-inset-bottom));
    left: 8px;
    width: calc(100% - 16px);
    align-items: flex-end;
  }

  .is-touch-layout .pose-joint-overlay .joint-control-panel:not(.is-collapsed) {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: auto;
    max-height: 100%;
    padding: 8px;
    border-radius: 8px;
    overflow: visible;
    --joint-row-height: 49px;
  }

  .is-touch-layout .pose-joint-overlay .joint-control-panel.is-expanded {
    height: auto;
  }

  .is-touch-layout .pose-joint-overlay .joint-control-panel.is-collapsed {
    width: 100%;
    padding: 8px;
    overflow: visible;
  }

  .is-touch-layout .pose-joint-overlay:not(:has(.hand-control-panel)) .joint-control-dock {
    width: 480px;
  }

  .is-touch-layout .joint-sheet-grabber {
    position: relative;
    display: none;
    flex: 0 0 24px;
    width: 100%;
    min-height: 24px;
    padding: 0;
    border: 0;
    background: transparent;
    touch-action: none;
  }

  .is-touch-layout .joint-sheet-grabber::before {
    position: absolute;
    top: 8px;
    left: 50%;
    width: 40px;
    height: 5px;
    border-radius: 3px;
    background: rgba(78, 83, 84, 0.42);
    content: "";
    transform: translateX(-50%);
  }

  .is-touch-layout .pose-joint-overlay .joint-control-panel:not(.is-collapsed) .joint-panel-body {
    flex: 0 1 auto;
    min-height: 0;
  }

  .is-touch-layout .joint-panel-footer {
    flex: 0 0 auto;
  }

  .is-touch-layout .pose-joint-overlay .joint-panel-body {
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: auto;
    align-content: start;
  }

  .is-touch-layout .joint-control-row-group:has([data-joint-control="shoulderGirdleElevation"]),
  .is-touch-layout .joint-control-row-group:has([data-joint-control="leftShoulderGirdleElevation"]) {
    display: none;
  }

  .is-touch-layout .joint-control-row {
    grid-template-columns: 31px 34px minmax(24px, 1fr) 34px 56px;
    gap: 5px;
    min-height: var(--joint-row-height);
    font-size: 13px;
  }

  .is-touch-layout .joint-control-row-group { grid-template-columns: 23px minmax(0, 1fr); gap: 4px; padding: 5px; }
  .is-touch-layout .joint-control-group-label { font-size: 14px; }
  .is-touch-layout .joint-control-row.is-grouped { grid-template-columns: 34px minmax(24px, 1fr) 34px 56px; }
  .is-touch-layout .joint-control-row.is-grouped.has-control-label { grid-template-columns: 28px minmax(24px, 1fr) 28px 56px; }
  .is-touch-layout .joint-control-row.has-control-label .whole-body-control-label { grid-column: 1 / -1; text-align: left; }
  .is-touch-layout .joint-control-direction { white-space: normal; overflow-wrap: anywhere; line-height: 1.15; }
  .is-touch-layout .joint-control-number { width: 56px; height: 37px; min-width: 0; font-size: 16px; }
  .is-touch-layout .pose-joint-overlay .joint-panel-body { width: 100%; }
  .is-touch-layout .joint-panel-body > .joint-panel-toolbar { width: 100%; margin-bottom: 6px; }
  .is-touch-layout .hand-gesture-tools { grid-template-columns: 32px minmax(0, 1fr) 32px; }
  .is-touch-layout .hand-gesture-tools > .hand-preset-page-btn { grid-column: 1; grid-row: 1; }
  .is-touch-layout .hand-gesture-tools > .hand-preset-page-next { grid-column: 3; }
  .is-touch-layout .hand-gesture-tools > .hand-gesture-presets { grid-column: 2; grid-row: 1; }
  .is-touch-layout .hand-gesture-presets.is-paged { grid-template-rows: repeat(3, 32px); }
  .is-touch-layout .hand-preset-actions { grid-column: 1 / -1; grid-row: 2; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: 32px; }
  .is-touch-layout .joint-control-panel .hand-gesture-btn,
  .is-touch-layout .hand-preset-action-btn { min-height: 32px; font-size: 12px; }
  .is-touch-layout .whole-body-presets { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }

  .is-touch-layout .joint-control-row input[type="range"] {
    height: var(--joint-row-height);
    margin: 0;
  }

  .is-touch-layout .joint-control-row input[type="range"]::-webkit-slider-thumb {
    width: 28px;
    height: 28px;
    margin-top: -12px;
  }

  .is-touch-layout .joint-control-row input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
  }

  .is-touch-layout .joint-panel-tab,
  .is-touch-layout .joint-panel-footer .joint-reset-btn,
  .is-touch-layout .joint-panel-footer .joint-mirror-toggle,
  .is-touch-layout .joint-panel-toggle {
    min-height: 49px;
  }

  .is-touch-layout .pose-overlay-right {
    top: 8px;
    right: 8px;
    bottom: 8px;
    left: auto;
    width: 109px;
    max-height: none;
    justify-content: flex-start;
  }

  .is-touch-layout .pose3d-panel:has(.joint-control-panel:not(.is-collapsed)) .pose-preset-panel,
  .is-touch-layout .pose3d-panel:has(.joint-control-panel:not(.is-collapsed)) .pose-touch-axis-bar {
    display: none;
  }

  .is-touch-layout .pose-preset-panel {
    grid-template-rows: auto minmax(0, 1fr);
    width: 100%;
    height: auto;
    max-height: 100%;
    padding: 4px;
    border: 1px solid rgba(72, 72, 66, 0.16);
    border-radius: 8px;
    background: rgba(255, 253, 248, 0.92);
    box-shadow: 0 4px 14px rgba(36, 32, 28, 0.1);
    backdrop-filter: blur(8px);
  }

  .is-touch-layout .pose-preset-list {
    display: grid;
    gap: 5px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    padding-bottom: 2px;
  }

  .is-touch-layout .pose-preset-category {
    display: grid;
    gap: 4px;
  }

  .is-touch-layout .pose-preset-category + .pose-preset-category {
    margin-top: 3px;
  }

  .is-touch-layout .pose-preset-category-heading {
    position: static;
    min-height: 34px;
  }

  .is-touch-layout .pose-preset-category-items {
    display: grid;
    gap: 5px;
  }

  .is-touch-layout .pose-preset-list .pose-btn {
    min-width: 0;
    min-height: 49px;
    font-size: 13px;
    touch-action: manipulation;
  }

  .is-touch-layout .pose-preset-action,
  .is-touch-layout .pose-preset-view-toggle {
    min-height: 49px;
    touch-action: manipulation;
  }

  .is-touch-layout .pose-folder-toggle,
  .is-touch-layout .pose-preset-folder-select,
  .is-touch-layout .pose-folder-form input {
    min-height: 49px;
    font-size: 12px;
    touch-action: manipulation;
  }

  .is-touch-layout .pose-preset-list .pose-preset-item.is-editing .custom-pose-btn {
    touch-action: pan-y pinch-zoom;
  }

  .is-touch-layout .pose-folder-toggle.is-reorderable {
    touch-action: none;
  }

  .is-touch-layout .pose-preset-panel.is-editing {
    border-color: #83aa98;
    background: rgba(224, 240, 232, 0.96);
  }

  .is-touch-layout .pose-preset-drop-palette button {
    min-height: 49px;
  }

  .is-touch-layout .pose-folder-form input {
    font-size: 16px;
  }

  .is-touch-layout .pose-folder-tools button {
    width: 44px;
    height: 44px;
    touch-action: manipulation;
  }
}

/* Keep the pose viewport bounded; only the controls inside it may scroll. */
html:has(#diagramStage[data-rendered-mode="pose"]),
body:has(#diagramStage[data-rendered-mode="pose"]) {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.app-shell:has(#diagramStage[data-rendered-mode="pose"]) {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.workspace:has(#diagramStage[data-rendered-mode="pose"]) {
  min-height: 0;
  overflow: visible;
}

#diagramStage[data-rendered-mode="pose"] {
  height: 100%;
  min-height: 0;
}

#diagramStage[data-rendered-mode="pose"] > .diagram-layout {
  min-width: 0;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr);
}

#diagramStage[data-rendered-mode="pose"] .pose3d-panel {
  min-width: 0;
  min-height: 0;
}

@media (max-width: 1100px) {
  .workspace {
    row-gap: 0;
  }

  .workspace:has(#diagramStage[data-rendered-mode="pose"]) {
    grid-template-rows: minmax(0, 0.772fr) minmax(0, 0.228fr);
  }

  .workspace.is-left-pane-collapsed:has(#diagramStage[data-rendered-mode="pose"]) {
    grid-template-rows: minmax(0, 1fr) 0;
  }

  .workspace:has(#diagramStage[data-rendered-mode="pose"]) .data-area {
    min-height: 0;
  }
}

@media (max-width: 980px) {
  .is-touch-layout .pose-joint-overlay {
    top: 8px;
  }

  .is-touch-layout .pose-joint-overlay .joint-control-panel:not(.is-collapsed) {
    max-height: 100%;
  }

  .is-touch-layout .joint-control-panel {
    --joint-panel-action-col: 49px;
  }

  .is-touch-layout .joint-control-panel .joint-reset-btn,
  .is-touch-layout .joint-control-panel .joint-panel-toggle {
    width: 49px;
    height: 49px;
    min-height: 49px;
    padding: 0;
  }

  .is-touch-layout .joint-control-panel .joint-reset-btn {
    font-size: 23px;
  }

  .is-touch-layout .joint-control-panel .joint-panel-toggle {
    font-size: 16px;
  }

  .is-touch-layout .joint-panel-footer {
    position: relative;
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
  }

  .is-touch-layout .joint-panel-footer .joint-panel-tabs {
    min-width: 0;
    width: 100%;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-template-rows: repeat(2, 40px);
  }

  .is-touch-layout .joint-panel-footer .joint-panel-tabs .joint-panel-tab {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.1;
    font-size: 12px;
  }

  .is-touch-layout .joint-panel-footer .joint-panel-tab { height: 40px; min-height: 40px; gap: 0; }
  .is-touch-layout .pose3d-panel .joint-part-icon { width: 26px; height: 28px; max-height: 28px; }
  .is-touch-layout .pose3d-panel .joint-panel-tab[data-joint-panel="trunkPelvis"] .joint-part-icon { width: 28px; }
  .is-touch-layout .joint-part-label { font-size: 11px; line-height: 12px; }
  .is-touch-layout .joint-panel-side-mark { width: 18px; height: 18px; font-size: 10px; }
  .is-touch-layout .joint-panel-actions { grid-template-rows: 40px; }
  .is-touch-layout .joint-control-panel .joint-panel-actions > button { width: 100%; height: 40px; min-height: 40px; padding: 0 1px; gap: 0; touch-action: manipulation; }
  .is-touch-layout .pose3d-panel .joint-panel-actions svg { width: 22px; height: 22px; max-height: 22px; }
}

@media (max-width: 720px) {
  .pose-joint-overlay .joint-control-dock {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
  }

  .pose-joint-overlay .joint-control-panel,
  .pose-joint-overlay .hand-control-panel {
    flex: 0 1 auto;
  }
}

.pose-touch-axis-bar {
  display: none;
  position: absolute;
  z-index: 15;
  left: 8px;
  right: 8px;
  bottom: max(8px, env(safe-area-inset-bottom));
  height: 142px;
  box-sizing: border-box;
  padding: 6px;
  border: 1px solid #bdc7c9;
  border-radius: 6px;
  background: #fafcfc;
  color: #25383c;
  box-shadow: 0 2px 10px rgba(30, 45, 49, 0.15);
  --axis-color: #c74444;
}

.pose-touch-axis-bar[data-axis="y"] { --axis-color: #24884d; }
.pose-touch-axis-bar[data-axis="z"] { --axis-color: #2867cf; }
.pose-touch-axis-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 49px;
  grid-template-rows: 20px 49px;
  align-items: center;
  gap: 2px 8px;
  height: 71px;
}
.pose-touch-axis-joint {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.pose-touch-axis-buttons {
  grid-column: 1 / 3;
  grid-row: 2;
  display: flex;
  height: 49px;
}
.pose-touch-axis-buttons button {
  flex: 1 1 49px;
  min-width: 0;
  height: 49px;
  padding: 2px 4px;
  border: 1px solid #ced7d9;
  border-radius: 0;
  background: #fff;
  font-size: 13px;
  line-height: 16px;
  overflow-wrap: anywhere;
  font-weight: 700;
  touch-action: manipulation;
}
.pose-touch-axis-buttons button[hidden] { display: none; }
.pose-touch-axis-buttons button[data-axis="x"] { color: #c74444; }
.pose-touch-axis-buttons button[data-axis="y"] { color: #24884d; }
.pose-touch-axis-buttons button[data-axis="z"] { color: #2867cf; }
.pose-touch-axis-buttons button[aria-pressed="true"] {
  background: #edf2f3;
  box-shadow: inset 0 -3px 0 currentColor;
}
.pose-touch-axis-value {
  grid-column: 2;
  grid-row: 1;
  color: var(--axis-color);
  text-align: right;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.pose-touch-axis-track {
  display: grid;
  grid-template-columns: 49px minmax(0, 1fr) 49px;
  gap: 4px;
  align-items: center;
  height: 49px;
  margin-top: 6px;
  color: var(--axis-color);
  text-align: center;
  font-size: 18px;
}
.pose-touch-axis-close,
.pose-touch-axis-track button {
  display: grid;
  place-items: center;
  width: 49px;
  height: 49px;
  padding: 0;
  border: 1px solid #ced7d9;
  border-radius: 4px;
  background: #fff;
  color: inherit;
  font: 22px system-ui, sans-serif;
  cursor: pointer;
  touch-action: manipulation;
}
.pose-touch-axis-close {
  grid-column: 3;
  grid-row: 1 / -1;
  color: #52666a;
}
.pose-touch-axis-track button:disabled { opacity: 0.35; cursor: default; }
.pose-touch-axis-close:focus-visible,
.pose-touch-axis-track button:focus-visible { outline: 2px solid #27636a; outline-offset: 1px; }
.pose-touch-axis-track input {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-width: 0;
  height: 49px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: var(--axis-color);
  touch-action: none;
  cursor: ew-resize;
}
.pose-touch-axis-track input::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: #d4dee0;
}
.pose-touch-axis-track input::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 30px;
  height: 30px;
  margin-top: -12px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--axis-color);
  box-shadow: 0 0 0 1px var(--axis-color);
}
.pose-touch-axis-track input::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: #d4dee0;
}
.pose-touch-axis-track input::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--axis-color);
}
.pose-touch-axis-track input:focus {
  outline: none;
}
.pose-touch-axis-track input:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px var(--axis-color);
}
.pose-touch-axis-track input:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 3px var(--axis-color);
}

@media (max-width: 980px) {
  .pose3d-panel:has(.joint-control-panel:not(.is-collapsed)) .pose-preset-panel {
    display: none;
  }
  .pose3d-panel:has(.joint-control-panel:not(.is-collapsed)) .pose-overlay-right {
    top: 8px;
  }
  .is-touch-layout .pose-touch-axis-bar:not([hidden]) { display: block; }
  .is-touch-layout .pose3d-panel:has(.pose-touch-axis-bar:not([hidden])) .pose-overlay-right {
    bottom: max(158px, calc(env(safe-area-inset-bottom) + 150px));
  }
  .is-touch-layout .pose3d-panel:has(.joint-control-panel:not(.is-collapsed)) .pose-joint-overlay {
    bottom: max(8px, env(safe-area-inset-bottom));
  }
  .is-touch-layout .pose3d-panel:has(.joint-control-panel.is-collapsed) .pose-touch-axis-bar {
    bottom: max(81px, calc(env(safe-area-inset-bottom) + 73px));
  }
  .is-touch-layout .pose3d-panel:has(.joint-control-panel.is-collapsed):has(.pose-touch-axis-bar:not([hidden])) .pose-overlay-right {
    bottom: max(231px, calc(env(safe-area-inset-bottom) + 223px));
  }
}
.pose-model-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 26px 26px;
  gap: 4px;
  width: 216px;
  max-width: 100%;
}
.pose-model-toolbar button {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(255, 253, 248, 0.94);
  color: var(--pose);
  cursor: pointer;
  font-family: inherit;
}
.pose-model-toolbar button:hover:not(:disabled),
.pose-model-toolbar button:focus-visible { border-color: var(--pose); }
.pose-model-buttons { display: flex; min-width: 0; gap: 3px; }
.pose-model-buttons button { display: flex; align-items: center; justify-content: center; gap: 3px; flex: 1; min-width: 0; padding: 3px 2px; font-size: 11px; height: 26px; }
.pose-model-buttons button.is-active { color: #fff; background: #27636a; border-color: #27636a; }
.pose-model-selection-check { display: grid; place-items: center; width: 12px; height: 12px; flex: 0 0 12px; visibility: hidden; }
.pose-model-selection-check svg { display: block; width: 12px; height: 12px; min-height: 0; max-height: 12px; }
.pose-model-buttons button.is-active .pose-model-selection-check { visibility: visible; }
.pose-model-buttons button:focus-visible { outline: 2px solid #27636a; outline-offset: 2px; }
.pose-model-markers { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.pose-model-marker { position: absolute; top: 0; left: 0; width: 32px; height: 32px; display: grid; place-items: center; padding: 2px; border: 0; background: transparent; color: #31565b; cursor: pointer; pointer-events: auto; touch-action: manipulation; font: 700 14px system-ui, sans-serif; }
.pose-model-marker-number { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid #7b9296; border-radius: 4px; background: rgba(255,255,255,.96); box-shadow: 0 1px 4px #172d3030; }
.pose-model-marker.is-active .pose-model-marker-number { color: #fff; background: #27636a; border: 2px solid #fff; outline: 1px solid #27636a; }
.pose-model-marker:hover .pose-model-marker-number { outline: 2px solid #27636a; outline-offset: 1px; }
.pose-model-marker:focus-visible { outline: 0; }
.pose-model-marker:focus-visible .pose-model-marker-number { outline: 3px solid #102e32; outline-offset: 2px; }
.pose-model-markers[data-compact="true"] .pose-model-marker { width: 44px; height: 44px; }
.pose-model-markers[data-compact="true"] .pose-model-marker-number { width: 32px; height: 32px; }
.pose-model-markers[hidden], .pose-model-marker[hidden] { display: none; }
.pose-model-tool { display: grid; place-items: center; width: 26px; height: 26px; padding: 4px; }
.pose-model-tool svg { width: 17px; height: 17px; min-height: 0; max-height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pose-model-tool:disabled { opacity: 0.35; cursor: default; }
.pose-model-color-row {
  display: grid;
  grid-template-columns: 26px 58px minmax(0, 1fr) 24px;
  gap: 3px;
}
.pose-model-color-row input,
.pose-model-color-row [data-pose-model-material] {
  min-width: 0;
  width: 100%;
  height: 28px;
  padding: 3px 4px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  font: 11px monospace;
  box-sizing: border-box;
}
.pose-model-color-row [data-pose-model-material] { font-family: inherit; font-size: 11px; cursor: pointer; white-space: nowrap; }
.pose-model-color-row input[type="color"] { padding: 3px; cursor: pointer; }
.pose-model-color-row input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.pose-model-color-row input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 2px; }
.pose-model-color-row input[type="color"]::-moz-color-swatch { border: 0; border-radius: 2px; }
.pose-model-color-row input:focus-visible { outline: 2px solid var(--pose); outline-offset: 1px; }
.pose-model-color-row input[aria-invalid="true"] { border-color: #bb4444; }
.pose-tools-popover .pose-model-color-row button { padding: 4px; display: grid; place-items: center; }
.pose-model-color-row svg {
  width: 17px;
  height: 17px;
  min-height: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pose-model-color-row button:disabled { opacity: 0.35; cursor: default; }
@media (max-width: 600px) {
  .pose-model-toolbar { grid-template-columns: minmax(0, 1fr) 32px 32px; }
  .pose-model-buttons button { height: 32px; }
  .pose-model-tool { width: 32px; height: 32px; }
  .pose-model-color-row { grid-template-columns: 32px 58px minmax(0, 1fr) 32px; }
  .pose-model-color-row input,
  .pose-model-color-row [data-pose-model-material] { height: 36px; }
}

@media (max-width: 980px) {
  .is-touch-layout .pose-mode-overlay { width: 263px; max-width: calc(100% - 133px); }
  .is-touch-layout .pose-mode-overlay .segmented { width: 100%; }
  .is-touch-layout .pose-mode-overlay .mode-btn { min-width: 0; min-height: 37px; padding-inline: 4px; }
  .is-touch-layout .pose-model-toolbar {
    width: 263px;
    max-width: 100%;
    grid-template-columns: minmax(0, 1fr) 49px 49px;
  }
  .is-touch-layout .pose-model-buttons button {
    height: 49px;
    font-size: 13px;
    padding-inline: 0;
    gap: 2px;
    touch-action: manipulation;
  }
  .is-touch-layout .pose-model-tool,
  .is-touch-layout .pose-undo-button {
    width: 49px;
    height: 49px;
    touch-action: manipulation;
  }
  .is-touch-layout .pose-tools-menu summary {
    min-width: 69px;
    min-height: 49px;
    touch-action: manipulation;
  }
  .is-touch-layout .pose-camera-utility-stack { display: grid; grid-template-columns: minmax(0, 1fr) 49px 49px; width: 100%; }
  .is-touch-layout .pose-tools-menu { width: 100%; }
  .is-touch-layout .camera-lens-readout { grid-column: 1 / -1; align-self: center; min-width: 0; gap: 6px; padding-inline: 0; line-height: 1.1; }
  .is-touch-layout .camera-lens-readout input[type="range"] { height: 44px; }
  .is-touch-layout .pose-model-tool svg { width: 21px; height: 21px; max-height: 21px; }
  .is-touch-layout .pose-tools-popover > button { min-height: 49px; }
  .is-touch-layout .pose-model-color-row { grid-template-columns: 44px 64px minmax(0, 1fr) 44px; }
  .is-touch-layout .pose-model-color-row input,
  .is-touch-layout .pose-model-color-row [data-pose-model-material] { height: 49px; }
}

@media (max-width: 980px) {
  .is-touch-layout .pose-model-toolbar:has([data-pose-model-id="model-2"]) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .is-touch-layout .pose-model-toolbar:has([data-pose-model-id="model-2"]) .pose-model-buttons { grid-column: 1 / -1; }
  .is-touch-layout .pose-model-toolbar:has([data-pose-model-id="model-2"]) .pose-model-tool { width: 100%; }
}

@media (max-width: 360px) {
  :root:not(.is-touch-layout) .pose-overlay-right { top: 128px; }
  .viewer3d-controls .layer-toggle { grid-template-columns: repeat(2, minmax(38px, 1fr)); }
  .viewer3d-meta { max-width: calc(100% - 16px); }
  .is-touch-layout .pose-mode-overlay .segmented { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pose-mode-overlay .viewport-mode-row .segmented,
  .viewer3d-controls .viewport-mode-row .segmented { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .is-touch-layout .pose-model-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .is-touch-layout .pose-model-buttons { grid-column: 1 / -1; }
  .is-touch-layout .pose-model-tool { width: 100%; }
  .is-touch-layout .pose-camera-utility-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .is-touch-layout .pose-tools-menu { grid-column: 1 / -1; }
}

@media (min-width: 600px) and (max-width: 980px) and (orientation: landscape) {
  .is-touch-layout .pose-overlay-right { top: 8px; }
  .is-touch-layout .pose-touch-axis-bar { left: 295px; }
  .is-touch-layout .pose-joint-overlay .joint-control-panel:not(.is-collapsed) { height: auto; max-height: 100%; }
}

@media (min-width: 768px) and (max-width: 980px) and (orientation: landscape) {
  .is-touch-layout .pose-touch-axis-bar { right: 125px; }
  .is-touch-layout .pose3d-panel:has(.pose-touch-axis-bar:not([hidden])) .pose-overlay-right {
    bottom: max(8px, env(safe-area-inset-bottom));
  }
  .is-touch-layout .pose3d-panel:has(.joint-control-panel.is-collapsed):has(.pose-touch-axis-bar:not([hidden])) .pose-overlay-right {
    bottom: max(8px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 980px) {
  .is-touch-layout .pose-joint-overlay:has(.hand-control-panel) .joint-control-panel { display: none; }
  .is-touch-layout .pose-joint-overlay:has(.hand-control-panel) .joint-control-dock { width: 480px; }
  .is-touch-layout .pose-joint-overlay .hand-control-panel { flex: 0 1 auto; width: 100%; max-height: 100%; gap: 6px; padding: 8px; scrollbar-gutter: auto; }
  .is-touch-layout .hand-control-panel-header { grid-template-columns: minmax(0, 1fr) auto 49px; font-size: 14px; }
  .is-touch-layout .hand-control-panel-header span { font-size: 13px; }
  .is-touch-layout .hand-control-panel-close { width: 49px; height: 49px; font-size: 22px; touch-action: manipulation; }
  .is-touch-layout .hand-control-temp-title { font-size: 14px; }
  .is-touch-layout .hand-control-temp-panel { align-content: start; }
  .is-touch-layout .hand-control-rows { gap: 3px; }
  .is-touch-layout .hand-control-row { grid-template-columns: 54px minmax(24px, 1fr) 56px; gap: 6px; min-height: 39px; font-size: 13px; }
  .is-touch-layout .hand-control-row input[type="range"] { height: 39px; margin: 0; }
  .is-touch-layout .hand-control-row input[type="range"]::-webkit-slider-thumb { width: 26px; height: 26px; margin-top: -11px; }
  .is-touch-layout .hand-control-row input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; }
  .is-touch-layout .hand-control-row input[type="number"] { width: 56px; height: 37px; font-size: 16px; }
  .is-touch-layout .hand-control-tab { min-height: 49px; font-size: 14px; touch-action: manipulation; }
  .is-touch-layout .hand-control-pad-row { grid-template-columns: 64px minmax(0, 1fr); }
  .is-touch-layout .hand-control-pad { height: 101px; }
  .is-touch-layout .hand-control-pad-thumb { width: 24px; height: 24px; }
  .is-touch-layout .hand-control-pad-action { min-height: 49px; font-size: 13px; touch-action: manipulation; }
}

@media (max-width: 980px) and (max-height: 700px) {
  .is-touch-layout .pose-joint-overlay .joint-control-panel:not(.is-collapsed) { --joint-row-height: 37px; padding: 6px; }
  .is-touch-layout .pose-joint-overlay .joint-control-panel.is-collapsed { padding: 6px; }
  .is-touch-layout .joint-control-row-group { padding: 3px; margin-bottom: 0; }
  .is-touch-layout .joint-control-row.is-grouped.has-control-label { grid-template-columns: 28px 24px minmax(24px, 1fr) 24px 56px; }
  .is-touch-layout .joint-control-row.has-control-label .whole-body-control-label { grid-column: auto; white-space: normal; }
}

@media (min-width: 600px) and (max-width: 980px) and (orientation: landscape) {
  .is-touch-layout .pose-joint-overlay:not(:has(.hand-control-panel)) .joint-control-dock { width: 100%; }
  .is-touch-layout .pose-joint-overlay:not(:has(.hand-control-panel)) .joint-control-panel:not(.is-collapsed) { display: grid; grid-template-columns: minmax(0, 1fr) 280px; grid-template-rows: minmax(0, 1fr); align-items: end; padding: 6px; }
  .is-touch-layout .pose-joint-overlay:not(:has(.hand-control-panel)) .joint-control-panel.is-collapsed { display: grid; grid-template-columns: minmax(0, 1fr) 280px; grid-template-rows: auto; padding: 6px; }
  .is-touch-layout .joint-control-panel.is-collapsed .joint-panel-footer { grid-column: 2; }
  .is-touch-layout .pose-joint-overlay .joint-panel-body { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .is-touch-layout .joint-panel-body > .joint-panel-toolbar { grid-column: 1 / -1; }
  .is-touch-layout .joint-control-row-group { grid-template-columns: minmax(0, 1fr); gap: 4px; padding: 6px; }
  .is-touch-layout .joint-control-group-label { writing-mode: horizontal-tb; justify-items: start; }
  .is-touch-layout .joint-control-row { grid-template-columns: 18px 34px minmax(24px, 1fr) 34px 56px; gap: 3px; }
  .is-touch-layout .joint-control-row.is-grouped { grid-template-columns: 34px minmax(24px, 1fr) 34px 56px; }
  .is-touch-layout .joint-panel-body:has(.whole-body-presets) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .is-touch-layout .whole-body-presets { grid-column: 1 / -1; grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .is-touch-layout .joint-control-row.is-grouped.has-control-label { grid-template-columns: 18px 18px minmax(24px, 1fr) 18px 56px; }
  .is-touch-layout .joint-control-row.has-control-label .whole-body-control-label { grid-column: auto; white-space: normal; }
  .is-touch-layout .pose-joint-overlay:has(.hand-control-panel) .joint-control-dock { width: 100%; }
  .is-touch-layout .pose-joint-overlay .hand-control-panel { grid-template-columns: minmax(240px, 1fr) minmax(180px, 1fr); grid-template-rows: 49px auto; padding: 8px; }
  .is-touch-layout .hand-control-panel-header { grid-column: 1 / -1; }
  .is-touch-layout .hand-control-temp-panel { grid-column: 1; grid-row: 2; }
  .is-touch-layout .hand-control-rows { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .is-touch-layout .hand-control-row { grid-template-columns: 34px minmax(24px, 1fr) 56px; gap: 4px; }
  .is-touch-layout .hand-control-pad-row { grid-column: 2; grid-row: 2; align-self: start; }
  .is-touch-layout .hand-control-tabs { grid-column: 2; grid-row: 2; align-self: end; margin-top: 107px; }
}

/* Keep corner controls near the frame without changing their size or collision rules. */
.viewer3d-panel { --viewer-control-inset: 6px; }
.viewer3d-panel > .pose-mode-overlay,
.viewer3d-panel > .viewer3d-controls {
  top: var(--viewer-control-inset);
  left: var(--viewer-control-inset);
}
.viewer3d-panel > .viewer3d-meta {
  top: var(--viewer-control-inset);
  right: var(--viewer-control-inset);
}
.pose3d-panel > .pose-overlay-right {
  right: var(--viewer-control-inset);
  bottom: var(--viewer-control-inset);
}
.pose3d-panel {
  --pose-rail-button-size: 36px;
  --pose-reset-height: 32px;
  --pose-rail-width: calc(var(--pose-rail-button-size) + 18px);
  --joint-panel-offset: calc(var(--viewer-control-inset) + var(--pose-rail-width) + 6px);
}
.pose3d-panel > .pose-joint-overlay {
  left: var(--joint-panel-offset);
  max-width: calc(100% - var(--joint-panel-offset) - var(--viewer-control-inset));
}
.pose3d-panel > .pose-reset-control {
  position: absolute;
  z-index: 10;
  left: calc(var(--viewer-control-inset) + 4px);
  bottom: max(var(--viewer-control-inset), env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: var(--pose-rail-button-size);
  height: var(--pose-reset-height);
  padding: 0;
  touch-action: manipulation;
}
.pose3d-panel > .pose-reset-control svg {
  width: 18px;
  height: 18px;
  min-height: 0;
  max-height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.joint-action-placeholder { pointer-events: none; }
@media (pointer: coarse) {
  .pose3d-panel { --pose-rail-button-size: 44px; --pose-reset-height: 40px; }
}
.pose3d-panel:has(.joint-control-panel.is-collapsed) > .pose-joint-overlay {
  left: calc(var(--viewer-control-inset) + var(--pose-rail-button-size) + 10px);
  bottom: max(var(--viewer-control-inset), env(safe-area-inset-bottom));
}
.pose3d-panel > .pose-joint-overlay .joint-control-panel.is-collapsed,
.is-touch-layout .pose3d-panel > .pose-joint-overlay .joint-control-panel.is-collapsed {
  display: block;
  width: max-content;
  padding: 0;
  border: 0;
}
.pose3d-panel .joint-control-panel.is-collapsed .joint-panel-actions {
  width: max-content;
  grid-template-columns: repeat(2, var(--pose-rail-button-size));
  grid-template-rows: var(--pose-reset-height);
}
.pose3d-panel .joint-control-panel.is-collapsed .joint-panel-actions > button {
  height: var(--pose-reset-height);
  min-height: var(--pose-reset-height);
}
.is-touch-layout .pose3d-panel > .pose-overlay-right { top: var(--viewer-control-inset); }
@media (min-width: 431px) {
  .pose3d-panel > .pose-overlay-right { top: var(--viewer-control-inset); }
}
@media (max-width: 980px) {
  .viewer3d-panel { --viewer-control-inset: 4px; }
}

