:root {
  color-scheme: dark;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  --bg-0: #0a0c10;
  --bg-1: #0e1116;
  --panel: rgb(20 25 32 / 72%);
  --panel-solid: #141921;
  --stage: #05070a;
  --hairline: rgb(255 255 255 / 10%);
  --hairline-strong: rgb(255 255 255 / 16%);
  --text: #eef2f7;
  --muted: #97a3b4;
  --accent: #7ee0a6;
  --radius: 14px;
  --radius-sm: 9px;
  background: var(--bg-0);
  color: var(--text);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
}

.runtime-shell {
  position: relative;
  min-height: 100vh;
  background:
    radial-gradient(
      1200px 680px at 28% -8%,
      rgb(96 130 196 / 14%),
      transparent 60%
    ),
    radial-gradient(
      900px 600px at 100% 110%,
      rgb(126 224 166 / 9%),
      transparent 55%
    ),
    linear-gradient(180deg, var(--bg-1), var(--bg-0));
}

.viewport-panel {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(120% 120% at 50% 0%, rgb(42 52 68 / 55%), transparent 55%),
    radial-gradient(150% 150% at 50% 120%, #0a0e14, var(--stage) 70%);
}

.benchmark-panel {
  align-content: center;
  padding: 24px;
}

.benchmark-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 16px;
  width: min(100%, 720px);
}

.benchmark-card {
  display: grid;
  gap: 14px;
  min-height: 220px;
  padding: 18px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: rgb(255 255 255 / 4%);
}

.benchmark-card strong {
  font-size: 16px;
  font-weight: 720;
}

.benchmark-card dl {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 14px;
  margin: 0;
  font-size: 13px;
}

.benchmark-card dt {
  color: #9ca8b7;
}

.benchmark-card dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

#apperture-canvas {
  display: block;
  /* Grow to fill the viewport at the canvas backing-store aspect (published as
     --canvas-aspect by example-control.js) so the scene is never distorted. */
  width: min(100%, calc(100vh * var(--canvas-aspect, 1.7778)));
  height: auto;
  aspect-ratio: var(--canvas-aspect, 1.7778);
  max-width: 100%;
  max-height: 100vh;
  background: var(--stage);
}

.msaa-viewport-grid {
  grid-template-columns: repeat(2, minmax(0, 512px));
  gap: 12px;
}

.msaa-canvas-frame {
  display: grid;
  gap: 6px;
  margin: 0;
}

.msaa-canvas-frame figcaption {
  color: #9ca8b7;
  font-size: 12px;
  font-weight: 650;
  text-align: center;
}

.msaa-canvas {
  display: block;
  width: min(100%, 512px);
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  background: var(--stage);
}

.status-panel {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10;
  display: grid;
  gap: 14px;
  width: min(340px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 18px;
  overflow: auto;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 24px 70px -30px rgb(0 0 0 / 95%);
  backdrop-filter: blur(16px) saturate(130%);
}

.status-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.status-row span {
  color: var(--muted);
}

.status-row strong {
  font-size: 13px;
  font-weight: 650;
}

/* Promote the leading "example" row into a clean title banner. */
.status-panel > .status-row:first-child {
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--hairline);
}

.status-panel > .status-row:first-child span {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.status-panel > .status-row:first-child strong {
  font-size: 19px;
  font-weight: 720;
  letter-spacing: -0.01em;
  text-transform: capitalize;
}

.asset-select-row {
  display: grid;
  gap: 6px;
  font-size: 13px;
}

.asset-select-row[hidden] {
  display: none;
}

.asset-select-row span {
  color: #9ca8b7;
}

.asset-select-row select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-sm);
  background: #202832;
  color: #edf2f7;
  font: inherit;
  font-size: 13px;
}

.asset-select-row select:focus-visible {
  outline: 2px solid #81d69d;
  outline-offset: 3px;
}

.asset-url-row {
  display: grid;
  gap: 6px;
  font-size: 13px;
}

.asset-url-row label {
  color: #9ca8b7;
}

