/* ─── demo.css ─────────────────────────────────────────────────────────────
   Styles for demo.html — "Without ORIAN / With ORIAN" side-by-side demo.
   Relies on the custom properties, typography, and .btn classes defined in
   styles.css. No @import, no external fonts, no frameworks.
   ──────────────────────────────────────────────────────────────────────── */


/* ── Controls toolbar ──────────────────────────────────────────────────── */

.demo-controls {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin: 0 0 1.5rem;
}

.demo-controls .btn {
  gap: 0.45rem;
  padding: 0.55rem 0.9rem;
  font-size: 0.9rem;
}

.demo-scenario-label {
  margin-left: auto;
  font-size: 0.875rem;
  font-weight: 620;
  color: var(--muted);
}

.demo-scenario {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  padding: 0.5rem 0.7rem;
  cursor: pointer;
  transition: border-color 0.22s ease, box-shadow 0.22s ease;
  max-width: 260px;
}

.demo-scenario:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.demo-scenario:hover { border-color: var(--brand); }

.demo-speed-label {
  margin-left: 0.65rem;
  font-size: 0.875rem;
  font-weight: 620;
  color: var(--muted);
}

.demo-speed {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  padding: 0.5rem 0.7rem;
  cursor: pointer;
  transition: border-color 0.22s ease, box-shadow 0.22s ease;
}

.demo-speed:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.demo-speed:hover {
  border-color: var(--brand);
}


/* ── Stage — two panes side by side ────────────────────────────────────── */

.demo-stage {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1rem, 2.4vw, 1.75rem);
  align-items: start;
}


/* ── Pane base ─────────────────────────────────────────────────────────── */

.demo-pane {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  transition: border-color 0.24s ease, box-shadow 0.24s ease;
}

.demo-pane:hover {
  border-color: rgba(37, 99, 235, 0.32);
  box-shadow: var(--shadow-soft), 0 0 0 1px rgba(37, 99, 235, 0.1);
}


/* ── Pane label band ───────────────────────────────────────────────────── */

.demo-pane-label {
  display: block;
  padding: 0.5rem 1.1rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  line-height: 1;
}

.demo-pane--without .demo-pane-label {
  background: rgba(74, 91, 118, 0.08);
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.demo-pane--with .demo-pane-label {
  background: rgba(37, 99, 235, 0.09);
  color: var(--brand-dark);
  border-bottom: 1px solid rgba(37, 99, 235, 0.18);
}


/* ── Pane body padding ─────────────────────────────────────────────────── */

.demo-pane-body {
  padding: clamp(0.9rem, 2vw, 1.25rem);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}


/* ── Session header (player ID + elapsed time) ─────────────────────────── */

.demo-session-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.demo-player-id {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.demo-session-time {
  font-size: 0.82rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, "Cascadia Code", "Fira Mono", "Consolas", monospace;
}


/* ── Event feed ─────────────────────────────────────────────────────────── */

.demo-feed-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  overflow: hidden;
}

.demo-feed-title {
  margin: 0;
  padding: 0.45rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
}

.demo-feed {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 13rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  font-family: ui-monospace, "Cascadia Code", "Fira Mono", "Consolas", monospace;
  font-size: 0.8rem;
}

.demo-feed li {
  display: flex;
  gap: 0.55rem;
  padding: 0.32rem 0.75rem;
  margin: 0;
  border-bottom: 1px solid transparent;
  transition: background-color 0.15s ease;
}

.demo-feed li:last-child {
  border-bottom: none;
}

.demo-feed-ts {
  color: var(--muted);
  flex-shrink: 0;
  user-select: none;
}

.demo-feed-text {
  color: var(--text);
  word-break: break-word;
}

/* New-event highlight — added by JS, removed after 1 s */
.demo-event-new {
  animation: demoEventFlash 1s ease forwards;
}

@keyframes demoEventFlash {
  0% {
    background-color: rgba(37, 99, 235, 0.18);
  }
  100% {
    background-color: transparent;
  }
}


/* ── Event tags ────────────────────────────────────────────────────────── */

.demo-event-tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  margin-right: 0.5rem;
  flex-shrink: 0;
  font-family: inherit;
  white-space: nowrap;
  line-height: 1.2;
}

.demo-event-tag--win {
  color: #15803d;
  background: rgba(34, 197, 94, 0.14);
}

