/* Cross-device contract loaded last. Keep the play surface stable across
   Chromium, Firefox and WebKit without changing the game's visual language. */
:root { --cg-viewport-height: 100vh; }
@supports (height: 100svh) { :root { --cg-viewport-height: 100svh; } }
@supports (height: 100dvh) { :root { --cg-viewport-height: 100dvh; } }

html, body { width: 100%; max-width: 100%; overflow-x: hidden; }
@supports (overflow: clip) { html, body { overflow-x: clip; } }
img, svg, canvas, video { max-width: 100%; }
button, input, select, textarea, summary { font: inherit; }

body.match-active {
  --match-height: var(--cg-viewport-height);
  width: 100%;
  max-width: 100%;
  min-height: 0;
}
body.match-active > main,
body.match-active #match,
#match .match-layout,
#match #board,
#match .playmat,
#match .match-bottom-dock { min-width: 0; max-width: 100%; }
#match .match-layout { scrollbar-gutter: auto; }
#match .playmat { width: 100%; }
#match .match-bottom-dock { padding-bottom: env(safe-area-inset-bottom, 0px); }
#match .player-resources,
#match .mat-zone,
#match .mat-content,
#match .field-lane,
#match .field-cards,
#match .game-card { min-width: 0; }

/* A selected hand card stays inside the usable viewport, including notched
   phones and Safari's dynamic browser chrome. */
body.match-active .hand-card-focus {
  max-width: calc(100vw - 12px);
  max-height: calc(var(--cg-viewport-height) - 72px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
body.match-active .card-reading-preview,
body.match-active .match-settings-panel,
body.match-active dialog {
  max-width: calc(100vw - 16px);
  max-height: calc(var(--cg-viewport-height) - 20px);
  overscroll-behavior: contain;
}

/* Wide desktop: cap the utility rails so added width goes to the play field. */
@media (min-width: 1600px) {
  #match .playmat {
    grid-template-columns: minmax(150px, 184px) minmax(0, 1fr) minmax(0, 1fr) minmax(150px, 184px);
    column-gap: clamp(10px, 1vw, 18px);
  }
  #match .field-cards .game-card { flex-basis: 132px; width: 132px; }
}

/* Tablet and phone: the player's Gigs live in the near-side dock immediately
   above the hand. Rival resources remain on the far side of the board. */
@media (max-width: 1099px) {
  #match .match-bottom-dock {
    grid-template-columns: minmax(0, 1fr) clamp(76px, 12vw, 96px);
    grid-template-areas: 'tracker tracker' 'gigs gigs' 'hand turn';
  }
  #localGigsDock { min-width: 0; overflow: hidden; }
  #localGigsDock .mat-friendly { width: 100%; min-width: 0; }
  #localGigsDock .mat-dice {
    max-width: 100%;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }
  #match .resources-rival { order: -1; }
  #match .match-bottom-dock #realHand {
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }
}

/* Phones: maintain an Arena-like shallow hand and keep the board as the main
   surface. Controls remain at least 44px on touch devices. */
@media (max-width: 720px) {
  body.match-active > .site-header { flex: 0 0 auto; min-width: 0; }
  body.match-active > .site-header .site-brand { overflow: hidden; }
  body.match-active > main { min-height: 0; }
  #match .match-layout { scrollbar-width: thin; }
  #match .playmat {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-template-rows: auto minmax(190px, 1fr) auto auto auto;
    padding-inline: 4px;
  }
  #match .match-bottom-dock { max-height: 48%; }
  #match #stepTracker { max-height: 136px; }
  #match .match-bottom-dock .hand-area { min-height: 78px; }
  #match .match-bottom-dock #realHand {
    height: 58px;
    flex-basis: 58px;
    padding: 7px 6px 0;
  }
  #match .match-bottom-dock #realHand .game-card {
    flex-basis: 84px;
    width: 84px;
    margin-left: -38px;
  }
  #match .match-bottom-dock #realHand .game-card:first-child { margin-left: 0; }
  #match .match-bottom-dock #realHand .card-art-button { height: 108px; }
  #localGigsDock { padding: 8px 3px 1px; }
  #localGigsDock .mat-dice { min-height: 47px; }
  #match .match-bottom-dock .turn-dock { align-self: stretch; }
  #match .match-bottom-dock .turn-dock button { min-height: 52px; }
}

/* Compact phones: preserve two readable board lanes without allowing labels,
   the hand fan or turn controls to create horizontal page scroll. */
@media (max-width: 430px) {
  body.match-active > .site-header { padding-inline: max(4px, env(safe-area-inset-left, 0px)) max(4px, env(safe-area-inset-right, 0px)); }
  body.match-active > .site-header .site-brand h1 { font-size: clamp(14px, 4.7vw, 18px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #match .playmat { gap-inline: 4px; }
  #match .lane-title .identity-badge strong { max-width: 94px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #match .field-cards .game-card { flex-basis: 116px; width: 116px; }
  #match .match-bottom-dock { grid-template-columns: minmax(0, 1fr) 76px; }
  #match #stepTracker { padding-inline: 4px; }
  #match #stepTracker .tracker-actions button { max-width: 72vw; }
  #localGigsDock .gig-summary { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #match .match-bottom-dock .hand-area .section-title { padding-inline: 5px; }
  #match .match-bottom-dock #realHand { padding-inline: 4px; }
  .hand-card-focus { width: 148px; }
  .hand-card-focus .game-card { width: 148px; }
}

/* Short landscape windows: decision controls stay available while the hand
   collapses to a slim card edge, leaving most height to the playmat. */
@media (max-height: 620px) and (orientation: landscape) {
  body.match-active > .site-header { min-height: 44px; padding-block: 2px; }
  #match .match-bottom-dock { max-height: 42%; }
  #match #stepTracker { max-height: 92px; padding-block: 3px; }
  #match #stepTracker .turn-steps { display: none; }
  #match .match-bottom-dock .hand-area { min-height: 62px; }
  #match .match-bottom-dock #realHand { height: 44px; flex-basis: 44px; padding-top: 5px; }
  #localGigsDock { padding-top: 5px; }
  #localGigsDock .gig-summary { display: none; }
  body.match-active .hand-card-focus { max-height: calc(var(--cg-viewport-height) - 50px); }
}

@media (pointer: coarse) {
  body.match-active button,
  body.match-active summary,
  body.match-active [role='button'] { min-height: 44px; }
  #match .mat-die,
  #match .fixer-die { min-width: 44px; min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  body.match-active *, body.match-active *::before, body.match-active *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Reserve a real viewport band for turn guidance and hand controls. The board
   gets the remaining height and scrolls internally when its zones need it. */
#match .match-layout {
  flex: 1 1 0;
  height: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}
#match .match-bottom-dock {
  flex: 0 0 auto;
  height: clamp(236px, 35vh, 340px);
  max-height: min(52%, 52vh);
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}
@media (max-width: 1099px) {
  #match .match-bottom-dock {
    height: clamp(246px, 40vh, 366px);
    max-height: min(48%, 48vh);
  }
}
@media (max-height: 620px) and (orientation: landscape) {
  #match .match-bottom-dock {
    height: clamp(138px, 42vh, 220px);
    max-height: min(42%, 42vh);
  }
}

