/* The native inspector keeps its paper surface all the way through touch scrolling. */
html:has(#studio:not([hidden]) #thStudio:not([hidden])),
body:has(#studio:not([hidden]) #thStudio:not([hidden])) {
  background-color:#f5f1e9;
  overscroll-behavior-y:none;
}
#thStudio[hidden], #thStudio [hidden] {display:none!important}
#thStudio {
  --hy-ink:#29231e; --hy-quiet:#655a50; --hy-rule:#c7beb1; --hy-paper:#f5f1e9;
  display:grid;flex:1 1 0;min-width:0;min-height:0;overflow:hidden;
  grid-template-columns:minmax(0,2.05fr) minmax(348px,1fr);
  grid-template-rows:minmax(0,1fr);
  background:var(--hy-paper);color:var(--hy-ink);font:400 14px/1.4 var(--sans,Arial,sans-serif);
}
#thStudio button {font:inherit;color:inherit;cursor:pointer}
#thStage {position:relative;min-width:0;min-height:0;overflow:hidden;isolation:isolate;border-inline-end:1px solid var(--hy-rule);background:#d6cdc0}
#thStage[data-night="true"] {background:#282824}
#thCanvas {display:block;position:absolute;inset:0;width:100%;height:100%;cursor:grab;touch-action:none;outline-offset:-3px}
#thCanvas:active {cursor:grabbing}
#thLoad {position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);padding:10px 14px;max-width:85%;color:#392e25;background:#f5f1e9ed;border:1px solid var(--hy-rule);text-align:center}
#thLoad:empty {display:none}
#thLoad button {display:block;margin:7px auto 0}
#thInspector {min-width:0;min-height:0;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;color-scheme:light;scrollbar-color:#a49a8c var(--hy-paper);background:var(--hy-paper)}
#thInspector select {width:100%;padding:8px;margin-top:5px;font:inherit;background:#f9f6ef;color:var(--hy-ink);border:1px solid var(--hy-rule);min-height:42px}
.th-options {display:flex;flex-wrap:wrap;gap:6px;border:0;margin:13px 0;padding:0;min-width:0}
.th-options legend {display:block;padding:0 0 5px}
.th-choice {min-height:38px;border:1px solid var(--hy-rule);padding:7px 13px;background:transparent}
.th-choice[aria-pressed="true"] {background:#44382f;color:white!important}
.th-play {display:flex;gap:5px;margin:2px 0 12px}
.th-detail {margin-top:12px}
.th-door-spec {margin:8px 0;font-size:.88rem}
.th-door-spec div {display:flex;justify-content:space-between;align-items:baseline;gap:8px;border-block-end:1px solid #d5ccbd;padding:5px 0}
.th-door-spec dd {margin:0;white-space:nowrap;font-variant-numeric:tabular-nums}
.th-warning {border-inline-start:2px solid #9c643f;padding:6px 10px;color:#76482c}
@media (max-width:1180px),(pointer:coarse) {
  #thStudio {grid-template-columns:minmax(0,1.2fr) minmax(302px,1fr)}
  #thStudio :is(.hy-tabs button,.hy-switch button,.th-choice,.hy-preset) {min-height:40px}
}
@media (max-width:760px) and (orientation:portrait) {
  #thStudio {grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,44%) minmax(0,1fr)}
  #thStage {border-inline-end:0;border-bottom:1px solid var(--hy-rule)}
  #thInspector {padding:15px max(16px,env(safe-area-inset-right)) max(34px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left))}
  #thTools {bottom:6px;inset-inline:6px;flex-wrap:wrap}
  #thStudio .hy-switch button {min-height:34px}
}
@media (max-height:540px) and (orientation:landscape) {
  #thStudio {grid-template-columns:minmax(0,1.3fr) minmax(250px,1fr)}
  #thTools {flex-wrap:wrap}
}
.th-reference img {display:block;width:100%;height:auto;max-height:300px;object-fit:contain;background:#4a4741}
.th-slots .th-choice {min-height:34px;padding:5px 8px;font-size:.83rem!important}
.th-selection-heading {display:flex;align-items:center;justify-content:space-between;gap:12px;padding-block:4px 10px}
.th-selection-title {display:grid;min-width:0;gap:2px;color:var(--hy-ink)}
.th-selection-title small {font-size:.82rem;color:var(--hy-quiet)}
.th-selection-title strong {font:400 1.15rem/1.2 var(--display,Georgia,serif);overflow-wrap:anywhere}
#thInspector .th-parent-selection {max-width:48%;min-height:42px;padding:6px 9px;line-height:1.15}
.th-selection-menu {border-block:1px solid var(--hy-rule);margin-block:0 10px}
.th-selection-menu summary {cursor:pointer;padding:9px 0;font-size:.9rem}
.th-selection-lists {display:grid;grid-template-columns:repeat(auto-fit,minmax(min(126px,100%),1fr));gap:8px;padding-bottom:8px}
.th-selection-lists .hy-control {margin:0;min-width:0}
.th-selection-lists :is(select,label) {min-width:0}
.th-inherit {margin-block-start:5px}
.th-hint {margin-block-end:3px}

/* The global structure picker stays distinct from the controls for the active model. */
#thInspector .hy-heading {margin-bottom:12px}
.th-structure-switch {margin:0 0 12px;min-width:0;background:#f5f1e9}
.th-structure-switch:not(:has(.th-structure-trigger[aria-expanded="true"])) {position:sticky;top:0;z-index:3}
#thInspector .th-structure-trigger {
  width:100%;display:flex;justify-content:space-between;align-items:center;gap:12px;
  min-height:58px;text-align:start;padding:9px 13px;border:1px solid #3a3028;
  color:#faf6ee;background:#3a3028;
}
.th-structure-trigger:hover {filter:brightness(1.09)}
.th-structure-current {display:grid;min-width:0;gap:3px}
.th-structure-current small {font-size:.77rem;line-height:1.15;color:#d9cebf}
.th-structure-current strong {font:400 1.16rem/1.12 var(--display,Georgia,serif);overflow-wrap:anywhere}
.th-structure-action {display:inline-flex;align-items:center;justify-content:center;gap:9px;min-height:32px;
  padding:4px 8px;border:1px solid #9a8b7b;font-size:.88rem;line-height:1.12;max-width:48%}
.th-structure-action::after {content:"";flex:0 0 auto;width:7px;height:7px;border-inline-end:1.5px solid currentColor;border-block-end:1.5px solid currentColor;transform:rotate(45deg) translate(-1px,-1px)}
.th-structure-trigger[aria-expanded="true"] .th-structure-action::after {transform:rotate(225deg) translate(-1px,-1px)}
[dir="rtl"] .th-structure-action::after {transform:rotate(-45deg)}
[dir="rtl"] .th-structure-trigger[aria-expanded="true"] .th-structure-action::after {transform:rotate(135deg)}
.th-structure-choices {border:1px solid #aca091;border-top:0;padding:10px;background:#eee7dd}
.th-family {display:flex;gap:4px;margin:0 0 10px}
#thInspector .th-family-choice {
  flex:1 1 0;min-width:0;min-height:42px;line-height:1.14;border:1px solid #b9ac9c;
  background:transparent;padding:5px 4px;overflow-wrap:anywhere;font-size:.87rem;
}
#thInspector .th-family-choice[aria-pressed="true"],.th-customize {background:#44382f;color:#fff!important}
.th-structure-grid {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px}
#thInspector .th-structure-card {position:relative;display:flex;align-items:center;gap:7px;min-width:0;min-height:44px;
  padding:5px;text-align:start;overflow-wrap:anywhere;line-height:1.16;font-size:.875rem;
  background:#faf7f0;border:1px solid #c6baaa}
#thInspector .th-structure-card:hover {border-color:#756451}
#thInspector .th-structure-card[aria-pressed="true"] {border-color:#44382f;box-shadow:inset 0 0 0 1px #44382f;font-weight:600}
.th-structure-card img {width:clamp(35px,3.8vw,52px);height:34px;object-fit:cover;flex-shrink:0;background:#62584b}
.th-structure-card:not(:has(img)) {padding-inline:9px!important}
.th-picker-subtitle {font-size:.81rem;font-weight:500;color:var(--hy-quiet);margin:12px 0 5px}
#thInspector .hy-tabs {padding-top:8px;border-top:1px solid var(--hy-rule)}
@media(max-width:760px) and (orientation:portrait){
  #thInspector .th-structure-trigger {min-height:49px;padding:7px 10px}
  .th-structure-switch {margin-bottom:8px}
  #thInspector .hy-heading {margin-bottom:8px}
}
.th-dimensions {border-block-end:1px solid var(--hy-rule);padding:0 0 5px}
.th-count .hy-control-label {min-height:36px;align-items:center}
.th-count .hy-control-label>label {font-weight:550;cursor:pointer}
.th-count-value {display:inline-flex;align-items:center;gap:5px;color:var(--hy-quiet);font-variant-numeric:tabular-nums;white-space:nowrap}
#thInspector .th-count-value input {box-sizing:border-box;width:3.1em;height:36px;border:1px solid var(--hy-rule);border-radius:0;background:#fbf8f2;text-align:center;padding:2px 3px;font:inherit;font-weight:550;color:var(--hy-ink);appearance:textfield;-moz-appearance:textfield}
.th-count-value input::-webkit-inner-spin-button,.th-count-value input::-webkit-outer-spin-button {-webkit-appearance:none;margin:0}
#thInspector .th-count input[type="range"] {height:29px}
.th-customize {width:100%;margin-bottom:6px;min-height:44px}
#thInspector :is(button,input,summary):focus-visible {outline:2px solid #7d5036;outline-offset:2px}
@media(pointer:coarse) {
  #thInspector .th-count-value input {height:44px;font-size:16px}
  #thInspector .th-count input[type="range"] {height:34px}
  #thInspector .th-family-choice {min-height:44px}
}