.asset-url-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.asset-url-controls input,
.asset-url-controls button {
  min-height: 34px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-sm);
  background: #202832;
  color: #edf2f7;
  font: inherit;
  font-size: 13px;
}

.asset-url-controls input {
  min-width: 0;
  padding: 0 10px;
}

.asset-url-controls button {
  padding: 0 12px;
  font-weight: 650;
  cursor: pointer;
}

.asset-url-controls button:hover {
  background: #2a3440;
}

.asset-url-controls input:focus-visible,
.asset-url-controls button:focus-visible {
  outline: 2px solid #81d69d;
  outline-offset: 3px;
}

#example-state[data-state="ready"] {
  color: #81d69d;
}

#example-state[data-state="failed"] {
  color: #ffab91;
}

#example-state[data-state="paused"] {
  color: #ffd27d;
}

.runtime-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.runtime-controls button {
  min-height: 34px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-sm);
  background: #202832;
  color: #edf2f7;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.runtime-controls button:hover:not(:disabled) {
  background: #2a3440;
}

.runtime-controls button[aria-pressed="true"] {
  border-color: #81d69d;
  background: #26362d;
  color: #c7f7d3;
}

.runtime-controls button:focus-visible {
  outline: 2px solid #81d69d;
  outline-offset: 3px;
}

.runtime-controls button:disabled {
  color: #6f7a87;
  cursor: default;
}

.selected-asset-summary,
.material-slot-summary,
.texture-gallery-summary,
.image-decode-summary,
.unsupported-feature-summary,
.animation-summary,
.animation-clip-summary,
.animation-node-summary,
.animation-channel-summary,
.imported-camera-summary,
.imported-camera-list-summary,
.light-summary,
.metadata-summary,
.scene-summary,
.orbit-summary,
.shadow-summary,
.shadow-request-summary,
.ibl-summary,
.ibl-resource-summary,
.draw-summary,
.render-state-summary,
.pipeline-token-summary,
.mesh-draw-summary,
.prepared-resource-reuse-summary,
.render-diagnostic-summary,
.extraction-diagnostic-summary,
.imported-light-summary,
.imported-light-list-summary,
.primitive-material-summary,
.material-factor-summary,
.material-alpha-summary,
.primitive-texture-slot-summary,
.texture-handle-summary,
.texture-sampler-summary,
.texture-transform-summary,
.source-loader-summary,
.source-output-summary,
.hierarchy-summary,
.replay-stage-summary {
  display: grid;
  gap: 6px;
  padding-block: 2px;
  font-size: 12px;
}

.selected-asset-summary[hidden],
.material-slot-summary[hidden],
.texture-gallery-summary[hidden],
.image-decode-summary[hidden],
.unsupported-feature-summary[hidden],
.animation-summary[hidden],
.animation-clip-summary[hidden],
.animation-node-summary[hidden],
.animation-channel-summary[hidden],
.imported-camera-summary[hidden],
.imported-camera-list-summary[hidden],
.light-summary[hidden],
.metadata-summary[hidden],
.scene-summary[hidden],
.orbit-summary[hidden],
.shadow-summary[hidden],
.shadow-request-summary[hidden],
.ibl-summary[hidden],
.ibl-resource-summary[hidden],
.draw-summary[hidden],
.render-state-summary[hidden],
.pipeline-token-summary[hidden],
.mesh-draw-summary[hidden],
.prepared-resource-reuse-summary[hidden],
.render-diagnostic-summary[hidden],
.extraction-diagnostic-summary[hidden],
.imported-light-summary[hidden],
.imported-light-list-summary[hidden],
.primitive-material-summary[hidden],
.material-factor-summary[hidden],
.material-alpha-summary[hidden],
.primitive-texture-slot-summary[hidden],
.texture-handle-summary[hidden],
.texture-sampler-summary[hidden],
.texture-transform-summary[hidden],
.source-loader-summary[hidden],
.source-output-summary[hidden],
.hierarchy-summary[hidden],
.replay-stage-summary[hidden] {
  display: none;
}

