/* The railway uses the available viewport; controls remain actual CSS pixels. */
:root {
  --nq-safe-top: env(safe-area-inset-top, 0px);
  --nq-safe-right: env(safe-area-inset-right, 0px);
  --nq-safe-bottom: env(safe-area-inset-bottom, 0px);
  --nq-safe-left: env(safe-area-inset-left, 0px);
}
html { display:block; width:100%; height:100%; background:#bde5f4; }
body { display:block; width:100%; height:100vh; height:100dvh; height:var(--nq-viewport-height,100dvh); background:#bde5f4; overscroll-behavior:none; }
#phone { width:100%; height:100%; max-width:none; max-height:none; aspect-ratio:auto; border-radius:0; box-shadow:none; }
#cabPanel { height:calc(132px + var(--nq-safe-bottom)); }
#hold { right:calc(18px + var(--nq-safe-right)); bottom:calc(10px + var(--nq-safe-bottom)); }
#whistle { left:calc(16px + var(--nq-safe-left)); bottom:calc(10px + var(--nq-safe-bottom)); }
#settingsToggle { bottom:calc(15px + var(--nq-safe-bottom)); }
#title { top:calc(12px + var(--nq-safe-top)); }
#destChip { top:calc(36px + var(--nq-safe-top)); max-width:min(280px,calc(100% - 32px - var(--nq-safe-left) - var(--nq-safe-right))); }
#hint.forkPrompt,#hint.wrongHint,#hint.obstacleHint {
  top:calc(40px + var(--nq-safe-top)); left:calc(16px + var(--nq-safe-left)); right:calc(16px + var(--nq-safe-right));
  width:auto; max-width:720px; margin-left:auto; margin-right:auto;
}
#phone.hasDestination #hint.forkPrompt { top:calc(126px + var(--nq-safe-top)); }
#arrivalBunting { top:calc(178px + var(--nq-safe-top)); }
#settingsPanel {
  left:calc(14px + var(--nq-safe-left)); right:calc(14px + var(--nq-safe-right)); width:auto; max-width:560px; margin-left:auto; margin-right:auto;
  bottom:calc(145px + var(--nq-safe-bottom)); max-height:calc(100% - 165px - var(--nq-safe-top) - var(--nq-safe-bottom));
  overflow-y:auto; touch-action:pan-y; overscroll-behavior:contain;
}
#miniDistractions [role=status] { bottom:calc(28% + var(--nq-safe-bottom))!important; }
@media (orientation:landscape) and (max-height:500px) {
  #cabPanel { height:calc(100px + var(--nq-safe-bottom)); }
  #hold,#whistle { bottom:calc(4px + var(--nq-safe-bottom)); }
  #hold { right:calc(24px + var(--nq-safe-right)); }
  #settingsToggle { bottom:calc(9px + var(--nq-safe-bottom)); }
  #title { top:calc(7px + var(--nq-safe-top)); }
  #destChip { top:calc(20px + var(--nq-safe-top)); left:calc(110px + var(--nq-safe-left)); transform:none; max-width:230px; }
  #hint.forkPrompt,#hint.wrongHint,#hint.obstacleHint {
    top:calc(28px + var(--nq-safe-top)); width:360px;
    max-width:calc(100% - 32px - var(--nq-safe-left) - var(--nq-safe-right));
  }
  #phone.hasDestination #hint.forkPrompt { top:calc(28px + var(--nq-safe-top)); left:calc(350px + var(--nq-safe-left)); right:calc(16px + var(--nq-safe-right)); width:auto; max-width:none; margin:0; }
  #settingsPanel { bottom:calc(112px + var(--nq-safe-bottom)); max-height:calc(100% - 132px - var(--nq-safe-top) - var(--nq-safe-bottom)); }
  #arrivalBunting { top:calc(85px + var(--nq-safe-top)); }
}

/* Branch signs stay attached to actual rails when accessibility spacing moves them. */
.forkTrackLeaders{position:absolute;inset:0;width:100%;height:100%;overflow:visible;pointer-events:none}
.forkTrackLeaders path{fill:none;stroke:#fff7d9;stroke-width:5;stroke-linecap:round;filter:drop-shadow(0 1px 2px #264c50)}
.forkTrackLeaders circle{fill:#fff7d9;stroke:#356b70;stroke-width:2}
@media(max-width:360px){.forkArrowBtn{padding-left:4px;padding-right:4px}}

@media(orientation:landscape) and (max-height:500px){
  #phone.forkChoicesVisible #hint.forkPrompt,#phone.forkChoicesVisible #hint.wrongHint{
    top:auto;bottom:calc(26px + var(--nq-safe-bottom));left:calc(16px + var(--nq-safe-left));right:calc(78px + var(--nq-safe-right));width:auto;max-width:none;padding:8px 10px;font-size:18px;
  }
  #phone.forkChoicesVisible #settingsToggle{left:auto;right:calc(16px + var(--nq-safe-right));transform:none}
  #phone.forkChoicesVisible .cabBadge{visibility:hidden}
  .forkArrowBtn.pulseBoth{animation-name:forkCompactPulse}
  .forkArrowBtn.pulseIcon .iconBox{animation-name:forkCompactIconPulse}
  @keyframes forkCompactPulse{0%,100%{transform:translate(-50%,-50%) scale(1)}35%{transform:translate(-50%,-50%) scale(1.04)}}
  @keyframes forkCompactIconPulse{0%,100%{transform:scale(1)}35%{transform:scale(1.05)}}
}