/* Phone play is an action console with a board, not a miniature desktop.
   Put the player's crew first, give the hand real reading space, and keep the
   board as the only vertically scrolling surface. */
@media (max-width: 720px) and (orientation: portrait) {
  #match .match-bottom-dock {
    height: clamp(390px, 56vh, 520px);
    max-height: min(60%, 60vh);
    grid-template-columns: minmax(0, 1fr) 92px;
    grid-template-rows: auto auto auto minmax(190px, 1fr);
  }
  #match .playmat {
    grid-template-rows: auto auto auto auto auto;
    grid-template-areas: 'field field field field field field' 'rival rival rival rival rival rival' 'legends legends legends legends legends legends' 'eddies eddies deck deck trash trash' 'opponent opponent opponent opponent opponent opponent';
  }
  #match .mat-field > .mat-content { gap: 6px; }
  #match .field-lane { min-height: 72px; }
  #match .field-lane-own { order: -1; }
  #match .field-lane + .field-lane { padding-top: 6px; }
  #match .lane-title { margin-bottom: 2px; }
  #match .field-cards { padding-block: 2px 4px; }
  #match .field-cards > .mat-empty { display: none; }
  #match .mat-rival { padding-block: 10px 5px; }
  #match #stepTracker { max-height: 124px; }
  #match .match-bottom-dock .hand-area { min-height: 190px; }
  #match .match-bottom-dock #realHand {
    height: 176px;
    flex-basis: 176px;
    gap: 4px;
    padding: 6px 5px 0;
    scroll-snap-type: x proximity;
  }
  #match .match-bottom-dock #realHand .game-card {
    flex-basis: 112px;
    width: 112px;
    margin-left: -10px;
    scroll-snap-align: start;
  }
  #match .match-bottom-dock #realHand .game-card:first-child { margin-left: 0; }
  #match .match-bottom-dock #realHand .card-art-button { height: 156px; }
  #match .match-bottom-dock .turn-dock {
    position: relative;
    top: auto;
    align-self: stretch;
    height: 100%;
    justify-content: flex-end;
  }
  #match #endTurnHint { display: block; font-size: 10px; line-height: 1.2; }
}

/* A short landscape phone has enough width for two surfaces. Keeping the
   board and command console side by side prevents both from collapsing into
   unreadable horizontal slivers. */
@media (max-width: 1099px) and (max-height: 620px) and (orientation: landscape) {
  body.match-active #match:not([hidden]) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 46%);
    grid-template-rows: minmax(0, 1fr);
    gap: 5px;
  }
  #match .match-layout {
    grid-column: 1;
    grid-row: 1;
    width: auto;
    height: auto;
  }
  #match .match-bottom-dock {
    grid-column: 2;
    grid-row: 1;
    width: auto;
    height: auto;
    max-height: none;
    grid-template-columns: minmax(0, 1fr) 82px;
    grid-template-rows: auto auto minmax(126px, 1fr);
    overflow: hidden;
  }
  #match .playmat {
    grid-template-rows: auto auto auto auto auto;
    grid-template-areas: 'field field field field field field' 'rival rival rival rival rival rival' 'legends legends legends legends legends legends' 'eddies eddies deck deck trash trash' 'opponent opponent opponent opponent opponent opponent';
  }
  #match .field-lane { min-height: 64px; }
  #match .field-lane-own { order: -1; }
  #match .field-lane + .field-lane { padding-top: 5px; }
  #match .field-cards > .mat-empty { display: none; }
  #match #stepTracker { max-height: 88px; overflow: hidden; }
  #match.rolling-gig #stepTracker .match-context { display: block; }
  #match #stepTracker .match-context > strong { display: block; font-size: 12px; }
  #localGigsDock { padding-block: 3px 1px; }
  #localGigsDock .mat-dice { min-height: 48px; }
  #match .match-bottom-dock .hand-area { min-height: 126px; }
  #match .match-bottom-dock #realHand { height: 108px; flex-basis: 108px; padding-top: 5px; }
  #match .match-bottom-dock #realHand .game-card { flex-basis: 88px; width: 88px; margin-left: -14px; }
  #match .match-bottom-dock #realHand .game-card:first-child { margin-left: 0; }
  #match .match-bottom-dock #realHand .card-art-button { height: 120px; }
  #match .match-bottom-dock .turn-dock {
    position: relative;
    top: auto;
    align-self: stretch;
    height: 100%;
    justify-content: flex-end;
  }
  #match #endTurnHint { display: block; }
}



/* Phone card commands use the full action column. Opening a card trades some
   hand-rail height for a readable, touch-safe command panel without moving
   End Turn or creating page-level scrolling. */
