/* Approved ENH-136 Table Play visual baseline, scoped to the live table. */
:root{--gui-bg:#edf2f0;--gui-surface:#fffdf8;--gui-ink:#1e2b29;--gui-muted:#6a7974;--gui-line:#c6d4ce;--gui-felt:#185e49;--gui-felt2:#0d4637;--gui-soft:#e3ede8;--gui-accent:#17664d;--gui-font:22.1px;--workspace-font:18.5px;--gui-rank:35.2px;--gui-scale:1;--gui-face:Inter}
:root[data-table-palette=blue]{--gui-felt:#24517a;--gui-felt2:#122f53;--gui-accent:#24517a;--gui-soft:#e2eaf2;--gui-bg:#edf1f5}
:root[data-table-palette=slate]{--gui-felt:#46525a;--gui-felt2:#273138;--gui-accent:#46525a;--gui-soft:#e1e7e9;--gui-bg:#edf0f1}
body.table-mode{background:var(--gui-bg);--ink:var(--gui-ink);--muted:var(--gui-muted);--color-text:var(--gui-ink);--color-text-muted:var(--gui-muted);--card-rank-size:var(--gui-rank);--card-suit-size:calc(var(--gui-rank) + 3px);font:var(--gui-font)/1.3 var(--gui-face),system-ui,sans-serif}
body.table-mode #topbar{background:var(--gui-surface);color:var(--gui-ink);border-color:var(--gui-line);min-height:76px;padding:8px 18px;box-shadow:none}
body.table-mode .topbar-brand img{width:100px;height:60px;object-fit:contain}
body.table-mode #topbar button{background:var(--gui-soft);color:var(--gui-ink);border:0;border-radius:8px;font:700 var(--gui-font)/1.2 var(--gui-face),system-ui,sans-serif;min-height:42px;padding:8px 11px}
body.table-mode #topbar .topbar-brand{background:transparent;padding:0}
body.table-mode #tb-table-title{font-size:1.05em;color:var(--gui-accent);font-weight:850}
body.table-mode #tb-scoring{color:var(--gui-muted)}
body.table-mode #topbar-navigation{background:var(--gui-surface);border-color:var(--gui-line)}
body.table-mode #app.on{display:block;box-sizing:border-box;height:100dvh;overflow:auto;padding:calc(var(--topbar-clearance) + 12px) 16px 16px;background:var(--gui-bg)}
body.table-mode #app .felt{position:relative;display:grid;grid-template-areas:'board top auction' 'left mid right' 'systems bottom actions';grid-template-columns:minmax(220px,1fr) minmax(300px,1.4fr) minmax(220px,1fr);grid-template-rows:minmax(195px,1fr) minmax(185px,1.2fr) minmax(200px,1fr);gap:16px;align-items:center;min-height:650px;height:calc(100dvh - var(--topbar-clearance) - 28px);max-width:1500px;margin:auto;padding:16px;border-radius:18px;overflow:visible;background:radial-gradient(ellipse at 50% 40%,var(--gui-felt),var(--gui-felt2));box-shadow:0 10px 25px #163b2d33;border:0}
body.table-mode #app .seat{position:static;transform:none;width:100%;min-width:0;max-width:none;display:flex;flex-direction:column;align-items:center;gap:7px;align-self:center;justify-self:center;color:var(--gui-ink)}
body.table-mode #seat-2{grid-area:top}body.table-mode #seat-0{grid-area:bottom}body.table-mode #seat-1{grid-area:left}body.table-mode #seat-3{grid-area:right}
body.table-mode #mid{grid-area:mid;position:static;transform:none;min-width:0;align-self:center;color:white}
body.table-mode .nameplate{background:var(--gui-surface);color:var(--gui-ink);border:3px solid #d8e6df;border-radius:8px;padding:6px 9px;font:800 var(--gui-font)/1.2 var(--gui-face),system-ui,sans-serif;max-width:100%;min-height:42px}
body.table-mode .nameplate .pos{font:900 calc(var(--gui-font) + 9px)/1 ui-monospace,monospace}
body.table-mode .nameplate.vulnerable-seat{background:#b52326;color:#fff;border-color:#741417}
body.table-mode .nameplate.nonvulnerable-seat{background:#fff;color:#17231e;border-color:#d8d2c2}
body.table-mode #app .nameplate.vulnerable-seat :is(.tag,.system-info){color:#fff}
body.table-mode .nameplate[aria-current=true]{outline:3px solid #e5c34b;outline-offset:2px;box-shadow:0 0 0 5px #735d18}
body.table-mode .hand-slot{width:100%;min-width:0;max-width:100%;overflow:auto}
body.table-mode .diagramhand,body.table-mode .concealedhand{background:var(--gui-surface);color:var(--gui-ink);border:1px solid var(--gui-line);border-radius:8px;padding:calc(9px * var(--gui-scale));min-width:0;min-height:calc(120px * var(--gui-scale));box-shadow:0 3px 8px #0002}
body.table-mode .concealedhand{background:repeating-linear-gradient(135deg,#d7e5df 0 8px,#e5efeb 8px 16px);width:100%}
body.table-mode #app .diagramrow{display:flex;align-items:center;min-height:calc(30px * var(--gui-scale));gap:2px;white-space:nowrap;flex-wrap:nowrap}
body.table-mode #app .diagramrow .slbl{font-size:calc(var(--gui-rank) + 3px);font-weight:900;width:30px;flex:0 0 30px;line-height:1.2}
body.table-mode #app .diagramrank{font:800 var(--gui-rank)/1.2 Georgia,serif;color:var(--gui-ink);background:transparent;min-width:26px;min-height:34px;padding:2px;border:2px solid transparent;flex:0 0 auto;opacity:1}
body.table-mode #app .diagramrank.play{background:#fff0a2;border-color:#d3b132;border-radius:4px}
body.table-mode #app :is(.diagramrank,.card).action-candidate{
  position:relative;z-index:8;
  background:#fff0a2;border-color:#8a6b00;box-shadow:0 0 0 3px #fff,0 4px 12px #0006
}
body.table-mode #app .card.action-candidate{transform:scale(1.8);transform-origin:50% 100%}
body.table-mode #app :is(.diagramrank,.card).action-candidate:focus-visible{outline:3px solid #173f7a;outline-offset:3px}
body.table-mode #app .diagramrank:disabled{color:var(--gui-ink)}
body.table-mode #app .diagramrank[data-legal=false]:not(:disabled){cursor:not-allowed;text-decoration:none}
body.table-mode #app .diagramrow .slbl.red{color:#a92e34}body.table-mode #app .diagramrow .slbl.black{color:#17222b}
body.table-mode #app .diagramvoid{font-size:var(--gui-rank);color:var(--gui-muted)}
body.table-mode #app .card{width:calc(54px * var(--gui-scale));height:calc(78px * var(--gui-scale));--card-rank-size:var(--gui-rank);--card-suit-size:calc(var(--gui-rank) + 3px);font-weight:800}
body.table-mode #app .card.play{outline:2px solid #e5c34b;outline-offset:-2px}
body.table-mode #board-panel{grid-area:board;align-self:start;position:static;width:100%;max-width:280px;margin:0;border:1px solid #d4bb64;border-radius:9px;background:#fff8dd;color:#4d421e;padding:10px 12px;font-size:var(--gui-font)}
body.table-mode .boardheadline{display:flex;flex-wrap:wrap;gap:5px}.gui-dealer{width:100%;font-size:.85em;font-weight:500}
body.table-mode .boardpanel .contractline{color:var(--gui-ink);font-size:1.05em}body.table-mode .tricksummary{margin-top:6px}body.table-mode .trick-total{font-size:1.2em;color:var(--gui-accent)}
body.table-mode .partnershipclock{background:var(--gui-surface);color:var(--gui-ink)}
body.table-mode #bidding-workspace{display:contents;position:static;transform:none;width:auto;max-width:none}
body.table-mode #auction-panel{grid-area:auction;position:static;transform:none;width:100%;min-width:0;max-width:100%;align-self:start;max-height:250px;overflow:auto;background:var(--gui-surface);color:var(--gui-ink);border:1px solid var(--gui-line);border-radius:9px;padding:10px;z-index:2}
body.table-mode #bidbox{grid-area:mid;position:static;transform:none;width:100%;min-width:0;max-width:100%;background:var(--gui-surface);color:var(--gui-ink);padding:12px;border:1px solid var(--gui-line);border-radius:10px;z-index:3;box-shadow:0 8px 20px #0003}
body.table-mode .bid{color:var(--gui-ink);background:var(--gui-soft);font-size:var(--gui-font);border-radius:6px;min-height:40px}
body.table-mode .bid:disabled{opacity:.35}body.table-mode .bid.level[aria-expanded=true]{background:var(--gui-accent);color:white}
body.table-mode .bid.action-candidate{background:#fff0a2;color:#142820;border:3px solid #8a6b00;box-shadow:0 0 0 2px #fff}
body.table-mode .bid-confirmation{display:flex;align-items:center;justify-content:flex-end;gap:7px;margin-top:6px;padding-top:6px;border-top:1px solid var(--gui-line)}
body.table-mode .bid-confirmation button{min-height:40px;padding:5px 9px}
body.table-mode .bid-confirmation .sy{margin-left:2px;font-weight:900}
body.table-mode .bid-confirmation .sy.red{color:#a92e34}
body.table-mode .bidprimary{display:flex;flex-wrap:wrap;gap:4px}body.table-mode .bidprimary .level{flex:1;min-width:30px}
body.table-mode .bidstrains{display:grid;grid-template-columns:repeat(5,1fr);gap:4px;margin-top:5px}
body.table-mode #bidbox.full-bidding .bidprimary .level,body.table-mode #bidbox.full-bidding #bid-strains{display:none}
#gui-bid-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:3px;margin-top:7px}#gui-bid-grid button{font-size:var(--gui-font);padding:4px;min-height:32px}
body.table-mode .auction{font-size:calc(var(--gui-font) - 2px);color:var(--gui-ink)}body.table-mode .auction th{background:var(--gui-soft);color:var(--gui-accent)}body.table-mode .auction td{color:var(--gui-ink)}
body.table-mode .call-alert-entry{display:flex;flex-wrap:wrap;gap:5px}body.table-mode .call-alert-entry textarea{background:white;color:var(--gui-ink);font-size:var(--gui-font);border:1px solid var(--gui-line)}body.table-mode .alerttoggle{color:var(--gui-ink)}
body.table-mode .explanation-input{min-width:0}
body.table-mode #bid-alert-note{box-sizing:border-box;width:100%;height:4.4em;min-height:3.2em;max-height:6.8em;overflow:auto;resize:vertical;line-height:1.3}
body.table-mode #gui-systems{grid-area:systems;position:static;display:grid;gap:8px;align-self:end;background:transparent;border:0;font-size:calc(var(--gui-font) - 2px)}
body.table-mode #gui-systems>div{border:1px solid var(--gui-line);border-radius:9px;background:var(--gui-surface);padding:9px;color:var(--gui-ink)}
body.table-mode #gui-play-actions{grid-area:actions;display:flex;flex-wrap:wrap;align-self:end;justify-content:flex-end;gap:8px;padding:8px}
body.table-mode #gui-play-actions button,body.table-mode .tablepanel button{background:var(--gui-soft);color:var(--gui-ink);border-radius:7px;padding:8px 12px;font:700 var(--gui-font)/1.2 var(--gui-face),system-ui,sans-serif;min-height:44px}
body.table-mode #rail-details{display:none}body.table-mode #table-feedback,body.table-mode #undo-status{position:fixed;top:calc(var(--topbar-clearance) + 8px);left:25%;right:25%;z-index:30;background:var(--gui-surface);color:var(--gui-ink);border:2px solid #cba83d;border-radius:8px}
body.table-mode .scorepanel{position:absolute;right:16px;bottom:16px;z-index:10;max-width:calc(100% - 32px);max-height:65%;overflow:auto;background:var(--gui-surface);color:var(--gui-ink);border:1px solid var(--gui-line);border-radius:10px}
body.table-mode .sheet{background:var(--gui-surface);color:var(--gui-ink);border-color:var(--gui-line);border-radius:12px}body.table-mode .sheet .btn{background:var(--gui-soft);color:var(--gui-ink);border-radius:8px}body.table-mode .sheet input,body.table-mode .sheet select,body.table-mode .sheet textarea{background:white;color:var(--gui-ink);border:1px solid var(--gui-line)}
.shared-theme-preview{display:grid;grid-template-columns:minmax(88px,.72fr) minmax(160px,1.5fr) minmax(105px,.9fr);min-height:100px;margin:7px 0 10px;overflow:hidden;border:1px solid var(--gui-line);border-radius:7px;background:var(--gui-bg);font-size:13px}
.shared-theme-preview-panel,.shared-theme-preview-context{display:flex;min-width:0;flex-direction:column;gap:7px;padding:9px;background:var(--table-v2-panel);color:var(--table-v2-panel-ink)}
.shared-theme-preview-action{display:grid;min-height:34px;place-items:center;padding:4px;color:var(--table-v2-button-ink);border:1px solid #ffffff66;border-radius:4px;background:var(--table-v2-button)}
.shared-theme-preview-felt{display:grid;place-items:center;padding:10px;background:var(--gui-felt)}
.shared-theme-preview-hand{display:grid;min-width:135px;gap:3px;padding:7px;color:var(--gui-ink);border:2px solid #d9e3df;border-radius:4px;background:var(--gui-surface);font-family:Georgia,serif}
.shared-theme-preview-hand .red{color:#b51f37}
.shared-theme-preview-context{background:var(--table-v2-communication);color:var(--table-v2-communication-ink)}
.shared-theme-preview-context span{font-size:11px}
@media(max-width:520px){.shared-theme-preview{grid-template-columns:82px minmax(130px,1fr)}.shared-theme-preview-context{display:none}}
.gui-preferences{width:min(690px,100%)}
body .sheet.gui-appearance.gui-preferences,body .sheet.gui-appearance.gui-preferences :is(label,select,button,p){font-size:var(--gui-font)}
.gui-preference-section+.gui-preference-section{margin-top:12px;padding-top:12px;border-top:1px solid var(--gui-line)}
.gui-preference-section h3{margin:0 0 5px;font-size:1em}
.gui-section-reset{width:auto;margin-top:8px}
.gui-appearance-fields{display:grid;grid-template-columns:1fr;gap:0;border-block:1px solid var(--gui-line)}
.gui-preference-row{display:grid;grid-template-columns:minmax(190px,.9fr) minmax(230px,1.1fr);align-items:center;gap:18px;min-height:44px;padding:3px 10px}
.gui-preference-row+.gui-preference-row{border-top:1px solid var(--gui-line)}
.gui-preference-row :is(label,.gui-preference-label){margin:0;font-weight:700}
.gui-preference-row select{box-sizing:border-box;width:100%;min-height:38px;margin:0;padding:6px 10px;font:inherit}
.gui-preference-row .profile-static-value{display:flex;align-items:center;box-sizing:border-box;min-height:38px;padding:6px 10px;border:1px solid var(--gui-line);border-radius:6px;background:var(--gui-soft);color:var(--gui-ink)}
.gui-score-preview{width:100%;text-align:center;margin:14px 0;font-size:1.3em}
body.table-mode .cap,body.table-mode .paneltitle{color:var(--gui-accent);font-size:.85em}body.table-mode .centerinfo{color:white}body.table-mode .trickpad{background:transparent}
@media(max-width:1050px){body.table-mode #app .felt{grid-template-columns:minmax(180px,1fr) minmax(270px,1.3fr) minmax(180px,1fr);gap:10px;padding:12px}body.table-mode #tb-scoring{display:none}body.table-mode #topbar .topbar-brand img{width:76px}}
@media(max-width:700px){body.table-mode #app.on{padding-left:8px;padding-right:8px}body.table-mode #app .felt{min-width:680px;min-height:800px}body.table-mode #app .nameplate{font-size:var(--gui-font)}body.table-mode #tb-table-title{max-width:130px}body.table-mode #topbar button{font-size:var(--gui-font)}.gui-preference-row{grid-template-columns:minmax(105px,.75fr) minmax(145px,1.25fr);gap:10px;padding-inline:4px}.gui-preference-row :is(label,.gui-preference-label){overflow-wrap:anywhere}body .sheet.gui-appearance.gui-preferences,body .sheet.gui-appearance.gui-preferences :is(label,select,button,p){font-size:var(--gui-font)}body.table-mode #table-feedback,body.table-mode #undo-status{left:10px;right:10px}}
body.table-mode #app .seat.turn-due{border-color:transparent;background:transparent;box-shadow:none;animation:none}
.reference2-bid-title{display:none}
body.table-mode #app .hand-slot{display:block;width:max-content;max-width:100%;min-width:calc(240px * var(--gui-scale))}
body.table-mode #app .concealedhand{width:calc(250px * var(--gui-scale));max-width:100%}
body.table-mode .nameplate .pos{color:inherit}
body.table-mode #app .nameplate.robot-unavailable{background:#fff0c2;color:#382800;border-color:#a56b00;opacity:1}
body.table-mode #app .nameplate.robot-unavailable[aria-current=true]{background:#fff0c2;color:#382800;border-color:#a56b00;animation:none}
body.table-mode #app .nameplate.robot-unavailable .player-name{font-weight:900}
@media(min-width:561px){body.table-mode #app .nameplate.robot-unavailable .player-name{font-size:14px}}
body.table-mode #board-panel .boardheadline{display:flex;flex-direction:column;gap:3px;background:transparent;text-transform:none;letter-spacing:normal;font:800 var(--gui-font)/1.3 var(--gui-face),system-ui,sans-serif}
body.table-mode #board-panel .boardheadline span{padding:0;text-align:left;min-height:0}
body.table-mode #board-panel .boardvulnerability{font-size:.85em;background:transparent;color:#4d421e}
body.table-mode #board-panel .boardvulnerability.vulnerable{color:#a92e34}

body.table-mode .bidcontrols{display:flex;flex-direction:column;gap:6px}
body.table-mode #bidbox{max-height:none;overflow:visible}

body.table-mode .call-alert-entry{display:grid;grid-template-columns:minmax(0,1fr) minmax(100px,.6fr);align-items:center}
body.table-mode .call-alert-entry .alerttoggle{font-size:13px;letter-spacing:normal;text-transform:none}
body.table-mode #bidbox .call-alert-entry{grid-template-columns:minmax(0,1fr) auto;gap:8px}
body.table-mode #bidbox .call-alert-entry .alerttoggle{display:flex;align-items:center;gap:5px;white-space:nowrap}
body.table-mode #gui-bid-grid .bid{min-width:0}
body.table-mode .benito-mark{width:28px;height:28px;object-fit:contain;vertical-align:middle;margin-right:5px}

body.table-mode #gui-systems{display:contents}
body.table-mode #gui-systems>div{align-self:end;font-size:calc(var(--gui-font) - 2px)}
body.table-mode #gui-systems>[data-our-system=false]{grid-area:systems}
body.table-mode #gui-systems>[data-our-system=true]{grid-area:actions}
body.table-mode #gui-play-actions{align-self:start}

body.table-mode #gui-bid-grid button{min-height:28px;padding:2px}
body.table-mode #topbar .topbar-brand{order:0}
body.table-mode #tb-player-id{order:1;color:#fff;border-color:transparent}
body.table-mode #tb-player-id[data-connection-state="connected"]{background:#196c43}
body.table-mode #tb-player-id[data-connection-state="disconnected"]{background:#a92e34}
body.table-mode #tb-player-id[data-connection-state="reconnecting"]{background:#f4d77e;color:#2f2509;border-color:#9c6800}
body.table-mode #topbar .topbar-account{display:flex;order:2;flex:0 0 44px;padding:0;border:0}
body.table-mode #topbar :is(#tb-table-title,#tb-scoring){order:3}
body.table-mode #topbar .topbar-menu{order:4}
body.table-mode #topbar .topbar-account>:not(#tb-notifications){display:none!important}
body.table-mode #topbar #tb-notifications{position:relative;display:inline-flex;width:44px;min-width:44px;height:44px;align-items:center;justify-content:center;padding:0;overflow:visible}
body.table-mode #topbar #tb-notifications .notification-bell{font-size:24px;line-height:1}
body.table-mode #topbar #tb-notifications .notification-label{display:none}
body.table-mode #topbar #tb-notification-count{position:absolute;right:-4px;top:-5px;min-width:18px;margin:0;padding:1px 4px;background:#a92e34;color:#fff;border-color:#fff;font-size:10px;line-height:1.4}
body.table-mode #topbar #tb-notifications.has-pending{border-color:#9c6800;background:#fff0c9;color:#593b00;box-shadow:0 0 0 2px #f4d77e}
body.table-mode #topbar #tb-notifications.has-new{outline:3px solid #b98700;outline-offset:2px;box-shadow:0 0 0 2px #fff}

body.table-mode .gui-vul-label{display:inline-block;padding:2px 5px;border-radius:4px;text-transform:none;letter-spacing:normal}
body.table-mode .gui-vul-label.vulnerable{color:#a92e34}
body.table-mode .gui-vul-label.nonvulnerable,body.table-mode #board-panel .boardvulnerability:not(.vulnerable){color:#fff;background:var(--gui-felt2);border-radius:4px;padding:2px 5px;width:max-content}

.gui-vul-label,body.table-mode #board-panel .gui-vul-label{display:inline-block;padding:3px 7px;border:1px solid #c6d4ce;border-radius:4px;width:max-content;text-transform:none;letter-spacing:normal;font-weight:800}
.gui-vul-label.vulnerable,body.table-mode .gui-vul-label.vulnerable,body.table-mode #board-panel .gui-vul-label.vulnerable{background:#a92e34;color:white;border-color:#a92e34}
.gui-vul-label.nonvulnerable,body.table-mode .gui-vul-label.nonvulnerable,body.table-mode #board-panel .gui-vul-label.nonvulnerable{background:white;color:#1e2b29}

body.table-mode #topbar.table-mode.menu-open{flex-wrap:nowrap}
body.table-mode #topbar.table-mode.menu-open #topbar-navigation{
 position:absolute;left:auto;right:10px;top:calc(100% + 4px);width:260px;display:grid;
 grid-template-columns:minmax(0,1fr);
 max-height:calc(100dvh - 100px);overflow:auto;padding:8px;background:var(--gui-surface);
 box-shadow:0 8px 24px #0004;z-index:100}
body.table-mode #topbar.table-mode.menu-open .topbar-account{display:flex}
.gui-menu-account{display:none}
body.table-mode .gui-menu-account{display:grid;gap:6px;border-top:1px solid var(--gui-line);padding-top:6px}
body.table-mode .claimchoices button{background:#fffdf8;color:#1e2b29;border:2px solid #7c9187;font-weight:800}
body.table-mode .claimchoices button[aria-pressed=true]{background:#17664d;color:white;border-color:#17664d}
body.table-mode #sheet[data-claim]{background:#fff;color:#111;border:2px solid #52665d}
body.table-mode #sheet[data-claim] h2,body.table-mode #sheet[data-claim] .sub{color:#111}
body.table-mode #sheet[data-claim] .claimmsg{background:#fff;color:#111;border:2px solid #52665d}
body.table-mode #sheet[data-claim] .claimnote{background:#fff;color:#111;border:2px solid #52665d}
body.table-mode #sheet[data-claim] .claim-hands{background:#f6f6f1;color:#111}
body.table-mode .claim-hands{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px;margin:8px 0;padding:8px;background:#f6f1e6;color:#1e2b29;border:1px solid #c6b98f;border-radius:6px;font:14px/1.35 ui-monospace,monospace}
body.table-mode .claim-hands strong{color:#7a5a16}
body.table-mode .alertdetail{background:#fffdf8;color:#1e2b29;border-color:#a92e34}
body.table-mode .alertdetail .alerttitle{color:#a92e34}
body.table-mode .alertdetail textarea{background:var(--gui-field-bg);color:var(--gui-field-ink);-webkit-text-fill-color:var(--gui-field-ink);border-color:var(--gui-line)}
body.table-mode #board-panel .contractline{white-space:nowrap}

/* Compact full grid: one level label, then five strain buttons. */
body.table-mode #gui-bid-grid{grid-template-columns:24px repeat(5,minmax(0,1fr))}
.gui-bid-level{display:grid;place-items:center;font-weight:850;color:var(--gui-ink)}

body.table-mode #bidbox.full-bidding .call-alert-entry{grid-template-columns:minmax(0,1fr) 132px}
body.table-mode #bidbox.full-bidding .alerttoggle{white-space:normal;line-height:1.25}
body.table-mode #manage-close-dialog{background:#17664d;color:white;border:2px solid #17664d}
body.table-mode #manage-close-dialog:focus{outline:3px solid #d2a72a;outline-offset:3px}
body.table-mode #manage-close-table{background:transparent;color:#a92e34;border:1px solid #a92e34;box-shadow:none}

body.table-mode #gui-bid-grid button[data-call$="H"],body.table-mode #gui-bid-grid button[data-call$="D"]{color:#a92e34}

body.table-mode .call-alert-entry .alerttoggle input{padding:0;margin:0;flex:0 0 22px}
body.table-mode #bidbox.full-bidding .alert-label-tail{display:block}

/* Review round 3: readable text and optional visual guidance, never card authority. */
body.table-mode[data-legal-highlight=off] #app .diagramrank.play{background:transparent;border-color:transparent;box-shadow:none}
body.table-mode[data-legal-highlight=off] #app .card.play{outline:none;background:#fffdf7;border-color:#b9b9b4;box-shadow:0 1px 3px rgba(0,0,0,.24)}
body.table-mode[data-legal-highlight=off] #app :is(.diagramrank.play,.card.play):focus-visible{outline:3px solid var(--gui-accent);outline-offset:2px}
body.table-mode #gui-systems button{background:var(--gui-soft);color:var(--gui-ink);border:2px solid var(--gui-accent);border-radius:7px;padding:6px 12px;min-height:44px;font:700 var(--gui-font)/1.2 var(--gui-face),system-ui}
body.table-mode .centerinfo,body.table-mode .centerinfo :is(.cap,.big,.small){font-size:var(--gui-font);line-height:1.35}
body.table-mode .auction{font-size:var(--gui-font)}
body.table-mode .auction :is(th,td,button){font-size:inherit}
body.table-mode .call-alert-entry .alerttoggle{font-size:16.9px}
@media(max-width:700px){body.table-mode #app .nameplate,body.table-mode #topbar button{font-size:var(--gui-font)}}

body.table-mode #bidbox.full-bidding .call-alert-entry{grid-template-columns:minmax(0,1fr) 155px}
body.table-mode :is(.matchwaiting,.matchwaiting small,.centerinfo .sub,.centerinfo .dealscore){font-size:var(--gui-font);line-height:1.35}
body.table-mode .centerinfo .big{font-size:39px}

/* Same seat node survives polls: five-second reminder never restarts on an unchanged turn. */
@keyframes gui-turn-reminder{0%,60%,100%{outline-color:#e5c34b;outline-width:3px;box-shadow:0 0 0 0 #e5c34b00}30%{outline-color:#fff4a8;outline-width:8px;box-shadow:0 0 12px 6px #e5c34baa}}
body.table-mode #app .seat.turn-due{outline:3px solid #e5c34b;outline-offset:3px;border-radius:9px;animation:gui-turn-reminder 5s ease-in-out infinite}
@media(prefers-reduced-motion:reduce){body.table-mode #app .seat.turn-due{animation:none}}

/* The active-turn cue belongs to the player name panel. Keep it visible even
   when the surrounding seat is neutralised by the fit-layout rules above. */
@keyframes gui-nameplate-turn{0%,60%,100%{border-color:#d2a72a;box-shadow:0 0 0 2px #735d18,0 0 0 0 #e5c34b00}30%{border-color:#fff4a8;box-shadow:0 0 0 4px #735d18,0 0 16px 6px #e5c34b99}}
body.table-mode #app .nameplate[aria-current=true]{border-color:#d2a72a;outline:0;box-shadow:0 0 0 2px #735d18;animation:gui-nameplate-turn 5s ease-in-out infinite}
@media(prefers-reduced-motion:reduce){body.table-mode #app .nameplate[aria-current=true]{animation:none}}

/* v5.9.2 pilot feedback: make the end-of-deal continuation action unmistakable. */
@keyframes gui-continue-reminder{
  0%,60%,100%{background:#fff6d8;border-color:#d2a72a;box-shadow:0 0 0 0 #e5c34b00}
  30%{background:#fff0ad;border-color:#e5c34b;box-shadow:0 0 0 6px #e5c34b55,0 0 18px 7px #e5c34b66}
}

body.table-mode #app .felt .result-advance{
  background:#fff6d8;color:#142820;border:3px solid #d2a72a;border-radius:10px;
  animation:gui-continue-reminder 6s ease-in-out infinite;cursor:pointer
}
body.table-mode #app .felt .result-advance:hover,
body.table-mode #app .felt .result-advance:focus-visible{background:#fff0ad;outline:4px solid #fff;outline-offset:3px}
@media(prefers-reduced-motion:reduce){body.table-mode #app .felt .result-advance{animation:none}}

/* ENH-176: quiet legal-card tint; keyboard focus stays explicit. */
body.table-mode #app .card.play{outline:none;border-color:#c9c3ad;background:#fff9e8;box-shadow:0 1px 3px #0002,0 0 7px #e5c34b30}
body.table-mode #app .card.play:hover{box-shadow:0 1px 4px #0002,0 0 9px #e5c34b50}
body.table-mode #app .diagramrank.play{border-color:transparent;background:#fff4cf;box-shadow:none}
body.table-mode #app :is(.card.play,.diagramrank.play):focus-visible{outline:3px solid var(--gui-accent);outline-offset:2px}
body.table-mode[data-legal-highlight=off] #app .card.play{background:#fffdf7;border-color:#b9b9b4;box-shadow:0 1px 3px rgba(0,0,0,.24)}
body.table-mode[data-legal-highlight=off] #app .diagramrank.play{background:transparent}
@media(forced-colors:active){body.table-mode #app :is(.card.play,.diagramrank.play){outline:1px dashed Highlight}body.table-mode #app :is(.card.play,.diagramrank.play):focus-visible{outline:3px solid Highlight}body.table-mode[data-legal-highlight=off] #app :is(.card.play,.diagramrank.play):not(:focus-visible){outline:none}}

/* ENH-187 component layout. Text establishes intrinsic height; no fixed rank rows. */
body.table-mode #topbar{min-height:50px;padding:5px 10px}
body.table-mode #topbar .topbar-brand img{width:56px;height:38px}
body.table-mode #topbar button{min-height:36px;padding:5px 9px}
#table-workspace{display:contents}#table-controls{display:none}
body.table-mode #app.on:has(.felt[data-fit-layout]){position:fixed;inset:0;padding:calc(var(--table-header-bottom,var(--topbar-clearance)) + 6px) 6px 6px;overflow:hidden}
body.table-mode #table-workspace[data-active=true]{display:grid;grid-template-columns:180px minmax(0,1fr);gap:6px;height:100%;min-height:0}
body.table-mode #table-workspace[data-active=true][data-phase=bidding]{grid-template-columns:260px minmax(0,1fr)}
body.table-mode #table-workspace[data-active=true] #table-controls{display:flex;flex-direction:column;gap:8px;min-height:0;overflow:auto;padding:3px;background:var(--gui-surface);border-radius:8px;color:var(--gui-ink)}
body.table-mode #table-controls #board-panel{display:block;position:static;max-width:100%;width:100%;padding:6px;border:0;border-radius:4px;font-size:var(--gui-font)}
body.table-mode #table-controls #board-panel .boardheadline{display:flex;flex-direction:row;flex-wrap:wrap;gap:4px;font-size:.8em;margin:0}
body.table-mode #table-controls #board-panel .contractline{width:100%;font-size:1em;padding:5px 0;min-height:0;white-space:normal}
body.table-mode #table-controls .gui-dealer{width:auto;font-size:inherit}
body.table-mode #table-controls .tricksummary{margin:0;display:flex;justify-content:center}
body.table-mode #table-controls .tricksummary button{padding:2px 6px;min-height:28px;font-size:18px}
body.table-mode #table-controls .panel-vulnerability{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:5px 7px;border-radius:5px;font-size:.85em;font-weight:700}
body.table-mode #table-controls .panel-vulnerability.nonvulnerable{background:#fff;color:#1e2b29}
body.table-mode #table-controls .panel-vulnerability.vulnerable{background:#b8322a;color:#fff}
body.table-mode #table-controls .partnershipclock strong{color:var(--gui-ink)}
body.table-mode #table-controls #gui-play-actions{display:flex;flex-direction:column;padding:0;gap:5px;align-self:stretch}
body.table-mode #table-controls #gui-play-actions button{font:600 var(--gui-font)/1.2 var(--gui-face),system-ui;min-height:34px;padding:5px 7px;width:100%;white-space:normal}
body.table-mode #table-controls #director-call-region{display:flex;flex-direction:column;margin:0;padding:0;border:0;gap:4px}
body.table-mode #table-controls #director-call-region span{display:none}
.director-private-slot[hidden]{display:none}
.director-private-slot{display:grid;gap:3px;padding:5px;border:1px solid #82958b;border-radius:5px;background:#eef3f1;color:#17231f}
.director-private-slot p{margin:0;overflow-wrap:anywhere;max-height:3.5em;overflow:hidden}
.director-private-slot button{min-height:40px}
#director-private-transcript{display:grid;gap:3px;max-height:45vh;overflow-y:auto;padding:4px;border:1px solid #82958b}
#director-private-transcript p{margin:0;padding:3px;background:#eef3f1;overflow-wrap:anywhere}
body.table-mode #table-controls #bidbox{position:static;transform:none;width:100%;max-height:none;padding:6px;border:0;box-shadow:none;order:1}
body.table-mode #table-controls .bid{min-height:34px;padding:3px;font-size:var(--gui-font)}
body.table-mode #table-controls .bidprimary .level{min-width:24px}
body.table-mode #table-controls .call-alert-entry{display:flex;flex-direction:column;align-items:stretch}
body.table-mode #table-controls #bid-alert-note{height:auto;min-height:58px;line-height:1.3;padding:7px;resize:vertical}
body.table-mode #app .felt[data-fit-layout]{display:grid;position:relative;min-width:0;max-width:none;width:100%;min-height:0;height:100%;margin:0;padding:4px;gap:4px;border-radius:8px;box-shadow:none;
 grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:auto minmax(0,1fr) auto;
 grid-template-areas:'. top .' 'left mid right' 'bottom bottom bottom';align-content:stretch;overflow:visible}
body.table-mode #app .felt[data-fit-layout=bidding]{grid-template-columns:minmax(0,1fr) minmax(220px,1.5fr) minmax(0,1fr);grid-template-areas:'. top .' 'left auction right' 'bottom bottom bottom'}
body.table-mode #app .felt[data-fit-layout=play][data-dummy='2']{grid-template-areas:'top top top' 'left mid right' 'bottom bottom bottom'}
body.table-mode #app .felt[data-fit-layout=play][data-dummy='1']{grid-template-columns:minmax(0,1.4fr) minmax(0,1fr) minmax(0,.4fr)}
body.table-mode #app .felt[data-fit-layout=play][data-dummy='3']{grid-template-columns:minmax(0,.4fr) minmax(0,1fr) minmax(0,1.4fr)}
body.table-mode #app .felt[data-fit-layout] .seat{width:max-content;max-width:100%;min-width:0;min-height:0;padding:0;border:0;gap:0;align-self:center;justify-self:center;border-radius:4px}
body.table-mode #app .felt[data-fit-layout] #seat-0{align-self:end}
body.table-mode #app .felt[data-fit-layout] #seat-2{align-self:start}
body.table-mode #app .felt[data-fit-layout] .plate-slot{width:100%;max-width:100%;min-width:0}
body.table-mode #app .felt[data-fit-layout] .nameplate{min-height:0;max-width:100%;padding:2px 4px;border:1px solid var(--gui-line);border-radius:3px;gap:4px;font-size:var(--gui-font);line-height:1.15;white-space:nowrap;overflow:hidden}
body.table-mode #app .felt[data-fit-layout] .nameplate .player-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
body.table-mode #app .felt[data-fit-layout] .nameplate .pos{display:grid;align-self:stretch;min-width:1.7em;place-items:center;margin:-2px 0 -2px -4px;color:#fff;background:#185b4c;font-size:calc(var(--gui-font) + 5px);line-height:1}
body.table-mode #app .felt[data-fit-layout] .nameplate.vulnerable-seat .pos{background:#a9221b}
body.table-mode #app .felt[data-fit-layout] :is(#seat-1,#seat-3){width:100%}
body.table-mode #app .felt[data-fit-layout] :is(#seat-1,#seat-3) .nameplate{
  width:100%;min-width:140px;padding:2px 4px;gap:4px;font-size:max(calc(var(--gui-font) - 2px),15px);line-height:1.05;
  white-space:nowrap;overflow:hidden;text-align:left}
body.table-mode #app .felt[data-fit-layout] :is(#seat-1,#seat-3) .player-name{
  min-width:0;flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
  overflow-wrap:normal;word-break:normal}
body.table-mode #app .felt[data-fit-layout] .hand-slot{display:block;width:max-content;max-width:100%;min-width:0;min-height:0;overflow:visible}
body.table-mode #app .felt[data-fit-layout] .seat:not(.fit-visible-hand) .hand-slot{display:none}
body.table-mode #app .felt[data-fit-layout] .diagramhand{display:flex;flex-direction:column;width:max-content;max-width:100%;min-width:0;min-height:0;height:auto;gap:0;padding:3px 5px;border:0;border-radius:0 0 3px 3px;box-shadow:none}
body.table-mode #app .felt[data-fit-layout] .diagramrow{height:auto;min-height:0;flex-shrink:0;flex-wrap:wrap;align-items:center;gap:0;overflow:visible;line-height:1.15}
body.table-mode #app .felt[data-fit-layout] .diagramrank{font-family:var(--gui-face),system-ui,sans-serif;font-weight:600;height:auto;max-height:none;min-height:1.25em;line-height:1.25;min-width:.66em;padding:0 1px;border-width:0;flex:0 0 auto;letter-spacing:0}
body.table-mode #app .felt[data-fit-layout] .diagramrow .slbl{width:auto;flex:0 0 .95em;font-size:var(--gui-rank);line-height:1.25}
body.table-mode #app .felt[data-fit-layout] .diagramvoid{height:auto;min-height:1.25em;line-height:1.25;font-size:var(--gui-rank)}
body.table-mode #app .felt[data-fit-layout] .system-info{padding:0 3px;min-height:24px;font:600 14px/1 system-ui;border:0;border-radius:3px;margin-left:3px}
body.table-mode #app .felt[data-fit-layout] #gui-systems{display:none}
body.table-mode #app .felt[data-fit-layout=bidding] #mid{display:none}
body.table-mode #app .felt[data-fit-layout] #mid{min-height:0;min-width:0;overflow:visible}
body.table-mode #app .felt[data-fit-layout=bidding] #auction-panel{position:static;transform:none;grid-area:auction;width:100%;min-width:0;max-width:320px;max-height:none;overflow:visible;padding:4px;justify-self:center;align-self:center;border:0;border-radius:4px}
body.table-mode #app .felt[data-fit-layout=bidding] .auction :is(th,td){padding:2px 3px;line-height:1.2}
body.table-mode #app .felt[data-fit-layout=play] #auction-panel.play-open{position:absolute;transform:none;max-width:none;width:300px;max-height:90%;overflow:auto;z-index:20}
body.table-mode #table-controls #auction-panel{position:static;transform:none;min-width:0;max-width:100%;font-size:16px;padding:3px;overflow:auto;order:2}
/* Compact suit/rank tiles in Diagram mode, retaining card DOM/action semantics. */
body.table-mode #app .felt[data-fit-layout][data-fit-cards=diagram] .trickpad{width:180px;height:calc(var(--gui-rank)*3.75 + 12px);min-height:0}
body.table-mode #app .felt[data-fit-layout][data-fit-cards=diagram] .trickpad .card{width:76px;height:auto;min-height:calc(var(--gui-rank)*1.25 + 4px);padding:2px;border:0;border-radius:4px}
body.table-mode #app .felt[data-fit-layout][data-fit-cards=diagram] .trickpad .card .idx{position:static;display:flex;flex-direction:row;justify-content:center;align-items:center;gap:3px;line-height:1.25;transform:none}
body.table-mode #app .felt[data-fit-layout][data-fit-cards=diagram] .trickpad .card .idx :is(.ir,.is){font-size:var(--gui-rank);line-height:1.25}
body.table-mode #app .felt[data-fit-layout][data-fit-cards=diagram] .trickpad .pips{display:none}
body.table-mode #app .felt[data-fit-layout][data-fit-cards=diagram] .trickpad .p0{left:50%;top:auto;bottom:0;transform:translateX(-50%)}
body.table-mode #app .felt[data-fit-layout][data-fit-cards=diagram] .trickpad .p2{left:50%;top:0;transform:translateX(-50%)}
body.table-mode #app .felt[data-fit-layout][data-fit-cards=diagram] .trickpad .p1{left:0;top:50%;transform:translateY(-50%)}
body.table-mode #app .felt[data-fit-layout][data-fit-cards=diagram] .trickpad .p3{left:auto;right:0;top:50%;transform:translateY(-50%)}
body.table-mode #app .felt[data-fit-layout][data-fit-cards=cards] .hand.horizontal{flex-wrap:wrap;gap:0;justify-content:center}
body.table-mode #app .felt[data-fit-layout][data-fit-cards=cards] .hand.horizontal .card+.card{margin-left:0}
body.table-mode #app .felt[data-fit-layout][data-fit-cards=cards] .suits.hand{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:3px}
body.table-mode #app .felt[data-fit-layout][data-fit-cards=cards] .suitrow{flex-wrap:wrap;gap:0}
body.table-mode #app .felt[data-fit-layout][data-fit-cards=cards] .card{min-height:calc(var(--gui-rank)*2.2 + 20px)}
body.table-mode #app .felt[data-fit-layout][data-fit-cards=cards] .card .idx,body.table-mode #app .felt[data-fit-layout][data-fit-cards=cards] .card .idx :is(.ir,.is){line-height:1.1}
body.table-mode #app .felt[data-fit-layout][data-fit-cards=cards] #seat-2{grid-column:1/-1}
body.table-mode #table-notices{position:static;display:flex;flex:0 0 auto;flex-direction:column;gap:6px;width:100%;max-height:min(40%,260px);overflow:auto;overscroll-behavior:contain}
body.table-mode #table-notices:empty{display:none}
body.table-mode #table-notices :is(#undo-status,#table-feedback){position:static;flex:none;min-width:0;margin:0;padding:5px 8px;font:16px/1.3 system-ui;visibility:visible;max-width:100%}
body.table-mode #table-notices :is(#undo-status,#table-feedback)[hidden]{display:none}
body.table-mode #table-notices p{font:inherit;margin:3px 0}
body.table-mode #table-notices button{font:600 16px/1.2 system-ui;min-height:32px;padding:5px 8px}
#gui-system-edit{display:none}body.table-mode #gui-system-edit:not([hidden]){display:block}
@media(max-width:900px){body.table-mode #table-workspace[data-active=true]{grid-template-columns:150px minmax(0,1fr)}body.table-mode #table-workspace[data-active=true][data-phase=bidding]{grid-template-columns:235px minmax(0,1fr)}}

/* Keep the exposed dummy's ranks at the viewing hand's size through laptop
   widths. A long suit wraps within its own hand area; shrinking only the dummy
   caused the 1015px desktop regression and a font jump at 1000px. */
@media (min-width:901px) and (max-width:1100px) and (max-height:650px){
  body.table-mode #app .felt[data-fit-layout=play] :is(#seat-0,#seat-2) .diagramhand{padding:3px 5px}
  body.table-mode #app .felt[data-fit-layout=play] :is(#seat-0,#seat-2) .diagramrow{min-height:24px}
  body.table-mode #app .felt[data-fit-layout=play] :is(#seat-0,#seat-2) .diagramrow .slbl{width:22px;flex-basis:22px;font-size:18px}
  body.table-mode #app .felt[data-fit-layout=play] :is(#seat-0,#seat-2) .diagramrank{min-height:24px;font-size:20px;line-height:1.1}
}

/* Owner review correction: use available width; scroll instead of suppressing play. */
body.table-mode #table-workspace[data-active=true],body.table-mode #table-workspace[data-active=true][data-phase=bidding]{grid-template-columns:180px minmax(0,1fr);grid-template-rows:minmax(0,1fr);overflow:auto;align-items:start}
body.table-mode #table-workspace[data-active=true] #table-controls{height:100%;max-height:100%;min-width:0;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable}
body.table-mode #table-controls>*{flex-shrink:0}
body.table-mode #app .felt[data-fit-layout]{grid-template-areas:'top top top' 'left mid right' 'bottom bottom bottom';grid-template-rows:auto minmax(170px,1fr) auto;min-height:min-content;align-self:stretch}
body.table-mode #app .felt[data-fit-layout=bidding]{grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:auto minmax(240px,1fr) auto}
body.table-mode #app .felt[data-fit-layout] :is(#seat-0,#seat-2){width:max-content;max-width:none;grid-column:1/-1;align-items:flex-start;justify-self:center}
body.table-mode #app .felt[data-fit-layout] .fit-visible-hand{position:relative;z-index:4}
body.table-mode #app .felt[data-fit-layout] #mid{z-index:2}
body.table-mode #app .felt[data-fit-layout] :is(#seat-0,#seat-2) .hand-slot,
body.table-mode #app .felt[data-fit-layout] :is(#seat-0,#seat-2) .diagramhand{max-width:none;width:max-content}
body.table-mode #app .felt[data-fit-layout] :is(#seat-0,#seat-2) .diagramrow{flex-wrap:nowrap}
body.table-mode #app .felt[data-fit-layout] .diagramrow.action-candidate-row{position:relative;z-index:9}
body.table-mode #app .felt[data-fit-layout] .diagramrank.action-candidate{
  color:transparent;background:transparent;border-color:transparent;box-shadow:none;
  overflow:visible;isolation:isolate
}
body.table-mode #app .felt[data-fit-layout] .diagramrank.action-candidate::after{
  content:attr(data-card-label);position:absolute;left:0;top:50%;z-index:10;
  box-sizing:border-box;display:grid;place-items:center;
  width:calc(var(--gui-rank) * 1.9);height:calc(var(--gui-rank) * 1.5);
  transform:translateY(-50%);padding:1px 4px;border:3px solid #8a6b00;border-radius:7px;
  background:#fff0a2;color:#17222b;box-shadow:0 0 0 3px #fff,0 4px 12px #0006;
  font:800 calc(var(--gui-rank) * 1.3)/1 Georgia,serif;pointer-events:auto
}
body.table-mode #app .felt[data-fit-layout] .diagramrow:has(.slbl.red) .diagramrank.action-candidate::after{color:#a92e34}
body.table-mode #app .felt[data-fit-layout] .diagramrank.action-candidate:focus-visible{outline:none}
body.table-mode #app .felt[data-fit-layout] .diagramrank.action-candidate:focus-visible::after{
  outline:3px solid #173f7a;outline-offset:3px
}
body.table-mode #app .felt[data-fit-layout] .diagramrank.action-candidate~.diagramrank{
  transform:translateX(calc(var(--gui-rank) * 1.25))
}
/* In a shallow landscape viewport, ranks can wrap under each other.  Keep the
   enlarged selected face within its own row's height so the next rank remains
   an independent pointer target. */
@media(max-height:560px) and (min-width:1001px){
  body.table-mode #app .felt[data-fit-layout] .diagramrank.action-candidate::after{
    height:100%;font-size:calc(var(--gui-rank) * .55)
  }
  body.table-mode #app .felt[data-fit-layout] .diagramrank.action-candidate~.diagramrank{
    transform:translateX(calc(var(--gui-rank) * 1.5))
  }
  body.table-mode #app .felt[data-fit-layout=bidding] #auction-panel table.auction :is(th,td){
    padding:0 2px;line-height:1
  }
  body.table-mode #app .felt[data-fit-layout=bidding] #auction-panel table.auction .alertchip{
    min-height:20px
  }
}
/* Side seats must not expand to fill the asymmetric dummy column.  A full-width
   RHO seat starts near the centre when RHO is dummy, stretching its header and
   dragging the hand with it.  Keep both side seats compact and anchor their
   contents against their respective felt edges. */
body.table-mode #app .felt[data-fit-layout] :is(#seat-1,#seat-3){max-width:100%;align-items:flex-start}
body.table-mode #app .felt[data-fit-layout] #seat-1{width:min(var(--fit-left-seat-width,230px),100%)}
body.table-mode #app .felt[data-fit-layout] #seat-3{width:min(var(--fit-right-seat-width,230px),100%)}
body.table-mode #app .felt[data-fit-layout] #seat-1{justify-self:start;align-items:flex-start}
body.table-mode #app .felt[data-fit-layout] #seat-3{justify-self:end;align-items:flex-end}
body.table-mode #app .felt[data-fit-layout=play][data-dummy='1']{grid-template-columns:var(--fit-left-seat-width,230px) 190px minmax(150px,1fr)}
body.table-mode #app .felt[data-fit-layout=play][data-dummy='3']{grid-template-columns:minmax(150px,1fr) 190px var(--fit-right-seat-width,230px)}
body.table-mode #app .felt[data-fit-layout=bidding] :is(#seat-1,#seat-3){align-self:start;margin-top:6px}
body.table-mode #app .felt[data-fit-layout=bidding] #bidbox{position:absolute;transform:none;grid-area:auto;max-width:none;padding:7px;max-height:none;overflow:visible;z-index:3}
body.table-mode #app .felt[data-fit-layout=bidding] #auction-panel{position:absolute;transform:none;grid-area:auto;max-width:none;max-height:none;overflow:visible;z-index:2}
body.table-mode #app .felt[data-auction-placement=quadrant] #seat-0{justify-self:start;margin-left:8px}
body.table-mode #app .felt[data-fit-layout=bidding] .bid{min-height:34px;padding:3px}
body.table-mode #app .felt[data-fit-layout=bidding] .bidprimary :is(.dbl,.rdbl){min-height:44px}
body.table-mode #app .felt[data-fit-layout=bidding] .call-alert-entry{grid-template-columns:minmax(0,1fr) auto;gap:4px}
body.table-mode #app .felt[data-fit-layout=bidding] #bid-alert-note{min-height:36px;height:auto;padding:4px;line-height:1.2}
body.table-mode #topbar{flex-wrap:wrap;height:auto}
body.table-mode #topbar>*{min-width:0}
@media(max-width:900px){body.table-mode #table-workspace[data-active=true],body.table-mode #table-workspace[data-active=true][data-phase=bidding]{grid-template-columns:150px minmax(0,1fr)}}
body.table-mode #app .felt[data-fit-layout=bidding] #bidbox .cap{margin-bottom:5px;letter-spacing:.04em}
body.table-mode #app .felt[data-fit-layout=bidding] .bidstrains{min-height:34px;margin-top:0;padding:0}
body.table-mode #app .felt[data-fit-layout=bidding] .bidprimary{padding:0;gap:3px;overflow:visible}
body.table-mode #app .felt[data-fit-layout=bidding] .bidprimary .level{min-width:24px;flex:1 0 24px}
/* BUG-345: flexible wrapping stretches the final row of numbered levels. */
@media(min-width:561px) and (min-height:561px){
  body.table-mode #app .felt[data-fit-layout=bidding] .bidcontrols{grid-template-rows:auto auto}
  body.table-mode #app .felt[data-fit-layout=bidding] .bidprimary{
    display:grid;grid-template-columns:repeat(7,minmax(0,1fr));grid-template-rows:44px 44px
  }
  body.table-mode #app .felt[data-fit-layout=bidding] .bidprimary .pass{grid-column:1/3;grid-row:1;justify-self:start;width:min(100%,72px);min-width:0}
  body.table-mode #app .felt[data-fit-layout=bidding] .bidprimary :is(.dbl,.rdbl){grid-column:3/5;grid-row:1;justify-self:start;width:min(100%,72px);min-width:0}
  body.table-mode #app .felt[data-fit-layout=bidding] .bidprimary .level{grid-row:2;min-width:0;width:100%;flex:none}
  body.table-mode #app .felt[data-fit-layout=bidding] .bidprimary .level[data-level="1"]{grid-column:1}
  body.table-mode #app .felt[data-fit-layout=bidding] .bidprimary .level[data-level="2"]{grid-column:2}
  body.table-mode #app .felt[data-fit-layout=bidding] .bidprimary .level[data-level="3"]{grid-column:3}
  body.table-mode #app .felt[data-fit-layout=bidding] .bidprimary .level[data-level="4"]{grid-column:4}
  body.table-mode #app .felt[data-fit-layout=bidding] .bidprimary .level[data-level="5"]{grid-column:5}
  body.table-mode #app .felt[data-fit-layout=bidding] .bidprimary .level[data-level="6"]{grid-column:6}
  body.table-mode #app .felt[data-fit-layout=bidding] .bidprimary .level[data-level="7"]{grid-column:7}
}
body.table-mode #app .felt[data-fit-layout=bidding] .call-alert-entry{margin-top:5px;padding-top:4px}
body.table-mode #app .felt[data-fit-layout=bidding] .call-alert-entry .alerttoggle{min-height:26px}

/* Stable own-hand anchor throughout bidding; only surrounding panels adapt. */
body.table-mode #app .felt[data-fit-layout=bidding]{min-height:0;grid-template-rows:auto minmax(0,1fr)}
body.table-mode #app .felt[data-fit-layout=bidding] #seat-0{position:absolute;left:8px;bottom:8px;top:auto;right:auto;transform:none;margin:0}
body.table-mode #app .felt[data-fit-layout=bidding] :is(#bidbox,#auction-panel){overscroll-behavior:contain}
body.table-mode #app .felt[data-fit-layout=bidding] #bidbox{overflow:auto}
body.table-mode #app .felt[data-fit-layout=bidding] #auction-panel{
  overflow-x:hidden;overflow-y:auto;scrollbar-gutter:stable}
body.table-mode #app .felt[data-fit-layout=bidding] table.auction th{
  height:22px;padding:1px 3px;font-size:15px;line-height:1}
body.table-mode #app .felt[data-fit-layout=bidding] table.auction td{
  height:30px;padding:1px 3px;line-height:1}
body.table-mode #app .felt[data-fit-layout=bidding] table.auction .auctioncall{min-height:28px}
body.table-mode #app .felt[data-fit-layout=bidding] table.auction .alertchip{
  min-width:32px;min-height:28px;padding:1px 3px}
body.table-mode #auction-panel table.auction{border-collapse:separate;border-spacing:0}
body.table-mode #app .felt[data-fit-layout=bidding] #auction-panel .cap{
  position:sticky;top:0;z-index:5;display:flex;align-items:center;justify-content:center;
  height:32px;min-height:32px;margin-bottom:0;background:var(--gui-surface)}
body.table-mode #auction-panel table.auction thead th{
  position:sticky;top:32px;z-index:4;background:var(--gui-soft);
  box-shadow:0 1px 0 var(--gui-line)}
body.table-mode #auction-panel table.auction thead th.vulnerable{background:#a9221b;color:#fff}
body.table-mode #auction-panel:focus-visible{outline:3px solid var(--gui-accent);outline-offset:-3px}

/* Adaptive trick presentation is independent of hand/font layout. */
body.table-mode #app .felt[data-fit-layout=play][data-trick-layout=adaptive] #mid{position:absolute;grid-area:auto;left:var(--trick-x);top:var(--trick-y);width:var(--trick-width);height:var(--trick-height);transform:none;margin:0;padding:0;display:flex;align-items:center;justify-content:center}
body.table-mode #app .felt[data-fit-layout=play][data-trick-layout=adaptive] .trickpad{width:var(--trick-width);height:var(--trick-height);flex:none}
body.table-mode #app .felt[data-trick-layout=adaptive][data-fit-cards=diagram] .trickpad .card{width:calc(76px * var(--trick-scale));min-height:calc((var(--gui-rank)*1.25 + 4px) * var(--trick-scale));padding:2px}
body.table-mode #app .felt[data-trick-layout=adaptive][data-fit-cards=diagram] .trickpad .card .idx :is(.ir,.is){font-size:calc(var(--gui-rank) * var(--trick-scale))}
body.table-mode #app .felt[data-trick-layout=adaptive][data-fit-cards=cards] .trickpad .card{width:calc(54px * var(--gui-scale) * var(--trick-scale));height:calc(78px * var(--gui-scale) * var(--trick-scale));min-height:calc((var(--gui-rank)*2.2 + 20px) * var(--trick-scale));--card-rank-size:calc(var(--gui-rank) * var(--trick-scale));--card-suit-size:calc((var(--gui-rank) + 3px) * var(--trick-scale))}
body.table-mode #app .felt[data-trick-layout=adaptive] #mid :is(.pausebar,.takeovernotice){position:absolute;left:0;right:0;top:calc(100% + 4px);font-size:var(--gui-font);text-align:center}

/* One chosen face for live-table ranks, played cards and interface text. */
body.table-mode{--sans:var(--gui-face),system-ui,sans-serif;--font-ui:var(--sans);--card-font:var(--sans);--font-card:var(--sans)}
body.table-mode :is(.nameplate .pos,.system-info,#table-notices,#table-notices button){font-family:var(--sans)}

/* Completed deals retain the same separate, scrollable controls column. */
body.table-mode #table-controls :is(.centerinfo,.matchwaiting){order:1;position:static;width:100%;max-width:100%;padding:10px 4px;color:var(--gui-ink);background:var(--gui-soft);border-radius:6px;overflow-wrap:anywhere;font:600 var(--gui-font)/1.3 var(--sans)}
body.table-mode #table-controls :is(.centerinfo .big,.centerinfo .dealscore){font:600 var(--gui-font)/1.3 var(--sans);margin:6px 0}
body.table-mode #table-controls :is(.centerinfo .sub,.matchwaiting small){display:block;color:var(--gui-ink);font:400 .85em/1.4 var(--sans);margin-top:8px}
body.table-mode #table-controls :is(.result-advance,.matchscoresprompt):focus-visible{outline:3px solid var(--gui-accent);outline-offset:-3px}

/* Completion status is a central felt surface; the left rail is reserved for board and actions. */
body.table-mode #app .felt[data-fit-layout] #mid>:is(.centerinfo,.matchwaiting){
  position:relative;z-index:5;box-sizing:border-box;width:min(420px,92%);max-width:92%;
  padding:14px 18px;border:3px solid var(--brass);border-radius:10px;
  background:var(--gui-surface);color:var(--gui-ink);box-shadow:0 5px 18px #0004;
  text-align:center;overflow-wrap:anywhere
}
body.table-mode #app .felt[data-fit-layout] #mid>.matchwaiting{font:900 clamp(20px,3vw,36px)/1.2 var(--sans)}
body.table-mode #app .felt[data-fit-layout] #mid>.matchwaiting small{color:var(--gui-ink)}
body.table-mode #app .felt[data-fit-layout] #mid>.matchscoresprompt{background:#f8e3a4;color:#142820;cursor:pointer}

body.table-mode #board-panel .board-diagram{display:block;width:112px;max-width:100%;height:auto;margin:0 auto 5px;font-family:var(--sans)}
.board-diagram text{text-anchor:middle;font-size:10px;font-weight:600}
.board-diagram .board-number{font-size:29px;font-weight:500;fill:#182d25}

/* Information above, commands anchored below when the panel has spare height. */
body.table-mode #table-controls #gui-play-actions{order:2;margin-top:auto;padding-top:12px;border-top:1px solid var(--gui-line);gap:6px}

/* Owner-approved compass anchors, independent of auction length. */
body.table-mode #app .felt[data-fit-layout=bidding] #seat-0{left:50%;bottom:8px;transform:translateX(-50%)}
body.table-mode #app .felt[data-fit-layout=bidding] #seat-2{position:absolute;left:50%;top:8px;transform:translateX(-50%);margin:0}
body.table-mode #app .felt[data-fit-layout=bidding] :is(#seat-1,#seat-3){position:absolute;top:50%;transform:translateY(-50%);margin:0;max-width:calc((100% - var(--bidding-centre-width,430px))/2 - 18px)}
body.table-mode #app .felt[data-fit-layout=bidding] #seat-1{left:8px}
body.table-mode #app .felt[data-fit-layout=bidding] #seat-3{right:8px}
body.table-mode #app .felt[data-fit-layout=bidding][data-auction-placement=beside] :is(#seat-1,#seat-3){top:var(--bidding-side-header-top,48px);transform:none}

body.table-mode #app .felt[data-fit-layout=bidding] :is(#seat-0,#seat-1,#seat-2,#seat-3){grid-area:auto}

body.table-mode #app .felt[data-fit-layout=bidding] #auction-panel{min-height:0}

/* A play-phase auction opened over the opposite hand belongs in the central
   gap.  Keep it away from both the viewer and dummy hands on narrow screens. */
body.table-mode #app .felt[data-fit-layout=play] #auction-panel.auctionpanel.play-open.avoid-top{
  position:fixed;left:50%;right:auto;top:50%;transform:translate(-50%,-50%)}
body.table-mode #app .felt[data-fit-layout=play] #contract-auction{
  position:relative;z-index:1001}
/* The disclosure is an overlay; its controls remain interactive while its
   empty surface never blocks the contract toggle underneath. */
body.table-mode #app .felt[data-fit-layout=play] #auction-panel.play-open{pointer-events:none}
body.table-mode #auction-panel.play-open{pointer-events:none}
body.table-mode #auction-panel.play-open .auctionclose,
body.table-mode #auction-panel.play-open button,
body.table-mode #auction-panel.play-open a,
body.table-mode #auction-panel.play-open [role="button"],
body.table-mode #auction-panel.play-open :is(input,select,textarea,label){pointer-events:auto}

.board-diagram .board-dealer{font-size:8px;font-weight:900}
.board-diagram .board-vulnerability{font-size:6px;font-weight:800;text-anchor:middle;fill:#182d25}

/* Keep the full deal-sized envelope shared by each player label and hand. */
body.table-mode #app .felt[data-fit-layout] .hand-slot:has(.diagramhand),
body.table-mode #app .felt[data-fit-layout] .diagramhand{min-width:100%}
body.table-mode #app .felt[data-fit-layout] :is(#seat-1,#seat-3) .hand-slot,
body.table-mode #app .felt[data-fit-layout] :is(#seat-1,#seat-3) .diagramhand{
  box-sizing:border-box;width:100%;min-width:100%;max-width:100%
}

/* ENH-187 guardrail: the command rail is a real column beside the felt.
   Keep it outside the felt grid so the LHO seat can never be displaced into it. */
body.table-mode #app.on{
  display:grid;
  grid-template-columns:180px minmax(0,1fr);
  gap:8px;
  align-items:stretch;
}

/* The semantic information role is distinct from player cards and the
   communication rail. It is shared by auction, bidding and Board controls. */
body.table-mode :is(#auction-panel,#bidbox),
body.table-mode #table-controls #board-panel{
  background:var(--table-v2-information);
  color:var(--table-v2-information-ink);
}

/* Owner-review correction: Manage Table follows the account font preference
   and uses compact bounded controls instead of full-width selectors. */
body.table-mode .sheet.manage-table-dialog,
body.table-mode .sheet.manage-table-dialog :is(h2,p,label,span,button,select){
  font-family:var(--gui-face),system-ui,sans-serif;
  font-size:var(--gui-font);
}
body.table-mode .sheet.manage-table-dialog{width:min(760px,calc(100vw - 32px));max-height:calc(100dvh - 32px);overflow:auto}
body.table-mode .sheet.manage-table-dialog h2{font-size:1.3em}
body.table-mode .sheet.manage-table-dialog .scoreline{align-items:center;gap:16px;font-family:inherit;font-size:inherit}
body.table-mode .sheet.manage-table-dialog .manage-setting-row{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center}
body.table-mode .sheet.manage-table-dialog .manage-setting-row select{justify-self:end;width:11ch;min-width:0;max-width:100%;font-size:inherit}
body.table-mode .sheet.manage-table-dialog #best-hand-seat{width:9ch}
body.table-mode .sheet.manage-table-dialog #trick-delay{width:11ch}
@media(max-width:700px){
 body.table-mode .sheet.manage-table-dialog,
 body.table-mode .sheet.manage-table-dialog :is(h2,p,label,span,button,select){font-size:var(--gui-font)}
 body.table-mode .sheet.manage-table-dialog .scoreline{align-items:stretch;flex-direction:column;gap:7px}
 body.table-mode .sheet.manage-table-dialog .manage-setting-row{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center}
}
body.table-mode #app.on > .rail{
  display:flex;
  grid-column:1;
  grid-row:1;
  min-width:0;
  min-height:0;
  overflow:hidden;
  flex-direction:column;
  padding:6px;
  gap:6px;
  background:var(--gui-surface);
  border:1px solid var(--gui-line);
  border-radius:8px;
  color:var(--gui-ink);
}
body.table-mode #app.on > .felt{grid-column:2;grid-row:1;min-width:0}
body.table-mode #app.on:has(.felt[data-fit-layout]){
  display:grid;
}
body.table-mode #app.on[data-table-phase=bidding]{grid-template-columns:260px minmax(0,1fr)}
body.table-mode #app.on:has(.felt[data-fit-layout]) > .rail{
  display:flex;
  grid-column:1;
  grid-row:1;
  min-width:0;
  min-height:0;
  overflow:hidden;
  flex-direction:column;
  padding:6px;
  gap:6px;
  background:var(--gui-surface);
  border:1px solid var(--gui-line);
  border-radius:8px;
  color:var(--gui-ink);
}
body.table-mode #app.on:has(.felt[data-fit-layout]) > .rail .rail-scroll,
body.table-mode #app.on[data-table-phase=waiting] > .rail .rail-scroll{display:none}
body.table-mode #app.on:has(.felt[data-fit-layout]) > .rail #table-controls,
body.table-mode #app.on[data-table-phase=waiting] > .rail #table-controls{
  display:flex;
  flex:1 1 auto;
  min-width:0;
  min-height:0;
  height:100%;
  max-height:100%;
  overflow:auto;
  overscroll-behavior:contain;
  scrollbar-gutter:stable;
  flex-direction:column;
  gap:8px;
  padding:3px;
  background:transparent;
}
body.table-mode #app.on:has(.felt[data-fit-layout]) > #table-workspace{
  display:block;
  grid-column:2;
  grid-row:1;
  min-width:0;
  min-height:0;
  height:100%;
  overflow:auto;
}
body.table-mode #app.on:has(.felt[data-fit-layout]) > #table-workspace > .felt{box-sizing:border-box;width:auto;max-width:100%;height:100%;min-height:0}
@media(max-width:900px){
  body.table-mode #app.on{grid-template-columns:150px minmax(0,1fr)}
  body.table-mode #app.on:has(.felt[data-fit-layout]){grid-template-columns:150px minmax(0,1fr)}
  body.table-mode #app.on[data-table-phase=bidding]{grid-template-columns:220px minmax(0,1fr)}
  body.table-mode #app .felt[data-fit-layout=play][data-dummy='1'],
  body.table-mode #app .felt[data-fit-layout=play][data-dummy='3']{grid-template-columns:minmax(0,1.6fr) 130px minmax(140px,.4fr)}
  body.table-mode #app .felt[data-fit-layout=play][data-dummy='1'] .seat .hand-slot,
  body.table-mode #app .felt[data-fit-layout=play][data-dummy='3'] .seat .hand-slot,
  body.table-mode #app .felt[data-fit-layout=play][data-dummy='1'] .diagramhand,
  body.table-mode #app .felt[data-fit-layout=play][data-dummy='3'] .diagramhand{width:100%;max-width:100%}
  body.table-mode #app .felt[data-fit-layout=play][data-dummy='1'] .diagramrow,
  body.table-mode #app .felt[data-fit-layout=play][data-dummy='3'] .diagramrow{flex-wrap:wrap}
  body.table-mode #app .felt[data-fit-layout=play][data-fit-cards=diagram]:not([data-trick-layout=adaptive]) .trickpad{width:130px;height:calc(var(--gui-rank)*3.75 + 8px)}
  body.table-mode #app .felt[data-fit-layout=play] #seat-2{grid-area:top!important}
  body.table-mode #app .felt[data-fit-layout=play] #seat-0{grid-area:bottom!important}
  body.table-mode #app .felt[data-fit-layout] :is(#seat-1,#seat-3) .nameplate{
    font-size:14px;line-height:1}
}
@media(max-width:850px) and (min-height:500px){
  /* Keep four suit rows and both hands distinct on a 800x600 laptop viewport. */
  body.table-mode #app .felt[data-fit-layout=play]{--gui-rank:28px;--gui-font:17px}
  body.table-mode #app .felt[data-fit-layout=play] .diagramrow{min-height:28px}
  body.table-mode #app .felt[data-fit-layout=play] .diagramrank{min-height:28px;font-size:28px}
  body.table-mode #app .felt[data-fit-layout=play]{height:470px;grid-template-rows:150px 140px 150px;align-content:start}
}

/* ENH-058 portrait-phone composition.  This is viewport-driven, not a user-agent
   fork.  It preserves the shared DOM, action handlers and server authority while
   spending the narrow axis on the bridge task instead of a compressed desktop rail. */
@media(max-width:560px){
  body.table-mode{
    --gui-font:16px;--gui-rank:18px;--gui-scale:1;
    --phone-table-gap:4px
  }
  body.table-mode #topbar{
    min-height:52px;padding:max(4px,env(safe-area-inset-top)) max(6px,env(safe-area-inset-right)) 4px max(6px,env(safe-area-inset-left));
    flex-wrap:nowrap;gap:5px
  }
  body.table-mode #topbar .topbar-brand img{width:42px;height:36px}
  body.table-mode #topbar .topbar-brand-copy{display:none}
  body.table-mode #topbar :is(#tb-scoring,#tb-table-title){min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px}
  body.table-mode #topbar #tb-notifications{width:44px;min-width:44px;height:44px}
  body.table-mode #topbar .topbar-menu{min-width:44px;min-height:44px;padding-inline:8px}

  body.table-mode #app.on,
  body.table-mode #app.on:has(.felt[data-fit-layout]){
    position:fixed;inset:0;display:grid;
    grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr) auto;
    gap:var(--phone-table-gap);height:auto;min-height:0;
    padding:calc(var(--table-header-bottom,var(--topbar-clearance)) + var(--phone-table-gap)) max(4px,env(safe-area-inset-right)) max(4px,env(safe-area-inset-bottom)) max(4px,env(safe-area-inset-left));
    overflow:hidden;background:var(--gui-bg)
  }
  body.table-mode #app.on>.rail,
  body.table-mode #app.on:has(.felt[data-fit-layout])>.rail,
  body.table-mode #app.on>.rail>#table-controls,
  body.table-mode #app.on:has(.felt[data-fit-layout])>.rail>#table-controls{
    display:contents
  }
  body.table-mode #app.on>.rail>#table-notices{
    position:fixed;z-index:40;top:calc(var(--table-header-bottom,var(--topbar-clearance)) + 6px);
    right:6px;left:6px;width:auto;max-height:34dvh
  }
  body.table-mode #app.on #board-panel,
  body.table-mode #app.on:has(.felt[data-fit-layout]) #board-panel{
    position:relative;grid-column:1;grid-row:1;display:grid;
    grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:4px;
    box-sizing:border-box;width:100%;max-width:none;min-height:48px;margin:0;padding:4px 6px;
    border:1px solid var(--gui-line);border-radius:6px;background:var(--table-v2-panel);color:var(--table-v2-panel-ink);
    overflow:hidden;font-size:14px
  }
  body.table-mode #app.on #board-panel::before{
    content:"Board " attr(data-board);display:grid;min-width:54px;min-height:38px;place-items:center;
    border-radius:5px;background:var(--table-v2-information);color:var(--table-v2-information-ink);font-weight:800
  }
  body.table-mode #board-panel :is(.board-diagram,.paneltitle,.system-summaries,.partnershipclocks){display:none}
  body.table-mode #board-panel .panel-vulnerability{grid-column:2;grid-row:1;width:max-content;min-width:0;padding:3px 6px;font-size:12px}
  body.table-mode #board-panel .contractline{grid-column:3;grid-row:1;width:auto;min-width:72px;min-height:38px;padding:3px 6px;font-size:14px;white-space:nowrap}
  body.table-mode #board-panel .tricksummary{grid-column:2;grid-row:1;justify-self:end;margin:0}
  body.table-mode #board-panel .tricksummary button{min-width:34px;min-height:38px;padding:2px 5px;font-size:15px}

  body.table-mode #app.on>#table-workspace,
  body.table-mode #app.on:has(.felt[data-fit-layout])>#table-workspace{
    display:block;grid-column:1;grid-row:2;min-width:0;min-height:0;width:100%;height:100%;overflow:hidden
  }
  body.table-mode #app.on>#table-workspace>.felt,
  body.table-mode #app.on:has(.felt[data-fit-layout])>#table-workspace>.felt{
    box-sizing:border-box;width:100%;max-width:none;height:100%;min-height:0
  }
  body.table-mode #app.on #gui-play-actions{
    grid-column:1;grid-row:3;display:flex;flex-direction:row;flex-wrap:nowrap;
    align-items:stretch;align-self:end;justify-content:flex-start;height:52px;max-height:52px;
    gap:4px;min-width:0;margin:0;padding:4px 2px max(2px,env(safe-area-inset-bottom));overflow-x:auto;
    border-top:1px solid var(--gui-line);background:var(--gui-surface);overscroll-behavior-inline:contain;scrollbar-width:thin
  }
  body.table-mode #app.on #gui-play-actions button{
    flex:1 0 72px;width:auto;min-width:72px;min-height:44px;height:44px;padding:4px 5px;font-size:12px;white-space:normal
  }

  body.table-mode #app .felt[data-fit-layout],
  body.table-mode #app .felt[data-fit-layout=play],
  body.table-mode #app .felt[data-fit-layout=play][data-dummy='1'],
  body.table-mode #app .felt[data-fit-layout=play][data-dummy='3']{
    position:relative;display:grid;grid-template-columns:132px minmax(0,1fr) 132px;
    grid-template-rows:auto minmax(0,1fr) auto;grid-template-areas:'top top top' 'left mid right' 'bottom bottom bottom';
    gap:3px;width:100%;height:100%;min-width:0;min-height:0;padding:4px;overflow:hidden;border-radius:7px;
    --gui-rank:18px;--gui-font:15px
  }
  body.table-mode #app .felt[data-fit-layout] .seat{min-width:0;max-width:100%;gap:0}
  body.table-mode #app .felt[data-fit-layout] :is(#seat-0,#seat-2){
    position:relative;inset:auto;width:100%;max-width:100%;transform:none;align-items:stretch;justify-self:stretch
  }
  body.table-mode #app .felt[data-fit-layout] #seat-2{grid-area:top;align-self:start}
  body.table-mode #app .felt[data-fit-layout] #seat-0{grid-area:bottom;align-self:end}
  body.table-mode #app .felt[data-fit-layout] :is(#seat-0,#seat-2) :is(.plate-slot,.hand-slot,.diagramhand){
    box-sizing:border-box;width:100%;min-width:0;max-width:100%
  }
  body.table-mode #app .felt[data-fit-layout] :is(#seat-0,#seat-2) .nameplate{
    min-height:28px;padding:1px 4px;font-size:12px
  }
  body.table-mode #app .felt[data-fit-layout] :is(#seat-0,#seat-2) .nameplate .pos{
    min-width:30px;font-size:18px
  }
  body.table-mode #app .felt[data-fit-layout] :is(#seat-0,#seat-2) .nameplate .tag{font-size:8px}
  body.table-mode #app .felt[data-fit-layout] :is(#seat-0,#seat-2) .diagramhand{
    display:flex;min-height:48px;padding:2px;overflow:visible;flex-direction:row;align-items:stretch;gap:1px;
    border-radius:0 0 5px 5px;background:var(--gui-surface)
  }
  body.table-mode #app .felt[data-fit-layout] :is(#seat-0,#seat-2) .diagramrow{display:contents}
  body.table-mode #app .felt[data-fit-layout] :is(#seat-0,#seat-2) .diagramrow>.slbl,
  body.table-mode #app .felt[data-fit-layout] :is(#seat-0,#seat-2) .diagramvoid{display:none}
  body.table-mode #app .felt[data-fit-layout] :is(#seat-0,#seat-2) .diagramrank{
    position:relative;display:grid;min-width:0;min-height:44px;height:44px;place-items:center;
    flex:1 1 0;padding:0;color:transparent;border:1px solid #afbbb6;border-radius:4px;background:#fffdf8;
    font-size:0;line-height:1;overflow:hidden
  }
  body.table-mode #app .felt[data-fit-layout] :is(#seat-0,#seat-2) .diagramrank::after{
    content:attr(data-card-label);position:static;display:block;color:#17222b;background:transparent;
    font:800 clamp(11px,3.2vw,15px)/1 var(--gui-face),system-ui,sans-serif;transform:none;box-shadow:none
  }
  body.table-mode #app .felt[data-fit-layout] :is(#seat-0,#seat-2) .diagramrow:has(.slbl.red) .diagramrank::after{color:#a92e34}
  body.table-mode #app .felt[data-fit-layout] :is(#seat-0,#seat-2) .diagramrank.play,
  body.table-mode #app .felt[data-fit-layout] :is(#seat-0,#seat-2) .diagramrank.action-candidate{
    color:transparent;border:2px solid #8a6b00;background:#fff0a2;box-shadow:inset 0 0 0 1px #fff
  }
  body.table-mode #app .felt[data-fit-layout] :is(#seat-0,#seat-2) .diagramrank.action-candidate::after{
    position:static;width:auto;height:auto;padding:0;border:0;border-radius:0;background:transparent;
    box-shadow:none;transform:none;font:800 clamp(11px,3.2vw,15px)/1 var(--gui-face),system-ui,sans-serif
  }
  body.table-mode #app .felt[data-fit-layout] :is(#seat-0,#seat-2) .diagramrank.action-candidate~.diagramrank{transform:none}

  /* Bidding cards are informational, so use a shallow overlapping fan.  The
     grid step leaves each leading rank/suit exposed and reserves a complete
     final-card column; play retains the larger touch targets above. */
  body.table-mode #app .felt[data-fit-layout=bidding] #seat-0 .diagramhand{
    --phone-bid-card-width:clamp(32px,9.5vw,42px);
    display:grid;grid-template-columns:repeat(12,minmax(0,1fr)) var(--phone-bid-card-width);
    align-items:stretch;gap:0;min-height:36px;height:36px;padding:2px;overflow:visible
  }
  body.table-mode #app .felt[data-fit-layout=bidding] #seat-0 .diagramrank{
    width:var(--phone-bid-card-width);min-width:var(--phone-bid-card-width);min-height:32px;height:32px;
    place-items:center start;padding-left:3px;border-radius:4px;background:#fffdf8;
    box-shadow:1px 0 2px rgba(23,34,43,.24)
  }
  body.table-mode #app .felt[data-fit-layout=bidding] #seat-0 .diagramrank::after{
    font-size:clamp(10px,3vw,13px);white-space:nowrap
  }

  body.table-mode #app .felt[data-fit-layout] :is(#seat-1,#seat-3){
    position:relative;inset:auto;width:100%;max-width:132px;transform:none;align-self:center
  }
  body.table-mode #app .felt[data-fit-layout] #seat-1{grid-area:left;justify-self:start;align-items:flex-start}
  body.table-mode #app .felt[data-fit-layout] #seat-3{grid-area:right;justify-self:end;align-items:flex-end}
  body.table-mode #app .felt[data-fit-layout] :is(#seat-1,#seat-3) .nameplate{min-width:0;min-height:32px;font-size:11px}
  body.table-mode #app .felt[data-fit-layout] :is(#seat-1,#seat-3) .nameplate .pos{min-width:30px;font-size:18px}
  body.table-mode #app .felt[data-fit-layout] :is(#seat-1,#seat-3) .concealedhand{width:100%;min-width:0;min-height:88px}
  body.table-mode #app .felt[data-fit-layout] :is(#seat-1,#seat-3) .diagramhand{width:100%;min-width:0;padding:3px}
  body.table-mode #app .felt[data-fit-layout] :is(#seat-1,#seat-3) .diagramrow{min-height:22px;flex-wrap:nowrap;overflow:hidden}
  body.table-mode #app .felt[data-fit-layout] :is(#seat-1,#seat-3) .diagramrow .slbl{font-size:17px;flex-basis:18px}
  body.table-mode #app .felt[data-fit-layout] :is(#seat-1,#seat-3) .diagramrank{min-width:12px;min-height:22px;padding:0;font-size:14px}

  body.table-mode #app .felt[data-fit-layout=play] #mid{
    position:relative;inset:auto;grid-area:mid;display:flex;width:100%;height:100%;min-height:160px;
    transform:none;align-items:center;justify-content:center;overflow:visible
  }
  body.table-mode #app .felt[data-fit-layout=play] .trickpad{width:168px;height:156px;min-height:0}
  body.table-mode #app .felt[data-fit-layout=play][data-fit-cards=diagram] .trickpad .card{
    width:58px;min-height:42px
  }
  body.table-mode #app .felt[data-fit-layout=play][data-fit-cards=diagram] .trickpad .card .idx :is(.ir,.is){font-size:20px}

  body.table-mode #app .felt[data-fit-layout=bidding]{
    display:grid;grid-template-columns:88px minmax(0,1fr) 88px;
    grid-template-rows:auto minmax(80px,1fr) auto auto;
    grid-template-areas:'top top top' 'left auction right' 'bottom bottom bottom' 'bid bid bid';
    align-content:stretch
  }
  body.table-mode #app .felt[data-fit-layout=bidding] #seat-2,
  body.table-mode #app .felt[data-fit-layout=bidding] #seat-0,
  body.table-mode #app .felt[data-fit-layout=bidding] :is(#seat-1,#seat-3){
    position:relative;inset:auto;transform:none;margin:0;max-width:100%;grid-column:auto
  }
  body.table-mode #app .felt[data-fit-layout=bidding] #seat-2{grid-area:top;justify-self:center;width:min(180px,100%)}
  body.table-mode #app .felt[data-fit-layout=bidding] #seat-1{grid-area:left;align-self:center}
  body.table-mode #app .felt[data-fit-layout=bidding] #seat-3{grid-area:right;align-self:center}
  body.table-mode #app .felt[data-fit-layout=bidding] #seat-0{grid-area:bottom;width:100%}
  body.table-mode #app .felt[data-fit-layout=bidding] #auction-panel{
    position:relative;inset:auto;grid-area:auction;align-self:center;justify-self:center;
    width:min(250px,100%);max-width:100%;max-height:170px;transform:none;overflow:auto;padding:3px
  }
  body.table-mode #app .felt[data-fit-layout=bidding] #bidbox{
    position:relative;inset:auto;grid-area:bid;align-self:end;justify-self:stretch;
    box-sizing:border-box;width:100%;max-width:none;max-height:250px;transform:none;overflow:auto;padding:5px
  }
  body.table-mode #app .felt[data-fit-layout=bidding] #bidbox .cap{margin:0 0 3px;font-size:11px;text-align:left}
  body.table-mode #app .felt[data-fit-layout=bidding] .bid{min-height:44px;font-size:16px}
  body.table-mode #app .felt[data-fit-layout=bidding] .bidcontrols{grid-template-rows:91px 44px}
  body.table-mode #app .felt[data-fit-layout=bidding] .bidprimary{
    display:grid;grid-template-columns:repeat(7,minmax(0,1fr));grid-template-rows:44px 44px;
    gap:3px;overflow:visible
  }
  body.table-mode #app .felt[data-fit-layout=bidding] .bidprimary .pass{grid-column:1/3;grid-row:1;min-width:0}
  body.table-mode #app .felt[data-fit-layout=bidding] .bidprimary :is(.dbl,.rdbl){grid-column:3/5;grid-row:1;min-width:0}
  body.table-mode #app .felt[data-fit-layout=bidding] .bidprimary .level{
    grid-row:2;min-width:0;width:auto;flex:none
  }
  body.table-mode #app .felt[data-fit-layout=bidding] .bidprimary .level[data-level="1"]{grid-column:1}
  body.table-mode #app .felt[data-fit-layout=bidding] .bidprimary .level[data-level="2"]{grid-column:2}
  body.table-mode #app .felt[data-fit-layout=bidding] .bidprimary .level[data-level="3"]{grid-column:3}
  body.table-mode #app .felt[data-fit-layout=bidding] .bidprimary .level[data-level="4"]{grid-column:4}
  body.table-mode #app .felt[data-fit-layout=bidding] .bidprimary .level[data-level="5"]{grid-column:5}
  body.table-mode #app .felt[data-fit-layout=bidding] .bidprimary .level[data-level="6"]{grid-column:6}
  body.table-mode #app .felt[data-fit-layout=bidding] .bidprimary .level[data-level="7"]{grid-column:7}
  body.table-mode #app .felt[data-fit-layout=bidding] .call-alert-entry{grid-template-columns:minmax(0,1fr) auto;gap:4px}
  body.table-mode #app .felt[data-fit-layout=bidding] #bid-alert-note{min-height:44px;max-height:70px}
  body.table-mode #app .felt[data-fit-layout=play] #auction-panel.play-open,
  body.table-mode #app .felt[data-fit-layout=play] #auction-panel.auctionpanel.play-open.avoid-top{
    position:fixed;z-index:1000;top:50%;right:8px;left:8px;width:auto;max-height:55dvh;
    transform:translateY(-50%);overflow:auto;pointer-events:auto
  }
  body.table-mode .scorepopupgrid{min-width:360px}
  body.table-mode .sheet{max-height:calc(100dvh - 24px);padding:14px}
}

