:root {
  --bg: #f2f7f6;
  --bg-deep: #dbe9e6;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-strong: rgba(255, 255, 255, 0.94);
  --line: rgba(50, 82, 88, 0.14);
  --text: #163338;
  --muted: #587177;
  --teal: #1cba96;
  --teal-deep: #0c9076;
  --blue: #3b9cf3;
  --amber: #f0b24d;
  --green: #2aaf72;
  --red: #d5674d;
  --slate: #7d8b92;
  --ink-soft: #1f4850;
  --shadow: 0 24px 54px rgba(42, 67, 75, 0.14);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --font-body: "Aptos", "Segoe UI", "Trebuchet MS", sans-serif;
  --font-display: "Bahnschrift SemiBold", "Aptos Display", "Segoe UI", sans-serif;
  --stage-height: 500px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(1100px 520px at 10% 0%, rgba(28, 186, 150, 0.14), transparent 62%),
    radial-gradient(920px 520px at 100% 8%, rgba(240, 178, 77, 0.15), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
}

html.embed-mode,
body.embed-mode {
  width: 100%;
  height: auto;
  min-height: 0;
  background: transparent;
  overflow: hidden;
}

.shell {
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: 16px;
}

.widget {
  display: grid;
  gap: 14px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, var(--panel-strong), rgba(248, 252, 251, 0.88)),
    radial-gradient(420px 220px at 100% 0%, rgba(59, 156, 243, 0.08), transparent 66%);
  box-shadow: var(--shadow);
}

.hero {
  padding: 24px 26px 22px;
  overflow: hidden;
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.hero-copy-block {
  min-width: 0;
}

.eyebrow,
.section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 12px;
  border-radius: 999px;
  color: #0f5d61;
  background: rgba(28, 186, 150, 0.12);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow::before,
.section-kicker::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--amber), var(--teal));
  box-shadow: 0 0 0 6px rgba(28, 186, 150, 0.12);
}

h1,
h2 {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: -0.03em;
}

h1 {
  margin-top: 14px;
  font-size: clamp(2rem, 1.4rem + 2.3vw, 3.55rem);
  line-height: 0.96;
}

h2 {
  font-size: clamp(1.28rem, 1.06rem + 0.9vw, 1.92rem);
  line-height: 1.04;
}

.hero-copy,
.section-copy,
#summaryText,
.footnote-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.hero-copy {
  max-width: 860px;
  margin-top: 14px;
  font-size: 15px;
}

.hero-side {
  width: min(260px, 100%);
  display: grid;
  gap: 10px;
}

.hero-control-button,
.hero-speed-select {
  appearance: none;
  border: 0;
  border-radius: 16px;
  padding: 11px 16px;
  color: #f8fffe;
  font-family: var(--font-display);
  font-size: 0.94rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  box-shadow: 0 12px 24px rgba(16, 95, 103, 0.18);
  background-image:
    radial-gradient(160px 110px at 0% 0%, rgba(255, 255, 255, 0.18), transparent 72%),
    linear-gradient(135deg, var(--teal), var(--blue));
  background-repeat: no-repeat, no-repeat;
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.hero-control-button {
  cursor: pointer;
}

.hero-control-button:hover,
.hero-speed-select:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(16, 95, 103, 0.22);
  filter: saturate(1.04);
}

.runtime-chip,
.status-chip,
.footnote-card {
  border: 1px solid rgba(54, 89, 97, 0.12);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 250, 248, 0.92)),
    radial-gradient(180px 120px at 100% 0%, rgba(59, 156, 243, 0.1), transparent 80%);
}

.runtime-chip {
  position: relative;
  overflow: hidden;
  padding: 12px 16px;
  display: grid;
  gap: 4px;
  justify-items: center;
  text-align: center;
  border-color: rgba(54, 89, 97, 0.14);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(241, 247, 245, 0.94)),
    radial-gradient(180px 100px at 0% 0%, rgba(59, 156, 243, 0.08), transparent 74%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.runtime-chip::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--teal);
  box-shadow: 0 0 0 5px rgba(28, 186, 150, 0.12);
}