@media (max-width: 720px) {
  #match .match-bottom-dock.card-command-open {
    grid-template-rows: auto auto auto minmax(92px, 1fr);
  }
  #match .match-bottom-dock.card-command-open .hand-area { min-height: 92px; }
  #match .match-bottom-dock.card-command-open #realHand {
    height: 80px;
    flex-basis: 80px;
  }
  #match .hand-card-focus {
    width: auto;
    min-width: 0;
    max-width: none;
    justify-self: stretch;
  }
  #match .hand-card-focus .game-card { width: 100%; }
}
@media (max-width: 430px) {
  #match .hand-card-focus { width: auto; }
  #match .hand-card-focus .game-card {
    width: 100%;
    grid-template-columns: 64px minmax(0, 1fr);
    column-gap: 6px;
  }
  #match .hand-card-focus .card-art-button,
  #match .hand-card-focus .thumb {
    width: 64px;
    height: 88px;
  }
  #match .hand-card-focus h3 { font-size: 13px; }
}


/* Landscape commands must switch away from the desktop three-column card.
   Otherwise its intrinsic width programmatically scrolls the entire console
   sideways when the selected card receives focus. */
@media (max-width: 1099px) and (max-height: 620px) and (orientation: landscape) {
  #match .match-bottom-dock.card-command-open {
    grid-template-areas: 'tracker turn' 'gigs turn' 'focus turn';
    grid-template-rows: auto auto minmax(0, 1fr);
  }
  #match .match-bottom-dock.card-command-open .hand-area { display: none !important; }
  #match .hand-card-focus {
    box-sizing: border-box;
    display: block !important;
    position: absolute;
    left: 3px;
    right: 3px;
    bottom: 3px;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    max-height: calc(100% - 108px);
    margin: 0;
    padding-top: 14px;
    overflow: auto;
  }
  #match .hand-card-focus .game-card {
    width: 100% !important;
    min-width: 0;
    grid-template-columns: 60px minmax(0, 1fr);
    grid-template-rows: auto auto auto auto;
    column-gap: 6px;
    padding: 5px 90px 5px 5px;
  }
  #match .hand-card-focus .hand-card-close,
  #match .hand-card-focus .hand-card-expand { right: 86px; }
  #match .match-bottom-dock.card-command-open .turn-dock {
    position: relative;
    z-index: 4;
  }
  #match .hand-card-focus .card-art-button,
  #match .hand-card-focus .thumb {
    width: 60px;
    height: 78px;
  }
  #match .hand-card-focus h3 { font-size: 13px; }
  #match .hand-card-focus .mini-actions {
    grid-column: 1 / 3;
    grid-row: 4;
    margin-top: 4px;
  }
}


/* Portrait uses the same contained command-surface contract. Keeping the
   selected card out of the dock grid prevents focus scrolling the whole dock
   sideways while preserving the permanent End Turn rail. */
@media (max-width: 720px) and (orientation: portrait) {
  #match .match-bottom-dock.card-command-open { overflow: hidden; }
  #match .match-bottom-dock.card-command-open .hand-area { display: none !important; }
  #match .match-bottom-dock.card-command-open .turn-dock {
    position: relative;
    z-index: 4;
  }
  #match .hand-card-focus {
    box-sizing: border-box;
    display: block !important;
    position: absolute;
    left: 3px;
    right: 95px;
    bottom: 3px;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    max-height: calc(100% - 142px);
    margin: 0;
    padding-top: 14px;
    overflow: auto;
  }
  #match .hand-card-focus .game-card {
    width: 100% !important;
    min-width: 0;
  }
}


/* Portrait phones use one purposeful surface at a time. The board and action
   console each receive the full remaining viewport instead of becoming two
   cramped, independently scrolling miniature pages. */
.mobile-match-nav { display: none; }
@media (max-width: 720px) and (orientation: portrait) {
  #match .mobile-match-nav {
    display: grid;
    flex: 0 0 48px;
    grid-template-columns: minmax(0, 1fr) 76px 84px;
    align-items: stretch;
    gap: 3px;
    min-width: 0;
    padding: 2px;
    border: 1px solid #31505a;
    border-radius: 5px;
    background: #071019;
  }
  #match .mobile-match-status {
    display: flex;
    min-width: 0;
    flex-direction: column;
    justify-content: center;
    padding: 2px 6px;
    overflow: hidden;
  }
  #match .mobile-match-status strong,
  #match .mobile-match-status small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  #match .mobile-match-status strong {
    color: #e9ef25;
    font-size: 11px;
    letter-spacing: .08em;
  }
  #match .mobile-match-status small { color: #9fb7bd; font-size: 10px; }
  #match .mobile-match-nav button {
    min-width: 0;
    min-height: 44px;
    padding: 5px 7px;
    border-color: #31505a;
    background: #0b1820;
    color: #b9cbd0;
    font-size: 12px;
  }
  #match .mobile-match-nav button.active,
  #match .mobile-match-nav button[aria-pressed='true'] {
    border-color: #e9ef25;
    background: #e9ef25;
    color: #101500;
    box-shadow: none;
  }

  #match[data-mobile-view='actions'] .match-layout { display: none; }
  #match[data-mobile-view='actions'] .match-bottom-dock {
    display: grid;
    flex: 1 1 0;
    width: 100%;
    height: auto;
    max-height: none;
    grid-template-columns: minmax(0, 1fr) 92px;
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas: 'tracker tracker' 'gigs turn' 'hand turn';
    overflow: hidden;
  }
  #match[data-mobile-view='actions'] #stepTracker {
    max-height: 160px;
    overflow: auto;
    overscroll-behavior: contain;
  }
  #match[data-mobile-view='actions'] #localGigsDock {
    min-height: 58px;
    overflow-x: auto;
    overflow-y: hidden;
  }
  #match[data-mobile-view='actions'] .hand-area {
    min-height: 0;
    height: 100%;
    overflow: hidden;
  }
  #match[data-mobile-view='actions'] #realHand {
    height: 100%;
    min-height: 190px;
    flex-basis: auto;
    align-items: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
  }
  #match[data-mobile-view='actions'] .turn-dock {
    min-height: 0;
    height: 100%;
    align-self: stretch;
  }

  #match[data-mobile-view='board'] .match-layout {
    display: block;
    flex: 1 1 0;
    height: auto;
    min-height: 0;
  }
  #match[data-mobile-view='board'] .match-bottom-dock {
    display: grid;
    flex: 0 0 68px;
    width: 100%;
    height: 68px;
    max-height: 68px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    grid-template-areas: 'turn';
    overflow: hidden;
  }
  #match[data-mobile-view='board'] #stepTracker,
  #match[data-mobile-view='board'] #localGigsDock,
  #match[data-mobile-view='board'] .hand-area,
  #match[data-mobile-view='board'] .hand-card-focus { display: none !important; }
  #match[data-mobile-view='board'] .turn-dock {
    display: grid;
    grid-template-columns: auto minmax(132px, 42%) minmax(0, 1fr);
    align-items: center;
    gap: 7px;
    width: 100%;
    height: 100%;
    padding: 5px 7px !important;
  }
  #match[data-mobile-view='board'] .turn-dock button {
    min-height: 48px;
    margin: 0;
  }
  #match[data-mobile-view='board'] #endTurnHint {
    display: block;
    min-width: 0;
    margin: 0;
    font-size: 10px;
    line-height: 1.2;
    text-align: left;
  }
}


