/* Shared mobile geometry. A single face and flush bevel replace displaced back planes. */
.card,.motion-card,.ghost,button{-webkit-tap-highlight-color:transparent}
.card,.motion-card,.ghost{transform-style:flat;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
.card-solid,.single-table .card-solid,.single-table .overlap-scroll .card-solid,.move-layer .motion-card .card-solid{transform:none;transform-style:flat}
.card-front,.single-table .card-front{transform:none;border:1px solid #172019;border-radius:2px;box-shadow:inset 0 0 0 1px #ffffff18}
.single-table .card,.single-table .hand-cards .card,.motion-card,.ghost{background:transparent;box-shadow:0 1px 0 #182018,0 2px 3px #07160d55!important;border-radius:2px}
.single-table .card.selected{box-shadow:0 1px 0 #172018,0 7px 7px #10241466!important}
.card:focus:not(:focus-visible){outline:none}
.card:focus-visible{outline:2px solid #ffe09b;outline-offset:3px}
.single-table .table-cards .card[data-chosen=true]{outline:3px solid #fff0b4;outline-offset:2px}
.move-layer .motion-card{filter:drop-shadow(0 6px 4px #07190a66)}
.move-layer[data-stage=settle] .motion-card{filter:none}
.handed-setting{display:flex;align-items:center;gap:10px}
.handed-setting input{width:20px;height:20px;flex:none}

.single-table,.single-table.hanaawase{--op-height:207px;--own-height:166px;--hand-height:177px;--op-card:22px;min-height:720px;grid-template-rows:38px minmax(320px,1fr) var(--own-height) var(--hand-height);gap:6px}
.single-table .table-arena{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:var(--op-height) minmax(0,1fr);gap:7px;min-height:0;min-width:0}
.single-table .opponents{gap:6px}
.single-table .opponent,.single-table.hanaawase .opponent{grid-template-rows:49px minmax(0,1fr);background:linear-gradient(135deg,#173831,#0a2528)}
.single-table .opponent-paper,.single-table .own-capture-area,.single-table .yaku-paper{background:linear-gradient(105deg,#f8f5ec,#efeadc)}
.single-table .opponent-heading{grid-template-rows:20px 25px}
.single-table .opponent-heading strong{font-size:26px;line-height:1}
.single-table .opponent-paper,.single-table.hanaawase .opponent-paper{display:flex;flex-direction:column;gap:0;min-height:0;padding:3px 4px}
.single-table .public-hand{flex:none;height:49px;grid-template-rows:14px minmax(0,1fr);padding:0;margin:0}
.single-table .public-hand>span{font-size:12px;line-height:14px}
.single-table .public-hand-cards{padding:1px 0 2px;gap:2px;height:100%;min-height:0;overflow-y:hidden;scrollbar-width:none}
.single-table .public-hand-cards .card{width:20px;min-width:20px;flex-basis:20px}
.single-table .public-hand-empty{height:14px}
.single-table .public-hand-empty .public-hand-cards{display:none}
.opponent-capture-content{display:grid;grid-template-rows:18px minmax(0,1fr);min-height:0;flex:1}
.opponent-capture-content[hidden]{display:none}
.single-table .capture-title{font-size:12px;min-height:0}
.single-table .opponent .table-captures{min-height:0;container-type:size}
.single-table .opponent .overlap-scroll .card{--shelf-card:min(var(--op-card),calc((100cqh - 3px)*72/112));width:var(--shelf-card);min-width:var(--shelf-card);flex-basis:var(--shelf-card);margin-right:calc(var(--shelf-card)*(var(--capture-step,.88) - 1))}
.single-table .field-row,.single-table .field-row:has(.table-cards){padding:0 4px;grid-template-columns:minmax(0,1fr) 53px;grid-template-rows:minmax(0,1fr) 14px;gap:0 7px;min-height:0;min-width:0}
.single-table .table-zone{padding:0;min-width:0;min-height:0;grid-template-rows:13px minmax(0,1fr);container-type:size}
.single-table .table-cards{--field-limit:145px;--field-size:min(var(--field-limit),calc((100cqh - 21px - (var(--field-rows,2) - 1)*4px)/var(--field-rows,2)),calc((100cqw - 8px - (var(--field-cols,3) - 1)*4px)/var(--field-cols,3)*112/72));gap:4px;padding:2px;min-height:0;min-width:0;container-type:normal;grid-template-rows:repeat(var(--field-rows,2),var(--field-size));align-content:center}
.single-table .table-cards .card,.single-table .table-cards[style*="--field-cols:9"] .card{height:var(--field-size);width:calc(var(--field-size)*72/112)}
.single-table .draw-rest .deck-back{width:41px!important}
.single-table .draw-rest>strong{font-size:23px}
.single-table .draw-slot{width:43px}
.single-table .draw-copy .eyebrow{font-size:10px}
.single-table .draw-copy strong{font-size:11px}
.single-table .last-move{font-size:10px;line-height:14px}
.single-table .hand-zone{grid-template-rows:21px minmax(0,1fr) 42px;gap:5px;padding-top:5px;padding-bottom:8px}
.single-table .hand-cards{gap:3px;container-type:size}
.single-table .hand-cards .card{width:min(100%,calc((100cqh - 18px)*72/112));height:auto;max-width:100%}
.single-table .hand-controls{grid-template-columns:minmax(0,1fr) 86px;grid-template-areas:'prompt actions';gap:8px}
.hand-prompt{grid-area:prompt}.single-table .rail-actions{grid-area:actions}
.single-table.left-handed .hand-controls{grid-template-columns:86px minmax(0,1fr);grid-template-areas:'actions prompt'}
.single-table.left-handed .rail-actions .cancel-card{left:-5px;right:auto}

/* Folded opponents keep public hands visible; one open drawer takes a real grid column. */
.single-table.fold-captures .table-arena{grid-template-rows:86px minmax(0,1fr)}
.single-table.fold-captures .table-arena:has(.public-hand:not(.public-hand-empty)){grid-template-rows:140px minmax(0,1fr)}
.single-table .capture-toggle{display:flex;align-items:center;justify-content:center;flex:none;width:100%;min-height:26px;padding:3px 1px;font-size:12px;color:#264232;background:#e4ddc7;border:0;border-radius:3px;box-shadow:none;white-space:nowrap}
.single-table.fold-captures .public-hand-empty{display:none}
.single-table.fold-captures .opponent-paper{justify-content:flex-start;gap:2px}
.single-table.fold-captures .public-hand{height:49px}
.single-table.fold-captures .table-arena[class*=expanded-]{grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:86px minmax(0,1fr);gap:6px}
.single-table.fold-captures .table-arena[class*=expanded-]:has(.opponent[data-expanded=false] .public-hand:not(.public-hand-empty)){grid-template-rows:140px minmax(0,1fr)}
.single-table.fold-captures .table-arena[class*=expanded-] .opponents{display:contents}
.single-table .table-arena[class*=expanded-] .opponent[data-expanded=true]{grid-row:1/-1;grid-column:1}
.single-table .table-arena[class*=expanded-] .opponent[data-expanded=false]{grid-row:1;grid-column:2}
.single-table .table-arena[class*=expanded-] .field-row{grid-row:2;grid-column:2;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) 42px 14px;gap:2px;padding:0}
.single-table .table-arena.expanded-right .opponent[data-expanded=true]{grid-column:2}
.single-table .table-arena.expanded-right .opponent[data-expanded=false],.single-table .table-arena.expanded-right .field-row{grid-column:1}
.single-table .table-arena[class*=expanded-] .opponent[data-expanded=true] .opponent-capture-content{grid-template-rows:23px minmax(0,1fr)}
.single-table .table-arena[class*=expanded-] .opponent[data-expanded=true] .table-captures{--op-card:47px;--capture-step:.7}
.single-table .table-arena[class*=expanded-] .action-rail{display:flex;position:relative;min-height:0;justify-content:center}
.single-table .table-arena[class*=expanded-] .draw-rest{display:flex;flex-direction:row;gap:7px;justify-content:center}
.single-table .table-arena[class*=expanded-] .draw-rest .deck-back{width:22px!important;margin:0 2px 4px 0}
.single-table .table-arena[class*=expanded-] .draw-rest>span{font-size:12px}
.single-table .table-arena[class*=expanded-] .draw-rest>strong{font-size:19px;min-width:24px}
.single-table .table-arena[class*=expanded-] .draw-tray{flex-direction:row;gap:5px}
.single-table .table-arena[class*=expanded-] .draw-slot{width:23px}
.single-table .table-arena[class*=expanded-] .draw-copy strong{font-size:10px}
.single-table .table-arena[class*=expanded-] .table-cards{--field-limit:135px}
.single-table.spectator-table.fold-captures .table-arena[class*=expanded-]{grid-template-rows:82px 82px minmax(0,1fr)}
.single-table.spectator-table.fold-captures .table-arena[class*=expanded-]:has(.opponent[data-expanded=false] .public-hand:not(.public-hand-empty)){grid-template-rows:140px 140px minmax(0,1fr)}
.single-table.spectator-table .table-arena[class*=expanded-] .opponent[data-expanded=false]:nth-last-child(1){grid-row:2}
.single-table.spectator-table .table-arena.expanded-right:has(.opponent:last-child[data-expanded=true]) .opponent:nth-child(2){grid-row:2}
.single-table.spectator-table .table-arena[class*=expanded-] .field-row{grid-row:3}

@media(min-width:480px) and (min-height:780px){
 .single-table,.single-table.hanaawase{--op-height:225px;--own-height:190px;--hand-height:202px;min-height:810px;grid-template-rows:43px minmax(340px,1fr) var(--own-height) var(--hand-height)}
 .single-table .opponent,.single-table.hanaawase .opponent{grid-template-rows:53px minmax(0,1fr)}
 .single-table.fold-captures .table-arena{grid-template-rows:90px minmax(0,1fr)}
 .single-table .field-row,.single-table .field-row:has(.table-cards){grid-template-columns:minmax(0,1fr) 64px}
 .single-table .table-arena[class*=expanded-] .field-row{grid-template-columns:minmax(0,1fr)}
}
@media(max-height:740px){
 .single-table,.single-table.hanaawase{--op-height:182px;--own-height:148px;--hand-height:157px;min-height:680px;grid-template-rows:34px minmax(325px,1fr) var(--own-height) var(--hand-height);gap:4px}
 .single-table .opponent,.single-table.hanaawase .opponent{grid-template-rows:43px minmax(0,1fr)}
 .single-table .opponent-heading{grid-template-rows:18px 22px}.single-table .opponent-heading strong{font-size:23px}
 .single-table .opponent .table-captures{--op-card:20px}
 .single-table .public-hand{height:37px}.single-table .public-hand-cards .card{width:16px;min-width:16px;flex-basis:16px}
 .single-table .public-hand-empty{height:12px}
 .single-table .hand-cards .card{width:min(100%,calc((100cqh - 18px)*72/112));max-width:100%}
 .single-table .hand-zone{grid-template-rows:19px minmax(0,1fr) 36px;gap:4px;padding:4px 8px 6px}
 .single-table .table-arena[class*=expanded-] .opponent[data-expanded=true] .table-captures{--op-card:40px}
}

/* Readability takes precedence over squeezing capture faces into fractional rows. */
.single-table,.single-table.hanaawase{--op-height:308px;--own-height:222px;--hand-height:170px;min-height:950px;grid-template-rows:38px minmax(500px,1fr) var(--own-height) var(--hand-height);gap:5px}
.single-table.fold-captures,.single-table.hanaawase.fold-captures{min-height:800px;grid-template-rows:38px minmax(350px,1fr) var(--own-height) var(--hand-height)}
.single-table .opponent,.single-table.hanaawase .opponent{grid-template-rows:46px minmax(0,1fr)}
.single-table .opponent-paper{padding:2px 3px;gap:0}
.single-table .opponent-capture-content{grid-template-rows:14px minmax(0,1fr)}
.single-table .opponent .capture-title{font-size:11px}
.single-table .opponent .capture-title small{display:none}
.single-table .opponent .table-captures{container-type:normal;--op-card:27px;grid-template-rows:repeat(4,minmax(46px,1fr))}
.single-table .opponent .table-capture-row{grid-template-columns:36px minmax(0,1fr) 14px;gap:1px}
.single-table .table-capture-row .capture-scroll{min-width:0;overflow-x:auto;overflow-y:hidden;container-type:normal;touch-action:pan-x;scrollbar-width:none;padding:0 1px 1px;overscroll-behavior-x:contain}
.single-table .table-capture-row:has(.can-scroll):after{content:'›';position:absolute;right:17px;bottom:1px;font-size:18px;color:#523f1b;background:#f6eacbd9;border-radius:3px;line-height:20px;pointer-events:none}
.single-table .own-capture-label small{font-size:10px;display:block;color:#e4d6b4}
.single-table .opponent .overlap-scroll .card,.single-table .own-capture-area .overlap-scroll .card{--shelf-card:var(--op-card);width:var(--op-card);min-width:var(--op-card);max-width:none;height:calc(var(--op-card)*112/72);flex:0 0 var(--op-card);margin-right:calc(var(--op-card)*(var(--capture-step,.88) - 1))}
.single-table .overlap-scroll .card:last-child{margin-right:4px}
.single-table .public-hand,.single-table .public-hand-empty,.single-table.fold-captures .public-hand,.single-table.fold-captures .public-hand-empty{display:grid;height:47px;min-height:47px;grid-template-rows:13px 32px;opacity:1;visibility:visible}
.single-table .public-hand>span{font-size:11px;line-height:13px}
.single-table .public-hand-cards .card{width:20px;min-width:20px;height:31px;flex:0 0 20px}
.single-table .public-hand-empty .public-hand-cards{display:block}
.single-table.fold-captures .table-arena,.single-table.fold-captures .table-arena:has(.public-hand:not(.public-hand-empty)){grid-template-rows:134px minmax(0,1fr)}
.single-table.fold-captures.hanaawase .table-arena{grid-template-rows:85px minmax(0,1fr)}
.single-table.fold-captures .table-arena[class*=expanded-],.single-table.fold-captures .table-arena[class*=expanded-]:has(.opponent[data-expanded=false] .public-hand:not(.public-hand-empty)){grid-template-rows:134px minmax(0,1fr)}
.single-table.fold-captures.hanaawase .table-arena[class*=expanded-]{grid-template-rows:85px minmax(0,1fr)}
.single-table .table-arena[class*=expanded-] .opponent[data-expanded=true] .table-captures{--op-card:35px;grid-template-rows:repeat(4,minmax(59px,1fr))}
.single-table .table-arena[class*=expanded-] .opponent[data-expanded=true] .opponent-paper{overflow-y:auto;scrollbar-width:thin}
.single-table .table-arena[class*=expanded-] .opponent[data-expanded=true] .opponent-capture-content{flex:1 0 260px}
.single-table .opponent.active,.single-table .personal-zone.active{border-color:#ffe59b;box-shadow:inset 0 0 0 2px #e4be65,0 0 9px #ffe09599}
.single-table .opponent.active .opponent-name:before{content:'▶ ';color:#ffe39a;font-size:12px}
.single-table .table-meta{display:flex;justify-content:space-between;gap:3px;font-size:10px;white-space:nowrap}
.turn-label{color:#f8e1a8;font-weight:600;overflow:hidden;text-overflow:ellipsis}
.turn-label.your-turn{color:#fff2ba}
.turn-announcement{position:fixed;top:42%;left:50%;transform:translate(-50%,-50%);z-index:950;background:#fff1c9;color:#1f392e;border:2px solid #a88237;border-radius:12px;padding:12px 24px;box-shadow:0 5px 25px #0007;font-size:23px;white-space:nowrap;pointer-events:none;animation:turn-notice 1.8s both}
@keyframes turn-notice{0%{opacity:0}15%,70%{opacity:1}100%{opacity:0}}
.single-table .hand-prompt.your-turn{box-shadow:inset 0 0 0 1px #f6dda4;color:#fff5da}
.single-table .personal-zone{grid-template-columns:76px minmax(0,1fr);grid-template-rows:minmax(0,1fr) 28px;gap:3px;padding:4px}
.single-table .own-heading{grid-row:1/3;padding:3px 1px;gap:6px;min-width:0}
.single-table .own-heading button.own-name{font-family:var(--serif);font-size:17px;min-height:25px;width:100%;max-width:100%;margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0;background:none;border:0;box-shadow:none;color:#fff3dc;text-align:left}
.single-table .own-heading>.own-score{display:flex;flex-wrap:wrap;align-items:baseline;gap:2px;font-size:22px;white-space:normal;max-width:100%;line-height:1.1;font-variant-numeric:tabular-nums}
.single-table .own-score small{font-size:12px}
.single-table .own-heading>.seat-role{right:0;top:4px;font-size:11px}
.single-table .own-heading button.own-capture-label{display:block;color:#f5e6c4;font-size:13px;white-space:normal;min-height:32px;line-height:1.3;margin:0;padding:0;background:none;border:0;box-shadow:none}
.single-table .own-capture-area{grid-column:2;grid-row:1;grid-template-rows:minmax(0,1fr);padding:1px 3px}
.single-table .own-capture-area .table-captures{--op-card:27px;grid-template-rows:repeat(4,minmax(44px,1fr))}
.single-table .own-capture-area .table-capture-row{grid-template-columns:39px minmax(0,1fr) 17px;gap:1px}
.single-table .own-capture-area .rank-label{font-size:12px}
.single-table .yaku-paper{grid-column:2;grid-row:2;flex-direction:row;align-items:center;gap:4px;padding:2px 4px;overflow:visible}
.single-table .yaku-heading{font-size:12px;min-height:23px;padding:0;flex:none;background:none;border:0;color:#283b2c;box-shadow:none}
.single-table .capture-yaku{flex:1;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;touch-action:pan-x;scrollbar-width:thin;white-space:nowrap;min-width:0;height:26px;align-items:center}
.single-table .yaku-chip{flex:none;min-height:23px;font-size:12px;padding:3px 5px;white-space:nowrap;border:0;box-shadow:none;line-height:1.2}
.single-table .review-rail{flex:none;flex-direction:row;gap:2px;margin:0;align-items:center}
.single-table .review-rail>span{display:none}
.single-table .review-rail button{min-height:23px;font-size:11px;padding:3px}
.single-table .personal-tools{gap:3px;margin-top:auto}
.single-table .own-heading .personal-tools button{min-height:24px;font-size:11px;padding:3px}
.single-table.spectator-table .personal-zone{grid-template-columns:1fr;grid-template-rows:1fr}
.single-table.spectator-table.fold-captures .table-arena[class*=expanded-]{grid-template-rows:134px 134px minmax(100px,1fr)}

.modal.player-detail-dialog{width:min(660px,calc(100vw - 12px));height:calc(100dvh - 20px);max-height:calc(100dvh - 20px);padding:12px;overflow:auto}
.modal>header{position:sticky;top:-12px;background:#14372e;color:#fff3dc;z-index:3;padding:8px 0}
.player-detail{display:grid;gap:12px;font-size:15px}
.player-detail .capture-scroll{overflow-x:auto;min-width:0;touch-action:pan-x;scrollbar-width:thin;gap:5px;padding-bottom:6px}
.player-detail .capture-scroll .card{flex:0 0 52px;width:52px;height:81px;max-width:none}
.detail-cards{display:flex;flex-wrap:wrap;gap:5px}
.detail-cards .card{width:52px;height:81px;flex:none}
.yaku-detail{padding:8px;border:1px solid #bdad85;border-radius:6px;scroll-margin-top:72px}
.yaku-detail h3{display:flex;justify-content:space-between;margin-bottom:8px}
.draw-choice-source{display:flex;align-items:center;justify-content:center;gap:15px;margin:10px}
.draw-choice-source .card{width:70px;height:109px;flex:none}
.draw-choices{display:grid;grid-template-columns:repeat(auto-fit,minmax(85px,1fr));gap:10px}
.draw-choices>button{display:flex;flex-direction:column;align-items:center;gap:7px;padding:10px 4px;font-size:14px}
.draw-choices .card{width:76px;height:118px;flex:none}
.replay-origin{display:flex;flex-direction:column;align-items:center;gap:5px;flex:none}
.replay-origin-label{font-size:15px;font-weight:700;background:#253e32;color:#fff0c6;padding:3px 12px;border-radius:4px}
.replay-origin small{font-size:12px}
.replay-moving.spent{opacity:.28;filter:saturate(.5)}
.screen.round-intro{height:100dvh;max-height:100dvh;min-height:0;max-width:620px;display:flex;flex-direction:column;gap:10px;padding:12px 14px max(12px,env(safe-area-inset-bottom));overflow:hidden}
.round-intro>header{flex:none}.round-intro>header button{min-height:32px;padding:5px 8px;font-size:13px}
.round-intro h1{font-size:26px;margin:0;flex:none;line-height:1.2}
.intro-field{display:flex;gap:14px;align-items:center;flex:none}
.intro-field>strong{font-size:25px;color:#ffe3aa;background:#722e29;padding:5px 10px;border-radius:7px}.intro-field>div{display:grid;gap:3px;font-size:14px}.intro-field small{font-size:12px}
.intro-scores{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px;flex:none}
.intro-scores>div{display:grid;gap:3px;background:#e9e1cb;color:#25382d;border-radius:6px;padding:6px 8px;min-width:0}
.intro-scores span{font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.intro-scores strong{font-size:22px}.intro-scores small{font-size:12px}
.intro-openings{flex:1;min-height:0;overflow:auto;scrollbar-width:thin;overscroll-behavior:contain}
.intro-openings h2{font-size:16px;margin:0 0 5px}.intro-opening{padding:5px 0;border-bottom:1px solid #b9a97d55;font-size:13px}
.intro-opening .help{font-size:11px;display:block;line-height:1.3;margin:2px 0}
.intro-cards{display:flex;gap:4px;overflow-x:auto;padding:2px 0 4px}.intro-cards .card{flex:0 0 31px;width:31px;height:48px;max-width:none}
.round-intro>.intro-enter{flex:none;min-height:44px;margin:0;width:100%;font-size:17px}
@media(max-height:740px){
 .single-table,.single-table.hanaawase{--op-height:292px;--own-height:212px;--hand-height:151px;min-height:886px;grid-template-rows:34px minmax(474px,1fr) var(--own-height) var(--hand-height);gap:4px}
 .single-table.fold-captures,.single-table.hanaawase.fold-captures{min-height:775px;grid-template-rows:34px minmax(350px,1fr) var(--own-height) var(--hand-height)}
 .single-table .opponent .table-captures{--op-card:25px;grid-template-rows:repeat(4,minmax(43px,1fr))}
 .single-table .own-capture-area .table-captures{--op-card:26px;grid-template-rows:repeat(4,minmax(42px,1fr))}
 .single-table .opponent,.single-table.hanaawase .opponent{grid-template-rows:42px minmax(0,1fr)}
 .single-table .own-heading{gap:4px}.single-table .own-heading>.own-score{font-size:21px}
 .single-table .table-arena[class*=expanded-] .opponent[data-expanded=true] .table-captures{--op-card:33px;grid-template-rows:repeat(4,minmax(56px,1fr))}
 .screen.round-intro{gap:6px;padding:8px 10px}.round-intro h1{font-size:23px}.intro-field>strong{font-size:22px}
}
@media(prefers-reduced-motion:reduce){.turn-announcement{animation:none}}

/* Fit the complete table to the visible viewport, reserving the hand and controls. */
.single-table,.single-table.hanaawase,.single-table.fold-captures,.single-table.hanaawase.fold-captures{
 --op-height:clamp(175px,30dvh,260px);--own-height:clamp(130px,23dvh,200px);--hand-height:clamp(108px,18dvh,160px);
 height:100dvh;min-height:0;max-height:100dvh;grid-template-rows:32px minmax(0,1fr) var(--own-height) var(--hand-height);gap:3px;
}
.single-table .table-arena{gap:3px}
.single-table .opponent,.single-table.hanaawase .opponent{grid-template-rows:42px minmax(0,1fr);padding:3px}
.single-table .opponent-heading{grid-template-rows:18px 23px}
.single-table .opponent .table-captures,.single-table .own-capture-area .table-captures{grid-template-rows:repeat(4,minmax(0,1fr))}
.single-table .opponent .overlap-scroll,.single-table .own-capture-area .overlap-scroll{container-type:size}
.single-table .opponent .overlap-scroll .card,.single-table .own-capture-area .overlap-scroll .card{
 --shelf-card:min(var(--op-card),calc((100cqh - 3px)*72/112));width:var(--shelf-card);min-width:var(--shelf-card);height:calc(var(--shelf-card)*112/72);flex-basis:var(--shelf-card);margin-right:calc(var(--shelf-card)*(var(--capture-step,.88) - 1));
}
.single-table .overlap-scroll .card:last-child{margin-right:4px}
.single-table .own-heading{gap:2px;padding:0 1px}
.single-table .own-heading>.player-crest{width:21px;height:21px}
.single-table .own-heading button.own-name{min-height:20px;font-size:15px}
.single-table .own-heading button.own-capture-label{font-size:12px;min-height:28px;line-height:1.1}
.single-table .own-heading .personal-tools button{min-height:20px;font-size:10px;padding:2px}
.single-table .own-capture-label small{font-size:9px}
.single-table .hand-zone{grid-template-rows:18px minmax(0,1fr) 36px;gap:3px;padding-top:3px;padding-bottom:4px}
.single-table .hand-cards .card{width:min(100%,calc((100cqh - 16px)*72/112))}
.single-table .hand-card-label{padding-top:1px;line-height:13px}.single-table .public-marker{font-size:10px;padding:0 3px}
.single-table .rail-actions button.primary{min-height:34px;font-size:16px}
.single-table .last-move{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@media(max-height:650px){
 .single-table .opponent,.single-table.hanaawase .opponent{grid-template-rows:36px minmax(0,1fr)}
 .single-table .opponent-heading{grid-template-rows:16px 19px}.single-table .opponent-heading strong{font-size:21px}
 .single-table .opponent-name{font-size:13px}.single-table .opponent-heading .player-crest{width:20px;height:20px}
 .single-table .public-hand,.single-table .public-hand-empty,.single-table.fold-captures .public-hand,.single-table.fold-captures .public-hand-empty{height:36px;min-height:36px;grid-template-rows:11px 23px}
 .single-table .public-hand>span{font-size:10px;line-height:11px}.single-table .public-hand-cards .card{width:14px;min-width:14px;height:22px;flex-basis:14px}
 .single-table .own-heading>.player-crest{display:none}.single-table .own-heading>.seat-role{position:static;order:-1;padding:1px 3px;font-size:10px}
 .single-table .own-heading>.own-score{font-size:18px}.single-table .own-heading button.own-capture-label{min-height:24px;font-size:11px}
 .single-table .personal-zone{grid-template-columns:65px minmax(0,1fr);grid-template-rows:minmax(0,1fr) 25px;padding:3px;gap:2px}
 .single-table .hand-zone{grid-template-rows:16px minmax(0,1fr) 32px;gap:2px;padding-top:2px;padding-bottom:3px}
 .single-table .rail-actions button.primary{min-height:30px;font-size:14px}.single-table .hand-prompt{font-size:11px}
 .single-table.fold-captures .table-arena,.single-table.fold-captures .table-arena:has(.public-hand:not(.public-hand-empty)),.single-table.fold-captures .table-arena[class*=expanded-],.single-table.fold-captures .table-arena[class*=expanded-]:has(.opponent[data-expanded=false] .public-hand:not(.public-hand-empty)){grid-template-rows:108px minmax(0,1fr)}
 .single-table.fold-captures.hanaawase .table-arena,.single-table.fold-captures.hanaawase .table-arena[class*=expanded-]{grid-template-rows:73px minmax(0,1fr)}
}

/* Landscape uses the reference's horizontal composition, with no rotated portrait canvas. */
@media (orientation:landscape) and (min-width:600px){
 .single-table,.single-table.hanaawase,.single-table.fold-captures,.single-table.hanaawase.fold-captures{
  --landscape-top:clamp(100px,28dvh,270px);--landscape-bottom:clamp(128px,39dvh,360px);
  max-width:1680px;width:100%;height:100dvh;min-height:0;max-height:100dvh;
  grid-template-columns:minmax(210px,35%) minmax(0,1fr);
  grid-template-rows:30px var(--landscape-top) minmax(0,1fr) var(--landscape-bottom);
  gap:4px;padding:env(safe-area-inset-top) max(7px,env(safe-area-inset-right)) max(4px,env(safe-area-inset-bottom)) max(7px,env(safe-area-inset-left));
 }
 .single-table .topbar{grid-area:1/1/2/-1;margin:0;justify-content:center;gap:clamp(12px,3vw,46px);position:relative}
 .single-table .topbar .iconbutton{position:absolute;right:2px;top:0;min-height:28px;min-width:28px;font-size:22px}
 .single-table .table-arena,.single-table.fold-captures .table-arena[class*=expanded-]{display:contents}
 .single-table .opponents,.single-table.fold-captures .table-arena[class*=expanded-] .opponents{display:grid;grid-area:2/1/3/-1;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px;min-height:0}
 .single-table .opponent,.single-table.hanaawase .opponent,.single-table .table-arena[class*=expanded-] .opponent[data-expanded]{
  grid-area:auto;display:grid;grid-template-columns:54% minmax(0,1fr);grid-template-rows:42px minmax(0,1fr) 0;
  grid-template-areas:'heading captures' 'public captures' 'toggle captures';padding:3px;gap:0 4px;min-width:0;min-height:0;
 }
 .single-table .opponent:nth-child(2){grid-template-columns:minmax(0,1fr) 54%;grid-template-areas:'captures heading' 'captures public' 'captures toggle'}
 .single-table .opponent-heading{grid-area:heading;grid-template-columns:23px minmax(0,1fr) auto;grid-template-rows:18px 22px;padding:1px 3px;gap:0 3px}
 .single-table .opponent-heading .player-crest{width:22px;height:22px}
 .single-table .opponent-name{font-size:14px}.single-table .opponent-name small{font-size:9px}
 .single-table .opponent-heading strong{font-size:23px}.single-table .opponent-heading strong small{font-size:11px}
 .single-table .hand-count{font-size:11px}.single-table .seat-role{font-size:10px;padding:1px 4px}
 .single-table .opponent-paper,.single-table.hanaawase .opponent-paper,.single-table.fold-captures .opponent-paper{display:contents}
 .single-table .public-hand,.single-table .public-hand-empty,.single-table.fold-captures .public-hand,.single-table.fold-captures .public-hand-empty{
  grid-area:public;display:grid;min-height:0;height:auto;grid-template-rows:13px minmax(0,1fr);gap:1px;padding:3px 4px;background:#f5f0e3;border-radius:5px;
 }
 .single-table .public-hand>span{font-size:10px;line-height:12px}
 .single-table .public-hand-cards{container-type:size;align-items:center;padding:1px 0 2px;gap:2px}
 .single-table .public-hand-cards .card{--public-width:min(38px,calc((100cqh - 3px)*72/112));width:var(--public-width);min-width:var(--public-width);height:calc(var(--public-width)*112/72);flex:0 0 var(--public-width)}
 .single-table .opponent-capture-content,.single-table .table-arena[class*=expanded-] .opponent[data-expanded=true] .opponent-capture-content{
  grid-area:captures;display:grid;grid-template-rows:14px minmax(0,1fr);min-height:0;min-width:0;flex:initial;background:linear-gradient(105deg,#f8f5ec,#efeadc);border-radius:5px;padding:3px 4px;
 }
 .single-table .opponent-capture-content[hidden]{display:none}
 .single-table .opponent .capture-title{font-size:10px;line-height:12px}
 .single-table .opponent .table-captures,.single-table .table-arena[class*=expanded-] .opponent[data-expanded=true] .table-captures{--op-card:40px;grid-template-rows:repeat(4,minmax(0,1fr))}
 .single-table .opponent .table-capture-row{grid-template-columns:33px minmax(0,1fr) 12px}
 .single-table .opponent .rank-label,.single-table .opponent .row-count{font-size:10px}
 .single-table .capture-toggle{grid-area:toggle;min-height:22px;height:22px;font-size:11px;padding:1px;border-radius:4px}
 .single-table.fold-captures .opponent[data-expanded=true]{grid-template-rows:38px minmax(0,1fr) 22px}
 .single-table.fold-captures .opponent[data-expanded=false]{grid-template-columns:46% minmax(0,1fr);grid-template-rows:minmax(0,1fr) 22px;grid-template-areas:'heading public' 'heading toggle'}
 .single-table.fold-captures .opponent[data-expanded=false] .opponent-heading{align-self:center}
 .single-table.fold-captures .opponent:nth-child(2)[data-expanded=false]{grid-template-areas:'public heading' 'toggle heading';grid-template-columns:minmax(0,1fr) 46%}
 .single-table.hanaawase .opponent{grid-template-columns:44% minmax(0,1fr);grid-template-rows:minmax(0,1fr) 0;grid-template-areas:'heading captures' 'toggle captures'}
 .single-table.hanaawase .opponent:nth-child(2){grid-template-columns:minmax(0,1fr) 44%;grid-template-areas:'captures heading' 'captures toggle'}
 .single-table.hanaawase .opponent-heading{align-self:center}
 .single-table.hanaawase.fold-captures .opponent[data-expanded=true]{grid-template-rows:minmax(0,1fr) 22px}
 .single-table.hanaawase.fold-captures .opponent[data-expanded=false]{grid-template-columns:1fr;grid-template-rows:minmax(0,1fr) 22px;grid-template-areas:'heading' 'toggle'}
 .single-table.fold-captures:not(:has(.opponent[data-expanded=true])){--landscape-top:clamp(76px,21dvh,190px)}
 .single-table .field-row,.single-table .field-row:has(.table-cards),.single-table .table-arena[class*=expanded-] .field-row,.single-table .table-arena.expanded-right .field-row{
  grid-area:3/1/4/-1;grid-template-columns:minmax(0,1fr) 70px;grid-template-rows:minmax(0,1fr) 12px;gap:0 8px;padding:0 clamp(12px,10vw,150px);min-height:0;
 }
 .single-table .table-zone{grid-template-rows:12px minmax(0,1fr)}
 .single-table .table-cards,.single-table .table-arena[class*=expanded-] .table-cards{
  --field-cols:var(--landscape-cols)!important;--field-rows:var(--landscape-rows)!important;--field-limit:180px;
  --field-size:min(var(--field-limit),calc((100cqh - 17px - (var(--field-rows) - 1)*3px)/var(--field-rows)),calc((100cqw - 6px - (var(--field-cols) - 1)*5px)/var(--field-cols)*112/72));
  grid-template-columns:repeat(var(--field-cols),minmax(0,1fr));grid-template-rows:repeat(var(--field-rows),var(--field-size));gap:3px 5px;padding:1px;align-content:center;
 }
 .single-table .action-rail,.single-table .table-arena[class*=expanded-] .action-rail{display:flex;flex-direction:column;gap:2px;justify-content:center;align-items:center}
 .single-table .draw-rest,.single-table .table-arena[class*=expanded-] .draw-rest{display:grid;grid-template-columns:34px auto;grid-template-rows:16px 24px;align-items:center;gap:0 6px;font-size:12px}
 .single-table .draw-rest .deck-back,.single-table .table-arena[class*=expanded-] .draw-rest .deck-back{grid-row:1/3;width:30px!important;margin:0 3px 6px 0}
 .single-table .draw-rest>strong,.single-table .table-arena[class*=expanded-] .draw-rest>strong{font-size:20px;min-width:25px}
 .single-table .draw-tray,.single-table .table-arena[class*=expanded-] .draw-tray{flex-direction:row;gap:4px;padding:1px}
 .single-table .draw-slot,.single-table .table-arena[class*=expanded-] .draw-slot{width:28px}
 .single-table .draw-copy strong{font-size:10px}
 .single-table .personal-zone{grid-area:4/1/5/2;grid-template-columns:clamp(65px,8vw,125px) minmax(0,1fr);grid-template-rows:minmax(0,1fr) 25px;gap:2px;padding:3px;min-width:0}
 .single-table .own-heading{grid-row:1/-1;gap:2px;padding:2px}
 .single-table .own-heading>.player-crest{display:block;width:23px;height:23px}
 .single-table .own-heading>.seat-role{position:absolute;right:0;top:4px;order:initial;font-size:10px}
 .single-table .own-heading button.own-name{font-size:15px;min-height:20px}
 .single-table .own-heading>.own-score{font-size:23px}.single-table .own-score small{font-size:11px}
 .single-table .own-heading button.own-capture-label{font-size:11px;min-height:24px}
 .single-table .own-capture-area .table-captures{--op-card:48px}
 .single-table .own-capture-area .table-capture-row{grid-template-columns:35px minmax(0,1fr) 12px}
 .single-table .own-capture-area .rank-label,.single-table .own-capture-area .row-count{font-size:10px}
 .single-table .yaku-paper{gap:2px;padding:1px 2px}.single-table .yaku-heading{font-size:10px}
 .single-table .review-rail button{font-size:9px;padding:2px;min-height:22px}.single-table .yaku-chip{font-size:10px;padding:2px}
 .single-table .hand-zone{grid-area:4/2/5/3;margin:0;padding:5px 9px 5px;border:1px solid #e8d789;border-radius:12px 12px 5px 5px;grid-template-rows:19px minmax(0,1fr) 34px;gap:4px;background-size:100% 135%}
 .single-table .hand-cards{gap:5px;align-items:center;max-width:100%;width:100%}
 .single-table .hand-cards .card{width:min(100%,calc((100cqh - 16px)*72/112))}
 .single-table .hand-controls{grid-template-columns:minmax(0,1fr) clamp(86px,11vw,170px);gap:8px}
 .single-table.left-handed .hand-controls{grid-template-columns:clamp(86px,11vw,170px) minmax(0,1fr)}
 .single-table .hand-prompt{font-size:12px;line-height:1.2}.single-table .rail-actions button.primary{min-height:32px;font-size:16px}
 .single-table.spectator-table .opponents{grid-template-columns:repeat(3,minmax(0,1fr))}
 .single-table.spectator-table .personal-zone{grid-template-columns:1fr;grid-template-rows:1fr}
 @media(min-height:550px){
  .single-table,.single-table.hanaawase,.single-table.fold-captures,.single-table.hanaawase.fold-captures{grid-template-rows:44px var(--landscape-top) minmax(0,1fr) var(--landscape-bottom);gap:7px;padding-bottom:8px}
  .single-table .topbar .iconbutton{min-height:40px;min-width:40px;font-size:28px}.single-table .wordmark{font-size:23px}.single-table .round,.single-table .top-stock,.single-table .field-seal{font-size:21px}
  .single-table .opponent,.single-table.hanaawase .opponent{grid-template-rows:64px minmax(0,1fr) 0;padding:5px;gap:0 6px}
  .single-table .opponent-heading{grid-template-columns:34px minmax(0,1fr) auto;grid-template-rows:28px 31px;gap:0 6px}.single-table .opponent-heading .player-crest{width:32px;height:32px}
  .single-table .opponent-name{font-size:23px}.single-table .opponent-heading strong{font-size:33px}.single-table .hand-count{font-size:17px}.single-table .seat-role{font-size:15px}
  .single-table .public-hand>span{font-size:14px;line-height:17px}.single-table .public-hand,.single-table .public-hand-empty,.single-table.fold-captures .public-hand,.single-table.fold-captures .public-hand-empty{grid-template-rows:18px minmax(0,1fr);padding:5px}
  .single-table .public-hand-cards .card{--public-width:min(57px,calc((100cqh - 4px)*72/112))}
  .single-table .opponent-capture-content,.single-table .table-arena[class*=expanded-] .opponent[data-expanded=true] .opponent-capture-content{grid-template-rows:22px minmax(0,1fr);padding:5px 7px}
  .single-table .opponent .capture-title{font-size:15px;line-height:20px}.single-table .opponent .table-capture-row{grid-template-columns:48px minmax(0,1fr) 20px}.single-table .opponent .rank-label,.single-table .opponent .row-count{font-size:14px}
  .single-table .own-heading{gap:7px;padding:6px}.single-table .own-heading>.player-crest{width:35px;height:35px}.single-table .own-heading button.own-name{font-size:24px;min-height:30px}.single-table .own-heading>.own-score{font-size:36px}.single-table .own-score small{font-size:16px}
  .single-table .own-heading button.own-capture-label{font-size:16px;line-height:1.3}.single-table .own-heading .personal-tools button{font-size:13px;min-height:28px}
  .single-table .own-capture-area .table-capture-row{grid-template-columns:48px minmax(0,1fr) 20px}.single-table .own-capture-area .rank-label,.single-table .own-capture-area .row-count{font-size:14px}
  .single-table .personal-zone{grid-template-rows:minmax(0,1fr) 30px;padding:5px;gap:4px}.single-table .yaku-heading,.single-table .yaku-chip{font-size:13px}.single-table .review-rail button{font-size:12px}
  .single-table .hand-zone{grid-template-rows:27px minmax(0,1fr) 46px;gap:9px;padding:10px 15px}.single-table .hand-title{font-size:22px}.single-table .hand-prompt{font-size:18px}.single-table .rail-actions button.primary{font-size:23px}
  .single-table .public-marker{font-size:13px;line-height:17px}.single-table .hand-cards .card{width:min(100%,calc((100cqh - 21px)*72/112))}
 }
}

@media (orientation:landscape) and (min-width:600px){
 .single-table .table-arena[class*=expanded-] .opponent:nth-child(2)[data-expanded=true]{grid-template-columns:minmax(0,1fr) 54%;grid-template-areas:'captures heading' 'captures public' 'captures toggle'}
 .single-table.hanaawase .table-arena[class*=expanded-] .opponent:nth-child(2)[data-expanded=true]{grid-template-columns:minmax(0,1fr) 44%;grid-template-areas:'captures heading' 'captures toggle'}
 .single-table .own-heading .personal-tools{display:flex;flex-wrap:nowrap;gap:2px}
 .single-table .own-heading .personal-tools button{flex:1;min-width:0;white-space:nowrap;font-size:9px;padding:2px 0;min-height:20px}
 .single-table .own-heading button.own-capture-label{font-size:10px;line-height:1.2}.single-table .own-capture-label small{font-size:8px}
 .single-table.spectator-table .opponent-name small{display:none}
 @media(min-height:550px){
  .single-table .own-heading .personal-tools button{font-size:12px;min-height:28px}
  .single-table .own-heading button.own-capture-label{font-size:15px}.single-table .own-capture-label small{font-size:10px}
  .single-table .field-row,.single-table .field-row:has(.table-cards),.single-table .table-arena[class*=expanded-] .field-row{grid-template-columns:minmax(0,1fr) 115px}
  .single-table .draw-rest,.single-table .table-arena[class*=expanded-] .draw-rest{grid-template-columns:67px auto;grid-template-rows:24px 36px;font-size:17px;gap:0 8px}
  .single-table .draw-rest .deck-back,.single-table .table-arena[class*=expanded-] .draw-rest .deck-back{width:59px!important}
  .single-table .draw-rest>strong,.single-table .table-arena[class*=expanded-] .draw-rest>strong{font-size:29px}
  .single-table .draw-slot,.single-table .table-arena[class*=expanded-] .draw-slot{width:57px}.single-table .draw-copy strong{font-size:14px}
 }
}
@media (orientation:landscape) and (min-width:600px){
 .single-table .own-heading .personal-tools button[data-do=rules]{display:block}
 .single-table.fold-captures .table-arena .opponents .opponent[data-expanded=false]{grid-template-columns:46% minmax(0,1fr);grid-template-rows:minmax(0,1fr) 22px;grid-template-areas:'heading public' 'heading toggle'}
 .single-table.fold-captures .table-arena .opponents .opponent:nth-child(2)[data-expanded=false]{grid-template-columns:minmax(0,1fr) 46%;grid-template-areas:'public heading' 'toggle heading'}
 .single-table.fold-captures .table-arena .opponents .opponent[data-expanded=true]{grid-template-rows:38px minmax(0,1fr) 22px}
 .single-table.hanaawase.fold-captures .table-arena .opponents .opponent[data-expanded=false]{grid-template-columns:1fr;grid-template-rows:minmax(0,1fr) 22px;grid-template-areas:'heading' 'toggle'}
 .single-table.hanaawase.fold-captures .table-arena .opponents .opponent[data-expanded=true]{grid-template-rows:minmax(0,1fr) 22px;grid-template-areas:'heading captures' 'toggle captures'}
 .single-table.hanaawase.fold-captures .table-arena .opponents .opponent:nth-child(2)[data-expanded=true]{grid-template-areas:'captures heading' 'captures toggle'}
 @media(min-height:550px){.single-table.fold-captures .table-arena .opponents .opponent[data-expanded=true]{grid-template-rows:64px minmax(0,1fr) 22px}.single-table.hanaawase.fold-captures .table-arena .opponents .opponent[data-expanded=true]{grid-template-rows:minmax(0,1fr) 22px}}
}


@media (orientation:landscape) and (min-width:600px){
 .single-table[data-field-density=high]{--landscape-top:clamp(82px,23dvh,220px);--landscape-bottom:clamp(122px,34dvh,320px)}
 .single-table[data-field-density=high] .field-row,.single-table[data-field-density=high] .field-row:has(.table-cards){padding-left:8px;padding-right:8px}
}
@media (orientation:landscape) and (min-width:600px){.single-table.spectator-table .table-arena[class*=expanded-] .opponents .opponent[data-expanded]{grid-row:auto;grid-column:auto}}

/* The stock has its own lane: use that space for readable card faces. */
@media (orientation:portrait){
 .single-table .field-row,.single-table .field-row:has(.table-cards){grid-template-columns:minmax(0,1fr) 65px}
 .single-table .draw-rest .deck-back{width:55px!important}
 .single-table .draw-slot{width:57px}
 .single-table .table-arena[class*=expanded-] .field-row{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) 74px 14px}
 .single-table .table-arena[class*=expanded-] .draw-rest .deck-back{width:36px!important}
 .single-table .table-arena[class*=expanded-] .draw-slot{width:40px}
 .single-table .table-arena[class*=expanded-] .draw-copy{width:auto;max-width:84px}
}
@media (orientation:landscape){
 .single-table .field-row,.single-table .field-row:has(.table-cards),.single-table .table-arena[class*=expanded-] .field-row,.single-table .table-arena.expanded-right .field-row{grid-template-columns:minmax(0,1fr) clamp(100px,12vw,160px);padding-inline:clamp(8px,6vw,100px)}
 .single-table .draw-rest,.single-table .table-arena[class*=expanded-] .draw-rest{grid-template-columns:auto auto;grid-template-rows:20px 28px}
 .single-table .draw-rest .deck-back,.single-table .table-arena[class*=expanded-] .draw-rest .deck-back{width:clamp(44px,11dvh,82px)!important}
 .single-table .draw-slot,.single-table .table-arena[class*=expanded-] .draw-slot{width:clamp(46px,12dvh,86px)}
 .single-table .draw-copy,.single-table .table-arena[class*=expanded-] .draw-copy{width:auto;max-width:76px}
}

.native-update-dialog { width:min(90vw,460px); padding:24px; }
.native-update-dialog button { margin:8px 8px 0 0; }
.screen-tools{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:6px}
.screen-tools button{padding:8px 12px;font-size:.88rem}
.setup>.row:first-child,.online-screen>header{flex-wrap:wrap;gap:10px}
.release-dialog{width:min(560px,calc(100vw - 24px));max-height:calc(100dvh - 32px);box-sizing:border-box;overflow:auto;padding:20px;color:#163c36;background:#faf6e9;border:1px solid #c9ad64;border-radius:16px;line-height:1.65}
.release-dialog::backdrop{background:#071d20b8}
.release-dialog header{display:flex;align-items:center;justify-content:space-between;gap:12px}
.release-dialog h2{font-size:1.25rem;margin:0}
.release-dialog h3{font-size:1.05rem;margin:18px 0 8px}
.release-dialog li{margin:8px 0}
.release-dialog ul{padding-left:22px}
.release-dialog button{min-height:42px}
