body #mars #campaign-stage-title {
  scroll-margin-top: 100px;
}
body #mars #campaign-stage-title:focus {
  outline: 0;
}
body #mars .campaign-stage-navigation {
  list-style: none;
  margin: 0;
}
body #mars .campaign-stage-navigation .campaign-stage {
  font-weight: 600;
  cursor: default;
}
/* Shared geometry for Challenges, Campaign and both Sandbox models. */
/* Reserve the responsive workspace below the real hero until its owner is ready. */
body #mars .boot-workspace {
  min-height: 100svh;
  padding: 24px 0;
}
body #mars .boot-workspace p {
  max-width: 60ch;
  margin: 12px 0;
}
body #mars .simulation-intro {
  display: block;
}
body #mars .simulation-intro h1 {
  display: grid;
}
body #mars .simulation-intro h1 span {
  grid-area: 2/1;
}
body #mars .simulation-intro h1 [aria-hidden="true"] {
  visibility: hidden;
}
body #mars .simulation-intro h1::before,
body #mars .simulation-intro h1::after {
  grid-area: 2/1;
  visibility: hidden;
  font: italic 1.3rem/1.3 var(--serif);
  letter-spacing: 0;
  margin: 6px 0 0;
}
body #mars .simulation-intro h1::before {
  content: 'Cargo Commander';
}
body #mars .simulation-intro h1::after {
  content: 'Planning Sandbox';
}
body #mars .simulation-intro .intro-copy-stack {
  display: grid;
}
body #mars .intro-copy-stack .intro-copy {
  grid-area: 1/1;
  max-width: none;
  margin: 0;
}
body #mars .intro-copy-stack [aria-hidden="true"] {
  visibility: hidden;
}
body #mars .mode-line {
  margin: 16px 0 0;
}
body #mars .mode-help {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 0 0 14px;
  border-block: 1px solid var(--line);
}
body #mars .mode-help>button {
  flex: none;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #dcc8b2;
  border-radius: 5px;
  background: #f7f3eb;
  font-size: .875rem;
  font-weight: 600;
  text-underline-offset: 4px;
}
body #mars .mode-help>button:hover {
  border-color: var(--orange);
  background: #f7eee7;
}
body #mars .mode-help>button span {
  color: var(--orange);
  margin-left: 6px;
}
body #mars .mode-help ol {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  flex: 1;
  gap: 12px;
  list-style: none;
  margin: 0;
  padding: 0;
}
body #mars .mode-help ol,
body #mars .mode-help li {
  min-width: 0;
  overflow-wrap: anywhere;
}
body #mars .mode-help li {
  display: flex;
  gap: 7px;
  align-items: baseline;
  margin: 0;
  color: var(--muted);
  font-size: .8125rem;
}
body #mars .mode-help li>span {
  color: var(--orange);
  font: inherit;
  font-variant-numeric: tabular-nums;
}
body #mars .mode-help .help-step-text {
  display: grid;
  color: var(--muted);
}
body #mars .help-step-text>span {
  grid-area: 1/1;
}
body #mars .help-step-text [aria-hidden] {
  visibility: hidden;
}
body #mars dialog {
  width: min(820px,calc(100% - 32px));
  max-height: calc(100dvh - 40px);
  box-sizing: border-box;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg,#faf9f6);
  color: var(--ink);
  box-shadow: 0 18px 70px #28251e33;
  overflow: hidden;
}
body #mars dialog[open] {
  display: flex;
  flex-direction: column;
}
body #mars dialog::backdrop {
  background: rgb(24 27 25 / 45%);
}
body #mars .guide-dialog-content {
  min-height: 0;
  overflow: auto;
}
body #mars .guide-dialog-heading {
  flex: none;
  padding-right: 36px;
  margin-bottom: 12px;
}
body #mars .guide-dialog-heading h2 {
  min-width: 0;
  margin: 0;
  font-size: 1.3rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
