/* Shared example layout: controls occupy layout space instead of covering the globe. */
body {
  height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--inspector-width);
  grid-template-rows: auto minmax(0, 1fr);
  background: #0c1b2b;
}
#experiment-controls {
  position: static;
  grid-column: 1 / -1;
  grid-row: 1;
  gap: 10px;
  padding: 8px 12px;
  border: 0;
  border-radius: 0;
  background: #0c1b2b;
}
.globe-logo { width: 36px; height: 36px; object-fit: contain; }
.info-icon { width: 28px; height: 28px; object-fit: contain; }
#show-help { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px 3px 3px; }
#navigation-help {
  box-sizing: border-box;
  width: min(1100px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 18px;
  border: 1px solid #537089;
  border-radius: 12px;
  background: #0c1b2b;
  color: #dfebf4;
}
#navigation-help::backdrop { background: #0009; }
#navigation-help-canvas { display: block; width: 100%; height: auto; }
#close-help { position: absolute; top: 18px; right: 18px; width: 28px; height: 28px; padding: 0; border: 0; background: transparent; color: transparent; cursor: pointer; }
#close-help:focus-visible { outline: 2px solid #77dcff; outline-offset: 2px; }
.navigation-help-semantics { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#quadtree, body.map-hidden #quadtree {
  grid-column: 1;
  grid-row: 2;
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
}
#tree-inspector, #demo-controls {
  position: static;
  grid-column: 2;
  grid-row: 2;
  width: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: #0c1b2b;
  border-top: 2px solid #38506a;
}
#demo-controls {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 20px;
  padding: 20px 16px;
  overflow: auto;
}
.fly-control { display: grid; gap: 8px; }
.quality-control { display: grid; gap: 8px; }
.quality-control, .quality-control + .lod-control {
  border-top: 1px solid #38506a;
  padding-top: 20px;
}
.quality-slider { display: flex; align-items: center; gap: 8px; }
.quality-slider input { flex: 1; min-width: 0; }
.quality-slider output { min-width: 4ch; text-align: right; }
.lod-control { display: grid; grid-template-columns: 80px 80px; align-items: center; gap: 12px; }
.lod-control input { width: 80px; font: inherit; }
#apply-lod { align-self: flex-start; }
#lod-error:empty { display: none; }
.controls-divider { width: 100%; margin: 0; border: 0; border-top: 1px solid #38506a; }
.layers-panel { display: grid; gap: 12px; margin: 0; padding-top: 20px; border-top: 1px solid #38506a; }
.layers-panel > label { display: grid; gap: 8px; }
#layer-controls { flex-direction: column; gap: 14px; }
.layer-row { display: grid; grid-template-columns: minmax(100px, 1fr) minmax(60px, 90px) 34px; }
.layer-row input[type=range] { width: 100%; }
#demo-controls .demo-feature {
  position: static;
  width: 100%;
  max-width: none;
  max-height: none;
  overflow: visible;
  margin: 0;
  padding: 20px 0 0;
  border: 0;
  border-top: 1px solid #38506a;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
#pick-result { overflow-wrap: anywhere; }
body.map-hidden { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 760px) {
  body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) 42dvh; }
  #tree-inspector, #demo-controls {
    grid-column: 1;
    grid-row: 3;
    width: 100%;
  }
  #experiment-controls h1 { font-size: 15px; }
}

/* One persistent sidebar: application controls and diagnostics share its tabs. */
#demo-controls {
  grid-column: auto;
  grid-row: auto;
  flex: 1;
  width: auto;
  border-top: 0;
  padding: 12px 4px;
}
.inspector-tabs { grid-template-columns: .5fr .4fr .5fr 1fr .5fr .55fr 1fr; }
#toggle-sidebar { display: none; font-size: 24px; line-height: 1; padding: 5px 9px; margin-left: auto; }
@media (max-width: 760px) {
  body { grid-template-rows: auto minmax(0, 1fr); }
  #toggle-sidebar { display: block; }
  #experiment-controls { gap: 6px; padding: 6px; }
  #experiment-controls h1 { flex: 1; font-size: 13px; }
  .globe-logo { width: 28px; height: 28px; }
  #show-help { gap: 3px; padding: 3px; font-size: 12px; }
  .info-icon { width: 22px; height: 22px; }
  #tree-inspector {
    display: none;
    position: fixed;
    top: var(--sidebar-top, 52px);
    right: 0;
    bottom: 0;
    width: min(420px, 100%);
    padding: 12px;
    z-index: 5;
    box-shadow: -8px 0 24px #0008;
  }
  body.sidebar-open #tree-inspector { display: flex; }
}