/* The portrait action surface ends with a horizontal turn bar. This removes
   the empty vertical rail and gives the hand and card commands the full width. */
@media (max-width: 720px) and (orientation: portrait) {
  #match[data-mobile-view='actions'] .match-bottom-dock {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr) 68px;
    grid-template-areas: 'tracker' 'gigs' 'hand' 'turn';
  }
  #match[data-mobile-view='actions'] .turn-dock {
    display: grid;
    grid-template-columns: auto minmax(132px, 42%) minmax(0, 1fr);
    align-items: center;
    gap: 7px;
    width: 100%;
    height: 68px;
    padding: 5px 7px !important;
  }
  #match[data-mobile-view='actions'] .turn-dock button {
    min-height: 48px;
    margin: 0;
  }
  #match[data-mobile-view='actions'] #endTurnHint {
    display: block;
    min-width: 0;
    margin: 0;
    font-size: 10px;
    line-height: 1.2;
    text-align: left;
  }
  #match[data-mobile-view='actions'] .match-bottom-dock.card-command-open .hand-card-focus {
    left: 3px;
    right: 3px;
    bottom: 71px;
    max-height: calc(100% - 214px);
  }
}


/* Hearthstone-style phone contract: portrait is an orientation gate for
   touch-first phones; narrow mouse-driven windows keep the contained board. */
.mobile-landscape-gate { display: none; }
@media (max-width: 720px) and (orientation: portrait) and (pointer: coarse) {
  body.match-active #match:not([hidden]) { position: relative; }
  #match .mobile-match-nav { display: none !important; }
  #match .mobile-landscape-gate {
    position: absolute;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: max(24px, env(safe-area-inset-top, 0px)) max(24px, env(safe-area-inset-right, 0px)) max(24px, env(safe-area-inset-bottom, 0px)) max(24px, env(safe-area-inset-left, 0px));
    border: 1px solid #e9ef25;
    border-radius: 6px;
    background:
      linear-gradient(135deg, #071019f7, #0b1720f7),
      repeating-linear-gradient(0deg, transparent 0 7px, #e9ef2508 8px);
    text-align: center;
  }
  #match .mobile-landscape-gate h2 {
    margin: 0;
    color: #e9ef25;
    font-size: clamp(28px, 9vw, 42px);
    line-height: 1;
    text-transform: uppercase;
  }
  #match .mobile-landscape-gate p {
    max-width: 34ch;
    margin: 0;
    color: #d5e2e5;
    font-size: 15px;
    line-height: 1.45;
  }
  #match .mobile-landscape-gate button {
    width: min(280px, 100%);
    min-height: 52px;
  }
  #match .mobile-landscape-gate small {
    max-width: 38ch;
    color: #91a7ad;
    line-height: 1.35;
  }
  #match .match-layout,
  #match .match-bottom-dock { visibility: hidden; pointer-events: none; }
}

/* Phones in landscape keep the board mounted at all times. Guidance, Gigs,
   hand, selected-card commands and End Turn sit around its edges as a HUD. */
