/* Hex backing shares the outline's native SVG geometry at every scale. */
body[data-page='play'] polygon.hex-glass-backdrop { fill:rgba(6,10,18,.48); stroke:none; filter:none; }
html[data-theme='light'] body[data-page='play'] polygon.hex-glass-backdrop { fill:rgba(238,244,250,.68); }

/* History remains touch/wheel accessible, without a visible scrollbar. */
html:has(body[data-page='play']), body[data-page='play'], body[data-page='play'] * {
  scrollbar-width:none!important;
}
body[data-page='play'] ::-webkit-scrollbar { display:none!important; width:0!important; height:0!important; }
html:has(body[data-page='play']), body[data-page='play'] { overflow:hidden!important; }
body#top[data-page='play'] .side-stash { overflow:hidden!important; }
/* The reserve beams down from inside its wider plaque, centred underneath it.
   Keep this inset in both battle and normal play. */
body#top[data-page='play']:not(.phone-match-active) {
  --hud-w:clamp(248px,22vw,368px);
  --stash-plaque-inset:16px;
  --stash-w:calc(var(--hud-w) - 2 * var(--stash-plaque-inset));
  --stash-margin:calc(var(--hud-margin) + var(--stash-plaque-inset) - 4px);
  --play-mascot-size:clamp(80px,7.5vw,110px);
}
body#top[data-page='play']:not(.phone-match-active) .side-stash {
  box-sizing:border-box; width:var(--stash-w)!important; flex-shrink:0;
}
body#top[data-page='play']:not(.phone-match-active) .hp-main {
  grid-template-columns:minmax(0,1fr) calc(var(--play-mascot-size) * 1.06 + 12px) minmax(0,1fr);
}
body#top[data-page='play']:not(.phone-match-active).combat-active .side-stash {
  padding:12px!important; align-items:center; justify-content:center;
}
body#top[data-page='play']:not(.phone-match-active).combat-active .combat-stash-content {
  flex:0 0 auto!important; width:312px!important; height:auto!important; max-width:none; min-height:0;
  transform:scale(var(--viewport-fit-scale,1)); transform-origin:center;
}
body#top[data-page='play']:not(.phone-match-active).combat-active .combat-matrix-cell { flex-shrink:0; }
body#top[data-page='play']:not(.phone-match-active) .stash-grid-wrapper {
  flex-shrink:0; transform:scale(var(--viewport-fit-scale,1))!important; transform-origin:top center;
}
body#top[data-page='play']:not(.phone-match-active) .bg3-battle-die-widget { max-width:100%; }
@media (max-width:1200px) {
  body#top[data-page='play']:not(.phone-match-active).combat-active .combat-stash-content { width:100%!important; }
  body#top[data-page='play']:not(.phone-match-active).combat-active .bg3-battle-die-widget {
    min-height:0; height:auto;
  }
  body#top[data-page='play']:not(.phone-match-active).combat-active .bg3-die-container { width:100%; height:auto; aspect-ratio:1; flex-shrink:0; }
  body#top[data-page='play']:not(.phone-match-active).combat-active :is(.bg3-die-body,.bg3-3d-canvas) { width:100%; height:100%; }
}
body#top[data-page='play'] .modal:not(#setup-screen) > .modal-card,
body#top[data-page='play'] .modal:not(#setup-screen) > :is(.tut-intro-card,.tut-modal-card) {
  max-height:none!important; overflow:visible!important;
  flex-shrink:0; transform:scale(var(--viewport-fit-scale,1)); transform-origin:center;
}
body#top[data-page='play']:not(.phone-match-active) .modal > :is(.tut-intro-card,.tut-modal-card) {
  height:auto!important; flex:0 0 auto!important;
}
body#top[data-page='play'] #setup-screen { overflow:hidden!important; }
body#top[data-page='play'] #setup-screen > .subscribe-wrapper {
  flex-shrink:0; transform:scale(var(--viewport-fit-scale,1)); transform-origin:top center;
}
/* Combat overlays do not shrink or move the field. */
body#top[data-page='play']:not(.phone-match-active).combat-active #hex-board { transform:none!important; }

/* A single controlled faction owns the left side at every supported size.
   Reorder equal-width lanes; the field, menu and faction IDs keep their geometry. */
