/* One 3D table, with DOM controls and player information. */
.deskWrap{max-width:1750px;margin:7px auto 6px;padding:0 clamp(8px,1.1vw,25px)}
.deskWrap>.row.space{min-height:48px;padding:0 19px}.deskWrap h2{font:18px Georgia,'Microsoft YaHei',serif;letter-spacing:.5px;color:#e9d3a0;margin:0}
.machineTable{position:relative;width:100%}
.machineTable .playerBox{position:absolute;width:132px;text-align:center;border:1px solid #c8b16b50;border-radius:10px;color:#f7e6c2}
.machineTable .playerBox strong{display:block;letter-spacing:.6px}.machineTable .playerBox small{color:#d7b875}.machineTable .playerBox .handCount{display:block;margin-top:3px}.machineTable .playerBox.me{border-color:#f7d78e}
.machineTable .myHand{position:relative;display:flex;justify-content:center;align-items:flex-end;border-radius:0;filter:drop-shadow(0 8px 7px #001c1590)}
.machineTable .tile{display:flex;align-items:center;justify-content:center;padding:0;border:0;background:transparent;border-radius:10% 10% 7% 7%;box-shadow:none;filter:drop-shadow(0 3px 3px #001b1280);cursor:pointer;user-select:none;touch-action:manipulation;transition:transform .15s,filter .15s}
.machineTable .tile .tileFace{display:block;width:100%;height:100%;border-radius:10% 10% 7% 7%;pointer-events:none}
.machineTable .tile.drawn{margin-left:16px}.machineTable .tile:hover{transform:translateY(-5px);filter:brightness(1.04) drop-shadow(0 4px 4px #001b1280)}.machineTable .tile.selected{transform:translateY(-19px);filter:drop-shadow(0 0 5px #f4d27d) drop-shadow(0 6px 4px #001b12a0)}.machineTable .tile:focus-visible{outline:3px solid #f4d278;outline-offset:2px}
.machineTable .turnPrompt{position:absolute;text-align:center}

.deskWrap .desk.machineTable{height:calc(100dvh - 174px);min-height:340px;max-height:none;aspect-ratio:auto;border:0;border-radius:0;background:transparent;box-shadow:none;isolation:isolate;overflow:hidden}
.machineTable::before,.machineTable::after{display:none}
.machineTable>.webglTable{position:absolute;inset:0;width:100%;height:100%;display:block;z-index:0;pointer-events:none}
.machineTable .playerBox{z-index:3;min-width:108px;padding:7px 10px;background:#092b20e6;border-color:#c8b16b50;box-shadow:0 3px 12px #00171033}
.machineTable .playerBox strong{font-size:12px}.machineTable .playerBox small{font-size:10px}
.machineTable .playerBox.north{left:calc(50% + 185px);top:10px;transform:translateX(-50%)}
.machineTable .playerBox.west{left:10px;top:43%}.machineTable .playerBox.east{right:10px;top:43%}
.machineTable .playerBox.south{left:10px;bottom:12px;top:auto;transform:none}
.machineTable .playerInteraction{z-index:5;bottom:8px;gap:14px;left:1%;right:1%}
.machineTable .myHand{background:none;box-shadow:none;min-height:0;padding:0;gap:2px;flex-wrap:nowrap}
.machineTable #hand>.tile{flex:0 0 clamp(32px,3.4vw,53px);width:clamp(32px,3.4vw,53px);height:auto;aspect-ratio:347/532;min-width:0}
.machineTable .tableActions{margin-right:13%;gap:9px}
.desk.machineTable .turnPrompt{z-index:4;top:auto;left:50%;bottom:calc(var(--machine-hand-height,84px) + 26px);transform:translateX(-50%);width:max-content;max-width:38%;min-width:0;min-height:0;height:auto;padding:6px 12px;display:block;border:1px solid #c2b47645;border-radius:20px;background:#062b22bb;box-shadow:none;pointer-events:none}
.machineTable .turnPrompt .status{font-size:11px;line-height:16px;margin:0;color:#f1d89f}
@media(min-width:1024px){.machineTable .playerBox.north{top:0;display:flex;align-items:center;gap:8px;padding:5px 10px}.machineTable .playerBox.north strong,.machineTable .playerBox.north small{display:inline;margin:0}}
@media(max-width:1023px){
 .deskWrap .desk.machineTable{height:calc(100dvh - 198px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px));min-height:290px}
 .machineTable .playerBox{width:calc((100% - 32px)/3);padding:4px 3px;min-width:0}
 .machineTable .playerBox.north{left:50%;top:6px}.machineTable .playerBox.west{left:6px;top:6px}.machineTable .playerBox.east{right:6px;top:6px}
 .machineTable .playerBox.south{display:none}
 .machineTable .playerBox strong{font-size:11px}.machineTable .playerBox small{font-size:9px}
 .machineTable .playerInteraction{left:8px;right:8px;bottom:5px;gap:12px}
 .machineTable .myHand{display:grid;grid-template-columns:repeat(7,minmax(0,40px));gap:7px 2px}
 .machineTable #hand>.tile{width:100%;max-width:40px;justify-self:center}
 .machineTable .tableActions{align-self:flex-end;margin-right:4px;gap:7px}
 .machineTable .tableActions .mjAction{width:48px;flex-basis:48px;gap:6px}.machineTable .tableActions .mjActionFace{width:46px;height:46px;font-size:29px}
 .desk.machineTable .turnPrompt{left:8px;max-width:calc(100% - 190px);bottom:calc(var(--machine-hand-height,132px) + 20px);transform:none;padding:5px 8px}
 .machineTable .turnPrompt .status{font-size:10px;line-height:14px}
}
@media(max-width:1023px) and (orientation:landscape){
 .deskWrap .desk.machineTable{height:calc(100dvh - 122px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px));min-height:190px}
 .machineTable .playerBox{width:auto;max-width:150px;padding:3px 5px}.machineTable .playerBox.north{left:calc(50% + 150px)}
 .machineTable .playerBox.west,.machineTable .playerBox.east{top:40%}
 .machineTable .myHand{grid-template-columns:repeat(14,minmax(0,30px));gap:0 2px}
 .machineTable #hand>.tile{max-width:30px}.machineTable #hand>.tile.drawn{margin-left:0}
 .machineTable .tableActions{margin-right:7%;gap:6px}.machineTable .tableActions .mjAction{width:44px;flex-basis:44px}.machineTable .tableActions .mjActionFace{width:44px;height:44px;font-size:27px}
 .desk.machineTable .turnPrompt{left:50%;bottom:calc(var(--machine-hand-height,48px) + 18px);max-width:38%;transform:translateX(-50%)}
}

.machineLoading::after{content:"正在准备牌桌…";display:block!important;position:absolute;z-index:2;inset:auto;left:50%;top:42%;transform:translate(-50%,-50%);width:max-content;height:auto;border:0;background:none;box-shadow:none;color:#d2c69e;font-size:12px;pointer-events:none}
.hasMachineTable:not(.machinePainted)>.webglTable{visibility:hidden}

.machineError{position:absolute;z-index:6;left:50%;top:40%;transform:translate(-50%,-50%);width:min(360px,85%);text-align:center;color:#ead8af;background:#10362cf2;border:1px solid #9b875b;border-radius:14px;padding:18px;font-size:13px;line-height:1.7}
.machineUnavailable .playerInteraction,.machineUnavailable .turnPrompt{visibility:hidden}
@media(max-width:1023px){.deskWrap{margin:4px auto;padding:0 max(4px,env(safe-area-inset-right,0px)) 0 max(4px,env(safe-area-inset-left,0px))}.deskWrap>.row.space{min-height:0;flex-direction:column;align-items:stretch;gap:4px;padding:4px 2px 6px}.deskWrap h2{font-size:12px;line-height:16px}.deskWrap>.row.space>.row{justify-content:space-between;gap:5px;flex-wrap:nowrap}.deskWrap>.row.space button{padding:6px 9px;min-height:32px;font-size:11px;white-space:nowrap}.machineTable .tile.drawn{margin-left:0}.machineTable .tile:hover{transform:none}.machineTable .tile.selected{transform:translateY(-6px)}}
@media(max-width:1023px) and (orientation:landscape){.deskWrap>.row.space{flex-direction:row;align-items:center;gap:6px;padding:2px;min-height:32px}.deskWrap>.row.space>.row{gap:4px}.deskWrap>.row.space button{min-height:28px;padding:4px 7px;font-size:10px}.machineTable .playerBox strong,.machineTable .playerBox small,.machineTable .playerBox .handCount{display:inline;margin:0 0 0 3px}.machineTable .playerBox strong{font-size:10px}.machineTable .playerBox small{font-size:8px}}
@media(prefers-reduced-motion:reduce){.machineTable .tile{transition:none}}

/* Opening sequence shares the server clock and never reveals opponents' tiles. */
.machineTable.openingSequence .myHand .tile{visibility:hidden;pointer-events:none}
.machineTable.openingSequence .tableActions,.machineTable.openingSequence .turnPrompt{visibility:hidden}
.openingBanner{position:absolute;z-index:6;top:34%;left:50%;transform:translate(-50%,-50%);max-width:85%;padding:10px 17px;border:1px solid #e6cd87aa;border-radius:12px;background:#103c30eb;color:#f8e6b1;text-align:center;font-size:15px;line-height:1.6;pointer-events:none;box-shadow:0 5px 18px #001b1450}
@media(max-width:600px){.openingBanner{top:29%;max-width:90%;padding:8px 12px;font-size:12px}}

.openingCaption{display:block}.openingDice{display:flex;justify-content:center;gap:14px;margin:2px 0 9px}.openingDie{display:grid;grid-template-columns:repeat(3,1fr);gap:3px;padding:6px;width:38px;height:38px;border-radius:7px;border:1px solid #d7c9a2;background:linear-gradient(135deg,#fffef0,#e3ddc2);box-shadow:2px 3px 0 #a7a181,0 5px 9px #0005}.openingDie i{display:block;width:6px;height:6px;border-radius:50%;background:#a62c24}.openingBanner[data-phase="dice"] .openingDie{animation:openingDiceRoll .45s linear infinite alternate}.openingBanner[data-phase="dice"] .openingDie:nth-child(2){animation-delay:-.225s}.openingBanner[data-phase="dealing"] .openingDice,.openingBanner[data-phase="sorting"] .openingDice{display:none}@keyframes openingDiceRoll{0%{transform:translate(-4px,-3px) rotate(-24deg)}50%{transform:translate(1px,2px) rotate(5deg)}100%{transform:translate(4px,-5px) rotate(27deg)}}@media(prefers-reduced-motion:reduce){.openingBanner .openingDie{animation:none!important}}
