:root[data-studio] {
  color-scheme: dark;
  font-family: "Segoe UI", system-ui, sans-serif;
  --studio-bg: #14171a;
  --studio-panel: #1b1e22;
  --studio-surface: #22262a;
  --studio-border: #343a40;
  --studio-text: #f4f1eb;
  --studio-muted: #aeb5ba;
  --studio-accent: #f2bd8c;
  background: var(--studio-bg);
  color: var(--studio-text);
}
html[data-studio], [data-studio] body { height: 100%; padding: 0; margin: 0; overflow: hidden; }
[data-studio] .app { display: none !important; }
#studio { height: 100dvh; display: flex; flex-direction: column; font-family: "Segoe UI", system-ui, sans-serif; color: var(--studio-text); background: var(--studio-bg); }
#studio h1, #studio h2, #studio h3 { color: var(--studio-text); font: inherit; font-weight: 650; margin: 0; }
#studio button, #studio input, #studio select, #studio output { font: inherit; }
#studio button, #studio select, #studio input[type="search"] {
  border: 1px solid var(--studio-border);
  background: var(--studio-surface);
  color: var(--studio-text);
  min-height: 38px;
  border-radius: 8px;
}
#studio button { padding: 6px 11px; cursor: pointer; }
#studio button:disabled { cursor: default; opacity: .45; }
#studio button:hover:not(:disabled) { border-color: #7c6b5d; }
#studio :focus-visible { outline: 2px solid var(--studio-accent); outline-offset: 2px; }
#studio button[aria-pressed="true"] { background: #48372d; border-color: #79583f; color: #ffdbc1; }
#studio input[type="search"], #studio select { padding: 7px 9px; width: 100%; min-width: 0; }
#studio input[type="search"]::placeholder { color: #929ba2; }
#studio input[type="range"] { width: 100%; min-width: 40px; accent-color: var(--studio-accent); }
#studio button.studio-primary { background: var(--studio-accent); color: #261a14; border-color: var(--studio-accent); font-weight: 690; }
#studio [hidden] { display: none !important; }

.studio-header {
  height: 64px;
  flex: 0 0 auto;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--studio-border);
  background: #191c1f;
}
.studio-brand { display: flex; align-items: center; gap: 12px; }
#studio .studio-brand h1 { font-size: 20px; letter-spacing: -.025em; line-height: 1.1; }
.studio-mark {
  display: block;
  width: 29px;
  height: 29px;
  border-radius: 50%;
  border: 1px solid #936a54;
  background: repeating-radial-gradient(ellipse at 65% 40%, #f0bd98 0 1px, #402923 1.5px 4px, #8c5b44 5px 6px);
  box-shadow: 0 0 20px #ec886335;
}
.studio-layout {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(246px, 284px) minmax(300px, 1fr) minmax(246px, 306px);
}
.studio-mobile-nav { display: none; }
.studio-catalog, .studio-detail { min-height: 0; min-width: 0; background: var(--studio-panel); }
.studio-catalog { display: flex; flex-direction: column; border-right: 1px solid var(--studio-border); }
.studio-catalog-head { display: grid; gap: 8px; flex: 0 0 auto; padding: 18px 14px 8px; }
#studio .studio-catalog h2 { font-size: 19px; line-height: 1.2; margin: 0 0 5px; }
.studio-label, .studio-result-row, .studio-list small, .studio-notice, .studio-gesture, .studio-description, .studio-motion-status {
  color: var(--studio-muted);
  font-size: 12px;
}
.studio-label { font-weight: 620; }
.studio-segment { display: flex; flex-wrap: wrap; gap: 5px; }
.studio-segment button { flex: 0 1 auto; }
#studio .studio-segment button { font-size: 12px; padding: 5px 8px; min-height: 33px; }
.studio-result-row { display: flex; justify-content: space-between; align-items: center; gap: 5px; min-height: 28px; }
#studio .studio-text-button { border: 0; background: transparent; padding: 2px 0; min-height: 28px; font-size: 12px; color: var(--studio-accent); }
.studio-list { margin: 0; padding: 0 10px 12px; list-style: none; overflow: auto; }
.studio-list li { margin: 0 0 2px; }
#studio .studio-list button {
  width: 100%;
  display: grid;
  gap: 3px;
  text-align: left;
  padding: 7px 9px;
  border-color: transparent;
  background: transparent;
  font-size: 13px;
  line-height: 1.18;
}
#studio .studio-list button:hover { background: var(--studio-surface); border-color: var(--studio-border); }
#studio .studio-list button[aria-current="true"] { background: #392c25; border-color: #604637; }
.studio-list .studio-hidden-row b { color: var(--studio-muted); }
.studio-list .studio-empty { padding: 10px 6px; color: var(--studio-muted); font-size: 14px; }

