/* The same game link uses this layout only on the mobile interface. */
:where(html[data-interface="mobile"]) {
  --mobile-safe-top: env(safe-area-inset-top, 0px);
  --mobile-safe-right: env(safe-area-inset-right, 0px);
  --mobile-safe-bottom: env(safe-area-inset-bottom, 0px);
  --mobile-safe-left: env(safe-area-inset-left, 0px);
  --mobile-order-top: calc(36px + var(--mobile-safe-top));
  --mobile-order-height: 80px;
}

:where(html[data-interface="mobile"]) #game {
  height: 100dvh;
  min-height: 0;
}

/* A single status line and order strip leave the floor open. */
:where(html[data-interface="mobile"]) body.playing .topbar {
  top: var(--mobile-safe-top);
  left: var(--mobile-safe-left);
  right: var(--mobile-safe-right);
  height: 34px;
  padding: 2px 8px;
  background: none;
  pointer-events: none;
}

:where(html[data-interface="mobile"]) body.playing .topbar .brand,
:where(html[data-interface="mobile"]) body.playing .shift-heading,
:where(html[data-interface="mobile"]) body.playing .rfq-label {
  display: none;
}

:where(html[data-interface="mobile"]) body.playing .top-actions {
  gap: 5px;
  pointer-events: auto;
}

:where(html[data-interface="mobile"]) body.playing .icon-button {
  width: 32px;
  height: 32px;
  font-size: 17px;
  background: #102e37e8;
}

:where(html[data-interface="mobile"]) body.playing #live-hud {
  top: calc(3px + var(--mobile-safe-top));
  right: calc(84px + var(--mobile-safe-right));
  bottom: auto;
  left: calc(8px + var(--mobile-safe-left));
  width: auto;
  height: 30px;
  z-index: 24;
}

:where(html[data-interface="mobile"]) body.playing .status-row {
  height: 30px;
  margin: 0;
  justify-content: flex-start;
}

:where(html[data-interface="mobile"]) body.playing .scoreboard {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 3px 7px;
  border-radius: 7px;
  background: #0b2530e6;
}

:where(html[data-interface="mobile"]) body.playing .scoreboard > span {
  flex-direction: row;
  align-items: center;
  gap: 4px;
}

:where(html[data-interface="mobile"]) body.playing .scoreboard small,
:where(html[data-interface="mobile"]) body.playing #shipment-progress small {
  font-size: 10px;
  line-height: 16px;
  letter-spacing: 0;
  white-space: nowrap;
}

:where(html[data-interface="mobile"]) body.playing .scoreboard b {
  font-size: 15px;
  line-height: 20px;
  white-space: nowrap;
}

:where(html[data-interface="mobile"]) #shop-sidebar {
  display: contents;
}

:where(html[data-interface="mobile"]) #shop-sidebar .order-list-heading,
:where(html[data-interface="mobile"]) #shop-sidebar .ticket-select {
  display: none;
}

:where(html[data-interface="mobile"]) #shop-sidebar #orders {
  position: absolute;
  top: var(--mobile-order-top);
  right: calc(8px + var(--mobile-safe-right));
  bottom: auto;
  left: calc(8px + var(--mobile-safe-left));
  width: auto;
  height: var(--mobile-order-height);
  min-height: 0;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 7px;
  padding: 0 0 3px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  scrollbar-gutter: auto;
  scroll-snap-type: x proximity;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
  pointer-events: auto;
  z-index: 12;
}

:where(html[data-interface="mobile"]) #shop-sidebar #orders::-webkit-scrollbar {
  display: none;
}

:where(html[data-interface="mobile"]) #shop-sidebar #orders .order-ticket,
:where(html[data-interface="mobile"]) #shop-sidebar #orders .order-ticket.long-route {
  flex: 0 0 226px;
  width: 226px;
  height: 77px;
  min-height: 0;
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 7px 5px;
  border-radius: 6px;
  box-shadow: 0 3px 8px #00172133;
  scroll-snap-align: start;
}

:where(html[data-interface="mobile"]) #shop-sidebar #orders .order-ticket.long-route {
  flex-basis: auto;
  width: max-content;
  min-width: 352px;
}

:where(html[data-interface="mobile"]) #shop-sidebar .order-ticket.long-route .route {
  width: max-content;
  flex-shrink: 0;
}

:where(html[data-interface="mobile"]) #shop-sidebar .order-ticket.long-route .route-step {
  flex-shrink: 0;
}

