/* Chrome & Gigs reference-board implementation.
   Loaded last: this stylesheet intentionally replaces the old tabletop geometry. */

body.match-active #match:not([hidden]) {
  position: relative;
  display: block;
  min-height: 0;
  overflow: hidden;
  --arena-red: #ff574c;
  --arena-cyan: #31d9ff;
  --arena-gold: #ffc64d;
  --arena-line: #263d46;
  --arena-surface: #071017;
}
body.match-active #match .match-layout {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
body.match-active #match .match-coach,
#match .mat-heading,
#match #localGigsDock { display: none !important; }
#match #board {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #2d444d;
  border-radius: 7px;
  background:
    linear-gradient(90deg, transparent 49.9%, #5c778018 50%, transparent 50.1%),
    repeating-linear-gradient(0deg, transparent 0 39px, #6f88900a 40px),
    repeating-linear-gradient(90deg, transparent 0 59px, #6f88900a 60px),
    radial-gradient(ellipse at center, #18303a55, transparent 64%),
    #060d12;
}
#match .arena-playmat {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 94px;
  grid-template-rows: 150px minmax(0, 1fr) 150px;
  grid-template-areas:
    "rival meter"
    "battle meter"
    "own meter";
  gap: 4px;
  width: 100%;
  height: 100%;
  padding: 4px;
  overflow: hidden;
  background: transparent;
}
#match .arena-band {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--arena-line);
  border-radius: 5px;
  background: linear-gradient(90deg, #071017f2, #0a151cf2 50%, #071017f2);
}
#match .arena-rival {
  grid-area: rival;
  border-color: #69312d;
  box-shadow: inset 0 -2px #ff574c55, 0 0 14px #ff574c14;
}
#match .arena-own {
  grid-area: own;
  border-color: #1c5c70;
  box-shadow: inset 0 2px #31d9ff55, 0 0 14px #31d9ff14;
}
#match .arena-band::before,
#match .arena-band::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 42%;
  height: 56%;
  pointer-events: none;
  opacity: .72;
  background:
    linear-gradient(currentColor,currentColor) 0 24% / 74% 1px no-repeat,
    linear-gradient(currentColor,currentColor) 15% 48% / 84% 1px no-repeat,
    linear-gradient(currentColor,currentColor) 0 72% / 68% 1px no-repeat,
    linear-gradient(135deg,transparent 47%,currentColor 48% 51%,transparent 52%) 74% 24% / 28px 28px no-repeat,
    linear-gradient(45deg,transparent 47%,currentColor 48% 51%,transparent 52%) 68% 72% / 28px 28px no-repeat;
}
#match .arena-band::before { left: 8px; transform: translateY(-50%); }
#match .arena-band::after { right: 8px; transform: translateY(-50%) scaleX(-1); }
#match .arena-rival { color: var(--arena-red); }
#match .arena-own { color: var(--arena-cyan); }

#match .arena-band > .player-resources {
  display: contents;
}
#match .arena-band .player-hub {
  position: absolute;
  z-index: 5;
  left: 50%;
  top: 50%;
  display: grid;
  width: 82px;
  height: 82px;
  min-width: 0;
  place-content: center;
  transform: translate(-50%,-50%);
  border: 2px solid currentColor;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, #1b2b34, #05090d 72%);
  box-shadow: 0 0 0 5px #091116, 0 0 18px currentColor;
}
#match .arena-band .player-hub::before,
#match .arena-band .player-hub::after {
  content: "";
  position: absolute;
  inset: -10px;
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: .38;
}
#match .arena-band .player-hub::after {
  inset: -16px;
  border-style: dashed;
}
#match .arena-band .player-hub .identity-badge {
  display: grid;
  justify-items: center;
  gap: 1px;
  color: #eaf3f5;
}
#match .arena-band .player-hub .identity-badge > .portrait-image {
  width: 40px;
  height: 47px;
  border-radius: 50%;
}
#match .arena-band .player-hub .identity-badge strong {
  max-width: 72px;
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#match .arena-band .player-hub-stats { display: none; }

#match .arena-band .mat-fixer {
  position: absolute;
  z-index: 2;
  inset: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  pointer-events: none;
}
#match .arena-band .mat-fixer .mat-label { display: none; }
#match .arena-band .mat-fixer .mat-content {
  display: grid;
  grid-template-columns: repeat(3, 52px) minmax(250px, 1fr) repeat(3, 52px);
  align-items: center;
  gap: clamp(4px, 1vw, 18px);
  width: 100%;
  height: 100%;
  padding: 0 clamp(10px, 2vw, 34px);
}
#match .arena-band .fixer-die {
  position: relative;
  width: 52px;
  min-width: 52px;
  height: 58px;
  min-height: 52px;
  padding: 3px;
  border: 1px solid #71818a;
  background: #071119e8;
  color: #aebbc0;
  pointer-events: auto;
}
#match .arena-band .fixer-die:nth-child(6) { grid-column: 1; grid-row: 1; }
#match .arena-band .fixer-die:nth-child(5) { grid-column: 2; grid-row: 1; }
#match .arena-band .fixer-die:nth-child(4) { grid-column: 3; grid-row: 1; }
#match .arena-band .fixer-die:nth-child(3) { grid-column: 5; grid-row: 1; }
#match .arena-band .fixer-die:nth-child(2) { grid-column: 6; grid-row: 1; }
#match .arena-band .fixer-die:nth-child(1) { grid-column: 7; grid-row: 1; }
#match .arena-band .fixer-die svg { width: 28px; height: 28px; }
#match .arena-band .fixer-die strong { font-size: 10px; }
#match .arena-band .fixer-die span { display: none; }
#match .arena-band .fixer-die.departed { opacity: .16; }
#match .arena-own .fixer-die.can-roll {
  border-color: var(--arena-gold);
  color: var(--arena-gold);
  box-shadow: 0 0 12px #ffc64d99;
}
#match .arena-rival .fixer-die { color: #a6b0b5; }

#match .arena-band .mat-legends {
  position: absolute;
  z-index: 6;
  left: 50%;
  top: 50%;
  width: 310px;
  height: 128px;
  transform: translate(-50%,-50%);
  padding: 0;
  border: 0;
  background: transparent;
  pointer-events: none;
}
#match .arena-band .mat-legends > .mat-label { display: none; }
#match .arena-band .mat-legends > .mat-content {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
}
#match .arena-band .mat-legend-slots {
  position: absolute;
  inset: 0;
  display: block;
}
#match .arena-band .mat-legend-slot {
  position: absolute;
  width: 58px;
  height: 72px;
  min-width: 0;
  overflow: visible;
  border: 1px solid var(--arena-gold);
  clip-path: polygon(10% 0,90% 0,100% 12%,100% 88%,90% 100%,10% 100%,0 88%,0 12%);
  background: #151108f2;
  box-shadow: 0 0 10px #ffc64d44;
  pointer-events: auto;
}
#match .arena-band .mat-legend-slot:nth-child(1) { left: 14px; top: 24px; }
#match .arena-band .mat-legend-slot:nth-child(2) { right: 14px; top: 24px; }
#match .arena-band .mat-legend-slot:nth-child(3) { left: 126px; bottom: -3px; }
#match .arena-rival .mat-legend-slot:nth-child(3) { top: -3px; bottom: auto; }
#match .arena-band .legend-art,
#match .arena-band .legend-back {
  width: 100%;
  height: 50px;
  min-height: 0;
  padding: 0;
}
#match .arena-band .legend-art img,
#match .arena-band .legend-back .card-back-visual {
  width: 100%;
  height: 50px;
  object-fit: contain;
}
#match .arena-band .legend-name,
#match .arena-band .legend-state {
  display: block;
  max-width: 100%;
  overflow: hidden;
  font-size: 7px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#match .arena-band .legend-gear-stack,