body #mars button.guide-dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 50%;
  background: var(--bg,#faf9f6);
}
body #mars dialog .simulation-guide {
  padding: 0;
  border: 0;
}
body #mars dialog .guide-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}
body #mars dialog .guide-columns h2 {
  font-size: 1rem;
  margin: 0 0 6px;
}
body #mars dialog .guide-columns p {
  margin: 0;
}
body #mars .mode-navigation {
  display: grid;
}
body #mars .mode-navigation>.mission-strip {
  grid-area: 1/1;
  margin: 0;
}
body #mars .mode-navigation .navigation-measure {
  display: grid;
  grid-area: 1/1;
  min-width: 0;
  visibility: hidden;
  pointer-events: none;
}
body #mars .navigation-measure>.mission-strip {
  margin: 0;
}
body #mars .mission-strip .mission {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 12px 14px;
  font-weight: 600;
  line-height: 1.3;
}
body #mars .mission-strip .mission small {
  display: block;
  margin-top: 4px;
  font-weight: 400;
  line-height: 1.4;
}
body #mars .mission-strip .mission>span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
}
body #mars .mission-strip .mission-num {
  flex: none;
  width: 30px;
  height: 30px;
}
body #mars .mission-strip .mission {
  border: 1px solid transparent;
}
body #mars .mission-strip .mission.selected {
  border-color: #dcc8b2;
}
body #mars .sandbox-navigation {
  grid-template-columns: repeat(2,minmax(0,1fr));
}
body #mars .sandbox-navigation .mission small {
  display: block;
}
body #mars .brief {
  display: grid;
  grid-template-columns: 1fr;
  margin: 20px 0 0;
  padding: 0;
  background: transparent;
  border: 0;
}
body #mars .brief .mission-brief {
  display: flex;
  flex-direction: column;
  align-items: start;
}
body #mars .brief h2 {
  margin: 0 0 8px;
}
body #mars .brief p:not(.kicker) {
  max-width: 78ch;
}
body #mars .brief .mission-rules {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 14px;
  width: 100%;
  box-sizing: border-box;
  padding: 12px 16px;
}
body #mars .brief-metric {
  min-width: 0;
  display: block;
}
body #mars .brief-metric .metric-value,
body #mars .brief-metric .metric-label {
  display: grid;
}
body #mars .metric-value>b,
body #mars .metric-label>span {
  grid-area: 1/1;
  min-width: 0;
  overflow-wrap: anywhere;
}
body #mars .metric-value [aria-hidden],
body #mars .metric-label [aria-hidden] {
  visibility: hidden;
}
body #mars .metric-value>b {
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}
body #mars .metric-label {
  font-size: .8125rem;
  line-height: 1.5;
}
body #mars .play-layout {
  display: grid;
  grid-template-columns: minmax(0,1.3fr) minmax(0,.75fr);
  align-items: start;
  gap: 28px;
  padding: 24px 0;
  margin: 0;
}
body #mars .play-layout>.packing {
  min-width: 0;
}
body #mars .play-layout>.mission-board {
  min-width: 0;
  margin: 0;
}
/* Mission controls follow the supplies; Sandbox tools retain their result actions. */
body #mars .packing-actions {
  margin-top: 20px;
}
body #mars .packing-actions .pack-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 10px;
  margin: 0;
}
body #mars .packing-actions .pack-actions>.primary {
  flex: 1 1 200px;
  min-width: 0;
  min-height: 48px;
}
body #mars .packing-actions .pack-actions>.secondary {
  flex: 1 1 180px;
}
body #mars .packing-actions .pack-actions>.quiet {
  flex: 0 1 auto;
}
body #mars .packing-actions .run-help {
  font-size: .875rem;
  line-height: 1.55;
  margin: 10px 0 0;
}
body #mars .packing-actions .hint {
  margin-top: 16px;
}
body #mars .packing-actions .minor-actions {
  flex-wrap: wrap;
  gap: 4px 16px;
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 8px;
}
body #mars .packing-actions .minor-actions button {
  padding-inline: 0;
  font-size: .875rem;
}
body #mars .packing-actions button.hint-trigger {
  min-height: 48px;
  padding: 8px 7px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--navy);
  font-size: .875rem;
  line-height: 1.5;
  font-weight: 400;
  text-decoration: underline;
  text-underline-offset: 4px;
}
body #mars .packing-actions button.hint-trigger:hover:not(:disabled) {
  border-color: var(--rust);
  background: #f7eee7;
}
body #mars .packing-actions button.hint-trigger:focus-visible {
  outline: 3px solid #c6511c;
  outline-offset: 4px;
}
body #mars .result-column {
  min-width: 0;
  width: 100%;
  order: 2;
}
body #mars .result-column>.mission-board {
  margin: 0;
  width: 100%;
}
body #mars .result-actions {
  margin-top: 16px;
}
body #mars .result-actions .pack-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 0;
}
body #mars .result-actions .pack-actions>.primary {
  width: 100%;
  min-height: 46px;
}
body #mars .result-actions .run-help {
  font-size: .8125rem;
  line-height: 1.55;
  margin: 10px 0 14px;
}
body #mars .result-actions .minor-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px;
}
body #mars .result-actions .minor-actions button {
  font-size: .8125rem;
}
body #mars .result-actions .apply-preview {
  margin: 0;
}
body #mars .result-actions .apply-preview>.primary {
  width: 100%;
}
body #mars .campaign .campaign-status .campaign-forecast h3 {
  font-size: 1.5rem;
  line-height: 1.2;
  margin: 0 0 12px;
}
body #mars #campaign-status-title,
body #mars #campaign-crew-comparison-title {
  scroll-margin-top: 105px;
}
body #mars #campaign-status-title:focus,
body #mars .campaign-action-phase:focus {
  outline: none;
}
body #mars .project-story {
  display: block;
  padding: 0;
  margin-bottom: 16px;
}
body #mars .project-story section {
  margin: 0;
}
body #mars .project-story h3 {
  margin-top: 24px;
}
body #mars .project-story p {
  color: inherit;
}
body #mars #project-context .project-boundary {
  margin-top: 20px;
  padding: 0;
}
body #mars .sandbox-reset {
  margin: 4px 0 14px;
}
@media (max-width:1100px) and (min-width:761px) {
  body #mars .play-layout {
    grid-template-columns: minmax(0,1.25fr) minmax(0,.82fr);
    gap: 20px;
  }
}
@media(max-width:760px) {
  body #mars .simulation-intro h1::before,
  body #mars .simulation-intro h1::after {
    font-size: 1.2rem;
  }
  body #mars .simulation-intro .intro-copy-stack {
    margin-top: 11px;
  }
  body #mars .mode-help {
    gap: 8px;
    align-items: start;
  }
  body #mars .mode-help ol {
    grid-template-columns: 1fr;
    gap: 3px;
  }
  body #mars .mode-help li {
    line-height: 1.45;
  }
  body #mars .mode-help>button {
    font-size: .8125rem;
  }
  body #mars .mission-strip .mission {
    flex-direction: column;
    align-items: start;
    gap: 7px;
    font-size: .8125rem;
  }
  body #mars .mission-strip .mission small {
    display: none;
  }
  body #mars .mission-strip .mission-num {
    width: 24px;
    height: 24px;
  }
  body #mars .sandbox-navigation {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }
  body #mars .sandbox-navigation .mission small {
    display: block;
    font-size: .75rem;
  }
  body #mars .brief {
    margin-top: 19px;
  }
  body #mars .metric-value>b {
    font-size: 1.125rem;
  }
  body #mars .metric-label {
    font-size: .75rem;
  }
  body #mars .play-layout {
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding-top: 20px;
  }
  body #mars .play-layout>.packing,
  body #mars .play-layout>.mission-board {
    width: 100%;
  }
  body #mars dialog {
    padding: 18px;
  }
}
/* UI/UX implementation: compact entry, local stability, accessible editing. */
body #mars .simulation-intro {
  min-height: 0;
  padding: 10px 26px;
}
body #mars .simulation-intro h1 {
  font-size: 2.4rem;
}
body #mars .simulation-intro h1::before,
body #mars .simulation-intro h1::after {
  content: none;
}
body #mars .simulation-intro .intro-copy-stack {
  margin-top: 10px;
}
body #mars .packing-jump {
  display: grid;
  margin: 0;
  min-height: 44px;
  padding: 8px 12px;
  background: #fffdf6;
  border: 1px solid #9b805f;
  border-radius: 4px;
  color: #78380f;
  font-size: .9375rem;
  font-weight: 600;
}
body #mars .packing-jump .jump-copy {
  grid-area: 1/1;
  color: inherit;
  margin: 0;
}
body #mars .packing-jump [aria-hidden="true"] {
  visibility: hidden;
}
body #mars .mode-switch {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  flex: 1 1 640px;
  gap: 12px;
}
body #mars .mode-switch button {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
  padding: 10px 12px;
}
body #mars .mode-switch .mode-name,
body #mars .mode-switch button small {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}
body #mars .mode-switch button small {
  display: inline;
  font-size: .75rem;
  font-weight: 400;
  color: var(--muted);
}
body #mars .mode-line {
  display: grid;
  grid-template-columns: minmax(0,3fr) minmax(0,1fr);
  gap: 8px 16px;
}
body #mars .mode-switch {
  min-width: 0;
  width: 100%;
}
body #mars .progress {
  display: grid;
  min-width: 0;
  max-width: none;
  text-align: left;
  font-size: .8125rem;
  overflow-wrap: anywhere;
}
body #mars .progress>span {
  grid-area: 1/1;
}
body #mars .progress [aria-hidden="true"] {
  visibility: hidden;
}
body #mars .mode-help {
  min-height: 0;
  padding: 8px 0;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
