/* One playfield, no independently scrolling panels. Density belongs to cards;
   detailed inspection lives in a deliberate dialog, outside the playfield. */
body[data-screen="game"] .app-shell { height: 100dvh; display: flex; flex-direction: column; }
body[data-screen="game"] .topbar { flex: 0 0 auto; }
.table-game { flex: 1 1 0; min-height: 0; --hand-card: clamp(62px, 10dvh, 102px); }
.table-game .footer { flex: 0 0 auto; }
.table-game .table-scene {
  flex: 1 1 0; min-height: 0; min-width: 0;
  grid-template-columns: minmax(0, 1fr); grid-template-rows: 48px minmax(0, 1fr) auto;
  gap: 4px; padding: 8px 18px;
}
.feedback-rail { position: relative; min-width: 0; height: 48px; display: grid; grid-template-rows: 22px 26px; align-items: center; }
.feedback-rail #turn-status { font: 18px/1.15 var(--pop-title); text-align: center; margin: 0; }
.table-game .table-announcement {
  position: static; transform: none; width: 100%; max-width: none; min-height: 26px;
  padding: 2px 8px; display: grid; align-items: center; pointer-events: auto;
  font: 14px/1.2 var(--pop-body); box-shadow: none; border-radius: 6px;
}
.table-game .game {
  display: grid; grid-template-rows: 62px minmax(0, 1fr); gap: 4px;
  min-height: 0; position: relative; container-type: size;
}
.table-game .opponents { height: 62px; margin: 0; align-items: start; padding-right: 68px; }
.table-game .opponent-count { min-height: 14px; }
.table-game .opponent-detail { min-width: 0; }
.table-game .opponent-detail strong { overflow-wrap: anywhere; }
.table-game .table-bottomline { position: absolute; top: 0; right: 0; margin: 0; z-index: 2; }
.table-game #last-move { display: none; }
.table-game #foundations { align-self: stretch; min-width: 0; min-height: 0; margin: 0 auto; }
.table-game .controller { min-width: 0; max-width: 1100px; padding: 0; display: grid; grid-template-rows: 22px auto auto auto; }
.table-game .hand-heading { height: 22px; margin: 0; }
.table-game .human-identity { position: static; width: auto; height: auto; clip-path: none; overflow: visible; }
.table-game .hand-heading h2 { font-size: 18px; line-height: 22px; }
.table-game .hand {
  display: grid; grid-template-columns: repeat(calc(var(--hand-count) - 1), minmax(0, 1fr)) var(--hand-card);
  align-items: start; justify-content: center; gap: 0;
  height: calc(var(--hand-card) * 156 / 110 + 24px); min-height: 0;
  width: min(100%, calc(var(--hand-count) * (var(--hand-card) + 12px)));
  margin: 0 auto; padding: 16px 6px 8px;
}
.table-game .hand:has(> :only-child) { grid-template-columns: var(--hand-card); }
.table-game .hand-card { width: var(--hand-card); justify-self: start; }
.table-game .hand-card:hover, .table-game .hand-card:focus-visible, .table-game .hand-card.selected { z-index: 5; }
.table-game .hand-card.selected { transform: translateY(-8px); }
.table-game .hand-card:focus-visible { outline-offset: -2px; }
.table-game .control-strip { display: flex; justify-content: center; align-items: center; gap: 8px; min-width: 0; height: 3em; min-height: 48px; font-size: 16px; padding: 2px; }
.table-game .control-strip .hand-actions, .table-game .action-choices { flex-wrap: wrap; gap: 6px; padding: 0; }
.table-game .control-strip button { min-height: 44px; padding: 5px 12px; white-space: nowrap; }
.table-game .action-choices select { min-height: 44px; width: auto; max-width: 55%; margin: 0; padding: 5px 8px; font: 16px var(--pop-body); }
.table-game .context-messages { height: 3.6em; min-height: 40px; font-size: 12px; line-height: 1.2; padding: 3px; text-align: center; }
.table-game .context-messages p { margin: 0; }
.table-game .context-messages .error { color: var(--pop-paper); background: #6d2a24; padding: 3px 7px; border-radius: 4px; }
.context-messages:has(#interaction-instruction:not(:empty)) #help,
.context-messages:has(#error:not([hidden])) #help,
.context-messages:has(#error:not([hidden])) #interaction-instruction { display: none; }
.placement-source { touch-action: none; }
.placement-ghost {
  position: fixed !important; z-index: 100; pointer-events: none !important;
  transform: translate(-50%, -50%) rotate(var(--placement-angle, 0deg)) !important; margin: 0 !important; opacity: .92;
  transition: transform 160ms ease-out;
  max-width: none !important;
}
.placement-ghost * { pointer-events: none !important; }
.placement-ghost.tableau-row { background: transparent; border-color: transparent; outline: none; }
.placement-ghost.tableau-row .tableau-label { visibility: hidden; }
@media (prefers-reduced-motion: reduce) { .placement-ghost { transition: none; } }
.placement-over { outline: 3px dashed var(--pop-paper); outline-offset: -3px; }
.placement-destination { visibility: hidden; }
[data-placing="true"] .placement-destination { visibility: visible; }
.table-game .brisca-trick { position: relative; padding-bottom: 46px; }
.table-game .brisca-trick > .placement-destination { position: absolute; bottom: 0; left: 0; right: 0; margin-inline: auto; width: max-content; }
.table-game .brisca-table { --table-card: clamp(40px, calc((100cqh - 225px) * 110 / 156), 100px); grid-template-rows: minmax(0,1fr); }
.table-game .brisca-trick h3 { margin-bottom: 8px; }
.table-game .brisca-scores { padding: 8px 12px; }
.table-game .brisca-scores h3 { font: 23px/1.1 var(--pop-title); margin-bottom: 4px; padding-bottom: 4px; }
.table-game .brisca-score { grid-template-columns: minmax(0, 1fr) auto; padding: 4px 0; line-height: 1.15; }
.table-game .brisca-score > span { grid-column: auto; align-self: center; }
.table-game .brisca-score small { grid-column: 1 / -1; font: 11px/1.1 var(--pop-body); }
.table-game .brisca-score strong { font: 20px/1 var(--pop-title); }
.game-pocha .brisca-table { grid-template-columns: 100px minmax(0, 1fr); grid-template-rows: 68px minmax(0, 1fr); gap: 8px 18px; --table-card: clamp(30px, calc((100cqh - 235px) * 110 / 156), 80px); }
.game-pocha .brisca-scores { grid-column: 1 / -1; grid-row: 1; display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); width: 100%; transform: none; gap: 8px; }
.game-pocha .brisca-scores h3 { display: none; }
.game-pocha .brisca-score + .brisca-score { border: 0; padding-left: 0; }
.game-pocha .brisca-plays { display: flex; flex-wrap: nowrap; }
.game-pocha .brisca-play { flex: 1 1 0; }
.game-pocha .brisca-card { max-width: 100%; }
.table-game .escoba-tools { min-height: 44px; }
.table-game .escoba-table { height: 100%; grid-template-rows: minmax(0, 1fr); }
.table-game .escoba-surface { height: 100%; min-height: 0; grid-template-rows: minmax(0, 1fr) 44px; }
.table-game .escoba-cards { --loose-card: clamp(52px, min(28cqw, calc((100cqh - 72px) * 110 / 156)), 130px); }
.table-game.game-ronda .escoba-table { grid-template-rows: minmax(0, 1fr) 48px; }
.table-game .ronda-notes { height: 48px; align-content: start; }
.table-game .mona-table { height: 100%; }
.table-game .mona-out { margin-top: 6px; }
.table-game .mona-card { width: clamp(40px, calc((100cqh - 160px) * 110 / 156), 80px); }
.table-game .mona-fan, .table-game .mona-pair { min-height: 60px; }
/* Sequences and tableau retain every destination, including empty ones. */
.table-game .foundations { display: grid; grid-template-rows: repeat(4, minmax(0, 1fr)); padding: 4px 0; gap: 6px; }
.table-game .foundation { min-width: 0; min-height: 0; }
.game-cinquillo .foundation { grid-template-columns: 90px minmax(0, 1fr); }
.table-game .card-slots { min-height: 0; align-items: center; }
.table-game .card-slot { min-height: 0; width: min(100%, calc((100cqh - 100px) * 110 / 624)); max-width: 63px; padding: 0; }
.table-game.game-tableau { --hand-card: 62px; }
.table-game.game-tableau .game { grid-template-rows: 42px minmax(0, 1fr); }
.table-game.game-tableau .opponents { height: 42px; }
.table-game.game-tableau .opponent .avatar, .table-game.game-tableau .mini-hand { display: none; }
.table-game.game-tableau .controller { grid-template-rows: 0 auto auto auto; }
.table-game.game-tableau .hand-heading { visibility: hidden; }
.table-game .tableau-table { --row-card: clamp(28px, calc((100cqh - 132px) * 110 / 468), 68px); grid-template-rows: repeat(3, minmax(0, 1fr)); }
.tableau-row { min-height: 0; touch-action: none; }
.tableau-label { touch-action: none; }
.tableau-fan { height: 100%; min-height: 0; }
.tableau-row .tableau-card { aspect-ratio: 110 / 156; }
/* Public seats use the available area; hands overlap instead of wrapping/scrolling. */
.game-banking .game { grid-template-rows: minmax(0, 1fr); }
.game-banking .banking-table { display: grid; grid-template-rows: 70px minmax(0, 1fr); width: 100%; padding: 0; }
.game-banking .banking-heading { min-height: 0; }
.game-banking .banking-seats { height: auto; max-height: none; overflow: visible; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); gap: 8px; }
.game-banking .banking-seats:not(:has(> :nth-child(5))) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.game-banking .banking-seat { padding: 6px 10px; min-height: 0; }
.game-banking .banking-seat h4 { font-size: 20px; }
.game-banking .banking-heading .stock-pile { right: 85px; }
.game-banking .banking-seats:has(> :nth-child(5)) .banking-seat { display: grid; grid-template-columns: minmax(0,1fr) 44px; align-content: center; column-gap: 6px; }
.game-banking .banking-seats:has(> :nth-child(5)) .banking-seat > * { grid-column: 1; margin: 0; line-height: 1.2; }
.game-banking .banking-seats:has(> :nth-child(5)) .banking-cards { grid-column: 2; grid-row: 1 / span 5; align-self: center; --bank-card: 44px; }
.game-banking .banking-seats:has(> :nth-child(5)) .banking-private { grid-column: 1 / -1; font-size: 11px; }
.game-banking .banking-cards { --bank-card: clamp(28px, calc((100cqh - 240px) * 110 / 312), 86px); display: grid; grid-template-columns: repeat(var(--card-count), minmax(0,1fr)); padding: 5px 0 0; gap: 0; max-width: calc(var(--card-count) * (var(--bank-card) + 6px)); }
.game-banking .banking-card { width: var(--bank-card); max-width: 100%; }
.footer-navigation { display: flex; align-items: center; gap: 16px; }
#inspection-dialog { width: min(900px, calc(100% - 24px)); }
.inspection-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 14px; }
.inspection-card { margin: 0; }
.inspection-card .card-art { display: block; width: 100%; }
.inspection-card figcaption { font-size: 12px; text-align: center; }
#setup-replace { margin: 12px 0; font-size: 14px; }
@media (max-width: 1000px) {
  .table-game .brisca-table { --table-card: clamp(34px, calc((100cqh - 225px) * 110 / 156), 75px); grid-template-rows: auto minmax(0,1fr); }
  .game-pocha .brisca-table { --table-card: clamp(28px, calc((100cqh - 250px) * 110 / 156), 70px); }
}
@media (max-width: 700px) {
  .table-game { --hand-card: 72px; }
  .table-game .table-scene { padding: 6px 8px; }
  .table-game .game { grid-template-rows: 58px minmax(0, 1fr); }
  .table-game .opponents { height: 58px; gap: 4px; }
  .table-game .opponent-count { max-width: none; }
  .table-game .mini-hand { display: none; }
  .table-game .controller { grid-template-rows: 20px auto auto auto; }
  .table-game .control-strip { gap: 5px; }
  .table-game .control-strip button { font-size: 15px; padding-inline: 7px; }
  .table-game .control-strip .hand-actions { gap: 4px; }
  .table-game .context-messages { font-size: 11px; }
  .table-game .footer { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 4px; }
  .footer-navigation { gap: 8px; }
  .table-game .footer-controls { gap: 5px; width: auto; min-width: 0; justify-content: flex-end; }
  .table-game .footer-controls select { width: 76px; padding-inline: 2px; }
  .table-game .footer-controls label, .table-game #turn-number { display: none; }
  .game-banking .game { grid-template-rows: minmax(0, 1fr); }
  .game-banking .banking-seats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .game-banking .banking-cards { --bank-card: 44px; }
  .game-banking .banking-seats:has(> :nth-child(5)) .banking-seat { grid-template-columns: minmax(0,1fr) 28px; padding: 4px; }
  .game-banking .banking-seats:has(> :nth-child(5)) .banking-cards { --bank-card: 28px; }
  .game-banking .banking-seats:has(> :nth-child(5)) .banking-seat h4 { font-size: 16px; }
  .game-banking .banking-seats:has(> :nth-child(5)) .banking-total { font-size: 12px; }
  .table-game .foundation { grid-template-columns: 22px minmax(0,1fr); }
  .table-game .card-slots { gap: 2px; }
  .table-game .card-slot .slot-rank { font-size: 12px; left: 2px; }
  .game-pocha .brisca-table { grid-template-columns: 58px minmax(0,1fr); grid-template-rows: 94px minmax(0,1fr); }
  .game-pocha .brisca-scores { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 4px; }
  .game-pocha .brisca-score { padding: 0; font-size: 10px; }
  .game-pocha .brisca-score small { font-size: 9px; }
  .game-mona .game:has(.opponents > :nth-child(6)) { grid-template-rows: 76px minmax(0,1fr); }
  .game-mona .opponents:has(> :nth-child(6)) { height: 76px; padding-right: 0; }
  .game-mona .opponents:has(> :nth-child(6)) .opponent { flex-basis: calc(33.33% - 8px); padding: 0; }
  .game-mona .opponents:has(> :nth-child(6)) .opponent-detail { display: flex; gap: 4px; align-items: baseline; }
  .game-mona .opponents:has(> :nth-child(6)) .opponent-count { max-width: 7ch; line-height: 1; }
}
@media (max-width: 700px) and (max-height: 650px) {
  .table-game { --hand-card: 52px; }
  .table-game.game-tableau { --hand-card: 48px; }
  .table-game .controller, .table-game.game-tableau .controller { grid-template-rows: 0 auto auto auto; }
  .table-game .control-strip { height: 44px; min-height: 44px; }
  .table-game .hand-heading { visibility: hidden; }
  .table-game .table-scene { grid-template-rows: 42px minmax(0,1fr) auto; }
  .feedback-rail { height: 42px; grid-template-rows: 20px 22px; }
  .table-game .table-announcement { font-size: 11px; min-height: 22px; }
  .table-game .opponent .avatar { display: none; }
  .table-game .game { grid-template-rows: 38px minmax(0,1fr); }
  .table-game .opponents { height: 38px; }
  .game-banking .game { grid-template-rows: minmax(0,1fr); }
  .table-game .brisca-table { --table-card: 30px; gap: 4px 8px; grid-template-columns: 66px minmax(0,1fr); }
  .table-game .brisca-scores { padding: 3px 6px; gap: 5px; }
  .table-game .brisca-score { padding: 0; font-size: 10px; }
  .table-game .brisca-score { display: flex; flex-direction: column; align-items: flex-start; gap: 0; }
  .table-game .brisca-score strong { font-size: 16px; }
  .table-game .brisca-score small { font-size: 9px; }
  .game-tute .brisca-scores { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .table-game .brisca-trick-note { margin-top: 3px; font-size: 9px; min-height: 0; }
  .table-game .brisca-trick-note { display: none; }
  .table-game .brisca-trick h3 { display: none; }
  .game-pocha .brisca-table { grid-template-rows: 70px minmax(0,1fr); }
  .game-pocha .brisca-score { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 0 2px; }
  .game-pocha .brisca-score strong { font-size: 14px; }
  .table-game .brisca-trick { padding-bottom: 44px; }
  .table-game .mona-layout { margin-top: 3px; }
  .table-game .mona-layout h3 { font-size: 15px; line-height: 1.15; margin-bottom: 3px; }
  .table-game .mona-layout p, .table-game .mona-out { font-size: 10px; margin-block: 3px; }
  .game-banking:has(.banking-seats > :nth-child(5)) { --hand-card: 36px; }
  .game-banking:has(.banking-seats > :nth-child(5)) .banking-table { grid-template-rows: 70px minmax(0,1fr); }
  .game-banking:has(.banking-seats > :nth-child(5)) .banking-heading { flex-direction: row; align-items: center; padding-right: 178px; }
  .game-banking:has(.banking-seats > :nth-child(5)) .banking-heading h3 { font-size: 18px; white-space: nowrap; }
  .game-banking:has(.banking-seats > :nth-child(5)) .banking-heading > span { display: none; }
  .game-banking .banking-seats:has(> :nth-child(5)) { gap: 4px; }
  .game-banking .banking-seats:has(> :nth-child(5)) .banking-seat { grid-template-columns: minmax(0,1fr) auto; padding: 2px 4px; }
  .game-banking .banking-seats:has(> :nth-child(5)) .banking-cards,
  .game-banking .banking-seats:has(> :nth-child(5)) .banking-private { display: none; }
  .game-banking .banking-seats:has(> :nth-child(5)) .banking-seat h4 { font-size: 15px; }
  .game-banking .banking-seats:has(> :nth-child(5)) .banking-balance { grid-column: 1 / -1; font-size: 10px; }
  .game-banking .banking-seats:has(> :nth-child(5)) .banking-total { grid-column: 1 / -1; font-size: 11px; }
  .game-banking .banking-seats:has(> :nth-child(5)) .banking-outcome { grid-column: 2; grid-row: 1; font-size: 9px; }
}
@media (min-width: 701px) and (max-height: 500px) {
  .table-game { --hand-card: 62px; }
  .table-game .table-scene { grid-template-columns: minmax(0,1fr) 260px; grid-template-rows: 42px minmax(0,1fr); gap: 6px 16px; }
  .feedback-rail { grid-column: 1 / -1; height: 42px; grid-template-rows: 20px 22px; }
  .table-game .controller { align-self: center; grid-template-rows: 0 auto auto auto; }
  .table-game .hand-heading { visibility: hidden; }
  .table-game .game { grid-template-rows: 38px minmax(0,1fr); }
  .table-game .opponents { height: 38px; }
  .table-game .mini-hand { display: none; }
  .game-banking .game { grid-template-rows: minmax(0,1fr); }
  .table-game .brisca-table { --table-card: 38px; }
  .table-game .brisca-trick-note { margin: 3px 0 0; }
  .table-game .brisca-trick { padding-bottom: 44px; }
  .table-game .footer-controls { width: auto; }
  .game-banking .banking-seats:has(> :nth-child(5)) .banking-seat h4 { font-size: 17px; }
  .game-banking .banking-seats:has(> :nth-child(5)) .banking-balance { font-size: 11px; }
  .game-banking .banking-seats:has(> :nth-child(5)) .banking-total { font-size: 13px; }
  .game-banking .banking-seats:has(> :nth-child(5)) .banking-outcome { font-size: 11px; }
}