#match .arena-band .solo-button { display: none; }
#match .arena-band .mat-call {
  position: absolute;
  left: 50%;
  bottom: 0;
  z-index: 8;
  width: 96px;
  min-height: 32px;
  transform: translateX(-50%);
  padding: 2px 5px;
  font-size: 8px;
  pointer-events: auto;
}
#match .arena-rival .mat-call { top: 0; bottom: auto; }

#match .arena-band > .mat-rival,
#match .arena-band > .mat-friendly {
  position: absolute;
  z-index: 4;
  left: 24%;
  right: 24%;
  top: 4px;
  width: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  pointer-events: none;
}
#match .arena-own > .mat-friendly { top: auto; bottom: 4px; }
#match .arena-band > .mat-rival .mat-label,
#match .arena-band > .mat-friendly .mat-label,
#match .arena-band > .mat-rival .gig-summary,
#match .arena-band > .mat-friendly .gig-summary { display: none; }
#match .arena-band > .mat-rival .mat-dice,
#match .arena-band > .mat-friendly .mat-dice {
  display: flex;
  min-height: 42px;
  justify-content: center;
  gap: 4px;
  padding: 0 106px;
  overflow-x: auto;
  overflow-y: visible;
}
#match .arena-band .mat-die {
  flex: 0 0 44px;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 1px;
  pointer-events: auto;
}
#match .arena-rival .mat-die {
  border-color: var(--arena-red);
  color: #fff0ed;
  filter: drop-shadow(0 0 7px #ff574caa);
}
#match .arena-own .mat-die {
  border-color: var(--arena-cyan);
  color: #e8faff;
  filter: drop-shadow(0 0 7px #31d9ffaa);
}
#match .arena-band .mat-dice > .mat-empty { display: none; }

#match .arena-band .mat-deck,
#match .arena-band .mat-trash {
  position: absolute;
  z-index: 7;
  top: 8px;
  width: 82px;
  height: 44px;
  min-height: 0;
  padding: 9px 3px 2px;
  border: 1px solid #28414b;
  background: #071118ed;
}
#match .arena-band .mat-deck { right: 94px; }
#match .arena-band .mat-trash { right: 8px; }
#match .arena-own .mat-deck,
#match .arena-own .mat-trash { top: auto; bottom: 8px; }
#match .arena-band .mat-deck .mat-label,
#match .arena-band .mat-trash .mat-label {
  font-size: 7px;
}
#match .arena-band .deck-back,
#match .arena-band .trash-pile {
  height: 28px;
  min-height: 0;
  padding: 0;
}
#match .arena-band .deck-back .card-back-visual,
#match .arena-band .trash-pile .card-art { display: none; }
#match .arena-band .back-caption,
#match .arena-band .pile-count {
  position: static;
  display: grid;
  height: 100%;
  place-content: center;
  font-size: 8px;
}
#match .arena-band .removed-link { display: none; }

#match .arena-battle {
  grid-area: battle;
  min-width: 0;
  min-height: 0;
}
#match .arena-battle .mat-field {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 18px 10px 6px;
  overflow: hidden;
  border: 1px solid #2b424b;
  background:
    linear-gradient(90deg,transparent 49.9%,#69808918 50%,transparent 50.1%),
    radial-gradient(ellipse at center,#18323c42,transparent 68%),
    #080f14e8;
}
#match .arena-battle .mat-field > .mat-label {
  left: 50%;
  transform: translateX(-50%);
  color: #94aab1;
  background: #061016;
}
#match .arena-battle .mat-field > .mat-content {
  display: grid;
  grid-template-rows: repeat(2,minmax(0,1fr));
  height: 100%;
  min-height: 0;
  gap: 0;
}
#match .arena-battle .field-lane {
  display: grid;
  grid-template-rows: 28px minmax(0,1fr);
  min-height: 0;
  padding: 3px 8px;
  overflow: hidden;
}
#match .arena-battle .field-lane-rival {
  border-bottom: 1px solid #ff574c4f;
  background: linear-gradient(180deg,#2c0d0d21,transparent);
}
#match .arena-battle .field-lane-own {
  border-top: 1px solid #31d9ff4f;
  background: linear-gradient(0deg,#092d3829,transparent);
}
#match .arena-battle .field-lane + .field-lane {
  margin: 0;
  padding-top: 3px;
}
#match .arena-battle .field-lane-rival::after {
  content: "CONTESTED SPACE";
  position: absolute;
  left: 50%;
  bottom: -8px;
  z-index: 3;
  transform: translateX(-50%);
  padding: 1px 12px;
  background: #080f14;
  color: #788f96;
  font-size: 8px;
  letter-spacing: .24em;
  white-space: nowrap;
}
#match .arena-battle .lane-title {
  min-height: 26px;
  flex-wrap: nowrap;
  margin: 0;
}
#match .arena-battle .lane-title .identity-badge { display: none; }
#match .arena-battle .lane-title h3 {
  color: #d8e3e5;
  font-size: 10px;
  letter-spacing: .15em;
}
#match .arena-battle .lane-title > span:not(.lane-turn-state) {
  overflow: hidden;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#match .arena-battle .lane-turn-state {
  margin-left: auto;
  font-size: 8px;
  white-space: nowrap;
}
#match .arena-battle .field-cards {
  min-height: 0;
  height: 100%;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 2px 4px;
  overflow-x: auto;
  overflow-y: hidden;
}
#match .arena-battle .field-cards .game-card {
  flex: 0 0 clamp(106px,9vw,132px);
  width: clamp(106px,9vw,132px);
  max-height: 100%;
  overflow: auto;
}
#match .arena-battle .field-cards .card-art-button {
  height: clamp(72px,10vh,112px);
}
#match .arena-battle .field-cards > .mat-empty {
  color: #72888f;
  font-size: 11px;
}

#match .arena-meter {
  grid-area: meter;
  display: grid;
  grid-template-rows: 24px minmax(180px,1fr) auto;
  min-height: 0;
  gap: 6px;
  padding: 6px;
  border: 1px solid #2b424b;
  border-radius: 5px;
  background: #050b0ff2;
}
#match .arena-meter-title {
  color: #aabcc1;
  font-size: 8px;
  letter-spacing: .18em;
  text-align: center;
}
#match .arena-pressure {
  display: grid;
  min-height: 0;
  grid-template-rows: 1fr 24px 1fr;
  gap: 4px;
}
#match .pressure-side {
  display: flex;
  min-height: 0;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}
#match .pressure-side i {
  display: block;
  width: 100%;
  height: min(17px,8%);
  min-height: 7px;
  border: 1px solid #354951;
  border-radius: 2px;
  background: #111b20;
}
#match .pressure-rival i.claimed {
  border-color: var(--arena-red);
  background: linear-gradient(90deg,#ff574c,#ff8a69);
  box-shadow: 0 0 8px #ff574c99;
}
#match .pressure-own { flex-direction: column-reverse; }
#match .pressure-own i.claimed {
  border-color: var(--arena-cyan);
  background: linear-gradient(90deg,#27bddd,#5ceaff);
  box-shadow: 0 0 8px #31d9ff99;
}
#match .pressure-neutral {
  display: grid;
  place-content: center;
  border: 1px solid #53666d;
  color: var(--arena-gold);
  font-size: 14px;
}
#match .arena-eddies {
  display: grid;
  gap: 4px;
}
#match .arena-eddies .mat-eddies {
  min-height: 0;
  padding: 11px 2px 2px;
}
#match .arena-eddies .mat-label {
  width: 100%;
  overflow: hidden;
  font-size: 6px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#match .arena-eddies .bank-total {
  margin: 0;
  color: #aabcc1;
  font-size: 7px;
  text-align: center;
}
#match .arena-eddies .bank-total strong {
  display: block;
  color: var(--arena-gold);
  font-size: 18px;
}
#match .arena-eddies .eddie-cards,
#match .arena-eddies .mat-empty { display: none; }

