.detector-demo {
  margin-block: clamp(3rem, 8vw, 7rem);
  color: var(--ink);
}

.detector-demo-intro { max-width: 39rem; margin-bottom: 1.55rem; }
.detector-demo-intro h2 { margin: .4rem 0 .7rem; font: 500 clamp(2rem, 4.8vw, 3.65rem)/1.04 var(--display); letter-spacing: -.045em; }
.detector-demo-intro > p:last-child { color: var(--muted); }

.detector-console {
  display: grid;
  grid-template-columns: minmax(0, 2.15fr) minmax(15rem, 1fr);
  overflow: hidden;
  border-radius: .75rem;
  background: #17222d;
  color: #edf3f4;
}

.detector-demo-frame {
  display: grid;
  align-content: center;
  overflow: hidden;
  padding: clamp(.75rem, 2vw, 1.5rem);
  background: #131d27;
}

.detector-demo-note,
.detector-demo-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .3rem .9rem;
  color: #b7c5ce;
  font-size: .74rem;
}
.detector-demo-note { margin-bottom: .75rem; font-weight: 650; letter-spacing: .055em; }
.detector-demo-legend { justify-content: center; margin-top: .65rem; }

.detector-demo-svg { width: 100%; height: auto; border: 1px solid #2e414f; border-radius: .3rem; }
.detector-demo-svg text { font: 600 17px var(--body); }
.detector-grid { stroke: #617687; }
.detector-collision { color: #b9d7f8; }
.detector-tracks { color: #f2b590; }
.detector-extrapolation { color: #9ed7d8; }
.detector-vertex { color: #ffe1a0; }

.detector-demo-legend span::before {
  display: inline-block;
  width: .46em;
  height: .46em;
  margin-right: .4em;
  vertical-align: .14em;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.detector-console-side { display: grid; align-content: center; gap: 1.15rem; padding: clamp(1.2rem, 3vw, 2rem); }
.detector-console-label { color: #c3d0d8; font-size: .76rem; font-weight: 650; letter-spacing: .09em; text-transform: uppercase; }
.detector-demo-controls { display: grid; gap: .4rem; }

.detector-demo-controls button,
.detector-play {
  min-height: 44px;
  border: 1px solid #526473;
  border-radius: .3rem;
  background: transparent;
  color: #edf3f4;
  cursor: pointer;
  font: inherit;
  font-size: .875rem;
  font-weight: 600;
  transition: background .2s ease, border-color .2s ease;
}

.detector-demo-controls button {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .4rem .68rem;
  text-align: left;
}
.detector-demo-controls button span { color: #b1bfcb; font-size: .76rem; font-variant-numeric: tabular-nums; }
.detector-demo-controls button:hover, .detector-play:hover { border-color: #b5c7d3; background: #263744; }
.detector-demo-controls button[aria-pressed="true"] { border-color: #d8b091; background: #372e31; }
.detector-demo-controls button[aria-pressed="true"] span { color: #ffd9b8; }
.detector-console button:focus-visible { outline-color: #f6c5ae; }

.detector-demo-readout { min-height: 5.5em; color: #e0e7e9; font-size: .9rem; line-height: 1.5; }
.detector-play { width: fit-content; padding: .4rem .82rem; }

[data-detector-flight] { opacity: 0; }
[data-detector-layer][hidden] { display: none !important; }

@media (max-width: 760px) {
  .detector-console { grid-template-columns: minmax(0, 1fr); }
  .detector-console-side { gap: .85rem; }
  .detector-demo-readout { min-height: 4.5em; }
}

@media (prefers-reduced-motion: reduce) {
  .detector-console button { transition: none; }
}
