/* Agency: TCG — Alpha 3.2.3 · Visual Integrity Patch */

/*
  The live match is a designed tabletop, not a normal fluid webpage.

  When the browser can no longer show the native desktop composition safely,
  JS adds .board-canvas-323 to the match shell and scales one fixed 1400px-wide
  tabletop as a single object. Internal modules keep their native geometry;
  the page reserves the *scaled* tabletop height, so nothing is asked to squash
  merely because the browser window became narrower or shorter.

  Floating card magnifiers and game overlays are appended to document.body and
  therefore remain outside this transform at full readable viewport size.
*/

body.board-canvas-active-323 {
  overflow-x: hidden;
}

.match-fit-169.board-canvas-323 {
  position: relative !important;
  box-sizing: border-box !important;
  width: 100vw !important;
  max-width: none !important;
  height: var(--board-shell-height-323, 100vh) !important;
  min-height: max(100vh, var(--board-shell-height-323, 100vh)) !important;
  padding: 0 !important;
  overflow-x: hidden !important;
  overflow-y: visible !important;
}

/* The panel is the actual tabletop canvas. It no longer inherits viewport
   height while in integrity mode: 940px is the native content geometry and
   the parent shell accounts for its transformed height. */
.match-fit-169.board-canvas-323 .match-panel-120 {
  position: absolute !important;
  left: var(--board-left-323, 0px) !important;
  top: 12px !important;
  width: 1400px !important;
  max-width: none !important;
  height: 940px !important;
  min-height: 940px !important;
  margin: 0 !important;
  zoom: 1 !important;
  transform: scale(var(--board-scale-323, 1)) !important;
  transform-origin: top left !important;
  overflow: visible !important;
}

.match-fit-169.board-canvas-323 .match-body-110 {
  box-sizing: border-box !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  padding: 14px 16px !important;
}

/* Restore the approved three-column desktop composition even when older
   max-width media queries would normally collapse or narrow these rails. */
.match-fit-169.board-canvas-323 .match-layout-120,
.match-fit-169.board-canvas-323.match-multiplayer-230 .match-layout-120,
.match-fit-169.board-canvas-323.match-redesign-130 .match-layout-120 {
  box-sizing: border-box !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  grid-template-columns: 226px minmax(0, 1fr) 274px !important;
  gap: 14px !important;
  align-items: stretch !important;
}

.match-fit-169.board-canvas-323 .match-sidebar-120 {
  min-width: 0 !important;
  height: 100% !important;
  align-content: start !important;
}
.match-fit-169.board-canvas-323 .match-sidebar-120 .match-brand-block {
  min-height: initial !important;
}
.match-fit-169.board-canvas-323 .match-sidebar-120 .match-sidebar-logo {
  width: min(190px, 100%) !important;
}

.match-fit-169.board-canvas-323 .match-right-rail {
  grid-column: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  height: 100% !important;
  grid-template-rows: minmax(0, 1fr) auto !important;
  gap: 12px !important;
}
.match-fit-169.board-canvas-323 .meeting-notes-panel {
  grid-column: auto !important;
  min-height: 0 !important;
  height: auto !important;
}

/* Theme Deck is setup information, not turn-state information. Remove the
   muted descriptor from live Agency modules at every match width. */
.match-fit-169 .network-board .deck-line {
  display: none !important;
}

/* Fixed content floors. These are deliberately content-driven rather than
   viewport-driven: if the browser is tight, the *whole board* gets smaller.
   Individual Presentation / Hand modules never become shorter than their cards. */
.match-fit-169.board-canvas-323 .match-main-120 {
  box-sizing: border-box !important;
  min-width: 0 !important;
  min-height: 0 !important;
  height: 100% !important;
  display: grid !important;
  gap: 10px !important;
  overflow: visible !important;
}
.match-fit-169.board-canvas-323.match-players-4 .match-main-120 {
  grid-template-rows: minmax(188px, 1fr) minmax(266px, 1.08fr) minmax(328px, 1.12fr) 44px 12px !important;
}
.match-fit-169.board-canvas-323.match-players-3 .match-main-120 {
  grid-template-rows: minmax(182px, .98fr) minmax(266px, 1.08fr) minmax(328px, 1.12fr) 44px 12px !important;
}
.match-fit-169.board-canvas-323.match-players-2 .match-main-120 {
  grid-template-rows: minmax(170px, .88fr) minmax(266px, 1.10fr) minmax(328px, 1.14fr) 44px 12px !important;
}

/* Opponent strip never becomes a horizontally scrolling mini-layout inside the
   scaled tabletop. All Agencies keep their allotted half / third. */