/* The hand, guidance and End Turn are a transparent HUD over the board. */
#match .match-bottom-dock {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  padding: 0;
  overflow: visible;
  border: 0;
  background: transparent;
  pointer-events: none;
}
#match .match-bottom-dock > * { pointer-events: auto; }
#match #stepTracker {
  position: absolute;
  left: 8px;
  bottom: 8px;
  display: grid;
  width: 286px;
  height: 92px;
  max-height: 92px;
  grid-template-columns: minmax(0,1fr);
  grid-template-areas: "context" "actions";
  gap: 4px;
  padding: 8px;
  overflow: hidden;
  border: 1px solid #285264;
  background: #07131bef;
  box-shadow: 0 0 16px #31d9ff20;
}
#match #stepTracker > h3,
#match #stepTracker .turn-steps,
#match #stepTracker .effect-queue { display: none; }
#match #stepTracker .match-context {
  display: block;
  grid-area: context;
  min-width: 0;
}
#match #stepTracker .match-context > strong {
  display: block;
  overflow: hidden;
  color: #e7f3f5;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#match #stepTracker .match-context > small {
  display: block;
  overflow: hidden;
  color: #a7bbc1;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#match #stepTracker .tracker-actions {
  grid-area: actions;
  display: flex;
  max-width: none;
  flex-wrap: nowrap;
  overflow-x: auto;
}
#match #stepTracker .tracker-actions button {
  flex: 0 0 auto;
  min-height: 44px;
}
#match .match-bottom-dock .hand-area {
  position: absolute;
  left: 302px;
  right: 158px;
  bottom: 0;
  display: block !important;
  width: auto;
  height: 112px;
  min-height: 112px;
  padding: 3px 6px 0;
  overflow: hidden;
  border: 1px solid #2a424b;
  border-bottom: 0;
  background: linear-gradient(180deg,#071119e8,#03070bf8);
}
#match .match-bottom-dock .hand-area .section-title {
  position: relative;
  z-index: 2;
  height: 24px;
  padding: 3px 6px;
}
#match .match-bottom-dock #realHand {
  height: 88px;
  min-height: 88px;
  padding: 3px 8px 0;
  justify-content: safe center;
  overflow-x: auto;
  overflow-y: hidden;
}
#match .match-bottom-dock #realHand .game-card {
  flex: 0 0 100px;
  width: 100px;
  margin-left: -17px;
}
#match .match-bottom-dock #realHand .game-card:first-child { margin-left: 0; }
#match .match-bottom-dock #realHand .card-art-button { height: 132px; }
#match .match-bottom-dock .turn-dock {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: flex;
  width: 142px;
  height: 92px;
  min-height: 0;
  justify-content: center;
  padding: 7px !important;
  border: 1px solid #8c722d;
  background: #171206ee;
  box-shadow: 0 0 16px #ffc64d22;
}
#match .match-bottom-dock .turn-dock button {
  width: 100%;
  min-height: 52px;
}
#match #endTurnHint {
  display: block;
  font-size: 9px;
  line-height: 1.15;
}
#match .hand-card-focus {
  position: absolute;
  left: 302px;
  right: 158px;
  bottom: 4px;
  width: auto;
  max-width: none;
  max-height: 170px;
  margin: 0;
  padding-top: 15px;
  pointer-events: auto;
}
#match .match-bottom-dock.card-command-open .hand-area { display: none !important; }
#match .hand-card-focus .game-card { width: 100%; }

/* Tablet tightening keeps the reference composition instead of stacking zones. */
@media (max-width: 1399px) {
  #match .arena-playmat {
    grid-template-columns: minmax(0,1fr) 82px;
    grid-template-rows: 128px minmax(0,1fr) 128px;
  }
  #match .arena-band .mat-fixer .mat-content {
    grid-template-columns: repeat(3,46px) minmax(230px,1fr) repeat(3,46px);
    gap: 5px;
    padding-inline: 10px;
  }
  #match .arena-band .fixer-die {
    width: 46px;
    min-width: 46px;
    height: 52px;
  }
  #match .arena-band .mat-legends { width: 280px; height: 116px; }
  #match .arena-band .mat-legend-slot { width: 52px; height: 64px; }
  #match .arena-band .mat-legend-slot:nth-child(3) { left: 114px; }
  #match .arena-band .player-hub { width: 72px; height: 72px; }
  #match .arena-band .mat-deck,
  #match .arena-band .mat-trash { width: 66px; }
  #match .arena-band .mat-deck { right: 78px; }
}

/* Phone landscape is the same board, with detail compressed—not a different
   stacked interface. The player can see both rails, both combat lanes, hand,
   guidance, Gig controls and End Turn in one frame. */
