.demo-shell {
  border: 1px solid #e2e5ea;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  background: #fff;
  color: #2d333b;
  color-scheme: light;
  overflow: hidden;
  margin: 2rem 0;
}

.demo-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
}

/* Same specificity as the UA [hidden] rule, but author styles win the
   cascade at equal specificity — so `.demo-layout { display: grid }` above
   would otherwise show the panel even while its `hidden` attribute is set.
   This re-asserts display:none for the hidden case. */
.demo-layout[hidden] {
  display: none;
}

@media (max-width: 800px) {
  .demo-layout { grid-template-columns: 1fr; }
}

#viewer-canvas {
  width: 100%;
  height: 60vh;
  min-height: 320px;
  display: block;
  touch-action: none;
  background: #fcfcfd;
}

.demo-controls {
  padding: 1.25rem;
  border-left: 1px solid #eceef1;
}

@media (max-width: 800px) {
  .demo-controls { border-left: none; border-top: 1px solid #eceef1; }
}

.control-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.15rem;
  margin-bottom: 1rem;
}

.control-row label { font-weight: 600; color: #2c3e50; font-size: 0.95rem; }
.control-value { color: #55606c; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.control-row input[type='range'] { width: 100%; }

.field-toggle { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; }

.field-toggle button {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid #e2e5ea;
  background: #fff;
  color: #2d333b;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
}

.field-toggle button.active { background: #2c3e50; color: #fff; border-color: #2c3e50; }

.colorbar { height: 14px; border-radius: 3px; margin-top: 0.75rem; border: 1px solid #e2e5ea; }
.colorbar-labels { display: flex; justify-content: space-between; font-size: 0.8rem; color: #55606c; }

.demo-launch { padding: 3rem 1.5rem; text-align: center; }

.demo-launch p { color: #2d333b; }

.demo-launch button {
  padding: 0.8rem 1.5rem;
  background: #2c3e50;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
}

#reset-button {
  padding: 0.5rem 1rem;
  background: #fff;
  color: #2c3e50;
  border: 1px solid #e2e5ea;
  border-radius: 4px;
  font-size: 0.9rem;
  cursor: pointer;
}

.demo-error { padding: 2rem; text-align: center; color: #b3261e; }
.demo-error img { max-width: 100%; border-radius: 4px; margin-bottom: 1rem; }
