
.station #station-flight { position: relative; min-height: calc(100dvh - 52px); }
.station .flight-rail { display: contents; }
.station .viewport {
  height: clamp(375px, calc(100dvh - 170px), 840px);
  background-color: #10212b;
}
.station .blast-map-instruments {
  position: absolute;
  z-index: 8;
  inset: 12px auto auto 14px;
  width: min(60%, 410px);
  display: block;
  padding: 11px 14px;
  color: #f2e4bd;
  border: 0;
  background: linear-gradient(91deg,#0c1a22f0,#10212be3 78%,#10212b00);
  text-shadow: 0 1px 4px #080e10;
  pointer-events: none;
}
.station .starport-dial { display: none; }
.station #round-status #entry-guide {
  gap: 1px;
  padding: 2px 3px 3px;
  border: 1px solid #87b8a352;
  border-radius: 4px;
  background: linear-gradient(172deg, #25413dba, #12272cda);
}
.station #round-status #entry-guide li:not([aria-current="step"]) { border-block-end-color: transparent; }
.station #station-flight:has(.viewport[data-clock]:not([data-clock="ready"])) #entry-step { display: none; }
.station .blast-map-timer {
  position: absolute;
  inset: 5px 10px auto auto;
  z-index: 9;
  box-sizing: border-box;
  width: clamp(104px, 14vw, 152px);
  aspect-ratio: 1.12;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 13px 13px 16px;
  border: 0;
  border-radius: 0;
  background: transparent url("assets/pocket-clock.webp") center / contain no-repeat !important;
  filter: drop-shadow(0 3px 7px #05080abf);
}
.station #clock-label,
.station .blast-map-timer #personal-bay {
  max-width: 87px;
  font-size: 10px;
  line-height: 1.1;
  text-align: center;
  text-wrap: balance;
}
.station .blast-map-timer #countdown { line-height: .95; font-size: clamp(31px, 6vw, 48px); }
.station .blast-map-timer .progress { width: 44%; height: 3px; margin-top: 3px; }
.station .blast-map-timer[data-clock="urgent"] {
  color: #ffb37e;
  animation: clock-alarm 950ms ease-in-out infinite;
}
.visual-warning {
  position: absolute;
  z-index: 1;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 37%, #e85c2852 100%);
}
.viewport[data-clock="urgent"] .visual-warning { animation: perimeter-warning 950ms ease-in-out infinite; }
@keyframes perimeter-warning {
  0%,100% { opacity: .1; }
  42% { opacity: .68; }
}
.station #door-control {
  width: clamp(125px, 20vw, 180px);
  max-width: 50%;
  min-height: 53px;
  padding: 0 7px 6px;
  border: 0;
  border-radius: 0;
  background: transparent url("assets/hatch-handle.webp") center / 100% 100% no-repeat;
  box-shadow: none;
  filter: drop-shadow(0 4px 4px #080e16c7);
  transform: translate(-50%, -34%);
  color: #18120c;
  font-weight: 900;
  font-size: clamp(10px, 2.5vw, 13px);
}
.station #door-control:hover { filter: drop-shadow(0 2px 8px #ffc476c7) brightness(1.12); }
.station #door-control:active { transform: translate(-50%, -26%) scale(.95); }
.station #door-control::after { content: none; }
.station .station-switch,
.station .turn-stake > summary {
  background: url("assets/hatch-handle.webp") center / 100% 100% no-repeat;
  border: 0;
  color: #221a0b;
  padding-inline: 13px;
  font-weight: 850;
}
.station .station-switch[aria-pressed="true"] { filter: saturate(1.14) brightness(1.14); }
.station .station-log,
.station .station-log .sheet-panel {
  color: #f5e3ba;
}
.station .station-log {
  min-height: calc(100dvh - 52px);
  background: #14282d url("assets/signal-ledger.webp") center 24px / min(900px,100%) max(365px,70%) no-repeat;
  padding-inline: clamp(22px, 8vw, 106px);
}
.bay-payout {
  z-index: 10;
  position: absolute;
  transform: translate(-50%,-102%);
  color: #fff0a9;
  text-align: center;
  padding: 12px 22px 15px;
  min-width: 108px;
  background: url("assets/signal-ledger.webp") center / 100% 100% no-repeat;
  text-shadow: 0 0 9px #b57710, 0 2px 2px #3c230c;
  font: 850 clamp(18px, 4vw, 35px)/1 var(--font-display);
  animation: reward-arrive 570ms cubic-bezier(.23,.77,.37,1.23) both;
  pointer-events: none;
}
@keyframes reward-arrive {
  from { opacity: 0; transform: translate(-50%,-52%) scale(.55); }
  to { opacity: 1; transform: translate(-50%,-102%) scale(1); }
}
.payout-token {
  position: absolute;
  z-index: 12;
  width: clamp(19px, 4vw, 28px);
  aspect-ratio: 1;
  background: url("series/assets/paper-controls/tokens.webp") center / contain no-repeat;
  filter: drop-shadow(0 0 6px #ffca62);
  pointer-events: none;
}
@media (max-width: 600px) {
  .station .viewport { height: max(439px, calc(100dvh - 198px)); }
  .station .blast-map-instruments { inset: 3px auto auto 3px; padding: 6px 8px; width: calc(100% - 111px); }
  .station .map-objective, .station #entry-step, .station #status-message { font-size: 11px; }
  .station .blast-map-timer { inset-inline-end: 4px; }
  .station .station-switch, .station .turn-stake > summary { padding-inline: 8px; }
  .station #door-control { min-height: 49px; }
}
@media (prefers-reduced-motion: reduce) {
  .station :is(.visual-warning,.blast-map-timer,.bay-payout) { animation: none !important; }
}
.app[data-motion="off"] :is(.visual-warning,.blast-map-timer,.bay-payout) { animation: none !important; }

#stage.station:not(.fallback) {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  block-size: 100dvh;
}
#stage.station:not(.fallback) :is(#game-sheet, #station-flight) { min-height: 0; }
#stage.station:not(.fallback) #game-sheet { width: 100%; overflow: auto; }
#stage.station:not(.fallback) .viewport { height: 100%; min-height: 0; }
.station:not(.fallback) :is(#station-flight > .station-deck, #station-flight > .stage-footer, .flight-rail > .airlock-controls) {
  position: absolute;
  inset-inline: 0;
  z-index: 10;
  border: 0;
  background: transparent;
}
.station:not(.fallback) .flight-rail > .airlock-controls {
  bottom: 102px;
  justify-content: center;
  text-align: center;
  padding-inline: 68px;
  pointer-events: none;
}
.station:not(.fallback) .flight-rail .launch-command { pointer-events: auto; }
.station:not(.fallback) #station-flight > .station-deck {
  bottom: 47px;
  pointer-events: none;
}
.station:not(.fallback) .station-deck :is(.station-selectors, .turn-stake) { pointer-events: auto; }
.station:not(.fallback) #station-flight > .stage-footer { bottom: 0; }
.station:not(.fallback) #station-flight > .room-list:not([hidden]) {
  position: absolute;
  inset: auto clamp(10px,5vw,60px) 114px;
  z-index: 13;
  max-height: min(55dvh,400px);
  overflow: auto;
  background: #11262bf5 url("assets/signal-ledger.webp") center / 100% 100% no-repeat;
  padding: 23px clamp(14px,5vw,54px);
}
.station #station-flight > .station-deck .turn-stake[open] {
  background: #132426 url("assets/signal-ledger.webp") center / 100% 100% no-repeat;
  padding: 10px;
}
.station #station-flight > .station-deck .station-switch {
  background: url("assets/signal-ledger.webp") center / 100% 100% no-repeat;
  color: #fff0bb;
}
.station #station-flight > .station-deck .turn-stake > summary {
  color: #fff2c8;
  text-shadow: 0 1px 3px #111;
  background: url("assets/signal-ledger.webp") center / 100% 100% no-repeat;
}
.station .blast-map-timer[data-result="lost"]::after {
  content: "";
  position: absolute;
  width: 23px;
  height: 23px;
  inset: auto 7% 17% auto;
  background: url("assets/bay-beacon.webp") center / contain no-repeat;
  filter: drop-shadow(0 0 4px #ff684f);
}
.station .station-action:not(:disabled) {
  background: transparent url("assets/hatch-handle.webp") center / 100% 100% no-repeat;
  border: 0;
  padding-inline: 25px;
  text-shadow: 0 1px 1px #e9a75b;
}
@media (max-width: 650px) {
  .station:not(.fallback) .flight-rail > .airlock-controls { padding-inline: 14px; }
  .station-deck .station-switch { min-width: 72px; }
}

.station .blast-map-timer.on-platform {
  inset-inline-end: auto;
  width: clamp(92px, 12vw, 131px);
  transform: translate(-50%, -18%);
  --clock-position: translate(-50%, -18%);
}
@keyframes clock-alarm {
  0%,100% { transform: var(--clock-position,translate(0,0)) scale(1); filter: drop-shadow(0 2px 6px #d55b23a0); }
  43% { transform: var(--clock-position,translate(0,0)) scale(1.1); filter: drop-shadow(0 2px 14px #fc722dae); }
}
.station .blast-map-instruments {
  width: max-content;
  max-width: calc(100% - 15px);
  border: 0;
  background: none;
  filter: drop-shadow(0 2px 3px #08131e);
}
.station .map-context {
  min-width: 0;
  padding: 3px 0;
  color: #f6deb2;
}
.station .blast-map-instruments :is(.map-objective,#entry-step,#status-message:not([data-tone="error"])) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.station :is(#reveal-count,.lost-rooms li) {
  text-shadow: 0 1px 3px #101923;
}
.station .lost-rooms li {
  background: transparent url("assets/signal-ledger.webp") center / 100% 100% no-repeat;
  border: 0;
  padding: 7px 10px;
}
.station .station-telemetry {
  filter: drop-shadow(0 2px 3px #101923);
}
@media (max-width: 440px) {
  .station .blast-map-instruments .map-context { gap: 5px; }
  .station .blast-map-timer.on-platform { transform: translate(-50%, -14%); --clock-position: translate(-50%, -14%); }
}
.station .blast-map-timer { pointer-events: none; }

.station #station-flight:has(.viewport[data-clock]:not([data-clock="ready"])) #entry-step:not([hidden]),
.station .blast-map-instruments #entry-step:not([hidden]) {
  display: block;
  position: static;
  width: auto;
  height: auto;
  margin: .18em 0 0;
  color: #f6eacd;
  font-size: .8rem;
  white-space: normal;
  clip-path: none;
}
.station #door-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  width: clamp(126px, 32vw, 174px);
  max-width: calc(100% - 10px);
  min-height: 54px;
  padding: 9px 17px 7px;
  color: #fff1cf;
  background-size: 100% 100%;
  text-transform: none;
  line-height: 1.1;
  white-space: normal;
  overflow-wrap: anywhere;
}
.station #door-control .hatch-caption {
  display: grid;
  gap: 2px;
  min-width: 0;
  max-width: 100%;
  margin-block-start: 2px;
  padding: 3px 7px;
  border: 1px solid #f0bd657d;
  border-radius: 5px;
  background: #2c2014;
  box-shadow: 0 1px 3px #140c08aa;
  text-align: center;
}
.station #door-control strong { font-size: max(12px, .96em); font-weight: 850; }
.station #door-control small { color: #ffdc8f; font-size: 11px; font-weight: 740; font-variant-numeric: tabular-nums; }
.station :is(.station-switch,.turn-stake > summary,.map-button,.station-action) {
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
}
.station #station-flight .station-switch[aria-pressed="true"] {
  color: #fff5d4;
  box-shadow: inset 0 -3px #f6d493;
}
.station .room-marker {
  grid-template-columns: auto minmax(0,1fr);
  padding-inline: 3px;
}
.station .room-marker small {
  justify-self: center;
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: clamp(8px,2.25vw,11px);
  line-height: 1.12;
}
@media (max-width: 564px) {
  .station[data-view="map"] .room-marker {
    width: clamp(47px, 14vw, 56px);
    gap: 0 2px;
  }
}
@media (max-width: 650px) {
  .station .stage-footer {
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    align-items: stretch;
  }
  .station .stage-footer .camera-hint { display: none; }
  .station .stage-footer .map-button {
    min-width: 0;
    padding: 4px;
    text-align: center;
  }
  .station #station-flight > .station-deck {
    display: grid;
    grid-template-columns: minmax(0,1.35fr) minmax(0,1fr);
    align-items: end;
    gap: 7px;
  }
  .station #station-flight > .station-deck .station-selectors {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 4px;
  }
  .station #station-flight > .station-deck .station-switch {
    min-width: 0;
    min-height: 48px;
    padding: 5px 10px;
  }
  .station #station-flight > .station-deck .turn-stake { min-width: 0; }
  .station #station-flight > .station-deck .turn-stake > summary {
    justify-content: center;
    flex-wrap: wrap;
    gap: 2px 5px;
    min-height: 48px;
    padding: 4px 8px;
    text-align: center;
  }
  .station #station-flight > .station-deck .turn-stake:not([open]) .stake-edit { display: none; }
  .station #station-flight > .station-deck .turn-stake[open] {
    grid-column: 1 / -1;
    grid-row: 1;
    width: min(100%, 370px);
    justify-self: end;
  }
}
.station #door-control { transform: translate(-50%, -100%); }
.station #door-control:active { transform: translate(-50%, -96%) scale(.97); }

