:root {
  color-scheme: light;
  --bg: #3a414f;
  --surface: #ffffff;
  --text: #132033;
  --muted: #617089;
  --border: #d9e2f0;
  --axis: #2e3f59;
  --poverty: #d14f45;
  --user: #3b82f6;
  --landmark: #7c3aed;
  --wealth: #0f9d58;
  --shadow: 0 14px 30px rgba(19, 32, 51, 0.08);
  --control-radius: 8px;
  --journey-control-height: 41px;
  --narrative-message-font-size: 1.5rem;
  --narrative-message-font-weight: 700;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

.app-header__row {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 16px 20px;
}

.app-header__wordmark {
  margin: 0;
  flex: 0 0 auto;
  font: inherit;
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: #d9e2f0;
  text-decoration: none;
}

.app-header__wordmark:hover,
.app-header__wordmark:focus-visible {
  color: #eef3fb;
}

.app-header__nav-link {
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.2;
  color: #d9e2f0;
  text-decoration: none;
}

.app-header__nav-link:hover,
.app-header__nav-link:focus-visible {
  color: #eef3fb;
}

.app-header__nav-link--current {
  color: #eef3fb;
  font-weight: 600;
}

.app-header__menu-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #d9e2f0;
  cursor: pointer;
}

.app-header__menu-button:hover,
.app-header__menu-button:active {
  color: #eef3fb;
}

.app-header__menu-button:focus-visible {
  color: #eef3fb;
  outline: 2px solid rgba(238, 243, 251, 0.9);
  outline-offset: -5px;
}

.app-header__menu-icon,
.app-header__menu-icon::before,
.app-header__menu-icon::after {
  display: block;
  width: 18px;
  height: 1.5px;
  background: currentColor;
}

.app-header__menu-icon {
  position: relative;
}

.app-header__menu-icon::before,
.app-header__menu-icon::after {
  position: absolute;
  left: 0;
  content: "";
}

.app-header__menu-icon::before { top: -6px; }
.app-header__menu-icon::after { top: 6px; }

body[data-supporting-page] .app-header {
  position: relative;
  z-index: 1;
  background: var(--bg);
}

body[data-supporting-page] .app-header__row {
  min-height: 76px;
}

body[data-supporting-page] .header__back {
  margin-left: auto;
}

body[data-supporting-page] .app-header__menu-button {
  margin-left: 0;
}

body[data-supporting-page] .static-page {
  padding-top: 0;
  background: #f6f7fb;
}

.static-page {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 72px 0 56px;
  background: linear-gradient(to bottom, var(--bg) 72px, #f6f7fb 72px);
}

.static-page__card {
  width: 100%;
  max-width: calc(42rem + 64px);
  margin: 0 auto;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 32px;
}

.static-page__title {
  margin: 0 0 20px;
  line-height: 1.1;
}

.static-page__body {
  max-width: 42rem;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
}

.static-page__body p {
  margin: 0 0 1.1em;
}

.static-page__body p:last-child {
  margin-bottom: 0;
}

.static-page__body h2 {
  margin: 2em 0 0.5em;
  font-size: 1.2rem;
  line-height: 1.3;
}

.static-page__body h2:first-child {
  margin-top: 0;
}

.static-page__body h3 {
  margin: 1.5em 0 0.5em;
  font-size: 1rem;
  line-height: 1.4;
}

.static-page__body ul {
  margin: 0 0 1.1em;
  padding-left: 1.4em;
}

.static-page__body li + li {
  margin-top: 0.35em;
}

.static-page__body a:not(.quick-option) {
  color: inherit;
  text-underline-offset: 0.16em;
}

.static-page__reference {
  padding: 1.1rem 0;
  border-top: 1px solid var(--border);
}

.static-page__reference h2 {
  margin-top: 0;
}

.static-page__reference p {
  margin-bottom: 0.55em;
}

.page-404 .static-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 0;
}

.page-404 .static-page__card {
  text-align: center;
}

.page-404 .static-page__title {
  color: #606b82;
  font-size: 108px;
  line-height: 1;
}

.page-404 .static-page__body {
  margin: 0 auto;
}

.page-404 .static-page__body > img {
  display: block;
  margin: 0 auto 1.1em;
  transform: rotate(-90deg);
}

.app-header__nav {
  position: absolute;
  top: calc(100% - 8px);
  right: 20px;
  width: min(18rem, calc(100vw - 40px));
  padding: 8px;
  border: 1px solid rgba(217, 226, 240, 0.55);
  border-radius: var(--control-radius);
  background: #313a49;
  box-shadow: var(--shadow);
}

.app-header__nav-link {
  display: block;
  padding: 10px 12px;
  border-radius: 5px;
}

.app-header__nav-link:hover,
.app-header__nav-link:focus-visible {
  background: rgba(217, 226, 240, 0.12);
}