.match-fit-169.board-canvas-323 .multiplayer-opponent-strip,
.match-fit-169.board-canvas-323 .multiplayer-opponent-strip.opponents-3 {
  width: 100% !important;
  min-width: 0 !important;
  height: 100% !important;
  overflow: visible !important;
}
.match-fit-169.board-canvas-323 .multiplayer-opponent-strip.opponents-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}
.match-fit-169.board-canvas-323 .multiplayer-opponent-strip:not(.opponents-3) {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}
.match-fit-169.board-canvas-323 .multiplayer-opponent-shell,
.match-fit-169.board-canvas-323 .multiplayer-opponent-shell > .network-board.opponent {
  min-width: 0 !important;
  height: 100% !important;
}

/* Card-stack hover now uses body-level portals, so clipping the resting
   opponent board is safe and prevents labels / chips / physical cards from
   escaping their Agency module at narrow browser widths. */
.match-fit-169.board-canvas-323 .multiplayer-opponent-shell > .network-board.opponent {
  overflow: hidden !important;
}
.match-fit-169.board-canvas-323 .multiplayer-opponent-strip .network-board.opponent {
  padding: 6px 8px 7px !important;
}
.match-fit-169.board-canvas-323 .multiplayer-opponent-strip.opponents-3 .network-board.opponent {
  padding-inline: 6px !important;
}
.match-fit-169.board-canvas-323 .multiplayer-opponent-strip .network-board.opponent .network-board-head h2 {
  font-size: 12px !important;
  line-height: 1.16 !important;
  padding-bottom: 2px !important;
}
.match-fit-169.board-canvas-323 .multiplayer-opponent-strip .network-board.opponent .network-score {
  min-width: 42px !important;
  padding: 4px 6px !important;
}
.match-fit-169.board-canvas-323 .multiplayer-opponent-strip .network-board-actions {
  gap: 4px !important;
}
.match-fit-169.board-canvas-323 .multiplayer-opponent-strip .view-presentation-btn {
  max-width: none !important;
  overflow: visible !important;
  text-overflow: clip !important;
}

/* Lock the Hand to the approved desktop geometry. Older <=980px rules should
   not make its resting cards or resource piles a different size merely because
   the outside browser is narrow—the tabletop transform already handles that. */
.match-fit-169.board-canvas-323.match-multiplayer-240,
.match-fit-169.board-canvas-323.match-multiplayer-250 {
  --hand-rest-card-width: 90px !important;
}
.match-fit-169.board-canvas-323 .private-hand-panel {
  box-sizing: border-box !important;
  height: auto !important;
  min-height: 328px !important;
  padding-bottom: 14px !important;
  overflow: hidden !important;
}
.match-fit-169.board-canvas-323 .private-hand-workspace {
  box-sizing: border-box !important;
  height: auto !important;
  min-height: 184px !important;
  grid-template-columns: minmax(0, 1fr) 214px !important;
  gap: 12px !important;
  align-items: start !important;
  overflow: visible !important;
}
.match-fit-169.board-canvas-323 .private-hand-workspace .private-hand-grid {
  min-height: 184px !important;
  padding-left: 20px !important;
  padding-right: 4px !important;
  flex-wrap: nowrap !important;
  align-content: start !important;
}
.match-fit-169.board-canvas-323 .private-hand-workspace .hand-card-shell {
  width: 66px !important;
  flex-basis: 66px !important;
  min-width: 28px !important;
  flex-shrink: 1 !important;
}
.match-fit-169.board-canvas-323 .private-hand-workspace .hand-card-shell:last-child {
  flex-shrink: 0 !important;
}
.match-fit-169.board-canvas-323 .private-hand-workspace .hand-hover-stage {
  width: 90px !important;
  margin-left: -20px !important;
}
.match-fit-169.board-canvas-323 .private-hand-workspace .private-hand-card,
.match-fit-169.board-canvas-323 .private-hand-workspace .hand-hover-stage .private-hand-card {
  width: 90px !important;
  margin-left: 0 !important;
}
.match-fit-169.board-canvas-323 .private-hand-resources {
  width: auto !important;
  height: auto !important;
  max-height: none !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  grid-template-rows: minmax(0, 1fr) !important;
  gap: 10px !important;
  align-self: start !important;
  overflow: visible !important;
}
.match-fit-169.board-canvas-323 .private-hand-resources .hand-resource-pile {
  min-height: 184px !important;
  height: auto !important;
  overflow: hidden !important;
}

/* Your Presentation gets a containment boundary as well. Body-level Campaign
   magnification still works; resting pieces remain visually owned by the box. */
.match-fit-169.board-canvas-323 .network-board.you {
  min-height: 266px !important;
  overflow: hidden !important;
}

/* The persistent bottom strips stay in their rows rather than drifting through
   the Hand when the outer browser is short. */
.match-fit-169.board-canvas-323 .turn-control-110 {
  min-height: 44px !important;
  height: 44px !important;
  margin-top: 0 !important;
  overflow: hidden !important;
}
.match-fit-169.board-canvas-323 .match-connection-compact {
  min-height: 12px !important;
  height: 12px !important;
  overflow: hidden !important;
}

/* Outside canvas mode, 3.2.3 contributes no layout overrides. The established
   tablet/mobile responsive system resumes automatically. */