.demo-event-tag--loss {
  color: #b91c1c;
  background: rgba(220, 38, 38, 0.12);
}

.demo-event-tag--deposit {
  color: #047857;
  background: rgba(16, 185, 129, 0.14);
}

.demo-event-tag--stake-up {
  color: #b45309;
  background: rgba(217, 119, 6, 0.14);
}

.demo-event-tag--rapid-rebet {
  color: #c2410c;
  background: rgba(234, 88, 12, 0.16);
}

.demo-event-tag--spin {
  color: var(--muted);
  background: rgba(74, 91, 118, 0.1);
}

.demo-event-tag--session-open {
  color: var(--brand-dark);
  background: rgba(37, 99, 235, 0.1);
}

.demo-event-tag--session-close {
  color: var(--muted);
  background: rgba(74, 91, 118, 0.1);
}

.demo-event-tag--frustration {
  color: #991b1b;
  background: rgba(220, 38, 38, 0.18);
}

.demo-event-tag--cooldown {
  color: #0e7490;
  background: rgba(14, 165, 233, 0.14);
}

.demo-event-tag--milestone {
  color: #6d28d9;
  background: rgba(139, 92, 246, 0.14);
}

.demo-event-tag--dormancy {
  color: #525b6e;
  background: rgba(82, 91, 110, 0.14);
}

.demo-event-tag--orian-intervene {
  color: #ffffff;
  background: var(--brand-dark);
}


/* ── Branching timeline ────────────────────────────────────────────────── */

.demo-timeline {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1.1rem 1.25rem 1.5rem;
  margin: 1.5rem 0 1rem;
  box-shadow: var(--shadow-soft);
}

.demo-timeline-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.demo-timeline-header-text {
  flex: 1 1 260px;
  min-width: 0;
}

