/* Entering a tablet match frees the header's space without switching to the
   phone board or reserve layout. All dock positions include safe-area insets. */
html[data-theme][data-tablet-menu='true'] body#top[data-page='play'] {
  --game-site-header-height:0px;
  --play-edge:max(48px,calc(env(safe-area-inset-left,0px) + 48px),calc(env(safe-area-inset-right,0px) + 48px));
  --hud-w:clamp(224px,20vw,272px);
  --stash-plaque-inset:16px;
  --play-action-clearance:calc(32px + env(safe-area-inset-top,0px));
  --play-bottom-space:calc(58px + env(safe-area-inset-bottom,0px));
  --tablet-dock-bottom:max(12px,calc(env(safe-area-inset-bottom,0px) + 8px));
}
html[data-theme][data-tablet-menu='true'] body#top[data-page='play'] .site-header {
  height:0!important; min-height:0!important; padding:0!important; border:0!important;
  background:transparent!important; box-shadow:none!important;
  backdrop-filter:none!important; -webkit-backdrop-filter:none!important;
  transform:none!important; pointer-events:none;
}
html[data-theme][data-tablet-menu='true'] body#top[data-page='play'] .site-header > .brand,
html[data-theme][data-tablet-menu='true'] body#top[data-page='play'] .site-header > .game-site-mode { display:none!important; }
html[data-theme][data-tablet-menu='true'] body#top[data-page='play'] .site-header .header-controls { height:0!important; }
html[data-theme][data-tablet-menu='true'] body#top[data-page='play'] .site-header .menu-toggle,
html.site-menu-open[data-theme][data-tablet-menu='true'] body#top[data-page='play'] .site-header .menu-toggle {
  display:grid!important; position:fixed!important; pointer-events:auto;
  inset:auto var(--play-edge) var(--tablet-dock-bottom) auto!important;
  width:48px!important; height:48px!important; min-width:48px!important;
}
html[data-theme][data-tablet-menu='true'] body#top[data-page='play'] #main-nav.open { pointer-events:auto; }
html.site-menu-open[data-theme][data-tablet-menu='true'] body#top[data-page='play'] .site-header > .brand { pointer-events:auto; }
html[data-theme][data-tablet-menu='true'] body#top[data-page='play'] #main-nav .phone-navigation-links {
  display:grid!important; grid-template-columns:repeat(2,minmax(0,1fr));
  align-content:center; gap:24px;
}
html[data-theme][data-tablet-menu='true'] body#top[data-page='play'] #main-nav .phone-navigation-settings {
  position:fixed!important;
  inset:auto calc(var(--play-edge) + 60px) var(--tablet-dock-bottom) calc(var(--play-edge) + 120px)!important;
  display:grid!important; grid-template-columns:repeat(var(--phone-navigation-control-count,5),minmax(0,1fr))!important;
  gap:8px!important; padding:0!important; border:0!important;
}
html[data-theme][data-tablet-menu='true'] body#top[data-page='play'] #main-nav .phone-navigation-settings :is(button,.theme-toggle,#phone-log-toggle) {
  height:48px!important; min-height:48px!important;
}
html[data-theme][data-tablet-menu='true'] body#top[data-page='play'] #main-nav .phone-navigation-settings #btn-exit-game {
  position:fixed!important; inset:auto auto var(--tablet-dock-bottom) var(--play-edge)!important;
  width:104px!important; height:48px!important; flex-direction:row; gap:8px;
}

/* The field uses the full lane between the reserve beams. Its geometry is the
   same before, during and after combat, so a battle never moves the board. */
html[data-theme][data-tablet-menu='true'] body#top[data-page='play'] #board-col {
  padding:4px!important;
}

/* Narrow reference rails leave room for wider dice, with no overlap against
   the reserve beams. The numbered controls keep their 44px touch height. */
html[data-theme][data-tablet-menu='true'] body#top[data-page='play'] :is(#left-sidebar,#rb-sidebar) {
  width:44px!important; min-width:44px!important; padding:6px 0!important; gap:4px!important;
}
html[data-theme][data-tablet-menu='true'] body#top[data-page='play'] #left-sidebar {
  left:env(safe-area-inset-left,0px)!important;
}
html[data-theme][data-tablet-menu='true'] body#top[data-page='play'] #rb-sidebar {
  left:auto!important; right:env(safe-area-inset-right,0px)!important;
}
html[data-theme][data-tablet-menu='true'] body#top[data-page='play'] :is(#left-sidebar,#rb-sidebar) :is(.rb-hover-btn,.rb-help-icon) {
  width:44px!important; min-width:44px!important; min-height:44px!important;
}
html[data-theme][data-tablet-menu='true'] body#top[data-page='play'] :is(#left-sidebar,#rb-sidebar) .rb-hover-btn .lt-icon {
  font-size:10px!important;
}

