:root {
  color-scheme: dark;
  --ink: #f5f1e7;
  --muted: #a8b2bb;
  --dim: #71808d;
  --night: #071018;
  --panel: rgba(10, 20, 29, 0.92);
  --line: rgba(229, 222, 202, 0.16);
  --gold: #d4b46f;
  --gold-bright: #f2d894;
  --cyan: #6fc8cf;
  --red: #ed765f;
  --safe: #70c49a;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.48);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--night);
  color: var(--ink);
}
body {
  min-width: 320px;
}
button,
input,
textarea,
select {
  font: inherit;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  color: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 12px 16px;
  min-height: 44px;
  border-radius: 8px;
  background: #fff;
  color: #071018;
  transform: translateY(-150%);
}
.skip-link:focus {
  transform: none;
}

.sim-app {
  width: 100%;
  height: 100%;
  min-width: 0;
  display: grid;
  grid-template-rows: 64px 1fr;
  background: radial-gradient(circle at 50% 28%, #132b3a 0, #071018 58%);
}
.topbar {
  position: relative;
  z-index: 20;
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  height: 64px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 13, 20, 0.86);
  backdrop-filter: blur(18px);
}
.brand {
  justify-self: start;
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  text-decoration: none;
  letter-spacing: 0.02em;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(242, 216, 148, 0.55);
  border-radius: 50%;
  color: var(--gold-bright);
  font-size: 17px;
}
.scope-switch {
  display: flex;
  align-items: center;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
}
.scope-switch a {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.scope-switch a.active {
  background: rgba(212, 180, 111, 0.16);
  color: var(--gold-bright);
  box-shadow: inset 0 0 0 1px rgba(212, 180, 111, 0.18);
}
.top-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
}
.site-menu {
  position: relative;
}
.site-menu summary {
  min-width: 44px;
  min-height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
}
.site-menu summary::-webkit-details-marker {
  display: none;
}
.site-menu nav {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  width: 210px;
  display: grid;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(7, 16, 24, 0.98);
  box-shadow: var(--shadow);
}
.site-menu nav a {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.site-menu nav a:hover,
.site-menu nav a[aria-current="page"] {
  background: rgba(212, 180, 111, 0.1);
  color: var(--gold-bright);
}
.icon-button,
.primary,
.secondary,
.dialog-close,
.panel-close,
.transport-button,
.map-inspector {
  min-height: 44px;
  border-radius: 10px;
  cursor: pointer;
}
.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
}
.primary {
  padding: 0 18px;
  border: 1px solid #e3c77f;
  background: linear-gradient(180deg, #e2c477, #b9954e);
  color: #12120f;
  font-weight: 800;
  box-shadow: 0 8px 30px rgba(198, 159, 78, 0.18);
}
.primary:hover {
  filter: brightness(1.08);
}
.primary.compact {
  min-height: 44px;
}
.secondary {
  padding: 0 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.055);
  color: var(--ink);
  font-weight: 700;
}
a.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
}

.stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
}
.renderer {
  position: absolute;
  inset: 0;
}
.renderer canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
.stage-vignette {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    radial-gradient(
      ellipse at 50% 46%,
      transparent 30%,
      rgba(2, 7, 11, 0.1) 57%,
      rgba(2, 7, 11, 0.78) 112%
    ),
    linear-gradient(
      180deg,
      rgba(1, 6, 9, 0.34),
      transparent 24%,
      transparent 72%,
      rgba(1, 6, 9, 0.66)
    );
}
.film-grain {
  pointer-events: none;
  position: absolute;
  inset: -40%;
  z-index: 3;
  opacity: 0.032;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.92' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  animation: grain 0.22s steps(2) infinite;
}
@keyframes grain {
  0% {
    transform: translate(0, 0);
  }
  25% {
    transform: translate(3%, -2%);
  }
  50% {
    transform: translate(-2%, 3%);
  }
  75% {
    transform: translate(2%, 2%);
  }
}

