/* A phone in the hand: readable sizes, targets a thumb can find, a sideways layout that leaves the middle of the view clear. */

/* Walking to a chosen place: the button beside the destination line, and a short note when no way is found. */
#walk-there{position:absolute;z-index:4;min-width:92px;min-height:44px;padding:6px 16px;border:1px solid #d9c58d;border-radius:23px;background:#efe4c6;color:#1e2a26;font:600 .95rem/1.2 var(--cabin-type,sans-serif);white-space:nowrap;box-shadow:0 2px 9px #0007;touch-action:manipulation;cursor:pointer}
#walk-there.walking{background:#1c2a26;color:#f4ecd6;border-color:#a9b29d}
#walk-there[hidden]{display:none}
#walk-there:focus-visible{outline:2px solid #fff3cf;outline-offset:2px}
#mobile-note{position:absolute;z-index:6;left:50%;top:22%;transform:translateX(-50%);max-width:84%;padding:8px 14px;border-radius:17px;background:#131b1fe8;color:#fff5da;font-size:.92rem;text-align:center;pointer-events:none}
#mobile-note[hidden]{display:none}
.looking-out #walk-there,.boarding #walk-there,body:has(#encounter:not([hidden])) #walk-there,.scene:has(#handset-controls:not([hidden])) #walk-there,
#game:has(#handset-browser:not([hidden])) #walk-there,.scene:has(.passenger-invite:not([hidden])) #walk-there{visibility:hidden}
/* The line itself takes the same tap as its button. */
.scene.walk-offered #destination-cue{pointer-events:auto;cursor:pointer;touch-action:manipulation}
.route-touch-tools{display:contents}
#travel-menu #mobile-fullscreen[hidden],#travel-menu #mobile-haptics[hidden]{display:none}

@media(pointer:coarse){
 /* Nothing a traveller has to read is under 14 px, nothing to press under 44 px. */
 #game .view-tools button{font-size:.9rem}
 #game .stick-home{font-size:.875rem}
 #game .ride-status,#game .ride-status #station{font-size:.875rem}
 #game #phase{font-size:.9rem}#game #clock-multiplier{font-size:.875rem}
 #game #show-key-guide{font-size:.875rem}
 #game .rail-announcement,#game #speech-caption,#game #destination-cue{font-size:.9rem}
 #game #handset-controls button{font-size:.9rem;min-height:44px}
 #game #other-actions,#game #encounter.dialogue #other-actions{font-size:.9rem;min-height:44px}
 #key-guide select,#control-settings select{min-height:44px;font-size:.95rem}
 #key-guide #travel-menu :is(button,a){min-height:46px}
 #journal-dialog :is(button,a.sheet-link,summary){min-height:44px}
 #journal-dialog #journey-note button,#journal-dialog #keep-ticket{display:inline-flex;align-items:center;min-height:44px}
 #journal-dialog :is(#journey-note span,#journey-note-day,#note-ride-copy){font-size:.875rem}
 #journal-dialog :is(#car-strip,#cabin-diagram,#car-destinations) small,#journal-dialog .map-aisle{font-size:.875rem}
 #clock-dialog :is(th,td,small,#calls-foot){font-size:.875rem}
 #journal-dialog :is(.ticket-ink small,.ticket-stub small,.ticket-stub span,.ticket-serial,#seal-note){font-size:.875rem}
 #journal-dialog .ticket-ink p{font-size:.875rem;letter-spacing:.04em}
 #journal-dialog .ticket-serial{flex-wrap:wrap}
 #journal-dialog .route span{font-size:.875rem}
 #needs-panel :is(button,a){min-height:44px}
 /* No zoom on a double tap, no text picked up by a resting thumb, no grey flash under a tap. */
 html{touch-action:manipulation;-webkit-text-size-adjust:100%;text-size-adjust:100%}
 #game :is(button,summary,select,a,label){-webkit-tap-highlight-color:transparent}
 #game :is(.masthead,.ride-status,.rail-announcement,#destination-cue,#control-hint,#walk-there,#mobile-note,.passenger-invite){-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
}

/* Upright: the destination line makes room for its button. */
@media (pointer: coarse) and (orientation: portrait) and (max-width: 700px){
 #game{--pad-size:clamp(74px,20vw,86px)}
 #game .view-tools{gap:6px}
 #game .view-tools #interact{flex:1.4 1 0}
 #game .scene.walk-offered #destination-cue{display:flex;align-items:center;min-height:50px;padding-right:126px}
 #game .view-tools button{font-size:.875rem}
 #game .masthead #show-key-guide{font-size:.875rem;letter-spacing:-.01em}
}
/* Keep a map drag on the glass on devices running the flat carriage view. */
#handset-fallback{touch-action:none}

