/* Ver.2.42 — primary formation + barracks pages; journal at right edge. */
.nav-tabs{display:flex;align-items:stretch;gap:9px;flex-wrap:wrap;}
.main-nav-tabs{display:flex;gap:7px;flex:1 1 auto;flex-wrap:wrap;min-width:0;}
.nav-tabs .nav-archive-edge{margin-left:auto;align-self:center;min-height:37px;padding:7px 12px;font-size:12px;letter-spacing:0;background:#241b2d;border:1px solid #745c6d;color:#cbbdcb;white-space:nowrap;}
.nav-tabs .nav-archive-edge.active{border-color:#e2bc76;color:#ffe6b7;background:#533851;}
.formation-slot[draggable="true"],.formation-candidate[draggable="true"]{cursor:grab;touch-action:pan-y;}
.formation-slot[draggable="true"]:active,.formation-candidate[draggable="true"]:active{cursor:grabbing;}
.formation-dragging{opacity:.48;}
.formation-slot.formation-drop-target{border:3px solid #ffe29d!important;outline:2px solid #5cba9d;outline-offset:2px;background:#503657!important;}
.formation-candidate[draggable="true"]:hover{border-color:#bb9b70;}
.fusion-quick-area{display:grid;gap:9px;background:#261d31;border:1px solid #97775d;padding:13px;margin:8px 0;}
.fusion-quick-area>strong{color:#f4d6a0;}
.fusion-quick-area>small{color:#d2bfd1;}
.fusion-quick-buttons{display:flex;flex-wrap:wrap;gap:9px;max-height:200px;overflow:auto;}
.fusion-quick-buttons .btn{white-space:normal;min-height:40px;}
.barracks-no-fusion{padding:8px 0;margin:0;}
@media(max-width:800px){.main-nav-tabs{flex-basis:100%;}.nav-tabs .nav-archive-edge{margin-left:auto;}}
@media(max-width:480px){.main-nav-tabs{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));}.main-nav-tabs button{padding:8px 7px;font-size:13px;min-width:0;}.main-nav-tabs button:first-child{grid-column:1 / -1;}.nav-tabs .nav-archive-edge{font-size:12px;}}
/* Child portrait images would otherwise start their own native image drag. */
.formation-slot *{pointer-events:none;user-select:none;-webkit-user-drag:none;}



/* Phone interaction layout: one-thumb navigation, compact status, and a collapsible utility menu.
   Deliberately scoped to phones: desktop and tablet layouts remain unchanged. */
.mobile-menu-toggle{display:none;}
.dashboard .dash-mobile-label{display:none;}
@media(max-width:700px){
 .game-shell{padding:0 9px calc(98px + env(safe-area-inset-bottom));}
 .masthead{position:relative;z-index:26;min-height:54px;flex-wrap:nowrap;gap:8px;}
 .brand{min-width:0;gap:6px;}
 .brand-mark{font-size:29px;}
 .brand small{display:none;}
 .brand strong{font-size:clamp(18px,5.5vw,23px);white-space:nowrap;letter-spacing:0;}
 .mobile-menu-toggle{display:inline-flex;flex:0 0 auto;min-height:44px;font-size:14px;padding:8px 12px;}
 .masthead .header-actions{display:none;position:absolute;top:calc(100% - 1px);right:0;z-index:29;
  width:min(270px,calc(100vw - 22px));padding:10px;background:#211629;
  border:2px solid #be9567;box-shadow:0 15px 30px #08050bd9;gap:7px;}
 .masthead .header-actions.mobile-open{display:grid;grid-template-columns:1fr;}
 .masthead .header-actions .btn{min-height:46px;font-size:14px;padding:9px 12px;width:100%;justify-content:flex-start;}
 .dashboard{grid-template-columns:repeat(6,minmax(0,1fr));gap:5px;margin:7px 0 9px;}
 .dashboard .dash-card{grid-column:span 2;min-width:0;min-height:58px;padding:7px 6px;}
 .dashboard .dash-card:nth-child(n+4){grid-column:span 3;}
 .dashboard .dash-card b,.dashboard .dash-card.key b{font-size:clamp(14px,4vw,19px);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-bottom:2px;}
 .dashboard .dash-icon,.dashboard .dash-detail-label{display:none;}
 .dashboard .dash-mobile-label{display:block;font-size:12px;line-height:1.3;color:#dbc8d4;}
 #navTabs.nav-tabs{position:fixed;left:0;right:0;bottom:0;z-index:25;margin:0;padding:8px 10px calc(8px + env(safe-area-inset-bottom));
  border-top:2px solid #bf966c;border-bottom:0;background:#1c1427f5;
  box-shadow:0 -8px 26px #08040cbf;display:flex;flex-wrap:nowrap;align-items:stretch;gap:6px;
  width:100%;overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain;
  -webkit-overflow-scrolling:touch;scroll-snap-type:x proximity;scrollbar-width:thin;scrollbar-color:#947258 #211629;}
 #navTabs.nav-tabs::-webkit-scrollbar{height:3px;}
 #navTabs.nav-tabs::-webkit-scrollbar-thumb{background:#947258;}
 #navTabs .main-nav-tabs{display:flex;flex:0 0 auto;flex-basis:auto;min-width:max-content;grid-template-columns:none;gap:6px;flex-wrap:nowrap;}
 #navTabs .main-nav-tabs button:first-child{grid-column:auto;}
 #navTabs button,#navTabs .nav-archive-edge{flex:0 0 auto;min-width:0;min-height:48px;
  padding:9px 13px;font-size:14px;line-height:1.25;white-space:nowrap;scroll-snap-align:start;}
 #navTabs .nav-archive-edge{margin:0;align-self:stretch;display:inline-flex;align-items:center;justify-content:center;}
 .site-footer{padding-bottom:8px;}
 .home-grid .action-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:12px 0;}
 .home-grid .action-card{min-height:108px;padding:9px 10px;gap:5px;flex-direction:column;align-items:flex-start;justify-content:flex-start;}
 .home-grid .action-symbol{width:30px;min-width:30px;height:30px;font-size:18px;}
 .home-grid .action-card b{font-size:14px;line-height:1.35;}
 .home-grid .action-card small{font-size:11px;line-height:1.35;margin-top:2px;}
 .home-grid .panel{padding:14px 11px;}
 .btn.small{min-height:44px;}
 .facility-info-btn,.modal-close-top{min-height:44px;min-width:44px;}
 button,summary{touch-action:manipulation;-webkit-tap-highlight-color:#e9c78e44;}
 input,select,textarea{font-size:16px;}
 .overlay{padding:6px;}
 .modal-window{max-height:calc(100dvh - 12px);padding:16px 12px;overscroll-behavior:contain;}
 .modal-foot .btn{min-height:48px;}
 .raid-floating-cta{bottom:calc(79px + env(safe-area-inset-bottom));right:12px;min-width:175px;min-height:56px;font-size:15px;}
 #toast{bottom:calc(83px + env(safe-area-inset-bottom));}
}

/* Mobile legibility follow-up: eliminate overlapping decorative tabs and keep
   interview art and both combat armies visible. All overrides are phone-only. */
.mobile-lilith-glimpse{display:none;}
@media(max-width:700px){
 /* The desktop 9-slice tab borders occupy too much of a narrow touch target.
    Replace only the phone tabs with an uncluttered framed control. */
 #navTabs.nav-tabs button{
  border:2px solid #796178!important;border-image:none!important;
  background:#2d2139!important;box-shadow:none!important;clip-path:none!important;
  padding:8px 12px!important;min-height:50px;gap:7px;
  transform:none!important;align-items:center;justify-content:center;
 }
 #navTabs.nav-tabs button.active,#navTabs.nav-tabs button[aria-current="page"]{
  border-color:#e3b87c!important;background:#604260!important;color:#ffe9af!important;
  box-shadow:inset 0 -3px 0 #d8ae72!important;
 }
 #navTabs.nav-tabs .pixel-tab-icon{width:19px;height:19px;min-width:19px;flex-shrink:0;margin:0;}
 #navTabs.nav-tabs .mobile-nav-label{display:inline-block;white-space:nowrap;line-height:1.35;flex:0 0 auto;}
 #navTabs.nav-tabs .nav-expedition-icon{flex:0 0 auto;}
 /* Show Lilith alongside the next action rather than after the long formation.
    Keep the original full portrait below for anyone who wants to see it. */
 .mobile-lilith-glimpse{
  display:flex;align-items:center;gap:9px;width:100%;min-height:75px;
  padding:7px 9px;margin:0 0 11px;text-align:left;cursor:pointer;
  color:#ead6eb;background:#2c1f39;border:2px solid #8d6d7b;
  font:inherit;touch-action:manipulation;
 }
 .mobile-lilith-glimpse:focus-visible{outline:3px solid #ffe1a2;outline-offset:2px;}
 .mobile-lilith-glimpse img{
  width:58px;height:61px;flex:0 0 58px;object-fit:contain;object-position:center;
 }
 .mobile-lilith-copy{min-width:0;flex:1;display:grid;gap:3px;font-size:13px;line-height:1.4;}
 .mobile-lilith-copy strong{font-size:14px;color:#f6d49f;}
 .mobile-lilith-copy [data-lilith-speech]{
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;
 }
 .mobile-lilith-tap{font-size:12px;color:#ffdfaa;white-space:nowrap;align-self:center;}
 /* Character art and dialogue belong to separate grid rows on phones:
    never put the dialogue card over the sprite. */
 .modal-window:has(.interview-shell) .interview-stage{
  height:auto;min-height:0;display:grid;
  grid-template-columns:minmax(0,1fr);
  grid-template-rows:auto clamp(180px,32dvh,260px) auto;
  align-items:stretch;
 }
 .modal-window:has(.interview-shell) .interview-stage::after{
  background:linear-gradient(180deg,#140b220d 0%,transparent 65%,#130e2450 100%);
 }
 .modal-window:has(.interview-shell) .interview-portrait,
 .modal-window:has(.interview-shell) .interview-portrait.large-monster{
  position:relative;grid-column:1;grid-row:2;z-index:1;
  left:auto;top:auto;transform:none;
  display:block;justify-self:center;align-self:stretch;
  width:min(100%,360px);max-width:96%;
  height:100%;max-height:100%;margin:0 auto;
  object-fit:contain;object-position:center center;
 }
 .modal-window:has(.interview-shell) .interview-speech{
  grid-column:1;grid-row:3;position:relative;z-index:3;
  margin:0;padding:10px 12px 12px;
  width:100%;border-left:0;border-right:0;border-bottom:0;
  box-shadow:none;background:#23182ff5;
 }
 .modal-window:has(.interview-shell) .interview-speech p{font-size:14px;line-height:1.5;}
 /* Battle: both armies stay in adjacent columns. Compact one-card-per-row
    rosters preserve portraits, health bars, and status indicators. */
 #overlayRoot .modal-window:has(#battle-field){
  width:calc(100vw - 10px);max-width:calc(100vw - 10px);
  padding:10px 8px;max-height:calc(100dvh - 10px);
 }
 #overlayRoot #battle-field.battle-columns{
  display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;
  align-items:start;margin-top:5px;
 }
 #overlayRoot #battle-field .battle-side{
  min-width:0;padding:7px 5px;border-width:1px;
 }
 #overlayRoot #battle-field .battle-side h3{
  margin:0 0 7px;font-size:15px;display:block;white-space:nowrap;
 }
 #overlayRoot #battle-field .battle-lanes{gap:6px;}
 #overlayRoot #battle-field .battle-lane{min-width:0;padding:5px 4px;}
 #overlayRoot #battle-field .battle-lane-title{
  font-size:12px;gap:4px;margin-bottom:5px;white-space:nowrap;
 }
 #overlayRoot #battle-field .battle-lane-title span{font-size:10px;white-space:nowrap;}
 #overlayRoot #battle-field .battle-lane-units{
  display:grid;grid-template-columns:minmax(0,1fr);gap:4px;
 }
 #overlayRoot #battle-field .fighter-card,
 #overlayRoot #battle-field .battle-side.enemy .fighter-card{
  min-width:0;min-height:0;padding:4px;
 }
 #overlayRoot #battle-field .combat-name,
 #overlayRoot #battle-field .battle-side.enemy .combat-name{
  display:flex;align-items:center;gap:4px;min-width:0;margin:0 0 3px;
 }
 #overlayRoot #battle-field .combat-name>div{min-width:0;flex:1;}
 #overlayRoot #battle-field .fighter-icon,
 #overlayRoot #battle-field .battle-side.enemy .fighter-icon:has(img){
  width:32px;height:38px;min-width:32px;flex:0 0 32px;
  display:grid;place-items:center;padding:0;
 }
 #overlayRoot #battle-field .fighter-icon img{width:100%;height:100%;object-fit:contain;}
 #overlayRoot #battle-field .fighter-card .name,
 #overlayRoot #battle-field .battle-side.enemy .fighter-card .name{
  display:block;font-size:11px;line-height:1.3;white-space:nowrap;
  overflow:hidden;text-overflow:ellipsis;
 }
 #overlayRoot #battle-field .hptext{display:block;font-size:10px;white-space:nowrap;line-height:1.25;}
 #overlayRoot #battle-field .hpbar{height:6px;margin:3px 0 2px;}
 #overlayRoot #battle-field .status-icons{
  font-size:10px;line-height:1.3;min-height:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
 }
 #overlayRoot #battle-field .empty-lane{font-size:11px;}
 #overlayRoot .modal-window:has(#battle-field) .battle-toolbar{gap:6px;margin:0 0 7px;}
 #overlayRoot .modal-window:has(#battle-field) .battle-event{
  font-size:13px;line-height:1.4;min-height:0;padding:7px 9px;
  margin:3px 0 8px;
 }
 #overlayRoot .modal-window:has(#battle-field) .modal-head{margin-bottom:7px;padding-bottom:6px;}
 #overlayRoot .modal-window:has(#battle-field) .modal-head h2{font-size:20px;margin:0;}
}
@media(max-width:360px){
 #overlayRoot #battle-field .battle-side{padding:6px 3px;}
 #overlayRoot #battle-field .battle-lane{padding:4px 2px;}
 #overlayRoot #battle-field .battle-lane-title span{font-size:9px;}
 #overlayRoot #battle-field .fighter-icon,
 #overlayRoot #battle-field .battle-side.enemy .fighter-icon:has(img){
  width:27px;height:34px;min-width:27px;flex-basis:27px;
 }
 #overlayRoot #battle-field .fighter-card .name{font-size:10px;}
}