/* Reference2 cascade lock.  Keep this final: the phone composition is an
   intentional replacement of the desktop table geometry, while retaining the
   shared table DOM, controls and server-authoritative actions. */
@media (max-width:560px), (max-height:560px) and (min-width:561px) and (max-width:1100px){
  body.table-mode{--reference2-gap:3px}
  body.table-mode #app .felt:is([data-fit-layout=bidding],[data-fit-layout=play][data-phase=play]){
    grid-template-areas:none
  }
  body.table-mode #app .felt:is([data-fit-layout=bidding],[data-fit-layout=play][data-phase=play]) .seat{
    display:contents
  }
  body.table-mode #app .felt:is([data-fit-layout=bidding],[data-fit-layout=play][data-phase=play]) .plate-slot{
    display:block;position:relative;z-index:5;grid-row:1;min-width:0;width:auto;align-self:stretch
  }
  body.table-mode #app .felt:is([data-fit-layout=bidding],[data-fit-layout=play][data-phase=play]) #seat-1 .plate-slot{grid-column:1}
  body.table-mode #app .felt:is([data-fit-layout=bidding],[data-fit-layout=play][data-phase=play]) #seat-2 .plate-slot{grid-column:2}
  body.table-mode #app .felt:is([data-fit-layout=bidding],[data-fit-layout=play][data-phase=play]) #seat-3 .plate-slot{grid-column:3}
  body.table-mode #app .felt:is([data-fit-layout=bidding],[data-fit-layout=play][data-phase=play]) #seat-0 .plate-slot{grid-column:4}
  body.table-mode #app .felt:is([data-fit-layout=bidding],[data-fit-layout=play][data-phase=play]) .nameplate{
    box-sizing:border-box;width:100%;height:30px;min-width:0;min-height:30px;margin:0;padding:2px 3px;
    gap:2px;border-width:1px;border-radius:3px;overflow:hidden;font-size:10px;white-space:nowrap
  }
  body.table-mode #app .felt:is([data-fit-layout=bidding],[data-fit-layout=play][data-phase=play]) .nameplate .pos{
    min-width:24px;font-size:16px
  }
  body.table-mode #app .felt:is([data-fit-layout=bidding],[data-fit-layout=play][data-phase=play]) .nameplate .player-name{
    min-width:0;overflow:hidden;text-overflow:ellipsis
  }
  body.table-mode #app .felt:is([data-fit-layout=bidding],[data-fit-layout=play][data-phase=play]) .nameplate :is(.tag,.system-info){display:none}
  body.table-mode #app .felt:is([data-fit-layout=bidding],[data-fit-layout=play][data-phase=play]) .hand-slot{display:none;min-width:0}
  body.table-mode #app .felt:is([data-fit-layout=bidding],[data-fit-layout=play][data-phase=play]) #seat-0 .hand-slot{display:block}
  body.table-mode #app .felt[data-fit-layout=play][data-phase=play] .fit-visible-hand:not(#seat-0) .hand-slot{display:block}
  body.table-mode #app .felt:is([data-fit-layout=bidding],[data-fit-layout=play][data-phase=play]) #seat-0 .diagramrow{display:contents}
  body.table-mode #app .felt:is([data-fit-layout=bidding],[data-fit-layout=play][data-phase=play]) #seat-0 .diagramrow>.slbl,
  body.table-mode #app .felt:is([data-fit-layout=bidding],[data-fit-layout=play][data-phase=play]) #seat-0 .diagramvoid{display:none}
  body.table-mode #app .felt:is([data-fit-layout=bidding],[data-fit-layout=play][data-phase=play]) #seat-0 .diagramrank{
    position:relative;display:grid;place-items:center;overflow:hidden;color:transparent;
    border:1px solid #afbbb6;border-radius:4px;background:#fffdf8;font-size:0;line-height:1
  }
  body.table-mode #app .felt:is([data-fit-layout=bidding],[data-fit-layout=play][data-phase=play]) #seat-0 .diagramrank::after{
    content:attr(data-card-label);display:block;color:#17222b;background:transparent;
    font:800 14px/1 var(--gui-face),system-ui,sans-serif;white-space:nowrap
  }
  body.table-mode #app .felt:is([data-fit-layout=bidding],[data-fit-layout=play][data-phase=play]) #seat-0 .diagramrow:has(.slbl.red) .diagramrank::after{color:#a92e34}
  body.table-mode #app .felt[data-fit-layout=play][data-phase=play] #seat-0 .diagramrank.play,
  body.table-mode #app .felt[data-fit-layout=play][data-phase=play] #seat-0 .diagramrank.action-candidate{
    color:transparent;border:2px solid #8a6b00;background:#fff0a2;box-shadow:inset 0 0 0 1px #fff
  }
  body.table-mode #app .felt[data-fit-layout=bidding] :is(#auction-panel,#bidbox){
    position:relative;inset:auto;box-sizing:border-box;width:100%;max-width:none;max-height:none;margin:0;
    transform:none;align-self:stretch;justify-self:stretch;overflow:auto;border-radius:4px;box-shadow:none
  }
  body.table-mode #app .felt[data-fit-layout=bidding] #bidbox .reference2-bid-title{
    display:block;margin:0 0 3px;text-align:center;text-transform:uppercase;letter-spacing:.08em;
    color:var(--gui-accent);font-size:12px;font-weight:850
  }
}