.selected-asset-summary-row,
.material-slot-summary-row,
.texture-gallery-summary-row,
.image-decode-summary-row,
.unsupported-feature-summary-row,
.animation-summary-row,
.animation-clip-summary-row,
.animation-node-summary-row,
.animation-channel-summary-row,
.imported-camera-summary-row,
.imported-camera-list-summary-row,
.light-summary-row,
.metadata-summary-row,
.scene-summary-row,
.orbit-summary-row,
.shadow-summary-row,
.shadow-request-summary-row,
.ibl-summary-row,
.ibl-resource-summary-row,
.draw-summary-row,
.render-state-summary-row,
.pipeline-token-summary-row,
.mesh-draw-summary-row,
.prepared-resource-reuse-summary-row,
.render-diagnostic-summary-row,
.extraction-diagnostic-summary-row,
.imported-light-summary-row,
.imported-light-list-summary-row,
.primitive-material-summary-row,
.material-factor-summary-row,
.material-alpha-summary-row,
.primitive-texture-slot-summary-row,
.texture-handle-summary-row,
.texture-sampler-summary-row,
.texture-transform-summary-row,
.source-loader-summary-row,
.source-output-summary-row,
.hierarchy-summary-row,
.replay-stage-summary-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.selected-asset-summary-row span,
.material-slot-summary-row span,
.texture-gallery-summary-row span,
.image-decode-summary-row span,
.unsupported-feature-summary-row span,
.animation-summary-row span,
.animation-clip-summary-row span,
.animation-node-summary-row span,
.animation-channel-summary-row span,
.imported-camera-summary-row span,
.imported-camera-list-summary-row span,
.light-summary-row span,
.metadata-summary-row span,
.scene-summary-row span,
.orbit-summary-row span,
.shadow-summary-row span,
.shadow-request-summary-row span,
.ibl-summary-row span,
.ibl-resource-summary-row span,
.draw-summary-row span,
.render-state-summary-row span,
.pipeline-token-summary-row span,
.mesh-draw-summary-row span,
.prepared-resource-reuse-summary-row span,
.render-diagnostic-summary-row span,
.extraction-diagnostic-summary-row span,
.imported-light-summary-row span,
.imported-light-list-summary-row span,
.primitive-material-summary-row span,
.material-factor-summary-row span,
.material-alpha-summary-row span,
.primitive-texture-slot-summary-row span,
.texture-handle-summary-row span,
.texture-sampler-summary-row span,
.texture-transform-summary-row span,
.source-loader-summary-row span,
.source-output-summary-row span,
.hierarchy-summary-row span,
.replay-stage-summary-row span {
  color: #9ca8b7;
}

.selected-asset-summary-row strong,
.material-slot-summary-row strong,
.texture-gallery-summary-row strong,
.image-decode-summary-row strong,
.unsupported-feature-summary-row strong,
.animation-summary-row strong,
.animation-clip-summary-row strong,
.animation-node-summary-row strong,
.animation-channel-summary-row strong,
.imported-camera-summary-row strong,
.imported-camera-list-summary-row strong,
.light-summary-row strong,
.metadata-summary-row strong,
.scene-summary-row strong,
.orbit-summary-row strong,
.shadow-summary-row strong,
.shadow-request-summary-row strong,
.ibl-summary-row strong,
.ibl-resource-summary-row strong,
.draw-summary-row strong,
.render-state-summary-row strong,
.pipeline-token-summary-row strong,
.mesh-draw-summary-row strong,
.prepared-resource-reuse-summary-row strong,
.render-diagnostic-summary-row strong,
.extraction-diagnostic-summary-row strong,
.imported-light-summary-row strong,
.imported-light-list-summary-row strong,
.primitive-material-summary-row strong,
.material-factor-summary-row strong,
.material-alpha-summary-row strong,
.primitive-texture-slot-summary-row strong,
.texture-handle-summary-row strong,
.texture-sampler-summary-row strong,
.texture-transform-summary-row strong,
.source-loader-summary-row strong,
.source-output-summary-row strong,
.hierarchy-summary-row strong,
.replay-stage-summary-row strong {
  text-align: right;
  font-size: 12px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.glb-viewer-controls {
  grid-template-columns: 1fr;
}

.runtime-controls label {
  display: flex;
  min-width: 0;
  min-height: 34px;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-sm);
  background: #202832;
  color: #edf2f7;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.runtime-controls input {
  accent-color: #81d69d;
}