/* Keep the reserve grid in flow while combat replaces its contents visually.
   Its normal dimensions remain the panel's dimensions throughout the battle. */
html[data-theme][data-tablet-menu='true'] body#top[data-page='play'] .side-stash {
  max-height:calc(100% - 8px)!important;
}
html[data-theme][data-tablet-menu='true'] body#top[data-page='play'].combat-active .stash-grid-wrapper {
  display:flex!important; visibility:hidden; pointer-events:none;
}
html[data-theme][data-tablet-menu='true'] body#top[data-page='play'].combat-active .side-stash {
  height:auto!important; min-height:0!important;
  padding: max(24px,calc((var(--play-mascot-size) - 64px) / 2 + 18px)) 0 var(--stash-bottom-space)!important;
  align-items:center; justify-content:flex-start;
}
html[data-theme][data-tablet-menu='true'] body#top[data-page='play'].combat-active .combat-stash-content {
  position:absolute; inset:24px 8px 16px;
  display:grid!important; grid-template-columns:minmax(0,1fr);
  grid-template-rows:28px 14px 26px auto; gap:8px;
  align-content:center;
  width:auto!important; height:auto!important; min-height:0;
  flex:0 0 auto!important; padding:0!important; transform:none!important;
}
html[data-theme][data-tablet-menu='true'] body#top[data-page='play'].combat-active .cb-role-badge {
  justify-self:center; align-self:center; margin:0!important;
  padding:5px 12px!important; font-size:12px!important; letter-spacing:2px!important;
}
html[data-theme][data-tablet-menu='true'] body#top[data-page='play'].combat-active :is(.cb-section-title,.csp-unit) {
  margin:0!important; align-self:center; text-align:center;
}
html[data-theme][data-tablet-menu='true'] body#top[data-page='play'].combat-active .csp-unit { font-size:18px!important; }
html[data-theme][data-tablet-menu='true'] body#top[data-page='play'].combat-active .combat-matrix-cell {
  display:grid; grid-template-columns:minmax(0,1fr);
  grid-template-rows:auto 52px; gap:8px;
  width:100%; max-width:none; min-height:0; height:auto;
  margin:8px 0 0; padding:16px 8px 0;
  border:0!important; background:none!important; box-shadow:none!important;
}
/* The animation has a square frame. Roll labels and effect copy sit below it,
   so neither a long result nor a waiting state stretches the artwork. */
html[data-theme][data-tablet-menu='true'] body#top[data-page='play'].combat-active .combat-matrix-cell::before {
  content:''; position:absolute; inset:0 0 auto; aspect-ratio:1;
  border:1px solid rgba(255,255,255,.12); border-radius:16px;
  background:radial-gradient(130% 90% at 50% 0%,rgba(12,18,34,.94),rgba(5,7,15,.98));
  box-shadow:0 8px 24px rgba(0,0,0,.35); pointer-events:none;
}
html[data-theme='light'][data-tablet-menu='true'] body#top[data-page='play'].combat-active .combat-matrix-cell::before {
  border-color:rgba(36,26,49,.12);
  background:radial-gradient(130% 90% at 50% 0%,rgba(244,241,255,.94),rgba(242,238,251,.98));
  box-shadow:0 8px 24px rgba(36,26,49,.1);
}
html[data-theme][data-tablet-menu='true'] body#top[data-page='play'].combat-active .cb-battle-die-pill {
  font-size:10px!important; letter-spacing:1.5px!important; padding:4px 10px!important;
}
html[data-theme][data-tablet-menu='true'] body#top[data-page='play'].combat-active .bg3-battle-die-widget {
  width:100%!important; max-width:none; height:auto!important; min-height:0!important;
  margin:0!important; gap:8px;
}
html[data-theme][data-tablet-menu='true'] body#top[data-page='play'].combat-active .bg3-die-container {
  width:100%; max-width:248px; height:auto!important; aspect-ratio:1; flex:0 0 auto;
}
html[data-theme][data-tablet-menu='true'] body#top[data-page='play'].combat-active :is(.bg3-3d-canvas,.bg3-die-body) {
  width:100%; height:100%; aspect-ratio:1;
}
html[data-theme][data-tablet-menu='true'] body#top[data-page='play'].combat-active .bg3-prompt-badge {
  margin:0!important; min-width:0; max-width:100%; min-height:44px; box-sizing:border-box;
  padding:6px 8px!important; white-space:normal; line-height:1.25;
  font-size:10px!important; letter-spacing:.5px!important;
}
html[data-theme][data-tablet-menu='true'] body#top[data-page='play'].combat-active .bg3-effect-desc {
  display:flex!important; min-height:0; height:52px; margin:0!important; padding:0!important;
}
