.prototype-photos {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.prototype-photo-link {
  display: block;
  border: 1px solid var(--rule);
}

.prototype-render {
  display: block;
  width: 100%;
  height: auto;
  background: var(--subtle);
}

.prototype-label {
  margin: 9px 0 0;
  color: var(--secondary);
  font: 11px/1.6 var(--sans);
}

.prototype-figure figcaption { margin-top: 17px; }
.coverage-plan { display: block; width: 100%; height: auto; }

.detection-demo {
  --tracking: #496d5d;
  --candidate: #8a6329;
  --alert: #a44930;
  --state-color: var(--tracking);
}

:root[data-theme="dark"] .detection-demo {
  --tracking: #a3c7b1;
  --candidate: #d8b678;
  --alert: #e8a18b;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .detection-demo {
    --tracking: #a3c7b1;
    --candidate: #d8b678;
    --alert: #e8a18b;
  }
}

.detection-demo[data-phase="detect"],
.detection-demo[data-phase="confirm"] { --state-color: var(--candidate); }
.detection-demo[data-phase="alert"] { --state-color: var(--alert); }

.demo-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font: 500 12px/1.5 var(--sans);
}

.demo-annotation {
  color: var(--secondary);
  font-size: 10px;
  font-weight: 400;
  text-align: right;
}

.detection-scene {
  display: block;
  width: 100%;
  height: auto;
  margin: 7px 0 4px;
}

.room-lines { color: var(--rule); }
.camera-device { color: var(--secondary); }
.camera-coverage { fill: var(--tracking); fill-opacity: .035; stroke: var(--tracking); stroke-opacity: .3; stroke-dasharray: 3 5; }
.scene-label { color: var(--secondary); font: 11px var(--mono); }
.scene-note { font-size: 10px; }
.tracked-person { color: var(--state-color); }
.pose-joints { fill: var(--paper); }
.track-bounds { opacity: .6; }
.caregiver-device { color: var(--secondary); }
.phone-alert, .alert-connection { opacity: 0; }
.alert-connection { color: var(--alert); }
.detection-demo[data-phase="alert"] .caregiver-device { color: var(--alert); }
.detection-demo[data-phase="alert"] .phone-idle { opacity: 0; }
.detection-demo[data-phase="alert"] .phone-alert,
.detection-demo[data-phase="alert"] .alert-connection { opacity: 1; }

.demo-readout {
  display: flex;
  align-items: baseline;
  gap: 18px;
  min-height: 38px;
  padding: 10px 0;
  border-top: 1px solid var(--rule);
  font: 11px/1.6 var(--sans);
}

.demo-state { min-width: 114px; color: var(--state-color); font-weight: 500; }
.demo-detail { color: var(--secondary); font-variant-numeric: tabular-nums; }
.demo-transport { display: flex; align-items: center; gap: 16px; }

.demo-play {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  min-width: 76px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  font: 12px/1.5 var(--sans);
}

.demo-play:hover { color: var(--link); }
.demo-play svg { flex: none; }
.demo-timeline { appearance: none; flex: 1; min-width: 32px; width: 100%; height: 44px; margin: 0; cursor: pointer; background: transparent; accent-color: var(--state-color); }
.demo-timeline::-webkit-slider-runnable-track { height: 2px; background: var(--rule); }
.demo-timeline::-webkit-slider-thumb { appearance: none; width: 10px; height: 10px; margin-top: -4px; border: 0; border-radius: 50%; background: var(--state-color); }
.demo-timeline::-moz-range-track { height: 2px; background: var(--rule); }
.demo-timeline::-moz-range-progress { height: 2px; background: var(--state-color); }
.demo-timeline::-moz-range-thumb { width: 10px; height: 10px; border: 0; border-radius: 50%; background: var(--state-color); }
.demo-time { flex: none; color: var(--secondary); font: 10px/1.5 var(--mono); font-variant-numeric: tabular-nums; }

.demo-stages { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--rule); }
.demo-stages button { position: relative; min-height: 44px; padding: 7px 4px; border: 0; color: var(--secondary); background: transparent; font: 11px/1.5 var(--sans); }
.demo-stages button::before { position: absolute; top: -1px; left: 0; right: 0; height: 1px; background: transparent; content: ""; }
.demo-stages button[aria-pressed="true"] { color: var(--state-color); font-weight: 600; }
.demo-stages button[aria-pressed="true"]::before { background: var(--state-color); }
.demo-stages button:hover { color: var(--ink); background: var(--subtle); }
.demo-static-note { color: var(--secondary); font: 12px/1.7 var(--sans); }
.detection-figure figcaption { margin-top: 16px; }

@media (max-width: 540px) {
  .prototype-photos { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .demo-heading { flex-direction: column; gap: 3px; }
  .demo-annotation { text-align: left; }
  .scene-label { font-size: 16px; }
  .scene-note { font-size: 13px; }
  .demo-readout { flex-direction: column; gap: 2px; min-height: 70px; }
  .demo-transport { gap: 10px; }
  .demo-play { min-width: 67px; font-size: 11px; }
  .demo-time { font-size: 10px; }
  .demo-stages button { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .demo-play { min-width: 103px; }
}

@media print {
  .prototype-photos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detection-demo,
  :root[data-theme] .detection-demo,
  :root:not([data-theme]) .detection-demo { --tracking: #333; --candidate: #333; --alert: #333; }
  .demo-controls, .demo-readout, .demo-heading { display: none; }
  .detection-figure, .prototype-figure { break-inside: avoid; }
}