:where(html[data-interface="mobile"]) #shop-sidebar .order-ticket::after {
  display: none;
}

:where(html[data-interface="mobile"]) #shop-sidebar .ticket-top {
  flex: 0 0 auto;
  margin: 0;
  font-size: 12px;
  line-height: 14px;
}

:where(html[data-interface="mobile"]) #shop-sidebar .ticket-heading {
  height: 20px;
  min-height: 20px;
  margin: 0;
  gap: 5px;
}

:where(html[data-interface="mobile"]) #shop-sidebar .order-ticket h3 {
  margin: 0;
  font-size: 13px;
  line-height: 17px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

:where(html[data-interface="mobile"]) #shop-sidebar .stock-icon {
  width: 20px;
  height: 20px;
}

:where(html[data-interface="mobile"]) #shop-sidebar .stock-pictogram {
  width: 19px;
  height: 19px;
}

:where(html[data-interface="mobile"]) #shop-sidebar .technology-badges {
  gap: 3px;
}

:where(html[data-interface="mobile"]) #shop-sidebar .technology-badge {
  width: 21px;
  height: 21px;
  border-radius: 4px;
}

:where(html[data-interface="mobile"]) #shop-sidebar .technology-icon {
  width: 17px;
  height: 17px;
}

:where(html[data-interface="mobile"]) #shop-sidebar .route {
  flex-wrap: nowrap;
  gap: 2px;
  margin: 0;
  min-height: 18px;
}

:where(html[data-interface="mobile"]) #shop-sidebar .route-step {
  padding: 2px 3px;
  font-size: 12px;
  line-height: 14px;
  border-radius: 3px;
}

:where(html[data-interface="mobile"]) #shop-sidebar .route-arrow {
  font-size: 12px;
  line-height: 14px;
}

:where(html[data-interface="mobile"]) #shop-sidebar .rush-status {
  position: static;
  margin: 0;
  padding: 0;
  background: none;
  font-size: 12px;
  line-height: 14px;
}

:where(html[data-interface="mobile"]) #shop-sidebar #orders .order-ticket.rush-ticket {
  gap: 1px;
  padding-top: 4px;
  padding-bottom: 4px;
}

:where(html[data-interface="mobile"]) #shop-sidebar .rush-ticket .ticket-heading {
  height: 18px;
  min-height: 18px;
}

:where(html[data-interface="mobile"]) #shop-sidebar .rush-ticket .technology-badge,
:where(html[data-interface="mobile"]) #shop-sidebar .rush-ticket .stock-icon {
  height: 18px;
}

:where(html[data-interface="mobile"]) #shop-sidebar .rush-ticket .route {
  min-height: 16px;
}

:where(html[data-interface="mobile"]) #shop-sidebar .rush-ticket .route-step {
  padding-block: 1px;
}

:where(html[data-interface="mobile"]) #shop-sidebar .orders-empty {
  height: 77px;
  min-width: 226px;
  padding: 20px 12px;
  font-size: 13px;
}

/* The optional order grows only when it needs a decision or collection. */
:where(html[data-interface="mobile"]) #shop-sidebar #orders:has(.source-card:not([hidden]) #source-accept:not([hidden])) {
  height: 132px;
}

:where(html[data-interface="mobile"]) #shop-sidebar #orders:has(.source-card:not([hidden]) #source-collect:not([hidden])) {
  height: 150px;
}

:where(html[data-interface="mobile"]) #shop-sidebar #orders .source-card {
  flex: 0 0 286px;
  width: 286px;
  height: 77px;
  min-height: 0;
  align-self: flex-start;
  gap: 3px;
  padding: 5px 8px;
  overflow: hidden;
  scroll-snap-align: start;
}

:where(html[data-interface="mobile"]) #shop-sidebar #orders .source-card:has(#source-accept:not([hidden])) {
  height: 129px;
}

:where(html[data-interface="mobile"]) #shop-sidebar #orders .source-card:has(#source-collect:not([hidden])) {
  height: 147px;
}

:where(html[data-interface="mobile"]) #shop-sidebar .source-card > .source-ticket-top {
  font-size: 12px;
  line-height: 14px;
}

:where(html[data-interface="mobile"]) #shop-sidebar .source-card > .source-heading {
  min-height: 23px;
  gap: 5px;
}

:where(html[data-interface="mobile"]) #shop-sidebar .source-card .source-heading > strong {
  font-size: 13px;
  line-height: 16px;
}