.shell {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 56px;
  display: grid;
  gap: 24px;
}

.act-lower-panel,
.panel,
.stage-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.header {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 24px;
}

#act-lower-panel-shell {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.act-lower-panel,
.panel,
.stage-card {
  padding: 24px;
}

.header__bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.header__copy {
  flex: 1;
  min-width: 0;
}

.header h1,
.controls h2,
.panel h2 {
  margin: 0;
  line-height: 1.1;
}

.narrative-message {
  font-size: var(--narrative-message-font-size);
  font-weight: var(--narrative-message-font-weight);
}

.distance-double-arrow__guidance {
  font-size: var(--narrative-message-font-size);
  font-weight: var(--narrative-message-font-weight);
  fill: #f7f9fc;
}

.scale-narrative-message {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: var(--narrative-message-font-size);
  font-weight: var(--narrative-message-font-weight);
}

.header h1 {
  color: #eef3fb;
}

.header__back {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: #eef3fb;
  color: var(--text);
  border-radius: 999px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition:
    background 120ms ease,
    box-shadow 120ms ease,
    transform 120ms ease;
}

.directional-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.directional-button__icon {
  flex: 0 0 auto;
  width: 24px;
  height: 12px;
  pointer-events: none;
}

.directional-button__icon--previous {
  margin-right: -14px;
}

.directional-button__icon--next {
  margin-left: -14px;
}

.intro,
.controls__note,
.panel__subcopy,
.range {
  margin: 10px 0 0;
  color: var(--muted);
}

.controls {
  display: grid;
  gap: 16px;
}

.act-lower-panel {
  display: grid;
}

.act-lower-panel__layer {
  grid-area: 1 / 1;
  display: grid;
  min-width: 0;
}

.act-lower-panel__layer--act2 {
  gap: 18px;
}

.act-lower-panel__layer--act3 {
  gap: 16px;
}

.act-lower-panel__layer--act3.act-lower-panel__layer--layout-reserved {
  min-height: calc(1.375rem + 16px + var(--journey-control-height));
  pointer-events: none;
}

.stage-card {
  display: grid;
  gap: 18px;
}

.transition-card {
  opacity: var(--transition-card-opacity, 1);
}

.transition-card--inactive {
  pointer-events: none;
  user-select: none;
}

.transition-card--visual-ready .journey-control-button--next:disabled,
.transition-card--visual-ready .journey-scrubber--disabled {
  opacity: 1;
}

.stage-card__title {
  margin: 0 0 14px;
}

#act2-destination-title {
  color: #eef3fb;
}

.act2-destination-title__vertical-break {
  display: none;
}

.stage-card__note {
  margin: 14px 0 0;
  color: var(--muted);
}

.stage-card--act1 {
  --act1-button-gap: 12px;
  --act1-section-gap: 28px;
  --act1-ticket-notch: 36px;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  gap: 0;
  background: #f6f7fb;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  text-align: center;
}

.act1-content {
  display: grid;
  gap: var(--act1-section-gap);
  width: 100%;
  max-width: 1052px;
  margin: 0 auto;
}

.act1-intro {
  display: grid;
  gap: 20px;
  width: 100%;
}

.stage-card--act1 .act1-intro {
  justify-items: center;
}

.act1-ticket {
  position: relative;
  isolation: isolate;
  padding: 28px clamp(24px, 4vw, 48px) 30px;
  background: #606b82;
}

.act1-ticket::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(
      circle at top left,
      #f6f7fb 0 var(--act1-ticket-notch),
      transparent calc(var(--act1-ticket-notch) + 1px)
    ),
    radial-gradient(
      circle at top right,
      #f6f7fb 0 var(--act1-ticket-notch),
      transparent calc(var(--act1-ticket-notch) + 1px)
    ),
    radial-gradient(
      circle at bottom right,
      #f6f7fb 0 var(--act1-ticket-notch),
      transparent calc(var(--act1-ticket-notch) + 1px)
    ),
    radial-gradient(
      circle at bottom left,
      #f6f7fb 0 var(--act1-ticket-notch),
      transparent calc(var(--act1-ticket-notch) + 1px)
    );
}

.act1-ticket > * {
  position: relative;
  z-index: 2;
}

.income-hero {
  display: grid;
  gap: 16px;
  justify-items: start;
  width: 100%;
  padding: 8px 0 12px;
  container-type: inline-size;
}

.stage-card--act1 .income-hero {
  justify-items: center;
}

.income-hero__prompt {
  margin: 0;
  width: min(420px, 100%);
  color: var(--muted);
  font: inherit;
  line-height: 1.4;
  text-align: left;
}

.stage-card--act1 .income-hero__prompt {
  width: 100%;
  color: #f6f7fb;
  text-align: center;
}