.demo-timeline-title {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.demo-timeline-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.demo-timeline-graph {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 0.75rem;
  align-items: stretch;
}

.demo-timeline-labels {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  padding: 0.5rem 0;
}

.demo-timeline-branch-label {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.3rem 0.55rem;
  border-radius: 6px;
  align-self: flex-start;
}

.demo-timeline-branch-label--without {
  color: var(--muted);
  background: rgba(74, 91, 118, 0.10);
}

.demo-timeline-branch-label--with {
  color: var(--brand-dark);
  background: rgba(37, 99, 235, 0.12);
}

.demo-timeline-canvas {
  position: relative;
  min-height: 240px;
  overflow-x: auto;
  overflow-y: hidden;
}

.demo-timeline-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.demo-timeline-trunk-path,
.demo-timeline-branch-path {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
}

.demo-timeline-trunk-path  { stroke: #c2410c; }

.demo-timeline-branch-path { stroke: var(--brand-dark); }

.demo-timeline-nodes {
  position: absolute;
  inset: 0;
  list-style: none;
  margin: 0;
  padding: 0;
  pointer-events: none;
}

.demo-timeline-node {
  position: absolute;
  /* (left, top) anchors the LINE position the node sits on.
     left is set per-node by JS; top is the trunk or branch line
     y in canvas coordinates (same as the SVG path's y). */
  transform: translateX(-50%);
  width: 0;
  opacity: 0;
  pointer-events: none;
}

.demo-timeline-node[data-visible="true"] {
  opacity: 1;
}

.demo-timeline-node-meta {
  position: static;
}

/* Pill — absolutely positioned ABOVE the line. Default = level 1
   (close to the line). Odd-indexed nodes get level 2 (further up).
   :nth-child counts within each <ol> separately so trunk and
   branch alternate independently — that's what we want. */
.demo-timeline-node-tag {
  position: absolute;
  left: 0;
  top: -26px;
  transform: translateX(-50%);
  white-space: nowrap;
}

.demo-timeline-nodes .demo-timeline-node:nth-child(odd) .demo-timeline-node-tag {
  top: -48px;
}

.demo-timeline-node-dot {
  position: absolute;
  left: 0;
  top: 14px;
  transform: translate(-50%, -50%) scale(0.4);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--line-strong);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
  transition: transform 0.32s cubic-bezier(0.34,1.56,0.64,1),
              border-color 0.25s ease, background 0.25s ease,
              box-shadow 0.25s ease;
}

.demo-timeline-node[data-visible="true"] .demo-timeline-node-dot {
  transform: translate(-50%, -50%) scale(1);
}

.demo-timeline-nodes[data-track="trunk"]  .demo-timeline-node-dot { border-color: #c2410c; }

.demo-timeline-nodes[data-track="branch"] .demo-timeline-node-dot { border-color: var(--brand); }

.demo-timeline-node[data-active="true"] .demo-timeline-node-dot {
  background: var(--brand);
  border-color: var(--brand-dark);
  transform: translate(-50%, -50%) scale(1.2);
}

/* Branch (intervention) marker: the star replaces the regular
   dot. Size/colour stays as before. Pill and time spans are
   omitted from these nodes by the JS, so no layout side-effects. */
.demo-timeline-node--branch .demo-timeline-node-dot {
  width: 22px;
  height: 22px;
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 11px;
}

.demo-timeline-node--branch .demo-timeline-node-dot::after {
  content: "★"; line-height: 1;
}

/* Outcome markers — same size as branch */
.demo-timeline-node--outcome-good .demo-timeline-node-dot,
.demo-timeline-node--outcome-bad  .demo-timeline-node-dot {
  width: 22px;
  height: 22px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
}

.demo-timeline-node--outcome-good .demo-timeline-node-dot {
  background: #15803d;
  border-color: #15803d;
}

.demo-timeline-node--outcome-good .demo-timeline-node-dot::after { content: "✓"; }

.demo-timeline-node--outcome-bad .demo-timeline-node-dot {
  background: #b91c1c;
  border-color: #b91c1c;
}

.demo-timeline-node--outcome-bad .demo-timeline-node-dot::after { content: "✗"; }

.demo-timeline-node-tag .demo-event-tag {
  margin-right: 0;
}

.demo-timeline-node-time {
  position: absolute;
  left: 0;
  top: 30px;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, "Cascadia Code", "Fira Mono", "Consolas", monospace;
}


/* ── API flow ─────────────────────────────────────────────────────────── */

.demo-api-flow {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1rem 1.25rem 0.85rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-soft);
  transition: border-color 0.24s ease, box-shadow 0.24s ease;
}

.demo-api-flow--compact {
  margin: 0;
  padding: 0.3rem 0.55rem;
  background: rgba(37, 99, 235, 0.04);
  border-radius: var(--radius-sm);
  flex: 0 0 auto;
  max-width: 320px;
  width: 100%;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.demo-api-flow--compact .demo-api-flow-svg {
  max-height: 56px;
  width: 100%;
}

/* Hide the caption on compact mode — saves vertical space.
   The icons + arrows are self-explanatory in this context. */
.demo-api-flow--compact .demo-api-flow-caption {
  display: none;
}

.demo-api-flow-caption {
  display: block;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.2rem;
}

.demo-api-flow[data-active="true"] {
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: var(--shadow-soft), 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.demo-api-flow-svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 240px;
}

.demo-api-node rect,
.demo-api-node circle,
.demo-api-node path,
.demo-api-node ellipse,
.demo-api-node line {
  transition: filter 0.25s ease, opacity 0.25s ease;
}

.demo-api-flow[data-active="true"] .demo-api-node--api {
  filter: drop-shadow(0 4px 12px rgba(29, 78, 216, 0.18));
}

.demo-api-node-label {
  font-size: 13px;
  font-weight: 700;
  fill: var(--text);
  font-family: inherit;
}

.demo-api-link-line {
  transition: stroke 0.25s ease, stroke-width 0.25s ease;
}

.demo-api-link-label {
  font-size: 12px;
  font-weight: 700;
  fill: var(--muted);
  font-family: inherit;
  letter-spacing: 0.01em;
  transition: fill 0.25s ease, opacity 0.25s ease;
}

.demo-api-packet {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
}

.demo-api-link.is-active .demo-api-packet {
  opacity: 1;
}

.demo-api-link--request.is-active .demo-api-link-line,
.demo-api-link--query.is-active .demo-api-link-line {
  stroke: #1d4ed8;
  stroke-width: 3;
}

.demo-api-link--response.is-active .demo-api-link-line,
.demo-api-link--result.is-active .demo-api-link-line {
  stroke: #15803d;
  stroke-width: 3;
}

.demo-api-link--request.is-active .demo-api-link-label,
.demo-api-link--query.is-active .demo-api-link-label {
  fill: #1d4ed8;
}

.demo-api-link--response.is-active .demo-api-link-label,
.demo-api-link--result.is-active .demo-api-link-label {
  fill: #15803d;
}

.demo-api-link--request.is-active .demo-api-packet {
  animation: demoApiPacketRequest 0.42s ease forwards;
}

.demo-api-link--response.is-active .demo-api-packet {
  animation: demoApiPacketResponse 0.42s ease forwards;
}

.demo-api-link--query.is-active .demo-api-packet {
  animation: demoApiPacketQuery 0.42s ease forwards;
}

.demo-api-link--result.is-active .demo-api-packet {
  animation: demoApiPacketResult 0.42s ease forwards;
}

.demo-api-flow--compact .demo-api-link--request  .demo-api-packet { --packet-distance:  88px; }
.demo-api-flow--compact .demo-api-link--query    .demo-api-packet { --packet-distance:  88px; }
.demo-api-flow--compact .demo-api-link--response .demo-api-packet { --packet-distance: -88px; }
.demo-api-flow--compact .demo-api-link--result   .demo-api-packet { --packet-distance: -88px; }

@keyframes demoApiPacketRequest {
  0% {
    opacity: 0;
    transform: translateX(0);
  }
  12% {
    opacity: 1;
  }
  88% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateX(var(--packet-distance, 212px));
  }
}

@keyframes demoApiPacketResponse {
  0% {
    opacity: 0;
    transform: translateX(0);
  }
  12% {
    opacity: 1;
  }
  88% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateX(var(--packet-distance, -212px));
  }
}