@media(max-width:560px){
  body.table-mode #app .felt[data-fit-layout=bidding]{
    display:grid;grid-template-columns:repeat(4,minmax(0,1fr));
    grid-template-rows:30px minmax(110px,1fr) auto 36px;gap:3px;align-content:stretch
  }
  body.table-mode #app .felt[data-fit-layout=bidding] #auction-panel{
    grid-column:1/5;grid-row:2;padding:5px
  }
  body.table-mode #app .felt[data-fit-layout=bidding] #bidbox{
    grid-column:1/5;grid-row:3;padding:5px
  }
  body.table-mode #app .felt[data-fit-layout=bidding] #seat-0 .hand-slot{
    grid-column:1/5;grid-row:4;align-self:end;width:100%;height:36px;overflow:visible
  }
  body.table-mode #app .felt[data-fit-layout=play][data-phase=play]{
    display:grid;grid-template-columns:repeat(4,minmax(0,1fr));
    grid-template-rows:30px auto minmax(120px,1fr) 48px;gap:3px;align-content:stretch
  }
  body.table-mode #app .felt[data-fit-layout=play][data-phase=play] #mid{
    position:relative;inset:auto;grid-column:1/5;grid-row:3;width:100%;height:100%;min-height:120px;transform:none
  }
  body.table-mode #app .felt[data-fit-layout=play][data-phase=play] #seat-0 .hand-slot{
    grid-column:1/5;grid-row:4;align-self:end;width:100%;height:48px;overflow:visible
  }
  body.table-mode #app .felt[data-fit-layout=play][data-phase=play] .fit-visible-hand:not(#seat-0) .hand-slot{
    grid-column:1/5;grid-row:2;align-self:start;width:100%;height:44px;overflow:visible
  }
  body.table-mode #app .felt[data-fit-layout=play][data-phase=play] .fit-visible-hand:not(#seat-0) .diagramhand{
    display:flex;box-sizing:border-box;width:100%;min-width:0;min-height:44px;height:44px;
    align-items:stretch;gap:1px;padding:2px;overflow:visible
  }
  body.table-mode #app .felt[data-fit-layout=play][data-phase=play] .fit-visible-hand:not(#seat-0) .diagramrow{display:contents}
  body.table-mode #app .felt[data-fit-layout=play][data-phase=play] .fit-visible-hand:not(#seat-0) .diagramrow>.slbl,
  body.table-mode #app .felt[data-fit-layout=play][data-phase=play] .fit-visible-hand:not(#seat-0) .diagramvoid{display:none}
  body.table-mode #app .felt[data-fit-layout=play][data-phase=play] .fit-visible-hand:not(#seat-0) .diagramrank{
    display:grid;min-width:0;min-height:40px;height:40px;place-items:center;flex:1 1 0;padding:0;
    overflow:hidden;color:transparent;border:1px solid #afbbb6;border-radius:4px;background:#fffdf8;font-size:0
  }
  body.table-mode #app .felt[data-fit-layout=play][data-phase=play] .fit-visible-hand:not(#seat-0) .diagramrank::after{
    content:attr(data-card-label);display:block;color:#17222b;
    font:800 clamp(11px,3vw,14px)/1 var(--gui-face),system-ui,sans-serif;white-space:nowrap
  }
  body.table-mode #app .felt[data-fit-layout=play][data-phase=play] .fit-visible-hand:not(#seat-0) .diagramrow:has(.slbl.red) .diagramrank::after{color:#a92e34}
}