@media (max-width: 1099px) and (max-height: 620px) and (orientation: landscape) {
  body.match-active #match:not([hidden]) {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0;
  }
  #match .mobile-match-nav,
  #match .mobile-landscape-gate { display: none !important; }

  #match .match-layout {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
    scrollbar-gutter: auto;
  }
  #match #board,
  #match .playmat { width: 100%; height: 100%; min-height: 0; }
  #match .playmat {
    grid-template-columns: 112px minmax(0, 1fr) minmax(0, 1fr) 112px;
    grid-template-rows: 64px minmax(0, 1fr);
    grid-template-areas: 'opponent rival rival player' 'opponent field field player';
    gap: 6px;
    padding: 76px 4px 104px;
    overflow: hidden;
  }
  #match .resources-own {
    grid-area: player;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: minmax(70px, 1fr) auto auto;
    grid-template-areas: 'legends legends' 'eddies eddies' 'deck trash';
    gap: 7px 3px;
  }
  #match .resources-rival {
    grid-area: opponent;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto minmax(70px, 1fr) auto auto;
    grid-template-areas: 'fixer fixer' 'legends legends' 'eddies eddies' 'deck trash';
    gap: 7px 3px;
  }
  #match .resources-own > .mat-fixer { display: none !important; }
  #match .mat-rival { grid-area: rival; }
  #match .mat-field { grid-area: field; }
  #match .mat-zone { padding: 10px 4px 4px; }
  #match .mat-label { font-size: 9px; }
  #match .player-resources .mat-content { gap: 3px; }
  #match .mat-legend-slot { min-width: 0; }
  #match .legend-art,
  #match .legend-back { max-height: 64px; object-fit: contain; }
  #match .mat-eddie-stack { min-height: 42px; }
  #match .field-lane { min-height: 0; padding: 4px; }
  #match .field-lane-rival { order: 0; }
  #match .field-lane-own { order: 1; }
  #match .field-lane + .field-lane { padding-top: 4px; }
  #match .lane-title { margin-bottom: 2px; }
  #match .lane-title > span { flex-basis: auto; }
  #match .field-cards {
    min-height: 58px;
    padding: 2px;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
  }
  #match .field-cards .game-card {
    flex: 0 0 104px;
    width: 104px;
  }
  #match .field-cards .card-art-button { height: 68px; }
  #match .field-cards .mini-actions button { min-height: 44px; }

  #match .match-bottom-dock {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    max-height: none;
    padding: 0;
    overflow: visible;
    background: transparent;
    border: 0;
    pointer-events: none;
    z-index: 45;
  }
  #match .match-bottom-dock > * { pointer-events: auto; }

  #match #stepTracker {
    position: absolute;
    top: 3px;
    left: 3px;
    right: 340px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: 'context actions';
    align-items: center;
    gap: 6px;
    width: auto;
    height: 68px;
    max-height: 68px;
    padding: 5px 7px;
    overflow: hidden;
    border: 1px solid #31505a;
    background: #071019f2;
  }
  #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;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  #match #stepTracker .match-context > small {
    display: block;
    max-width: 48ch;
    overflow: hidden;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  #match #stepTracker .context-result,
  #match #stepTracker .context-sync { display: none !important; }
  #match #stepTracker .tracker-actions {
    grid-area: actions;
    display: flex;
    max-width: 220px;
    overflow-x: auto;
  }
  #match #stepTracker .tracker-actions button {
    flex: 0 0 auto;
    min-height: 44px;
    max-width: 180px;
  }

  #match #localGigsDock {
    position: absolute;
    top: 3px;
    right: 3px;
    display: block;
    width: 332px;
    height: 68px;
    padding: 0;
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid #88931f;
    background: #10170cf2;
  }
  #match #localGigsDock .mat-zone {
    width: 100%;
    height: 100%;
    padding: 12px 4px 2px;
    border: 0;
  }
  #match #localGigsDock .gig-summary { display: none; }
  #match #localGigsDock .mat-dice {
    min-height: 48px;
    flex-wrap: nowrap;
    justify-content: center;
  }
  #match #localGigsDock .mat-die,
  #match #localGigsDock .fixer-die {
    flex: 0 0 44px;
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
  }

  #match .match-bottom-dock .hand-area {
    position: absolute;
    left: 100px;
    right: 100px;
    bottom: 0;
    display: block;
    width: auto;
    height: 98px;
    min-height: 98px;
    padding: 2px 4px 0;
    overflow: hidden;
    border: 1px solid #31505a;
    background: linear-gradient(180deg, #071019e8, #050a0ff8);
  }
  #match .match-bottom-dock .hand-area .section-title {
    position: relative;
    z-index: 2;
    height: 22px;
    padding: 2px 5px;
  }
  #match .match-bottom-dock #realHand {
    height: 76px;
    min-height: 76px;
    padding: 2px 5px 0;
    overflow-x: auto;
    overflow-y: hidden;
    justify-content: safe center;
  }
  #match .match-bottom-dock #realHand .game-card {
    flex: 0 0 92px;
    width: 92px;
    margin-left: -16px;
  }
  #match .match-bottom-dock #realHand .game-card:first-child { margin-left: 0; }
  #match .match-bottom-dock #realHand .card-art-button { height: 118px; }

  #match .match-bottom-dock .turn-dock {
    position: absolute;
    right: 3px;
    bottom: 3px;
    display: flex;
    width: 94px;
    height: 112px;
    min-height: 0;
    padding: 5px !important;
    justify-content: flex-end;
    background: #10170cf2;
    border: 1px solid #88931f;
  }
  #match .match-bottom-dock .turn-dock button {
    width: 100%;
    min-height: 54px;
  }
  #match #endTurnHint {
    display: block;
    font-size: 9px;
    line-height: 1.15;
  }

  #match .match-bottom-dock.card-command-open .hand-area { display: none !important; }
  #match .match-bottom-dock.card-command-open .hand-card-focus {
    position: absolute;
    left: 100px;
    right: 102px;
    bottom: 3px;
    display: block !important;
    width: auto !important;
    max-width: none !important;
    max-height: 164px;
    margin: 0;
    padding: 15px 0 0;
    overflow: auto;
    pointer-events: auto;
  }
  #match .match-bottom-dock.card-command-open .hand-card-focus .game-card {
    width: 100% !important;
    min-width: 0;
    grid-template-columns: 68px minmax(0, 1fr) minmax(150px, 210px);
    padding-right: 50px;
  }
  #match .match-bottom-dock.card-command-open .hand-card-focus .card-art-button,
  #match .match-bottom-dock.card-command-open .hand-card-focus .thumb {
    width: 68px;
    height: 92px;
  }
  #match .match-bottom-dock.card-command-open .hand-card-focus .mini-actions {
    grid-column: 3;
    grid-row: 1 / 4;
  }
  #match .match-bottom-dock.card-command-open .hand-card-focus .hand-card-close,
  #match .match-bottom-dock.card-command-open .hand-card-focus .hand-card-expand { right: 4px; }
}


/* Final landscape compression: both combat rows remain visible above the hand,
   while rival bookkeeping collapses to the information needed during play. */