@media (orientation: landscape) and (max-height: 620px) {
  body.match-active #match:not([hidden]) { display: block; }
  #match .arena-playmat {
    grid-template-columns: minmax(0,1fr) 62px;
    grid-template-rows: 66px minmax(0,1fr) 72px;
    gap: 2px;
    padding: 2px;
  }
  #match .arena-band::before,
  #match .arena-band::after { width: 40%; height: 68%; opacity: .45; }
  #match .arena-band .player-hub {
    width: 48px;
    height: 48px;
    border-width: 1px;
    box-shadow: 0 0 0 2px #091116,0 0 9px currentColor;
  }
  #match .arena-band .player-hub::before { inset: -4px; }
  #match .arena-band .player-hub::after { display: none; }
  #match .arena-band .player-hub .identity-badge > .portrait-image { width: 25px; height: 29px; }
  #match .arena-band .player-hub .identity-badge strong { max-width: 42px; font-size: 6px; }
  #match .arena-band .mat-fixer .mat-content {
    grid-template-columns: repeat(3,44px) minmax(150px,1fr) repeat(3,44px);
    gap: 1px;
    padding-inline: 3px;
  }
  #match .arena-band .fixer-die {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    transform: scale(.84);
  }
  #match .arena-band .fixer-die svg { width: 22px; height: 22px; }
  #match .arena-band .mat-legends { width: 176px; height: 62px; }
  #match .arena-band .mat-legend-slot {
    width: 32px;
    height: 42px;
    box-shadow: none;
  }
  #match .arena-band .mat-legend-slot:nth-child(1) { left: 8px; top: 10px; }
  #match .arena-band .mat-legend-slot:nth-child(2) { right: 8px; top: 10px; }
  #match .arena-band .mat-legend-slot:nth-child(3) { left: 72px; bottom: -1px; }
  #match .arena-rival .mat-legend-slot:nth-child(3) { top: -1px; }
  #match .arena-band .legend-art,
  #match .arena-band .legend-back,
  #match .arena-band .legend-art img,
  #match .arena-band .legend-back .card-back-visual { height: 31px; }
  #match .arena-band .legend-name,
  #match .arena-band .legend-state { display: none; }
  #match .arena-band .mat-call {
    left: calc(50% + 51px);
    bottom: 2px;
    width: 54px;
    min-height: 44px;
    padding: 1px;
    font-size: 6px;
  }
  #match .arena-rival .mat-call { top: 2px; bottom: auto; }
  #match .arena-band > .mat-rival,
  #match .arena-band > .mat-friendly {
    left: 20%;
    right: 20%;
  }
  #match .arena-band > .mat-rival .mat-dice,
  #match .arena-band > .mat-friendly .mat-dice {
    min-height: 44px;
    padding-inline: 72px;
  }
  #match .arena-band .mat-die {
    flex-basis: 44px;
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    transform: scale(.82);
  }
  #match .arena-band .mat-deck,
  #match .arena-band .mat-trash {
    top: 3px;
    width: 46px;
    height: 42px;
    padding: 2px;
  }
  #match .arena-band .mat-deck { right: 51px; }
  #match .arena-band .mat-trash { right: 3px; }
  #match .arena-own .mat-deck,
  #match .arena-own .mat-trash { top: auto; bottom: 3px; }
  #match .arena-band .mat-deck .mat-label,
  #match .arena-band .mat-trash .mat-label { display: none; }
  #match .arena-band .back-caption,
  #match .arena-band .pile-count { font-size: 7px; }
  #match .arena-battle .mat-field { padding: 11px 3px 3px; }
  #match .arena-battle .field-lane {
    grid-template-rows: 21px minmax(0,1fr);
    padding: 1px 4px;
  }
  #match .arena-battle .lane-title { min-height: 20px; }
  #match .arena-battle .lane-title h3 { font-size: 7px; }
  #match .arena-battle .lane-title > span:not(.lane-turn-state) { display: none; }
  #match .arena-battle .lane-turn-state { font-size: 6px; }
  #match .arena-battle .field-lane-rival::after { bottom: -6px; font-size: 6px; }
  #match .arena-battle .field-cards { gap: 3px; padding: 0 2px; }
  #match .arena-battle .field-cards .game-card {
    flex-basis: 84px;
    width: 84px;
    max-height: 61px;
    overflow: hidden;
  }
  #match .arena-battle .field-cards .card-art-button { height: 54px; }
  #match .arena-battle .field-cards .game-card h3,
  #match .arena-battle .field-cards .card-meta,
  #match .arena-battle .field-cards .status,
  #match .arena-battle .field-cards .mini-actions { display: none; }
  #match .arena-meter {
    grid-template-rows: 12px minmax(100px,1fr) 74px;
    gap: 2px;
    padding: 2px;
  }
  #match .arena-meter-title { font-size: 6px; }
  #match .arena-pressure { grid-template-rows: 1fr 14px 1fr; gap: 2px; }
  #match .pressure-side { gap: 2px; }
  #match .pressure-side i { min-height: 4px; }
  #match .pressure-neutral { font-size: 8px; }
  #match .arena-eddies .mat-eddies { padding: 1px; }
  #match .arena-eddies .mat-label { display: none; }
  #match .arena-eddies .bank-total { font-size: 6px; }
  #match .arena-eddies .bank-total strong { font-size: 13px; }

  #match #stepTracker {
    left: 4px;
    top: 4px;
    bottom: auto;
    width: 174px;
    height: 58px;
    max-height: 58px;
    padding: 4px 5px;
  }
  #match #stepTracker .match-context > strong { font-size: 10px; }
  #match #stepTracker .match-context > small { font-size: 7px; }
  #match #stepTracker .tracker-actions { display: none; }
  #match .match-bottom-dock .hand-area {
    left: 150px;
    right: 94px;
    height: 82px;
    min-height: 82px;
    padding: 2px 3px 0;
  }
  #match .match-bottom-dock .hand-area .section-title { height: 18px; padding: 1px 4px; }
  #match .hand-area h2 { font-size: 10px; }
  #match #realWallet { font-size: 7px; }
  #match .match-bottom-dock #realHand {
    height: 64px;
    min-height: 64px;
    padding: 1px 3px 0;
  }
  #match .match-bottom-dock #realHand .game-card {
    flex-basis: 78px;
    width: 78px;
    margin-left: -16px;
  }
  #match .match-bottom-dock #realHand .card-art-button { height: 102px; }
  #match .match-bottom-dock .turn-dock {
    right: 4px;
    bottom: 4px;
    width: 86px;
    height: 76px;
    padding: 4px !important;
  }
  #match .match-bottom-dock .turn-dock button {
    min-height: 48px;
    font-size: 11px;
  }
  #match #endTurnHint { display: none; }
  #match .hand-card-focus {
    left: 150px;
    right: 94px;
    bottom: 3px;
    max-height: 148px;
  }
  #match .hand-card-focus .game-card {
    grid-template-columns: 58px minmax(0,1fr) minmax(130px,180px);
    min-width: 0;
  }
  #match .hand-card-focus .card-art-button,
  #match .hand-card-focus .thumb {
    width: 58px;
    height: 76px;
  }
}

/* Portrait remains an explicit orientation gate. */
@media (max-width: 720px) and (orientation: portrait) and (pointer: coarse) {
  #match .arena-playmat,
  #match .match-bottom-dock { visibility: hidden; pointer-events: none; }
}

@media (pointer: coarse) {
  #match button,
  #match [role="button"] { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  #match .arena-playmat *,
  #match .arena-playmat *::before,
  #match .arena-playmat *::after { transition: none !important; animation: none !important; }
}


/* Reference-board viewport integration v2.
   The board and the lower HUD now own separate viewport bands, matching the
   supplied arena instead of covering the near command rail with the hand. */
body.match-active #match:not([hidden]) {
  --arena-hud-depth: 132px;
}
#match .arena-playmat {
  height: calc(100% - var(--arena-hud-depth));
}
#match .arena-band > .player-resources > .mat-fixer,
#match .arena-band .mat-fixer .mat-content,
#match .arena-band .mat-legends,
#match .arena-band .player-hub {
  visibility: visible;
  opacity: 1;
}
#match .arena-band > .player-resources > .mat-fixer,
#match .arena-band .mat-legends {
  display: block !important;
}

/* The live action context belongs in the lower-left HUD block. */
#match #stepTracker .match-context {
  display: grid;
  grid-template-rows: auto auto auto minmax(0,1fr);
  gap: 2px;
  overflow: hidden;
}
#match #stepTracker .match-context > #matchContextKicker {
  color: var(--arena-cyan);
  font-size: 9px;
  letter-spacing: .12em;
}
#match #stepTracker .match-context > strong {
  min-height: 17px;
  font-size: 14px;
  line-height: 17px;
}
#match #stepTracker .match-context > small {
  line-height: 1.2;
}
#match #stepTracker .context-actions {
  display: flex;
  min-width: 0;
  gap: 4px;
  overflow-x: auto;
  overflow-y: hidden;
}
#match #stepTracker .context-actions:empty { display: none; }
#match #stepTracker .context-actions button {
  flex: 0 0 auto;
  min-height: 44px;
}
#match #stepTracker .tracker-actions { display: none; }

/* Keep every command-rail object in the digital arena. Older compact rules
   moved the local Fixer away from the board. */
#match .arena-band .fixer-die,
#match .arena-band .mat-die {
  transform: none !important;
}
#match .arena-band .gig-roll-source .fixer-die.can-roll {
  transform: none !important;
}

