/* /demo/: the poisoned-ticket side-by-side (content/demo.mjs, public/demo.js).
   Colours come from style.css's tokens, so both themes and "More contrast"
   apply. On phones the two columns become a switch built from two radio
   buttons, which needs no JavaScript. */
.demo-banner { margin: 0 0 22px; padding: 14px 18px; border: 1px solid var(--line-2); border-left: 4px solid var(--amber); border-radius: 12px; background: var(--panel-2); color: var(--ink-2); max-width: 900px; }
.demo-banner strong { color: var(--ink); }
.demo-presets { margin: 26px 0 8px; }
.demo-presets-label { margin: 0 0 8px; color: var(--muted); font-size: 0.875rem; font-weight: 650; }
.demo-presets ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.demo-presets a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel); color: var(--ink) !important; text-decoration: none; font-weight: 650; }
.demo-presets a[aria-current="true"] { border-color: var(--violet); background: var(--panel-2); box-shadow: 0 0 0 1px var(--violet) inset; }
.demo-preset { margin-top: 28px; padding-top: 8px; border-top: 1px solid var(--line); }
.demo-preset > h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin: 20px 0 6px; }
.demo-preset > h2:focus { outline: none; }
.demo-preset > h2:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
.demo-preset-kicker { display: block; font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cyan); margin-bottom: 4px; }
.demo-alias { display: block; position: relative; top: -80px; }
.demo-stage { margin-top: 26px; }
.demo-stage > h3 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 1.1875rem; margin: 0 0 12px; }
.demo-num { display: inline-grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--panel-2); border: 1px solid var(--line-2); font-size: 0.875rem; }
.demo-sample { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); }
.demo-hint { color: var(--muted); margin: 0 0 12px; }
.demo-message { margin: 0; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); max-width: 760px; }
.demo-message figcaption { color: var(--muted); font-size: 0.875rem; margin-bottom: 8px; }
.demo-message blockquote { margin: 0; font-size: 1.0625rem; }
.demo-message blockquote p { margin: 0; }
.demo-hidden { margin-top: 14px; }
.demo-hidden summary { cursor: pointer; font-weight: 650; color: var(--cyan); min-height: 24px; }
.demo-hidden-text { margin: 10px 0 0; padding: 12px 14px; border: 1px dashed var(--error); border-radius: 10px; color: var(--ink-2); background: rgb(var(--fg-rgb) / 0.03); }
.demo-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.demo-controls .small { padding: 10px 16px; }
.demo-status { margin: 0; color: var(--muted); }
.demo-switch { display: none; }
.demo-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.demo-col { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 18px; min-width: 0; }
.demo-col h4 { margin: 0 0 12px; font-size: 1.0625rem; }
.demo-col-agent { border-top: 4px solid var(--error); }
.demo-col-tool { border-top: 4px solid var(--good); }
.demo-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: demo-step; }
.demo-steps li { display: flex; gap: 10px; align-items: baseline; }
.demo-by { flex: none; display: inline-block; min-width: 4.4em; text-align: center; font-size: 0.75rem; font-weight: 750; letter-spacing: 0.04em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line-2); }
.demo-by-code { color: var(--good); border-color: currentColor; }
.demo-by-model { color: var(--amber); border-color: currentColor; }
.demo-col-note { margin: 12px 0 0; color: var(--muted); font-size: 0.9375rem; }
.demo-draft { margin-top: 14px; border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px; background: var(--raised); }
.demo-draft-head { margin: 0 0 4px; font-size: 0.9375rem; overflow-wrap: anywhere; }
.demo-draft-head span { display: inline-block; min-width: 6.5em; color: var(--muted); font-weight: 650; }
.demo-draft-body { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.demo-draft-body p { margin: 0 0 8px; }
.demo-injected { background: rgb(var(--fg-rgb) / 0.08); color: var(--ink); padding: 1px 4px; border-radius: 4px; outline: 1px dashed var(--amber); }
.demo-fixed { padding: 1px 4px; border-radius: 4px; outline: 1px solid var(--good); }
.demo-mark-note { display: block; margin-top: 4px; font-size: 0.8125rem; color: var(--muted); }
.demo-outcomes { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.demo-outcome { border-radius: var(--radius); padding: 16px 18px; border: 1px solid var(--line-2); background: var(--panel); }
.demo-outcome p { margin: 0 0 6px; }
.demo-outcome-label { font-weight: 750; }
.demo-outcome-bad { border-left: 4px solid var(--error); }
.demo-outcome-bad .demo-outcome-label { color: var(--error); }
.demo-outcome-good { border-left: 4px solid var(--good); }
.demo-outcome-good .demo-outcome-label { color: var(--good); }
.demo-outcome-note { color: var(--muted); }
.table-scroll { overflow-x: auto; max-width: 100%; }
.table-scroll:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.demo-manifest { border-collapse: collapse; width: 100%; min-width: 520px; font-size: 0.9375rem; }
.demo-manifest th, .demo-manifest td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.demo-manifest thead th { color: var(--muted); font-weight: 650; }
.demo-record { margin: 0 0 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--raised); overflow-x: auto; font-size: 0.875rem; line-height: 1.6; white-space: pre; }
.demo-end { margin-top: 44px; padding-top: 8px; border-top: 1px solid var(--line); }

@media (max-width: 760px) {
  .demo-cols, .demo-outcomes { grid-template-columns: 1fr; }
  .demo-switch { display: inline-flex; align-items: center; gap: 4px; margin: 0 0 12px; border: 1px solid var(--line-2); border-radius: 999px; padding: 4px; background: var(--panel); }
  .demo-switch legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .demo-switch label { position: relative; display: inline-flex; align-items: center; min-height: 40px; padding: 6px 16px; border-radius: 999px; font-weight: 650; cursor: pointer; color: var(--muted); }
  .demo-switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
  .demo-switch label:has(input:checked) { background: var(--panel-2); color: var(--ink); box-shadow: 0 0 0 1px var(--violet) inset; }
  .demo-switch label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
  .demo-run:has(.demo-view-agent:checked) .demo-col-tool,
  .demo-run:has(.demo-view-tool:checked) .demo-col-agent { display: none; }
}
@media print {
  .demo-switch, .demo-controls { display: none !important; }
  .demo-cols .demo-col { display: block !important; }
}