.station .blast-map-timer.on-platform #clock-label {
  max-width: 62px;
  line-height: 1.04;
}

#panel-settings {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}
#panel-settings .tool {
  min-width: 0;
  padding-inline: 8px;
  color: #fff0bb;
  background: #19343b url("assets/signal-ledger.webp") center / 100% 100% no-repeat;
  line-height: 1.25;
}
#panel-settings .tool[aria-pressed="true"] { box-shadow: inset 0 -3px #abd7ab; }

.station .charge-adjustment #stake-done {
  width: 100%;
  margin-top: 6px;
  color: #fff1ba;
  background: url("assets/signal-ledger.webp") center / 100% 100% no-repeat;
}
.station .turn-stake:not([open]) .charge-adjustment { display: none; }
.station:not(.fallback) #station-flight > .station-deck .turn-stake[open] {
  position: absolute;
  inset: auto clamp(8px, 3vw, 38px) 192px auto;
  width: min(370px, calc(100% - 16px));
  z-index: 14;
}

#stage.fallback #round-status {
  position: static;
  width: 100%;
  max-width: none;
  min-height: 0;
  margin: 0;
  padding: 5px 11px 6px;
}

@media (max-width: 650px), (max-width: 980px) and (max-height: 520px) and (orientation: landscape) {
  #stage.station:not(.fallback) #station-flight {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto auto auto;
    min-height: 0;
  }
  #stage.station:not(.fallback) #round-status {
    position: static;
    width: 100%;
    max-width: none;
    min-height: 0;
    margin: 0;
    padding: 5px 11px 6px;
  }
  #stage .lost-rooms li { padding: 4px 7px; }
  #stage.station:not(.fallback) .viewport { height: auto; min-height: 0; }
  #stage.station:not(.fallback) .flight-rail {
    display: grid;
    grid-template: "command clock" minmax(0, 1fr) "telemetry clock" auto / minmax(0, 1fr) 90px;
    align-items: center;
    justify-items: center;
    gap: 0 3px;
    min-height: 86px;
    padding: 2px 7px 3px;
  }
  #stage.station:not(.fallback) .flight-rail > .airlock-controls { display: contents; }
  #stage .flight-rail .launch-command, #stage .flight-rail #door-control { grid-area: command; }
  #stage .flight-rail .station-telemetry {
    grid-area: telemetry;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 1px 7px;
    padding: 1px 3px 5px;
  }
  #stage #station-flight .flight-rail #door-control {
    position: static;
    inset: auto;
    transform: none;
    width: clamp(126px, 36vw, 174px);
    max-width: 100%;
  }
  #stage #station-flight .flight-rail #door-control:active { transform: scale(.97); }
  #stage .flight-rail .blast-map-timer {
    position: relative;
    grid-area: clock;
    inset: auto;
    width: 86px;
    padding-inline: 10px;
    transform: none;
    --clock-position: translate(0);
  }
  #stage .flight-rail .blast-map-timer[data-clock="urgent"] { animation: none; }
  #stage.station:not(.fallback) #station-flight > :is(.station-deck, .stage-footer) {
    position: relative;
    inset: auto;
    width: 100%;
  }
  #stage.station:not(.fallback) #station-flight > .station-deck .turn-stake[open] {
    inset: auto 8px calc(100% + 91px) auto;
  }
  #stage.station:not(.fallback) #station-flight > #room-list:not([hidden]) {
    bottom: 98px;
  }
}

