/* Keep the current screen and navigation together in a phone viewport. */
@media (max-width: 740px), (max-width: 1000px) and (max-height: 500px) {
  :is(.front-home, .front-shell) { display: flex; flex-direction: column; height: 100dvh; min-height: 0; overflow: hidden; }
  :is(.front-home, .front-shell) .front-header { flex: 0 0 auto; min-height: 70px; gap: 8px; padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left)); }
  :is(.front-home, .front-shell) .front-brand-logo { width: 88px; }
  :is(.front-home, .front-shell) .front-player .front-settings { width: 44px; padding: 9px; }
  :is(.front-home, .front-shell) .front-player .front-settings span { display: none; }
  :is(.front-home, .front-shell) .front-lobby { flex: 1; min-height: 0; align-items: stretch; padding: 0 max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
  :is(.front-home, .front-shell) .front-clubhouse { display: flex; flex-direction: column; width: 100%; height: 100%; min-height: 0; border-radius: 15px; }
  :is(.front-home, .front-shell) .front-rail { display: grid; grid-template-columns: 44px minmax(0, 1fr); flex: 0 0 auto; align-items: center; gap: 5px; min-height: 54px; padding: 4px 6px; overflow: hidden; border-right: 0; border-bottom: 1px solid #305f5426; }
  :is(.front-home, .front-shell) .front-rail-heading { display: none; }
  :is(.front-home, .front-shell) .front-rail .front-menu { display: flex; grid-area: 1 / 2; flex-direction: row; flex-wrap: nowrap; align-items: center; min-width: 0; gap: 4px; overflow-x: auto; padding: 1px; scrollbar-width: none; scroll-padding-inline: 8px; }
  :is(.front-home, .front-shell) .front-rail .front-menu > button { flex: 0 0 auto; width: auto; min-height: 44px; gap: 6px; padding: 9px 12px; }
  :is(.front-home, .front-shell) .front-rail .front-choice-copy strong { font-size: 19px; white-space: nowrap; }
  :is(.front-home, .front-shell) .front-rail :is(.front-choice-copy small, .front-choice-icon, .front-rail-current) { display: none; }
  :is(.front-home, .front-shell) .front-rail .front-back { grid-area: 1 / 1; width: 44px; margin: 0; padding: 8px; border: 1px solid #305f5426; border-radius: 8px; font-size: 0; }
  :is(.front-home, .front-shell) .front-rail .front-back .icon { width: 18px; height: 18px; }
  :is(.front-home, .front-shell) .front-rail .front-editorial-links { grid-column: 1 / -1; min-width: 0; padding: 0 4px 3px; gap: 3px 12px; }
  :is(.front-home, .front-shell) .front-footer { display: none; }
  .front-shell main { flex: 1; min-height: 0; padding: 16px; overflow-y: auto; overscroll-behavior: contain; scroll-padding-block: 16px; }
  .front-home .front-race-brief { order: 0; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .front-home .front-voyage-scene { flex: 0 0 auto; min-height: 230px; padding: 16px; }
  .front-home .front-voyage-top .front-eyebrow { display: none; }
  .front-home .front-voyage-top { justify-content: flex-end; }
  .front-home .front-voyage-top .front-link { min-height: 44px; padding: 10px 12px; font-size: 12px; }
  .front-home .front-destination { padding-top: 16px; }
  .front-home .front-destination h2 { font-size: 44px; }
  .front-home .front-conditions > span { min-height: 27px; font-size: 9px; }
  .front-home .front-departure { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 16px; }
  .front-home .front-vessel h3 { font-size: 27px; }
  .front-home .front-vessel p { font-size: 11px; }
  .front-home .front-brief-actions { display: grid; grid-template-columns: minmax(0, 1fr); }
  .front-home .front-brief-actions > button { min-height: 52px; font-size: 17px; }
  .front-home .front-brief-actions > button:last-child { min-height: 44px; font-size: 12px; }
  .front-home .front-save-note { margin: 0 16px 12px; font-size: 9px; }

  /* The whole Adventure section scrolls, including its chart and launch dock. */
  .front-shell main:has(.adventure-setup) { display: block; overflow-y: auto; padding: 12px; }
  .front-shell .adventure-setup { display: flex; flex-direction: column; min-height: 0; overflow: visible; }
  .front-shell .adventure-setup .adventure-browse-header { flex: 0 0 auto; gap: 10px; margin-bottom: 12px; }
  .front-shell .adventure-setup .adventure-heading h1 { margin-top: 3px; font-size: 30px; }
  .front-shell .adventure-setup .adventure-heading p { font-size: 11px; }
  .front-shell .adventure-setup :is(.adventure-heading .eyebrow, .adventure-coast-byline) { display: none; }
  .front-shell .adventure-setup .adventure-region-card { min-height: 62px; gap: 2px; padding: 9px 11px; }
  .front-shell .adventure-setup .adventure-region-card > strong { font-size: 25px; }
  .front-shell .adventure-setup .adventure-region-card > small { font-size: 9px; }
  .front-shell .adventure-setup .adventure-region-card > span { font-size: 8px; }
  .front-shell .adventure-setup .adventure-planner { display: flex; flex: 0 0 auto; flex-direction: column; min-height: 0; gap: 12px; overflow: visible; }
  .front-shell .adventure-setup .adventure-chart-column { flex: 0 0 auto; width: 100%; }
  .front-shell .adventure-setup .adventure-chart { height: clamp(180px, 27dvh, 230px); min-height: 180px; }
  .front-shell .adventure-setup .adventure-plan { flex: 0 0 auto; height: auto; overflow: visible; }
  .front-shell .adventure-setup .adventure-plan-body { padding: 14px; overflow: visible; }
  .front-shell .adventure-setup .adventure-plan-heading { flex-direction: row; align-items: baseline; gap: 10px; }
  .front-shell .adventure-setup .adventure-plan h2 { font-size: 25px; }
  .front-shell .adventure-setup .adventure-boat-field { margin-top: 10px; }
  .front-shell .adventure-setup .adventure-selected-boat-copy strong { font-size: 26px; }
  .front-shell .adventure-setup .adventure-selected-boat-copy > span { font-size: 11px; }
  .front-shell .adventure-setup :is(.adventure-departure-label, .adventure-control-field label) { font-size: 12px; }
  .front-shell .adventure-setup .adventure-control-field label small { float: none; font-size: 10px; }
  .front-shell .adventure-setup .adventure-departure-mode button { min-height: 46px; font-size: 12px; }
  .front-shell .adventure-setup .nautical-select-trigger { min-height: 48px; font-size: 14px; }
  .front-shell .adventure-setup .adventure-scale-summary { font-size: 11px; }
  .front-shell .adventure-setup .adventure-forecast { font-size: 11px; }
  .front-shell .adventure-setup #adventure-weather-summary { flex-wrap: wrap; font-size: 24px; }
  .front-shell .adventure-setup #adventure-weather-summary small { font-size: 9px; }
  .front-shell .adventure-setup .adventure-data-actions button { font-size: 10px; }
  .front-shell .adventure-setup > .adventure-launch-dock { position: static; margin-top: 12px; padding: 10px; border: 1px solid #376e6038; border-radius: 11px; background: #fff9ed; box-shadow: 0 -4px 14px #164e4b0b; }
  .front-shell .adventure-setup #adventure-start { min-height: 50px; font-size: 20px; }
  .front-shell .adventure-setup .adventure-launch-dock #adventure-resume:not([hidden]) { font-size: 11px; }
  .front-shell .adventure-setup .adventure-fine-print { margin: 0; padding: 2px 4px 10px; }

  body.front-end .modal-backdrop { align-items: flex-start; padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
  body.front-end :is(.stage-modal, .settings-modal, .username-modal, .help-modal, .adventure-boat-modal, .helm-intro, .race-picker-modal) { max-height: calc(100dvh - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
  body.front-end .nautical-choice-dialog { margin-block: max(10px, env(safe-area-inset-top)); max-height: calc(100dvh - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
}
@media (max-width: 1000px) and (max-height: 500px) {
  :is(.front-home, .front-shell) .front-header { min-height: 62px; padding-block: 4px; }
  .front-shell .adventure-setup .adventure-browse-header { grid-template-columns: minmax(140px, .8fr) minmax(0, 1.2fr); align-items: center; gap: 12px; margin-bottom: 8px; }
  .front-shell .adventure-setup .adventure-heading p { display: none; }
  .front-shell .adventure-setup .adventure-region-card { min-height: 56px; }
  .front-shell .adventure-setup > .adventure-launch-dock { margin-top: 8px; padding: 6px; }
  .front-home .front-voyage-scene { min-height: 200px; }
}
/* Public editorial links stay reachable beside the harbour navigation. */
.front-editorial-links { display:flex; align-items:center; flex-wrap:wrap; gap:6px 12px; padding:12px 5px 4px; font:600 10px/1.6 var(--body); color:#24574e; }
.front-editorial-links a { display:inline-flex; gap:5px; align-items:center; min-height:28px; text-decoration:none; }
.front-editorial-links a:hover { text-decoration:underline; }
.front-editorial-links .icon { width:11px; height:11px; }
.game-entry-summary { max-width:680px; margin:12vh auto; padding:25px; font:16px/1.7 Arial,sans-serif; color:#123744; background:#fff9ee; border-radius:12px; }
.game-entry-summary h1 { font-size:30px; line-height:1.2; }
.game-entry-summary a { color:#24574e; text-decoration:underline; }
.online-invite-row .invite-share-button { min-width:0; padding:9px 12px; font-size:10px; }
.boat-reference-link { display:inline-flex; align-items:center; gap:6px; margin-top:8px; color:#ad4633; font:700 9px/1.6 var(--body); text-decoration:none; }
.boat-reference-link:hover { text-decoration:underline; }
.boat-reference-link .icon { width:12px; height:12px; }