@media (max-width: 1099px) and (max-height: 620px) and (orientation: landscape) {
  #match .playmat {
    grid-template-columns: 124px minmax(0, 1fr) minmax(0, 1fr) 124px;
    grid-template-rows: 42px minmax(0, 1fr);
  }
  #match .resources-rival {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(68px, 1fr) auto;
    grid-template-areas: 'legends' 'deck';
  }
  #match .resources-rival > .mat-fixer,
  #match .resources-rival > .mat-eddies,
  #match .resources-rival > .mat-trash { display: none !important; }
  #match .resources-rival > .mat-deck { grid-area: deck; }
  #match .resources-rival > .mat-legends { grid-area: legends; }

  #match .mat-field > .mat-content {
    display: grid;
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 2px;
    height: 100%;
    min-height: 0;
  }
  #match .field-lane {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    height: auto;
    min-height: 0;
    overflow: hidden;
  }
  #match .field-lane + .field-lane {
    margin: 0;
    padding-top: 2px;
    border-top-width: 1px;
  }
  #match .lane-title {
    min-height: 25px;
    flex-wrap: nowrap;
    gap: 4px;
    margin: 0;
  }
  #match .lane-title .identity-badge { gap: 3px; }
  #match .lane-title .identity-badge strong { font-size: 10px; }
  #match .lane-title > span:not(.lane-turn-state) { display: none; }
  #match .lane-turn-state {
    margin-left: auto;
    font-size: 8px;
    white-space: nowrap;
  }
  #match .field-cards {
    min-height: 0;
    height: 100%;
    align-items: flex-start;
  }
  #match .field-cards .game-card {
    flex-basis: 92px;
    width: 92px;
    max-height: 58px;
    overflow: hidden;
  }
  #match .field-cards .card-art-button { height: 52px; }

  #match .player-resources .mat-label {
    max-width: calc(100% - 4px);
    padding-inline: 3px;
    overflow: hidden;
    font-size: 7px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  #match .player-resources .mat-deck .mat-content,
  #match .player-resources .mat-trash .mat-content { font-size: 8px; }
}


/* Digital-first battlefield: the screen is a game HUD, not a miniature table. */
body.match-active {
  --rival-signal: #ff604f;
  --player-signal: #35d9ff;
  --neutral-signal: #8da0a7;
  --command-signal: #f2d258;
}
#match .match-layout,
#match #board,
#match .playmat { overflow: hidden; }
#match #board {
  position: relative;
  height: 100%;
  min-height: 0;
  border: 1px solid #243c45;
  border-radius: 7px;
  background:
    radial-gradient(circle at 50% 50%, #15303a55 0 1px, transparent 2px),
    linear-gradient(90deg, transparent 49.85%, #45606a33 50%, transparent 50.15%),
    repeating-linear-gradient(0deg, transparent 0 39px, #45606a0d 40px),
    repeating-linear-gradient(90deg, transparent 0 59px, #45606a0d 60px),
    #071016;
}
#match #board::before,
#match #board::after {
  content: '';
  position: absolute;
  z-index: 0;
  left: 8%;
  right: 8%;
  height: 1px;
  pointer-events: none;
}
#match #board::before {
  top: 17%;
  background: linear-gradient(90deg, transparent, var(--rival-signal), transparent);
  box-shadow: 0 0 12px var(--rival-signal);
}
#match #board::after {
  bottom: 18%;
  background: linear-gradient(90deg, transparent, var(--player-signal), transparent);
  box-shadow: 0 0 12px var(--player-signal);
}
#match .mat-heading { display: none; }
#match .playmat {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(240px, 38%) minmax(0, 1fr);
  grid-template-rows: minmax(96px, 17%) minmax(0, 1fr) minmax(104px, 18%);
  grid-template-areas:
    'opponent rival'
    'field field'
    'player friendly';
  gap: 4px 8px;
  height: 100%;
  min-height: 0;
  padding: 4px;
  background: transparent;
}
#match .mat-rival { grid-area: rival; }
#match .mat-friendly { grid-area: friendly; }
#match .mat-field { grid-area: field; }
#match .resources-rival { grid-area: opponent; }
#match .resources-own { grid-area: player; }
#match .mat-rival,
#match .mat-friendly,
#match .player-resources {
  position: relative;
  min-height: 0;
  border: 1px solid #29414a;
  border-radius: 5px;
  background: linear-gradient(135deg, #09141cf2, #050b10f2);
}
#match .mat-rival { border-color: #71332d; box-shadow: inset 0 -2px #ff604f55; }
#match .mat-friendly { border-color: #1e6072; box-shadow: inset 0 2px #35d9ff55; }
#match .mat-rival .mat-label,
#match .mat-friendly .mat-label { color: #c7d3d6; }
#match .mat-rival .mat-dice,
#match .mat-friendly .mat-dice {
  flex-wrap: nowrap;
  justify-content: center;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
}
#match .mat-rival .mat-die { border-color: var(--rival-signal); filter: drop-shadow(0 0 5px #ff604f55); }
#match .mat-friendly .mat-die { border-color: var(--player-signal); filter: drop-shadow(0 0 5px #35d9ff55); }
#match .player-resources {
  display: grid;
  grid-template-columns: minmax(88px, .8fr) minmax(160px, 1.5fr) minmax(110px, 1fr) minmax(76px, .65fr) minmax(62px, .5fr) minmax(62px, .5fr);
  grid-template-areas: 'hub legends fixer eddies deck trash';
  gap: 4px;
  padding: 4px;
}
#match .player-hub {
  grid-area: hub;
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 1px solid currentColor;
  border-radius: 50% 12% 50% 12%;
  color: var(--neutral-signal);
  background: #071119e8;
  box-shadow: 0 0 14px currentColor;
}
#match .resources-rival .player-hub { color: var(--rival-signal); }
#match .resources-own .player-hub { color: var(--player-signal); }
#match .player-hub .identity-badge { min-width: 0; }
#match .player-hub .identity-badge > .portrait-image { width: 38px; height: 46px; }
#match .player-hub .identity-badge strong {
  max-width: 90px;
  overflow: hidden;
  color: #eaf4f6;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#match .player-hub-stats {
  max-width: 100%;
  overflow: hidden;
  color: #a9bcc1;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#match .player-resources > .mat-fixer { grid-area: fixer; }