.income-hero__field {
  display: flex;
  justify-content: flex-start;
  width: 100%;
}

.stage-card--act1 .income-hero__field {
  justify-content: center;
}

.income-hero__input {
  width: 95%;
  max-width: 95%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-size: clamp(2.75rem, calc(95cqi / 6), 200pt);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  text-align: left;
  font-variant-numeric: tabular-nums;
  caret-color: var(--user);
  box-shadow: none;
}

.stage-card--act1 .income-hero__input {
  color: #ffffff;
  caret-color: #ffffff;
  text-align: center;
}

.stage-card--act1 .stage-card__note {
  width: 100%;
  margin: 0;
  color: #f6f7fb;
  text-align: center;
}

.stage-card--act1 .button-row {
  display: grid;
  container-type: inline-size;
  grid-template-columns:
    minmax(0, 1fr)
    minmax(0, 1.25fr)
    minmax(0, 1.5fr)
    minmax(0, 1.75fr)
    minmax(0, 2fr);
  gap: var(--act1-button-gap);
  width: 100%;
}

.stage-card--act1 .button-row .quick-option,
.static-page__body a.quick-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.stage-card--act1 .button-row .quick-option {
  width: 100%;
  min-width: 0;
  padding: 10px clamp(8px, 1.8cqi, 16px);
}

.stage-card--act1 .stage-card__actions {
  width: 100%;
  margin-top: calc(var(--act1-button-gap) - var(--act1-section-gap));
}

.stage-card--act1 .stage-card__actions button {
  width: 100%;
  text-align: center;
}

.stage-card--act1 .stage-card__actions button.button--loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.income-hero__input:focus,
.income-hero__input:focus-visible {
  outline: none;
  box-shadow: none;
  border: 0;
}

.stage-card__actions {
  display: flex;
  justify-content: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.stage-card__actions--split {
  justify-content: space-between;
  align-items: center;
}

.act2-destination-controls {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  width: 100%;
}

.act2-destination-field {
  min-width: 0;
}

.act2-destination-field .field__input {
  width: 100%;
  max-width: none;
}

.act2-destination-field select.field__input {
  appearance: none;
  min-height: 42px;
  padding: 10px 44px 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  background-color: #eef3fb;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 13px) 50%;
  background-repeat: no-repeat;
  background-size: 5px 5px;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition:
    background-color 120ms ease,
    box-shadow 120ms ease;
}

.act2-destination-field select.field__input:hover {
  background-color: #e5edf8;
}

.act2-destination-field select.field__input:focus,
.act2-destination-field select.field__input:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.35);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px var(--surface);
}

.billionaire-picker {
  position: relative;
  min-width: 0;
}

.billionaire-picker__trigger,
.billionaire-picker__option {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.billionaire-picker__trigger {
  position: relative;
  width: 100%;
  height: 42px;
  padding: 10px 44px 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  background: #eef3fb;
}

.billionaire-picker__trigger::after {
  position: absolute;
  top: 50%;
  right: 16px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  content: "";
  transform: translateY(-65%) rotate(45deg);
}

.billionaire-picker__trigger:hover {
  background: #e5edf8;
}

.billionaire-picker__trigger:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.35);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px var(--surface);
}

.billionaire-picker__options {
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  left: 0;
  z-index: 20;
  max-height: min(360px, 52vh);
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  background: #fff;
  box-shadow: 0 16px 40px rgba(37, 52, 76, 0.2);
}

.billionaire-picker__option {
  width: 100%;
  height: 36px;
  padding: 0 11px;
  border: 0;
  border-radius: calc(var(--control-radius) - 4px);
  background: transparent;
}

.billionaire-picker__option:hover,
.billionaire-picker__option:focus-visible,
.billionaire-picker__option[aria-selected="true"] {
  outline: none;
  background: #eef3fb;
}