:where(html[data-interface="mobile"]) #shop-sidebar .source-card > small,
:where(html[data-interface="mobile"]) #shop-sidebar .source-card #source-partner {
  font-size: 12px;
  line-height: 15px;
  letter-spacing: 0;
  min-height: 15px;
}

:where(html[data-interface="mobile"]) #shop-sidebar .source-card .technology-badge {
  width: auto;
  height: 23px;
  padding: 2px 4px;
  gap: 3px;
}

:where(html[data-interface="mobile"]) #shop-sidebar .source-card .technology-code {
  font-size: 12px;
}

:where(html[data-interface="mobile"]) #shop-sidebar .source-card .source-actions {
  gap: 6px;
  margin-top: auto;
}

:where(html[data-interface="mobile"]) #shop-sidebar .source-card button,
:where(html[data-interface="mobile"]) #shop-sidebar .source-card #source-accept,
:where(html[data-interface="mobile"]) #shop-sidebar .source-card.delivered #source-collect {
  min-height: 44px;
  padding: 5px 7px;
  font-size: 12px;
  line-height: 15px;
}

:where(html[data-interface="mobile"]) #shop-sidebar .source-card .route,
:where(html[data-interface="mobile"]) #shop-sidebar .source-card.delivered .route {
  gap: 3px;
  margin: 0;
}

:where(html[data-interface="mobile"]) #shop-sidebar .source-card .route-step,
:where(html[data-interface="mobile"]) #shop-sidebar .source-card.delivered .route-step {
  font-size: 12px;
  line-height: 14px;
  padding: 2px 3px;
}

/* Calls need a response, but the rest of the bottom edge stays open. */
:where(html[data-interface="mobile"]) #shop-sidebar #game-footer {
  position: absolute;
  right: calc(12px + var(--mobile-safe-right));
  bottom: calc(62px + var(--mobile-safe-bottom));
  left: calc(12px + var(--mobile-safe-left));
  width: auto;
  margin: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: none;
  pointer-events: none;
  z-index: 16;
}

:where(html[data-interface="mobile"]) #shop-sidebar .office-panel {
  flex: 0 1 640px;
  width: auto;
  max-width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  background: #102e37f5;
}

:where(html[data-interface="mobile"]) #shop-sidebar .office-panel strong,
:where(html[data-interface="mobile"]) #shop-sidebar .office-panel span {
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0;
}

:where(html[data-interface="mobile"]) #shop-sidebar .office-panel strong {
  margin-bottom: 2px;
}

:where(html[data-interface="mobile"]) #shop-sidebar .office-actions {
  flex-direction: row;
  gap: 6px;
  max-width: none;
}

:where(html[data-interface="mobile"]) #shop-sidebar .office-actions button {
  min-height: 44px;
  padding: 6px 9px;
  font-size: 12px;
  line-height: 15px;
}

:where(html[data-interface="mobile"]) #mobile-tap-hint {
  position: absolute;
  right: calc(12px + var(--mobile-safe-right));
  bottom: calc(20px + var(--mobile-safe-bottom));
  left: calc(128px + var(--mobile-safe-left));
  z-index: 14;
  margin: 0;
  color: #e1eee7;
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
  text-shadow: 0 1px 4px #09222c;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

:where(html[data-interface="mobile"]) body:not(.playing) #mobile-tap-hint,
:where(html[data-interface="mobile"]) body:has(#overlay:not([hidden])) #mobile-tap-hint {
  display: none;
}

:where(html[data-interface="mobile"]) #shop-sidebar .action-controls,
:where(html[data-interface="mobile"]) #shop-sidebar .carry-panel,
:where(html[data-interface="mobile"]) #shop-sidebar .interaction-hint,
:where(html[data-interface="mobile"]) .keyboard-guide,
:where(html[data-interface="mobile"]) .quick-controls,
:where(html[data-interface="mobile"]) .help-keys,
:where(html[data-interface="mobile"]) .floor-caption {
  display: none;
}

/* Idle labels stop competing with the part, route, and next station. */
:where(html[data-interface="mobile"]) body.playing .station-label:not(.target):not(.nearby):not(.ready):not(.busy) {
  display: none;
}

:where(html[data-interface="mobile"]) body.playing .station-label,
:where(html[data-interface="mobile"]) body.playing .station-label.stock-label {
  min-height: 34px;
  padding: 7px 6px;
  gap: 4px;
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0;
  background: #122f39ed;
}