#match .player-resources > .mat-legends { grid-area: legends; }
#match .player-resources > .mat-eddies { grid-area: eddies; }
#match .player-resources > .mat-deck { grid-area: deck; }
#match .player-resources > .mat-trash { grid-area: trash; }
#match .player-resources .mat-zone {
  min-height: 0;
  padding: 12px 3px 3px;
  border-color: #263f48;
  background: #08131acc;
}
#match .resources-rival .mat-zone { border-color: #59332f; }
#match .resources-own .mat-zone { border-color: #205467; }
#match .player-resources .mat-fixer .mat-content {
  display: grid;
  grid-template-columns: repeat(3, minmax(36px, 1fr));
  gap: 3px;
}
#match .player-resources .fixer-die {
  width: 100%;
  min-width: 36px;
  min-height: 40px;
  padding: 2px;
}
#match .player-resources .fixer-die svg { width: 20px; height: 20px; }
#match .player-resources .fixer-die span { display: none; }
#match .player-resources .mat-legend-slots { height: 100%; }
#match .player-resources .mat-legend-slot {
  min-width: 0;
  border-color: #735f28;
  background: #141207cc;
}
#match .player-resources .legend-art,
#match .player-resources .legend-back { max-height: 58px; }
#match .player-resources .legend-name,
#match .player-resources .legend-state { font-size: 8px; }
#match .player-resources .mat-call { min-height: 40px; font-size: 10px; }
#match .player-resources .mat-eddies .mat-empty,
#match .player-resources .eddie-cards,
#match .player-resources .removed-link { display: none; }
#match .player-resources .bank-total {
  display: grid;
  height: 100%;
  place-content: center;
  margin: 0;
  color: #b9c9cd;
  text-align: center;
}
#match .player-resources .bank-total strong { color: var(--command-signal); font-size: 24px; }
#match .player-resources .deck-back,
#match .player-resources .trash-pile {
  height: 100%;
  min-height: 42px;
}
#match .player-resources .deck-back .card-back-visual,
#match .player-resources .trash-pile .card-art { display: none; }
#match .player-resources .back-caption,
#match .player-resources .pile-count {
  position: static;
  display: grid;
  height: 100%;
  place-content: center;
  padding: 2px;
  font-size: 10px;
  text-align: center;
}
#match .mat-field {
  position: relative;
  min-height: 0;
  padding: 14px 10px 6px;
  border: 1px solid #2a414a;
  background:
    linear-gradient(90deg, transparent 0 49.8%, #6f858d22 50%, transparent 50.2%),
    radial-gradient(ellipse at center, #15313a4d, transparent 67%);
}
#match .mat-field > .mat-content {
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  height: 100%;
  min-height: 0;
  gap: 3px;
}
#match .field-lane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  padding: 3px;
}
#match .field-lane-rival { border-bottom: 1px solid #ff604f42; }
#match .field-lane-own { border-top: 1px solid #35d9ff42; }
#match .field-lane + .field-lane { margin: 0; padding-top: 3px; }
#match .lane-title {
  min-height: 27px;
  flex-wrap: nowrap;
  margin: 0;
}
#match .lane-title .identity-badge { display: none; }
#match .lane-title h3 { font-size: 11px; letter-spacing: .13em; }
#match .lane-title > span:not(.lane-turn-state) {
  min-width: 0;
  overflow: hidden;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#match .lane-turn-state {
  margin-left: auto;
  font-size: 8px;
  white-space: nowrap;
}
#match .field-cards {
  min-height: 0;
  height: 100%;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  overflow-x: auto;
  overflow-y: hidden;
  gap: clamp(5px, 1vw, 12px);
  padding: 2px 4px;
}
#match .field-cards .game-card {
  flex: 0 0 clamp(96px, 10vw, 132px);
  width: clamp(96px, 10vw, 132px);
  max-height: 100%;
  overflow: auto;
  scrollbar-width: thin;
}
#match .field-cards .card-art-button { height: clamp(62px, 9vh, 108px); }
#match .match-bottom-dock {
  height: clamp(154px, 22vh, 220px);
  max-height: 30vh;
  overflow: hidden;
  border: 1px solid #263f48;
  border-radius: 6px;
  background: linear-gradient(180deg, #071119f2, #03070bf8);
}
#match #stepTracker {
  max-height: 60px;
  overflow: hidden;
}
#match .match-bottom-dock .hand-area { min-height: 88px; }
#match .match-bottom-dock #realHand { height: 84px; flex-basis: 84px; }
#match .match-bottom-dock #realHand .card-art-button { height: 126px; }
#match .turn-dock {
  border-left: 1px solid #6c5b24;
  background: linear-gradient(135deg, #171307, #080b0d);
}

/* At phone/tablet scale, keep the same battlefield hierarchy and discard
   miniature bookkeeping. Critical actions remain edge-mounted and touch safe. */