body#top[data-page='play'].controlled-perspective-p2:not(.phone-match-active) .bar-right {
  order:-1; margin-left:var(--hud-margin)!important; margin-right:0!important;
  justify-content:flex-start;
}
body#top[data-page='play'].controlled-perspective-p2:not(.phone-match-active) .bar-left {
  order:1; margin-left:0!important; margin-right:var(--hud-margin)!important;
  justify-content:flex-end;
}
body#top[data-page='play'].controlled-perspective-p2:not(.phone-match-active) #stash-panel-p2 {
  order:-1; margin-left:var(--stash-margin)!important; margin-right:0!important;
}
body#top[data-page='play'].controlled-perspective-p2:not(.phone-match-active) #stash-panel-p1 {
  order:1; margin-left:0!important; margin-right:var(--stash-margin)!important;
}
body#top[data-page='play'].controlled-perspective-p2:not(.phone-match-active) #hud-p2 .hp-name-col,
body#top[data-page='play'].controlled-perspective-p2:not(.phone-match-active) #hud-p1 .hp-tokens-slot {
  grid-column:1;
}
body#top[data-page='play'].controlled-perspective-p2:not(.phone-match-active) #hud-p1 .hp-name-col,
body#top[data-page='play'].controlled-perspective-p2:not(.phone-match-active) #hud-p2 .hp-tokens-slot {
  grid-column:3;
}
body#top[data-page='play'].controlled-perspective-p2:not(.phone-match-active) #hud-p2 .hp-name-col {
  align-items:flex-start; text-align:left;
}
body#top[data-page='play'].controlled-perspective-p2:not(.phone-match-active) #hud-p1 .hp-name-col {
  align-items:flex-end; text-align:right;
}
body#top[data-page='play'].controlled-perspective-p2:not(.phone-match-active) #hud-p2 .hp-name-row,
body#top[data-page='play'].controlled-perspective-p2:not(.phone-match-active) #hud-p1 .hp-tokens-slot {
  justify-content:flex-start!important;
}
body#top[data-page='play'].controlled-perspective-p2:not(.phone-match-active) #hud-p1 .hp-name-row,
body#top[data-page='play'].controlled-perspective-p2:not(.phone-match-active) #hud-p2 .hp-tokens-slot {
  justify-content:flex-end!important;
}
body#top[data-page='play'].controlled-perspective-p2:not(.phone-match-active) #hud-p2 .player-identity-label { text-align:left; }
body#top[data-page='play'].controlled-perspective-p2:not(.phone-match-active) #hud-p1 .player-identity-label { text-align:right; }
body#top[data-page='play'].controlled-perspective-p2:not(.phone-match-active) .sg-head { flex-direction:row-reverse; }
body#top[data-page='play'].controlled-perspective-p2:not(.phone-match-active) #stash-panel-p2 .stash-speed-arrows[data-tooltip]::before {
  left:calc(100% + 10px); right:auto;
}
body#top[data-page='play'].controlled-perspective-p2:not(.phone-match-active) #stash-panel-p1 .stash-speed-arrows[data-tooltip]::before {
  left:auto; right:calc(100% + 10px);
}
body#top[data-page='play'].controlled-perspective-p2:not(.phone-match-active) #action-bar.ab-p2 .bar-center {
  transform:translateX(min(0px,calc(-50vw + 50% + var(--hud-margin) + var(--hud-w) + var(--play-action-gap))))!important;
}
body#top[data-page='play'].controlled-perspective-p2:not(.phone-match-active) #action-bar.ab-p1 .bar-center {
  transform:translateX(max(0px,calc(50vw - 50% - var(--hud-margin) - var(--hud-w) - var(--play-action-gap))))!important;
}
body#top[data-page='play'].controlled-perspective-p2:not(.phone-match-active) #action-bar.ab-p2::before,
body#top[data-page='play'].controlled-perspective-p2:not(.phone-match-active) #action-bar.ab-p2::after {
  background:linear-gradient(90deg,rgba(255,43,177,.85),rgba(255,43,177,.4) 60%,transparent);
}
body#top[data-page='play'].controlled-perspective-p2:not(.phone-match-active) #action-bar.ab-p1::before,
body#top[data-page='play'].controlled-perspective-p2:not(.phone-match-active) #action-bar.ab-p1::after {
  background:linear-gradient(90deg,transparent,rgba(0,153,255,.4) 40%,rgba(0,153,255,.85));
}