:where(html[data-interface="mobile"]) body.playing .station-label.ready {
  background: #146b5bf2;
}

:where(html[data-interface="mobile"]) body.playing .station-label .station-time {
  font-size: 12px;
  line-height: 16px;
}

:where(html[data-interface="mobile"]) body.playing .stock-label .stock-pictogram {
  width: 17px;
  height: 17px;
}

:where(html[data-interface="mobile"]) #carried-job {
  font-size: 12px;
}

:where(html[data-interface="mobile"]) body.playing #coach {
  top: calc(var(--mobile-order-top) + var(--mobile-order-height) + 6px);
  right: auto;
  bottom: auto;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(480px, calc(100vw - 32px));
  padding: 6px 10px;
  pointer-events: none;
}

:where(html[data-interface="mobile"]) #coach .coach-number,
:where(html[data-interface="mobile"]) #coach small {
  display: none;
}

:where(html[data-interface="mobile"]) #coach strong {
  font-size: 12px;
  line-height: 16px;
}

:where(html[data-interface="mobile"]) #toast,
:where(html[data-interface="mobile"]) body.has-office #toast {
  left: 50%;
  bottom: calc(34px + var(--mobile-safe-bottom));
  width: max-content;
  max-width: min(520px, calc(100vw - 32px));
  padding: 8px 12px;
  font-size: 12px;
  line-height: 17px;
}

/* Mobile menus use a quiet solid surface, without any shop bleeding through. */
:where(html[data-interface="mobile"]) #overlay,
:where(html[data-interface="mobile"]) #overlay.centered {
  background: #12343b;
  backdrop-filter: none;
}

:where(html[data-interface="mobile"]) #overlay:not(.centered) {
  align-items: flex-start;
  justify-content: center;
}

:where(html[data-interface="mobile"]) body:has(#overlay:not([hidden])) #scene,
:where(html[data-interface="mobile"]) body:has(#overlay:not([hidden])) #station-labels,
:where(html[data-interface="mobile"]) body:has(#overlay:not([hidden])) #carried-job,
:where(html[data-interface="mobile"]) body:has(#overlay:not([hidden])) #floating-text,
:where(html[data-interface="mobile"]) body:has(#overlay:not([hidden])) .grain {
  visibility: hidden;
}

:where(html[data-interface="mobile"]) body:not(.playing) .topbar {
  height: calc(68px + var(--mobile-safe-top));
  padding-top: calc(12px + var(--mobile-safe-top));
  padding-right: calc(16px + var(--mobile-safe-right));
  padding-left: calc(16px + var(--mobile-safe-left));
  background: #12343b;
}

:where(html[data-interface="mobile"]) body:not(.playing) .icon-button {
  width: 44px;
  height: 44px;
}

:where(html[data-interface="mobile"]) .welcome-panel {
  width: min(560px, calc(100% - 40px - var(--mobile-safe-left) - var(--mobile-safe-right)));
  max-height: calc(100dvh - 96px - var(--mobile-safe-top) - var(--mobile-safe-bottom));
  margin: calc(80px + var(--mobile-safe-top)) 0 calc(16px + var(--mobile-safe-bottom));
  overflow: visible;
}

:where(html[data-interface="mobile"]) .welcome-panel .role-setup {
  background: #12343b;
}

:where(html[data-interface="mobile"]) .welcome-panel #start-button {
  min-height: 48px;
}

:where(html[data-interface="mobile"]) .welcome-panel .shift-picker {
  flex-direction: column;
  gap: 7px;
}

:where(html[data-interface="mobile"]) .welcome-panel .shift-choice {
  min-height: 62px;
  width: 100%;
  display: flex;
  align-items: center;
  padding: 11px 12px;
  background: #1a4047;
}

:where(html[data-interface="mobile"]) .welcome-panel .shift-choice.selected {
  background: #28534f;
}

:where(html[data-interface="mobile"]) .welcome-panel .shift-choice:disabled {
  opacity: 1;
  color: #c6d5ce;
  border-color: #49666b;
  background: #16343d;
}

:where(html[data-interface="mobile"]) .welcome-panel .shift-choice b {
  font-size: 14px;
  margin-top: 0;
}

:where(html[data-interface="mobile"]) .welcome-panel .shift-choice small {
  display: block;
  font-size: 12px;
  line-height: 1.4;
  color: #b4cbc6;
}

:where(html[data-interface="mobile"]) .welcome-panel .shift-choice .num {
  font-size: 16px;
}

:where(html[data-interface="mobile"]) .welcome-panel .shift-choice .pick-mark {
  display: block;
}

:where(html[data-interface="mobile"]) .welcome-panel .home-board {
  position: static;
  width: 100%;
  max-height: none;
  margin-top: 18px;
  padding: 16px;
  background: #102d36;
}

:where(html[data-interface="mobile"]) .modal-panel {
  max-height: calc(100dvh - 24px - var(--mobile-safe-top) - var(--mobile-safe-bottom));
  background: #173c44;
  overscroll-behavior: contain;
}

:where(html[data-interface="mobile"]) body:has(#office-panel:not([hidden])) #toast {
  bottom: calc(152px + var(--mobile-safe-bottom));
}

@media (orientation: portrait) {
  :where(html[data-interface="mobile"]) #shop-sidebar #game-footer {
    bottom: calc(62px + var(--mobile-safe-bottom));
  }

  :where(html[data-interface="mobile"]) #shop-sidebar .office-panel {
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
  }

  :where(html[data-interface="mobile"]) #shop-sidebar .office-actions {
    justify-content: flex-end;
    flex-shrink: 1;
  }

  :where(html[data-interface="mobile"]) #shop-sidebar .office-actions button {
    flex: 1;
  }


}