@media(max-height:560px) and (min-width:561px) and (max-width:1100px){
  body.table-mode{--gui-font:15px;--gui-rank:18px;--gui-scale:1}
  body.table-mode #topbar{
    min-height:44px;height:44px;padding:max(2px,env(safe-area-inset-top)) 5px 2px;flex-wrap:nowrap;gap:4px
  }
  body.table-mode #topbar .topbar-brand img{width:38px;height:34px}
  body.table-mode #topbar .topbar-brand-copy{display:none}
  body.table-mode #topbar :is(#tb-scoring,#tb-table-title){font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  body.table-mode #topbar #tb-notifications{width:40px;min-width:40px;height:40px}
  body.table-mode #topbar .topbar-menu{min-width:44px;min-height:40px;padding:3px 7px}
  body.table-mode #app.on,
  body.table-mode #app.on:has(.felt[data-fit-layout]){
    position:fixed;inset:0;display:grid;grid-template-columns:minmax(0,1fr) 92px;
    grid-template-rows:34px minmax(0,1fr);gap:2px;height:auto;min-height:0;
    padding:calc(var(--table-header-bottom,var(--topbar-clearance)) + 2px) max(2px,env(safe-area-inset-right)) max(2px,env(safe-area-inset-bottom)) max(2px,env(safe-area-inset-left));overflow:hidden
  }
  body.table-mode #app.on>.rail,
  body.table-mode #app.on:has(.felt[data-fit-layout])>.rail,
  body.table-mode #app.on>.rail>#table-controls,
  body.table-mode #app.on:has(.felt[data-fit-layout])>.rail>#table-controls{display:contents}
  body.table-mode #app.on #board-panel,
  body.table-mode #app.on:has(.felt[data-fit-layout]) #board-panel{
    position:relative;grid-column:1;grid-row:1;display:grid;grid-template-columns:auto auto minmax(0,1fr) auto;
    align-items:center;gap:6px;box-sizing:border-box;width:100%;max-width:none;height:34px;min-height:34px;
    margin:0;padding:2px 6px;overflow:hidden;border:1px solid var(--gui-line);border-radius:3px;
    background:var(--table-v2-panel);color:var(--table-v2-panel-ink);font-size:12px
  }
  body.table-mode #board-panel :is(.board-diagram,.paneltitle,.system-summaries,.partnershipclocks){display:none}
  body.table-mode #app.on #board-panel::before,
  body.table-mode #app.on:has(.felt[data-fit-layout]) #board-panel::before{
    content:"Board " attr(data-board);display:block;min-width:48px;padding:2px 4px;font-weight:850
  }
  body.table-mode #board-panel .panel-vulnerability{grid-column:2;grid-row:1;width:max-content;padding:2px 5px;font-size:12px}
  body.table-mode #board-panel .contractline{grid-column:4;grid-row:1;width:auto;min-width:70px;min-height:26px;padding:2px 5px;font-size:13px;white-space:nowrap}
  body.table-mode #board-panel .tricksummary{grid-column:3;grid-row:1;justify-self:end;margin:0}
  body.table-mode #board-panel .tricksummary button{min-width:34px;min-height:26px;padding:1px 5px;font-size:13px}
  body.table-mode #app.on>#table-workspace,
  body.table-mode #app.on:has(.felt[data-fit-layout])>#table-workspace{
    display:block;grid-column:1;grid-row:2;width:100%;height:100%;min-width:0;min-height:0;overflow:hidden
  }
  body.table-mode #app.on #gui-play-actions{
    grid-column:2;grid-row:1/3;display:flex;flex-direction:column;flex-wrap:nowrap;align-items:stretch;
    width:92px;height:100%;max-height:none;margin:0;padding:2px;gap:3px;overflow-y:auto;overflow-x:hidden
  }
  body.table-mode #app.on #gui-play-actions button{
    flex:1 0 44px;width:100%;min-width:0;min-height:44px;height:auto;padding:3px;font-size:11px;white-space:normal
  }
  body.table-mode #app .felt:is([data-fit-layout=bidding],[data-fit-layout=play][data-phase=play]){
    display:grid;grid-template-columns:repeat(4,minmax(0,1fr));grid-template-rows:30px minmax(0,1fr) 48px;
    gap:3px;width:100%;height:100%;padding:3px;overflow:hidden;align-content:stretch
  }
  body.table-mode #app .felt[data-fit-layout=bidding] #auction-panel{grid-column:1/3;grid-row:2;padding:6px}
  body.table-mode #app .felt[data-fit-layout=bidding] #bidbox{grid-column:3/5;grid-row:2;padding:5px}
  body.table-mode #app .felt[data-fit-layout=bidding] #seat-0 .hand-slot{
    grid-column:1/5;grid-row:3;align-self:end;width:100%;height:48px;overflow:visible
  }
  body.table-mode #app .felt[data-fit-layout=bidding] #seat-0 .diagramhand{
    display:flex;flex-direction:row;width:100%;min-width:0;height:48px;min-height:48px;gap:1px;padding:2px;overflow:visible
  }
  body.table-mode #app .felt[data-fit-layout=bidding] #seat-0 .diagramrow{display:contents}
  body.table-mode #app .felt[data-fit-layout=bidding] #seat-0 .diagramrank{
    flex:0 0 48px;width:48px;min-width:48px;height:44px;min-height:44px;place-items:center;padding:0
  }
  body.table-mode #app .felt[data-fit-layout=bidding] .bidcontrols{
    display:grid;grid-template-columns:repeat(12,minmax(0,1fr));grid-template-rows:repeat(4,44px);gap:3px
  }
  body.table-mode #app .felt[data-fit-layout=bidding] .bidprimary{display:contents}
  body.table-mode #app .felt[data-fit-layout=bidding] .bidprimary .level{grid-row:auto;min-width:0;width:auto;min-height:44px}
  body.table-mode #app .felt[data-fit-layout=bidding] .bidprimary .level[data-level="1"]{grid-column:1/4;grid-row:1}
  body.table-mode #app .felt[data-fit-layout=bidding] .bidprimary .level[data-level="2"]{grid-column:4/7;grid-row:1}
  body.table-mode #app .felt[data-fit-layout=bidding] .bidprimary .level[data-level="3"]{grid-column:7/10;grid-row:1}
  body.table-mode #app .felt[data-fit-layout=bidding] .bidprimary .level[data-level="4"]{grid-column:10/13;grid-row:1}
  body.table-mode #app .felt[data-fit-layout=bidding] .bidprimary .level[data-level="5"]{grid-column:1/5;grid-row:2}
  body.table-mode #app .felt[data-fit-layout=bidding] .bidprimary .level[data-level="6"]{grid-column:5/9;grid-row:2}
  body.table-mode #app .felt[data-fit-layout=bidding] .bidprimary .level[data-level="7"]{grid-column:9/13;grid-row:2}
  body.table-mode #app .felt[data-fit-layout=bidding] .bidstrains{
    grid-column:1/13;grid-row:3;display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:3px;margin:0;padding:0
  }
  body.table-mode #app .felt[data-fit-layout=bidding] .bidprimary .pass{grid-column:7/13;grid-row:4;min-width:0}
  body.table-mode #app .felt[data-fit-layout=bidding] .bidprimary :is(.dbl,.rdbl){grid-column:1/7;grid-row:4;min-width:0}
  body.table-mode #app .felt[data-fit-layout=bidding] .call-alert-entry{grid-template-columns:minmax(0,1fr) auto;gap:3px;margin-top:3px;padding-top:3px}
  body.table-mode #app .felt[data-fit-layout=bidding] #bid-alert-note{height:40px;min-height:40px;max-height:40px;padding:5px}
  body.table-mode #app .felt[data-fit-layout=play][data-phase=play] #mid{
    position:relative;inset:auto;grid-column:1/3;grid-row:2;width:100%;height:100%;min-height:0;transform:none
  }
  body.table-mode #app .felt[data-fit-layout=play][data-phase=play] #seat-0 .hand-slot{
    grid-column:1/5;grid-row:3;align-self:end;width:100%;height:48px;overflow:visible
  }
  body.table-mode #app .felt[data-fit-layout=play][data-phase=play] #seat-0 .diagramhand{
    display:flex;flex-direction:row;width:100%;min-width:0;height:48px;min-height:48px;gap:1px;padding:2px;overflow:visible
  }
  body.table-mode #app .felt[data-fit-layout=play][data-phase=play] #seat-0 .diagramrank{
    flex:0 0 48px;width:48px;min-width:48px;height:44px;min-height:44px
  }
  body.table-mode #app .felt[data-fit-layout=play][data-phase=play] .fit-visible-hand:not(#seat-0) .hand-slot{
    grid-column:3/5;grid-row:2;align-self:stretch;width:100%;height:100%;overflow:auto
  }
  body.table-mode #app .felt[data-fit-layout=play][data-phase=play] .fit-visible-hand:not(#seat-0) .diagramhand{
    display:grid;box-sizing:border-box;width:100%;height:100%;min-width:0;min-height:0;padding:5px;overflow:auto
  }
  body.table-mode #app .felt[data-fit-layout=play][data-phase=play] .fit-visible-hand:not(#seat-0) .diagramrow{
    display:flex;min-height:34px;flex-wrap:nowrap;overflow:visible
  }
  body.table-mode #app .felt[data-fit-layout=play][data-phase=play] .fit-visible-hand:not(#seat-0) .diagramrow>.slbl{
    display:block;width:24px;flex:0 0 24px;font-size:21px
  }
  body.table-mode #app .felt[data-fit-layout=play][data-phase=play] .fit-visible-hand:not(#seat-0) .diagramrank{
    min-width:24px;min-height:32px;height:32px;padding:0 2px;font-size:18px
  }
  body.table-mode #app .felt[data-fit-layout=play][data-phase=play] .trickpad{width:210px;height:190px;min-height:0}
  body.table-mode #app .felt[data-fit-layout=play] #auction-panel.play-open,
  body.table-mode #app .felt[data-fit-layout=play] #auction-panel.auctionpanel.play-open.avoid-top{
    position:fixed;z-index:1000;top:50%;right:100px;left:8px;width:auto;max-height:75dvh;
    transform:translateY(-50%);overflow:auto;pointer-events:auto
  }
  body.table-mode .sheet{max-height:calc(100dvh - 12px);padding:10px}
}