.billionaire-picker__name {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.billionaire-picker__flag {
  flex: 0 0 15px;
  width: 15px;
  min-width: 15px;
  max-width: 15px;
  height: 10px;
  min-height: 10px;
  max-height: 10px;
  object-fit: contain;
}

.billionaire-picker__entity {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  font-size: inherit;
  font-weight: 400;
  text-overflow: ellipsis;
}

body.scale-orientation--vertical .billionaire-picker__flag {
  flex: 0 0 12px;
  width: 12px;
  min-width: 12px;
  max-width: 12px;
  height: 8px;
  min-height: 8px;
  max-height: 8px;
}

.act2-destination-actions {
  width: 100%;
}

.act2-destination-actions button {
  width: 100%;
  text-align: center;
}

.act2-destination-actions button.button--loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.field {
  display: grid;
  gap: 10px;
}

.field__label {
  font-weight: 700;
}

.field__input {
  width: min(420px, 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  color: var(--text);
  background: #fff;
}

.field__input:focus {
  outline: 2px solid rgba(59, 130, 246, 0.2);
  outline-offset: 1px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button-row--journey {
  justify-content: space-between;
  width: 100%;
}

.journey-controls {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0;
  width: 100%;
  overflow: visible;
}

.journey-controls > button {
  position: relative;
  z-index: 2;
  display: inline-flex;
  flex: 0 0 auto;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: auto;
  height: var(--journey-control-height);
  padding: 10px 16px;
  overflow: hidden;
  border: 1px solid #606b82;
  background: #3a414f;
  box-shadow: none;
  color: #eef3fb;
  font: inherit;
  font-weight: 700;
  line-height: normal;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background 120ms ease,
    box-shadow 120ms ease,
    transform 120ms ease;
}

.journey-controls > .journey-control-button--previous {
  border-radius:
    var(--control-radius)
    0
    0
    var(--control-radius);
}

.journey-controls > .journey-control-button--next {
  border-radius:
    0
    var(--control-radius)
    var(--control-radius)
    0;
}

.journey-control-button__icon {
  display: block;
  flex: 0 0 auto;
  width: 24px;
  height: 12px;
  overflow: visible;
  fill: currentColor;
  pointer-events: none;
}

.journey-controls > button:disabled {
  color: #9aa3b2;
  opacity: 1;
  cursor: not-allowed;
}

.journey-controls--transient-lock > button:disabled {
  background: #3a414f;
  color: #eef3fb;
}

.journey-scrubber-host {
  position: relative;
  z-index: 1;
  flex: 1 1 0;
  height: var(--journey-control-height);
  min-width: 0;
  border-top: 1px solid #606b82;
  border-bottom: 1px solid #606b82;
  background: #eef3fb;
}

.journey-scrubber {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  --scrubber-tick-color: #41516a;
  --scrubber-current-position-color: #3a414f;
  cursor: pointer;
  touch-action: pan-y;
}

.journey-scrubber__track {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  transform: translateY(-50%);
  background: transparent;
  border-radius: 999px;
  pointer-events: none;
}

.journey-scrubber__ticks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.journey-scrubber__tick {
  position: absolute;
  top: 0;
  left: var(--scrubber-tick-position, 0%);
  width: 1px;
  height: 100%;
  transform: translateX(-50%);
  background: var(--scrubber-tick-color);
  opacity: 0.55;
  border-radius: 0;
}

body.scale-orientation--horizontal .journey-scrubber {
  --scrubber-tick-color: #8a94a6;
}

body.scale-orientation--horizontal .journey-scrubber__tick {
  top: 25%;
  height: 50%;
}

.journey-scrubber__handle {
  position: absolute;
  top: 50%;
  left: var(--scrubber-handle-position, 0%);
  width: 14px;
  height: 14px;
  padding: 0;
  transform: translate(-50%, -50%) rotate(45deg);
  border: 0;
  border-radius: 0;
  background: var(--scrubber-current-position-color);
  cursor: grab;
}

.journey-scrubber__handle:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.journey-scrubber--dragging .journey-scrubber__handle {
  cursor: grabbing;
}

.journey-scrubber--disabled {
  opacity: 0.45;
}

.journey-controls--transient-lock .journey-scrubber--disabled {
  opacity: 1;
}

.journey-scrubber--disabled .journey-scrubber__handle {
  cursor: not-allowed;
}

.button-row button,
.stage-card__actions button,
.static-page__body a.quick-option {
  border: 1px solid var(--border);
  background: #eef3fb;
  color: var(--text);
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
  transition:
    background 120ms ease,
    box-shadow 120ms ease,
    transform 120ms ease;
}

.static-page__body a.quick-option {
  font-family: Arial, sans-serif;
  font-size: 13.3333px;
  line-height: normal;
  padding: 10px clamp(8px, 1.8cqi, 16px);
  text-decoration: none;
}

.stage-card__actions button.button--pressed {
  background: #c5d4ea;
  box-shadow: inset 0 2px 5px rgba(15, 23, 42, 0.18);
  transform: translateY(1px);
}

.stage-card__actions button.button--loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.stage-card__actions button.button--loading::after {
  content: "";
  width: 0.85em;
  height: 0.85em;
  border: 2px solid rgba(19, 32, 51, 0.22);
  border-top-color: rgba(19, 32, 51, 0.68);
  border-radius: 50%;
  animation: button-loading-spin 720ms linear infinite;
}

.button-row button:disabled,
.stage-card__actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.stage-card--act1 .button-row button,
.stage-card--act1 .stage-card__actions button,
button.directional-button--dark,
.static-page__body a.quick-option {
  border-color: #606b82;
  border-radius: var(--control-radius);
  background: #3a414f;
  color: #eef3fb;
}

.stage-card--act1 #act1-continue-button:disabled {
  background: #606b82;
  color: rgba(238, 243, 251, 0.78);
  opacity: 1;
}

.stage-card--act1 .button-row button:hover:not(:disabled),
.stage-card--act1 .stage-card__actions button:hover:not(:disabled),
button.directional-button--dark:hover:not(:disabled),
.static-page__body a.quick-option:hover {
  background: #4a5363;
}

.stage-card--act1 .button-row button:focus-visible,
.stage-card--act1 .stage-card__actions button:focus-visible,
button.directional-button--dark:focus-visible,
.static-page__body a.quick-option:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.stage-card--act1 .button-row button:active:not(:disabled),
.stage-card--act1 .stage-card__actions button:active:not(:disabled),
.stage-card--act1 .stage-card__actions button.button--pressed,
button.directional-button--dark:active:not(:disabled),
button.directional-button--dark.button--pressed,
.static-page__body a.quick-option:active {
  background: #2f3541;
  box-shadow: inset 0 2px 5px rgba(15, 23, 42, 0.32);
  transform: translateY(1px);
}

.stage-card--act1 .stage-card__actions button.button--loading::after,
button.directional-button--dark.button--loading::after {
  border-color: rgba(238, 243, 251, 0.3);
  border-top-color: #eef3fb;
}

.quick-option {
  white-space: nowrap;
}

.panel__footer {
  margin: 16px 0 0;
  font-size: 0.875rem;
  color: var(--muted);
}

#scale-panel {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  margin-top: -12px;
  padding: 0;
  background: #f6f7fb;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

#scale-panel .panel__footer {
  width: min(1100px, calc(100% - 32px));
  margin-left: auto;
  margin-right: auto;
}

/* Act II controls retain one shared visual language whenever their real HTML
   node is hosted inside the scale, regardless of orientation. */
#act2-scale-controls-host .act2-destination-field select.field__input,
#act2-scale-controls-host .billionaire-picker__trigger {
  border-color: #606b82;
  border-radius: var(--control-radius);
  background-color: #3a414f;
  color: #eef3fb;
}