@media (orientation: landscape) and (max-height: 620px) {
  body.match-active {
    --control-size: 44px;
  }
  body.match-active > .site-header {
    height: 48px;
    min-height: 48px;
    max-height: 48px;
    padding-block: 2px;
    overflow: visible;
  }
  body.match-active > .site-header .menu-toggle,
  body.match-active > .site-header .profile-corner,
  body.match-active .match-settings > summary {
    min-height: 44px;
    height: 44px;
  }
  body.match-active > main {
    padding-top: 2px;
  }
  body.match-active #match:not([hidden]) {
    --arena-hud-depth: 120px;
  }
  #match .arena-playmat {
    grid-template-columns: minmax(0,1fr) 62px;
    grid-template-rows: 55px minmax(0,1fr) 55px;
  }
  #match .arena-band .player-hub {
    display: grid !important;
    width: 44px;
    height: 44px;
  }
  #match .arena-band .player-hub .identity-badge > .portrait-image {
    width: 23px;
    height: 27px;
  }
  #match .arena-band .player-hub .identity-badge strong {
    display: none;
  }
  #match .arena-band .mat-fixer {
    display: block !important;
  }
  #match .arena-band .mat-fixer .mat-content {
    grid-template-columns: repeat(3,44px) minmax(138px,1fr) repeat(3,44px);
    gap: 1px;
    padding-inline: 2px;
  }
  #match .arena-band .fixer-die {
    display: flex;
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 1px;
  }
  #match .arena-band .fixer-die svg {
    width: 21px;
    height: 21px;
  }
  #match .arena-band .mat-legends {
    display: block !important;
    width: 166px;
    height: 54px;
  }
  #match .arena-band .mat-legend-slot {
    width: 44px;
    height: 44px;
  }
  #match .arena-band .mat-legend-slot:nth-child(1) {
    left: 2px;
    top: 5px;
  }
  #match .arena-band .mat-legend-slot:nth-child(2) {
    right: 2px;
    top: 5px;
  }
  #match .arena-band .mat-legend-slot:nth-child(3) {
    left: 61px;
    top: 9px;
    bottom: auto;
  }
  #match .arena-band .legend-art,
  #match .arena-band .legend-back,
  #match .arena-band .legend-art img,
  #match .arena-band .legend-back .card-back-visual {
    height: 42px;
  }
  #match .arena-band .mat-call {
    left: calc(50% + 48px);
    top: 5px;
    bottom: auto;
    width: 46px;
    min-height: 44px;
    padding: 1px;
    overflow: hidden;
    font-size: 0;
  }
  #match .arena-band .mat-call::after {
    content: "CALL";
    font-size: 7px;
  }
  #match .arena-band > .mat-rival,
  #match .arena-band > .mat-friendly {
    left: 18%;
    right: 18%;
  }
  #match .arena-band > .mat-rival .mat-dice,
  #match .arena-band > .mat-friendly .mat-dice {
    min-height: 44px;
    padding-inline: 70px;
  }
  #match .arena-band .mat-die {
    flex-basis: 44px;
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
  }
  #match .arena-battle .mat-field {
    padding: 9px 3px 2px;
  }
  #match .arena-battle .field-lane {
    grid-template-rows: 17px minmax(0,1fr);
    padding: 1px 3px;
  }
  #match .arena-battle .lane-title {
    min-height: 16px;
  }
  #match .arena-battle .field-lane-rival::after {
    bottom: -5px;
  }
  #match .arena-battle .field-cards .game-card {
    max-height: 50px;
  }
  #match .arena-battle .field-cards .card-art-button {
    height: 44px;
  }

  #match #stepTracker {
    left: 4px;
    top: auto;
    bottom: 4px;
    width: 140px;
    height: 112px;
    max-height: 112px;
    padding: 6px;
  }
  #match #stepTracker .match-context > #matchContextKicker {
    font-size: 7px;
  }
  #match #stepTracker .match-context > strong {
    min-height: 17px;
    font-size: 14px;
    line-height: 17px;
  }
  #match #stepTracker .match-context > small {
    display: block;
    font-size: 8px;
  }
  #match #stepTracker .context-actions {
    display: flex;
  }
  #match #stepTracker .context-actions:empty {
    display: none;
  }
  #match .match-bottom-dock .hand-area {
    left: 148px;
    right: 96px;
    height: 120px;
    min-height: 120px;
    padding: 1px 3px 0;
  }
  #match .match-bottom-dock .hand-area .section-title {
    height: 18px;
    padding: 1px 4px;
  }
  #match .match-bottom-dock #realHand {
    height: 102px;
    min-height: 102px;
    padding: 1px 3px 0;
  }
  #match .match-bottom-dock #realHand .game-card {
    flex-basis: 82px;
    width: 82px;
    margin-left: -16px;
  }
  #match .match-bottom-dock #realHand .card-art-button {
    height: 112px;
  }
  #match .match-bottom-dock .turn-dock {
    right: 4px;
    bottom: 4px;
    width: 88px;
    height: 112px;
    padding: 4px !important;
  }
  #match .match-bottom-dock .turn-dock button {
    min-height: 54px;
    font-size: 12px;
  }
  #match .hand-card-focus {
    left: 148px;
    right: 96px;
    bottom: 3px;
    max-height: 166px;
  }
}


/* Reference-board viewport integration v3.
   Neutralize legacy flex sizing and inset values that could pull the lower
   command rail back underneath the arena or pin End Turn to the wrong edge. */
#match .arena-playmat {
  flex: 0 0 calc(100% - var(--arena-hud-depth)) !important;
  max-height: calc(100% - var(--arena-hud-depth));
}
#match .match-bottom-dock .turn-dock {
  position: absolute !important;
  inset: auto 8px 8px auto !important;
}
#match .arena-band .mat-fixer .mat-content {
  padding-right: clamp(112px, 14vw, 198px);
  padding-left: clamp(8px, 1vw, 18px);
}

@media (orientation: landscape) and (max-height: 620px) {
  #match .arena-playmat {
    flex-basis: calc(100% - var(--arena-hud-depth)) !important;
    max-height: calc(100% - var(--arena-hud-depth));
  }
  #match .match-bottom-dock .turn-dock {
    inset: auto 4px 4px auto !important;
  }
  #match .arena-band .mat-fixer .mat-content {
    padding-left: 2px;
    padding-right: 96px;
  }
}


/* Reference-board phone legibility v4.
   A shallow overlaid hand title preserves readable card art while returning
   enough height to the mirrored command rails for the identity and Legends. */
@media (orientation: landscape) and (max-height: 620px) {
  body.match-active #match:not([hidden]) {
    --arena-hud-depth: 104px;
  }
  #match .arena-playmat {
    grid-template-rows: 64px minmax(0,1fr) 64px;
  }
  #match .arena-band .player-hub {
    width: 50px;
    height: 50px;
    box-shadow: 0 0 0 2px #091116, 0 0 12px currentColor;
  }
  #match .arena-band .mat-legends {
    width: 180px;
    height: 62px;
  }
  #match .arena-band .mat-legend-slot {
    width: 46px;
    height: 48px;
    border-width: 1px;
  }
  #match .arena-band .mat-legend-slot:nth-child(1) {
    left: 3px;
    top: 7px;
  }
  #match .arena-band .mat-legend-slot:nth-child(2) {
    right: 3px;
    top: 7px;
  }
  #match .arena-band .mat-legend-slot:nth-child(3) {
    left: 67px;
    top: 11px;
  }
  #match .arena-band .legend-art,
  #match .arena-band .legend-back,
  #match .arena-band .legend-art img,
  #match .arena-band .legend-back .card-back-visual {
    height: 46px;
  }
  #match .arena-band .mat-call {
    left: calc(50% + 53px);
    top: 9px;
  }
  #match .arena-rival .fixer-die:not(.departed),
  #match .arena-rival .mat-legend-slot {
    opacity: .78 !important;
  }
  #match .arena-band .mat-deck,
  #match .arena-band .mat-trash {
    display: block !important;
  }

  #match #stepTracker {
    height: 96px;
    max-height: 96px;
  }
  #match .match-bottom-dock .hand-area {
    height: 104px;
    min-height: 104px;
    padding: 0 3px;
  }
  #match .match-bottom-dock .hand-area .section-title {
    position: absolute;
    z-index: 3;
    top: 0;
    left: 0;
    right: 0;
    height: 18px;
    padding: 1px 5px;
    background: linear-gradient(180deg,#061016 72%,transparent);
    pointer-events: none;
  }
  #match .match-bottom-dock #realHand {
    position: absolute;
    inset: 4px 0 0;
    height: 100px;
    min-height: 100px;
    padding: 0 3px;
  }
  #match .match-bottom-dock .turn-dock {
    height: 100px;
  }
}


/* Reference-board containing blocks v5.
   Compact legacy rules made the resource wrapper participate in an old grid,
   so positioned rail controls could use a collapsed mobile containing block. */
#match .arena-band > .player-resources {
  position: absolute;
  inset: 0;
  display: block !important;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}


/* Reference-board wide hand v6.
   The reference devotes a real lower band to the hand; taller screens can show
   nearly the full card art without taking space from the contested field. */
@media (orientation: landscape) and (min-height: 621px) {
  body.match-active #match:not([hidden]) {
    --arena-hud-depth: 160px;
  }
  #match #stepTracker {
    height: 116px;
    max-height: 116px;
  }
  #match .match-bottom-dock .hand-area {
    height: 148px;
    min-height: 148px;
  }
  #match .match-bottom-dock #realHand {
    height: 124px;
    min-height: 124px;
  }
  #match .match-bottom-dock .turn-dock {
    height: 116px;
  }
  #match .hand-card-focus {
    max-height: 190px;
  }
}


