/* Phone play uses the same board and commands in both orientations. */
.mobile-rail-details:empty{display:none}
#mobile-info{display:none;align-items:center;justify-content:center;gap:5px}
#mobile-info .stat-icon{width:18px;height:18px}
.mobile-intel.modal{width:min(440px,calc(100vw - 20px));max-height:calc(100dvh - 20px);padding:12px}
.mobile-intel-heading{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:10px}
.mobile-intel-heading h2{margin:0;font-size:27px}
.mobile-intel-heading button{flex:none;min-height:44px;padding:8px 14px}
#mobile-intel-content .intel-fold{width:100%;margin:0}
#mobile-intel-content .intel-fold>summary{display:none}
#mobile-intel-content .intel-panel{max-height:none}

/* Bords d'écran (encoche en paysage) : même bleu nuit que la barre, plus de bande claire du fond de page. */
body.mobile-landscape:not(.home-mode){padding:0;overflow:hidden;background:#14293a}
body.mobile-landscape:not(.home-mode) .app{width:100%;max-width:none;height:100dvh;min-height:0;display:flex;flex-direction:column;padding:0 max(8px,env(safe-area-inset-right,0px)) 0 max(8px,env(safe-area-inset-left,0px))}
body.mobile-landscape:not(.home-mode) .topbar{flex:none;display:flex;flex-wrap:nowrap;gap:8px;min-height:48px;height:48px;padding:2px 0;border-bottom-width:2px}
body.mobile-landscape:not(.home-mode) .topbar>.logo,body.mobile-landscape:not(.home-mode) .top-hud{display:none}
body.mobile-landscape:not(.home-mode) .topbar>.mission-title{display:block;flex:1;min-width:0}
body.mobile-landscape:not(.home-mode) .topbar .mission-title .eyebrow{display:none}
body.mobile-landscape:not(.home-mode) .topbar .mission-title h1{font-size:20px;line-height:1.1}
body.mobile-landscape:not(.home-mode) .topbar #mission-name{display:block;max-width:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
body.mobile-landscape:not(.home-mode) .topbar #mission-name>span{display:inline}
body.mobile-landscape:not(.home-mode) .topbar .top-right{width:auto;margin-left:auto}
body.mobile-landscape:not(.home-mode) .topbar .top-right .nav-control{width:44px;min-width:44px;height:44px;padding:0}
body.mobile-landscape:not(.home-mode) .topbar .nav-label{display:none!important}
body.mobile-landscape:not(.home-mode) #game-screen{flex:1;min-height:0;display:flex;flex-direction:column;padding:6px 0 max(6px,env(safe-area-inset-bottom,0px))}
body.mobile-landscape:not(.home-mode) #game-screen[hidden]{display:none}
body.mobile-landscape:not(.home-mode) #game-screen .game-layout{display:grid;grid-template-columns:minmax(0,1fr) clamp(200px,28vw,272px);gap:8px;flex:1;min-height:0;align-items:stretch;margin:0}
body.mobile-landscape:not(.home-mode) #game-screen .board-section{display:block;min-width:0;min-height:0;height:100%;width:auto;padding:0;align-self:stretch}
body.mobile-landscape:not(.home-mode) #game-screen .map-shell{height:100%;min-height:0}
body.mobile-landscape:not(.home-mode) #game-screen .map-viewport{width:100%;height:100%;min-height:0;max-height:none;aspect-ratio:auto}
body.mobile-landscape:not(.home-mode) #game-screen :is(.footer,.action-shelf,.board-bottom,.sidebar>.next-unit,.sidebar>.end-turn,.sidebar>#end-note){display:none}
body.mobile-landscape:not(.home-mode) #game-screen .sidebar{display:flex;flex-direction:column;gap:5px;min-height:0;height:100%;max-height:100%;width:auto;overflow:hidden}
body.mobile-landscape:not(.home-mode) #game-screen .mobile-rail-details{display:block;flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin}
body.mobile-landscape:not(.home-mode) #game-screen .mobile-rail-details .mission-header{display:flex;min-height:30px;padding:0;margin:0 0 4px;gap:4px}
body.mobile-landscape:not(.home-mode) #game-screen .mission-header .unit-counts{gap:3px}
body.mobile-landscape:not(.home-mode) #game-screen .mission-header .unit-counts>span{padding:2px 4px;font-size:10px}
body.mobile-landscape:not(.home-mode) #game-screen .mission-header .count-label{display:none}
body.mobile-landscape:not(.home-mode) #game-screen .mission-header .count-short{display:inline}
body.mobile-landscape:not(.home-mode) #game-screen .mission-header #game-day{position:static;display:inline-flex;gap:3px;font-size:11px;white-space:nowrap}
body.mobile-landscape:not(.home-mode) #game-screen .field-hud{display:grid!important;grid-template-columns:1fr;gap:0;border:1px solid #536473}
body.mobile-landscape:not(.home-mode) #game-screen .field-hud .economy-overview{padding:5px 7px;display:grid;grid-template-columns:1fr 1fr;gap:4px;min-height:0;border:0}
body.mobile-landscape:not(.home-mode) #game-screen .field-hud .economy-overview>div{grid-column:auto;grid-row:auto}
body.mobile-landscape:not(.home-mode) #game-screen .field-hud .economy-overview .army-line{display:none}
body.mobile-landscape:not(.home-mode) #game-screen .field-hud .economy-overview small{font-size:9px}
body.mobile-landscape:not(.home-mode) #game-screen .field-hud .economy-overview strong{font-size:18px}
body.mobile-landscape:not(.home-mode) #game-screen .power-overview{padding:3px 6px;gap:6px}
body.mobile-landscape:not(.home-mode) #game-screen .power-track{min-height:44px;grid-template-rows:auto 12px;padding:1px 0;gap:1px}
body.mobile-landscape:not(.home-mode) #game-screen .power-track>span{font-size:10px;gap:2px}
body.mobile-landscape:not(.home-mode) #game-screen .power-track progress{height:12px}
body.mobile-landscape:not(.home-mode) #game-screen .power-track .power-activate{line-height:12px;font-size:9px}
body.mobile-landscape:not(.home-mode) #game-screen .sidebar>.zoom{position:static;inset:auto;display:grid;grid-template-columns:44px minmax(0,1fr) 44px;gap:4px;flex:none;width:100%;margin:0}
body.mobile-landscape:not(.home-mode) #game-screen .sidebar>.zoom button{width:100%;height:44px;min-height:44px}
body.mobile-landscape:not(.home-mode) #game-screen .sidebar>.zoom #zoomfit{font-size:12px;padding:4px}
body.mobile-landscape:not(.home-mode) #game-screen .sidebar-orders:not(:empty){display:block;flex:0 1 auto;min-height:48px;max-height:42%;overflow:auto}
body.mobile-landscape:not(.home-mode) #game-screen #quick-actions.sidebar-docked{position:static;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));inset:auto!important;height:auto;max-height:none;width:100%;gap:4px;padding:0;overflow:visible}
body.mobile-landscape:not(.home-mode) #game-screen #quick-actions.sidebar-docked button{width:100%;min-width:0;height:auto;min-height:44px;padding:6px;white-space:normal;font-size:12px}
body.mobile-landscape:not(.home-mode) #mobile-orders:not([hidden]){position:static;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;flex:none;padding:0;min-height:48px;border:0;background:none;box-shadow:none}
body.mobile-landscape:not(.home-mode) #mobile-orders button{width:100%;min-width:0;min-height:48px;padding:4px;font-size:11px;white-space:normal;line-height:1.15}
body.mobile-landscape:not(.home-mode) #game-screen .mobile-rail-details .fold{margin:5px 0 0}
body.mobile-landscape:not(.home-mode) #game-screen .tutorial-coach{height:auto;max-height:none;display:flex;flex-wrap:wrap;margin:0 0 6px;padding:6px;gap:4px}
body.mobile-landscape:not(.home-mode) #game-screen .tutorial-coach[hidden]{display:none}
body.mobile-landscape:not(.home-mode) #game-screen .tutorial-coach>div{flex-basis:100%}
body.mobile-landscape:not(.home-mode) #game-screen .tutorial-coach strong{font-size:12px}
body.mobile-landscape:not(.home-mode) #game-screen .tutorial-coach #tutorial-text{height:auto;max-height:none;font-size:12px;margin:3px 0}
body.mobile-landscape:not(.home-mode) #game-screen .tutorial-coach button{min-width:0;min-height:44px;flex:1;padding:4px;font-size:11px}
body.mobile-landscape:not(.home-mode) .mobile-intel.modal{width:min(480px,calc(100vw - 24px));max-height:calc(100dvh - 12px);margin:auto;padding:10px}

#mobile-intel-content .selected-heading{padding:8px;gap:10px}
#mobile-intel-content .selected-heading canvas{width:64px;height:64px;flex:none}
#mobile-intel-content .selected-heading h3{font-size:25px;margin:0}
#mobile-intel-content .selected-heading p{font-size:12px;line-height:1.4}
#mobile-intel-content #unit-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px;padding:6px}
#mobile-intel-content #unit-stats>div{min-width:0;padding:6px 4px}
#mobile-intel-content #unit-stats strong{font-size:17px}


body.mobile-landscape:not(.home-mode) .topbar #mission-name{color:#fff0d1}

/* Two or three orders share the row. Longer engineering menus remain readable with a thumb swipe. */


/* Informations remains in the portrait sidebar. Only landscape uses the compact dialog. */
body.mobile-landscape:not(.home-mode) #mobile-info{display:flex}

/* Landscape uses some spare map width for readable controls and two-column orders. */
body.mobile-landscape:not(.home-mode) #game-screen .mobile-rail-details .fold>summary{min-height:44px;padding:7px 8px;gap:6px;white-space:normal}
body.mobile-landscape:not(.home-mode) #game-screen .mobile-rail-details .fold>summary::after{flex:none}
body.mobile-landscape:not(.home-mode) #game-screen .mobile-rail-details .fold>summary .fold-label{flex:none;font-size:11px}
/* Aperçu d'un panneau replié : une seule ligne tronquée, le résumé ne déborde plus sur le panneau suivant. */
body.mobile-landscape:not(.home-mode) #game-screen .mobile-rail-details .fold>summary span:not(.fold-label){flex:1;min-width:0;margin-left:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:12px;line-height:1.25}
body.mobile-landscape:not(.home-mode) #game-screen #quick-actions.sidebar-docked button:last-child:nth-child(odd){grid-column:1/-1}
/* Téléphone portrait en partie : l'écran descend jusqu'à la barre « Prêt / Fin du tour » et le journal ouvert prend
   toute la hauteur restante (son texte défile dedans) au lieu de laisser une bande vide. Navigateurs sans
   ::details-content : le journal garde sa hauteur fixe. */
@media(max-width:760px) and (orientation:portrait){
 body:not(.home-mode) #app-shell{min-height:calc(100dvh - 78px - env(safe-area-inset-bottom,0px));display:flex;flex-direction:column}
 body:not(.home-mode) #game-screen{flex:1 0 auto;display:flex;flex-direction:column}
 body:not(.home-mode) #game-screen .game-layout{flex:1 0 auto}
 body:not(.home-mode) #game-screen .sidebar{flex:1 0 auto}
 body:not(.home-mode) #game-screen .sidebar>.log-fold[open]{flex:1 0 auto;display:flex;flex-direction:column}
 body:not(.home-mode) #game-screen .sidebar>.log-fold[open]::details-content{display:contents}
 body:not(.home-mode) #game-screen .sidebar>.log-fold[open]>.battle-log{flex:1 1 0;min-height:64px;max-height:none}
}