/* No decorative diamonds over short mobile tab and modal labels. The actual
   frame and active-state color already communicate selection. */
@media(max-width:700px){
 #navTabs.nav-tabs button::before,#navTabs.nav-tabs button::after,
 .modal-window::before,.modal-window::after{
  content:none!important;display:none!important;
 }
 .home-grid .advisor-card{display:none!important;}
}

/* Command-room formation is draggable by touching the monster card itself.
   No separate handles or changes to the formation-editor layout. */
#game-content[data-view="home"] .formation-board .formation-slot.filled{
  cursor:grab;touch-action:none!important;
  user-select:none;-webkit-user-select:none;-webkit-user-drag:none;
}
#game-content[data-view="home"] .formation-board .formation-slot.filled:active{cursor:grabbing}
.formation-pointer-ghost{
 position:fixed;z-index:1001;transform:translate(-50%,-115%);
 pointer-events:none;padding:8px 13px;
 border:2px solid #f2c877;border-radius:8px;
 background:#35233eea;color:#fff1ca;box-shadow:0 8px 20px #0c0717ab;
 font-size:14px;font-weight:800;white-space:nowrap;
}


/* Mobile UX audit 2026-11-20:
   The original bottom nav covered actionable page controls (including the
   formation button at maximum scroll). Keep the one-thumb nav fixed, but
   give the scrollable game its own viewport ABOVE that rail.
   This avoids the nav passing over actions at any scroll position. */