/* Reference-board spatial cleanup v7.
   Keep the combat lanes, command rails and lower HUD as separate physical
   bands. Fixed circuit nodes replace movable-looking die boxes, Control stays
   visually above the field, and selected-card commands use a compact popover. */
#match .arena-playmat,
#match .arena-playmat * {
  box-sizing: border-box;
}
#match .arena-playmat {
  isolation: isolate;
}
#match .arena-battle {
  position: relative;
  z-index: 1;
  overflow: hidden;
}
#match .arena-battle .mat-field,
#match .arena-battle .mat-field > .mat-content,
#match .arena-battle .field-lane {
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
}
#match .arena-band {
  z-index: 4;
  border-inline: 0;
  border-radius: 0;
}
#match .arena-battle .mat-field {
  border-inline: 0;
  border-radius: 0;
}
#match .arena-battle .field-lane-rival,
#match .arena-battle .field-lane-own {
  background: transparent;
}

/* Gigs are permanent circuit nodes. Their labels still identify the die used,
   but the controls no longer look like loose tabletop dice. */
#match .arena-band .fixer-die {
  width: 48px;
  min-width: 48px;
  height: 48px;
  min-height: 48px;
  padding: 4px;
  overflow: hidden;
  border: 1px solid currentColor;
  border-radius: 0;
  clip-path: polygon(50% 0, 84% 16%, 100% 50%, 84% 84%, 50% 100%, 16% 84%, 0 50%, 16% 16%);
  background:
    radial-gradient(circle at 50% 46%, #18313c 0 27%, transparent 29%),
    linear-gradient(135deg, #0e2029, #050b10 68%);
  box-shadow: inset 0 0 0 4px #071017, 0 0 9px currentColor;
}
#match .arena-band .fixer-die::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid currentColor;
  clip-path: inherit;
  opacity: .45;
  pointer-events: none;
}
#match .arena-band .fixer-die svg {
  position: relative;
  z-index: 1;
  width: 22px;
  height: 22px;
}
#match .arena-band .fixer-die strong {
  position: relative;
  z-index: 1;
  font-size: 8px;
  line-height: 1;
}
#match .arena-own .fixer-die.can-roll {
  background:
    radial-gradient(circle at 50% 46%, #28434a 0 27%, transparent 29%),
    linear-gradient(135deg, #172919, #07100a 68%);
}

/* Control is a foreground instrument, not a recessed empty sidebar. */
#match .arena-meter {
  position: relative;
  z-index: 12;
  border-color: #647982;
  background: linear-gradient(180deg, #0a151cf7, #03080cf7);
  box-shadow: -5px 0 18px #0009, 0 0 12px #31d9ff1d;
}
#match .arena-meter-title {
  display: grid;
  min-height: 24px;
  place-content: center;
  color: var(--arena-gold);
  font-size: 9px;
  letter-spacing: .11em;
  white-space: nowrap;
}
#match .pressure-neutral {
  background: #101820;
  box-shadow: inset 0 0 10px #ffc64d24;
}

/* The lower HUD is one player zone. Cards float in it instead of sitting
   inside another heavy panel. */
#match .match-bottom-dock .hand-area {
  border: 0;
  background: linear-gradient(180deg, transparent 0, #040a0edb 30%, #020508f7 100%);
  box-shadow: inset 0 1px #31d9ff40;
}
#match .match-bottom-dock .hand-area .section-title {
  background: linear-gradient(180deg, #061016e8 68%, transparent);
}

/* Selected-card actions are a compact command popover, not a full-width bar. */
#match .hand-card-focus {
  left: 50%;
  right: auto;
  bottom: 8px;
  width: min(520px, calc(100% - 480px));
  min-width: 360px;
  max-width: 520px;
  max-height: 126px;
  transform: translateX(-50%);
  padding-top: 0;
  overflow: hidden;
  border-radius: 7px;
  background: #061016f5;
  box-shadow: 0 10px 28px #000c, 0 0 18px #e9ef2533;
}
#match .hand-card-focus .game-card {
  grid-template-columns: 78px minmax(110px, 1fr) minmax(148px, 190px);
  grid-template-rows: auto auto minmax(44px, 1fr);
  min-height: 118px;
  max-height: 126px;
  padding: 6px 50px 6px 6px;
  column-gap: 8px;
}
#match .hand-card-focus .card-art-button,
#match .hand-card-focus .thumb {
  width: 78px;
  height: 106px;
}
#match .hand-card-focus .mini-actions button {
  min-height: 44px;
}

/* Tall screens do not need a 160px command shelf. Returning that space to the
   actual play zones fixes the oversized-board feeling without shrinking cards. */
@media (orientation: landscape) and (min-height: 621px) {
  body.match-active #match:not([hidden]) {
    --arena-hud-depth: 138px;
  }
  #match .arena-playmat {
    grid-template-rows: 124px minmax(0, 1fr) 124px;
  }
  #match #stepTracker,
  #match .match-bottom-dock .turn-dock {
    height: 108px;
    max-height: 108px;
  }
  #match .match-bottom-dock .hand-area {
    height: 132px;
    min-height: 132px;
  }
  #match .match-bottom-dock #realHand {
    height: 110px;
    min-height: 110px;
  }
}

@media (orientation: landscape) and (max-height: 620px) {
  body.match-active #match:not([hidden]) {
    --arena-hud-depth: 96px;
  }
  #match .arena-playmat {
    grid-template-rows: 60px minmax(0, 1fr) 60px;
  }
  #match .arena-band .fixer-die {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 3px;
  }
  #match .arena-meter {
    grid-template-rows: 20px minmax(72px, 1fr) 58px;
  }
  #match .arena-meter-title {
    min-height: 20px;
    font-size: 7px;
  }
  #match #stepTracker {
    height: 88px;
    max-height: 88px;
  }
  #match .match-bottom-dock .hand-area {
    height: 96px;
    min-height: 96px;
  }
  #match .match-bottom-dock #realHand {
    height: 94px;
    min-height: 94px;
  }
  #match .match-bottom-dock .turn-dock {
    height: 92px;
  }
  #match .hand-card-focus {
    left: 50%;
    right: auto;
    bottom: 4px;
    width: min(380px, calc(100% - 252px));
    min-width: 260px;
    max-width: 380px;
    max-height: 92px;
    transform: translateX(-50%);
  }
  #match .hand-card-focus .game-card {
    grid-template-columns: 58px minmax(84px, 1fr) minmax(104px, 132px);
    min-width: 0;
    min-height: 88px;
    max-height: 92px;
    padding: 4px 46px 4px 4px;
    column-gap: 5px;
  }
  #match .hand-card-focus .card-art-button,
  #match .hand-card-focus .thumb {
    width: 58px;
    height: 80px;
  }
  #match .hand-card-focus h3 {
    font-size: 12px;
    line-height: 1.1;
  }
  #match .hand-card-focus .card-meta {
    font-size: 8px;
  }
  #match .hand-card-focus .hand-action-state,
  #match .hand-card-focus .hand-lock-reason {
    font-size: 8px;
    line-height: 1.1;
  }
  #match .hand-card-focus .mini-actions {
    gap: 3px;
  }
  #match .hand-card-focus .mini-actions button {
    min-height: 44px;
    padding: 3px;
    font-size: 10px;
  }
  #match .hand-card-focus .hand-card-close,
  #match .hand-card-focus .hand-card-expand {
    right: 1px;
    top: 1px;
  }
  #match .hand-card-focus .hand-card-expand {
    top: 46px;
  }
}


/* Reference-board lane containment v8.
   Absolutely inset the two crew lanes inside the combat row so legacy
   min-heights can never extend the player's lane beneath the command rail. */
#match .arena-battle .mat-field {
  position: relative;
  padding: 0 !important;
}
#match .arena-battle .mat-field > .mat-content {
  position: absolute;
  inset: 18px 10px 6px;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
}
@media (orientation: landscape) and (max-height: 620px) {
  #match .arena-battle .mat-field > .mat-content {
    inset: 9px 3px 2px;
  }
}