.runtime-chip span,
.status-chip span,
.footnote-card span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.runtime-chip strong,
.status-chip strong,
.footnote-card strong {
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-size: 1.18rem;
  line-height: 1.05;
}

.runtime-chip small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.runtime-chip span {
  color: var(--ink-soft);
  font-size: 11px;
  letter-spacing: 0.16em;
}

.hero-speed-control {
  position: relative;
  display: block;
}

.hero-speed-control::after {
  content: "\25BE";
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.18);
  color: rgba(247, 255, 254, 0.96);
  font-size: 10px;
  font-weight: 900;
  pointer-events: none;
}

.hero-speed-select {
  width: 100%;
  border: 0;
  padding: 11px 42px 11px 14px;
  line-height: 1.1;
  text-align: center;
  text-align-last: center;
  cursor: pointer;
}

.hero-speed-select option {
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-size: 0.94rem;
  font-weight: 800;
}

:focus-visible {
  outline: 3px solid rgba(59, 156, 243, 0.36);
  outline-offset: 2px;
}

.hero-progress {
  margin-top: 18px;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(89, 117, 122, 0.14);
}

.hero-progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--blue), var(--amber));
}

.main-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

.comparison-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}

.stage-panel,
.metrics-panel,
.footer-panel {
  padding: 18px;
}

.metrics-panel,
.footer-panel {
  height: 100%;
}

.stage-panel {
  min-width: 0;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}

.panel-copy-stack {
  display: grid;
  gap: 12px;
}

.panel-copy-stack .section-kicker {
  justify-self: start;
  width: fit-content;
}

.section-copy {
  margin-top: 10px;
  max-width: 720px;
  font-size: 14px;
}

.panel-copy-stack .section-copy {
  margin-top: 0;
}

#outcomeText {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stage-status {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 10px;
  min-width: min(320px, 100%);
}

.status-chip {
  padding: 14px 15px;
  display: grid;
  gap: 5px;
}

.status-chip strong {
  font-size: 1.04rem;
}

.canvas-frame {
  position: relative;
  width: 100%;
  min-width: 0;
  margin-top: 18px;
  min-height: var(--stage-height);
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(45, 73, 79, 0.14);
  background:
    linear-gradient(180deg, rgba(245, 250, 248, 0.98), rgba(224, 235, 232, 0.95)),
    radial-gradient(540px 260px at 14% 0%, rgba(240, 178, 77, 0.12), transparent 62%),
    radial-gradient(540px 260px at 86% 0%, rgba(28, 186, 150, 0.11), transparent 64%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 18px 42px rgba(18, 38, 42, 0.12);
}

#simCanvas {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 100%;
}

.summary-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 12px;
  background: rgba(10, 20, 22, 0.56);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.summary-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.summary-card {
  position: relative;
  width: min(900px, 100%);
  max-height: calc(100% - 6px);
  overflow: auto;
  padding: 20px 20px 18px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(240, 247, 245, 0.96)),
    radial-gradient(340px 180px at 100% 0%, rgba(59, 156, 243, 0.1), transparent 72%);
  box-shadow: 0 26px 50px rgba(11, 33, 37, 0.28);
}

.summary-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  background: rgba(22, 51, 56, 0.08);
  color: var(--ink-soft);
  font: 800 14px/1 var(--font-body);
  cursor: pointer;
}

.summary-close:hover {
  background: rgba(22, 51, 56, 0.14);
}

.summary-head {
  display: grid;
  gap: 6px;
  max-width: 620px;
}

.summary-kicker {
  margin: 0;
  color: #0d5960;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.summary-card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 1.2rem + 1vw, 2.2rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
}

