:root {
  color-scheme: light;
  font-family: Carlito, Arial, sans-serif;
  color: #241a12;
  background: #fff;
}

* { box-sizing: border-box; }
body { margin: 0; height: 100vh; overflow: hidden; }
main { position: relative; width: 100%; height: 100%; background: #fff; }
#renderer { width: 100%; height: 100%; border: 0; display: block; }
button, input { font: inherit; }
button { min-height: 32px; border: 1px solid #786653; border-radius: 4px; background: #fffaf3; color: #241a12; cursor: pointer; }
button:hover:not(:disabled) { background: #eadbc8; }
button:focus-visible, input:focus-visible { outline: 2px solid #8c4f1c; outline-offset: 2px; }
button:disabled { opacity: .45; cursor: default; }
h1 { margin: 0; font-size: 18px; }
h2 { margin: 0 0 8px; font-size: 13px; }
p { margin: 0; }
label { display: block; margin: 0 0 5px; font-size: 12px; font-weight: 700; }
.muted { color: #695c50; font-size: 12px; overflow-wrap: anywhere; }

.launcher-bar { position: absolute; z-index: 20; top: 10px; left: 10px; display: flex; flex-wrap: wrap; gap: 6px; max-width: calc(100% - 20px); pointer-events: none; }
.launcher { min-height: 34px; padding: 5px 10px; border-color: #8d7a66; background: rgba(255,250,243,.94); box-shadow: 0 2px 8px rgba(49,35,24,.18); pointer-events: auto; }
.launcher[aria-expanded="true"] { background: #d7b995; }
.launcher.has-errors { border-color: #b43a32; color: #8b241e; }

.overlay-panel { position: absolute; z-index: 15; top: 54px; left: 10px; width: min(410px, calc(100% - 20px)); max-height: calc(100% - 64px); overflow: auto; border: 1px solid #9e8b76; border-radius: 5px; background: rgba(246,241,233,.97); box-shadow: 0 7px 22px rgba(42,30,20,.28); }
.overlay-panel[hidden] { display: none; }
.panel-header { position: sticky; z-index: 2; top: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid #d9ccbd; background: rgba(246,241,233,.98); }
.panel-header .muted { margin-top: 4px; }
.close-panel { flex: 0 0 32px; padding: 0; font-size: 22px; line-height: 1; }

.loading-panel { width: min(350px, calc(100% - 20px)); }
.progress-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 9px; padding: 12px 14px 0; }
.progress-row progress { width: 100%; accent-color: #3c8b52; }
.metric-grid { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; margin: 0; padding: 12px 14px; font-size: 11px; }
.metric-grid dt { color: #695c50; }
.metric-grid dd { margin: 0; text-align: right; font-family: ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.error-block { padding: 0 14px 14px; }
#load-errors { margin: 0; padding-left: 18px; font-size: 11px; overflow-wrap: anywhere; }
#load-errors li + li { margin-top: 5px; }

.gesture-hint { padding: 10px 14px 0; color: #695c50; font-size: 12px; }
.control-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; padding: 10px 14px 14px; border-bottom: 1px solid #d9ccbd; }
.inspector-panel { right: 10px; left: auto; width: min(360px, calc(100% - 20px)); }
.object-details { display: grid; grid-template-columns: 82px 1fr; gap: 5px 8px; margin: 0; padding: 12px 14px; border-bottom: 1px solid #d9ccbd; font-size: 12px; }
.object-details dt { color: #695c50; }
.object-details dd { margin: 0; overflow-wrap: anywhere; }
.object-details dd.identity { font-family: ui-monospace, monospace; font-size: 11px; }
.component-identities { padding: 10px 14px; border-bottom: 1px solid #d9ccbd; font-size: 11px; }
.component-identities summary { cursor: pointer; font-weight: 700; }
.component-identity { margin-top: 9px; padding-top: 8px; border-top: 1px solid #d9ccbd; }
.component-identity:first-child { border-top: 0; }
.component-identity strong { display: block; margin-bottom: 4px; }
.component-identity code { display: block; overflow-wrap: anywhere; color: #54473c; }
.presentation { display: grid; grid-template-columns: 82px 1fr; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid #d9ccbd; }
.presentation h2, .presentation button, .presentation .muted { grid-column: 1 / -1; }
.presentation label { margin: 0; }
.presentation input[type=color] { width: 54px; height: 34px; padding: 2px; border: 1px solid #9e8b76; }
.opacity-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 7px; }
.opacity-row input { min-width: 0; }
.opacity-row output { min-width: 38px; font-size: 11px; font-variant-numeric: tabular-nums; text-align: right; }
.pivot-status { padding: 10px 14px 12px; }

.objects-panel { display: flex; flex-direction: column; overflow: hidden; }
.objects-panel > label { padding: 10px 14px 0; }
.search { width: calc(100% - 28px); height: 34px; margin: 0 14px 10px; padding: 5px 8px; border: 1px solid #9e8b76; border-radius: 3px; background: #fff; color: #241a12; }
#objects { flex: 1 1 auto; min-height: 0; overflow: auto; border-top: 1px solid #d9ccbd; }
.group + .group { border-top: 1px solid #bca994; }
.group-heading { position: sticky; z-index: 1; top: 0; display: grid; grid-template-columns: 24px 1fr auto 14px; align-items: center; gap: 5px; min-height: 38px; padding: 5px 10px; background: #e7dacb; cursor: pointer; list-style: none; }
.group-heading::-webkit-details-marker { display: none; }
.group-heading::after { content: '›'; font-size: 20px; line-height: 1; transform-origin: center; transition: transform .12s ease-out; }
.group[open] > .group-heading::after { transform: rotate(90deg); }
.group-heading .group-name { text-transform: uppercase; letter-spacing: .04em; font-size: 12px; font-weight: 700; }
.group-empty { padding: 9px 14px; color: #695c50; font-size: 12px; }
.object { border-top: 1px solid #ddd0c1; }
.object-row, .component-row { display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 5px; width: 100%; min-height: 34px; padding: 4px 10px; }
.select-row { min-width: 0; padding: 4px 3px; border: 0; border-radius: 2px; background: transparent; text-align: left; overflow-wrap: anywhere; }
.select-row.selected { background: #d7b995; }
.component-row { padding-left: 28px; font-size: 12px; color: #54473c; }
.component-row .state { width: 9px; height: 9px; border-radius: 50%; background: #aaa; }
.component-row .state.loading { background: #d89a2b; }
.component-row .state.ready { background: #3c8b52; }
.component-row .state.error { background: #b43a32; }
.kind-count { font-variant-numeric: tabular-nums; color: #6a5b4c; font-size: 11px; }

@media (max-width: 520px) {
  .launcher-bar { right: 10px; }
  .launcher { flex: 1 1 auto; }
  .overlay-panel { right: 10px; width: auto; max-height: calc(100% - 64px); }
  .inspector-panel { right: 10px; left: 10px; width: auto; }
}
