/* Offers may use the felt under this noninteractive status strip. */
body[data-screen="game"] .table-game.game-mona .feedback-rail { pointer-events: none; }

/* One centred reveal and a generous drop surface, clear of every seat. */
body[data-screen="game"] .game-mona .mona-table { display: grid; grid-template-rows: minmax(0, 1fr); width: 100%; }
body[data-screen="game"] .game-mona .mona-layout { display: grid; grid-template-columns: minmax(0, 1fr); margin: 0; min-height: 0; }
body[data-screen="game"] .game-mona .mona-discarded { position: relative; display: grid; place-items: center; border: 0; padding: 0; min-height: 0; }
body[data-screen="game"] .game-mona .mona-pair { display: flex; align-items: center; justify-content: center; min-height: 0; gap: 0; pointer-events: none; }
body[data-screen="game"] .game-mona .mona-card { width: clamp(48px, 18cqw, 96px); }
.game-mona .mona-pair .mona-card:first-child { transform: rotate(-5deg); }
.game-mona .mona-pair .mona-card + .mona-card { margin-left: -24px; transform: rotate(5deg); }
body[data-screen="game"] .game-mona .mona-pair-target {
  position: absolute; inset: 6px; width: calc(100% - 12px); height: calc(100% - 12px);
  padding: 0; border: 0; box-shadow: none; background: transparent; border-radius: 12px;
}
.game-mona .mona-pair-target:focus-visible, .game-mona .mona-pair-target.placement-over { outline: 2px dashed var(--pop-paper); outline-offset: -2px; }

body[data-screen="game"] .game-mona .beside-hand-action {
  position: static; grid-area: 1 / 2; justify-self: end; align-self: start; width: max-content;
  min-height: 44px; padding: 8px 14px; font-size: 20px;
}
@media (max-width: 700px), (max-height: 500px) {
  body[data-screen="game"] .game-mona .beside-hand-action { font-size: 18px; padding-inline: 10px; }
}
@media (min-width: 701px) and (min-height: 501px) and (max-height: 850px) {
  body[data-screen="game"] .table-game.game-mona:has(.opponents[data-crowded="true"]) { --seat-avatar: 44px; --seat-name: 22px; --hand-card: 90px; }
  body[data-screen="game"] .table-game.game-mona .game:has(> .opponents[data-crowded="true"]) { --seat-back: 40px; --seat-label: 50px; }
}
/* A chosen neighbour offers their hand beside their seat. On small tables
   it must not cover another player's pile or portrait. */
@media (max-width: 700px), (max-height: 500px) {
  body[data-screen="game"] .game-mona .opponents .hand-offered .mini-hand {
    --back-width: 44px; --seat-depth: calc(44px * 156 / 110 + 8px);
    --seat-fan: min(200px, 60cqw, 60cqh);
  }
  body[data-screen="game"] .game-mona .opponents .hand-offered[data-edge="top"] .mini-hand {
    --seat-fan: min(160px, 42cqw, 48cqh);
  }
}

/* The offered position is measured from its owner, not from the table centre. */
body[data-screen="game"] .game-mona .opponents .opponent.hand-offered .mini-hand,
body[data-screen="game"] .game-mona #hand .own-offered-fan {
  left: var(--offer-x, 50%); top: var(--offer-y, 50%); right: auto;
  transform: translate(-50%, -50%) rotate(var(--offer-angle, 0deg));
}
body[data-screen="game"] .game-mona #hand.hand-offered { translate: none; overflow: visible; }
body[data-screen="game"] .game-mona #hand .own-offered-fan {
  position: absolute; width: min(240px, 60vw); height: 90px; --back-width: 56px;
  transition: left 240ms ease, top 240ms ease, transform 320ms ease;
}
body[data-screen="game"] .game-mona .opponents .opponent.hand-offered .mini-hand,
body[data-screen="game"] .game-mona #hand .own-offered-fan {
  width: max(calc(var(--back-width) + 12px + (var(--back-count) - 1) * 6px),
    min(var(--offer-span, 240px), var(--seat-fan, min(240px, 60vw)),
      calc((var(--back-count) - 1) * var(--back-width) * .72 + var(--back-width) + 12px)));
  height: calc(var(--back-width) * 156 / 110 + 8px);
}
body[data-screen="game"] .game-mona .hand-offered .card-back { transition: transform 140ms ease; }
body[data-screen="game"] .game-mona .hand-offered button.card-back:focus-visible {
  transform: translateX(-50%) rotate(var(--back-angle)) translateY(-12px); z-index: 2;
}
@media (hover: hover) {
  body[data-screen="game"] .game-mona .hand-offered button.card-back:hover:not(:disabled) {
    transform: translateX(-50%) rotate(var(--back-angle)) translateY(-12px); z-index: 3;
  }
  /* Keep the original bottom edge hittable while its card is lifted. */
  body[data-screen="game"] .game-mona .hand-offered button.card-back:hover:not(:disabled)::after {
    content: ""; position: absolute; inset: 0 0 -14px;
  }
}
body[data-screen=game] .game-mona .opponents .mini-hand {
  transition: top 240ms ease, left 240ms ease, right 240ms ease, transform 320ms ease;
}
@media (prefers-reduced-motion: reduce) {
  body[data-screen=game] .game-mona .opponents .mini-hand,
  body[data-screen=game] .game-mona #hand .own-offered-fan,
  body[data-screen=game] .game-mona .hand-offered .card-back { transition: none; }
}

/* Keep earned letters in the identity slot even when a long name must truncate. */
body[data-screen="game"] .game-mona .opponents .opponent .opponent-detail:has(.seat-detail) {
  display: flex; flex-direction: column; align-items: start;
}
.game-mona .opponent-detail .seat-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-mona .seat-detail:not([hidden]) {
  display: block; width: fit-content; max-width: 100%; font: bold clamp(12px, 1.1vw, 16px)/1.1 var(--pop-title);
  letter-spacing: .05em; padding: 1px 4px; border-radius: 3px; color: #33271e; background: #f6d695;
}