/* Reference-board field reset v9.
   The legacy board assigns .mat-field to a parent grid area. Inside the new
   arena wrapper that old placement offset the entire field by one grid row.
   Anchor it directly to the arena-battle containing block. */
#match .arena-battle > .mat-field {
  position: absolute !important;
  inset: 0 !important;
  grid-area: auto !important;
  align-self: stretch !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  transform: none !important;
}


/* Reference-board node override v10.
   board.css intentionally forced loose dice back to transparent silhouettes.
   The new fixed-node arena is authoritative, so override that legacy rule. */
#match .arena-band .fixer-die {
  overflow: hidden !important;
  border: 1px solid currentColor !important;
  clip-path: polygon(50% 0, 84% 16%, 100% 50%, 84% 84%, 50% 100%, 16% 84%, 0 50%, 16% 16%) !important;
  background:
    radial-gradient(circle at 50% 46%, #18313c 0 27%, transparent 29%),
    linear-gradient(135deg, #0e2029, #050b10 68%) !important;
  box-shadow: inset 0 0 0 4px #071017, 0 0 9px currentColor !important;
}
#match .arena-own .fixer-die.can-roll {
  background:
    radial-gradient(circle at 50% 46%, #28434a 0 27%, transparent 29%),
    linear-gradient(135deg, #172919, #07100a 68%) !important;
}


/* Reference-board compact command override v11.
   Reset every legacy inset/width so the selected card cannot stretch back into
   the old full-width command bar. */
#match .hand-card-focus {
  position: absolute !important;
  inset: auto auto 8px 50% !important;
  width: 520px !important;
  min-width: 360px !important;
  max-width: calc(100vw - 480px) !important;
  transform: translateX(-50%) !important;
}
@media (orientation: landscape) and (max-height: 620px) {
  #match .hand-card-focus {
    inset: auto auto 4px 50% !important;
    width: 380px !important;
    min-width: 260px !important;
    max-width: calc(100vw - 276px) !important;
    max-height: 92px !important;
  }
}


/* Reference-board ownership nodes v12.
   Fixed circuit nodes are the Gig display: dark while unclaimed, blue when
   controlled by the viewer, and red when controlled by the rival. */
#match .arena-band > .mat-rival,
#match .arena-band > .mat-friendly,
#match .arena-eddies {
  display: none !important;
}
#match .arena-meter {
  grid-template-rows: 24px minmax(0, 1fr);
}
#match .arena-band .fixer-die.gig-unowned {
  color: #66777f;
  opacity: .72 !important;
  background:
    radial-gradient(circle at 50% 46%, #14242b 0 27%, transparent 29%),
    linear-gradient(135deg, #0a151b, #03070a 68%) !important;
  box-shadow: inset 0 0 0 4px #050b0f, 0 0 7px #263b44 !important;
}
#match .arena-band .fixer-die.gig-owned-own {
  color: var(--arena-cyan);
  opacity: 1 !important;
  background:
    radial-gradient(circle at 50% 46%, #167a96 0 27%, transparent 29%),
    linear-gradient(135deg, #0f5065, #06151e 68%) !important;
  box-shadow: inset 0 0 0 4px #06141b, 0 0 15px #31d9ffb8 !important;
}
#match .arena-band .fixer-die.gig-owned-rival {
  color: var(--arena-red);
  opacity: 1 !important;
  background:
    radial-gradient(circle at 50% 46%, #8e302d 0 27%, transparent 29%),
    linear-gradient(135deg, #5a211f, #1b0909 68%) !important;
  box-shadow: inset 0 0 0 4px #180909, 0 0 15px #ff574ca8 !important;
}
#match .arena-band .fixer-die.gig-owned-own strong,
#match .arena-band .fixer-die.gig-owned-rival strong {
  font-size: 14px;
}
#match .arena-band .fixer-die.gig-attack-target,
#match .arena-band .fixer-die.stealable {
  cursor: pointer;
  outline: 2px solid var(--arena-gold);
  outline-offset: 2px;
}
#match .arena-band .fixer-die.attack-target-selected {
  color: var(--arena-gold);
  box-shadow: inset 0 0 0 4px #171408, 0 0 20px #ffc64ddb !important;
}
#match .arena-band .fixer-die .gig-choice-badge {
  position: absolute;
  z-index: 3;
  right: 2px;
  bottom: 2px;
  padding: 1px 2px;
  border-radius: 2px;
  background: #ffc64d;
  color: #080b0d;
  font-size: 6px;
  line-height: 1;
}
#match .arena-band .fixer-die:disabled {
  cursor: default;
}
#match .arena-band .player-hub {
  overflow: visible;
}
#match .arena-band .player-hub-stat {
  position: absolute;
  z-index: 4;
  top: -9px;
  display: grid;
  width: 50px;
  min-height: 34px;
  place-content: center;
  gap: 0;
  border: 1px solid currentColor;
  border-radius: 5px;
  background: #050b10f2;
  box-shadow: 0 4px 10px #000b, inset 0 0 8px currentColor;
  line-height: 1;
  text-align: center;
}
#match .arena-band .hub-gigs {
  right: calc(100% - 9px);
  color: var(--arena-cyan);
}
#match .arena-rival .hub-gigs {
  color: var(--arena-red);
}
#match .arena-band .hub-eddies {
  left: calc(100% - 9px);
  color: var(--arena-gold);
}
#match .arena-band .player-hub-stat small {
  font-size: 6px;
  letter-spacing: .1em;
}
#match .arena-band .player-hub-stat strong {
  margin-top: 2px;
  font-size: 14px;
}
@media (orientation: landscape) and (max-height: 620px) {
  #match .arena-meter {
    grid-template-rows: 20px minmax(0, 1fr);
  }
  #match .arena-band .player-hub-stat {
    top: -5px;
    width: 45px;
    min-height: 30px;
  }
  #match .arena-band .hub-gigs {
    right: calc(100% - 5px);
  }
  #match .arena-band .hub-eddies {
    left: calc(100% - 5px);
  }
  #match .arena-band .player-hub-stat strong {
    font-size: 12px;
  }
}


/* Reference-board fluid height budget v13.
   One bounded system owns every vertical game band. The battlefield keeps a
   readable floor; below that floor, the board grows and the existing
   .match-layout scroller contains the overflow instead of the page clipping it. */
body.match-active #match:not([hidden]) {
  --match-safe-bottom: env(safe-area-inset-bottom, 0px);
  --arena-battle-min-height: 72px;
  --arena-hud-content-depth: clamp(112px, 18dvh, 138px);
  --arena-hud-depth: calc(var(--arena-hud-content-depth) + var(--match-safe-bottom));
  --arena-rail-height: clamp(104px, 16dvh, 124px);
  --arena-tracker-height: clamp(92px, 14dvh, 108px);
  --arena-hand-height: clamp(110px, 17dvh, 132px);
  --arena-hand-strip-height: calc(var(--arena-hand-height) - 2px);
  --arena-turn-height: var(--arena-tracker-height);
}
#match #board {
  min-height: max(
    100%,
    calc((2 * var(--arena-rail-height)) + var(--arena-battle-min-height) + var(--arena-hud-depth) + 16px)
  );
}
#match .arena-playmat {
  min-height: calc((2 * var(--arena-rail-height)) + var(--arena-battle-min-height) + 16px);
  grid-template-rows:
    var(--arena-rail-height)
    minmax(var(--arena-battle-min-height), 1fr)
    var(--arena-rail-height);
}
#match #stepTracker {
  bottom: calc(8px + var(--match-safe-bottom));
  height: var(--arena-tracker-height);
  max-height: var(--arena-tracker-height);
}
#match .match-bottom-dock .hand-area {
  bottom: var(--match-safe-bottom);
  height: var(--arena-hand-height);
  min-height: var(--arena-hand-height);
}
#match .match-bottom-dock #realHand {
  height: var(--arena-hand-strip-height);
  min-height: var(--arena-hand-strip-height);
}
#match .match-bottom-dock .turn-dock {
  bottom: calc(8px + var(--match-safe-bottom)) !important;
  height: var(--arena-turn-height);
}
#match .match-layout { scrollbar-gutter: auto; }
@media (hover: hover) and (pointer: fine) {
  #match .match-layout { scrollbar-gutter: stable; }
}

