/* InazumArcade V789 · mobile-only repair for Home, Google entry and Battaglia Inazuma.
   Every selector is gated by ia-real-phone-mode; desktop presentation is untouched. */

/* -------------------------------------------------------------------------
   PHONE NAVBAR: keep Google + theme controls inside the visible utility row.
   The previous absolute offsets placed both controls outside the right edge.
   ------------------------------------------------------------------------- */
html.ia-real-phone-mode.ia-phone-landscape .topbar .topbar-actions{
  gap:4px!important;
  right:5px!important;
  width:max-content!important;
  max-width:calc(100vw - 10px)!important;
}
html.ia-real-phone-mode.ia-phone-landscape .topbar .ia270-report-wrap{
  display:flex!important;
  flex:0 0 112px!important;
  width:112px!important;
  min-width:112px!important;
  max-width:112px!important;
  height:38px!important;
  margin:0!important;
  padding:0!important;
  gap:5px!important;
  align-items:center!important;
  justify-content:space-between!important;
  overflow:visible!important;
}
html.ia-real-phone-mode.ia-phone-landscape .topbar .ia270-report-wrap>.ia270-report-trigger,
html.ia-real-phone-mode.ia-phone-landscape .topbar .ia270-report-wrap>.ia-navbar-theme-trigger,
html.ia-real-phone-mode.ia-phone-landscape .topbar .ia270-report-wrap>.ia-navbar-google-trigger{
  position:relative!important;
  inset:auto!important;
  left:auto!important;
  right:auto!important;
  top:auto!important;
  transform:none!important;
  flex:0 0 34px!important;
  width:34px!important;
  min-width:34px!important;
  max-width:34px!important;
  height:34px!important;
  min-height:34px!important;
  max-height:34px!important;
  margin:0!important;
}
html.ia-real-phone-mode.ia-phone-landscape .topbar .ia270-report-wrap>.ia-navbar-theme-trigger,
html.ia-real-phone-mode.ia-phone-landscape .topbar .ia270-report-wrap>.ia-navbar-google-trigger{
  display:grid!important;
  place-items:center!important;
  padding:2px!important;
  border-radius:9px!important;
}
html.ia-real-phone-mode.ia-phone-landscape .topbar .ia270-report-wrap>.ia-navbar-theme-trigger svg{
  width:19px!important;height:19px!important;
}
html.ia-real-phone-mode.ia-phone-landscape .topbar .ia270-report-wrap>.ia-navbar-google-trigger img{
  width:100%!important;height:100%!important;object-fit:contain!important;
}
/* Reserve the wider utility row before the brand and let the mode strip pan. */
html.ia-real-phone-mode.ia-phone-landscape .topbar .brand-bar{
  right:clamp(345px,38vw,365px)!important;
  width:30px!important;min-width:30px!important;
}
html.ia-real-phone-mode.ia-phone-landscape #modeNavBar .mode-nav-inner{
  padding-right:350px!important;
  overflow-x:auto!important;
  overflow-y:hidden!important;
  scrollbar-width:none!important;
  touch-action:pan-x!important;
}
html.ia-real-phone-mode.ia-phone-landscape #modeNavBar .mode-nav-inner::-webkit-scrollbar{display:none!important}
@media(max-width:655px){
  html.ia-real-phone-mode.ia-phone-landscape #modeNavBar .mode-nav-inner{padding-right:315px!important;}
}

/* -------------------------------------------------------------------------
   HOME: restore a real document-flow grid on phone landscape.
   V507/V505 gave the scouting and news cards two-ID absolute-position rules;
   the older generic phone selectors could not override those rules.
   ------------------------------------------------------------------------- */