.summary-lead,
.summary-foot {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.summary-compare {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(156px, 0.48fr) minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}

.summary-side-card {
  padding: 14px;
  border-radius: 22px;
  border: 1px solid rgba(50, 82, 88, 0.12);
  background: rgba(255, 255, 255, 0.86);
  display: grid;
  gap: 10px;
}

.summary-side-b {
  background:
    linear-gradient(180deg, rgba(234, 249, 244, 0.98), rgba(245, 252, 249, 0.95)),
    rgba(255, 255, 255, 0.9);
  border-color: rgba(28, 186, 150, 0.18);
}

.summary-side-tag {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.summary-side-title {
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-size: 0.98rem;
  line-height: 1.08;
}

.summary-side-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.summary-stat {
  padding: 10px;
  border-radius: 14px;
  background: rgba(237, 244, 242, 0.82);
  display: grid;
  gap: 5px;
}

.summary-stat span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.summary-stat strong {
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-size: 0.94rem;
}

.summary-delta-stack {
  display: grid;
  gap: 8px;
  align-content: center;
}

.summary-delta-pill {
  padding: 9px 11px;
  border-radius: 16px;
  background: rgba(237, 244, 242, 0.92);
  border: 1px solid rgba(50, 82, 88, 0.1);
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.24;
  text-align: center;
}

.summary-delta-pill.metric-good {
  background: rgba(42, 175, 114, 0.12);
  border-color: rgba(42, 175, 114, 0.18);
}

.summary-delta-pill.metric-bad {
  background: rgba(213, 103, 77, 0.12);
  border-color: rgba(213, 103, 77, 0.18);
}

.summary-delta-pill.metric-neutral {
  background: rgba(35, 76, 83, 0.08);
}

.summary-foot {
  margin-top: 12px;
}

.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.legend-icon {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
}

.legend-driver {
  width: 19px;
  height: 19px;
  border: 2.2px solid var(--slate);
  border-radius: 999px;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.16));
}

.legend-driver.idle {
  border-color: var(--slate);
}

.legend-driver.assigned {
  border-color: var(--amber);
}

.legend-driver.rebalancing {
  border-color: #95aab0;
}

.legend-driver.ontrip {
  border-color: var(--green);
}

.legend-driver-body {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-left: -3.5px;
  margin-top: -3.5px;
  border-radius: 999px;
  background: rgba(24, 51, 56, 0.72);
  border: 0;
}

.legend-driver-body::after {
  display: none;
}

.legend-driver-passenger {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 13px;
  height: 13px;
  border-radius: 999px;
  margin-left: -6.5px;
  margin-top: -6.5px;
  border: 1.2px solid rgba(255, 255, 255, 0.78);
  background: transparent;
  display: none;
}

.legend-driver.ontrip .legend-driver-passenger {
  display: block;
}

.legend-request {
  width: 11px;
  height: 11px;
  margin: 3px 4px 6px;
  border-radius: 4px;
  background: var(--blue);
  transform: rotate(45deg);
}

.legend-request::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 2.2px solid rgba(88, 183, 255, 0.24);
  transform: translate(-50%, -50%);
}

.legend-request::after {
  display: none;
}

.legend-match {
  width: 22px;
  height: 14px;
  filter: drop-shadow(0 0 5px rgba(31, 115, 218, 0.38));
}

.legend-match::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1px;
  width: 16px;
  height: 10px;
  border-top: 2.4px solid #1f73da;
  border-right: 2.4px solid #1f73da;
  border-top-right-radius: 12px;
  transform: skewX(-16deg);
}

.legend-match::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 1px;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: rgba(31, 115, 218, 0.98);
  box-shadow: 0 0 0 3px rgba(31, 115, 218, 0.2);
}

.legend-stand {
  width: 22px;
  height: 16px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(226, 237, 236, 0.86));
  border: 1.8px solid rgba(19, 63, 69, 0.34);
}

.legend-stand::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  top: 50%;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--amber), var(--blue));
  transform: translateY(-50%);
}

.metrics-table {
  margin-top: 16px;
  display: grid;
  gap: 8px;
}

.metric-group {
  margin-top: 8px;
  padding: 0 2px;
}

.metric-group span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(28, 186, 150, 0.1);
  color: #0f5d61;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.metric-group span::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--amber), var(--teal));
}

.metric-header,
.metric-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.55fr) repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: center;
  padding: 13px 14px;
  border-radius: 18px;
}