.loading {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 9px;
  background: #071018;
  color: var(--muted);
  text-align: center;
  transition: opacity 0.35s ease;
}
.loading strong {
  color: var(--ink);
  font-family: Georgia, serif;
  font-size: 22px;
  font-weight: 500;
}
.loading-orbit {
  width: 52px;
  height: 52px;
  margin-bottom: 10px;
  border: 1px solid rgba(212, 180, 111, 0.2);
  border-top-color: var(--gold-bright);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.story-head {
  position: absolute;
  z-index: 5;
  top: 6.5%;
  left: clamp(22px, 4.5vw, 74px);
  max-width: min(690px, 57vw);
  pointer-events: none;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.75);
}
.eyebrow {
  color: var(--gold-bright);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.19em;
  text-transform: uppercase;
}
.story-head h1 {
  margin: 10px 0 8px;
  max-width: 19ch;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(30px, 4vw, 62px);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.story-head p {
  margin: 0;
  color: var(--muted);
  font-size: clamp(13px, 1.2vw, 16px);
}
.phase-card {
  position: absolute;
  z-index: 5;
  left: clamp(22px, 4.5vw, 74px);
  bottom: 94px;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 360px;
  padding: 11px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(6, 14, 21, 0.7);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(12px);
}
.phase-pip {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gold-bright);
  box-shadow: 0 0 18px var(--gold-bright);
}
.phase-card div {
  display: grid;
  gap: 2px;
}
.phase-card span {
  color: var(--gold-bright);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.phase-card strong {
  font-size: 13px;
  font-weight: 650;
}
.origin-label {
  position: absolute;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  border: 1px solid rgba(242, 216, 148, 0.25);
  border-radius: 9px;
  background: rgba(5, 12, 18, 0.78);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  pointer-events: none;
  transform: translate(-50%, -158%);
}
.origin-label span:last-child {
  display: flex;
  flex-direction: column;
}
.origin-label small {
  color: var(--gold-bright);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.origin-label strong {
  max-width: 140px;
  overflow: hidden;
  font-size: 12px;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.origin-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffbc73;
  box-shadow:
    0 0 0 5px rgba(255, 188, 115, 0.12),
    0 0 18px #ff9c5c;
}
.map-inspector {
  position: absolute;
  z-index: 8;
  display: grid;
  gap: 2px;
  min-width: 150px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  background: rgba(6, 14, 21, 0.92);
  box-shadow: var(--shadow);
  text-align: left;
  pointer-events: none;
  transform: translate(14px, 14px);
}
.map-inspector strong {
  font-size: 13px;
}
.map-inspector span {
  color: var(--muted);
  font-size: 11px;
}

.transport {
  position: absolute;
  z-index: 8;
  right: clamp(18px, 3vw, 45px);
  bottom: 23px;
  left: clamp(18px, 3vw, 45px);
  display: grid;
  grid-template-columns: 44px 1fr auto 44px;
  align-items: center;
  gap: 12px;
  max-width: 920px;
  margin: auto;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(5, 13, 20, 0.76);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.25);
}
.transport-button {
  width: 44px;
  padding: 0;
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  font-size: 17px;
}
.timeline-label {
  display: flex;
  min-width: 0;
  min-height: 44px;
  align-items: center;
}
.timeline-label input {
  width: 100%;
  min-height: 44px;
  accent-color: var(--gold-bright);
  cursor: pointer;
}
.timecode {
  min-width: 82px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  text-align: center;
}
.quality-badge {
  position: absolute;
  z-index: 5;
  top: 16px;
  right: 18px;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(6, 14, 21, 0.62);
  color: var(--dim);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result-panel {
  position: absolute;
  z-index: 15;
  top: 20px;
  right: 20px;
  bottom: 20px;
  width: min(440px, calc(100vw - 40px));
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: panel-in 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.result-panel:not([hidden]) ~ .transport {
  visibility: hidden;
}
@keyframes panel-in {
  from {
    transform: translateX(28px);
  }
}
.panel-close {
  position: absolute;
  z-index: 2;
  top: 12px;
  right: 12px;
  width: 44px;
  padding: 0;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  font-size: 23px;
}
.result-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 30px 27px;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}
.result-scroll h2 {
  margin: 8px 48px 7px 0;
  font-family: Georgia, serif;
  font-size: 34px;
  font-weight: 500;
  letter-spacing: -0.025em;
}
.result-lead {
  margin: 0 0 20px;
  color: var(--muted);
  line-height: 1.5;
}
.reaction-bars {
  display: grid;
  gap: 10px;
}
.reaction-row {
  display: grid;
  grid-template-columns: 92px 1fr 36px;
  align-items: center;
  gap: 9px;
  font-size: 12px;
}
.reaction-row > span:first-child {
  color: #dfe5e8;
}
.bar-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}
.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--bar, var(--cyan));
  transform-origin: left;
  animation: bar-in 0.65s ease both;
}
@keyframes bar-in {
  from {
    transform: scaleX(0);
  }
}
.reaction-row b {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}
.result-callouts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin: 21px 0;
}
.callout {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}
.callout--focus {
  grid-column: 1 / -1;
}
.callout small {
  display: block;
  margin-bottom: 5px;
  color: var(--dim);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.callout strong {
  display: block;
  font-size: 13px;
  line-height: 1.3;
}
.fallback-result {
  margin: 20px 0;
  padding: 15px;
  border: 1px solid rgba(104, 169, 176, 0.34);
  border-radius: 13px;
  background: rgba(104, 169, 176, 0.07);
}
.fallback-note h3 {
  margin: 6px 0;
  font-family: Georgia, serif;
  font-size: 21px;
  font-weight: 500;
}
.fallback-note p {
  margin: 0 0 13px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}
.modeled-data-details > summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
}
.modeled-data-details > p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
.fallback-table-scroll {
  max-height: 290px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(4, 11, 17, 0.48);
}
.fallback-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.4;
}
.fallback-table caption {
  padding: 10px;
  color: var(--muted);
  text-align: left;
}
.fallback-table th,
.fallback-table td {
  padding: 9px 10px;
  border-top: 1px solid rgba(178, 207, 211, 0.12);
  text-align: left;
}
.fallback-table thead th {
  position: sticky;
  z-index: 1;
  top: 0;
  background: #0a1821;
  color: var(--muted);
  font: 800 10px/1.4 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.fallback-table tbody th {
  color: var(--ink);
  font-weight: 650;
}
.fallback-table td:last-child {
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.fallback-explore {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  margin-top: 12px;
  text-decoration: none;
}
.why-details {
  margin: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.why-details summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
}
.why-details > div,
.why-details > dl {
  padding: 0 0 16px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}
.provenance-grid {
  margin: 0;
}
.provenance-grid > div {
  display: grid;
  grid-template-columns: minmax(92px, 0.38fr) 1fr;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid rgba(178, 207, 211, 0.12);
}
.provenance-grid dt {
  color: var(--muted);
  font: 800 9px/1.4 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.provenance-grid dd {
  margin: 0;
  color: var(--text);
  overflow-wrap: anywhere;
}
.maat-card {
  display: grid;
  gap: 12px;
  margin: 18px 0;
  padding: 15px;
  border: 1px solid rgba(212, 180, 111, 0.28);
  border-radius: 13px;
  background: rgba(212, 180, 111, 0.055);
}
.maat-card strong {
  display: block;
  margin-top: 5px;
  font-family: Georgia, serif;
  font-size: 19px;
}
.maat-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}
.maat-output {
  font-size: 12px;
  line-height: 1.45;
}
.maat-claim {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.maat-status {
  display: inline-block;
  margin-bottom: 5px;
  color: var(--gold-bright);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}
.maat-explain {
  color: var(--muted);
}
.maat-sources a {
  color: var(--cyan);
}
.comparison {
  margin: 16px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.comparison h3 {
  margin: 0 0 10px;
  font-family: Georgia, serif;
  font-weight: 500;
}
.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.compare-grid div {
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}
.compare-grid small {
  display: block;
  color: var(--dim);
}
.compare-grid strong {
  display: block;
  margin-top: 3px;
  font-size: 12px;
}
.disclosure {
  margin: 18px 0;
  color: var(--dim);
  font-size: 10px;
  line-height: 1.5;
}
.disclosure strong {
  color: var(--muted);
}
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.scenario-dialog {
  width: min(920px, calc(100vw - 28px));
  max-height: min(850px, calc(100dvh - 28px));
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(230, 218, 190, 0.2);
  border-radius: 20px;
  background: #0b1720;
  color: var(--ink);
  box-shadow: 0 34px 120px rgba(0, 0, 0, 0.72);
}
.scenario-dialog::backdrop {
  background: rgba(1, 6, 10, 0.72);
  backdrop-filter: blur(10px);
}
.dialog-shell {
  display: grid;
  max-height: inherit;
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 25px 27px 18px;
  border-bottom: 1px solid var(--line);
}
.dialog-head h2 {
  margin: 7px 0 4px;
  font-family: Georgia, serif;
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 500;
  letter-spacing: -0.035em;
}
.dialog-head p {
  max-width: 650px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}
.dialog-close {
  flex: 0 0 44px;
  width: 44px;
  padding: 0;
  border: 1px solid var(--line);
  background: transparent;
  font-size: 24px;
}
.mode-tabs {
  display: flex;
  gap: 6px;
  padding: 14px 27px 0;
}
.mode-tabs button {
  min-height: 44px;
  padding: 0 17px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
  cursor: pointer;
}
.mode-tabs button[aria-selected="true"] {
  border-color: var(--gold-bright);
  color: var(--gold-bright);
}
[role="tabpanel"] {
  min-height: 0;
  max-height: 295px;
  overflow: auto;
  padding: 14px 27px;
}
.preset-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}
.preset-card {
  min-height: 92px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-content: start;
  gap: 9px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.preset-card:hover,
.preset-card.selected {
  border-color: rgba(242, 216, 148, 0.62);
  background: rgba(212, 180, 111, 0.095);
}
.preset-card .preset-icon {
  font-size: 20px;
}
.preset-card strong {
  font-size: 15px;
  line-height: 1.42;
}
.preset-card small {
  grid-column: 2;
  color: var(--dim);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.lab-note {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}
.category-label,
.custom-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}
#lab-category {
  min-height: 44px;
  margin: 6px 0 12px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #111f29;
  color: var(--ink);
}
.lab-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.custom-label {
  position: relative;
  z-index: 2;
  padding: 10px 27px 7px;
  border-top: 1px solid var(--line);
  background: #0b1720;
}
#scenario-input {
  width: calc(100% - 54px);
  min-height: 78px;
  margin: 0 27px;
  padding: 12px 14px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(2, 8, 12, 0.5);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}
#scenario-input::placeholder {
  color: #65727b;
}
.setup-origin {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 3px 10px;
  margin: 12px 27px 0;
  padding: 11px 13px;
  border: 1px solid rgba(104, 169, 176, 0.34);
  border-radius: 10px;
  background: rgba(104, 169, 176, 0.08);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}
.setup-origin[hidden] {
  display: none;
}
.setup-origin span {
  color: var(--dim);
}
.setup-origin strong {
  color: var(--ink);
}
.setup-origin small {
  grid-column: 1 / -1;
  color: var(--dim);
  font-size: 13px;
}
.dialog-foot {
  position: sticky;
  z-index: 4;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 17px;
  padding: 17px 27px 23px;
  border-top: 1px solid var(--line);
  background: #0b1720;
  box-shadow: 0 -14px 28px rgba(3, 10, 15, 0.34);
}
.dialog-foot p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.dialog-foot p strong {
  color: var(--muted);
}
.run-button {
  min-height: 50px;
}

@media (max-width: 760px) {
  .sim-app {
    grid-template-rows: 58px 1fr;
  }
  .topbar {
    height: 58px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: 0 10px;
    gap: 8px;
  }
  .brand span:last-child,
  .wide-label {
    display: none;
  }
  .scope-switch {
    justify-self: center;
  }
  .scope-switch a {
    min-height: 44px;
    padding: 0 11px;
    font-size: 11px;
  }
  .top-actions {
    gap: 5px;
  }
  .icon-button {
    width: 44px;
    justify-content: center;
    padding: 0;
  }
  .primary.compact {
    width: 44px;
    padding: 0;
    font-size: 0;
  }
  .primary.compact::before {
    content: "+";
    font-size: 23px;
  }
  .story-head {
    top: 4.5%;
    left: 17px;
    max-width: calc(100vw - 34px);
  }
  .story-head h1 {
    max-width: 15ch;
    margin-top: 7px;
    font-size: clamp(28px, 8.6vw, 42px);
    line-height: 1.01;
  }
  .story-head p {
    max-width: 290px;
    font-size: 12px;
  }
  .phase-card {
    left: 14px;
    bottom: 83px;
    max-width: calc(100vw - 28px);
  }
  .transport {
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 10px;
    grid-template-columns: 44px 1fr 44px;
    gap: 7px;
  }
  .timecode {
    display: none;
  }
  .result-panel {
    top: auto;
    right: 8px;
    bottom: 8px;
    left: 8px;
    width: auto;
    height: min(73dvh, 680px);
    max-height: min(73dvh, 680px);
    border-radius: 18px;
  }
  .fallback-mode .story-head {
    display: none;
  }
  .fallback-mode .result-panel {
    top: 8px;
    height: auto;
    max-height: none;
  }
  .result-scroll {
    padding: 25px 20px calc(22px + env(safe-area-inset-bottom));
  }
  .result-scroll h2 {
    font-size: 30px;
  }
  .result-actions > button,
  .result-actions > a {
    flex: 1 1 130px;
  }
  .quality-badge {
    display: none !important;
  }
  .scenario-dialog {
    width: calc(100vw - 12px);
    max-height: calc(100dvh - 12px);
    border-radius: 16px;
  }
  .dialog-head {
    padding: 18px 17px 14px;
  }
  .dialog-head h2 {
    font-size: 30px;
  }
  .dialog-head p {
    font-size: 15px;
  }
  .mode-tabs {
    padding: 8px 17px 0;
  }
  [role="tabpanel"] {
    max-height: 31dvh;
    padding: 10px 17px;
  }
  .preset-grid,
  .lab-grid {
    grid-template-columns: 1fr;
  }
  .preset-card {
    min-height: 76px;
  }
  .custom-label {
    padding: 10px 17px 7px;
  }
  #scenario-input {
    width: calc(100% - 34px);
    min-height: 76px;
    margin: 0 17px;
    font-size: 16px;
  }
  .setup-origin {
    margin: 10px 17px 0;
    font-size: 15px;
  }
  .setup-origin small {
    font-size: 14px;
  }
  .dialog-foot {
    margin-top: 12px;
    padding: 12px 17px calc(15px + env(safe-area-inset-bottom));
  }
  .dialog-foot p {
    display: none;
  }
  .run-button {
    width: 100%;
  }
}

@media (max-width: 360px) {
  #sound-toggle {
    display: none;
  }
}

@media (max-height: 670px) and (min-width: 761px) {
  .story-head {
    top: 4%;
  }
  .story-head h1 {
    font-size: 38px;
  }
  [role="tabpanel"] {
    max-height: 220px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .film-grain {
    display: none;
  }
}
