:root {
  --runtime-bg: #0b1020;
  --runtime-panel: #11182a;
  --runtime-panel-soft: #171f34;
  --runtime-border: rgba(148, 163, 184, 0.18);
  --runtime-muted: #94a3b8;
  --runtime-violet: #8b82f6;
  --runtime-violet-soft: rgba(139, 130, 246, 0.14);
  --runtime-green: #4ade80;
  --runtime-green-soft: rgba(74, 222, 128, 0.12);
  --runtime-red: #fb7185;
  --runtime-red-soft: rgba(251, 113, 133, 0.11);
  --runtime-amber: #fbbf24;
  --runtime-amber-soft: rgba(251, 191, 36, 0.11);
}

.runtime-demo-stage {
  padding: clamp(5.5rem, 9vw, 9rem) 0;
  color: #f8fafc;
  background:
    radial-gradient(circle at 70% 12%, rgba(93, 86, 200, 0.2), transparent 28rem),
    var(--runtime-bg);
}

.runtime-demo-heading {
  display: grid;
  gap: 1.25rem;
  margin-bottom: clamp(2rem, 4vw, 3.5rem);
}

.runtime-demo-heading h2 {
  max-width: 12ch;
  margin: 0.7rem 0 0;
  font-size: clamp(2.7rem, 5vw, 5.1rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.runtime-demo-heading p {
  max-width: 42rem;
  margin: 0;
  color: var(--runtime-muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.runtime-demo-shell {
  overflow: hidden;
  border: 1px solid var(--runtime-border);
  border-radius: 2rem;
  background: rgba(17, 24, 42, 0.88);
  box-shadow: 0 34px 80px rgba(0, 0, 0, 0.28);
}

.runtime-demo-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--runtime-border);
  background: rgba(255, 255, 255, 0.025);
}

.runtime-demo-label {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: #cbd5e1;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.runtime-live-dot {
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 999px;
  background: var(--runtime-green);
  box-shadow: 0 0 0 5px rgba(74, 222, 128, 0.08);
}

.runtime-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  border: 1px solid var(--runtime-border);
  border-radius: 999px;
  background: #0e1527;
  padding: 0.38rem 0.48rem 0.38rem 0.75rem;
  color: #cbd5e1;
  font: inherit;
  cursor: pointer;
}

.runtime-switch-copy {
  display: grid;
  gap: 0.02rem;
  text-align: left;
}

.runtime-switch-copy strong {
  color: #f8fafc;
  font-size: 0.8rem;
}

.runtime-switch-copy small {
  color: var(--runtime-muted);
  font-size: 0.68rem;
}

.runtime-switch-track {
  position: relative;
  width: 3.15rem;
  height: 1.75rem;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #334155;
  transition: background 180ms ease;
}

.runtime-switch-thumb {
  position: absolute;
  top: 0.2rem;
  left: 0.22rem;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transition: transform 180ms ease;
}

.runtime-switch[aria-pressed="true"] .runtime-switch-track {
  background: #5d56c8;
}

.runtime-switch[aria-pressed="true"] .runtime-switch-thumb {
  transform: translateX(1.35rem);
}

.runtime-scenarios {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding: 1rem 1.15rem 0;
}

.runtime-scenario {
  border: 1px solid var(--runtime-border);
  border-radius: 999px;
  background: transparent;
  padding: 0.58rem 0.8rem;
  color: #cbd5e1;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.runtime-scenario:hover,
.runtime-scenario:focus-visible {
  border-color: rgba(165, 180, 252, 0.5);
  color: #ffffff;
}

.runtime-scenario.is-active {
  border-color: rgba(165, 180, 252, 0.45);
  background: var(--runtime-violet-soft);
  color: #ffffff;
}

.runtime-comparison {
  display: grid;
  gap: 1px;
  margin-top: 1rem;
  background: var(--runtime-border);
}

.runtime-column {
  min-width: 0;
  background: var(--runtime-panel);
  padding: clamp(1.15rem, 2.5vw, 2rem);
}

.runtime-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.35rem;
}

.runtime-column-header span {
  color: var(--runtime-muted);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.runtime-column-header strong {
  font-size: 0.92rem;
}

.runtime-mode-pill {
  border-radius: 999px;
  padding: 0.35rem 0.6rem;
  background: rgba(148, 163, 184, 0.08);
  color: #cbd5e1;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.66rem;
  font-weight: 600;
}

.runtime-column-governed .runtime-mode-pill {
  background: var(--runtime-violet-soft);
  color: #c4b5fd;
}

.runtime-flow {
  display: grid;
  gap: 0.65rem;
}

.runtime-flow-row {
  display: grid;
  grid-template-columns: 2.3rem minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: center;
  min-height: 4rem;
  border: 1px solid var(--runtime-border);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.025);
  padding: 0.75rem 0.85rem;
}

.runtime-flow-icon {
  display: grid;
  place-items: center;
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 0.75rem;
  background: rgba(148, 163, 184, 0.08);
  color: #cbd5e1;
}

.runtime-flow-row strong {
  display: block;
  font-size: 0.86rem;
}

.runtime-flow-row small {
  display: block;
  margin-top: 0.12rem;
  color: var(--runtime-muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.runtime-flow-status {
  white-space: nowrap;
  color: #cbd5e1;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.66rem;
  font-weight: 600;
}

.runtime-flow-arrow {
  position: relative;
  width: 2px;
  height: 1.15rem;
  margin: -0.2rem 0 -0.2rem 1.12rem;
  background: rgba(148, 163, 184, 0.28);
}

.runtime-flow-arrow::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 50%;
  width: 0.4rem;
  height: 0.4rem;
  border-right: 1px solid rgba(148, 163, 184, 0.55);
  border-bottom: 1px solid rgba(148, 163, 184, 0.55);
  transform: translateX(-50%) rotate(45deg);
}

.runtime-policy-card {
  border-color: rgba(165, 180, 252, 0.28);
  background: rgba(93, 86, 200, 0.08);
}

.runtime-policy-card .runtime-flow-icon {
  background: rgba(139, 130, 246, 0.14);
  color: #c4b5fd;
}

.runtime-decision-allow {
  border-color: rgba(74, 222, 128, 0.24);
  background: var(--runtime-green-soft);
}

.runtime-decision-allow .runtime-flow-icon,
.runtime-decision-allow .runtime-flow-status {
  color: var(--runtime-green);
}

.runtime-decision-review {
  border-color: rgba(251, 191, 36, 0.26);
  background: var(--runtime-amber-soft);
}

.runtime-decision-review .runtime-flow-icon,
.runtime-decision-review .runtime-flow-status {
  color: var(--runtime-amber);
}

.runtime-decision-block {
  border-color: rgba(251, 113, 133, 0.28);
  background: var(--runtime-red-soft);
}

.runtime-decision-block .runtime-flow-icon,
.runtime-decision-block .runtime-flow-status {
  color: var(--runtime-red);
}

.runtime-human-card {
  display: none;
  margin-top: 0.65rem;
  border: 1px solid rgba(251, 191, 36, 0.26);
  border-radius: 1rem;
  background: rgba(251, 191, 36, 0.07);
  padding: 0.9rem;
}

.runtime-human-card.is-visible {
  display: block;
}

.runtime-human-card strong {
  display: block;
  font-size: 0.84rem;
}

.runtime-human-card p {
  margin: 0.35rem 0 0.75rem;
  color: #cbd5e1;
  font-size: 0.76rem;
}

.runtime-human-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.runtime-human-actions button {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0.7rem;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.48rem 0.68rem;
  color: #ffffff;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}

.runtime-human-actions button:first-child {
  border-color: rgba(74, 222, 128, 0.28);
  background: rgba(74, 222, 128, 0.1);
  color: #bbf7d0;
}

.runtime-summary {
  display: grid;
  gap: 0.45rem;
  margin-top: 1rem;
  border-top: 1px solid var(--runtime-border);
  padding-top: 1rem;
}

.runtime-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--runtime-muted);
  font-size: 0.74rem;
}

.runtime-summary-row strong {
  color: #f8fafc;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.68rem;
}

.runtime-insight {
  display: grid;
  gap: 0.55rem;
  padding: 1rem 1.15rem 1.15rem;
  border-top: 1px solid var(--runtime-border);
  background: rgba(255, 255, 255, 0.02);
}

.runtime-insight strong {
  font-size: 0.84rem;
}

.runtime-insight p {
  margin: 0;
  color: var(--runtime-muted);
  font-size: 0.8rem;
  line-height: 1.55;
}

.policy-compiler-stage {
  padding: clamp(5.5rem, 9vw, 9rem) 0;
  background: #ffffff;
}

.policy-compiler-layout {
  display: grid;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}

.policy-compiler-copy h2 {
  max-width: 12ch;
  margin: 0.75rem 0 1.15rem;
  font-size: clamp(2.7rem, 5vw, 5rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.policy-compiler-copy > p {
  max-width: 35rem;
  margin: 0;
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.policy-compiler-card {
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 1.7rem;
  background: #f8fafc;
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.08);
}

.policy-compiler-source,
.policy-compiler-output {
  padding: 1.3rem;
}

.policy-compiler-source {
  border-bottom: 1px solid rgba(15, 23, 42, 0.1);
  background: #f2f1ff;
}

.policy-compiler-kicker {
  display: block;
  margin-bottom: 0.65rem;
  color: #5d56c8;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.policy-compiler-source p {
  margin: 0;
  color: #334155;
  font-size: 0.9rem;
  line-height: 1.6;
}

.policy-compiler-output {
  display: grid;
  gap: 0.65rem;
}

.compiled-rule {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 0.9rem;
  background: #ffffff;
  padding: 0.8rem;
}

.compiled-rule-icon {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.65rem;
  background: rgba(93, 86, 200, 0.08);
  color: #5d56c8;
}

.compiled-rule strong {
  display: block;
  color: #0f172a;
  font-size: 0.8rem;
}

.compiled-rule small {
  display: block;
  margin-top: 0.12rem;
  color: #64748b;
  font-size: 0.7rem;
}

.compiled-rule-result {
  border-radius: 999px;
  padding: 0.32rem 0.55rem;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.64rem;
  font-weight: 600;
}

.compiled-rule-result.allow { background: rgba(22, 163, 74, 0.09); color: #15803d; }
.compiled-rule-result.review { background: rgba(217, 119, 6, 0.1); color: #b45309; }
.compiled-rule-result.block { background: rgba(225, 29, 72, 0.08); color: #be123c; }

.policy-compiler-note {
  margin-top: 1rem;
  color: #64748b;
  font-size: 0.76rem;
}

@media (min-width: 850px) {
  .runtime-demo-heading {
    grid-template-columns: minmax(0, 0.95fr) minmax(22rem, 0.75fr);
    align-items: end;
  }

  .runtime-comparison {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .policy-compiler-layout {
    grid-template-columns: minmax(0, 0.85fr) minmax(27rem, 1.15fr);
  }
}

@media (max-width: 620px) {
  .runtime-demo-shell,
  .policy-compiler-card {
    border-radius: 1.35rem;
  }

  .runtime-demo-toolbar {
    align-items: stretch;
  }

  .runtime-switch {
    width: 100%;
    justify-content: space-between;
  }

  .runtime-flow-row,
  .compiled-rule {
    grid-template-columns: 2rem minmax(0, 1fr);
  }

  .runtime-flow-icon,
  .compiled-rule-icon {
    width: 2rem;
    height: 2rem;
  }

  .runtime-flow-status,
  .compiled-rule-result {
    grid-column: 2;
    justify-self: start;
  }
}

:root[data-theme="dark"] .policy-compiler-stage {
  background: #080d19;
}

:root[data-theme="dark"] .policy-compiler-card {
  border-color: var(--border);
  background: #111827;
  box-shadow: none;
}

:root[data-theme="dark"] .policy-compiler-source {
  border-color: var(--border);
  background: #17152a;
}

:root[data-theme="dark"] .policy-compiler-source p,
:root[data-theme="dark"] .compiled-rule strong {
  color: var(--text-dark);
}

:root[data-theme="dark"] .compiled-rule {
  border-color: var(--border);
  background: #0f172a;
}

:root[data-theme="dark"] .compiled-rule small,
:root[data-theme="dark"] .policy-compiler-note {
  color: var(--text-muted);
}
