.study-demos { background: linear-gradient(155deg, #f6f8f2, var(--tint)); }
.demo-intro { margin: .95rem 0 2rem; color: var(--muted); font-size: 1.08rem; }
.demo-panel { min-width: 0; border-radius: 24px; background: var(--white); box-shadow: var(--surface-shadow); }
.demo-panel h3 { font: 600 clamp(1.45rem,2.35vw,2.1rem)/1.15 var(--display); letter-spacing: -.042em; }
.demo-panel h3 + p, .demo-panel noscript p { color: var(--muted); line-height: 1.5; margin: .6rem 0 0; }
.demo-panel noscript p { margin-top: .8rem; }
.demo-sites { display: grid; grid-template-columns: 1fr 1fr; }
.demo-map-copy, .demo-roster, .demo-sequence { padding: clamp(1.25rem,2.6vw,2.5rem); }
.demo-map-copy { background: color-mix(in srgb,var(--tint) 42%,white); border-radius: 24px 0 0 24px; }
.demo-map-copy p { max-width: 35rem; }
.demo-role-control { display: flex; gap: .65rem; flex-wrap: wrap; align-items: center; margin-top: 1.1rem; }
.demo-role-control[hidden], .demo-action[hidden] { display: none; }
.demo-role-control label { font-size: .9rem; font-weight: 650; }
.demo-role-control select, .demo-action { font-family: inherit; font-size: .95rem; font-weight: 620; }
.demo-role-control select { flex: 0 1 auto; min-width: 0; max-width: 100%; height: 2.65rem; padding: 0 .6rem; border: 1px solid var(--muted); border-radius: .3rem; background: var(--white); color: var(--ink); }
.demo-map {
  display: block; width: 100%; max-width: 28rem; margin: 1.1rem auto 0;
  background-image: radial-gradient(var(--line) .9px, transparent .9px); background-size: 12px 12px;
}
.demo-map path { fill: none; }
.demo-grid-marks, .demo-wire { stroke: var(--muted); }
.demo-grid-marks { opacity: .4; }
.demo-wire { stroke-width: 1.2; stroke-dasharray: 3px 4px; }
.demo-signal { stroke: var(--teal); stroke-width: 2; opacity: var(--presence, 0); }
.demo-node[data-visible=true] .demo-signal { opacity: var(--presence, 1); }
.demo-node rect { fill: var(--white); stroke: var(--muted); }
.demo-node text { fill: var(--muted); font: 580 12px var(--body); }
.demo-node[data-visible=true] rect { fill: var(--teal); stroke: var(--teal); }
.demo-node[data-visible=true] text { fill: var(--white); }
.demo-map .demo-fold-back { fill: var(--fields); }
.demo-map .demo-fold-face { fill: var(--teal); }
.demo-map .demo-fold-crease { fill: var(--mint); stroke: var(--teal); stroke-width: .6; }
.demo-roster { align-self: center; }
.demo-roster table { width: 100%; border-collapse: collapse; text-align: start; line-height: 1.35; }
.demo-roster caption { color: var(--ink); font: 600 1.2rem var(--display); letter-spacing: -.03em; text-align: start; padding-bottom: 1rem; }
.demo-roster th, .demo-roster td { text-align: start; padding: .7rem .25rem; font-variant-numeric: tabular-nums; }
.demo-roster th:first-child { padding-left: 0; }
.demo-roster thead th { border-bottom: 1px solid var(--line); font-size: .85rem; color: var(--muted); }
.demo-roster tbody th { width: 25%; font-weight: 620; }
.demo-roster tbody td { border-bottom: 1px solid var(--line); }
.demo-roster tbody th { border-bottom: 1px solid var(--line); }
.demo-roster td:nth-child(2) { width: 43%; }
.demo-roster [data-visible=false] td { color: var(--muted); }
.demo-roster [data-visible=true] td { color: var(--teal); font-weight: 630; }
.demo-scope-status { color: var(--muted); font-size: .94rem; min-height: 3.1em; margin-top: .9rem; }
.demo-pair { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1rem; margin-top: 1rem; }
.demo-sequence { display: flex; align-items: flex-start; flex-direction: column; }
.demo-sequence h3 + p { margin-bottom: 1.3rem; }
.demo-record { align-self: stretch; margin-top: auto; padding: .4rem 1rem 0; border-radius: 14px; background: var(--page); }
.demo-fields > div { display: flex; justify-content: space-between; align-items: baseline; padding: .72rem 0; gap: .5rem; }
.demo-fields > div + div, .demo-state { border-top: 1px solid var(--line); }
.demo-fields dt { color: var(--muted); }
.demo-fields dd { color: var(--ink); text-align: end; font-weight: 640; font-variant-numeric: tabular-nums; }
.demo-blank { color: var(--muted); font-weight: 450; border-bottom: 1px dashed var(--muted); }
.demo-state { color: var(--teal); display: flex; gap: .5rem; min-height: 3.75rem; align-items: center; padding-block: .5rem; font-size: .94rem; font-weight: 630; }
.demo-state::before { content: ''; display: block; flex: 0 0 .45rem; height: .45rem; outline: 1px solid currentColor; outline-offset: 2px; border-radius: 100%; margin: 0 .2rem; }
.demo-sequence[data-phase="1"] .demo-state::before { background: var(--check); }
.demo-sequence[data-phase="2"] .demo-state::before { background: var(--teal); }
.demo-sign .demo-state::before { content: none; }
.demo-pen { width: 2.3rem; height: 1.25rem; flex: none; }
.demo-pen path { fill: none; stroke: currentColor; stroke-width: 1.7; }
.demo-sign[data-phase="1"] .demo-pen { color: var(--muted); }
.demo-action { border-radius: 999px; border: 1px solid var(--teal); color: var(--white); background: var(--teal); padding: .62rem .95rem; margin-top: 1rem; cursor: pointer; }
.demo-action:hover { color: var(--teal); background: var(--white); }
.demo-sequence :is(.phase-0,.phase-1,.phase-2) { display: none; }
.demo-sequence[data-phase="0"] .phase-0, .demo-sequence[data-phase="1"] .phase-1, .demo-sequence[data-phase="2"] .phase-2 { display: inline; }
@media (max-width: 780px) {
  .demo-sites, .demo-pair { grid-template-columns: 1fr; }
  .demo-map-copy { border-radius: 24px 24px 0 0; }
  .demo-scope-status { min-height: 3.1em; }
}