.metric-header {
  border: 1px solid rgba(54, 89, 97, 0.12);
  background: rgba(236, 244, 241, 0.82);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.scenario-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 12px;
}

.scenario-chip {
  padding: 14px 14px 12px;
  border-radius: 20px;
  border: 1px solid rgba(54, 89, 97, 0.12);
  background: rgba(255, 255, 255, 0.78);
  display: grid;
  gap: 6px;
}

.scenario-chip span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.scenario-chip strong {
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.05;
}

.scenario-chip p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.42;
}

.scenario-chip-a {
  background: linear-gradient(180deg, rgba(255, 249, 238, 0.98), rgba(255, 245, 231, 0.92));
  border-color: rgba(240, 178, 77, 0.18);
}

.scenario-chip-b {
  background: linear-gradient(180deg, rgba(237, 249, 244, 0.98), rgba(244, 252, 248, 0.94));
  border-color: rgba(28, 186, 150, 0.18);
}

.scenario-chip-metrics {
  background: linear-gradient(180deg, rgba(242, 247, 255, 0.98), rgba(248, 251, 255, 0.94));
  border-color: rgba(59, 156, 243, 0.18);
}

.metric-row {
  border: 1px solid rgba(54, 89, 97, 0.1);
  background: rgba(255, 255, 255, 0.76);
}

.metric-name {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink-soft);
}

.metric-row strong {
  font-family: var(--font-display);
  font-size: 1.02rem;
}

.metric-good {
  color: var(--green);
}

.metric-bad {
  color: var(--red);
}

.metric-neutral {
  color: var(--ink-soft);
}

.takeaway-stack,
.footer-panel {
  display: grid;
  gap: 14px;
  align-content: start;
}

.takeaway-stack {
  height: 100%;
}

.benefit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.benefit-card {
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(54, 89, 97, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 250, 248, 0.9)),
    radial-gradient(180px 110px at 100% 0%, rgba(59, 156, 243, 0.08), transparent 80%);
  display: grid;
  gap: 8px;
}

.benefit-card span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.benefit-card strong {
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-size: 1.02rem;
  line-height: 1.08;
}

.benefit-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.rider-benefit {
  border-color: rgba(59, 156, 243, 0.16);
  background:
    linear-gradient(180deg, rgba(248, 251, 255, 0.98), rgba(240, 247, 252, 0.92)),
    radial-gradient(220px 130px at 100% 0%, rgba(59, 156, 243, 0.1), transparent 78%);
}

.driver-benefit {
  border-color: rgba(28, 186, 150, 0.16);
  background:
    linear-gradient(180deg, rgba(240, 250, 246, 0.98), rgba(245, 252, 249, 0.92)),
    radial-gradient(220px 130px at 100% 0%, rgba(28, 186, 150, 0.1), transparent 78%);
}

.footnote-card {
  padding: 16px 18px;
  display: grid;
  gap: 8px;
}

