/* Home chooses a mode. The table is shown only after entering a match. */
#play-shell{display:flex;flex-direction:column;min-height:var(--viewport-height,100dvh)}
.site-header{flex:none;width:100%;max-width:1060px;gap:12px;padding:20px 24px;border-bottom:0}
.settings-link,.back-link{background:transparent;border:0;box-shadow:none;color:var(--muted);border-radius:4px;padding:8px 4px;min-height:44px;font-size:.9375rem;white-space:nowrap}
.settings-link{margin-left:auto}.back-link{display:inline-flex;align-items:center;gap:7px;text-align:left;font-weight:500}
.back-link:hover,.settings-link:hover{color:var(--text);background:#ffffff06}
.dialog-back{margin:-8px 0 10px}.result-back{grid-column:1/-1;justify-self:start;margin-bottom:0}
.home-screen{width:min(100%,500px);padding:18px 24px 24px;margin:auto;flex:1;display:flex;flex-direction:column;justify-content:center;gap:28px}
.home-modes{display:grid;gap:12px}.home-mode{width:100%;display:flex;align-items:center;gap:18px;padding:20px;text-align:left;border:1px solid #48634e;border-radius:12px;background:linear-gradient(115deg,#263e31,#1b3027);color:var(--text);min-height:92px}
.home-mode:hover{background:#2d4836;border-color:var(--gold)}.home-mode>span:nth-child(2){flex:1;min-width:0}
.home-mode strong{display:block;font-size:1.25rem;letter-spacing:.04em}.home-mode small{display:block;font-size:.875rem;color:var(--muted);margin-top:5px}
.home-mode-icon{width:40px;height:44px;display:grid;place-items:center;flex:none;font-size:1.45rem;color:var(--gold);font-family:serif;border:1px solid #93805055;border-radius:7px;background:#dbc07c08}.cpu-icon{font-weight:700}
.home-arrow{font-size:1.4rem;color:#c3b994}.home-preferences .screen-chooser{width:100%;justify-content:center;margin:0;order:0}.home-preferences .screen-chooser button{flex:1;max-width:160px}
.home-preferences p{font-size:.8125rem;text-align:center;color:var(--muted);margin:14px 0 0;white-space:nowrap}
.in-game .site-header{padding:2px 12px;min-height:44px;gap:12px;flex-wrap:nowrap;border-bottom:1px solid var(--line)}
.in-game #mode-label{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;font-size:.8125rem;text-align:center;flex:1;color:var(--muted);white-space:nowrap}
.in-game .site-header .settings-link{margin-left:0}.in-game .site-header .back-link{min-width:70px}
.settings-content{display:grid;gap:18px;padding-top:20px}.settings-row{display:flex;align-items:center;justify-content:space-between;gap:15px;font-size:.9375rem}
.settings-row select{max-width:none;min-height:44px;font-size:1rem}.settings-content .screen-chooser{order:0;margin:0;width:100%;justify-content:center}.settings-content .screen-chooser button{flex:1}
#speed-setting,#lobby-speed-setting{flex-wrap:wrap}
.speed-description{font-size:.875rem;color:var(--muted);line-height:1.6}
.settings-content .speed-description{margin-top:-10px}
.settings-content .online-error:empty{display:none}
.lobby-speed-block{border-top:1px solid var(--line);padding-top:16px;margin-top:16px}.lobby-speed-block .speed-description{margin-top:8px}
.settings-content .hand-preferences{display:flex;margin:0}.settings-content .switch-label{font-size:.9375rem}.settings-content .switch-label>span:last-child{display:flex;gap:12px}
.settings-rule-link{display:flex;justify-content:space-between;align-items:center;background:transparent;color:var(--text);border-top:1px solid var(--line);padding:16px 0 0;font-size:1rem}
.settings-content .recent-event{margin:0;padding-top:12px}.settings-content .event-log{margin:0;padding-top:10px}.settings-content .event-log ol{max-height:180px}
.leave-note{font-size:.9375rem;line-height:1.8;color:var(--muted);margin:16px 0 22px}.leave-actions{display:flex;flex-direction:column;gap:12px}
#online-dialog .dialog-header{margin-bottom:18px}#friend-options .join-row{margin-bottom:18px}
.landscape-mode .home-screen{max-width:900px;width:100%;gap:14px;padding:10px 20px;margin:auto}
.landscape-mode .home-modes{grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.landscape-mode .home-mode{min-height:108px;padding:14px 12px;gap:10px;flex-wrap:wrap}.landscape-mode .home-mode strong{font-size:1.1rem}.landscape-mode .home-mode small{font-size:.75rem}.landscape-mode .home-mode-icon{width:29px;height:35px;font-size:1.2rem}.landscape-mode .home-arrow{display:none}
.landscape-mode .home-preferences{display:flex;justify-content:center;align-items:center;gap:20px}.landscape-mode .home-preferences .screen-chooser{width:auto}.landscape-mode .home-preferences p{margin:0;font-size:.75rem}
.landscape-mode .settings-content{gap:12px;padding-top:10px}.landscape-mode .settings-content .hand-preferences{display:flex}
.landscape-mode .settings-content>*{grid-area:auto}
.landscape-mode .settings-content .recent-event,.landscape-mode .settings-content .event-log{display:block}
.in-game.landscape-mode .table-toolbar{grid-area:1/1/2/3;min-height:28px}
.in-game.landscape-mode .site-header{min-height:36px;padding-top:0;padding-bottom:0}.in-game.landscape-mode .site-header button{min-height:34px;padding-top:4px;padding-bottom:4px}
.landscape-mode .dialog-back{min-height:32px;padding-top:4px;padding-bottom:4px}.landscape-mode .result-back{grid-column:1/-1}
.landscape-mode .final-result .result-back{grid-area:1/1/2/-1}.landscape-mode .final-result .final-hero{grid-area:2/1}.landscape-mode .final-result .result-scores{grid-area:2/2}

/* Reserve the hand and controls first; the portrait table fills what remains. */
@media (max-width:850px){
 html.in-game:not(.landscape-mode),html.in-game:not(.landscape-mode) body{width:100%;height:100%;overflow:hidden}
 .in-game:not(.landscape-mode) #play-viewport{display:block;position:fixed;inset:var(--viewport-top,0px) auto auto var(--viewport-left,0px);width:var(--viewport-width,100vw);height:var(--viewport-height,100dvh);overflow:hidden}
 .in-game:not(.landscape-mode) #play-rotation{display:block;width:100%;height:100%}
 .in-game:not(.landscape-mode) #play-shell{height:100%;min-height:0;overflow-y:auto;overflow-x:hidden;padding-bottom:env(safe-area-inset-bottom)}
 .in-game:not(.landscape-mode) #game-screen{flex:1;min-height:0;max-width:none;width:100%;padding:5px 10px 8px;margin:0}
 .in-game:not(.landscape-mode) .game-column{height:100%;min-height:0;display:flex;flex-direction:column;gap:5px}
 .in-game:not(.landscape-mode) .table-toolbar{flex:none;margin:0;gap:6px;min-height:28px;flex-wrap:nowrap}
 .in-game:not(.landscape-mode) .table-label{font-size:.75rem;gap:5px}.in-game:not(.landscape-mode) .toolbar-controls{margin-left:auto;gap:6px}
 .in-game:not(.landscape-mode) .toolbar-controls .icon-button{min-height:28px;padding:4px 8px;font-size:.75rem}
 .in-game:not(.landscape-mode) .online-strip{flex:none;gap:8px;margin:0;padding:0 0 2px;font-size:.75rem;flex-wrap:nowrap}
 .in-game:not(.landscape-mode) #online-room-label{display:none}.in-game:not(.landscape-mode) .online-strip .text-button{min-height:26px;padding:3px 0;font-size:.75rem}
 .in-game:not(.landscape-mode) .table{flex:1 1 0%;height:auto;min-height:190px;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:24px auto minmax(30px,1fr) auto minmax(30px,1fr);gap:4px 9px;padding:6px 8px;border-radius:10px}
 .in-game:not(.landscape-mode) .table:before{display:none}
 .in-game:not(.landscape-mode) .table-center{position:static;grid-area:1/2;transform:none;width:auto;display:flex;align-items:center;justify-content:flex-end;gap:6px;white-space:nowrap}
 .in-game:not(.landscape-mode) .round-label{font-size:.875rem;letter-spacing:0}.in-game:not(.landscape-mode) .round-label small{font-size:.6875rem;margin-left:2px}
 .in-game:not(.landscape-mode) .wall-info{margin:0;gap:3px}.in-game:not(.landscape-mode) .wall-info span{font-size:.6875rem}.in-game:not(.landscape-mode) .wall-info strong{font-size:1.2rem}
 .in-game:not(.landscape-mode) .wall-meter{display:none}.in-game:not(.landscape-mode) .pot-line{position:absolute;top:6px;left:95px;font-size:.625rem;margin:0}
 .in-game:not(.landscape-mode) .table-dora{position:static;grid-area:1/1;display:flex;align-items:center;gap:4px;flex-direction:row;font-size:.6875rem;white-space:nowrap}
 .in-game:not(.landscape-mode) .table-dora .tile{width:17px;height:23px}
 .in-game:not(.landscape-mode) .opponent,.in-game:not(.landscape-mode) .table-self{position:relative;inset:auto;transform:none;width:auto;min-width:0;max-width:none;margin:0;padding:4px 6px;border-radius:5px;align-self:stretch;background:#10291fe0;border:1px solid #b6d0aa25}
 .in-game:not(.landscape-mode) .opponent.west{grid-area:2/1}.in-game:not(.landscape-mode) .opponent.north{grid-area:2/2}.in-game:not(.landscape-mode) .opponent.east{grid-area:4/1}
 .in-game:not(.landscape-mode) .player-main{gap:5px}.in-game:not(.landscape-mode) .seat{width:17px;height:17px;font-size:.6875rem;flex:none}.in-game:not(.landscape-mode) .player-name{max-width:none;font-size:.75rem}
 .in-game:not(.landscape-mode) .opponent-score-line{margin-top:1px;gap:4px}.in-game:not(.landscape-mode) .player-score{font-size:.875rem;letter-spacing:0}.in-game:not(.landscape-mode) .cpu-state{font-size:.6875rem}
 .in-game:not(.landscape-mode) .small-melds{position:static;max-width:none;margin-top:2px;gap:1px}.in-game:not(.landscape-mode) .small-melds .tile{width:10px;height:14px}.in-game:not(.landscape-mode) .small-melds .meld{margin-right:2px}
 .in-game:not(.landscape-mode) .table-self{grid-area:4/2;display:grid;grid-template-columns:17px minmax(0,1fr);gap:1px 5px;font-size:.75rem;border-color:#b8a26780;background:#344333}
 .in-game:not(.landscape-mode) .table-self strong{grid-area:2/1/3/3;font-size:.875rem;justify-self:start}.in-game:not(.landscape-mode) .table-self .reach{grid-area:2/2;justify-self:end}
 .in-game:not(.landscape-mode) .opponent.in-riichi{background:#493226;border-color:#efb15e;box-shadow:0 0 0 1px #da9b4944}
 .in-game:not(.landscape-mode) .river{position:static;inset:auto;transform:none;--river-w:19px;--river-h:26px;--river-gap:2px;display:flex;width:100%;height:100%;min-width:0;min-height:0;max-height:none;padding:2px;overflow-y:auto;overflow-x:hidden;border-top:1px solid #bfd0a52b;align-content:flex-start}
 .in-game:not(.landscape-mode) .river-west{grid-area:3/1}.in-game:not(.landscape-mode) .river-north{grid-area:3/2}.in-game:not(.landscape-mode) .river-east{grid-area:5/1}.in-game:not(.landscape-mode) .river-south{grid-area:5/2}
 .in-game:not(.landscape-mode) .river .tile{width:var(--river-w);height:var(--river-h)}
 .in-game:not(.landscape-mode) .hand-area{flex:none;padding:0;min-width:0}
 .in-game:not(.landscape-mode) .hand-topline{min-height:28px;margin:0 0 4px;gap:6px}.in-game:not(.landscape-mode) .hand-status{font-size:.75rem;line-height:1.4}.in-game:not(.landscape-mode) .hand-meta{gap:0}.in-game:not(.landscape-mode) #draw-count{display:none}
 .in-game:not(.landscape-mode) .action-timer{font-size:.75rem;gap:3px}.in-game:not(.landscape-mode) .action-timer strong{font-size:1rem}.in-game:not(.landscape-mode) .action-time-track{height:3px;margin:0 0 5px}
 .in-game:not(.landscape-mode) .hand{grid-template-columns:repeat(7,minmax(0,1fr));min-height:0;gap:4px;padding:1px}
 .in-game:not(.landscape-mode) .hand .tile{height:clamp(44px,calc(var(--viewport-height,700px)/13),58px);min-height:44px;max-height:58px;aspect-ratio:auto;border-bottom-width:3px}
 .in-game:not(.landscape-mode) .hand .tile.drawn{transform:none}.in-game:not(.landscape-mode) .hand .tile.drawn:after{display:none}
 .in-game:not(.landscape-mode) .your-melds{min-height:0;margin:4px 0 0;gap:5px}.in-game:not(.landscape-mode) .your-melds:empty{display:none}.in-game:not(.landscape-mode) .your-melds .tile{width:19px;height:26px}
 .in-game:not(.landscape-mode) .action-bar{margin-top:7px;gap:7px}.in-game:not(.landscape-mode) .action-bar button{min-height:52px;padding:5px;font-size:.9375rem}.in-game:not(.landscape-mode) .draw-button{min-width:0;gap:2px;flex-direction:column}.in-game:not(.landscape-mode) .action-bar small,.in-game:not(.landscape-mode) .riichi-button span{font-size:.6875rem}
 .in-game:not(.landscape-mode) .reservation-selection-hint{margin:0 0 4px;font-size:.75rem;line-height:1.4}
 .in-game:not(.landscape-mode) .inline-reservations{min-height:36px;gap:7px;margin:5px 0 0;padding-top:3px}
 .in-game:not(.landscape-mode) .inline-reservation-heading{display:grid;grid-template-columns:auto auto;gap:1px 7px;font-size:.75rem}.in-game:not(.landscape-mode) .inline-reservation-heading .text-button{grid-area:1/2;padding:0;font-size:.6875rem;min-height:20px}
 .in-game:not(.landscape-mode) .reservation-state{grid-area:2/1/3/3;border:0;padding:0;margin:0;background:transparent;font-size:.625rem;line-height:1.3;color:var(--muted)}
 .in-game:not(.landscape-mode) .inline-reservations .active-reservations{min-height:34px;padding:0}.in-game:not(.landscape-mode) .active-item{font-size:.75rem}.in-game:not(.landscape-mode) .active-item .tile{width:17px;height:24px}.in-game:not(.landscape-mode) .active-item button{min-height:32px;min-width:32px}
 .in-game:not(.landscape-mode) .active-empty{font-size:.6875rem}.in-game:not(.landscape-mode) .hand-footer{display:none}
 .in-game:not(.landscape-mode) .start-card{padding:12px 16px;max-height:95%;overflow-y:auto}.in-game:not(.landscape-mode) .start-card h2{font-size:1rem;margin:7px 0}.in-game:not(.landscape-mode) .start-card p{font-size:.75rem;line-height:1.5;margin-bottom:10px}.in-game:not(.landscape-mode) .start-card .eyebrow{font-size:.625rem}.in-game:not(.landscape-mode) .start-card .primary{min-height:44px;padding:9px 20px}
}
@media (max-width:520px){.site-header{padding:14px 18px;gap:10px;flex-wrap:nowrap}.site-header .brand-en{font-size:.625rem}.site-header h1{font-size:1.15rem}.home-screen{padding:12px 20px 20px;gap:24px}.home-mode{min-height:86px;padding:17px;gap:15px}.home-mode strong{font-size:1.2rem}.home-mode small{font-size:.8125rem}.home-preferences .screen-label{display:none}.settings-link{font-size:.8125rem}.in-game .site-header{min-height:42px}.in-game .back-link{font-size:.875rem}.in-game #mode-label{font-size:.75rem}}
@media (max-height:600px){.home-screen{gap:16px}.home-mode{min-height:74px;padding-top:12px;padding-bottom:12px}.home-preferences p{margin-top:8px}}
