.demo-page {
  --night: #081321;
  --edge: #d5e1e8;
  --body-text: #42586b;
  background: #f3f6f9;
  color: #142937;
}
.demo-shell { width: min(1190px, calc(100% - 3.5rem)); margin-inline: auto; }
@media (min-width: 81rem) {
  .demo-shell { width: var(--wide-shell); }
  .demo-stage .demo-intro h1 { font-size: clamp(5rem, 5.15vw, 6.65rem); }
  .demo-stage .demo-lead { font-size: clamp(1.17rem, 1.12vw, 1.32rem); }
}
.demo-header { background: var(--night); border-bottom: 1px solid #203144; color: white; }
.demo-nav { min-height: 4.85rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.demo-nav nav { display: flex; flex-wrap: wrap; gap: 1.55rem; align-items: center; }
.demo-nav nav a, .demo-footer a { display: inline-flex; align-items: center; min-height: 2.75rem; font-size: .92rem; }
.demo-nav nav a { color: #c4d5e4; }
.demo-nav nav a:hover, .demo-footer a:hover { text-decoration: underline; text-underline-offset: .25em; }
.demo-hero {
  position: relative; isolation: isolate; color: #f3f8fc;
  background: radial-gradient(ellipse at 87% 20%, #12363f, transparent 56%), radial-gradient(ellipse at 16% 125%, #132e46, transparent 53%), var(--night);
}
.demo-hero::before {
  content: ""; position: absolute; z-index: -1; inset: 0; pointer-events: none; opacity: .23;
  background-image: linear-gradient(#709aa112 1px, transparent 1px), linear-gradient(90deg, #709aa112 1px, transparent 1px);
  background-size: 3rem 3rem; mask-image: linear-gradient(90deg, transparent 20%, #000);
}
.demo-stage { display: grid; grid-template-columns: minmax(0, .87fr) minmax(0, 1.13fr); align-items: center; gap: clamp(2rem, 5vw, 5rem); padding-block: clamp(2.6rem, 4.5vw, 4.6rem) clamp(3.8rem, 6vw, 5.6rem); }
.demo-intro { min-width: 0; }
.demo-eyebrow, .demo-kicker {
  font: 680 .78rem/1.5 ui-monospace, "SFMono-Regular", Consolas, monospace;
  letter-spacing: .1em; text-transform: uppercase;
}
.demo-eyebrow { color: #90e3d5; display: flex; align-items: center; gap: .7rem; margin: 0; }
.demo-eyebrow::before { content: ""; width: 1.85rem; height: 2px; background: linear-gradient(90deg, #487fe6, #7aeed3); }
.demo-intro h1 { font-size: clamp(3.3rem, 5.45vw, 5.05rem); line-height: 1.015; letter-spacing: -.065em; font-weight: 730; margin: 1.3rem 0; }
.demo-intro h1 span { color: #9aefda; }
@supports (background-clip: text) {
  .demo-intro h1 span { color: transparent; background: linear-gradient(100deg, #b6f3e2 4%, #89e4cf 62%, #65c3d5); background-clip: text; }
}
.demo-lead { max-width: 43ch; color: #b8cbd9; font-size: clamp(1rem, 1.35vw, 1.17rem); line-height: 1.65; margin: 0; text-wrap: pretty; }
.demo-entry-links { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem 1.2rem; margin: 1.65rem 0 1.1rem; }
.demo-action, .replay-play, .replay-next, .demo-tabs button {
  display: inline-flex; justify-content: center; align-items: center; gap: .55rem; min-height: 2.75rem; padding: .65rem 1rem;
  border: 1px solid transparent; border-radius: .55rem; font: inherit; font-size: .94rem; font-weight: 650; line-height: 1.35; cursor: pointer;
}
.demo-action { background: #215bd4; color: #fff; }
.demo-action:hover { background: #164cbf; }
.demo-text-link { display: inline-flex; align-items: center; min-height: 2.75rem; color: #d5e4ef; font-size: .94rem; font-weight: 620; text-decoration: underline; text-decoration-color: #7190a6; text-underline-offset: .29em; }
.demo-text-link:hover { color: #a3ecdd; }
.demo-disclosure { margin: 0; color: #a0b6c8; font-size: .84rem; line-height: 1.55; }

.replay-console {
  position: relative; min-width: 0; border: 1px solid #355667; border-radius: 1.15rem;
  scroll-margin-block-start: 1rem;
  background: linear-gradient(125deg, #122638, #0c1c2d 60%, #102532);
  box-shadow: 0 1.5rem 4rem -2rem #000a, inset 0 1px #b9eae612; color: #e9f4fc;
}
.replay-header { display: flex; align-items: center; gap: .85rem; padding: 1.15rem 1.4rem .95rem; }
.replay-metal {
  display: grid; place-items: center; flex: 0 0 2.5rem; height: 2.5rem; color: #f9d399; border: 1px solid #8c734d;
  border-radius: .55rem; background: linear-gradient(135deg, #554736, #2b2c2e);
  font: 650 1.18rem/1 ui-monospace, Consolas, monospace; letter-spacing: -.07em;
}
.replay-header h2 { margin: 0; font-size: 1.25rem; line-height: 1.3; letter-spacing: -.03em; }
.replay-header p { margin: .14rem 0 0; color: #a6bbcb; font-size: .83rem; line-height: 1.3; }
.replay-timestamp { margin-left: auto; font: 600 .9rem/1.5 ui-monospace, Consolas, monospace; font-variant-numeric: tabular-nums; color: #c3dedf; }
.replay-figure { margin: 0 1.2rem; border: 1px solid #294456; border-radius: .65rem; overflow: hidden; background: #0a1a2a; }
.replay-plot { position: relative; height: clamp(9.75rem, 14.2vw, 12rem); }
.replay-plot canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.replay-fallback { height: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: center; text-align: center; gap: .3rem; color: #9cb1c4; font: .83rem/1.6 ui-monospace, Consolas, monospace; }
.replay-fallback b { display: block; color: #dbeefa; font-size: 1rem; }
.replay-figure figcaption { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; padding: .1rem .9rem .7rem; color: #b3c7d8; font-size: .78rem; }
.replay-figure figcaption span { display: inline-flex; align-items: center; gap: .4rem; }
.replay-figure figcaption span::before { content: ""; width: 1.05rem; border-top: 2px solid #78a7dc; }
.replay-figure figcaption .key-stop::before { border-top: 2px dashed #f4c17a; }
.replay-ticks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .35rem; margin: .4rem 1.3rem 0; }
.replay-ticks button {
  position: relative; padding: .4rem .2rem; min-height: 2.75rem; border: 0; border-bottom: 2px solid #34495a;
  background: transparent; color: #b6c9d8; font: 570 .88rem/1.4 ui-monospace, Consolas, monospace; cursor: pointer;
}
.replay-ticks button[aria-pressed=true] { border-color: #76e1cc; color: #a5f2df; background: linear-gradient(transparent, #26534d3b); }
.replay-ticks button:hover { color: white; }
.replay-event { padding: .95rem 1.4rem 1rem; min-height: 5.15rem; }
.replay-event strong { display: block; color: #dff7ef; font-size: 1.03rem; line-height: 1.3; }
.replay-event p { margin: .28rem 0 0; color: #b9cbd9; font-size: .95rem; line-height: 1.5; }
.replay-toolbar { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: .7rem 1rem; padding: 0 1.3rem 1rem; }
.replay-transport { display: flex; flex-wrap: wrap; gap: .45rem; }
.replay-play, .replay-next { padding-inline: .78rem; font-size: .88rem; }
.replay-play { background: #9cebd8; color: #0d2c2c; border-color: #97dfd1; }
.replay-play:hover { background: #b1f4e3; }
.replay-play i { display: block; width: .66rem; height: .72rem; background: currentColor; clip-path: polygon(8% 0, 100% 50%, 8% 100%); }
.replay-play[data-playing=true] i { background: linear-gradient(90deg, currentColor 0 32%, transparent 32% 68%, currentColor 68%); clip-path: none; }
.replay-next { border-color: #4a6578; color: #d8e7ef; background: #162a3b; }
.replay-next:hover:enabled { border-color: #86afbc; }
.replay-next:disabled { color: #92a4b5; border-color: #34495b; cursor: default; }
.replay-setting { min-width: 0; }
.replay-setting label { display: block; color: #c1d0dc; font-size: .82rem; line-height: 1.4; margin-bottom: .25rem; }
.demo-page select {
  appearance: none; padding-right: 2.2rem;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 1.1rem) center, calc(100% - .82rem) center;
  background-size: .3rem .3rem; background-repeat: no-repeat;
}
.replay-setting select { width: 100%; min-height: 2.75rem; border: 1px solid #4b6577; border-radius: .5rem; background-color: #132637; color: #e4eef5; padding-left: .75rem; font-family: inherit; font-weight: 550; font-size: .88rem; line-height: 1.35; cursor: pointer; color-scheme: dark; }
.replay-notes { border-top: 1px solid #294255; padding: 0 1.4rem; }
.replay-notes summary, .demo-details summary { width: fit-content; cursor: pointer; padding-block: .75rem; min-height: 2.75rem; line-height: 1.45; font-weight: 620; }
.replay-notes summary { font-size: .875rem; color: #b5cbd8; }
.replay-notes p, .replay-script-note { font-size: .9rem; line-height: 1.6; color: #bbccda; }
.replay-script-note { padding-inline: 1.4rem; }
.replay-log { list-style: none; padding: 0; margin: 1rem 0; }
.replay-log li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .85rem; padding: .6rem 0; border-top: 1px solid #2a4052; color: #b9cad8; font-size: .9rem; line-height: 1.5; }
.replay-log time { color: #a1dfd4; font: .81rem/1.6 ui-monospace, Consolas, monospace; }
.replay-log strong { display: block; color: #ebf2f7; }

.demo-workspace { display: grid; position: relative; align-items: start; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.4rem; margin-top: -1.6rem; }
.demo-card { min-width: 0; padding: clamp(1.3rem, 2.7vw, 2.3rem); border: 1px solid var(--edge); border-radius: 1.05rem; background: white; box-shadow: 0 14px 36px -30px #0d2b4c6b; scroll-margin-top: 1rem; }
.demo-kicker { color: #216b69; margin: 0 0 .5rem; }
.demo-step h2 { font-size: clamp(1.45rem, 2.1vw, 1.95rem); line-height: 1.16; letter-spacing: -.044em; margin: 0 0 1.1rem; }
.demo-card p:not(.demo-kicker), .demo-journey p:not(.demo-kicker), .demo-bottom p { color: var(--body-text); font-size: 1rem; line-height: 1.65; }
.demo-card p.demo-help, .demo-journey p.demo-help, .demo-bottom p.demo-help { font-size: .85rem; color: #51677a; }
.demo-tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-block: 1rem; }
.demo-tabs button { padding: .5rem .85rem; font-size: .88rem; border-color: #cbd9e1; background: #fff; color: #3b5567; }
.demo-tabs button[aria-pressed=true] { color: #105f54; border-color: #439183; background: #e8f6f1; }
.demo-tabs button:hover { border-color: #5c9291; }
.demo-card label { display: block; margin: 1rem 0 .4rem; font-size: .94rem; font-weight: 650; color: #263f51; }
.demo-card select, .demo-card textarea { min-width: 0; width: 100%; border: 1px solid #c7d7e0; border-radius: .6rem; padding: .7rem .85rem; background-color: #f6f9fb; color: #172f44; }
.demo-card textarea { display: block; resize: vertical; font: 1rem/1.6 ui-monospace, Consolas, monospace; scroll-margin-top: 1.2rem; }
.demo-card select { min-height: 2.8rem; font: inherit; padding-right: 2.3rem; }
.demo-rule { border-left: 3px solid #368f80; border-radius: 0 .5rem .5rem 0; background: #eff7f4; padding: 1.1rem 1.2rem; margin: 1.25rem 0; }
.demo-rule h3 { font-size: 1.13rem; margin: .45rem 0; color: #154c44; }
.demo-rule p:last-child { margin: .35rem 0 0; }
.demo-details { border-top: 1px solid var(--edge); margin-top: 1rem; }
.demo-details summary { color: #254e62; font-size: .92rem; }
.demo-details p { margin: .25rem 0; }
.scan-inbox { margin: 1.1rem 0; border: 1px solid #d2dfe7; border-radius: .75rem; overflow: hidden; }
.scan-inbox-head { display: flex; align-items: baseline; flex-wrap: wrap; justify-content: space-between; gap: .5rem; background: #edf3f6; padding: .68rem .85rem; }
.scan-inbox-head strong { font-size: .94rem; }
.scan-inbox-head span { color: #486573; font-size: .83rem; }
.scan-inbox ol { padding: 0 .85rem; list-style: none; margin: 0; }
.scan-inbox li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: baseline; gap: .65rem; padding-block: .65rem; border-top: 1px solid #e0e8ec; }
.scan-inbox li:first-child { border: 0; }
.scan-inbox time { color: #526a7c; font: .76rem/1.5 ui-monospace, Consolas, monospace; }
.inbox-text { display: block; overflow-wrap: anywhere; color: #304a5d; font-size: .91rem; line-height: 1.45; }
.inbox-kind { color: #32576b; font-weight: 650; font-size: .8rem; }
.inbox-kind[data-kind=signals] { color: #106553; }
.inbox-kind[data-kind=unknown], .inbox-kind[data-kind=incomplete] { color: #83550d; }
.demo-counts { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); margin-top: 1.4rem; gap: .6rem; }
.demo-counts div { background: #f1f6f7; border: 1px solid #dce7eb; border-radius: .6rem; padding: .85rem; }
.demo-counts strong, .demo-counts span { display: block; }
.demo-counts strong { color: #176c62; font-size: 1.65rem; font-variant-numeric: tabular-nums; }
.demo-counts span { color: #41606b; font-size: .88rem; }
.demo-notice { padding: .8rem 1rem; background: #f2f5f8; border-left: 2px solid #829bb1; }
.demo-locked { border-top: 1px solid var(--edge); margin-top: 1rem; padding-top: 1rem; }
.demo-locked h3 { margin: 0; font-size: 1.16rem; }
.demo-locked a { display: inline-flex; align-items: center; color: #145ab0; min-height: 2.75rem; text-decoration: underline; text-underline-offset: .23em; }
.demo-journey { padding-block: clamp(3rem, 6vw, 5.6rem); }
.demo-journey h2, .demo-bottom h2 { font-size: clamp(1.8rem, 3.4vw, 2.7rem); line-height: 1.13; letter-spacing: -.05em; margin: .7rem 0 1.4rem; }
.demo-journey-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1.3rem, 3vw, 2.7rem); }
.demo-journey article { border-top: 1px solid #bccfd9; padding-top: 1.1rem; }
.demo-journey h3 { margin: 0; font-size: 1.13rem; }
.demo-journey article p { margin: .55rem 0; }
.demo-bottom { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2rem; align-items: center; margin-bottom: 3.5rem; padding: clamp(1.5rem, 4vw, 3rem); border-radius: 1rem; color: white; background: #0c2032; }
.demo-bottom h2 { font-size: clamp(1.65rem, 3vw, 2.3rem); margin: 0; }
.demo-bottom p { max-width: 63ch; margin: .6rem 0 0; color: #bbccda; }
.demo-bottom p.demo-help { color: #acbfcd; }
.demo-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .3rem 1.7rem; border-top: 1px solid var(--edge); padding: 1rem; color: #526878; font-size: .88rem; }
.demo-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.demo-page :is(button, a, textarea, select, summary):focus-visible { outline: 3px solid #4394c7; outline-offset: 3px; }
.demo-page .demo-hero :focus-visible { outline-color: #abddff; }
.demo-page [hidden] { display: none !important; }
@media (max-width: 940px) {
  .demo-shell { width: calc(100% - 2.6rem); }
  .demo-stage { gap: 1.8rem; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); }
  .demo-intro h1 { font-size: clamp(2.9rem, 5.65vw, 3.6rem); }
  .replay-toolbar { align-items: center; }
  .demo-workspace { gap: 1rem; }
}
@media (max-width: 760px) {
  .demo-stage { grid-template-columns: minmax(0, 1fr); gap: 1.6rem; padding-block: 2.3rem 2.5rem; }
  .demo-intro h1 { font-size: clamp(2.7rem, 9vw, 3.85rem); }
  .demo-lead { max-width: 54ch; }
  .demo-intro h1, .demo-entry-links { margin-block: .85rem; }
  .replay-plot { height: clamp(9rem, 29vw, 12rem); }
  .demo-workspace { grid-template-columns: minmax(0, 1fr); margin-top: 1.25rem; }
  .demo-journey-grid, .demo-bottom { grid-template-columns: minmax(0, 1fr); }
  .demo-bottom { gap: 1rem; }
}
@media (max-width: 520px) {
  .demo-shell { width: calc(100% - 2rem); }
  .demo-nav { min-height: 3.8rem; gap: .5rem; }
  .demo-nav .brand { gap: .4rem; font-size: 1.03rem; }
  .demo-nav .brand img { width: 1.85rem; height: 1.85rem; }
  .demo-nav nav { gap: .8rem; }
  .demo-nav nav a { font-size: .86rem; }
  .demo-stage { padding-block: 1.85rem 1.45rem; gap: 1.3rem; }
  .demo-entry-links { gap: .35rem .85rem; }
  .replay-header { padding: .9rem; }
  .replay-figure { margin-inline: .65rem; }
  .replay-ticks { margin-inline: .7rem; }
  .replay-event { padding: .85rem .95rem; min-height: 6rem; }
  .replay-toolbar { padding: 0 .85rem .85rem; align-items: end; }
  .replay-notes { padding-inline: .95rem; }
  .demo-card { padding: 1.15rem; }
  .demo-kicker, .demo-eyebrow { font-size: .75rem; }
  .scan-inbox li { grid-template-columns: auto minmax(0, 1fr); gap: .15rem .5rem; }
  .inbox-kind { grid-column: 2; }
  .demo-footer { gap: .2rem .9rem; }
}
@media (max-width: 390px) {
  .demo-shell { width: calc(100% - 1.5rem); }
  .demo-nav nav { gap: .55rem; }
  .demo-tabs button { padding-inline: .55rem; }
  .replay-toolbar { display: grid; grid-template-columns: minmax(0, 1fr); gap: .65rem; }
  .replay-setting { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
  .replay-setting label { margin: 0; }
  .replay-setting select { width: auto; }
}
@media (forced-colors: active) {
  .demo-intro h1 span { color: CanvasText; background: none; }
  .replay-ticks button[aria-pressed=true], .demo-tabs button[aria-pressed=true] { outline: 2px solid Highlight; outline-offset: -3px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

.early-example { margin: 1rem 0; padding: 1rem; border: 1px solid #b9d7d3; border-radius: .8rem; background: #f5faf9; }
.early-example[hidden], .early-example [hidden] { display: none; }
.early-example label { margin-top: .8rem; }
.early-example > label:first-child { margin-top: 0; }
.early-example select { width: 100%; max-width: 100%; }
.early-outcome { margin: .8rem 0 0; color: #163e48; line-height: 1.55; }