.runtime-controls label:has(input:focus-visible) {
  outline: 2px solid #81d69d;
  outline-offset: 3px;
}

.runtime-controls label:hover {
  background: #2a3440;
}

.light-control-grid {
  display: grid;
  gap: 10px;
  font-size: 13px;
}

.light-control-grid label {
  display: grid;
  gap: 6px;
  color: #9ca8b7;
}

.light-control-grid input {
  width: 100%;
  accent-color: #81d69d;
}

.light-control-grid input:focus-visible {
  outline: 2px solid #81d69d;
  outline-offset: 3px;
}

.example-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.example-links a {
  padding: 4px 10px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: rgb(255 255 255 / 4%);
  color: #cdd6e2;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition:
    background 120ms ease,
    border-color 120ms ease,
    color 120ms ease;
}

.example-links a:hover {
  border-color: rgb(126 224 166 / 55%);
  background: rgb(126 224 166 / 12%);
  color: #eafff2;
}

.example-links a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.material-showcase-panel {
  overflow: hidden;
}

.material-legend {
  position: absolute;
  right: 20px;
  bottom: 18px;
  left: 20px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  pointer-events: none;
}

.material-legend span {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-sm);
  background: rgb(13 16 20 / 78%);
  color: #edf2f7;
  font-size: 13px;
  font-weight: 650;
  text-align: center;
  backdrop-filter: blur(8px);
}

.gpu-profiler-overlay {
  position: absolute;
  top: 18px;
  left: 18px;
  width: min(280px, calc(100% - 36px));
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-sm);
  background: rgb(12 15 19 / 82%);
  backdrop-filter: blur(8px);
}

.gpu-profiler-header,
.gpu-profiler-pass-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.gpu-profiler-header {
  color: #9ca8b7;
  font-size: 12px;
  text-transform: uppercase;
}

.gpu-profiler-header strong {
  color: #edf2f7;
  font-size: 12px;
  text-transform: none;
}

.gpu-profiler-pass-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.gpu-profiler-pass-list li {
  min-width: 0;
  padding-block: 2px;
  color: #d7dee8;
  font:
    12px/1.4 ui-monospace,
    "SFMono-Regular",
    Consolas,
    "Liberation Mono",
    monospace;
}

.gpu-profiler-pass-list span {
  min-width: 0;
  overflow: hidden;
  color: #9ca8b7;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gpu-profiler-pass-list strong {
  flex: none;
  color: #81d69d;
  font-weight: 650;
}

.example-json-drawer {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: rgb(8 10 14 / 60%);
}

.example-json-drawer > summary {
  padding: 9px 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.example-json-drawer > summary::-webkit-details-marker {
  display: none;
}

.example-json-drawer > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 8px;
  color: var(--accent);
  transition: transform 120ms ease;
}

.example-json-drawer[open] > summary::before {
  transform: rotate(90deg);
}

.example-json-drawer > summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#example-json {
  overflow: auto;
  max-height: min(46vh, 460px);
  margin: 0;
  padding: 12px;
  border-top: 1px solid var(--hairline);
  background: transparent;
  color: #cdd6e2;
  font:
    12px/1.5 ui-monospace,
    "SFMono-Regular",
    Consolas,
    "Liberation Mono",
    monospace;
}

@media (max-width: 760px) {
  .status-panel {
    top: auto;
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
    max-height: 50vh;
  }

  .benchmark-summary {
    grid-template-columns: 1fr;
  }

  #example-json {
    max-height: 280px;
  }
}
