/* Square table; each player's river faces that player's seat. */
.game{--board-size:min(520px,calc(100dvh - 368px),calc(100vw - 310px));--discard-size:clamp(12px,calc(var(--board-size)*.05),24px);position:relative}
.table-scene{position:relative;width:var(--board-size);margin:78px auto 0}
.table{width:var(--board-size);height:var(--board-size);min-height:0;aspect-ratio:1;border-width:5px;border-radius:15px}
.seat-top{top:-76px;left:50%;transform:translateX(-50%)}
.seat-left{left:auto;right:calc(100% + 34px);top:50%;transform:translateY(-50%)}
.seat-right{right:auto;left:calc(100% + 34px);top:50%;transform:translateY(-50%)}
.seat-left,.seat-right{width:max-content;max-width:145px;flex-direction:row;text-align:left}
.opponent-top{top:-18px;left:50%;transform:translateX(-50%)}
.opponent-top .tile{--tw:12px}
.opponent-side{display:flex;top:50%;transform:translateY(-50%)}
.opponent-side.left{left:-22px}.opponent-side.right{right:-22px}
.opponent-side .tile{--tw:15px;height:9px}
.melds-top{top:-28px;left:calc(50% + 85px);right:auto;max-width:190px}
.melds-left{left:auto;right:calc(100% + 34px);top:calc(50% - 85px);bottom:auto;max-width:150px;justify-content:flex-end}
.melds-right{right:auto;left:calc(100% + 34px);top:calc(50% - 85px);bottom:auto;max-width:150px}
.rivers{display:block;inset:12px;gap:0}
.river{position:absolute;display:grid;grid-template-columns:repeat(6,var(--discard-size));grid-auto-rows:calc(var(--discard-size)*1.28);gap:1px;align-content:start;justify-content:start;overflow:auto;scrollbar-width:none;max-height:calc(var(--board-size)*.3)}
.river::-webkit-scrollbar{display:none}.river:before{display:none}
.river .tile{--tw:var(--discard-size);justify-self:center;align-self:center;min-height:0}
.river-top,.river-bottom{left:50%;transform:translateX(-50%);width:calc(var(--discard-size)*6 + 5px)}
.river-top{top:0;bottom:auto}.river-bottom{bottom:0;top:auto}
.river-left,.river-right{top:50%;transform:translateY(-50%);grid-template-columns:none;grid-template-rows:repeat(6,var(--discard-size));grid-auto-columns:calc(var(--discard-size)*1.28);grid-auto-rows:auto;grid-auto-flow:column;height:calc(var(--discard-size)*6 + 5px);width:max-content;max-width:calc(var(--board-size)*.3);max-height:none}
.river-left{left:0;right:auto}.river-right{right:0;left:auto;direction:rtl}
.river-left .tile{transform:rotate(90deg)}.river-right .tile{transform:rotate(-90deg)}
.table-center{top:50%;width:clamp(42px,calc(var(--board-size)*.18),86px);height:clamp(46px,calc(var(--board-size)*.18),90px);z-index:2}
.table-center #wind{display:block;font-size:clamp(16px,calc(var(--board-size)*.05),25px)}
.table-center b{font-size:clamp(8px,calc(var(--board-size)*.024),11px);margin-top:2px}
.table-center #countdown{font-size:clamp(8px,calc(var(--board-size)*.022),10px);margin-top:2px}
.hand-area{position:relative;padding:8px 0 0}
.hand-heading{justify-content:center;margin:0;height:32px}
.self-seat{border:1px solid #b4ba7b38;border-radius:8px;background:#082416c9;padding:3px 8px;max-width:100%}
.tiles-row{display:flex;align-items:flex-end;justify-content:center;gap:12px;min-height:82px;padding-top:8px}
.hand{min-height:0;padding:0;flex-shrink:0}
.self-melds{position:static;flex-wrap:nowrap;gap:6px;margin:0 0 3px;flex-shrink:0}
.self-melds:empty{display:none}
.controls{min-height:52px;padding-top:6px}
.turn-copy #status{text-align:left;display:block}.turn-copy p{margin-top:5px}
.payment-notice{top:calc(50% + 38px);bottom:auto;max-width:92%;width:max-content;white-space:normal;text-align:center;font-size:12px}
@media(orientation:landscape) and (max-height:600px){
  .topbar{height:36px}.icon-button{min-height:30px;padding:5px 9px}
  .game{--board-size:min(420px,calc(100dvh - 151px - max(8px,env(safe-area-inset-bottom,0px))),calc(100vw - var(--landscape-gutter)*2 - 220px));padding-top:40px;padding-bottom:max(8px,env(safe-area-inset-bottom,0px))}
  .game-toolbar{position:absolute;top:0;left:var(--landscape-gutter);right:var(--landscape-gutter);height:22px;font-size:10px}.game-toolbar .text-button{padding:3px 8px}
  .table-scene{margin-top:0}.table{border-width:4px;border-radius:12px}
  .seat{font-size:10px;padding:3px 6px;gap:5px}.seat .avatar{width:23px;height:23px;font-size:14px}.seat-name{max-width:76px}.seat-score{font-size:10px;margin-top:1px}
  .seat-top{top:-40px}.seat-left{right:calc(100% + 27px)}.seat-right{left:calc(100% + 27px)}
  .opponent-top{display:none}.opponent-side.left{left:-17px}.opponent-side.right{right:-17px}.opponent-side .tile{--tw:11px;height:7px}
  .melds{gap:5px}.melds .tile{--tw:13px}
  .melds-top{left:calc(50% + 66px);top:-25px;max-width:150px}
  .melds-left{right:calc(100% + 27px);top:calc(50% - 62px);max-width:130px}.melds-right{left:calc(100% + 27px);top:calc(50% - 62px);max-width:130px}
  .rivers{inset:9px}.table-center{border-radius:8px}.table-center #wind{line-height:1}
  .hand-area{position:static;padding:4px 0 0}.hand-heading{height:26px;margin:0}
  .self-seat{font-size:11px;gap:5px;padding:2px 7px}.self-seat .avatar{width:20px;height:20px;font-size:13px}.self-seat .seat-score{font-size:10px}
  .tiles-row{height:45px;min-height:0;padding-top:4px;gap:10px}.hand{gap:4px;min-height:0}.hand .tile{--tw:32px;max-width:none;max-height:none}.hand .tile.drawn{margin-left:12px}
  .self-melds{position:static;gap:5px;margin-bottom:3px}.self-melds .tile{--tw:16px}
  .controls{position:absolute;top:calc(40px + var(--board-size)*.5 + 30px);left:calc(50% + var(--board-size)*.5 + 27px);right:var(--landscape-gutter);display:flex;flex-direction:column;align-items:stretch;gap:5px;padding:0;min-height:0}
  .turn-copy #status{font-size:10px;max-width:none;line-height:1.3}.turn-copy p{display:none}
  .actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px;width:100%}.action{padding:4px 5px;min-height:30px;font-size:12px}.action .tile{--tw:12px;margin-left:3px}
  .actions>.action:only-child{grid-column:1/-1}
  .payment-notice{top:calc(50% + 25px);bottom:auto;font-size:10px;padding:3px 7px}
}