body #mars .mode-help>button {
  max-width: 100%;
  overflow-wrap: anywhere;
}
body #mars .brief {
  margin-top: 12px;
  gap: 8px;
}
body #mars .brief .mission-rules {
  padding-block: 8px;
}
body #mars .brief .brief-metric {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 10px;
}
body #mars .brief .metric-value,
body #mars .brief .metric-label {
  display: block;
}
body #mars .stable-brief,
body #mars .brief-metrics {
  display: grid;
  min-width: 0;
}
body #mars .stable-brief>.mission-brief,
body #mars .brief-metrics>.mission-rules {
  grid-area: 1/1;
}
body #mars .stable-brief>[aria-hidden=true],
body #mars .brief-metrics>[aria-hidden=true] {
  visibility: hidden;
  pointer-events: none;
}
body #mars .mission-strip .mission {
  padding-block: 10px;
}
body #mars .brief .mission-objective {
  margin-top: 4px;
}
body #mars .play-layout {
  padding-top: 18px;
}
body #mars .supply-grid+.cargo {
  margin-top: 14px;
}
body #mars .compact-feedback {
  padding: 12px 14px;
  margin: 14px 0 0;
  border: 1px solid #d8d2c6;
  border-radius: 4px;
  background: #f1eee6;
}
body #mars .compact-feedback p {
  margin: 0 0 4px;
  font-size: .875rem;
}
body #mars .compact-feedback button,
body #mars button.forecast-trigger {
  min-height: 36px;
  padding: 5px 0;
  line-height: 1.5;
}
body #mars .save-status {
  font-size: .875rem;
  margin: 8px 0;
}
body #mars .save-status p {
  margin: 0;
}
body #mars .sandbox-controls {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
body #mars .quantity-guidance {
  margin: 0 0 18px;
  font-size: .875rem;
  line-height: 1.5;
}
body #mars .packing[tabindex='-1']:focus {
  outline: none;
}
body #mars .status.invalid button {
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
  min-height: 36px;
  padding: 5px 0;
}
body #mars input[data-field],
body #mars .campaign input[type=text] {
  border-color: #8a8a7e;
}
body #mars input[data-field]:focus {
  border-color: #444b44;
  box-shadow: inset 0 0 0 1px #444b44;
  outline: none;
}
body #mars input[data-field][aria-invalid=true]:focus {
  border-color: #8a2d20;
  box-shadow: inset 0 0 0 2px #8a2d20;
  outline: none;
}
body #mars .field label,
body #mars .field-error,
body #mars .projection,
body #mars .packing-help {
  font-size: .875rem;
}
body #mars .field-error {
  min-height: 1.5em;
}
body #mars [tabindex='-1'] {
  scroll-margin-top: 110px;
}
body #mars .table-wrap:focus-visible {
  outline: 2px solid #465347;
  outline-offset: 3px;
}
@media(max-width:1100px) {
  body #mars .mode-line {
    grid-template-columns: 1fr;
    gap: 0;
  }
  body #mars .progress {
    padding: 6px 0;
  }
  body #mars .play-layout {
    display: flex;
    flex-direction: column;
    gap: 22px;
  }
  body #mars .play-layout>.packing {
    width: 100%;
  }
  body #mars .supply-grid {
    grid-template-columns: repeat(3,minmax(0,1fr));
  }
  body #mars .supply {
    display: block;
    padding: 12px;
  }
  body #mars .supply-top {
    margin-bottom: 8px;
  }
  body #mars .steps {
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 4px;
  }
  body #mars .projection p {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 5px;
    flex-wrap: wrap;
  }
  body #mars .projection strong {
    font-size: .875rem;
  }
}
@media(max-width:760px) {
  body #mars .simulation-intro {
    padding: 18px 20px;
  }
  body #mars .simulation-intro::after {
    display: none;
  }
  body #mars .simulation-intro>div,
  body #mars .intro-copy {
    max-width: 100%;
  }
  body #mars .simulation-intro h1 {
    font-size: 2.1rem;
  }
  body #mars .mode-line {
    display: grid;
  }
  body #mars .mode-switch {
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(min(100%,5.4rem),1fr));
    gap: 4px;
  }
  body #mars .mode-switch button {
    gap: 2px 8px;
    padding-inline: 4px;
  }
  body #mars .progress {
    display: grid;
    padding: 8px 0;
  }
  body #mars .mission-strip .mission {
    min-height: 64px;
    padding: 8px 6px;
  }
  body #mars .mode-help ol {
    display: none;
  }
  body #mars .brief .mission-rules {
    margin-top: 0;
    padding: 8px 10px;
    gap: 8px;
  }
  body #mars .supply-grid {
    grid-template-columns: 1fr;
  }
  body #mars .supply {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px 10px;
    border-top-width: 1px;
    border-left: 3px solid var(--resource);
  }
  body #mars .supply-top {
    margin: 0;
    flex: 1 1 5.5rem;
    min-width: 0;
  }
  body #mars .supply>.field {
    flex: 2 1 8rem;
    min-width: 0;
  }
  body #mars .supply .steps {
    flex-basis: 100%;
    grid-template-columns: repeat(auto-fit,minmax(min(100%,3.5rem),1fr));
  }
  body #mars .supply .steps button {
    min-height: 36px;
  }
  body #mars .projection {
    flex-basis: 100%;
    padding-top: 6px;
  }
  body #mars .result-hero {
    padding: 10px;
  }
  body #mars .result-hero h2 {
    font-size: 1.25rem;
  }
  body #mars .board-body {
    padding: 16px;
  }
}
body #mars .mission.selected small {
  opacity: 1;
}
/* Normal-sized forecast text and keyboard access to a scrollable guide. */
body #mars .board-body .gate {
  color: #9e4300;
}
body #mars .guide-dialog-content:focus-visible {
  outline: 2px solid #444b44;
  outline-offset: -2px;
}

/* Field Notes accents stay on the introduction and explanatory story. */
body #mars .simulation-intro {
  border-radius: 3px;
  box-shadow: 3px 3px 0 var(--paper), 4px 4px 0 #d8ccba;
}
body #mars .simulation-intro .kicker {
  color: var(--orange);
}
body #mars #project-context .project-story {
  padding-left: 18px;
  border-left: 2px solid #d5b296;
}
@media(max-width:580px) {
  body #mars #project-context .project-story { padding-left: 12px; }
}
@media print {
  body #mars .simulation-intro { box-shadow: none; }
}