@media(max-width:700px){
 :root{--maou-mobile-nav-height:calc(68px + env(safe-area-inset-bottom,0px));}
 html,body{height:100%;overflow:hidden;}
 #shell.game-shell{
  height:calc(100dvh - var(--maou-mobile-nav-height));
  max-height:calc(100dvh - var(--maou-mobile-nav-height));
  min-height:0;overflow-x:hidden;overflow-y:auto;
  overscroll-behavior-y:contain;-webkit-overflow-scrolling:touch;
  padding-bottom:16px;
  scrollbar-width:thin;
 }
 /* On raid days a second fixed CTA is displayed above the tabs.
    Reserve its 56px plus 10px clearance, rather than letting it cover commands. */
 #shell.game-shell:has(#raidQuickBarRoot .raid-floating-cta){
  height:calc(100dvh - var(--maou-mobile-nav-height) - 66px);
  max-height:calc(100dvh - var(--maou-mobile-nav-height) - 66px);
 }
 body:has(#raidQuickBarRoot .raid-floating-cta) #toast{
  bottom:calc(var(--maou-mobile-nav-height) + 76px);
 }
 /* Action explanations are functional instructions, not decorative captions. */
 .home-grid .action-card small{font-size:12px;line-height:1.5;}
 .home-grid .action-card b{font-size:15px;}
 #navTabs.nav-tabs{
  height:var(--maou-mobile-nav-height);
  min-height:var(--maou-mobile-nav-height);
 }
 .raid-floating-cta{
  bottom:calc(var(--maou-mobile-nav-height) + 10px);
  min-height:56px;padding:6px 12px;white-space:nowrap;
 }
 .raid-floating-cta strong{display:inline;margin-left:5px;font-size:12px;}
 #toast{bottom:calc(var(--maou-mobile-nav-height) + 12px);}
 /* The old 34px detail toggle was easy to miss, especially on dense roster cards. */
 .unit-detail-toggle{min-height:44px;padding-block:10px;}
 /* Consistent minimum tap areas across formation presets, training and MP help. */
 #game-content .formation-preset-row input,
 #game-content select,
 #game-content .formation-preset-actions .btn,
 #game-content .recommended-train-button{min-height:44px;}
 #game-content .pixel-mobile-guide .facility-info-btn{
  width:44px;height:44px;min-width:44px;min-height:44px;
 }
 /* Lilith's portrait is also an interactive help target in the MP tree. */
 #game-content .pixel-tree-dialogue .pixel-lilith-button{
  width:44px;height:44px;min-width:44px;min-height:44px;flex-basis:44px;
 }
}