#act2-scale-controls-host .act2-destination-field select.field__input {
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
}

#act2-scale-controls-host .billionaire-picker__trigger::after {
  border-color: currentColor;
}

#act2-scale-controls-host .act2-destination-field select.field__input:hover,
#act2-scale-controls-host .billionaire-picker__trigger:hover {
  background-color: #4a5363;
}

#act2-scale-controls-host .act2-destination-field select.field__input:focus,
#act2-scale-controls-host .act2-destination-field select.field__input:focus-visible,
#act2-scale-controls-host .billionaire-picker__trigger:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
  box-shadow: none;
}

#act2-scale-controls-host .act2-destination-field select.field__input:active,
#act2-scale-controls-host .billionaire-picker__trigger:active {
  background-color: #2f3541;
  box-shadow: inset 0 2px 5px rgba(15, 23, 42, 0.32);
  transform: translateY(1px);
}

#act2-scale-controls-host .billionaire-picker__options {
  border-color: rgba(217, 226, 240, 0.55);
  background: #313a49;
  box-shadow: var(--shadow);
}

#act2-scale-controls-host .billionaire-picker__option {
  color: #d9e2f0;
}

#act2-scale-controls-host .billionaire-picker__option:hover,
#act2-scale-controls-host .billionaire-picker__option:focus-visible,
#act2-scale-controls-host .billionaire-picker__option[aria-selected="true"] {
  background: rgba(217, 226, 240, 0.12);
}

@media (orientation: landscape) {
  #scale-panel {
    position: relative;
  }

  #act2-scale-controls-host {
    position: absolute;
    z-index: 2;
    top: 0;
    right: 0;
    left: 0;
    height: 520px;
    pointer-events: none;
  }

  /* The Act II controls occupy the lower half of the 520px scale viewBox:
     from the double-arrow centre (y=259) to the scale axis (y=518). */
  #act2-scale-controls-host > #act2-destination-section {
    position: absolute;
    inset: 50% 0 0;
    display: grid;
    width: fit-content;
    max-width: calc(100% - 48px);
    min-width: 0;
    margin: 0 auto;
    align-content: center;
    justify-items: center;
    gap: 16px;
    pointer-events: auto;
  }

  #act2-scale-controls-host #act2-destination-title {
    width: 100%;
    margin: 0;
    color: #3a414f;
    text-align: center;
    white-space: nowrap;
  }

  #act2-scale-controls-host .act2-destination-controls {
    display: flex;
    width: 100%;
    min-width: 0;
    align-items: stretch;
    gap: 12px;
  }

  #act2-scale-controls-host .act2-destination-field {
    flex: 1 1 auto;
  }

  #act2-scale-controls-host .act2-destination-actions {
    flex: 0 0 auto;
    width: auto;
  }

  #act2-scale-controls-host .act2-destination-actions button,
  #act2-scale-controls-host .act2-destination-actions button.button--loading {
    width: auto;
    min-width: max-content;
  }

  #act2-scale-controls-host
    > #act2-destination-section.transition-card--inactive {
    pointer-events: none;
  }

  body.scale-orientation--horizontal
    .shell--scale-story:not(.shell--act3-journey)
    > #act-lower-panel-shell {
    display: none;
  }
}

