/* 16:9 stage. UI coordinates are shared with the 3D cards through their hit regions. */
:root{--gold:#c6a264;--ink:#f0ddb6;--muted:#c4b694}
body.in-game{background:#101911}
body.in-game main,.table-world{position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);width:min(100vw,177.7778dvh);height:min(100dvh,56.25vw)}
.table-world{background:#172a1b}
body.in-game .game{background:#183a25!important}
html.webgl-table body.in-game .game{background:transparent!important}
body.in-game header{top:calc((100dvh - min(100dvh,56.25vw))/2 + 6cqh);right:calc((100vw - min(100vw,177.7778dvh))/2 + 5cqw)}
.in-game #sound,.game .game-menu{width:3.4cqw;height:3.4cqw;min-height:0;border:1px solid #cfab68;background:linear-gradient(#203824,#122719);box-shadow:inset 0 0 0 2px #182117,0 0 0 1px #4c391f,0 3px 7px #0008}
.in-game #sound{margin-right:4.7cqw}
body.in-game header{top:calc((100dvh - min(100dvh,56.25vw))/2 + min(3.5vw,6.222dvh));right:calc((100vw - min(100vw,177.7778dvh))/2 + min(5vw,8.889dvh));height:auto}
body.in-game #sound{width:min(3.4vw,6.04dvh);height:min(3.4vw,6.04dvh);margin-right:min(4.7vw,8.356dvh)}
.game .game-top{top:6.2%;right:5%;width:3.4cqw!important;height:3.4cqw!important}
.game-menu .ui-icon{width:1.8cqw;height:2.3cqw}
.in-game #sound .ui-icon{width:min(1.8vw,3.2dvh);height:min(2.3vw,4.09dvh)}
.game .opponents,.game:has(.opponent:only-child) .opponents{left:29%!important;right:26%!important;top:6%!important;height:24%;gap:1%!important;align-items:flex-start}
.game .opponent,.game .opponent:only-child,.game:has(.opponent:nth-child(3)) .opponent{width:31%;max-width:15cqw!important;gap:0}
.game .opponent-cards{width:13cqw;height:7.1cqw}
.game .mini-back{--fan-index:calc((var(--i) - (var(--count) - 1)/2)*min(1,4/max(1,var(--count) - 1)));width:4.7cqw;height:7.05cqw;left:calc(50% - 2.35cqw + var(--fan-index)*1.15cqw);top:0;background-image:url('/assets/imperial-back-v33.jpg');transform:rotate(calc(var(--fan-index)*8deg))}
.game .opponent .portrait{width:7.04cqw;height:7.04cqw;margin-top:-4.5cqw;border:2px solid #c7a46b;border-radius:50%;box-shadow:0 0 0 2px #3a2c18,0 4px 10px #0009}
.game .opponent .name{font:1.35cqw/1.3 "Literata", Georgia,serif;min-height:0;padding:.45cqw 0 .1cqw;background:none!important;margin-top:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.game .opponent .status{font:1.15cqw/1.3 "Literata", Georgia,serif;letter-spacing:0!important;min-height:1.5cqw;color:#decd9e;margin:0;max-width:100%;overflow-wrap:anywhere}
.game .opponent.active .portrait{border-color:#ecd696;box-shadow:0 0 0 2px #796139,0 0 13px #c9a56666}
.game .opponent-count{width:1.8cqw;height:1.8cqw;right:2.1cqw;bottom:-1.9cqw;background:#142519;color:#f2ddb5;border:1px solid #cba462;font:1.2cqw "Literata", Georgia,serif}
.game .table-stats{inset:9% auto auto 6.7%!important;width:22%!important;height:21%!important;font:1.4cqw/1.4 "Literata", Georgia,serif;border:0}
.game .supply{display:grid;position:relative;grid-template-columns:1fr;gap:.45cqw;width:100%;padding:1.2cqw 0 0 12.6cqw;background:none!important}
.game .supply>span:not(.supply-cards){display:flex;flex-direction:row;justify-content:flex-start;gap:.4cqw;white-space:nowrap;align-items:center}
.game .table-stats b{font:inherit;color:inherit;margin:0}
.game .supply-cards{left:0;top:0;bottom:auto;width:10.7cqw;height:12cqw;display:block}
.game .supply-cards .card{width:7.6cqw;height:11.4cqw;top:0;left:0}
.game .supply-cards .back{transform:rotate(-3deg);background-image:url('/assets/imperial-back-v33.jpg')}
.game .supply-cards .trump{left:3.0cqw;top:1cqw;width:7.6cqw;height:11.4cqw;transform:rotate(0deg)}
.game .supply .discard-count{font-size:1.15cqw;display:block;width:auto;padding:0;background:none!important;opacity:.8}
.game .trump-badge .ui-icon{width:1.8cqw;height:2.3cqw}
.game .play-area{left:22%;right:27%;top:31%;bottom:40%;border:0;overflow:visible!important;align-items:center!important}
.game .battles{grid-template-columns:repeat(var(--columns,1),240px)!important;grid-auto-rows:270px;gap:24px 120px!important}
.game .battle{width:240px!important;height:270px!important}
.game .battle .card{width:160px!important;height:240px!important;left:20px!important;top:15px!important}
.game .battle .defense{left:60px!important;top:0!important}
.game .table-empty{font:1.35cqw/1.6 "Literata", Georgia,serif;opacity:.62}
.game .player-dock{position:absolute;inset:67% 4.3% 0;display:grid;grid-template-columns:19% minmax(0,1fr) 21%;column-gap:3%;align-items:start;z-index:7;pointer-events:none}
.game .turn-text{grid-column:1;align-self:start;text-align:left;font:2.45cqw/1.18 "Literata", Georgia,serif;color:#efd7aa;padding:0;margin:0;font-weight:400!important;overflow-wrap:anywhere}
.game .turn-text small{font:1.65cqw/1.32 "Literata", Georgia,serif;display:block;margin-top:.8cqw;color:#efddba}
.game .turn-text .hand-count-text{display:block;margin-top:1.5cqw;font:1.2cqw/1.3 "Literata", Georgia,serif;color:#d7c5a0}
.game .control-stack{grid-column:3;display:grid;grid-template-rows:3.6cqw 3cqw;gap:.85cqw;margin-top:2.4cqw;align-items:stretch;min-width:0;pointer-events:auto}
.game .actions{display:flex;width:100%;height:100%;gap:.5cqw}
.game .actions:empty{display:block}
.game .actions button,.game .hand-tools button{font:1.2cqw/1.15 "Literata", Georgia,serif;white-space:normal;min-height:0;min-width:0;width:100%;height:100%;margin:0;padding:.4cqw .5cqw;background:linear-gradient(135deg,#293d29,#10291c);border:1px solid #c19c58;border-radius:.45cqw;box-shadow:0 0 0 1px #1e180d,inset 0 0 0 2px #384731,0 4px 7px #0007;color:#f3dfb4}
.game .actions button{font-size:1.8cqw;box-shadow:0 0 0 1px #392b16,inset 0 0 0 2px #61734c,0 4px 7px #0007}
.game .hand-tools{display:grid;grid-template-columns:1fr 1fr;gap:.85cqw;height:100%;min-width:0}
.game .hand-tools button{font-size:1.1cqw;background:linear-gradient(#203724,#12291b)}
.game .hand-tools button[aria-pressed=true]{border-color:#e6ce90;box-shadow:inset 0 0 0 1px #8a784d,0 3px 6px #0007}
.game button:focus-visible{outline:2px solid #f9e5a6;outline-offset:4px}
.game .hand-area{position:absolute!important;inset:76% 29% 0!important;width:auto!important;height:auto!important;max-width:none!important;margin:0!important;z-index:8;pointer-events:none}
.game .hand-viewport{inset:0!important;overflow:visible!important;width:100%!important;height:100%!important;padding:0}
.game .hand{height:100%!important;width:100%;margin:0}
.game .hand .card{--card-w:6.7cqw;--card-h:calc(var(--card-w)*1.5);bottom:8.5cqh;pointer-events:auto;transform:translate(var(--x),var(--y)) rotate(var(--r));box-shadow:0 3px 7px #0009;transition:transform .42s cubic-bezier(.16,1,.3,1)}
.game .hand .card.playable{box-shadow:0 0 0 1px #d1bd77,0 3px 7px #0009}
.game .hand .card:hover{transform:translate(var(--x),calc(var(--y) - 18px)) rotate(var(--r))}
.game .hand-toolbar,.game .hand-scroll{display:none!important}
.game .hand-bottom{display:block!important;position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
.card-art{filter:none}
.game .card{border-radius:4.8%}
/* Narrow screens change the arrangement rather than shrinking every label. */
@media(max-width:900px) and (orientation:portrait){
 body.in-game main,.table-world{width:100vw;height:100dvh}
 body.in-game header{top:12px;right:14px;height:40px}body.in-game #sound{width:40px;height:40px;margin-right:50px}.in-game #sound .ui-icon{width:23px;height:30px}
 .game .game-top{top:12px;right:14px;width:40px!important;height:40px!important}.game .game-menu{width:40px;height:40px}.game-menu .ui-icon{width:23px;height:30px}
 .game .opponents,.game:has(.opponent:only-child) .opponents{left:5%!important;right:5%!important;top:10%!important;height:22%;gap:2%!important}
 .game .opponent,.game .opponent:only-child,.game:has(.opponent:nth-child(3)) .opponent{max-width:29cqw!important;width:31%}.game .opponent-cards{width:26cqw;height:15cqw}.game .mini-back{width:10cqw;height:15cqw;left:calc(50% - 5cqw + var(--fan-index)*2cqw)}
 .game .opponent .portrait{width:16.5cqw;height:16.5cqw;margin-top:-8cqw}.game .opponent-count{width:23px;height:23px;font-size:14px;right:1cqw;bottom:-3.5cqw}.game .opponent .name{font-size:16px;padding-top:5px}.game .opponent .status{font-size:12px;min-height:16px}
 .game .table-stats{inset:32% 5% auto!important;width:90%!important;height:5%!important;font-size:14px}.game .supply{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:0}.game .supply-cards{display:none}.game .supply .discard-count{font-size:12px}.game .trump-badge .ui-icon{width:17px;height:23px}
 .game .play-area{left:5%;right:5%;top:38%;bottom:39%}.game .table-empty{font-size:16px}
 .game .player-dock{inset:64% 5% 22%;grid-template-columns:minmax(0,1fr) minmax(156px,.95fr);column-gap:12px}
 .game .turn-text{font-size:22px}.game .turn-text small{font-size:14px;margin-top:6px}.game .turn-text .hand-count-text{font-size:13px;margin-top:8px}
 .game .control-stack{grid-column:2;margin-top:0;grid-template-rows:44px 44px;gap:8px}.game .actions button{font-size:18px;padding:6px}.game .hand-tools{gap:6px}.game .hand-tools button{font-size:12px;padding:4px;border-radius:5px}
 .game .hand-area{inset:80% 5% 0!important}.game .hand .card{--card-w:min(21cqw,11.5cqh);bottom:max(16px,env(safe-area-inset-bottom))}
}
@media(max-height:700px) and (orientation:portrait){
 .game .opponents,.game:has(.opponent:only-child) .opponents{top:10%!important}.game .opponent .portrait{width:14.3cqw;height:14.3cqw}.game .opponent .status{font-size:11px}.game .table-stats{inset:34% 5% auto!important}.game .play-area{top:40%;bottom:41%}.game .player-dock{top:61%;bottom:20%}.game .turn-text{font-size:20px}.game .turn-text small{font-size:13px}.game .turn-text .hand-count-text{margin-top:5px}.game .hand-area{inset:80% 5% 0!important}
}
@media(max-height:500px) and (orientation:landscape){
 .game .opponent .name{font-size:13px}.game .opponent .status{font-size:11px}.game .opponent-count{width:19px;height:19px;font-size:12px}
 .game .table-stats{font-size:12px}.game .supply .discard-count{font-size:11px}.game .player-dock{top:64%;grid-template-columns:24% minmax(0,1fr) 25%;gap:2%}.game .turn-text{font-size:20px}.game .turn-text small{font-size:13px;margin-top:5px}.game .turn-text .hand-count-text{font-size:11px;margin-top:7px}.game .control-stack{grid-template-rows:36px 36px;gap:7px;margin-top:0}.game .actions button{font-size:18px}.game .hand-tools button{font-size:12px}.game .hand-area{inset:77% 29% 0!important}.game .hand .card{--card-w:min(6.7cqw,12cqh);bottom:12px}
 body.in-game #sound,.game .game-menu{min-width:32px;min-height:32px}
}
@media(prefers-reduced-motion:reduce){.game *{animation:none!important;transition:none!important}}

.game .turn-title{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.game .supply>span:not(.supply-cards){gap:.35em}
@media(max-width:900px) and (orientation:portrait){.game .actions button{border-radius:5px}}

/* Empty header space must not cover the separate game menu. */
body.in-game header{pointer-events:none}
body.in-game header button{pointer-events:auto}

/* WebGL owns hover lift; its invisible DOM hit slot must stay stationary. */
.webgl-table .game .hand .card:hover{transform:translate(var(--x),var(--y)) rotate(var(--r))}

/* Hit slots are immediate; the retained 3D meshes own all card motion. */
.webgl-table .game .hand .card{transition:none}

/* Four opponents share the top edge without crossing neighbouring fans. */
.game:has(.opponent:nth-child(4)) .opponents{left:29%!important;right:10%!important;gap:1%!important}
.game:has(.opponent:nth-child(4)) .opponent{width:24%;max-width:14cqw!important}
@media(max-width:900px) and (orientation:portrait){
 .game:has(.opponent:nth-child(4)) .opponents{left:5%!important;right:5%!important;gap:1%!important}
 .game:has(.opponent:nth-child(4)) .opponent{width:24%;max-width:21cqw!important}
 .game:has(.opponent:nth-child(4)) .opponent-cards{width:20cqw;height:13cqw}
 .game:has(.opponent:nth-child(4)) .mini-back{width:8cqw;height:12cqw;left:calc(50% - 4cqw + var(--fan-index)*1.5cqw)}
 .game:has(.opponent:nth-child(4)) .opponent .portrait{width:14.3cqw;height:14.3cqw;margin-top:-7cqw}
 .game:has(.opponent:nth-child(4)) .opponent .name{font-size:13px;padding-inline:0}
 .game:has(.opponent:nth-child(4)) .opponent .status{font-size:11px}
 .game:has(.opponent:nth-child(4)) .opponent-count{right:0}
 .ui-choice-options:has(> :nth-child(4)){grid-template-columns:repeat(2,minmax(0,1fr))}
}