.studio-center { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.studio-scene {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: radial-gradient(ellipse 66% 78% at 48% 43%, #323339 0%, #23252a 52%, #111316 100%);
}
#studioScene > #vp { position: absolute; inset: 0; background: transparent; }
#studioScene > #vp::before { display: none; }
#studioScene > #vp canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
#studioScene > #vp canvas:active { cursor: grabbing; }
#studioScene > #vp > :not(canvas, #loading) { display: none !important; }
.studio-scene-bar { position: absolute; z-index: 1; top: 12px; left: 12px; right: 12px; display: grid; justify-items: start; gap: 7px; pointer-events: none; }
.studio-render-modes { background: #181b1dd9; border: 1px solid #474b50; padding: 4px; border-radius: 11px; pointer-events: auto; }
.studio-notice:empty { display: none; }
.studio-notice { padding: 4px 7px; background: #191b1eda; border-radius: 5px; }
.studio-camera { position: absolute; z-index: 1; bottom: 36px; left: 9px; right: 9px; display: flex; justify-content: center; gap: 5px; pointer-events: none; }
#studio .studio-camera button { pointer-events: auto; font-size: 12px; min-height: 34px; background: #1c2024eb; }
.studio-gesture { margin: 0; position: absolute; inset: auto 5px 10px; text-align: center; pointer-events: none; }

.studio-player { flex: 0 0 auto; display: grid; gap: 8px; padding: 11px 14px; border-top: 1px solid var(--studio-border); background: #1a1d20; }
.studio-motion-top, .studio-motion-time { display: flex; gap: 9px; align-items: end; }
.studio-motion-choice { display: grid; gap: 5px; flex: 1 1 12rem; min-width: 0; }
.studio-motion-choice label { color: var(--studio-muted); font-size: 12px; font-weight: 650; }
.studio-motion-actions { display: flex; align-items: center; gap: 5px; }
#studioSpeed { width: 66px !important; }
.studio-motion-time { align-items: center; }
.studio-motion-time output { white-space: nowrap; color: var(--studio-muted); min-width: 47px; text-align: right; font-size: 12px !important; }
.studio-motion-status:empty { display: none; }
.studio-relative { color:#c2e4dc; font:500 12px/1.3 system-ui,sans-serif; font-variant-numeric:tabular-nums; }

.studio-detail { border-left: 1px solid var(--studio-border); overflow: auto; }
.studio-detail-body { min-height: 100%; padding: 21px 17px; }
#studio .studio-detail h2 { font-size: clamp(19px, 1.65vw, 24px); line-height: 1.12; overflow-wrap: anywhere; }
.studio-description { line-height: 1.46; margin: 9px 0 12px; }
.studio-detail-actions, .studio-credit-links, .studio-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.studio-detail-actions button, .studio-quick button { font-size: 12px !important; }
.studio-detail dl { margin: 17px 0; }
.studio-detail dl div { padding: 8px 0; border-top: 1px solid var(--studio-border); }
.studio-detail dt { color: var(--studio-accent); font-size: 12px; }
.studio-detail dd { margin: 4px 0 0; font-size: 13px; line-height: 1.42; }
#studio .studio-detail h3 { font-size: 14px; margin-top: 13px; }
.studio-related { display: grid; gap: 4px; padding: 6px 0 0; margin: 0; list-style: none; }
.studio-related button { display: block; width: 100%; text-align: left; font-size: 12px !important; }
.studio-kind-label { color: var(--studio-accent); font-size: 12px; margin: 0 0 8px; }
.studio-status-error { color: #ffad9e !important; }

.studio-dialog { width: min(510px, calc(100vw - 24px)); border: 1px solid var(--studio-border); border-radius: 15px; background: var(--studio-panel); color: var(--studio-text); padding: 22px; }
.studio-dialog::backdrop { background: #0b0c0dba; }
.studio-dialog p { color: var(--studio-muted); font-size: 14px; line-height: 1.45; }
.studio-dialog a { color: var(--studio-accent); }
.studio-dialog form { margin-top: 18px; }
.studio-study-bar { position:absolute; inset:12px 12px auto; display:flex; gap:5px; z-index:3; align-items:center; }
#studioStudyMuscle { width:auto; max-width:min(65%,360px); min-width:0; }
#studioStudyMotion, #studioStudyClose { background:#23282d; white-space:nowrap; }
#studioStudyClose { margin-left:auto; font-size:20px; }
#studioCut { white-space:nowrap; font-size:12px; }
#studio[data-cut="false"] .studio-landmarks circle { fill:#282a30; stroke:currentColor; }
#studio[data-cut="false"] .studio-landmarks line { stroke-dasharray:3 3; }
@media(max-width:1050px) {
  .studio-study-bar { flex-wrap:wrap; }
  #studioStudyMuscle { flex:1 1 100%; max-width:100%; }
}
.studio-landmarks { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; z-index:1; }
.studio-landmarks g { color:#7fe3d4; }
.studio-landmarks g[data-point=insertion] { color:#ffd391; }
.studio-landmarks line { stroke:currentColor; stroke-width:1.5; }
.studio-landmarks circle { stroke:#171b1d; stroke-width:2; fill:currentColor; }
.studio-landmarks rect { fill:#151a1ded; stroke:currentColor; stroke-opacity:.55; }
.studio-landmarks text { fill:currentColor; font:600 11px system-ui,sans-serif; }
#studioStudyBar[hidden], #studioLandmarks[hidden], #studio[data-study] .studio-scene-bar { display:none !important; }
#studioCuff { pointer-events:auto; background:#302824; border-color:#725747; font-size:12px; }
#studio .studio-study-action { flex:1 1 100%; text-align:left; }

@media (max-width: 1020px) {
  .studio-layout { grid-template-columns: minmax(216px, 24%) minmax(280px, 1fr) minmax(216px, 26%); }
  .studio-detail-body { padding: 16px 12px; }
}
@media (max-width: 760px) {
  .studio-header { height: 53px; padding: 0 10px; }
  #studio .studio-brand h1 { font-size: 17px; }
  .studio-mark { width: 22px; height: 22px; }
  .studio-mobile-nav { flex: 0 0 auto; display: flex; gap: 6px; padding: 5px 9px; border-bottom: 1px solid var(--studio-border); }
  #studio .studio-mobile-nav button { min-height: 34px; }
  .studio-layout { display: flex; flex-direction: column; }
  .studio-center { order: 0; flex: 1 1 auto; min-height: 235px; }
  .studio-catalog, .studio-detail {
    position: static;
    width: auto;
    height: auto;
    z-index: auto;
    order: 1;
    display: none;
    flex: 0 1 40dvh;
    border: 0;
    border-top: 1px solid var(--studio-border);
    border-radius: 0;
    box-shadow: none;
  }
  #studio[data-panel="catalog"] .studio-catalog { display: flex; }
  #studio[data-panel="detail"] .studio-detail { display: block; }
  .studio-catalog-head { padding: 7px 9px 4px; gap: 4px; }
  #studio .studio-catalog h2, .studio-catalog-head label { display: none; }
  .studio-list { padding: 0 7px 6px; }
  .studio-scene-bar { left: 7px; right: 7px; top: 6px; }
  .studio-camera { bottom: 7px; }
  .studio-gesture { display: none; }
  .studio-player { padding: 6px 9px max(6px, env(safe-area-inset-bottom)); gap: 4px; }
  .studio-motion-choice { gap: 2px; }
  .studio-motion-top { gap: 4px; }
  #studio .studio-player button, #studio .studio-player select { font-size: 13px; min-height: 36px; padding: 4px 6px; }
  #studioSpeed { width: 54px !important; }
  .studio-detail-body { padding: 12px; }
}
@media (max-width: 740px) and (max-height: 470px) {
  .studio-center { min-height: 150px; }
  .studio-catalog, .studio-detail { flex-basis: 36dvh; }
}
