.auto-rig-selection { box-sizing:border-box; width:min(900px,calc(100vw - 24px)); max-height:calc(100dvh - 24px); padding:0; border:1px solid #484848; border-radius:16px; background:#202020; color:#eee; font-family:inherit; overflow:hidden; }
.auto-rig-selection[open] { display:flex; flex-direction:column; }
.auto-rig-selection::backdrop { background:#000b; }
.auto-rig-selection [hidden] { display:none !important; }
.auto-rig-selection header,.auto-rig-selection footer { display:flex; align-items:center; gap:12px; padding:16px 20px; flex-shrink:0; }
.auto-rig-selection header { justify-content:space-between; border-bottom:1px solid #393939; }
.auto-rig-selection h2 { font-size:22px; margin:5px 0 0; }
.auto-rig-selection h3 { font-size:16px; margin:12px 0; }
.auto-rig-selection small,.auto-rig-demo-label { font-size:11px; color:#aaa; line-height:1.5; }
.auto-rig-selection header small { color:#ffab40; letter-spacing:.08em; }
.auto-rig-selection button { font:inherit; font-size:14px; min-height:44px; padding:10px 16px; border:1px solid #494949; border-radius:9px; background:#303030; color:#eee; cursor:pointer; }
.auto-rig-selection button:focus-visible { outline:2px solid #ff9500; outline-offset:2px; }
.auto-rig-selection button:hover { border-color:#ff9500; }
.auto-rig-selection button:disabled { opacity:.4; cursor:default; }
.auto-rig-selection [data-rig="close"] { font-size:24px; min-width:44px; }
.auto-rig-content { display:grid; grid-template-columns:1fr 1fr; min-height:0; overflow:auto; scrollbar-width:thin; scrollbar-color:#555 #222; }
.auto-rig-guide,.auto-rig-outliner,.auto-rig-review { padding:20px; min-width:0; }
.auto-rig-guide { background:#191919; }
.auto-rig-guide svg { display:block; width:100%; max-height:220px; }
.auto-rig-selection p { font-size:14px; line-height:1.5; color:#ccc; }
.auto-rig-selection .auto-rig-note { font-size:12px; color:#aaa; }
.auto-rig-list-heading { display:flex; align-items:center; justify-content:space-between; }
.auto-rig-row { display:flex; align-items:center; text-align:left; width:100%; gap:12px; margin:6px 0; }
.auto-rig-row span:last-child { overflow-wrap:anywhere; min-width:0; }
.auto-rig-row[aria-pressed="true"] { border-color:#ff9500; background:#483219; color:#ffb14b; }
.auto-rig-selection footer { border-top:1px solid #393939; }
.auto-rig-selection footer [role="status"] { flex:1; font-size:12px; color:#bbb; }
.auto-rig-selection .auto-rig-primary { background:#f28a00; color:#171717; border-color:#f28a00; font-weight:700; min-width:90px; }
.auto-rig-review { overflow:auto; }
.rig-test-option { display:flex; align-items:center; gap:10px; margin:12px 0; min-height:44px; font-size:14px; }
.rig-test-option select { background:#303030; color:#eee; border:1px solid #555; border-radius:8px; padding:10px; min-height:44px; font:inherit; }
.rig-test-option input { width:20px; height:20px; accent-color:#f28a00; }
.auto-rig-orient { display:grid; grid-template-columns:minmax(0,1.4fr) minmax(0,1fr); overflow:auto; min-height:0; scrollbar-width:thin; scrollbar-color:#555 #222; color-scheme:dark; }
.auto-rig-preview { min-width:0; height:390px; background:#303238; touch-action:none; }
.auto-rig-preview canvas { display:block; width:100%; height:100%; }
.auto-rig-preview { position:relative; overflow:hidden; }
.rig-marker-overlay { position:absolute; inset:0; pointer-events:none; }
.auto-rig-selection .rig-marker-handle { position:absolute; transform:translate(-50%,-50%); width:44px; height:44px; min-width:44px; padding:0; border:0; border-radius:50%; background:transparent; pointer-events:auto; touch-action:none; box-shadow:none; }
.auto-rig-selection .rig-marker-handle::after { content:""; position:absolute; left:50%; top:50%; transform:translate(-50%,-50%); box-sizing:border-box; width:13.2px; height:13.2px; border:2px solid var(--marker-color); border-radius:50%; background:#16161680; box-shadow:0 0 0 1px #111; }
.auto-rig-selection .rig-marker-handle[aria-pressed="true"] { outline:0; }
.rig-marker-handle[aria-pressed="true"]::after { outline:1px solid white; outline-offset:2px; }
.rig-marker-handle:focus-visible::after { outline:2px solid white; outline-offset:3px; }
.rig-marker-zoom { position:absolute; bottom:10px; left:50%; transform:translateX(-50%); display:flex; gap:4px; z-index:2; padding:4px; border-radius:10px; background:#161616d9; }
.auto-rig-selection .rig-marker-zoom button { min-width:44px; min-height:44px; padding:6px 10px; }
.rig-marker-list { display:grid; grid-template-columns:1fr 1fr; gap:6px; }
.auto-rig-selection .rig-marker-list button { border-left:4px solid var(--marker-color); text-align:left; padding:8px; }
.rig-marker-list button[aria-pressed="true"] { background:#49321b; outline:1px solid #f28a00; }
.rig-marker-symmetry { display:flex; align-items:center; gap:10px; min-height:44px; font-size:14px; }
.rig-marker-symmetry input { width:20px; height:20px; accent-color:#f28a00; }
.rig-marker-nudge { display:flex; gap:6px; }
.auto-rig-orient-controls { padding:16px; min-width:0; display:flex; flex-direction:column; gap:12px; }
.auto-rig-orient-controls p { margin:0; }
.auto-rig-orient-controls strong { font-size:13px; }
.auto-rig-control-row { display:flex; flex-wrap:wrap; gap:6px; }
.auto-rig-control-row button { padding:8px 12px; }
.auto-rig-selection [role="alert"] { color:#ffb9a8; }
@media(max-width:600px) { .auto-rig-orient { grid-template-columns:1fr; flex:1; align-content:start; } .auto-rig-preview { height: min(42dvh,340px); min-height:200px; } }
@media(max-width:600px) { .auto-rig-selection { width:100%; max-width:none; max-height:100dvh; height:100dvh; margin:0; border:0; border-radius:0; } .auto-rig-content { grid-template-columns:1fr; flex:1; align-content:start; } .auto-rig-guide svg { max-height:130px; } .auto-rig-guide,.auto-rig-outliner { padding:12px 16px; } .auto-rig-selection header,.auto-rig-selection footer { padding:12px 16px; } .auto-rig-selection footer { flex-wrap:wrap; padding-bottom:max(12px,env(safe-area-inset-bottom)); } .auto-rig-selection footer [role="status"] { flex-basis:100%; } .auto-rig-selection [data-rig="cancel"] { margin-left:auto; } }
.rig-library-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; }
.rig-library-card { display:flex; flex-direction:column; align-items:center; gap:6px; padding:12px 8px; background:#272727; color:#eee; border:1px solid #444; border-radius:12px; min-width:0; cursor:pointer; font:inherit; }
.rig-library-card:hover,.rig-library-card.active { border-color:#f28a00; background:#3b2c1b; }
.rig-library-card:focus-visible { outline:2px solid #f28a00; outline-offset:2px; }
.rig-library-card svg { width:80px; height:64px; fill:none; stroke:#ffab40; stroke-width:4; stroke-linecap:round; }
.rig-library-card strong { font-size:14px; }
.rig-library-card span,.rig-library-note { font-size:12px; color:#bbb; line-height:1.5; }
.rig-library-card small { color:#ffab40; padding:4px; }
@media(max-width:600px){.rig-library-grid{grid-template-columns:repeat(2,minmax(0,1fr));}}

.rig-joint-adjust input[type="number"] { min-width:0; width:130px; padding:8px; border:1px solid #505050; border-radius:6px; background:#252525; color:#eee; }
.rig-weight-paint summary, .rig-part-bindings summary, .rig-joint-adjust summary, .rig-diagnostics summary { padding:12px 0; cursor:pointer; color:#f5a34d; }

.rig-part-bindings .rig-test-option { display:flex; flex-direction:column; align-items:stretch; overflow-wrap:anywhere; }
.rig-part-bindings select { width:100%; min-width:0; max-width:100%; }

.rig-weight-paint input[type="range"] { width:140px; max-width:100%; }
.rig-weight-paint select { min-width:0; max-width:100%; }

.rig-retarget-panel { border-top:1px solid #444; padding:8px 0; min-width:0; }
.rig-retarget-panel summary { padding:12px 0; cursor:pointer; color:#f5a34d; font-size:14px; }
.rig-retarget-panel .anim-field { margin:10px 0; }
.rig-retarget-panel select { width:100%; min-width:0; max-width:100%; }
.rig-retarget-panel > label { display:flex; align-items:center; gap:8px; padding:8px 0; }
.rig-retarget-panel > button { min-height:44px; margin-top:8px; padding:10px 16px; border:1px solid #d68119; border-radius:8px; background:#3b2c1b; color:#ffb454; font:inherit; cursor:pointer; }
.rig-retarget-panel > button:hover { background:#51391f; }
.rig-retarget-panel > button:disabled { opacity:.45; cursor:default; }
.rig-retarget-panel > button:focus-visible { outline:2px solid #f28a00; outline-offset:2px; }
.rig-retarget-panel input[type="checkbox"] { accent-color:#f28a00; }

.rig-marker-skeleton { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; overflow:hidden; }
.rig-marker-skeleton line { stroke:#e4eaff; stroke-width:2; opacity:.65; }
.rig-marker-list button[hidden] { display:none; }
.auto-rig-selection details > summary { padding:12px 0; cursor:pointer; color:#f5a34d; }
.auto-rig-selection .rig-test-option { flex-wrap:wrap; }
.auto-rig-selection .rig-test-option select { min-width:0; max-width:100%; }
@media(max-width:600px) {
  .auto-rig-selection footer { gap:6px; }
  .auto-rig-selection footer button { padding-left:10px; padding-right:10px; }
  /* Keep the character visible while choosing landmarks or editing weights. */
  .auto-rig-orient { grid-template-rows:minmax(160px,40%) minmax(0,1fr); align-content:stretch; overflow:hidden; }
  .auto-rig-preview { height:100%; min-height:0; }
  .auto-rig-orient-controls,.auto-rig-review { min-height:0; overflow:auto; overscroll-behavior:contain; }
  .rig-marker-zoom { left:auto; right:6px; top:6px; bottom:auto; transform:none; flex-direction:column; padding:2px; gap:2px; }
}

/* Guided landmark placement shares the existing marker model and controls. */
.rig-marker-guide { display:grid; gap:10px; }
.rig-guide-heading { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.auto-rig-selection .rig-guide-toggle { font-size:12px; padding:6px 9px; }
.rig-guide-progress { color:#ffa332; }
.rig-guide-reference { display:flex; align-items:center; gap:12px; padding:12px; border:1px solid #424242; border-radius:12px; background:#262626; }
.rig-guide-reference svg { width:90px; height:104px; flex:none; }
.rig-guide-reference h3 { margin:0 0 6px; font-size:18px; }
.rig-guide-reference p { font-size:14px; line-height:1.45; }
.rig-guide-auto { display:flex; align-items:center; gap:8px; font-size:13px; }
.rig-guide-auto input { accent-color:#f28a00; width:18px; height:18px; }
.rig-marker-handle.is-muted { opacity:.25; }
.rig-marker-sides { position:absolute; inset:8px 8px auto; display:flex; justify-content:space-between; pointer-events:none; gap:12px; font-size:11px; color:#eee; }
.rig-marker-sides span { background:#161616b8; border-radius:5px; padding:4px 6px; }
.rig-marker-skeleton[hidden],.rig-guide-auto[hidden],.auto-rig-selection .rig-marker-suggest[hidden] { display:none; }
@media(max-width:600px) {
  .auto-rig-selection footer { flex-wrap:wrap; }
  .auto-rig-selection footer [data-rig="status"] { flex-basis:100%; font-size:11px; }
  .auto-rig-selection footer [data-rig="next"] { margin-left:auto; }
  .rig-marker-sides { right:60px; font-size:10px; }
  .rig-guide-reference { padding:8px; gap:8px; }
  .rig-guide-reference svg { width:66px; height:84px; }
  .auto-rig-orient-controls:has(.rig-marker-guide) { padding:12px; gap:10px; }
}

.rig-guide-extras > div { display:flex; flex-direction:column; gap:10px; }
.auto-rig-orient-controls > [hidden],.rig-guide-extras [hidden] { display:none; }