/* Explicit, fully reachable mobile navigation: four destinations and More.
   Never require horizontal scrolling to leave the formation screen. Desktop
   tabs and the mobile game viewport above the 68px bar are unchanged. */
@media(max-width:700px){
 #navTabs.nav-tabs{
  display:grid;
  grid-template-columns:repeat(5,minmax(0,1fr));
  align-items:stretch;align-content:center;
  column-gap:4px;overflow:visible;
  padding-left:7px;padding-right:7px;
  scroll-snap-type:none;
 }
 #navTabs .main-nav-tabs{display:contents;}
 #navTabs.nav-tabs .mobile-nav-primary,
 #navTabs.nav-tabs .mobile-nav-more-toggle{
  width:100%;min-width:0;min-height:50px;height:50px;
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  padding:3px 1px!important;gap:1px;
  flex:none;font-size:12px;
  letter-spacing:0;line-height:1.1;text-align:center;
 }
 #navTabs.nav-tabs .mobile-nav-primary .mobile-nav-label,
 #navTabs.nav-tabs .mobile-nav-more-toggle .mobile-nav-label{
  display:block;flex:none;font-size:inherit;line-height:1.25;
  width:100%;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:clip;
 }
 #navTabs.nav-tabs .mobile-nav-primary .pixel-tab-icon{
  width:19px;height:19px;min-width:19px;flex:none;
 }
 #navTabs.nav-tabs .mobile-nav-primary .nav-expedition-icon{
  display:block;font-size:21px;line-height:19px;height:19px;flex:none;
 }
 #navTabs.nav-tabs .mobile-nav-more-icon{
  font-size:23px;line-height:19px;height:19px;flex:none;
 }
 #navTabs.nav-tabs .mobile-nav-more-panel{
  position:fixed;left:8px;right:8px;
  bottom:var(--maou-mobile-nav-height);
  z-index:30;max-height:calc(100dvh - var(--maou-mobile-nav-height) - 12px);
  display:flex;flex-direction:column;gap:7px;overflow-y:auto;
  overscroll-behavior:contain;
  padding:12px;background:#24172f;
  border:2px solid #ba9466;
  box-shadow:0 -8px 28px #0c0814e0;
 }
 #navTabs.nav-tabs .mobile-nav-more-panel[hidden]{display:none!important;}
 #navTabs.nav-tabs .mobile-nav-more-title{
  color:#f4d49e;font-size:14px;line-height:1.45;
  padding:2px 3px 5px;
 }
 #navTabs.nav-tabs .mobile-nav-more-item,
 #navTabs.nav-tabs .mobile-nav-more-close{
  display:flex;flex:none;width:100%;min-height:48px;
  justify-content:flex-start;align-items:center;text-align:left;
  padding:10px 12px!important;font-size:14px;
 }
 #navTabs.nav-tabs .mobile-nav-more-close{
  justify-content:center;
 }
}


