/* v354 — PC 화면 확장/스크롤, 팝업 범위, 모바일 필드·핸드 크기와 여백 */
.v354-dual-deck-note{margin:4px 0 7px;padding:6px 8px;border:1px solid #69532d;border-radius:6px;background:#15130e;color:#e8d7a8;font-size:11px;font-weight:800}
.v354-history-box{width:min(760px,94vw)!important;max-height:min(82dvh,760px)!important;display:flex!important;flex-direction:column!important}
.v354-history-text{flex:1 1 auto;min-height:280px;max-height:62dvh;overflow:auto;white-space:pre-wrap;word-break:keep-all;margin:10px 0;padding:12px;border:1px solid #5c4728;background:#090d11;color:#eee0bf;font:12px/1.55 ui-monospace,SFMono-Regular,Consolas,monospace}
.v354-history-actions{display:flex;justify-content:flex-end;gap:8px}

@media (min-width:851px){
  html:not([data-active-ui-mode="mobile"]),html:not([data-active-ui-mode="mobile"]) body{max-width:100vw;overflow:hidden!important}
  body.unified-left-layout:not(.ui-mode-mobile-preview){height:100dvh!important;max-height:100dvh!important;overflow:hidden!important}
  body.unified-left-layout:not(.ui-mode-mobile-preview) .app{
    height:100dvh!important;max-height:100dvh!important;min-height:0!important;overflow:hidden!important;align-items:stretch!important;
  }
  body.unified-left-layout:not(.ui-mode-mobile-preview) .reference-left{
    height:100dvh!important;max-height:100dvh!important;min-height:0!important;overflow-x:hidden!important;overflow-y:auto!important;overscroll-behavior:contain!important;
  }
  body.unified-left-layout:not(.ui-mode-mobile-preview) .battle-panel{
    height:100dvh!important;max-height:100dvh!important;min-height:0!important;overflow-x:hidden!important;overflow-y:auto!important;overscroll-behavior:contain!important;
  }
  body.unified-left-layout:not(.ui-mode-mobile-preview) .battle-panel .boardwrap{overflow:visible!important;min-height:max-content!important}
  body.unified-left-layout:not(.ui-mode-mobile-preview) .game-toast-wrap[data-v354-contained="1"]{
    left:calc(var(--v281-app-w,1225px) / 2)!important;right:auto!important;transform:translateX(-50%)!important;
    width:min(520px,calc(var(--v281-app-w,1225px) - 28px))!important;max-width:calc(var(--v281-app-w,1225px) - 28px)!important;
  }
  body.unified-left-layout:not(.ui-mode-mobile-preview) .modal{max-width:var(--v281-app-w,1225px)!important;width:var(--v281-app-w,1225px)!important;right:auto!important;overflow:hidden auto!important}
  body.unified-left-layout:not(.ui-mode-mobile-preview) .modal>.modalbox{max-width:calc(var(--v281-app-w,1225px) - 32px)!important}
}

body.ui-mode-mobile-preview{--v354-mobile-field-gap:4px;--v354-mobile-card-w:calc((100% - (var(--v354-mobile-field-gap) * 4)) / 5)}
body.ui-mode-mobile-preview .battle-panel{gap:0!important;row-gap:0!important}
body.ui-mode-mobile-preview .boardwrap{margin:0!important;padding-bottom:0!important}
body.ui-mode-mobile-preview .battlefield-layout,
body.ui-mode-mobile-preview .battlefield-layout>.board{margin-bottom:0!important;padding-bottom:0!important}
body.ui-mode-mobile-preview .battlefield-layout .slots,
body.ui-mode-mobile-preview .battlefield-layout .slots.n5,
body.ui-mode-mobile-preview .battlefield-layout .slots.n4,
body.ui-mode-mobile-preview .battlefield-layout .slots.n3,
body.ui-mode-mobile-preview .battlefield-layout .slots.n2,
body.ui-mode-mobile-preview .battlefield-layout .hq-battlefield-grid{
  display:flex!important;justify-content:center!important;align-items:stretch!important;gap:var(--v354-mobile-field-gap)!important;width:100%!important;min-width:0!important;max-width:100%!important;height:auto!important;min-height:0!important;max-height:none!important;padding:0!important;margin:0 auto!important;overflow:visible!important;
}
body.ui-mode-mobile-preview .battlefield-layout .slots>.slot,
body.ui-mode-mobile-preview .battlefield-layout .hq-battlefield-grid>.slot,
body.ui-mode-mobile-preview .battlefield-layout .hq-battlefield-grid>.hq-field-slot{
  flex:0 0 var(--v354-mobile-card-w)!important;width:var(--v354-mobile-card-w)!important;min-width:var(--v354-mobile-card-w)!important;max-width:var(--v354-mobile-card-w)!important;
  height:auto!important;min-height:0!important;max-height:none!important;aspect-ratio:2.5/3.5!important;box-sizing:border-box!important;
}
body.ui-mode-mobile-preview .battlefield-layout .slot>.unit,
body.ui-mode-mobile-preview .battlefield-layout .hq-field-slot>.unit{width:100%!important;height:100%!important;min-width:0!important;min-height:0!important;max-width:100%!important;max-height:100%!important;aspect-ratio:2.5/3.5!important}
body.ui-mode-mobile-preview .battlefield-layout>.board>.lane{height:auto!important;min-height:0!important;max-height:none!important;padding-top:2px!important;padding-bottom:2px!important}
body.ui-mode-mobile-preview .mobile-ally-hq-mount{margin:0 auto!important;padding-top:0!important;padding-bottom:0!important}
body.ui-mode-mobile-preview .mobile-hand-mount{margin:0 auto!important;padding:0 0 2px!important;min-height:0!important;max-height:none!important;overflow:visible!important}
body.ui-mode-mobile-preview .mobile-hand-mount .right-hand-section{height:auto!important;min-height:0!important;max-height:none!important;margin:0!important;overflow:visible!important}
body.ui-mode-mobile-preview .mobile-hand-mount .handbox{height:auto!important;min-height:0!important;max-height:none!important;margin:0!important;padding:2px 4px 4px!important;overflow:visible!important}
body.ui-mode-mobile-preview .mobile-hand-mount #hand.hand{
  display:flex!important;height:calc((100vw - 16px) / 5 * 1.4 + 8px)!important;min-height:0!important;max-height:none!important;
  gap:var(--v354-mobile-field-gap)!important;padding:2px 2px 4px!important;margin:0!important;overflow-x:auto!important;overflow-y:visible!important;scrollbar-width:thin!important;align-items:flex-start!important;
}
body.ui-mode-mobile-preview .mobile-hand-mount #hand.hand .card{
  flex:0 0 calc((100vw - 32px) / 5)!important;width:calc((100vw - 32px) / 5)!important;min-width:calc((100vw - 32px) / 5)!important;max-width:calc((100vw - 32px) / 5)!important;
  height:auto!important;min-height:0!important;max-height:none!important;aspect-ratio:2.5/3.5!important;margin:0!important;box-sizing:border-box!important;
}
body.ui-mode-mobile-preview .mobile-hand-mount #hand.hand .cimg{min-height:0!important;height:auto!important}
body.ui-mode-mobile-preview .mobile-hand-mount+.bottom-hud{margin-top:0!important}
body.ui-mode-mobile-preview .bottom-hud{margin-top:0!important}