/* ENH-058 phone hand preference.  Diagram groups a suit symbol and its plain
   rank text; Compact cards retain Reference2 faces with suit above rank.  The
   larger gap is between suits and the smaller gap is between adjacent cards. */
@media(max-width:560px){
  :root[data-hand-display=diagram] body.table-mode #app .felt[data-fit-layout]
    :is(#seat-0,#seat-2) .diagramhand{
    display:flex!important;box-sizing:border-box;width:100%;height:48px!important;min-height:48px;
    align-items:stretch;justify-content:center;flex-direction:row!important;gap:clamp(6px,2vw,10px);padding:2px 4px;overflow:hidden
  }
  :root[data-hand-display=diagram] body.table-mode #app .felt[data-fit-layout]
    :is(#seat-0,#seat-2) .diagramrow{
    display:flex!important;min-width:0;min-height:44px;align-items:center;flex:0 1 auto;gap:1px;overflow:visible
  }
  :root[data-hand-display=diagram] body.table-mode #app .felt[data-fit-layout]
    :is(#seat-0,#seat-2) .diagramrow>.slbl{
    display:block!important;width:auto;min-width:15px;flex:0 0 auto;font:900 19px/1 var(--gui-face),system-ui,sans-serif
  }
  :root[data-hand-display=diagram] body.table-mode #app .felt[data-fit-layout]
    :is(#seat-0,#seat-2) .diagramrank{
    display:grid;width:auto;min-width:13px;height:44px;min-height:44px;place-items:center;flex:0 1 auto;
    padding:0 1px;color:#17222b!important;border:0;border-radius:2px;background:transparent;
    font:800 clamp(14px,4.1vw,18px)/1 var(--gui-face),system-ui,sans-serif;overflow:visible
  }
  :root[data-hand-display=diagram] body.table-mode #app .felt[data-fit-layout]
    :is(#seat-0,#seat-2) .diagramrank::after{content:none!important}
  :root[data-hand-display=diagram] body.table-mode #app .felt[data-fit-layout]
    :is(#seat-0,#seat-2) .diagramvoid{display:block;font-size:15px}
}
@media(max-height:560px) and (min-width:561px) and (max-width:1100px){
  :root[data-hand-display=diagram] body.table-mode #app .felt[data-fit-layout] #seat-0 .diagramhand{
    display:flex!important;box-sizing:border-box;width:100%;height:48px!important;min-height:48px;
    align-items:stretch;justify-content:center;flex-direction:row!important;gap:10px;padding:2px 5px;overflow:hidden
  }
  :root[data-hand-display=diagram] body.table-mode #app .felt[data-fit-layout] #seat-0 .diagramrow{
    display:flex!important;min-width:0;min-height:44px;align-items:center;flex:0 1 auto;gap:2px;overflow:visible
  }
  :root[data-hand-display=diagram] body.table-mode #app .felt[data-fit-layout] #seat-0 .diagramrow>.slbl{
    display:block!important;width:auto;min-width:16px;flex:0 0 auto;font:900 19px/1 var(--gui-face),system-ui,sans-serif
  }
  :root[data-hand-display=diagram] body.table-mode #app .felt[data-fit-layout] #seat-0 .diagramrank{
    display:grid;width:auto;min-width:14px;height:44px;min-height:44px;place-items:center;flex:0 1 auto;
    padding:0 1px;color:#17222b!important;border:0;border-radius:2px;background:transparent;
    font:800 18px/1 var(--gui-face),system-ui,sans-serif;overflow:visible
  }
  :root[data-hand-display=diagram] body.table-mode #app .felt[data-fit-layout] #seat-0 .diagramrank::after{content:none!important}
  :root[data-hand-display=diagram] body.table-mode #app .felt[data-fit-layout] #seat-0 .diagramvoid{display:block;font-size:15px}
}
@media(max-width:560px), (max-height:560px) and (min-width:561px) and (max-width:1100px){
  :root[data-hand-display=cards] body.table-mode #app .felt[data-fit-layout] .hand-slot>.hand.horizontal{
    display:flex;box-sizing:border-box;width:100%;height:48px;min-height:48px;align-items:stretch;
    justify-content:center;flex-wrap:nowrap;gap:2px;padding:2px;overflow:hidden;border-radius:0 0 4px 4px;background:var(--gui-surface)
  }
  :root[data-hand-display=cards] body.table-mode #app .felt[data-fit-layout] .hand.horizontal .card{
    display:grid;width:auto;min-width:0;height:44px;min-height:44px;place-items:center;flex:1 1 0;
    margin:0;padding:1px;color:#17222b;border:1px solid #afbbb6;border-radius:4px;background:#fffdf8;box-shadow:none
  }
  :root[data-hand-display=cards] body.table-mode #app .felt[data-fit-layout] .hand.horizontal .card.red{color:#a92e34}
  :root[data-hand-display=cards] body.table-mode #app .felt[data-fit-layout] .hand.horizontal .card.suit-start:not(:first-child){margin-left:13px}
  :root[data-hand-display=cards] body.table-mode #app .felt[data-fit-layout] .hand.horizontal .card .idx{
    position:static;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:0;transform:none;line-height:.88
  }
  :root[data-hand-display=cards] body.table-mode #app .felt[data-fit-layout] .hand.horizontal .card .idx .is{
    order:0;font:900 clamp(13px,3.5vw,17px)/.9 var(--gui-face),system-ui,sans-serif
  }
  :root[data-hand-display=cards] body.table-mode #app .felt[data-fit-layout] .hand.horizontal .card .idx .ir{
    order:1;font:850 clamp(12px,3.2vw,16px)/1 var(--gui-face),system-ui,sans-serif
  }
}
@media(max-width:560px){
  body.table-mode #app .felt[data-fit-layout=bidding]{grid-template-rows:30px minmax(110px,1fr) auto 48px}
  body.table-mode #app .felt[data-fit-layout=bidding] #seat-0 .hand-slot{height:48px}
}