/* Secondary phone screen navigation for army pages. The fixed bottom rail
   stays available, but is not the only way to return to the command room. */
.mobile-screen-route{display:none}
@media(max-width:700px){
 #game-content>.mobile-screen-route{
  display:grid;gap:7px;position:sticky;top:0;z-index:12;
  padding:6px 0;max-width:100%;min-width:0;
  border:2px solid #af8b68;background:#211728f5;
  box-shadow:inset 0 0 0 2px #46304a,0 5px 15px #0a0714c7;
 }
 .mobile-screen-route-controls{
  display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:3px;
 }
 .mobile-screen-route-tab,.mobile-screen-route-more summary{
  display:flex;align-items:center;justify-content:center;min-width:0;min-height:52px;
  padding:6px 1px;border:2px solid #776178;border-radius:0;
  background:#30233b;color:#e9d7e5;box-shadow:inset 0 -3px 0 #1a1325;
  font-family:inherit;font-size:12px;font-weight:700;
  line-height:1.3;text-align:center;white-space:nowrap;cursor:pointer;
  touch-action:manipulation;
 }
 .mobile-screen-route-tab.selected,.mobile-screen-route-tab[aria-current="page"]{
  border-color:#f1cf8f;background:#68465e;color:#fff1be;
  box-shadow:inset 0 -3px 0 #e5b772;
 }
 .mobile-screen-route-tab:focus-visible,.mobile-screen-route-more summary:focus-visible,
 .mobile-screen-route-more-options button:focus-visible{
  outline:3px solid #fff4ba;outline-offset:2px;
 }
 .mobile-screen-route-more{position:relative;min-width:0}
 .mobile-screen-route-more summary{list-style:none;width:100%;height:100%}
 .mobile-screen-route-more summary::-webkit-details-marker{display:none}
 .mobile-screen-route-more.selected summary,
 .mobile-screen-route-more[open] summary{
  border-color:#e7b979;background:#583b53;color:#fff0bc;
 }
 .mobile-screen-route-more-options{
  position:absolute;z-index:15;right:0;top:calc(100% + 5px);
  display:grid;gap:5px;width:min(248px,calc(100vw - 24px));
  padding:8px;border:2px solid #cfad74;background:#211728;
  box-shadow:0 9px 22px #08040dd9;
 }
 .mobile-screen-route-more-options button{
  min-height:46px;padding:8px 10px;width:100%;border:2px solid #806483;
  background:#39283f;color:#f1deea;font-size:14px;cursor:pointer;text-align:left;
  touch-action:manipulation;
 }
 .mobile-screen-route-more-options button.selected{border-color:#f1cf8f;color:#fff1be;background:#68465e}
 .mobile-screen-route-more-options button:hover{border-color:#e1b985}
}

/* Phone redesign: the upper six-tab rail is the only page navigation.
   The fixed lower rail is hidden; its reserved viewport is reclaimed. */
@media(max-width:700px){
 #navTabs.nav-tabs{display:none!important}
 html,body{height:100%;overflow:hidden}
 #shell.game-shell,
 #shell.game-shell:has(#raidQuickBarRoot .raid-floating-cta){
  height:100dvh;max-height:100dvh;min-height:0;
  padding-bottom:calc(16px + env(safe-area-inset-bottom,0px));
 }
 #shell.game-shell:has(#raidQuickBarRoot .raid-floating-cta){
  padding-bottom:calc(90px + env(safe-area-inset-bottom,0px));
 }
 .raid-floating-cta{bottom:calc(12px + env(safe-area-inset-bottom,0px))}
 #toast{bottom:calc(12px + env(safe-area-inset-bottom,0px))}
 body:has(#raidQuickBarRoot .raid-floating-cta) #toast{
  bottom:calc(80px + env(safe-area-inset-bottom,0px));
 }
 .mobile-screen-route-tab,.mobile-screen-route-more summary{
  min-height:52px;height:52px;letter-spacing:0;
 }
 .mobile-screen-route-more-options{width:min(180px,calc(100vw - 24px))}
 .mobile-screen-route-more-options button{min-height:48px}
}
@media(max-width:359px){
 .mobile-screen-route-tab,.mobile-screen-route-more summary{font-size:11px}
}