html.ia-real-phone-mode.ia-phone-landscape #screen-home.ia-home-recreated{
  position:relative!important;
  inset:auto!important;
  left:auto!important;right:auto!important;top:auto!important;bottom:auto!important;
  width:100%!important;max-width:100%!important;
  height:auto!important;min-height:calc(100dvh - 61px)!important;
  margin:0!important;padding:0!important;
  overflow:visible!important;
}
html.ia-real-phone-mode.ia-phone-landscape #screen-home .ia-home-stage{
  position:relative!important;
  display:grid!important;
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
  grid-auto-rows:min-content!important;
  grid-auto-flow:row!important;
  align-content:start!important;
  align-items:stretch!important;
  width:100%!important;height:auto!important;min-height:0!important;
  padding:10px 10px calc(26px + env(safe-area-inset-bottom))!important;
  gap:10px!important;
  overflow:visible!important;
  box-sizing:border-box!important;
}
html.ia-real-phone-mode.ia-phone-landscape #screen-home .ia-home-panel{
  position:relative!important;
  inset:auto!important;left:auto!important;right:auto!important;top:auto!important;bottom:auto!important;
  width:100%!important;height:auto!important;max-height:none!important;
  min-width:0!important;margin:0!important;
  transform:none!important;overflow:visible!important;
  box-sizing:border-box!important;
}
/* Battaglia card: full-width first row, never the old desktop absolute tile. */
html.ia-real-phone-mode.ia-phone-landscape #screen-home #iaScoutingHomeCard{
  position:relative!important;
  inset:auto!important;left:auto!important;right:auto!important;top:auto!important;bottom:auto!important;
  grid-column:1/-1!important;grid-row:auto!important;order:1!important;
  width:100%!important;height:auto!important;min-height:174px!important;
  margin:0!important;z-index:4!important;
}
html.ia-real-phone-mode.ia-phone-landscape #screen-home #iaScoutingHomeCard .ia-scouting-home-inner{
  width:100%!important;height:auto!important;min-height:174px!important;
  padding:12px 15px!important;box-sizing:border-box!important;
}
html.ia-real-phone-mode.ia-phone-landscape #screen-home #iaScoutingHomeCard .ia-scouting-home-body{
  display:grid!important;
  grid-template-columns:minmax(0,1.25fr) minmax(145px,.75fr)!important;
  align-items:center!important;gap:12px!important;
}
html.ia-real-phone-mode.ia-phone-landscape #screen-home #iaScoutingHomeCard .ia-scouting-home-art svg{
  display:block!important;width:100%!important;max-width:190px!important;height:auto!important;max-height:100px!important;
}
/* Remaining home cards: explicit order and normal flow, with comfortable height. */
html.ia-real-phone-mode.ia-phone-landscape #screen-home .ia-challenge-panel{
  grid-column:1!important;order:2!important;min-height:210px!important;
}
html.ia-real-phone-mode.ia-phone-landscape #screen-home #iaNewsOpenTrigger{
  position:relative!important;
  inset:auto!important;left:auto!important;right:auto!important;top:auto!important;bottom:auto!important;
  grid-column:2!important;order:3!important;
  width:100%!important;height:auto!important;min-height:210px!important;
  margin:0!important;z-index:4!important;
}
html.ia-real-phone-mode.ia-phone-landscape #screen-home #iaNewsOpenTrigger>.ia-panel-inner{
  height:auto!important;min-height:210px!important;padding:12px 14px!important;
}
html.ia-real-phone-mode.ia-phone-landscape #screen-home #homeNewsCarousel.ia-news-carousel{
  height:auto!important;min-height:145px!important;max-height:none!important;
}
html.ia-real-phone-mode.ia-phone-landscape #screen-home .ia-profile-panel{
  grid-column:1!important;order:4!important;min-height:290px!important;
}
html.ia-real-phone-mode.ia-phone-landscape #screen-home .ia-ranking-panel{
  grid-column:2!important;order:5!important;min-height:300px!important;
}
html.ia-real-phone-mode.ia-phone-landscape #screen-home .ia-idle-hq-panel{
  grid-column:1/-1!important;order:6!important;
  position:relative!important;inset:auto!important;left:auto!important;right:auto!important;top:auto!important;bottom:auto!important;
  width:100%!important;height:auto!important;min-height:345px!important;
}
html.ia-real-phone-mode.ia-phone-landscape #screen-home .ia-idle-hq-inner{
  height:auto!important;min-height:345px!important;padding:13px 15px!important;
}
html.ia-real-phone-mode.ia-phone-landscape #screen-home .ia-idle-hq-body{
  grid-template-columns:minmax(0,1.25fr) minmax(180px,.75fr)!important;
  min-height:230px!important;gap:10px!important;
}
html.ia-real-phone-mode.ia-phone-landscape #screen-home .ia-next-move-panel{
  grid-column:1/-1!important;order:7!important;min-height:92px!important;
  position:relative!important;inset:auto!important;left:auto!important;right:auto!important;top:auto!important;bottom:auto!important;
  width:100%!important;height:auto!important;
}
html.ia-real-phone-mode.ia-phone-landscape #screen-home .ia-panel-inner{
  position:relative!important;inset:0!important;
  width:100%!important;height:auto!important;min-height:100%!important;
  max-height:none!important;overflow:visible!important;box-sizing:border-box!important;
}
html.ia-real-phone-mode.ia-phone-landscape #screen-home .ia-profile-panel .ia-profile-actions{
  position:relative!important;inset:auto!important;width:100%!important;margin:16px 0 0!important;
}
html.ia-real-phone-mode.ia-phone-landscape #screen-home .ia-home-panel button,
html.ia-real-phone-mode.ia-phone-landscape #screen-home .ia-home-panel[role="button"]{
  touch-action:manipulation!important;
}
/* Smaller landscape phones use a single clean column rather than cramped tiles. */
@media(max-width:850px) and (orientation:landscape){
  html.ia-real-phone-mode.ia-phone-landscape #screen-home .ia-home-stage{grid-template-columns:minmax(0,1fr)!important;}
  html.ia-real-phone-mode.ia-phone-landscape #screen-home #iaScoutingHomeCard,
  html.ia-real-phone-mode.ia-phone-landscape #screen-home #iaNewsOpenTrigger,
  html.ia-real-phone-mode.ia-phone-landscape #screen-home .ia-challenge-panel,
  html.ia-real-phone-mode.ia-phone-landscape #screen-home .ia-profile-panel,
  html.ia-real-phone-mode.ia-phone-landscape #screen-home .ia-ranking-panel,
  html.ia-real-phone-mode.ia-phone-landscape #screen-home .ia-idle-hq-panel,
  html.ia-real-phone-mode.ia-phone-landscape #screen-home .ia-next-move-panel{grid-column:1!important;}
  html.ia-real-phone-mode.ia-phone-landscape #screen-home #iaScoutingHomeCard .ia-scouting-home-body{grid-template-columns:minmax(0,1fr) minmax(125px,.55fr)!important;}
  html.ia-real-phone-mode.ia-phone-landscape #screen-home .ia-idle-hq-body{grid-template-columns:minmax(0,1fr)!important;}
}