.footnote-card strong {
  font-size: 1.04rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html.embed-mode .shell {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 12px;
}

html.embed-mode .widget {
  gap: 10px;
  background: transparent;
}

html.embed-mode .shell,
html.embed-mode .main-grid {
  background: transparent;
}

html.embed-mode .panel {
  border-radius: 20px;
}

html.embed-mode .stage-panel {
  padding: 14px;
}

html.embed-mode .main-grid {
  grid-template-columns: 1fr;
  gap: 10px;
}

html.embed-mode .stage-status {
  min-width: 0;
}

@media (max-width: 1080px) {
  .main-grid,
  .comparison-layout {
    grid-template-columns: 1fr;
  }

  .hero-top,
  .section-head {
    flex-direction: column;
  }

  .stage-status {
    width: 100%;
    min-width: 0;
  }

  .scenario-strip {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 760px) {
  :root {
    --stage-height: 380px;
  }

  .shell {
    padding: 10px;
  }

  .hero,
  .stage-panel,
  .metrics-panel,
  .footer-panel {
    padding: 14px;
  }

  .stage-status,
  .comparison-layout {
    grid-template-columns: 1fr;
  }

  .metric-header,
  .metric-row {
    grid-template-columns: 1.35fr repeat(3, minmax(0, 0.9fr));
    font-size: 12px;
  }

  .summary-overlay {
    padding: 12px;
  }

  .summary-card {
    max-height: calc(100% - 4px);
    padding: 16px;
  }

  .summary-compare {
    grid-template-columns: 1fr;
  }

  .summary-side-grid {
    grid-template-columns: 1fr 1fr;
  }

  .benefit-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  :root {
    --stage-height: 520px;
  }

  #outcomeText {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }

  .canvas-frame {
    margin-top: 14px;
    min-height: var(--stage-height);
    border-radius: 18px;
  }

  .summary-side-grid {
    grid-template-columns: 1fr;
  }

  .metric-header,
  .metric-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    font-size: 11px;
  }

  .metric-name {
    grid-column: 1 / -1;
  }

  .scenario-chip {
    padding: 12px 12px 11px;
  }

  .legend-row {
    gap: 8px 12px;
    font-size: 11px;
  }
}

@media (max-width: 768px) {
  .shell {
    padding: 10px;
  }

  .panel {
    border-radius: 22px;
  }

  .hero,
  .stage-panel,
  .metrics-panel,
  .footer-panel {
    padding: 16px 14px;
  }

  .hero-top,
  .section-head {
    gap: 14px;
  }

  h1 {
    font-size: clamp(2rem, 1.55rem + 4.2vw, 2.8rem);
    line-height: 0.98;
  }

  .hero-copy {
    font-size: 14px;
    line-height: 1.5;
  }

  .hero-side {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .runtime-chip {
    grid-column: 1 / -1;
  }

  .hero-control-button,
  .hero-speed-select {
    min-height: 46px;
    padding: 12px 16px;
    font-size: 0.92rem;
  }

  .hero-progress {
    margin-top: 14px;
    height: 10px;
  }

  .stage-status {
    width: 100%;
    min-width: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .status-chip {
    padding: 12px;
  }

  .section-copy {
    max-width: none;
    font-size: 13px;
    line-height: 1.5;
  }

  .canvas-frame {
    margin-top: 14px;
    border-radius: 18px;
    min-height: auto;
  }

  .legend-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 12px;
    margin-top: 12px;
    font-size: 11px;
  }

  .legend-item {
    align-items: flex-start;
  }

  .scenario-strip {
    gap: 8px;
    margin: 12px 0 10px;
  }

  .scenario-chip {
    padding: 12px;
    border-radius: 16px;
  }

  .metrics-table {
    margin-top: 12px;
    gap: 6px;
  }

  .metric-header,
  .metric-row {
    padding: 12px 10px;
    border-radius: 16px;
  }

  .metric-name {
    font-size: 13px;
  }

  .metric-row strong {
    font-size: 0.96rem;
  }

  .benefit-grid {
    gap: 10px;
  }

  .benefit-card,
  .footnote-card {
    padding: 14px;
    border-radius: 16px;
  }

  .benefit-card p,
  .footnote-card p,
  #summaryText {
    font-size: 12.5px;
    line-height: 1.5;
  }

  .summary-overlay {
    padding: 8px;
  }

  .summary-card {
    width: 100%;
    max-height: calc(100% - 2px);
    padding: 14px 14px 12px;
    border-radius: 22px;
  }

  .summary-close {
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
  }

  .summary-head {
    gap: 8px;
    max-width: none;
  }

  .summary-compare {
    gap: 10px;
  }

  .summary-side-card {
    padding: 12px;
    border-radius: 18px;
  }

  .summary-delta-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-delta-pill {
    min-height: 44px;
    display: grid;
    place-items: center;
    padding: 8px 10px;
  }
}

@media (max-width: 560px) {
  :root {
    --stage-height: 460px;
  }

  .hero-side,
  .stage-status,
  .summary-delta-stack,
  .legend-row {
    grid-template-columns: 1fr;
  }

  .summary-card h3 {
    padding-right: 36px;
  }

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

  .metric-header,
  .metric-row {
    padding: 10px;
  }
}

@media (max-width: 420px) {
  .summary-side-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