@media (orientation: landscape) {
  :where(html[data-interface="mobile"]) #shop-sidebar #orders .order-ticket {
    flex-basis: 226px;
    width: 226px;
  }

  :where(html[data-interface="mobile"]) #shop-sidebar #orders .order-ticket.long-route {
    flex-basis: auto;
    width: max-content;
    min-width: 352px;
  }

  :where(html[data-interface="mobile"]) #shop-sidebar #game-footer {
    left: calc(12px + var(--mobile-safe-left));
    right: calc(12px + var(--mobile-safe-right));
    bottom: calc(62px + var(--mobile-safe-bottom));
  }

  :where(html[data-interface="mobile"]) #shop-sidebar .office-panel {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
  }

  :where(html[data-interface="mobile"]) #shop-sidebar .office-actions {
    justify-content: flex-end;
    flex-shrink: 1;
  }

  :where(html[data-interface="mobile"]) #shop-sidebar .office-actions button {
    flex: 1;
  }

  :where(html[data-interface="mobile"]) .welcome-panel {
    margin-top: calc(74px + var(--mobile-safe-top));
    max-height: calc(100dvh - 90px - var(--mobile-safe-top) - var(--mobile-safe-bottom));
  }
}

@media (max-width: 360px) {
  :where(html[data-interface="mobile"]) body.playing .scoreboard {
    gap: 8px;
    padding-inline: 5px;
  }

  :where(html[data-interface="mobile"]) body.playing .scoreboard > span:nth-child(2) small {
    display: none;
  }

  :where(html[data-interface="mobile"]) body.playing .scoreboard b {
    font-size: 14px;
  }
}

/* Phones use the full landscape shop; portrait is a solid rotate prompt. */
#phone-rotate-screen {
  display: none;
}

@media (orientation: portrait) {
  :where(html[data-phone="true"]) #game > :not(#phone-rotate-screen),
  :where(html[data-phone="true"]) .board-dialog {
    visibility: hidden !important;
    pointer-events: none !important;
  }

  :where(html[data-phone="true"]) #phone-rotate-screen,
  :where(html[data-phone="true"]) #phone-rotate-screen[hidden] {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex !important;
    visibility: visible;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: calc(32px + var(--mobile-safe-top)) calc(26px + var(--mobile-safe-right)) calc(32px + var(--mobile-safe-bottom)) calc(26px + var(--mobile-safe-left));
    background: #12343b;
    color: #f5f0db;
    text-align: center;
    pointer-events: auto;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  :where(html[data-phone="true"]) #phone-rotate-screen .rotate-device {
    display: block;
    position: relative;
    width: 106px;
    height: 63px;
    margin: 22px 0 37px;
    border: 4px solid #65dec9;
    border-radius: 13px;
    color: #65dec9;
    flex-shrink: 0;
  }

  :where(html[data-phone="true"]) #phone-rotate-screen .rotate-device::before {
    content: '';
    position: absolute;
    top: 17px;
    bottom: 17px;
    left: 6px;
    width: 3px;
    border-radius: 3px;
    background: #65dec9;
  }

  :where(html[data-phone="true"]) #phone-rotate-screen .rotate-device::after {
    content: '↻';
    position: absolute;
    top: -37px;
    right: -28px;
    color: #ffd36e;
    font-size: 47px;
    font-weight: 700;
    line-height: 1;
  }

  :where(html[data-phone="true"]) #phone-rotate-screen .eyebrow {
    margin: 0 0 14px;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.5;
    letter-spacing: 1.8px;
    color: #65dec9;
  }

  :where(html[data-phone="true"]) #phone-rotate-screen h1 {
    max-width: 340px;
    margin: 0 0 18px;
    font-size: clamp(30px, 8vw, 42px);
    font-weight: 900;
    line-height: 1.08;
    letter-spacing: -1.2px;
  }

  :where(html[data-phone="true"]) #phone-rotate-screen > p:not(.eyebrow) {
    max-width: 320px;
    margin: 0;
    color: #bad0ca;
    font-size: 16px;
    line-height: 1.6;
  }

  :where(html[data-phone="true"]) #phone-rotate-screen #phone-rotate-status:not(:empty) {
    margin-top: 18px;
    color: #ffd36e;
    font-size: 14px;
  }
}