/* -------------------------------------------------------------------------
   BATTAGLIA INAZUMA: phone-landscape fit + touch-friendly scrolling.
   Keep the board and its state intact; only adapt the visual layout.
   ------------------------------------------------------------------------- */
html.ia-real-phone-mode.ia-phone-landscape #iaScoutingOverlay{
  padding:0!important;place-items:stretch!important;overflow:hidden!important;
}
html.ia-real-phone-mode.ia-phone-landscape #iaScoutingOverlay .ia-scouting-shell{
  width:100vw!important;max-width:100vw!important;
  height:100dvh!important;min-height:0!important;max-height:100dvh!important;
  margin:0!important;border-radius:0!important;overflow:hidden!important;
  grid-template-rows:auto auto auto minmax(0,1fr) auto!important;
}
html.ia-real-phone-mode.ia-phone-landscape #iaScoutingOverlay .ia-scouting-header{
  min-width:0!important;gap:8px!important;padding:8px 11px!important;
}
html.ia-real-phone-mode.ia-phone-landscape #iaScoutingOverlay .ia-scouting-brand{gap:8px!important;}
html.ia-real-phone-mode.ia-phone-landscape #iaScoutingOverlay .ia-scouting-brand-icon{
  width:34px!important;height:34px!important;flex:0 0 34px!important;font-size:21px!important;border-radius:10px!important;
}
html.ia-real-phone-mode.ia-phone-landscape #iaScoutingOverlay .ia-scouting-header h2{
  font-size:clamp(14px,2vw,20px)!important;line-height:1.05!important;
}
html.ia-real-phone-mode.ia-phone-landscape #iaScoutingOverlay .ia-scouting-eyebrow{font-size:8px!important;}
html.ia-real-phone-mode.ia-phone-landscape #iaScoutingOverlay .ia-scouting-head-actions{gap:5px!important;}
html.ia-real-phone-mode.ia-phone-landscape #iaScoutingOverlay .ia-os-motion,
html.ia-real-phone-mode.ia-phone-landscape #iaScoutingOverlay .ia-os-guide-shortcut,
html.ia-real-phone-mode.ia-phone-landscape #iaScoutingOverlay .ia-sc-close{
  min-height:38px!important;height:38px!important;padding:0 9px!important;font-size:9px!important;
}
html.ia-real-phone-mode.ia-phone-landscape #iaScoutingOverlay .ia-sc-close{
  flex:0 0 38px!important;width:38px!important;padding:0!important;font-size:23px!important;
}
html.ia-real-phone-mode.ia-phone-landscape #iaScoutingOverlay .ia-scouting-topline{
  min-width:0!important;gap:7px!important;padding:5px 11px!important;font-size:8px!important;letter-spacing:.08em!important;
}
html.ia-real-phone-mode.ia-phone-landscape #iaScoutingOverlay .ia-scouting-main{
  min-width:0!important;min-height:0!important;max-height:none!important;
  overflow-x:hidden!important;overflow-y:auto!important;
  overscroll-behavior:contain!important;-webkit-overflow-scrolling:touch!important;
  touch-action:pan-y!important;padding:7px 9px 15px!important;
}
/* Legacy 5×5 expedition view */
html.ia-real-phone-mode.ia-phone-landscape #iaScoutingOverlay #iaScoutingMain[data-view="game"]{
  height:auto!important;min-height:0!important;max-height:none!important;
  overflow-x:hidden!important;overflow-y:auto!important;
  padding:6px 9px 16px!important;touch-action:pan-y!important;
}
html.ia-real-phone-mode.ia-phone-landscape #iaScoutingOverlay #iaScoutingMain[data-view="game"] .ia-os-mission-layout{
  grid-template-columns:minmax(0,1.1fr) minmax(245px,.9fr)!important;
  grid-template-rows:auto!important;align-items:start!important;
  min-height:max-content!important;overflow:visible!important;gap:8px!important;
}
html.ia-real-phone-mode.ia-phone-landscape #iaScoutingOverlay #iaScoutingMain[data-view="game"] .ia-os-board-frame{
  width:min(100%,min(56vh,310px))!important;max-width:100%!important;
  max-height:none!important;flex:0 0 auto!important;aspect-ratio:1/1!important;
}
html.ia-real-phone-mode.ia-phone-landscape #iaScoutingOverlay #iaScoutingMain[data-view="game"] .ia-os-mission-side{
  min-height:max-content!important;height:auto!important;overflow:visible!important;
  align-content:start!important;gap:6px!important;
}
html.ia-real-phone-mode.ia-phone-landscape #iaScoutingOverlay #iaScoutingMain[data-view="game"] .ia-os-mission-side>section{
  min-height:0!important;overflow:visible!important;padding:7px 8px!important;
}
html.ia-real-phone-mode.ia-phone-landscape #iaScoutingOverlay #iaScoutingMain[data-view="game"] .ia-os-team-member b,
html.ia-real-phone-mode.ia-phone-landscape #iaScoutingOverlay #iaScoutingMain[data-view="game"] .ia-os-ability-row b{
  font-size:9px!important;line-height:1.2!important;
}
html.ia-real-phone-mode.ia-phone-landscape #iaScoutingOverlay #iaScoutingMain[data-view="game"] .ia-os-team-member small,
html.ia-real-phone-mode.ia-phone-landscape #iaScoutingOverlay #iaScoutingMain[data-view="game"] .ia-os-ability-row small{
  font-size:7px!important;line-height:1.2!important;
}
html.ia-real-phone-mode.ia-phone-landscape #iaScoutingOverlay #iaScoutingMain[data-view="game"] .ia-os-mission-side button{
  min-height:38px!important;padding:7px 8px!important;font-size:9px!important;
}
/* New V513 radar gameplay view */
html.ia-real-phone-mode.ia-phone-landscape #iaScoutingOverlay #iaScoutingMain[data-view="game"] .ia-v513-game:not(.has-found){
  height:auto!important;min-height:0!important;overflow:visible!important;
}