/* ENH-357: measured compact mode gives the felt the rail's width. Commands
   remain the original live controls and open in a separate, explicit view. */
body.table-mode #compact-table-header{display:none}
body.table-mode #app.on[data-compact-controls=true],
body.table-mode #app.on[data-compact-controls=true]:has(.felt[data-fit-layout]){
  grid-template-columns:minmax(0,1fr)!important;
  grid-template-rows:48px minmax(0,1fr)!important;
}
body.table-mode #app.on[data-compact-controls=true]>#compact-table-header{
  display:flex;grid-column:1;grid-row:1;align-items:center;justify-content:space-between;
  box-sizing:border-box;min-width:0;height:48px;min-height:48px;gap:8px;padding:2px 8px;
  border:1px solid var(--gui-line);border-radius:6px;background:var(--gui-surface);color:var(--gui-ink)
}
body.table-mode #compact-board-summary{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font:800 15px/1.2 var(--gui-face),system-ui,sans-serif}
body.table-mode #compact-controls-open{flex:none;min-width:88px;min-height:44px;padding:5px 10px;border:2px solid var(--gui-accent);border-radius:6px;background:var(--gui-soft);color:var(--gui-ink);font:800 15px/1.2 var(--gui-face),system-ui,sans-serif}
body.table-mode #compact-chat-open{flex:none;min-width:54px;min-height:44px;padding:5px 8px;border:1px solid var(--gui-line);border-radius:6px;background:var(--gui-soft);color:var(--gui-ink);font:700 14px/1.2 var(--gui-face),system-ui,sans-serif}
body.table-mode #compact-chat-open[hidden]{display:none!important}
body.table-mode #compact-controls-open:focus-visible{outline:3px solid #e5c34b;outline-offset:2px}
body.table-mode #app.on[data-compact-controls=true]>.rail,
body.table-mode #app.on[data-compact-controls=true]:has(.felt[data-fit-layout])>.rail{display:contents!important}
body.table-mode #app.on[data-compact-controls=true]>.rail>.rail-scroll{display:none!important}
body.table-mode #app.on[data-compact-controls=true]>.rail>#table-controls{display:none!important}
body.table-mode #app.on[data-compact-controls=true]>.rail>#table-notices{
  position:fixed;z-index:50;left:8px;right:8px;top:calc(var(--topbar-clearance) + 4px);max-height:32dvh;overflow:auto
}
body.table-mode #app.on[data-compact-controls=true]>#table-workspace,
body.table-mode #app.on[data-compact-controls=true]:has(.felt[data-fit-layout])>#table-workspace{
  display:block;grid-column:1;grid-row:2;min-width:0;min-height:0;width:100%;height:100%;overflow:hidden
}
body.table-mode #app.on[data-compact-controls=true]>#table-workspace>.felt{box-sizing:border-box;width:100%;max-width:none;height:100%;min-height:0}
body.table-mode #compact-controls-sheet{
  position:fixed;z-index:1200;inset:0;box-sizing:border-box;overflow:auto;
  padding:max(12px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));
  background:var(--gui-bg);color:var(--gui-ink);font:var(--gui-font)/1.3 var(--gui-face),system-ui,sans-serif
}
body.table-mode #compact-controls-sheet .compact-controls-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}
body.table-mode #compact-controls-title{margin:0;font-size:1.2em}
body.table-mode #compact-controls-close{min-height:44px;padding:6px 12px;border:2px solid var(--gui-accent);border-radius:6px;background:var(--gui-soft);color:var(--gui-ink);font:700 16px/1.2 var(--gui-face),system-ui,sans-serif}
body.table-mode #compact-controls-sheet p{font-size:.8em;margin:6px 0 12px}
body.table-mode #compact-controls-sheet #table-controls{display:flex;box-sizing:border-box;width:100%;max-width:640px;min-height:0;height:auto;max-height:none;overflow:visible;flex-direction:column;gap:10px;margin:0 auto;padding:8px;background:var(--gui-surface);color:var(--gui-ink)}
body.table-mode #compact-controls-sheet #board-panel .phone-viewer-seat{color:#1e2b29}
body.table-mode #compact-controls-sheet #table-controls #gui-play-actions{display:flex;position:static;width:100%;height:auto;max-height:none;overflow:visible;flex-direction:column;align-items:stretch;margin:0;padding:4px;gap:6px}
body.table-mode #compact-controls-sheet #table-controls #gui-play-actions button{min-height:44px;width:100%;flex:none;font-size:16px}