/* On a tablet the status and objective share the top edge. Keep the lower
   corners for the two thumbs, with directions directly above the walking pad. */
@media (pointer:coarse) and (min-width:701px) and (min-height:561px){
 #game{
  --tablet-pad:84px;
  --hud-left:max(18px,env(safe-area-inset-left));
  --hud-right:max(18px,env(safe-area-inset-right));
  --hud-top:max(8px,env(safe-area-inset-top));
  --hud-bottom:max(18px,env(safe-area-inset-bottom));
 }
 #game #loc-map{align-self:center;margin:0}
 #game .scenehud button{min-height:44px;min-width:44px}
 #game .scene .stick-home{
  left:var(--hud-left);bottom:var(--hud-bottom);width:var(--tablet-pad);height:var(--tablet-pad)
 }
 #game .touch-stick{width:var(--tablet-pad);height:var(--tablet-pad)}
 #game .view-tools{right:var(--hud-right);bottom:var(--hud-bottom);gap:8px}
 #game .view-tools button{min-height:50px;min-width:44px;padding-inline:14px}
 #game .route-touch-tools{
  position:absolute;left:var(--hud-left);bottom:calc(var(--hud-bottom) + var(--tablet-pad) + 12px);
  display:flex;align-items:center;gap:8px;max-width:calc(55% - var(--hud-left));pointer-events:none
 }
 #game .route-touch-tools #destination-cue{position:static;min-width:0;max-width:none;overflow-wrap:anywhere}
 #game .route-touch-tools #walk-there{position:static;flex:none;pointer-events:auto}
 #game .rail-announcement{
  left:var(--hud-left);right:auto;transform:none;max-width:min(32rem,calc(55% - var(--hud-left)));text-align:start
 }
 #game #control-hint,#game #view-status.plan-status{
  inset:auto var(--hud-right) calc(var(--hud-bottom) + 64px) auto;transform:none;
  max-width:min(25rem,calc(40% - var(--hud-right)));text-align:start
 }
 #game .scene:has(#view-status.plan-status:not([hidden])) #control-hint{visibility:hidden}
 #game:has(#handset-controls:not([hidden])) :is(.stick-home,.masthead,.scenehud,.ride-status,#destination-cue,.rail-announcement,#view-status.plan-status){visibility:hidden}
}

/* Sideways: status at the top left, announcements under the menu at the top right, a larger pad,
   and a low conversation band whose choices sit side by side so the face above it stays in view. */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 560px){
 #game .rail-announcement{top:calc(var(--hud-top) + 50px);left:auto;right:var(--hud-right);transform:none;max-width:min(46%,25rem);padding:6px 11px;text-align:left}
 #game .scene .stick-home{width:92px;height:92px}
 #game #control-hint{left:calc(var(--hud-left) + 104px)}
 #game #destination-cue,#game #speech-caption,#game #view-status.plan-status{bottom:calc(var(--hud-bottom) + 62px)}
 #game #destination-cue{left:calc(var(--hud-left) + 104px)}
 #game #speech-caption{max-width:min(62%,34rem)}
 #game .passenger-invite{left:calc(var(--hud-left) + 104px);bottom:calc(var(--hud-bottom) + 58px);max-width:min(26rem,calc(100% - var(--hud-left) - var(--hud-right) - 110px))}
 #game .view-tools{max-width:calc(100% - var(--hud-left) - var(--hud-right) - 112px)}
 #encounter{inset:auto 50% max(6px,env(safe-area-inset-bottom)) auto;width:min(900px,calc(100vw - 16px - env(safe-area-inset-left) - env(safe-area-inset-right)));max-height:min(47dvh,210px);padding:9px 16px 10px}
 #encounter h2{font-size:1rem;margin:0 60px 2px 0}
 #encounter #story p,#encounter .copy{margin:.15rem 0 .25rem;font-size:.95rem;line-height:1.4}
 #encounter .conversation-line{margin:0 60px 5px 0;font-size:1rem}
 #encounter #actions{flex-wrap:nowrap;overflow-x:auto;gap:8px;padding:6px 0 4px;scrollbar-width:thin;-webkit-overflow-scrolling:touch}
 #game #encounter #actions button,#encounter #actions button{flex:0 0 auto;min-height:46px;max-width:21rem;text-align:left}
 #encounter #other-actions{margin-top:2px}
 #encounter #ask-passenger:not([hidden]){margin:.25rem 0 0}
 /* Sheets use the height there is and scroll inside it. */
 #journal-dialog,#clock-dialog,#needs-panel,#key-guide{max-height:calc(100dvh - 12px)}
}
