/* Context stays with the plan; detailed geometry lives in the inspector. */
#placement:not([hidden]) {
  display: grid;
  gap: 7px;
  padding: 7px clamp(8px,1.5vw,16px);
  background: var(--raised);
  border-bottom: 1px solid var(--border);
}
.plan-context, .context-item, .context-actions, .context-action, .creation-fields, .library-heading {
  display: flex;
  align-items: center;
}
.plan-context { justify-content: space-between; gap: 8px; min-width: 0; }
.context-item { gap: 9px; text-align: left; padding: 0; min-width: 0; color: var(--text); }
button.context-item { min-height: 44px; border-radius: 5px; }
button.context-item:hover .plan-context-name strong { color: var(--gold); }
.context-item>i { color: var(--gold); width: 13px; }
.plan-mini-art, .library-art { display: grid; place-items: center; overflow: hidden; background: #1b2031; }
.plan-mini-art { height: 38px; width: 43px; border: 1px solid #424355; border-radius: 6px; flex: none; }
.plan-mini-art>i { color: var(--gold); }
.art-furniture, .art-portrait { display: block; image-rendering: pixelated; object-fit: contain; }
.plan-mini-art .art-furniture { width: 41px; height: 34px; }
.plan-mini-art .art-portrait { width: 34px; height: 34px; }
.plan-context-name { display: grid; gap: 1px; line-height: 1.25; min-width: 0; }
.plan-context-name strong { color: var(--text); font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-context-name small { font-size: .77rem; color: var(--muted); }
.context-actions { flex: none; gap: 3px; }
.context-action { min-height: 40px; min-width: 40px; padding: 4px 7px; gap: 5px; justify-content: center; border-radius: 5px; color: var(--text); font-size: .84rem; }
.context-action:hover { background: var(--panel); color: var(--gold); }
#context-cancel { font: 22px system-ui,sans-serif; color: var(--muted); }
.creation-fields { gap: 12px; }
#placement .creation-fields label { display: flex; gap: 6px; align-items: center; margin: 0; font-size: .84rem; }
#placement .creation-fields input { margin: 0; height: 38px; width: min(210px,45vw); }
#placement .creation-fields input[type=color] { width: 42px; }
.plan-feedback { pointer-events: none; position: absolute; z-index: 2; max-width: min(340px,calc(100% - 16px)); right: 8px; bottom: 8px; border: 1px solid #397769; border-radius: 7px; background: #172c2bf2; color: #b6e8d6; padding: 5px 9px; font-size: .82rem; line-height: 1.3; }
.plan-feedback[data-invalid=true] { border-color: #b76e65; background: #3a232bf5; color: #ffdad1; }
body:not(.editing) .plan-feedback { display: none; }
.object-library {
  --library-pad: clamp(12px, 3vw, 22px);
  --library-height: min(86dvh, 790px);
  width: min(780px, calc(100% - 24px)); max-width: none; max-height: var(--library-height);
  margin: auto; padding: 0; overflow: hidden; color: var(--text); background: var(--panel);
  border: 1px solid #555465; border-radius: 14px; box-shadow: 0 22px 70px #03050b99;
}
.object-library[data-kind=person] { width: min(580px, calc(100% - 24px)); }
.object-library::backdrop { background: #080910c9; }
.library-surface { display: flex; flex-direction: column; max-height: calc(var(--library-height) - 2px); }
.library-heading { justify-content: space-between; gap: 12px; padding: 10px var(--library-pad) 6px; flex: none; }
.library-heading h2 { font-size: clamp(1.12rem, 2.7vw, 1.35rem); line-height: 1.22; letter-spacing: -.025em; }
.library-close { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--border); border-radius: 8px; font-size: 1.42rem; line-height: 1; }
.library-close:hover { color: var(--gold); background: var(--raised); }
.library-filters { flex: none; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 10px; padding: 4px var(--library-pad) 0; }
.library-filters label { display: block; font-size: .875rem; font-weight: 590; color: var(--muted); }
.library-filters :is(input,select) { margin-top: 4px; }
.library-meta { flex: none; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 0 var(--library-pad); border-bottom: 1px solid var(--border); }
.library-meta p { font: .78rem var(--mono); color: var(--muted); }
.library-toggle { display: inline-flex; gap: 7px; align-items: center; min-height: 44px; margin: 0; color: var(--text); font-size: .875rem; cursor: pointer; }
.library-toggle input { appearance: auto; accent-color: var(--gold); min-height: 0; width: 16px; height: 16px; margin: 0; padding: 0; flex: none; cursor: pointer; }
.library-results { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 13px var(--library-pad) var(--library-pad); scrollbar-color: #646172 var(--panel); }
.library-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 9px; }
.library-choice { display: grid; grid-template-rows: auto 1fr auto; gap: 5px; align-items: start; justify-items: start; min-width: 0; text-align: left; color: var(--text); border: 1px solid var(--border); background: var(--raised); border-radius: 9px; padding: 5px 6px 8px; }
.library-choice:hover { background: #303143; border-color: #82798c; }
.library-choice[aria-pressed=true] { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.library-choice strong { padding: 0 2px; font-size: .875rem; line-height: 1.3; overflow-wrap: anywhere; }
.library-choice small { padding: 0 2px; font: .75rem var(--mono); color: var(--muted); }
.library-art { width: 100%; height: clamp(76px, 12vw, 91px); border-radius: 5px; background: radial-gradient(ellipse at 50% 90%,#363342,#202432 72%); }
.library-art canvas { width: 100%; height: 100%; }
.library-art img { width: 62px; height: 62px; }
.object-library[data-kind=person] .library-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
.library-empty { min-height: 118px; display: grid; align-content: center; justify-items: center; gap: 8px; }
.library-empty strong { font-size: .95rem; }
.library-empty button { margin: 0; }
.library-install { display: flex; flex: none; flex-wrap: wrap; align-items: center; gap: 5px 12px; padding: 8px var(--library-pad); border-top: 1px solid var(--border); background: #1c1f2c; }
.library-install button, .library-empty button { width: auto; max-width: 100%; }
.library-install button { margin: 0; }
.library-install p { flex: 1 1 170px; color: var(--muted); font-size: .78rem; line-height: 1.3; }
.library-install .library-install-error { flex-basis: 100%; color: #ffbdad; }

@media (max-width:600px) {
  .library-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; }
  .context-action { min-width: 44px; min-height: 44px; }
  #context-properties span { display: none; }
  #placement .creation-fields input:not([type=color]), .library-filters :is(input,select) { font-size: 16px; }
}
@media (max-width:440px) {
  .object-library { --library-height: min(92dvh, 790px); }
  .library-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .library-filters { grid-template-columns: 1fr 1fr; gap: 6px; }
  #watch-actions button:not(#open-catalog-iso) span { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
}
@media (max-width:380px) {
  .context-actions { gap: 0; }
  #context-rotate span { display: none; }
}
@media (max-height:26rem) {
  .object-library:focus-within { overflow-y: auto; }
  .library-surface { min-width: 0; }
  .library-results { flex: 1 0 5.5rem; }
}
@media (max-height:450px) {
  .object-library { --library-height: calc(100dvh - 10px); }
  .library-heading { padding-block: 1px; }
  .library-results { padding-top: 6px; }
  .library-install { padding-block: 3px; }
}
.seat-link { margin-top: 10px; }
.skin-options { border: 0; margin: 0; padding: 0; min-width: 0; }
.skin-options legend { color: var(--muted); font-size: .85rem; margin-bottom: 6px; }
.skin-options > div { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 5px; }
.skin-choice { display: grid; align-content: start; justify-items: center; gap: 3px; position: relative; padding: 5px 2px; border: 1px solid var(--border); border-radius: 6px; background: var(--raised); cursor: pointer; }
.skin-choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.skin-choice:has(input:checked) { background: #3a3227; border-color: var(--gold); color: var(--gold); }
.skin-choice:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 2px; }
.skin-choice img { width: 34px; height: 34px; image-rendering: pixelated; }
.skin-choice span { font-size: .75rem; line-height: 1.16; text-align: center; }
.room-color input { width: 100%; height: 36px; padding: 2px; }