/* A tall Diagram hand may leave less than a usable Auction band on a compact
   desktop. Preserve the four suit groups in one readable horizontal row;
   thirteen separate card faces waste width as the viewport narrows. */
@media (min-width:561px) and (min-height:561px), (min-width:1101px){
  body.table-mode #app .felt[data-fit-layout=bidding][data-bidding-own-horizontal=on] #seat-0{
    left:8px;right:8px;width:calc(100% - 16px);max-width:none;transform:none
  }
  body.table-mode #app .felt[data-fit-layout=bidding][data-bidding-own-horizontal=on] #seat-0 .hand-slot{
    width:100%;height:48px;min-height:48px
  }
  :root[data-hand-display=diagram] body.table-mode #app .felt[data-fit-layout=bidding][data-bidding-own-horizontal=on] #seat-0 .diagramhand{
    display:flex;flex-direction:row;width:100%;height:48px;min-height:48px;
    align-items:center;justify-content:center;gap:clamp(5px,1vw,10px);padding:2px 5px;overflow:visible
  }
  :root[data-hand-display=diagram] body.table-mode #app .felt[data-fit-layout=bidding][data-bidding-own-horizontal=on] #seat-0 .diagramrow{
    display:flex;min-width:0;min-height:44px;align-items:center;flex:0 1 auto;gap:1px;overflow:visible
  }
  :root[data-hand-display=diagram] body.table-mode #app .felt[data-fit-layout=bidding][data-bidding-own-horizontal=on] #seat-0 .diagramrow>.slbl{
    display:block;width:auto;min-width:17px;flex:0 0 auto;font:900 21px/1 var(--gui-face),system-ui,sans-serif
  }
  :root[data-hand-display=diagram] body.table-mode #app .felt[data-fit-layout=bidding][data-bidding-own-horizontal=on] #seat-0 .diagramrank{
    display:grid;flex:0 1 auto;width:auto;min-width:15px;height:44px;min-height:44px;place-items:center;
    padding:0 1px;border:0;border-radius:2px;background:transparent;color:#17222b;
    font:800 clamp(17px,1.8vw,22px)/1 var(--gui-face),system-ui,sans-serif;overflow:visible
  }
  :root[data-hand-display=diagram] body.table-mode #app .felt[data-fit-layout=bidding][data-bidding-own-horizontal=on] #seat-0 .diagramrank::after{
    content:none
  }
  :root[data-hand-display=diagram] body.table-mode #app .felt[data-fit-layout=bidding][data-bidding-own-horizontal=on] #seat-0 .diagramvoid{
    display:block;min-height:0;font-size:17px
  }
  :root[data-hand-display=cards] body.table-mode #app .felt[data-fit-layout=bidding][data-bidding-own-horizontal=on] #seat-0 .hand{
    display:flex;flex-direction:row;width:100%;height:48px;min-height:48px;gap:2px;padding:2px;overflow:hidden
  }
  :root[data-hand-display=cards] body.table-mode #app .felt[data-fit-layout=bidding][data-bidding-own-horizontal=on] #seat-0 .hand .card{
    display:grid;flex:1 1 0;width:auto;min-width:0;height:44px;min-height:44px;place-items:center;margin:0;padding:1px
  }
}
@media (min-width:561px) and (max-width:900px){
  body.table-mode #app .felt[data-fit-layout=bidding] :is(#seat-1,#seat-3) .nameplate{
    min-width:0
  }
}

