/* Melds belong to their seat; only stock and discard occupy the centre. */
.table-game .continental-table {
  --continental-card: clamp(46px, 7cqw, 72px); --stock-card: clamp(48px, 8cqw, 82px);
  position: relative; display: block; width: 100%; height: 100%; padding: 0; container-type: size;
}
body[data-screen="game"] .game-continental #foundations { width: 100%; max-width: none; }
body[data-screen="game"] .table-game.game-continental .table-scene { grid-template-columns: minmax(0, 1fr); grid-template-rows: 26px minmax(0, 1fr) auto; }
body[data-screen="game"] .table-game.game-continental .controller { align-self: end; }
.continental-contract { position: absolute; left: 0; top: 0; margin: 0; font-size: clamp(13px, 1.6cqw, 18px); font-weight: 400; }
.continental-tools { position: absolute; bottom: -48px; left: 0; z-index: 80; color: var(--pop-ink); }
.continental-tools summary { min-height: 40px; padding: 8px; border-radius: 4px; border: 1px solid var(--pop-ink); background: var(--pop-paper); font-size: 14px; cursor: pointer; }
.continental-tool-options { position: absolute; left: 0; bottom: calc(100% + 4px); display: grid; gap: 5px; width: min(260px, 70vw); padding: 8px; background: var(--pop-paper); border-radius: 5px; }
.continental-tools select { width: 100%; min-width: 0; min-height: 32px; font: 14px var(--font-ui); padding: 3px; border-radius: 5px; background: var(--pop-paper); color: var(--pop-ink); }
.continental-hand-number, .continental-meld-summary { display: none; }
.continental-piles { position: absolute; left: 50%; top: calc(50% + 14px); transform: translate(-50%, -50%); display: flex; gap: max(14px, 2cqw); align-items: center; }
.continental-stock, .continental-discard { position: relative; width: var(--stock-card); flex: none; }
.continental-stock .stock-pile { margin: 0; }
.game-continental .stock-pile:has(.stock-action:not(:disabled)), .continental-discard[data-game-action]:not(:disabled) { filter: drop-shadow(0 0 4px #f3d685); }
.continental-piles[data-penalty="true"] .continental-stock::after { content: "+1"; position: absolute; right: -8px; bottom: -8px; padding: 2px 6px; border-radius: 4px; background: var(--pop-paper); color: var(--pop-ink); font-size: 17px; pointer-events: none; }
.continental-discard { display: block; min-height: 44px; padding: 0; border: 0; background: none; color: inherit; box-shadow: none; }
.continental-discard:disabled, .continental-meld:disabled { opacity: 1; }
.continental-pile-card { display: block; width: var(--stock-card); aspect-ratio: 110 / 156; border-radius: 5px; }
.continental-pile-card:has(.continental-empty-discard) { border: 1px dashed #fff4df60; }
.continental-empty-discard { display: block; }
.continental-pile-label, .continental-player-name, .continental-meld-label, .continental-empty-discard {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%);
}
.continental-players { position: absolute; inset: 0; pointer-events: none; }
.continental-player { position: absolute; width: min(48cqw, 540px); }
.continental-player[data-edge="bottom"] { bottom: 0; left: 50%; transform: translateX(-50%); }
.continental-player[data-edge="top"] { top: 8px; left: 50%; transform: translateX(-50%) rotate(180deg); }
.continental-player[data-edge="left"], .continental-player[data-edge="right"] { --continental-card: clamp(36px, 5.5cqw, 68px); top: 48%; width: min(52cqh, 360px); }
.continental-player[data-edge="left"] { left: calc(var(--continental-card) * .71); transform: translate(-50%, -50%) rotate(90deg); }
.continental-player[data-edge="right"] { right: calc(var(--continental-card) * .71); transform: translate(50%, -50%) rotate(-90deg); }
.continental-groups { display: flex; align-items: center; justify-content: center; gap: 10px; }
.continental-meld { pointer-events: auto; flex: 1 1 0; min-width: var(--continental-card); max-width: calc(var(--continental-card) * 2.1); padding: 0; border: 0; background: none; box-shadow: none; color: inherit; }
.continental-row { position: relative; display: block; height: calc(var(--continental-card) * 156 / 110); width: 100%; }
.table-game .continental-card { position: absolute; display: block; width: var(--continental-card); aspect-ratio: 110 / 156; left: calc(var(--meld-index) * (100% - var(--continental-card)) / max(1, var(--meld-count) - 1)); top: 0; }
.continental-meld[data-empty="true"] { max-width: calc(var(--continental-card) * 1.3); }
.continental-meld[data-empty="true"] .continental-row { border: 1px dashed #fff4df50; border-radius: 6px; }
.continental-empty { display: grid; place-items: center; height: 100%; font-size: 14px; color: #fff4dfb0; }
.continental-wilds { position: absolute; right: 1px; bottom: 1px; padding: 1px 3px; border-radius: 3px; background: var(--pop-paper); color: var(--pop-ink); font-size: 11px; }
.continental-meld:focus-visible, .continental-discard:focus-visible { outline: 2px solid var(--pop-paper); outline-offset: 3px; }
/* Routine narration remains accessible and available in history. */
body[data-screen="game"] .game-continental :is(#turn-status, .table-announcement[data-kind="event"]) { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; overflow: hidden; clip-path: inset(50%); }
body[data-screen="game"] .game-continental .controller { position: relative; }
body[data-screen="game"] .table-game.game-continental .hand { height: calc(var(--hand-card) * 156 / 110 + 74px); }
body[data-screen="game"] .table-game.game-continental .hand .hand-card { top: 52px; }
body[data-screen="game"] .game-continental .beside-hand-action { top: 8px; right: 2px; }
.beside-hand-choices { position: absolute; right: 2px; top: 8px; z-index: 70; display: flex; gap: 6px; }
body[data-screen="game"]:has(.game-continental) .topbar { flex-wrap: nowrap; }
body[data-screen="game"]:has(.game-continental) .top-actions { width: auto; }
body[data-screen="game"]:has(.game-continental) #round-scoreboard { display: none; }
/* Optional paper annotation: no backdrop, focus trap or game pause. */
.score-note { position: absolute; right: 0; top: 0; z-index: 80; color: var(--pop-ink); font-size: 14px; }
.score-note summary { min-height: 44px; padding: 10px 12px; border: 1px solid var(--pop-ink); border-radius: 4px; background: var(--pop-paper); cursor: pointer; }
.score-note-paper { position: absolute; right: 0; top: calc(100% + 5px); width: max-content; max-width: min(440px, calc(100vw - 56px)); overflow: auto; padding: 12px; background: var(--pop-paper); border-top: 6px solid var(--pop-wood-edge); box-shadow: 2px 3px 0 #28282088; }
.score-note table { border-collapse: collapse; width: 100%; text-align: right; font-weight: 400; }
.score-note th, .score-note td { padding: 6px 8px; border-bottom: 1px solid #28282022; font-weight: 400; }
.score-note th { max-width: 100px; overflow-wrap: anywhere; }
.score-note tfoot { border-top: 2px solid #28282088; }
@media (max-width: 700px) {
  .table-game .continental-table { --continental-card: clamp(38px, 13cqw, 54px); --stock-card: clamp(42px, 16cqw, 60px); }
  .continental-contract { max-width: 68%; line-height: 1.1; }
  .continental-player { width: 72cqw; }
  .continental-player[data-edge="top"] { top: 42px; }
  .continental-player[data-edge="left"], .continental-player[data-edge="right"] { --continental-card: 36px; width: min(46cqh, 260px); top: 51%; }
  .continental-player[data-edge="bottom"] { bottom: 18px; }
  .continental-piles { top: calc(50% + 14px); }
  .continental-groups { gap: 6px; }
  .continental-tools select { font-size: 12px; }
  .score-note summary { padding-inline: 7px; }
  .score-note th, .score-note td { padding: 6px 4px; }
  .continental-empty { font-size: 12px; }
}
@media (max-height: 600px) {
  .table-game .continental-table { --continental-card: 38px; --stock-card: 44px; }
  .continental-player[data-edge="top"] { top: 52px; }
  .continental-player[data-edge="left"], .continental-player[data-edge="right"] { --continental-card: 32px; width: min(64cqh, 240px); }
  .continental-player[data-edge="bottom"] { bottom: 0; }
  .continental-piles { top: calc(50% + 30px); }
}
@media (min-width: 701px) and (max-height: 500px) {
  .score-note { top: -44px; }
  body[data-screen="game"] .table-game.game-continental .table-scene { grid-template-rows: 16px minmax(0, 1fr) auto; }
  body[data-screen="game"] .table-game.game-continental .feedback-rail { height: 16px; }
  body[data-screen="game"] .table-game.game-continental { --hand-card: 64px; }
  body[data-screen="game"] .table-game.game-continental .hand { height: 120px; }
  body[data-screen="game"] .table-game.game-continental .hand .hand-card { top: 16px; }
  .continental-tools { bottom: -44px; }
  body[data-screen="game"] .table-game.game-continental .game { padding-top: 30px; }
  .continental-player[data-edge="top"] { top: 0; }
  .continental-contract { font-size: 12px; }
  .table-game .continental-table { --continental-card: 30px; --stock-card: 34px; }
  .continental-stock .stock-layer { transform: translate(calc(var(--stock-lift) * -.1), calc(var(--stock-lift) * -.4)); }
  .continental-piles { top: calc(50% + 4px); }
  .continental-player[data-edge="bottom"] { bottom: 0; }
}
