/* New table materials and all decorative pixels are authored raster assets. */
body[data-table-palette="forest"] {--felt-art:url('../assets/art/felt-forest-v53.webp');--felt-1:#204b43;--felt-2:#183f39;--felt-3:#12352f;}
body[data-table-palette="sky"] {--felt-art:url('../assets/art/felt-sky-v53.webp');--felt-1:#44668d;--felt-2:#3b587b;--felt-3:#304c70;}
body[data-table-palette="depths"] {--felt-art:url('../assets/art/felt-depths-v53.webp');--felt-1:#194b60;--felt-2:#143d53;--felt-3:#10354a;}
body[data-table-palette="nebula"] {--felt-art:url('../assets/art/felt-nebula-v53.webp');--felt-1:#322d50;--felt-2:#272441;--felt-3:#211e38;}
body[data-table-palette] #feltBg {background-size:cover!important;}
body[data-material-state="loading"] :is(#feltBg,#blossomLayer),body[data-material-state="error"] :is(#feltBg,#blossomLayer) {visibility:hidden;}
body[data-material-state="loading"] {background-color:var(--felt-2);}
.table-ornament {position:absolute!important;display:block;pointer-events:none!important;object-fit:contain!important;image-rendering:pixelated;z-index:0;width:24%!important;height:auto!important;aspect-ratio:1;max-width:none!important;max-height:none!important;margin:0!important;padding:0!important;}
.table-corner-0 {top:0!important;left:0!important;right:auto!important;bottom:auto!important;}
.table-corner-1 {top:0!important;right:0!important;left:auto!important;bottom:auto!important;}
.table-corner-2 {bottom:0!important;left:0!important;right:auto!important;top:auto!important;}
.table-corner-3 {bottom:0!important;right:0!important;left:auto!important;top:auto!important;}
#blossomLayer[data-table-material]>.table-ornament {width:clamp(120px,23vw,290px)!important;opacity:.57;}
#blossomLayer[data-table-material]>.table-corner-0,#blossomLayer[data-table-material]>.table-corner-1 {top:clamp(140px,20vh,190px)!important;}
#blossomLayer[data-table-material]>.table-corner-2,#blossomLayer[data-table-material]>.table-corner-3 {bottom:clamp(110px,15vh,160px)!important;}
#blossomLayer[data-table-material="sky"]>.table-ornament {opacity:.37;}
#blossomLayer[data-table-material="nebula"]>.table-ornament {opacity:.53;}
.cosmetic-table-preview,.locker-table-preview,.premium-table-thumb,.profile-table-swatch {position:relative;overflow:hidden;isolation:isolate;}
.cosmetic-table-preview>.table-ornament,.locker-table-preview>.table-ornament {z-index:0!important;opacity:.67;}
.cosmetic-table-preview>.card,.cosmetic-table-preview>.locker-prop-meld,.cosmetic-table-preview>.locker-prop-pile,.locker-table-preview>.locker-prop-meld,.locker-table-preview>.locker-prop-pile {z-index:1!important;}
:is(.premium-table-thumb,.profile-table-swatch)[data-art-state="loading"] {background-image:none!important;}
:is(.premium-table-thumb,.profile-table-swatch)[data-art-state="loading"]>.table-ornament {visibility:hidden;}
.premium-table-options {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-top:14px;}
#modal-settings .premium-theme-choice.theme-swatch {display:flex!important;align-items:center;gap:10px;width:100%!important;min-width:0!important;height:72px!important;padding:8px!important;border:2px solid var(--chrome-border-strong)!important;border-radius:8px!important;background:var(--chrome-well)!important;color:var(--cream)!important;box-shadow:0 3px 0 var(--chrome-shadow)!important;text-align:left;}
#modal-settings .premium-theme-choice.active {border-color:var(--gold)!important;}
#modal-settings .premium-theme-choice>span:last-child {display:flex;flex-direction:column;gap:6px;min-width:0;}
#modal-settings .premium-theme-choice strong {font:600 13px/1.2 var(--ui-display);}
#modal-settings .premium-theme-choice small {font:500 10px/1.1 var(--ui-display);color:var(--chrome-muted);}
#modal-settings .premium-theme-choice::after {display:none!important;}
.premium-table-thumb {flex:0 0 68px;width:68px;height:49px;border:1px solid var(--chrome-border);border-radius:5px;background-size:cover;background-position:center;}
.premium-table-thumb>.table-ornament {width:43%!important;}
/* Readable portrait cards. Flex-basis must not turn into a height in a column. */
.pilotta-trick-cards {--trick-w:83px;--trick-slot:100px;gap:10px!important;min-height:166px!important;padding:7px 4px 0!important;flex-wrap:nowrap!important;}
.pilotta-trick-cards .trick-play {flex:0 0 var(--trick-slot);width:var(--trick-slot);gap:6px;align-self:flex-start;}
#screen-game .pilotta-trick-cards .trick-play>.card {flex:0 0 auto!important;width:var(--trick-w)!important;height:calc(var(--trick-w) * 1.435)!important;--card-w:var(--trick-w);--card-h:calc(var(--trick-w) * 1.435);aspect-ratio:1/1.435;margin:0!important;}
.pilotta-trick-cards .trick-player-name {max-width:100%;font:600 13px/1.15 var(--ui-display);color:var(--cream);}
.trick-card-state {display:block;min-height:15px;font:600 10px/1.2 var(--ui-display);color:var(--chrome-muted);}
.trick-play.is-winning .trick-card-state {color:#aee3c3;font-weight:700;}
.trick-play.is-complete.is-winning>.card {box-shadow:0 0 0 3px #81c59f,3px 5px 0 #15251d66;}
body.light .trick-play.is-winning .trick-card-state {color:#24533a;}
.pilotta-board {width:100%;gap:9px!important;justify-content:flex-start!important;}
.pilotta-contract {position:relative;width:min(100%,560px);padding:10px 15px;border:1px solid var(--chrome-border-strong);border-radius:9px;background:var(--chrome-well);text-align:left;color:var(--cream);}
.pilotta-contract-heading {display:flex;justify-content:space-between;gap:10px;align-items:center;margin-bottom:5px;font:600 11px/1.2 var(--ui-display);color:var(--chrome-muted);}
.pilotta-contract-team {color:var(--gold-ink);}
.pilotta-contract-value {display:flex;flex-wrap:wrap;align-items:center;gap:8px;font:700 20px/1.2 var(--ui-display);}
.pilotta-double {font-size:11px;color:var(--gold-ink);padding:2px 5px;border:1px solid var(--chrome-border-strong);border-radius:4px;}
.pilotta-contract-target {display:block;font:500 12px/1.35 var(--ui-display);margin-top:5px;}
.pilotta-contract-help {position:static!important;font:500 12px/1.5 var(--ui-display);}
.pilotta-contract-help>summary {cursor:pointer;color:var(--chrome-muted);margin-top:6px;font-size:11px;}
.pilotta-contract-help>p {margin:8px 0 0;max-width:55ch;}
.pilotta-trick-stage {width:min(100%,560px);}
.pilotta-stage-caption {display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:5px 12px;padding:0 5px;font:600 14px/1.2 var(--ui-display);color:var(--cream);}
.pilotta-stage-caption>span {font-size:11px;}
.pilotta-trick-result {display:flex;flex-wrap:wrap;gap:4px 10px;padding:5px;font:600 12px/1.35 var(--ui-display);color:#b8e2c9;}
.pilotta-trick-result>small {font-size:11px;font-weight:500;color:var(--cream);}
body.light .pilotta-trick-result {color:#24533a;}
.pilotta-trick-totals {display:flex;justify-content:center;gap:8px;width:min(100%,560px);}
.pilotta-team-tricks {display:flex;flex:1;justify-content:center;align-items:center;gap:7px;padding:7px 9px;border:1px solid var(--chrome-border-strong);border-radius:7px;background:var(--chrome-well);color:var(--cream);font:600 12px/1.2 var(--ui-display);}
.pilotta-team-tricks strong {font-size:19px;color:var(--gold-ink);}
.pilotta-team-tricks small {font-size:10px;color:var(--chrome-muted);}
.pilotta-previous-winner {font:500 11px/1.3 var(--ui-display);color:var(--cream);}
.pilotta-play-hint {display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:5px 12px;font:600 12px/1.3 var(--ui-display);color:var(--cream);}
.pilotta-legal-key {display:inline-flex;align-items:center;gap:5px;font:500 10px/1.2 var(--ui-display);}
.pilotta-legal-key::before {content:'';width:12px;height:4px;background:#71c59e;box-shadow:0 1px 0 #214c39;}
.pilotta-auction {width:min(100%,560px);display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;list-style:none;margin:0;padding:0;}
.pilotta-auction>li {display:flex;justify-content:space-between;gap:7px;padding:7px 10px;background:var(--chrome-well);border:1px solid var(--chrome-border);border-radius:6px;font:500 12px/1.2 var(--ui-display);color:var(--cream);}
/* Legal choices use the card's own edge, without a floating tab or fading. */
body[data-game="pilotta"] #handRow>.card.unplayable {opacity:1!important;}
body[data-game="pilotta"] #handRow>.card.legal-card:not(.selected) {box-shadow:3px 4px 0 #0007;}
body.light[data-game="pilotta"] #handRow>.card.legal-card:not(.selected) {box-shadow:3px 4px 0 #3c322252;}
#handRow[data-legal-filtered="true"]>.card.legal-card:not(.selected) {outline:2px solid color-mix(in srgb,var(--gold) 62%,transparent);outline-offset:-3px;}
@media(max-width:760px){
 .premium-table-options {gap:8px;}
 #modal-settings .premium-theme-choice.theme-swatch {gap:7px;height:73px!important;padding:6px!important;}
 .premium-table-thumb {flex-basis:48px;width:48px;height:43px;}
 #modal-settings .premium-theme-choice strong {font-size:11px;}
 #blossomLayer[data-table-material]>.table-ornament {width:clamp(100px,30vw,180px)!important;opacity:.48;}
 #blossomLayer[data-table-material]>.table-corner-0,#blossomLayer[data-table-material]>.table-corner-1 {top:clamp(230px,29vh,280px)!important;}
 #blossomLayer[data-table-material]>.table-corner-2,#blossomLayer[data-table-material]>.table-corner-3 {bottom:clamp(160px,23vh,220px)!important;}
 #blossomLayer[data-table-material="sky"]>.table-ornament {opacity:.28;}
 .pilotta-board {gap:7px!important;}
 .pilotta-contract {padding:8px 10px;}
 .pilotta-contract-value {font-size:17px;}
 .pilotta-contract-target {font-size:11px;}
 .pilotta-contract-heading {font-size:10px;}
 .pilotta-trick-cards {--trick-w:53px;--trick-slot:64px;gap:5px!important;min-height:116px!important;}
 .pilotta-trick-cards .trick-player-name {font-size:11px;}
 .pilotta-stage-caption {font-size:12px;}
 .pilotta-stage-caption>span {font-size:10px;}
 .pilotta-team-tricks {padding:6px;gap:5px;font-size:11px;}
 .pilotta-team-tricks strong {font-size:16px;}
 .pilotta-team-tricks small {font-size:9px;}
 .pilotta-play-hint {font-size:11px;}
}
@media(max-height:550px) and (min-width:620px){
 .pilotta-contract {padding:6px 10px;}
 .pilotta-trick-cards {--trick-w:42px;--trick-slot:60px;min-height:96px!important;}
 .pilotta-contract-value {font-size:15px;}
 .pilotta-board {gap:5px!important;}
}
/* Announcements are available to assistive technology without entering layout. */
#pilottaTrickAnnouncer {position:fixed!important;left:0;top:0;width:1px!important;height:1px!important;overflow:hidden!important;clip-path:inset(50%);white-space:nowrap;pointer-events:none;}
/* Table labels contrast with the felt, independently of the chrome's mode. */
body {--pilotta-ink:#fff1d5;--pilotta-quiet:#e4decf;--pilotta-winner:#b8efd0;--pilotta-text-shadow:#10211e;}
body[data-table-palette="cream"] {--pilotta-ink:#342b25;--pilotta-quiet:#514535;--pilotta-winner:#236046;--pilotta-text-shadow:#fff4d3;}
body[data-game="pilotta"] .team-score-rail>small,.pilotta-stage-caption,.pilotta-play-hint,.pilotta-previous-winner,.pilotta-trick-cards .trick-player-name,.pilotta-trick-result>small {color:var(--pilotta-ink)!important;text-shadow:0 1px 1px var(--pilotta-text-shadow);}
.pilotta-trick-cards .trick-card-state {color:var(--pilotta-quiet);text-shadow:0 1px 1px var(--pilotta-text-shadow);}
.pilotta-trick-cards .is-winning .trick-card-state,.pilotta-trick-result {color:var(--pilotta-winner)!important;text-shadow:0 1px 1px var(--pilotta-text-shadow);}
body.light :is(.pilotta-contract,.pilotta-team-tricks,.pilotta-auction>li) {background:var(--chrome-raised)!important;}
/* The explanation opens over the table instead of pushing cards into the hand. */
.pilotta-contract-help[open]>p {position:absolute!important;left:0;right:0;top:calc(100% + 5px);z-index:40!important;max-height:min(220px,40dvh);overflow:auto;margin:0!important;padding:12px!important;border:2px solid var(--chrome-border-strong);border-radius:8px;background:var(--chrome-raised)!important;color:var(--cream);box-shadow:0 5px 12px #0005;}
@media(max-height:740px){
 .pilotta-contract {padding:6px 10px;}
 .pilotta-contract-heading {font-size:9px;margin-bottom:3px;padding-right:25px;}
 .pilotta-contract-value {font-size:15px;line-height:1.1;}
 .pilotta-contract-target {font-size:10px;margin-top:3px;}
 .pilotta-contract-help>summary {position:absolute;right:5px;top:4px;width:24px;height:24px;display:grid;place-items:center;list-style:none;font-size:0;margin:0;border:1px solid var(--chrome-border-strong);border-radius:5px;background:var(--chrome-raised);color:var(--cream);}
 .pilotta-contract-help>summary::-webkit-details-marker {display:none;}
 .pilotta-contract-help>summary::after {content:'?';font:700 15px/1 var(--ui-display);}
 .pilotta-trick-cards {--trick-w:44px;--trick-slot:57px;min-height:100px!important;gap:4px!important;}
 .pilotta-trick-cards .trick-play {gap:3px!important;}
 .pilotta-trick-cards .trick-player-name {font-size:10px;}
 .trick-card-state {font-size:9px;min-height:12px;}
 .pilotta-stage-caption {font-size:11px;}
 .pilotta-stage-caption>span {font-size:9px;}
 .pilotta-team-tricks {padding:4px 6px;}
 .pilotta-board {gap:5px!important;}
 .pilotta-play-hint {font-size:10px;gap:3px 8px;}
 .pilotta-legal-key {font-size:9px;}
}
@media(max-height:740px) and (max-width:760px){
 body[data-game="pilotta"] #screen-game .statusbar {height:54px!important;min-height:54px!important;flex-basis:54px!important;}
 body[data-game="pilotta"] #screen-game .status-center {gap:2px!important;}
 body[data-game="pilotta"] #screen-game .status-phase {font-size:12px!important;}
 body[data-game="pilotta"] #screen-game .status-round {font-size:10px!important;}
 body[data-game="pilotta"] #screen-game .pilotta-board {flex:1 1 0!important;min-height:0!important;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;padding-top:3px;}
 .pilotta-contract-help[open]>p {max-height:36vh;}
}
@media(max-height:550px) and (min-width:620px){
 body[data-game="pilotta"] #screen-game .game-main {display:grid!important;grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);grid-template-rows:52px 24px minmax(0,1fr) auto auto;gap:4px 12px!important;}
 body[data-game="pilotta"] #screen-game #playerRail {grid-column:1/-1;grid-row:1;}
 body[data-game="pilotta"] #screen-game #teamScoreRail {grid-column:1/-1;grid-row:2;}
 body[data-game="pilotta"] #screen-game #partnershipBoard {grid-column:1;grid-row:3/6;min-height:0!important;flex:none!important;}
 body[data-game="pilotta"] #screen-game #handZone {grid-column:2;grid-row:3;align-self:center;}
 body[data-game="pilotta"] #screen-game #gameControls {grid-column:2;grid-row:4;}
 body[data-game="pilotta"] #screen-game .action-bar {grid-column:2;grid-row:5;}
 body[data-game="pilotta"] #screen-game #playerRail .pchip,body[data-game="pilotta"] #screen-game #playerRail .pchip.is-me {height:52px!important;min-height:52px!important;grid-template-columns:20px minmax(36px,1fr) auto!important;grid-template-rows:36px!important;padding:5px!important;gap:4px!important;}
 body[data-game="pilotta"] #screen-game #playerRail .pchip.has-turn-hud {grid-template-columns:20px minmax(30px,1fr) auto 21px!important;}
 body[data-game="pilotta"] #screen-game #playerRail .pchip .pchip-av {width:20px!important;height:20px!important;min-width:20px!important;}
 body[data-game="pilotta"] #screen-game #playerRail .pchip .pchip-body {grid-column:2!important;flex-direction:column!important;align-items:flex-start!important;gap:2px!important;}
 body[data-game="pilotta"] #screen-game #playerRail .pchip .pchip-name {font-size:11px!important;}
 body[data-game="pilotta"] #screen-game #playerRail .pchip .pchip-meta {gap:2px 4px!important;}
 body[data-game="pilotta"] #screen-game #playerRail .pchip .opponent-hand {display:flex!important;grid-column:3!important;grid-row:1!important;height:30px!important;gap:2px!important;}
 body[data-game="pilotta"] #screen-game #playerRail .opponent-back,body[data-game="pilotta"] #screen-game #playerRail .opponent-card-stack {width:17px;height:25px;flex-basis:17px;}
 body[data-game="pilotta"] #screen-game #playerRail .pchip .pchip-turn-hud {grid-column:4!important;grid-row:1!important;}
 .pilotta-trick-cards {--trick-w:42px;--trick-slot:57px;min-height:94px!important;}
 .pilotta-trick-result {padding:3px;font-size:10px;}
 .pilotta-trick-result>small {font-size:9px;}
}
/* Keep the compact bid explanation anchored below its own contract. */
@media(max-height:740px) and (max-width:760px){
 .pilotta-contract-help[open]>p {position:absolute!important;left:0!important;right:0!important;top:calc(100% + 5px)!important;max-height:36vh;}
 .pilotta-contract-help>summary {z-index:101;}
}
@media(max-height:680px) and (max-width:760px){
 body[data-game="pilotta"] #screen-game #playerRail .pchip:not(.is-me) {height:73px!important;min-height:73px!important;grid-template-rows:34px 27px!important;padding:3px!important;row-gap:2px!important;}
 body[data-game="pilotta"] #screen-game #playerRail .pchip:not(.is-me) .opponent-hand {height:27px!important;}
 body[data-game="pilotta"] #screen-game #playerRail .opponent-back,body[data-game="pilotta"] #screen-game #playerRail .opponent-card-stack {height:27px!important;width:19px!important;flex-basis:19px!important;}
 body[data-game="pilotta"] #screen-game #playerRail:not([data-players="2"]) .pchip.is-me {height:34px!important;min-height:34px!important;grid-template-rows:24px!important;padding:3px!important;}
 body[data-game="pilotta"] #screen-game #playerRail {gap:5px!important;}
 body[data-game="pilotta"] .team-score-rail {gap:5px!important;margin:3px 0!important;}
 body[data-game="pilotta"] .team-score {font-size:10px!important;gap:5px!important;padding:3px 6px!important;white-space:nowrap;}
 body[data-game="pilotta"] .team-score strong {font-size:15px!important;}
 body[data-game="pilotta"] .team-score-rail>small {font-size:9px!important;line-height:1.1;}
 body[data-game="pilotta"] .pilotta-stage-caption {font-size:10px;}
 body[data-game="pilotta"] .pilotta-stage-caption>span {font-size:8px;}
}
@media(max-height:680px) and (max-width:760px){
 body[data-game="pilotta"] #gameControls:empty {display:none!important;}
 body[data-game="pilotta"] #gameControls {min-height:22px;padding:0 4px;}
}
@media(max-height:680px) and (max-width:360px){
 body[data-game="pilotta"] #screen-game #playerRail .pchip:not(.is-me) {height:83px!important;min-height:83px!important;grid-template-rows:44px 27px!important;}
}
/* On a failed material request, show its calm base colour rather than
   revealing an incomplete set of decorations. The shared retry restores it. */
:is(.premium-table-thumb,.profile-table-swatch,.cosmetic-table-preview,.locker-table-preview)[data-table-material][data-art-state="error"] {background-image:none!important;}
[data-table-material][data-art-state="error"]>.table-ornament {visibility:hidden!important;}
@media(max-height:680px) and (max-width:760px){
 /* The completed trick already names who leads next. Avoid repeating that
    wait message at the expense of the deal's trick counters. */
 body[data-game="pilotta"] #partnershipBoard:has(.trick-play.is-complete)~#gameControls:has(>.game-wait:only-child) {display:none!important;}
}