/* The compact editor replaces only the bid input surface. It never overlays
   the Auction or either protected hand. Normal layouts retain inline entry. */
body.table-mode #bid-alert-open,
body.table-mode #bid-alert-close{display:none}
body.table-mode #app .felt[data-fit-layout=bidding][data-compact-bid-details=on] #auction-panel .cap{display:none}
body.table-mode #app .felt[data-fit-layout=bidding][data-compact-bid-details=on] #auction-panel table.auction thead th{top:0}
body.table-mode #app .felt[data-fit-layout=bidding][data-compact-bid-details=on] #bid-alert-open{
  display:block;min-height:44px;width:100%;margin-top:5px;padding:4px 8px;
  font:700 15px/1.2 var(--gui-face),system-ui,sans-serif
}
body.table-mode #app .felt[data-fit-layout=bidding][data-compact-bid-details=on] #bidbox .call-alert-entry{
  display:none
}
body.table-mode #app .felt[data-fit-layout=bidding][data-compact-bid-details=on] #bidbox[data-compact-alert-open=true] .call-alert-entry{
  display:flex;position:absolute;inset:0;z-index:10;box-sizing:border-box;
  flex-direction:column;align-items:stretch;gap:4px;margin:0;padding:6px;
  overflow:auto;background:var(--gui-surface);border:2px solid var(--gui-accent)
}
body.table-mode #app .felt[data-fit-layout=bidding][data-compact-bid-details=on] #bidbox[data-compact-alert-open=true] #bid-alert-close{
  display:block;align-self:flex-end;min-width:72px;min-height:44px
}
body.table-mode #app .felt[data-fit-layout=bidding][data-compact-bid-details=on] #bidbox[data-compact-alert-open=true] .explanation-input{
  width:100%
}
body.table-mode #app .felt[data-fit-layout=bidding][data-compact-bid-details=on] #bidbox[data-compact-alert-open=true] #bid-alert-note{
  box-sizing:border-box;width:100%;min-height:44px;height:44px;resize:none
}