html.ia-real-phone-mode.ia-phone-landscape #iaScoutingOverlay #iaScoutingMain[data-view="game"] .ia-v513-game:not(.has-found) .ia-v513-game-layout{
  height:auto!important;min-height:0!important;grid-template-rows:auto!important;
  align-items:start!important;gap:9px!important;overflow:visible!important;
}
html.ia-real-phone-mode.ia-phone-landscape #iaScoutingOverlay #iaScoutingMain[data-view="game"] .ia-v513-game:not(.has-found) .ia-v513-radar-zone{
  min-width:0!important;min-height:0!important;height:auto!important;
  grid-template-columns:minmax(0,1fr)!important;grid-template-areas:"head" "board" "legend" "feed"!important;
  align-content:start!important;gap:7px!important;overflow:visible!important;
}
html.ia-real-phone-mode.ia-phone-landscape #iaScoutingOverlay #iaScoutingMain[data-view="game"] .ia-v513-game:not(.has-found) .ia-v513-radar-shell{
  width:min(100%,min(58vh,310px))!important;max-width:310px!important;
  height:auto!important;max-height:none!important;aspect-ratio:1/1!important;
}
html.ia-real-phone-mode.ia-phone-landscape #iaScoutingOverlay #iaScoutingMain[data-view="game"] .ia-v513-game:not(.has-found) .ia-v513-side{
  min-width:0!important;min-height:0!important;height:auto!important;
  grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:6px!important;
  overflow:visible!important;
}
html.ia-real-phone-mode.ia-phone-landscape #iaScoutingOverlay #iaScoutingMain[data-view="game"] .ia-v513-game:not(.has-found) .ia-v513-squad-panel,
html.ia-real-phone-mode.ia-phone-landscape #iaScoutingOverlay #iaScoutingMain[data-view="game"] .ia-v513-game:not(.has-found) .ia-v513-tools-panel{
  grid-column:1/-1!important;
}
html.ia-real-phone-mode.ia-phone-landscape #iaScoutingOverlay #iaScoutingMain[data-view="game"] .ia-v513-game:not(.has-found) .ia-v513-team-member{
  min-height:38px!important;grid-template-columns:30px minmax(0,1fr) 12px!important;
}
html.ia-real-phone-mode.ia-phone-landscape #iaScoutingOverlay #iaScoutingMain[data-view="game"] .ia-v513-side button,
html.ia-real-phone-mode.ia-phone-landscape #iaScoutingOverlay #iaScoutingMain[data-view="game"] .ia-v513-found-actions button{
  min-height:38px!important;font-size:9px!important;
}
@media(max-width:850px) and (orientation:landscape){
  html.ia-real-phone-mode.ia-phone-landscape #iaScoutingOverlay #iaScoutingMain[data-view="game"] .ia-v513-game:not(.has-found) .ia-v513-game-layout{
    grid-template-columns:minmax(0,1fr)!important;grid-template-rows:auto auto!important;
    grid-template-areas:"radar" "side"!important;
  }
  html.ia-real-phone-mode.ia-phone-landscape #iaScoutingOverlay #iaScoutingMain[data-view="game"] .ia-v513-game:not(.has-found) .ia-v513-radar-shell{width:min(100%,min(62vh,300px))!important;}
  html.ia-real-phone-mode.ia-phone-landscape #iaScoutingOverlay #iaScoutingMain[data-view="game"] .ia-os-mission-layout{
    grid-template-columns:minmax(0,1fr)!important;grid-template-rows:auto auto!important;
  }
}