@media (max-width: 650px) and (orientation: portrait) {
  #stage.station:not(.fallback) #station-flight > #room-list:not([hidden]) {
    grid-area: 2 / 1 / 3 / 2;
    inset: 4px 8px;
    align-content: safe center;
    max-height: none;
    padding: 10px 12px;
  }
  #stage .room-list button { min-height: 54px; }
  #stage .room-list button img { width: 25px; height: 20px; }
}

@media (min-width: 651px) {
  #stage[data-view="cabin"] #station-flight #door-control {
    inset: auto clamp(24px, 7vw, 118px) 142px auto;
    transform: none;
  }
  #stage[data-view="cabin"] #station-flight #door-control:active { transform: scale(.97); }
}

@media (max-width: 980px) and (max-height: 520px) and (orientation: landscape) {
  #stage.station:not(.fallback) #station-flight {
    grid-template:
      "readout ready" auto
      "map deck" minmax(0, 1fr)
      "map tools" auto
      / minmax(0, 1fr) clamp(188px, 33vw, 225px);
  }
  #stage #round-status { grid-area: readout; }
  #stage .viewport { grid-area: map; }
  #stage.station:not(.fallback) .flight-rail {
    grid-area: ready;
    grid-template: "command clock" minmax(0, 1fr) "telemetry clock" auto / minmax(0, 1fr) 82px;
    min-height: 82px;
  }
  #stage .flight-rail .blast-map-timer { width: 80px; padding-inline: 7px; }
  #stage .flight-rail .station-telemetry { font-size: .72rem; line-height: 1.18; }
  #stage .flight-rail #personal-status { font-size: clamp(15px, 2.55vw, 21px); white-space: nowrap; }
  #stage .flight-rail .launch-command { min-width: 0; width: 100%; }
  #stage .flight-rail #main-action {
    width: 100%;
    padding: 5px 9px;
    font-size: .85rem;
    overflow-wrap: normal;
  }
  #stage[data-view="cabin"] #station-flight #door-control { position: static; inset: auto; transform: none; }
  #stage #station-flight .flight-rail #door-control { min-height: 48px; padding: 5px 9px 7px; }
  #stage #station-flight > .station-deck {
    grid-area: deck;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-content: center;
    gap: 5px;
    padding: 2px 6px;
  }
  #stage #station-flight > .station-deck .station-selectors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #stage #station-flight > .station-deck :is(.station-switch, .turn-stake > summary) { min-width: 0; padding-inline: 5px; }
  #stage #station-flight > .station-deck .turn-stake > summary { justify-content: center; }
  #stage.station:not(.fallback) #station-flight > .station-deck .turn-stake[open] {
    position: fixed;
    inset: 50% calc(clamp(188px, 33vw, 225px) + 8px) auto auto;
    width: min(320px, calc(70vw - 18px));
    max-height: calc(100dvh - 26px);
    transform: translateY(-50%);
    overflow: auto;
  }
  #stage .stage-footer {
    grid-area: tools;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding-inline: 6px;
  }
  #stage .stage-footer .camera-hint { display: none; }
  #stage .stage-footer .map-button { padding: 4px 2px; }
  #stage.station:not(.fallback) #station-flight > #room-list:not([hidden]) {
    inset: auto calc(clamp(188px, 33vw, 225px) + 8px) 6px 8px;
    max-height: min(65dvh, 400px);
    padding: 12px;
  }
  #stage .room-list button {
    grid-template: "portrait name" auto "portrait status" auto / auto minmax(0, 1fr);
    justify-items: start;
    column-gap: 5px;
    min-height: 54px;
    text-align: start;
  }
  #stage .room-list button img { grid-area: portrait; }
  #stage .room-list-name { grid-area: name; }
  #stage .room-list-status { grid-area: status; }
}

@media (max-width: 650px) and (max-height: 360px) and (orientation: landscape) {
  #stage .room-marker { width: 47px; height: 38px; padding-inline: 2px; }
  #stage.station:not(.fallback) .room-marker.safe { width: 54px; }
  #stage .room-marker :is(b, strong) { font-size: 10px; }
  #stage .room-marker small { display: none; }
}