@media (max-width: 1099px) {
  #match .player-hub { border-radius: 50%; }
  #match .player-hub-stats { display: none; }
}
@media (max-width: 1099px) and (max-height: 620px) and (orientation: landscape) {
  #match #board::before { top: 19%; }
  #match #board::after { bottom: 26%; }
  #match .playmat {
    display: block;
    height: 100%;
    padding: 0;
  }
  #match .mat-rival {
    position: absolute;
    top: 3px;
    left: 208px;
    right: 122px;
    width: auto;
    height: 56px;
    padding: 10px 3px 2px;
    overflow: hidden;
  }
  #match .mat-rival .gig-summary { display: none; }
  #match .mat-rival .mat-dice {
    min-height: 42px;
    padding: 0 3px;
  }
  #match .mat-rival .mat-die {
    flex: 0 0 44px;
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
  }
  #match .mat-field {
    position: absolute;
    inset: 62px 3px 101px;
    width: auto;
    height: auto;
    padding: 10px 3px 3px;
  }
  #match .field-cards .game-card {
    flex-basis: 94px;
    width: 94px;
    max-height: 68px;
  }
  #match .field-cards .card-art-button { height: 60px; }
  #match .field-cards .game-card h3,
  #match .field-cards .game-card .card-meta,
  #match .field-cards .game-card .status,
  #match .field-cards .game-card .mini-actions { display: none; }
  #match .resources-rival {
    position: absolute;
    top: 3px;
    right: 3px;
    display: grid !important;
    width: 116px;
    height: 56px;
    grid-template-columns: 58px 27px 27px;
    grid-template-areas: 'hub deck trash';
    gap: 2px;
    padding: 2px;
  }
  #match .resources-rival > .mat-fixer,
  #match .resources-rival > .mat-legends,
  #match .resources-rival > .mat-eddies { display: none !important; }
  #match .resources-rival .player-hub { min-height: 0; }
  #match .resources-rival .player-hub .identity-badge > .portrait-image { width: 26px; height: 30px; }
  #match .resources-rival .player-hub .identity-badge strong { display: none; }
  #match .resources-rival .mat-deck,
  #match .resources-rival .mat-trash { padding: 9px 1px 1px; }
  #match .resources-rival .mat-label { font-size: 6px; }
  #match .resources-rival .back-caption,
  #match .resources-rival .pile-count { font-size: 7px; }
  #match .resources-own {
    position: absolute;
    left: 3px;
    bottom: 3px;
    display: grid !important;
    width: 96px;
    height: 96px;
    grid-template-columns: 46px 23px 23px;
    grid-template-rows: 48px 44px;
    grid-template-areas: 'hub hub hub' 'eddies deck trash';
    gap: 2px;
    padding: 2px;
    z-index: 2;
  }
  #match .resources-own > .mat-fixer,
  #match .resources-own > .mat-legends { display: none !important; }
  #match .resources-own .player-hub .identity-badge > .portrait-image { width: 26px; height: 30px; }
  #match .resources-own .player-hub .identity-badge strong { font-size: 8px; max-width: 48px; }
  #match .resources-own .mat-zone { padding: 8px 1px 1px; }
  #match .resources-own .mat-label { font-size: 6px; }
  #match .resources-own .bank-total strong { font-size: 15px; }
  #match .resources-own .bank-total,
  #match .resources-own .back-caption,
  #match .resources-own .pile-count { font-size: 7px; }
  #match #stepTracker {
    top: 3px;
    left: 3px;
    right: auto;
    width: 202px;
    height: 56px;
    max-height: 56px;
  }
  #match #stepTracker .tracker-actions { max-width: 82px; }
  #match #stepTracker .tracker-actions button { max-width: 82px; padding-inline: 5px; }
  #match #localGigsDock {
    top: auto;
    right: 99px;
    bottom: 3px;
    width: 108px;
    height: 96px;
  }
  #match #localGigsDock .mat-zone { padding-top: 11px; }
  #match #localGigsDock .mat-dice {
    align-content: flex-start;
    justify-content: flex-start;
    min-height: 80px;
    padding: 2px;
  }
  #match #localGigsDock .mat-die,
  #match #localGigsDock .fixer-die {
    flex-basis: 44px;
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
  }
  #match .match-bottom-dock .hand-area {
    left: 210px;
    right: 100px;
    height: 98px;
    min-height: 98px;
  }
  #match .match-bottom-dock #realHand {
    height: 76px;
    min-height: 76px;
  }
  #match .match-bottom-dock #realHand .game-card {
    flex-basis: 92px;
    width: 92px;
  }
  #match .match-bottom-dock #realHand .card-art-button { height: 118px; }
  #match .match-bottom-dock.card-command-open .hand-card-focus {
    left: 210px;
    right: 102px;
  }
  #match .match-bottom-dock .turn-dock {
    width: 94px;
    height: 96px;
  }
}

/* Taller phones and tablets keep a contained console; the full board remains
   scroll-free and cards scroll only within their own horizontal rows. */
@media (max-width: 1099px) and (min-height: 621px) {
  #match .player-resources {
    grid-template-columns: minmax(76px, .7fr) minmax(150px, 1.4fr) minmax(100px, 1fr) minmax(68px, .6fr) 58px 58px;
  }
  #match .match-layout { overflow: hidden; }
}


/* Digital-grid inheritance fixes discovered by rendered viewport review. */
#match .match-layout {
  display: block;
  width: 100%;
}
#match .match-coach { display: none !important; }
#match #board { width: 100%; }
@media (max-width: 1099px) and (max-height: 620px) and (orientation: landscape) {
  #match .match-bottom-dock {
    inset: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    border: 0;
    background: transparent;
  }
}


/* Desktop uses explicit HUD bands so legacy grid tracks cannot reserve an
   invisible coach column. */
@media (min-width: 1100px) {
  #match .playmat {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
  }
  #match .resources-rival,
  #match .resources-own {
    position: absolute;
    left: 4px;
    display: grid;
    width: calc(48% - 8px);
    height: 108px;
  }
  #match .resources-rival { top: 4px; }
  #match .resources-own { bottom: 4px; }
  #match .mat-rival,
  #match .mat-friendly {
    position: absolute;
    left: 48%;
    right: 4px;
    width: auto;
    height: 108px;
  }
  #match .mat-rival { top: 4px; }
  #match .mat-friendly { bottom: 4px; }
  #match .mat-field {
    position: absolute;
    inset: 116px 4px 116px;
    width: auto;
    height: auto;
  }
}


/* Tiny HUD counters carry their meaning through accessible region labels; hide
   decorative tags that collide with the numeric values on short phones. */
@media (max-width: 1099px) and (max-height: 620px) and (orientation: landscape) {
  #match .resources-own .mat-label,
  #match .resources-rival .mat-label { display: none; }
  #match .resources-own .mat-zone,
  #match .resources-rival .mat-zone { padding: 1px; }
}
