/* This host occupies the existing fitted board slot. The game supplies its cell
   buttons, legal targets, score markers, card fronts and both side panels. */
body[data-screen="battle"] .atlas-frame{
  position:relative;isolation:isolate;flex:none;overflow:hidden;
  width:calc(7 * var(--cell) + 16px + var(--atlas-extra,0px));height:calc(7 * var(--cell) + 16px);
  background:#101619 url('/atlas/expanded-table.webp') center/100% 100% no-repeat;
}
.atlas-canvas{display:block;position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
body[data-theme][data-screen="battle"] .atlas-frame .field{
  position:absolute;left:50%;top:50%;width:max-content;box-sizing:content-box;
  transform:translate(-50%,-50%) scale(.84);transform-origin:50% 50%;
  background:#5c5945;
}
/* The paper layout fits the same roller-to-roller print when motion or WebGL is unavailable. */
body[data-theme][data-screen="battle"] .atlas-frame:not(.atlas-ready) .field{
  width:86.66%;height:84.13%;padding:0;gap:0;transform:translate(-50%,-50%);
  grid-template-columns:repeat(var(--cols),minmax(0,1fr));grid-template-rows:repeat(7,minmax(0,1fr));
}
body[data-screen="battle"] .atlas-frame:not(.atlas-ready) .cell{width:100%;height:100%}
body[data-screen="battle"] .atlas-frame.atlas-ready .field{
  left:0;top:0;transform-origin:0 0;background:transparent;box-shadow:none;
}
body[data-screen="battle"] .atlas-frame.atlas-opening .field{opacity:0}
body[data-screen="battle"] .atlas-frame.atlas-deploying .field{opacity:1}
body[data-screen="battle"] .atlas-frame:is(.atlas-deploying,.atlas-paper-deploy) .cell:has(.unit-card){overflow:visible}
body[data-screen="battle"] .atlas-frame.atlas-orbit{touch-action:none;cursor:grab}
body[data-theme][data-screen="battle"] .atlas-frame .field .cell:not(.legal):not(.attack):not(.selected):not(.preview-target):not(.response-attacker):not(.response-defender){
  background:transparent;border-color:#ead8b359;
}

body[data-screen="battle"] .atlas-frame .coordinate{color:#fff1d0;text-shadow:0 1px 2px #130f0b,0 0 3px #241d14}
body[data-screen="battle"] #atlas-camera[hidden]{display:none}

@media(min-width:900px){
  body[data-screen="battle"] .arena-layout:has(.atlas-frame) :is(.atlas-panel-scroll,.battle-left-rail),
  body[data-screen="battle"][data-battle-signals="outside"] .arena-layout:has(.atlas-frame) .battle-signals{
    max-height:var(--atlas-panel-height);overflow-y:auto;overflow-x:hidden;
    overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#6b716b transparent;
  }
}

.atlas-ready.atlas-figures [data-atlas-unit] .unit-card{opacity:0}

@media(max-width:899px){
  body[data-screen="battle"] .arena-layout:has(.atlas-frame) .atlas-panel-scroll{
    display:flex;flex-direction:column;max-height:var(--atlas-panel-height,210px);
    overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#6b716b transparent;
  }
  .atlas-panel-scroll>.play-panels{order:-1}
  .atlas-panel-scroll>*{flex:none}
}
body[data-screen="battle"]:has(.atlas-frame) .site-footer{display:none!important}

.atlas-frame.atlas-curtain:not(.atlas-ready) .field{visibility:hidden}
.atlas-frame.atlas-paper-intro .field{animation:unfold-paper-map 1.45s cubic-bezier(.33,.02,.2,1) both}
.atlas-frame.atlas-paper-intro :is(.objective-fort,.standard,.unit-card){opacity:0}
@keyframes unfold-paper-map{from{clip-path:inset(49% 0)}to{clip-path:inset(0)}}

/* Broaden the cell hit areas with the print while card faces retain their own aspect. */
body[data-screen="battle"] .atlas-frame.atlas-ready .field{
  grid-template-columns:repeat(var(--cols),calc(var(--cell) * var(--field-spacing,1)));
}
body[data-screen="battle"] .atlas-frame.atlas-ready .field .cell{width:calc(var(--cell) * var(--field-spacing,1))}