/* A phone in landscape uses a narrow order rail beside the shop. */
@media (orientation: landscape) {
  :where(html[data-interface="mobile"][data-phone="true"]) body.playing #shop-sidebar {
    position: absolute;
    top: calc(38px + var(--mobile-safe-top));
    bottom: calc(62px + var(--mobile-safe-bottom));
    left: calc(8px + var(--mobile-safe-left));
    right: auto;
    width: 200px;
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 0;
    pointer-events: none;
    z-index: 12;
  }

  :where(html[data-interface="mobile"][data-phone="true"]) #shop-sidebar #orders,
  :where(html[data-interface="mobile"][data-phone="true"]) #shop-sidebar #orders:has(.source-card:not([hidden]) #source-accept:not([hidden])),
  :where(html[data-interface="mobile"][data-phone="true"]) #shop-sidebar #orders:has(.source-card:not([hidden]) #source-collect:not([hidden])) {
    position: relative;
    inset: auto;
    width: 100%;
    height: auto;
    min-height: 0;
    flex: 1 1 0;
    flex-direction: column;
    align-items: stretch;
    gap: 7px;
    padding: 2px 4px 5px 2px;
    overflow-x: hidden;
    overflow-y: auto;
    scroll-snap-type: none;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
  }

  :where(html[data-interface="mobile"][data-phone="true"]) #shop-sidebar #orders .order-ticket,
  :where(html[data-interface="mobile"][data-phone="true"]) #shop-sidebar #orders .order-ticket.long-route {
    width: 100%;
    min-width: 0;
    height: auto;
    min-height: 98px;
    flex: 0 0 auto;
    gap: 4px;
    padding: 6px 7px 8px;
    scroll-snap-align: none;
  }

  :where(html[data-interface="mobile"][data-phone="true"]) #shop-sidebar #orders .order-ticket.long-route {
    min-height: 118px;
  }

  :where(html[data-interface="mobile"][data-phone="true"]) #shop-sidebar .route,
  :where(html[data-interface="mobile"][data-phone="true"]) #shop-sidebar .order-ticket.long-route .route {
    width: 100%;
    max-width: 100%;
    flex-wrap: wrap;
    row-gap: 3px;
  }

  :where(html[data-interface="mobile"][data-phone="true"]) #shop-sidebar .ticket-status {
    margin-top: 1px;
    font-size: 12px;
    line-height: 15px;
    white-space: normal;
  }

  :where(html[data-interface="mobile"][data-phone="true"]) #shop-sidebar .orders-empty {
    width: 100%;
    min-width: 0;
    height: auto;
    padding: 18px 9px;
  }

  :where(html[data-interface="mobile"][data-phone="true"]) #shop-sidebar #orders .source-card,
  :where(html[data-interface="mobile"][data-phone="true"]) #shop-sidebar #orders .source-card:has(#source-accept:not([hidden])),
  :where(html[data-interface="mobile"][data-phone="true"]) #shop-sidebar #orders .source-card:has(#source-collect:not([hidden])) {
    width: 100%;
    min-width: 0;
    height: auto;
    min-height: 98px;
    flex: 0 0 auto;
    padding: 7px;
    gap: 5px;
    overflow: visible;
  }

  :where(html[data-interface="mobile"][data-phone="true"]) #shop-sidebar .source-card > .source-heading {
    height: auto;
    align-items: flex-start;
  }

  :where(html[data-interface="mobile"][data-phone="true"]) #shop-sidebar .source-card .source-heading > strong {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  :where(html[data-interface="mobile"][data-phone="true"]) #shop-sidebar .source-card .source-actions {
    flex-direction: column;
    align-items: stretch;
    margin-top: 3px;
  }

  :where(html[data-interface="mobile"][data-phone="true"]) #shop-sidebar .source-card .source-actions button {
    width: 100%;
    flex: none;
    min-height: 44px;
  }

  :where(html[data-interface="mobile"][data-phone="true"]) #shop-sidebar #game-footer {
    position: static;
    inset: auto;
    width: 100%;
    height: auto;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: stretch;
    margin: 0;
  }

  :where(html[data-interface="mobile"][data-phone="true"]) #shop-sidebar #game-footer:has(.office-panel:not([hidden])) {
    margin-top: 7px;
  }

  :where(html[data-interface="mobile"][data-phone="true"]) #shop-sidebar #game-footer .office-panel {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex: none;
    flex-direction: column;
    align-items: stretch;
    padding: 7px;
    gap: 5px;
  }

  :where(html[data-interface="mobile"][data-phone="true"]) #shop-sidebar .office-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    flex-shrink: 0;
  }

  :where(html[data-interface="mobile"][data-phone="true"]) #shop-sidebar .office-actions button {
    width: 100%;
    min-height: 44px;
    flex: none;
  }

  :where(html[data-interface="mobile"][data-phone="true"]) body.playing #mobile-tap-hint {
    left: calc(220px + var(--mobile-safe-left));
    right: calc(12px + var(--mobile-safe-right));
  }

  :where(html[data-interface="mobile"][data-phone="true"]) body.playing #coach {
    top: calc(42px + var(--mobile-safe-top));
    left: calc(50% + 110px + var(--mobile-safe-left) / 2 - var(--mobile-safe-right) / 2);
    max-width: calc(100vw - 244px - var(--mobile-safe-left) - var(--mobile-safe-right));
  }

  :where(html[data-interface="mobile"][data-phone="true"]) body.playing #toast,
  :where(html[data-interface="mobile"][data-phone="true"]) body:has(#office-panel:not([hidden])) #toast {
    left: calc(50% + 110px + var(--mobile-safe-left) / 2 - var(--mobile-safe-right) / 2);
    bottom: calc(34px + var(--mobile-safe-bottom));
    max-width: calc(100vw - 244px - var(--mobile-safe-left) - var(--mobile-safe-right));
  }
}