/* Only phones use the sixth quick tab for MP; journal moves into ☰ menu.
   Desktop still shows the existing seven full navigation destinations. */
#gameHeaderActions > .mobile-journal-link{display:none;}
@media(max-width:700px){
 #gameHeaderActions.mobile-open > .mobile-journal-link{display:inline-flex;}
}

/* Keep both diamond corners clear of the actual section heading, including
   Japanese h2/h3 (not just the English eyebrow) and flex title rows. */
@media(max-width:700px){
 .panel > :is(.eyebrow,h2,h3,.section-title-with-info,.row-label:first-child){
  padding-inline:22px;
  min-width:0;
  overflow-wrap:anywhere;
 }
}

.home-grid .action-card .action-desc-phone{display:none;}
@media(max-width:700px){
 .home-grid .action-card .action-desc-pc{display:none;}
 .home-grid .action-card .action-desc-phone{display:inline;}
}

/* Phone command-room cards: icon left, text right. A 64px high, consistent
   2-column grid saves vertical space without shrinking the tap target below
   44px. Disabled-action notices remain below each button. */
@media(max-width:700px){
 .home-grid .action-grid{
  grid-auto-rows:minmax(64px,auto);
  align-items:start;
 }
 .home-grid .action-grid > .btn-wrap{
  min-width:0;
  min-height:0;
  height:auto;
  align-self:start;
 }
 .home-grid .action-grid > .btn-wrap > .action-card{
  box-sizing:border-box;
  width:100%;
  height:64px;
  flex:0 0 64px;
  min-height:0;
  flex-direction:row;
  align-items:center;
  justify-content:flex-start;
  padding:2px 5px;
  gap:4px;
 }
 .home-grid .action-card .action-symbol{
  width:24px;
  min-width:24px;
  height:24px;
  flex:0 0 24px;
 }
 .home-grid .action-card .action-symbol .pixel-ui-icon{
  width:24px;
  height:24px;
 }
 .home-grid .action-card > span:not(.action-symbol){
  min-width:0;
  flex:1 1 auto;
 }
 .home-grid .action-card b{
  font-size:12px;
  line-height:1.2;
  white-space:nowrap;
 }
 .home-grid .action-card small{
  font-size:10px;
  line-height:1.25;
  margin-top:2px;
  white-space:nowrap;
 }
}