@media (orientation: landscape) and (max-width: 700px) {
  #act2-scale-controls-host > #act2-destination-section {
    width: calc(100% - 32px);
  }

  #act2-scale-controls-host #act2-destination-title {
    white-space: normal;
  }
}

.journey-status {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.journey-status__destination {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.1;
  color: #eef3fb;
}

.journey-status__position {
  margin: 0;
  flex-shrink: 0;
  font-size: 1.25rem;
  line-height: 1.1;
  color: #eef3fb;
  white-space: nowrap;
}

.shell--act3-journey #scale-panel {
  order: 2;
  grid-row: 2;
}

.shell--act3-journey #act-lower-panel-shell {
  order: 3;
  grid-column: 1;
  grid-row: 3;
}

body.scale-orientation--horizontal
  .shell--act3-journey
  .act-lower-panel__layer--act3 {
  align-self: start;
}

.shell--act3-complete .act-lower-panel__layer--act2 {
  display: none;
}

.panel--revealing {
  animation: panel-reveal 240ms ease-out;
}

#scale-svg {
  display: block;
  width: 100%;
  height: 520px;
}

.tape-ruler-label {
  paint-order: stroke fill;
  stroke: #f6f7fb;
  stroke-width: 4px;
  stroke-linejoin: round;
}

body.scale-orientation--vertical .tape-ruler-label {
  paint-order: normal;
  stroke: none;
}

.destination-background-amount {
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  text-rendering: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#scale-svg.scale-svg--pannable {
  cursor: grab;
  touch-action: pan-y;
}

#scale-svg.scale-svg--dragging {
  cursor: grabbing;
}

.scale-dragging,
.scale-dragging * {
  user-select: none;
}

@keyframes panel-reveal {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes button-loading-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 720px) {
  body[data-supporting-page] .app-header__row {
    min-height: 64px;
  }

  .app-header__row {
    padding: 14px 16px;
  }

  .app-header__nav {
    gap: 14px;
  }

  .static-page {
    padding-top: 64px;
    background: linear-gradient(to bottom, var(--bg) 64px, #f6f7fb 64px);
  }

  .static-page__card {
    padding: 24px;
  }

  .shell {
    width: min(1100px, calc(100% - 20px));
    padding-top: 20px;
  }

  .header,
  .act-lower-panel,
  .panel,
  .stage-card {
    padding: 18px;
  }

  #scale-panel {
    margin-top: -8px;
  }

  #scale-panel .panel__footer {
    width: min(1100px, calc(100% - 20px));
  }

  .stage-card--act1 {
    --act1-section-gap: 22px;
    --act1-ticket-notch: 24px;
    width: calc(100% + 20px);
    margin-inline: -10px;
    border-radius: 0;
    gap: var(--act1-section-gap);
  }

  .act1-ticket {
    padding: 22px 16px 24px;
  }

  .stage-card--act1 .income-hero__input {
    font-size: clamp(40px, 14cqi, 150px);
    letter-spacing: -0.04em;
  }

  .stage-card--act1 .button-row {
    grid-template-columns: repeat(24, minmax(0, 1fr));
  }

  .stage-card--act1 .button-row .quick-option:nth-child(1) {
    grid-column: span 7;
  }

  .stage-card--act1 .button-row .quick-option:nth-child(2) {
    grid-column: span 8;
  }

  .stage-card--act1 .button-row .quick-option:nth-child(3) {
    grid-column: span 9;
  }

  .stage-card--act1 .button-row .quick-option:nth-child(4) {
    grid-column: span 11;
  }

  .stage-card--act1 .button-row .quick-option:nth-child(5) {
    grid-column: span 13;
  }

  .act2-destination-actions button {
    min-width: 0;
    padding-inline: 4px;
  }

  .income-hero {
    padding: 4px 0 8px;
  }
}