/* One explicit dash control keeps repeated taps from becoming a zoom gesture. */
#mobile-dash {
  display: none;
}

:where(html[data-interface="mobile"]) #scene canvas,
:where(html[data-interface="mobile"]) #station-labels,
:where(html[data-interface="mobile"]) .station-label,
:where(html[data-interface="mobile"]) #mobile-dash {
  touch-action: manipulation;
}

:where(html[data-interface="mobile"]) body.playing #mobile-dash:not([hidden]) {
  position: absolute;
  left: calc(12px + var(--mobile-safe-left));
  right: auto;
  bottom: calc(7px + var(--mobile-safe-bottom));
  z-index: 24;
  width: 100px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 9px 16px 11px;
  border: 1px solid #ffe7a5;
  border-radius: 999px;
  background: #f3d384;
  color: #173039;
  box-shadow: 0 3px 0 #866739, 0 3px 12px #09222c40;
  font-size: 14px;
  font-weight: 800;
  line-height: 20px;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

:where(html[data-interface="mobile"]) body.playing #mobile-dash:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 2px 0 #866739;
}

:where(html[data-interface="mobile"]) body.playing #mobile-dash:not([hidden]):disabled {
  background: #bcb193;
  border-color: #d0c5a7;
  color: #41534f;
  box-shadow: 0 2px 0 #6e654f;
}

:where(html[data-interface="mobile"]) #mobile-dash i {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background: #476c5f;
  pointer-events: none;
  transition: width 80ms linear;
}

:where(html[data-interface="mobile"]) body:not(.playing) #mobile-dash,
:where(html[data-interface="mobile"]) body:has(#overlay:not([hidden])) #mobile-dash {
  display: none;
}
