:root {
  color-scheme: light dark;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: Canvas;
  color: CanvasText;
}

* { box-sizing: border-box; }

body { margin: 0; padding: 0.75rem; }

[data-python-demo] { max-width: 70rem; margin: 0 auto; }

.demo-message {
  min-height: 1.5em;
  margin: 0;
  text-align: center;
  font-size: 0.85rem;
}

.demo-result {
  min-height: 1.5em;
  margin: 0.35rem 0;
  text-align: center;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.demo-plot { width: 100%; height: 460px; }

.demo-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.demo-control {
  display: grid;
  grid-template-columns: max-content minmax(5rem, 1fr) 3.5rem;
  align-items: center;
  gap: 0.75rem;
  flex: 1 1 15rem;
  max-width: 40rem;
}

.demo-control input { width: 100%; margin: 0; accent-color: #2563eb; }
.demo-control output { text-align: right; font-variant-numeric: tabular-nums; }

button {
  padding: 0.4rem 0.8rem;
  border: 1px solid GrayText;
  border-radius: 0.4rem;
  background: Canvas;
  color: CanvasText;
  font: inherit;
  cursor: pointer;
}

button:disabled { cursor: wait; opacity: 0.5; }
.demo-retry { margin: 0.75rem auto; }
.demo-retry:not([hidden]) { display: block; }

@media (max-width: 600px) {
  body { padding: 0.35rem; }
  .demo-control { gap: 0.4rem; }
}