/* Narrow mouse-driven windows are allowed to use the contained board scroller;
   the rotate gate is reserved for touch-first portrait phones. */
@media (max-width: 720px) and (orientation: portrait) and (pointer: fine) {
  body.match-active #match:not([hidden]) { position: relative; }
  #match .mobile-landscape-gate,
  #match .mobile-match-nav { display: none !important; }
  #match[data-mobile-view] .match-layout {
    display: block !important;
    visibility: visible;
    pointer-events: auto;
  }
  #match[data-mobile-view] .match-bottom-dock {
    display: block !important;
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-height: none !important;
    overflow: visible !important;
    visibility: visible;
    pointer-events: none;
  }
  #match[data-mobile-view='board'] #stepTracker { display: grid !important; }
  #match[data-mobile-view='board'] .hand-area { display: block !important; }
  #match[data-mobile-view='board'] .hand-card-focus:not([hidden]) { display: block !important; }
  #match .match-bottom-dock > * { pointer-events: auto; }
}

@media (orientation: landscape) and (max-height: 620px) {
  body.match-active #match:not([hidden]) {
    --arena-hud-content-depth: clamp(88px, 26.7dvh, 104px);
    --arena-rail-height: clamp(52px, 16.4dvh, 64px);
    --arena-tracker-height: clamp(72px, 22.6dvh, 88px);
    --arena-hand-height: clamp(82px, 24.6dvh, 96px);
    --arena-turn-height: clamp(76px, 23.6dvh, 92px);
  }
  #match .arena-playmat {
    flex-basis: calc(100% - var(--arena-hud-depth)) !important;
    max-height: none;
  }
  #match #stepTracker {
    bottom: calc(4px + var(--match-safe-bottom));
  }
  #match .match-bottom-dock .turn-dock {
    bottom: calc(4px + var(--match-safe-bottom)) !important;
  }
}


/* Real-device phone landscape v14.
   Mobile browser chrome can leave only ~320px of visual height. Keep the
   opening state at scroll position zero, use the full board width, and give
   the player rail and lower commands separate non-overlapping bands. */
@media (orientation: landscape) and (max-width: 1100px) and (max-height: 430px) {
  body.match-active #match:not([hidden]) {
    --arena-battle-min-height: 56px;
    --arena-hud-content-depth: 92px;
    --arena-hud-depth: calc(var(--arena-hud-content-depth) + var(--match-safe-bottom));
    --arena-rail-height: clamp(48px, 15dvh, 54px);
    --arena-tracker-height: 84px;
    --arena-hand-height: 88px;
    --arena-hand-strip-height: 86px;
    --arena-turn-height: 84px;
  }
  #match .match-layout {
    overflow: hidden;
    overscroll-behavior: none;
  }
  #match #board {
    min-height: 100%;
    overflow: hidden;
  }
  #match .arena-playmat {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows:
      var(--arena-rail-height)
      minmax(var(--arena-battle-min-height), 1fr)
      var(--arena-rail-height);
    grid-template-areas:
      "rival"
      "battle"
      "own";
    gap: 2px;
    padding: 2px;
  }

  /* On a phone the control meter becomes a compact battlefield readout instead
     of a fourth full-height column. */
  #match .arena-meter {
    position: absolute;
    z-index: 18;
    top: calc(var(--arena-rail-height) + 5px);
    right: 6px;
    display: block;
    width: 88px;
    height: 24px;
    min-height: 24px;
    padding: 0 4px;
    border-radius: 3px;
    pointer-events: none;
  }
  #match .arena-meter-title {
    min-height: 22px;
    place-content: center;
    font-size: 7px;
  }
  #match .arena-pressure { display: none; }

  /* Keep the portrait in the center, but move every Legend away from it. */
  #match .arena-band .player-hub {
    width: 44px;
    height: 44px;
  }
  #match .arena-band .player-hub .identity-badge > .portrait-image {
    width: 23px;
    height: 27px;
  }
  #match .arena-band .mat-legends {
    width: 316px;
    height: var(--arena-rail-height);
  }
  #match .arena-band .mat-legend-slot {
    top: 2px !important;
    bottom: auto !important;
    width: 44px;
    height: 44px;
  }
  #match .arena-band .mat-legend-slot:nth-child(1) {
    left: 0;
    right: auto;
  }
  #match .arena-band .mat-legend-slot:nth-child(2) {
    left: 48px;
    right: auto;
  }
  #match .arena-band .mat-legend-slot:nth-child(3) {
    left: auto;
    right: 48px;
  }
  #match .arena-band .legend-art,
  #match .arena-band .legend-back,
  #match .arena-band .legend-art img,
  #match .arena-band .legend-back .card-back-visual {
    height: 42px;
  }
  #match .arena-band .mat-call {
    top: 2px;
    right: 0;
    bottom: auto;
    left: auto;
    width: 44px;
    min-height: 44px;
    transform: none;
  }
  #match .arena-band .player-hub-stat {
    top: -1px;
    width: 40px;
    min-height: 24px;
  }
  #match .arena-band .hub-gigs { right: calc(100% + 4px); }
  #match .arena-band .hub-eddies { left: calc(100% + 4px); }
  #match .arena-band .player-hub-stat strong {
    margin-top: 1px;
    font-size: 10px;
  }

  /* Deck and Trash occupy the open space between the center cluster and the
     right-hand Gig nodes instead of covering those nodes. */
  #match .arena-band .mat-deck,
  #match .arena-band .mat-trash {
    top: 2px;
    bottom: auto;
    width: 44px;
    height: 44px;
  }
  #match .arena-own .mat-deck,
  #match .arena-own .mat-trash {
    top: auto;
    bottom: 2px;
  }
  #match .arena-band .mat-deck {
    left: 158px;
    right: auto;
  }
  #match .arena-band .mat-trash {
    left: 206px;
    right: auto;
  }

  #match #stepTracker {
    left: 4px;
    top: auto;
    bottom: calc(4px + var(--match-safe-bottom));
    width: 226px;
    height: var(--arena-tracker-height);
    max-height: var(--arena-tracker-height);
    grid-template-rows: minmax(0, 1fr) 44px;
    gap: 2px;
    padding: 4px;
  }
  #match #stepTracker .match-context {
    min-height: 0;
    overflow: hidden;
  }
  #match #stepTracker .match-context > #matchContextKicker,
  #match #stepTracker .match-context > small { display: none; }
  #match #stepTracker .match-context > strong {
    min-height: 18px;
    font-size: 11px;
    line-height: 18px;
  }
  #match #stepTracker .context-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    overflow: visible;
  }
  #match #stepTracker .context-actions:empty { display: none; }
  #match #stepTracker .context-actions button {
    min-width: 0;
    min-height: 44px;
    padding-inline: 5px;
    font-size: 9px;
  }
  #match .match-bottom-dock .hand-area {
    left: 234px;
    right: 96px;
    bottom: var(--match-safe-bottom);
    height: var(--arena-hand-height);
    min-height: var(--arena-hand-height);
  }
  #match .match-bottom-dock .hand-area .section-title {
    height: 17px;
    padding: 1px 5px;
  }
  #match .match-bottom-dock #realHand {
    height: var(--arena-hand-strip-height);
    min-height: var(--arena-hand-strip-height);
  }
  #match .match-bottom-dock #realHand .game-card {
    flex-basis: 74px;
    width: 74px;
    margin-left: -13px;
  }
  #match .match-bottom-dock #realHand .card-art-button { height: 96px; }
  #match .match-bottom-dock .turn-dock {
    right: 4px;
    bottom: calc(4px + var(--match-safe-bottom)) !important;
    width: 88px;
    height: var(--arena-turn-height);
  }
}