@media (orientation: portrait) {
  :root {
    font-size: 87.5%;
  }

  body {
    --portrait-rail-width: 40px;
    --journey-vertical-visible-width: 10px;
    --portrait-rail-space: calc(
      var(--portrait-rail-width) + env(safe-area-inset-right, 0px)
    );
  }

  body.scale-story-active {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  .app-header__row {
    gap: clamp(8px, 3vw, 12px);
    padding:
      calc(12px + env(safe-area-inset-top, 0px))
      calc(12px + env(safe-area-inset-right, 0px))
      12px
      calc(12px + env(safe-area-inset-left, 0px));
  }

  .app-header__wordmark {
    font-size: 1rem;
  }

  .app-header__nav {
    gap: clamp(8px, 2.8vw, 12px);
  }

  .app-header__nav-link {
    font-size: 0.875rem;
  }

  .shell {
    position: relative;
    width: min(1100px, calc(100% - 20px));
    padding-top: calc(60px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
    gap: 16px;
  }

  .shell--scale-story {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
  }

  body.scale-orientation--vertical .shell--scale-story {
    /* The SVG is the portrait scale viewport. Floating controls own their
       safe-area inset independently, so the shell must not reserve a second
       bottom strip outside the physical scale. */
    padding-bottom: 0;
    grid-template-rows: minmax(0, 1fr);
    overflow: visible;
  }

  /* Portrait Act II, the zoom, and Act III share one physical scale viewport.
     Their controls are either hosted in the scale or fixed to its rail, so this
     legacy grid row must never reclaim height while the camera is animating. */
  body.scale-orientation--vertical
    .shell--scale-story
    > #act-lower-panel-shell {
    display: none;
  }

  .shell > * {
    min-width: 0;
  }

  .static-page {
    padding-top: calc(64px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(
      to bottom,
      var(--bg) calc(64px + env(safe-area-inset-top, 0px)),
      #f6f7fb calc(64px + env(safe-area-inset-top, 0px))
    );
  }

  .header,
  .act-lower-panel,
  .stage-card,
  .static-page__card {
    padding: 18px;
  }

  :root {
    --narrative-message-font-size: 1.125rem;
  }

  .static-page__title {
    font-size: clamp(1.5rem, 7vw, 2rem);
  }

  .static-page__body,
  .act2-destination-field select.field__input,
  .billionaire-picker__trigger,
  .billionaire-picker__option,
  .field__input,
  .button-row button,
  .stage-card__actions button,
  .static-page__body a.quick-option,
  .header__back {
    font-size: 0.875rem;
  }

  .panel__footer {
    font-size: 0.75rem;
  }

  .income-hero__input {
    font-size: clamp(44px, calc(95cqi / 6), 200pt);
  }

  .journey-status {
    align-items: flex-start;
    gap: 8px;
  }

  body.portrait-scale-back-in-app-header .app-header__row {
    flex-wrap: nowrap;
  }

  body.portrait-scale-back-in-app-header .app-header__row > .header__back {
    margin-left: auto;
    translate: 0 var(--vertical-act3-back-travel, 0px);
  }

  body.portrait-scale-back-in-app-header .app-header__menu-button {
    margin-left: 0;
  }

  body.portrait-scale-back-in-app-header .shell--scale-story > .header {
    display: none;
  }

  /* Act III reveals additional scale viewport from above as the journey moves
     away from its first stop. The values are supplied from the continuous
     camera position, not from gesture events. */
  body.scale-orientation--vertical.scale-story-active
    .app-header {
    transform: translateY(
      var(--vertical-act3-app-header-travel, 0px)
    );
  }

  body.scale-orientation--vertical
    .shell--vertical-act3-collapsing {
    padding-top: var(--vertical-act3-shell-padding-top);
  }

  body.scale-orientation--vertical .shell--scale-story > #act-lower-panel-shell {
    order: 3;
    grid-column: 1;
    grid-row: 3;
  }

  body.scale-orientation--vertical
    .act-lower-panel__layer--act3.act-lower-panel__layer--layout-reserved {
    min-height: 0;
  }

  body.scale-orientation--vertical .shell--scale-story > #scale-panel {
    order: 2;
    grid-column: 1;
    grid-row: 1;
    position: relative;
    margin-top: -4px;
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    --vertical-act3-chrome-inline-inset: 18px;
  }

  body.scale-orientation--vertical .journey-status--vertical-tracking {
    position: absolute;
    z-index: 14;
    right: calc(var(--vertical-act3-chrome-inline-inset) + env(safe-area-inset-right, 0px));
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    left: calc(var(--vertical-act3-chrome-inline-inset) + env(safe-area-inset-left, 0px));
    min-height: 42px;
    padding: 10px 16px;
    border: 1px solid #606b82;
    border-radius: var(--control-radius);
    background: #3a414f;
    color: #eef3fb;
    pointer-events: none;
    transform: translateY(var(--vertical-act3-tracking-translate-y, 100%));
  }

  body.scale-orientation--vertical
    .journey-status--vertical-tracking
    .journey-status__destination,
  body.scale-orientation--vertical
    .journey-status--vertical-tracking
    .journey-status__position {
    color: #eef3fb;
    font-size: 0.875rem;
    white-space: nowrap;
  }

  body.scale-orientation--vertical
    .journey-status--vertical-tracking
    .journey-status__destination {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  body.scale-orientation--vertical .shell--scale-story #scale-svg {
    height: 100%;
    min-height: 0;
  }

  body.scale-orientation--vertical #act2-scale-controls-host {
    position: absolute;
    z-index: 2;
    inset: 0;
    pointer-events: none;
  }

  body.scale-orientation--vertical
    #act2-scale-controls-host
    > #act2-destination-section {
    position: absolute;
    right: calc(20px + env(safe-area-inset-right, 0px));
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    left: calc(20px + env(safe-area-inset-left, 0px));
    display: grid;
    grid-area: auto;
    gap: 14px;
    pointer-events: auto;
  }

  body.scale-orientation--vertical
    #act2-scale-controls-host
    #act2-destination-title {
    margin: 0;
    color: #3a414f;
    text-align: center;
  }

  body.scale-orientation--vertical .act2-destination-title__vertical-break {
    display: initial;
  }

  body.scale-orientation--vertical
    #act2-scale-controls-host
    .act2-destination-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 8px;
  }

  body.scale-orientation--vertical
    #act2-scale-controls-host
    .act2-destination-actions {
    display: none;
  }

  body.scale-orientation--vertical #scale-svg.scale-svg--pannable {
    touch-action: none;
  }

  body.scale-orientation--vertical
    .shell--act3-journey
    .journey-controls {
    position: fixed;
    z-index: 15;
    top: var(--journey-rail-top, 0);
    left: calc(
      var(--journey-rail-left, 0) +
        var(--portrait-rail-width) -
        var(--journey-vertical-visible-width) -
        env(safe-area-inset-right, 0px)
    );
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    width: var(--journey-vertical-visible-width);
    height: var(--journey-rail-height, 0);
    padding: 0;
    border-left: 0;
    background: transparent;
    box-shadow: none;
    visibility: hidden;
  }

  body.scale-orientation--vertical
    .shell--act3-journey
    .journey-controls--scale-aligned {
    visibility: visible;
  }

  body.scale-orientation--vertical
    #scale-panel
    > #journey-status-row.journey-status--vertical-tracking.journey-status--offscreen {
    visibility: hidden;
  }

  body.scale-orientation--vertical
    .shell--act3-journey
    .journey-controls
    > button {
    display: none;
  }

  body.scale-orientation--vertical
    .shell--act3-journey
    .journey-scrubber-host {
    flex: 1 1 auto;
    width: 100%;
    height: auto;
    min-width: 100%;
    min-height: 0;
    background: transparent;
  }

  .journey-scrubber--vertical {
    --minimap-tick-width: 1px;
    --minimap-current-position-color: var(--scrubber-current-position-color);
    width: 100%;
    height: 100%;
    min-height: 0;
    touch-action: none;
  }

  .journey-scrubber--vertical .journey-scrubber__track {
    inset: 0 auto 0 50%;
    width: 2px;
    height: auto;
    transform: translateX(-50%);
    background: transparent;
  }

  .journey-scrubber--vertical .journey-scrubber__tick {
    top: var(--scrubber-tick-position, 0%);
    left: 0;
    width: 100%;
    height: var(--minimap-tick-width);
    transform: translateY(-50%);
  }

  .journey-scrubber--vertical
    .journey-scrubber__tick--boundary {
    background: transparent;
    height: 0;
    opacity: 1;
  }

  .journey-scrubber--vertical
    .journey-scrubber__tick--start {
    transform: none;
  }

  .journey-scrubber--vertical
    .journey-scrubber__tick--end {
    transform: translateY(-100%);
  }

  .journey-scrubber--vertical .journey-scrubber__tick--start::before,
  .journey-scrubber--vertical .journey-scrubber__tick--end::before {
    position: absolute;
    right: 0;
    width: var(--journey-vertical-visible-width);
    height: var(--journey-vertical-visible-width);
    content: "";
    background: var(--minimap-current-position-color);
    pointer-events: none;
  }

  .journey-scrubber--vertical .journey-scrubber__tick--start::before {
    bottom: 100%;
    clip-path: polygon(100% 100%, 100% 0, 0 100%);
  }

  .journey-scrubber--vertical .journey-scrubber__tick--end::before {
    top: 100%;
    clip-path: polygon(100% 0, 100% 100%, 0 0);
  }

  .journey-scrubber--vertical .journey-scrubber__handle {
    top: var(--scrubber-handle-position, 0%);
    left: 100%;
    width: 10px;
    height: 10px;
  }
}

@media (orientation: portrait) and (max-width: 340px) {
  .app-header__row {
    flex-wrap: wrap;
  }

  .app-header__nav {
    min-width: max-content;
  }
}