/* Compact only the contact action; keep all other header controls unchanged.
   A smaller label and tighter horizontal insets prevent adjacent header buttons
   from competing for width on narrow desktop/tablet and in the phone menu. */
/* Header contact is condensed exclusively inside the PHONE menu;
   the original PC header button sizes and styles are preserved. */
@media(max-width:700px){
 #gameHeaderActions.mobile-open > button[onclick*="MAOU_FEEDBACK.open()"]{
  font-size:13px;
  padding-inline:9px;
  width:100%;
  min-height:46px;
 }
}

/* The title's contact button uses the original pixel-art nine-slice on
   BOTH PC and phone. Unlike unrelated buttons, it must not inherit the
   4px black shadow from pixel_ui.css's high-specificity .btn rule. */
.pixel-title-stage > .feedback-title-trigger.btn.ghost.small,
.pixel-title-stage > .feedback-title-trigger.btn.ghost.small:hover:not(:disabled),
.pixel-title-stage > .feedback-title-trigger.btn.ghost.small:active:not(:disabled){
 box-shadow:none!important;
}

/* Phone title contact: ONE shared pixel-button border only.
   The previous mobile CSS drew an extra gold border AND a second image-backed
   ::before frame around the existing .btn.small frame, causing concentric
   rectangles. Keep the original nine-slice from pixel_asset_skin_v221.css. */
@media(max-width:700px){
 .pixel-title-stage > .feedback-title-trigger.btn.ghost.small{
  position:absolute;
  top:auto;
  right:auto;
  left:8px;
  bottom:8px;
  box-sizing:border-box;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:max-content;
  max-width:calc(100% - 16px);
  min-height:44px;
  padding:4px 5px;
  font-size:12px;
  line-height:1.15;
  letter-spacing:0;
  white-space:nowrap;
  /* .btn in pixel_ui.css sets a 4px black drop shadow with !important.
     Its specificity beats the later :where(.btn) reset, so remove it here. */
  box-shadow:none!important;
 }
 .pixel-title-stage > .feedback-title-trigger.btn.ghost.small:hover:not(:disabled),
 .pixel-title-stage > .feedback-title-trigger.btn.ghost.small:active:not(:disabled){
  box-shadow:none!important;
 }
 /* Keyboard focus remains visible but does not introduce an OUTSIDE frame. */
 .pixel-title-stage > .feedback-title-trigger.btn.ghost.small:focus-visible{
  outline:2px solid #fff0ab!important;
  outline-offset:-6px!important;
 }
}

/* Phone formation editor matches the command-room card drag; PC unchanged. */
@media(max-width:700px){
 #game-content[data-view="formation"] .formation-board .formation-slot.filled{
  cursor:grab;touch-action:none!important;
  user-select:none;-webkit-user-select:none;-webkit-user-drag:none;
 }
 #game-content[data-view="formation"] .formation-board .formation-slot.filled:active{cursor:grabbing;}
}

/* Mobile title: the approved PC-style scene, recomposed as a vertical image.
   Only phones/tablets <= 700px change. Desktop retains the original 1671:941
   background, center overlay buttons, and untouched title artwork. */
@media(max-width:700px){
 .overlay:has(.pixel-title-stage){
  padding:0!important;align-items:flex-start;overflow-y:auto;overscroll-behavior:contain;
 }
 .modal-window:has(.pixel-title-stage){
  flex:0 0 auto;width:100%!important;max-width:100%!important;
  max-height:none!important;margin:0;padding:0!important;overflow:visible!important;
 }
 .pixel-title-stage{
  box-sizing:border-box;width:100%;height:100vh;height:100dvh;min-height:480px;
  max-height:none!important;aspect-ratio:auto;overflow:hidden;
  background:#211537 url('assets/title/title_background_mobile.webp') center center/cover no-repeat!important;
  image-rendering:pixelated;box-shadow:none;
 }
 .pixel-title-stage::before{content:none;display:none;}
 .pixel-title-buttons{
  position:absolute;inset:auto;top:55%;left:50%;right:auto;
  transform:translateX(-50%);width:min(80%,345px);max-width:calc(100% - 30px);
  margin:0;display:flex;flex-direction:column;gap:clamp(8px,1.2dvh,13px);
 }
 .pixel-title-buttons .pixel-title-btn{
  flex:0 0 auto;width:100%;min-height:44px;
 }
 .pixel-title-settings{
  position:absolute;inset:auto;top:45%;left:50%;
  transform:translateX(-50%);width:min(90%,420px);
  max-height:43%;box-sizing:border-box;overflow-y:auto;
  padding:12px;gap:9px;background:#20152fe8;
 }
 .pixel-title-settings .btn{min-height:44px;}
 /* A progress panel must not obscure the settings controls. */
 .pixel-title-stage:has(.pixel-title-settings) .pixel-title-warmup{display:none!important;}
 .pixel-title-warmup{
  position:absolute;top:46%;bottom:auto;
  left:50%;width:min(92%,420px);padding:5px 8px;
  transform:translateX(-50%);font-size:11px;
 }
 .pixel-title-stage > .feedback-title-trigger.btn.ghost.small{
  bottom:calc(8px + env(safe-area-inset-bottom, 0px));
 }
 .pixel-title-version{
  bottom:calc(18px + env(safe-area-inset-bottom, 0px));
  right:10px;max-width:40%;text-align:right;
 }
}
@media(max-width:700px) and (max-height:600px) and (orientation:portrait){
 .pixel-title-buttons{top:54%;width:min(78%,320px);gap:7px;}
 .pixel-title-warmup{top:45%;}
}
/* Landscape phones retain the original landscape art with large controls. */
@media(max-width:700px) and (orientation:landscape){
 .pixel-title-stage{
  min-height:100dvh;
  background-image:url('assets/title/title_background.webp')!important;
  background-size:cover!important;
 }
 .pixel-title-buttons{
  top:47%;left:71%;width:min(34%,270px);
  gap:7px;
 }
 .pixel-title-buttons .pixel-title-btn{
  min-height:44px;
 }
 .pixel-title-settings{
  top:19%;left:72%;width:43%;max-height:66%;
 }
 .pixel-title-warmup{top:auto;bottom:21%;width:45%;left:26%;}
}