@keyframes demoApiPacketQuery {
  0% {
    opacity: 0;
    transform: translateX(0);
  }
  12% {
    opacity: 1;
  }
  88% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateX(var(--packet-distance, 220px));
  }
}

@keyframes demoApiPacketResult {
  0% {
    opacity: 0;
    transform: translateX(0);
  }
  12% {
    opacity: 1;
  }
  88% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateX(var(--packet-distance, -220px));
  }
}

.demo-api-status-strip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.8rem;
  padding-top: 0.72rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: ui-monospace, "Cascadia Code", "Fira Mono", "Consolas", monospace;
  font-size: 0.8rem;
}

.demo-api-status-event,
.demo-api-status-scores {
  font-variant-numeric: tabular-nums;
}

.demo-api-status-event {
  color: var(--text);
  font-weight: 650;
}

.demo-api-status-arrow {
  color: var(--brand);
  font-weight: 800;
}

.demo-api-status-scores {
  color: var(--brand-dark);
}

@media (max-width: 700px) {
  .demo-timeline-graph {
    grid-template-columns: 1fr;
  }

  .demo-timeline-labels {
    flex-direction: row;
    gap: 0.5rem;
  }

  .demo-timeline-canvas { min-height: 360px; }

  .demo-api-flow {
    padding: 0.85rem 0.9rem 0.78rem;
  }

  .demo-api-node-label {
    font-size: 11.5px;
  }

  .demo-api-link-label {
    font-size: 11px;
  }

  .demo-api-status-strip {
    gap: 0.45rem;
    font-size: 0.74rem;
  }
}


/* ── CRM action card ────────────────────────────────────────────────────── */

.demo-action-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 0.65rem 0.85rem;
  transition: border-color 0.24s ease, box-shadow 0.24s ease,
              background-color 0.24s ease;
}

.demo-action-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.3rem;
}

.demo-action-text {
  font-size: 0.93rem;
  font-weight: 640;
  color: var(--text);
  margin: 0;
  line-height: 1.4;
}

/* Fire animation — added by JS when an action fires, then removed */
.demo-action-fire {
  animation: demoActionFire 0.55s ease forwards;
}

@keyframes demoActionFire {
  0% {
    transform: scale(1);
    background-color: var(--surface);
    border-color: var(--line);
    box-shadow: none;
  }
  30% {
    transform: scale(1.025);
    background-color: rgba(37, 99, 235, 0.09);
    border-color: rgba(37, 99, 235, 0.45);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.15);
  }
  100% {
    transform: scale(1);
    background-color: var(--surface);
    border-color: var(--line);
    box-shadow: none;
  }
}


/* ── Outcome line ───────────────────────────────────────────────────────── */

.demo-outcome {
  font-size: 0.92rem;
  font-weight: 660;
  color: var(--accent);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  background: rgba(37, 99, 235, 0.07);
  border: 1px solid rgba(37, 99, 235, 0.18);
  margin: 0;
  display: none; /* shown by JS when simulation ends */
}

