/* Controls and output for the in-browser experiment panel. */

#demo {
  min-height: 420px;
  border: 1px solid rgba(0, 0, 0, .10);
  border-radius: 14px;
  padding: 1.35rem 1.5rem 1.6rem;
  background: #fff;
}

#demo .boot {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 2.2rem .2rem;
  color: #555;
  font-size: .95rem;
}
#demo .boot.err { color: #a11; }
#demo .boot .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent, #3355ff);
  animation: demo-pulse 1.1s ease-in-out infinite;
  flex: none;
}
@keyframes demo-pulse { 0%, 100% { opacity: .25 } 50% { opacity: 1 } }

.demo-intro { font-size: .97rem; line-height: 1.6; margin-bottom: 1.1rem; }
.demo-intro p { margin: .5rem 0; }

.ctl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: .9rem 1.4rem;
  padding: 1rem 1.1rem;
  background: rgba(0, 0, 0, .025);
  border-radius: 10px;
  margin-bottom: 1rem;
}
.ctl label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .01em;
  margin-bottom: .35rem;
  color: #333;
}
.ctl label.ctl-check { display: flex; align-items: center; gap: .5rem; }
.ctl select {
  width: 100%; padding: .45rem .55rem; font: inherit; font-size: .9rem;
  border: 1px solid rgba(0, 0, 0, .18); border-radius: 7px; background: #fff;
}
.slider-row { display: flex; align-items: center; gap: .7rem; }
.slider-row input[type=range] { flex: 1; accent-color: var(--accent, #3355ff); }
.ctl-val {
  min-width: 3.4em; text-align: right; font-variant-numeric: tabular-nums;
  font-size: .86rem; color: #444;
}

.action-bar { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1.1rem; }
.demo-btn {
  font: inherit; font-size: .9rem; font-weight: 600;
  padding: .55rem 1.1rem; border-radius: 8px; cursor: pointer;
  border: 1px solid rgba(0, 0, 0, .16); background: #fff; color: #222;
}
.demo-btn.primary {
  background: var(--accent, #3355ff); border-color: transparent; color: #fff;
}
.demo-btn:disabled { opacity: .55; cursor: progress; }

.demo-fig img { max-width: 100%; height: auto; display: block; margin: 0 auto 1rem; }

.demo-out { font-size: .94rem; line-height: 1.6; }
.demo-out table {
  border-collapse: collapse; width: 100%; margin: .8rem 0; font-size: .87rem;
}
.demo-out th, .demo-out td {
  border-bottom: 1px solid rgba(0, 0, 0, .09); padding: .4rem .55rem;
  text-align: left; vertical-align: top;
}
.demo-out th { font-weight: 600; background: rgba(0, 0, 0, .03); }
.demo-out code {
  background: rgba(0, 0, 0, .05); padding: .1em .35em; border-radius: 4px;
  font-size: .86em; word-break: break-word;
}
.demo-out h3, .demo-out h4 { margin: 1.1rem 0 .4rem; font-size: 1rem; }
.demo-out pre.err {
  background: #fff4f4; border: 1px solid #f0c8c8; color: #811;
  padding: .8rem; border-radius: 8px; overflow-x: auto; font-size: .8rem;
}
.demo-note { font-size: .84rem; color: #666; margin-top: 1rem; }

details.more {
  border: 1px solid rgba(0, 0, 0, .10); border-radius: 12px;
  padding: .1rem 1.1rem; margin: 1.4rem 0; background: #fff;
}
details.more > summary {
  cursor: pointer; font-weight: 600; padding: .85rem 0; list-style: none;
}
details.more > summary::-webkit-details-marker { display: none }
details.more > summary::before { content: "\25B8\00a0\00a0"; color: var(--accent, #3355ff); }
details.more[open] > summary::before { content: "\25BE\00a0\00a0"; }
details.more .container { padding-left: 0; padding-right: 0; max-width: none; }

@media (max-width: 640px) {
  #demo { padding: 1rem .9rem 1.2rem; }
  .ctl-grid { grid-template-columns: 1fr; padding: .85rem .9rem; }
}