/* Mobile viewport repair (2026-11-23)
   Do not imprison the game in an independent 100dvh scroller. Browser
   address bars and Android display modes can resize the visual viewport
   without keeping that nested scroller's bottom in sync. */
@media(max-width:700px){
 html{
  height:auto!important;
  overflow-x:clip!important;
  overflow-y:auto!important;
  scrollbar-gutter:auto!important;
  scroll-padding-top:calc(66px + env(safe-area-inset-top,0px));
 }
 body{
  height:auto!important;
  min-height:100svh;
  overflow-x:clip!important;
  overflow-y:visible!important;
 }
 #shell.game-shell,
 #shell.game-shell:has(#raidQuickBarRoot .raid-floating-cta){
  box-sizing:border-box;
  display:flex;
  flex-direction:column;
  height:auto!important;
  max-height:none!important;
  min-height:100svh!important;
  min-height:100dvh!important;
  overflow:visible!important;
  padding-top:env(safe-area-inset-top,0px);
  padding-bottom:calc(10px + env(safe-area-inset-bottom,0px))!important;
 }
 #shell.game-shell:has(#raidQuickBarRoot .raid-floating-cta){
  padding-bottom:calc(92px + env(safe-area-inset-bottom,0px))!important;
 }
 #app{flex:1 0 auto;min-height:0;}
 #game-content>.mobile-screen-route{
  top:env(safe-area-inset-top,0px);
 }
 #game-content>.screen{
  min-height:0;
 }
 #game-content .formation-candidate-list{
  scroll-margin-top:calc(70px + env(safe-area-inset-top,0px));
 }
 .site-footer{
  padding:8px 6px calc(12px + env(safe-area-inset-bottom,0px));
 }
 /* Shorter visible heights must not crop the bottom of the title stage. */
 .pixel-title-stage{
  min-height:0!important;
  height:100svh;
  height:100dvh;
  background-position:center top!important;
 }
}
@media(max-width:700px) and (max-height:540px) and (orientation:portrait){
 .pixel-title-buttons{top:40%;gap:5px;}
 .pixel-title-settings{top:25%;max-height:53%;}
 .pixel-title-warmup{top:34%;}
}
/* English descriptions may wrap; keep the paired command actions identical in size. */
html[data-i18n-preview="en"] .home-grid .action-grid > .btn-wrap{
 min-width:0;
}
html[data-i18n-preview="en"] .home-grid .action-grid > .btn-wrap > .action-card{
 width:100%;min-width:0;
}
html[data-i18n-preview="en"] .home-grid .action-card > span:not(.action-symbol){
 min-width:0;flex:1 1 auto;
}
html[data-i18n-preview="en"] .home-grid .action-card b,
html[data-i18n-preview="en"] .home-grid .action-card small{
 white-space:normal;overflow-wrap:anywhere;
}
html[data-i18n-preview="en"] .home-grid .action-grid > .btn-wrap > .action-card{
 flex:1 1 auto;min-height:98px;
}
@media(max-width:700px){
 html[data-i18n-preview="en"] .home-grid .action-grid > .btn-wrap > .action-card{
  height:72px;min-height:0;flex:0 0 72px;
 }
}