.demo-outcome[data-visible="true"] {
  display: block;
}


/* ── Score readouts (with-ORIAN pane only) ──────────────────────────────── */

.demo-scores {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.demo-score-row {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.demo-score-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem;
}

.demo-score-name {
  font-size: 0.82rem;
  font-weight: 660;
  color: var(--text);
}

.demo-score-value {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--brand-dark);
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, "Cascadia Code", "Fira Mono", "Consolas", monospace;
  /* Pulse transition when JS updates the textContent */
  transition: color 0.4s ease;
}

.demo-score-track {
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.demo-score-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand-dark) 100%);
  width: 0%;
  /* Pulse transition — smooth bar update + brief glow */
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.3s ease;
}

.demo-score-fill[data-pulse] {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

/* Churn / Exit Risk gets a warning tint when high */
.demo-score-row--churn .demo-score-fill {
  background: linear-gradient(90deg, #d97706 0%, #b45309 100%);
}

.demo-score-row--churn .demo-score-value {
  color: #b45309;
}

.demo-score-row--bonus_responsiveness .demo-score-fill {
  background: linear-gradient(90deg, #dc2626 0%, #991b1b 100%);
}

.demo-score-row--bonus_responsiveness .demo-score-value {
  color: #b91c1c;
}

/* Alert states — danger & opportunity */
.demo-score-row {
  transition: border-left-color 0.3s ease, box-shadow 0.3s ease;
  border-left: 3px solid transparent;
  padding-left: 0.45rem;
}

[data-alert="danger"] {
  border-left-color: #dc2626;
  box-shadow: -3px 0 8px -3px rgba(220, 38, 38, 0.35);
}

[data-alert="danger"] .demo-score-name {
  font-weight: 750;
}

[data-alert="danger"] .demo-score-value {
  color: #dc2626;
  transition: color 0.3s ease;
}

[data-alert="opportunity"] {
  border-left-color: #15803d;
  box-shadow: -3px 0 8px -3px rgba(21, 128, 61, 0.35);
}

[data-alert="opportunity"] .demo-score-value {
  color: #15803d;
  transition: color 0.3s ease;
}

[data-alert="suppress"] {
  border-left-color: #d97706;
  box-shadow: -3px 0 8px -3px rgba(217, 119, 6, 0.35);
}

[data-alert="suppress"] .demo-score-name {
  font-weight: 750;
}

[data-alert="suppress"] .demo-score-value {
  color: #92400e;
  transition: color 0.3s ease;
}


/* ── Preview overlay ────────────────────────────────────────────────────── */

.demo-preview-wrap {
  position: relative;
}

/* Dim and disable panes when overlay is present */
.demo-preview-wrap:has(.demo-preview-overlay) .demo-stage {
  opacity: 0.38;
  pointer-events: none;
  user-select: none;
  filter: blur(1.5px);
  transition: opacity 0.3s ease, filter 0.3s ease;
}

.demo-preview-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.1rem;
  text-align: center;
  padding: 2rem 1.5rem;
  /* Semi-transparent backdrop */
  background: rgba(248, 251, 255, 0.72);
  backdrop-filter: blur(6px);
  border-radius: var(--radius);
  border: 1px solid rgba(37, 99, 235, 0.18);
  z-index: 10;
}

.demo-preview-heading {
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  font-weight: 760;
  color: var(--text);
  margin: 0;
  line-height: 1.3;
}

.demo-preview-sub {
  font-size: 0.93rem;
  color: var(--muted);
  margin: 0;
  max-width: 42ch;
}


/* ── Reduced-motion overrides ───────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .demo-event-new {
    animation: none;
    background-color: rgba(37, 99, 235, 0.12);
  }

  .demo-action-fire {
    animation: none;
    background-color: rgba(37, 99, 235, 0.09);
    border-color: rgba(37, 99, 235, 0.45);
  }

  .demo-score-fill {
    transition: width 0.3s ease;
  }

  .demo-score-value {
    transition: none;
  }

  .demo-pane,
  .demo-action-card,
  .demo-speed {
    transition: none;
  }
}


/* ── Mobile — stack panes vertically below 900 px ───────────────────────── */

@media (max-width: 900px) {
  .demo-stage {
    grid-template-columns: 1fr;
  }

  .demo-controls {
    flex-wrap: wrap;
  }

  .demo-speed-label {
    margin-left: 0;
  }
}
