*{box-sizing:border-box}body{margin:0;background:#071e24;color:#eff5ec;font:16px system-ui,'Microsoft YaHei',sans-serif}button,input,select{font:inherit}button{border:0;border-radius:12px;padding:13px 22px;background:#e7bc6b;color:#172c29;font-weight:700;cursor:pointer}button.secondary{background:#ffffff12;color:#e8eee5;border:1px solid #ffffff25}button:disabled{opacity:.4;cursor:default}input,select{width:100%;border:1px solid #ffffff24;border-radius:10px;background:#0b2a30;color:white;padding:13px;margin:7px 0 15px}h1{font-size:46px;letter-spacing:4px;margin:10px 0}h2{margin:8px 0 20px}p{color:#adc2bf;line-height:1.7}.shell{max-width:960px;margin:auto;padding:28px}.brand{font-size:13px;letter-spacing:4px;color:#dfbd7a}.hero{padding:45px 0 25px}.row{display:flex;gap:14px;align-items:center;flex-wrap:wrap}.between{justify-content:space-between}.grid{display:grid;grid-template-columns:1fr 1fr;gap:18px}.panel{background:linear-gradient(135deg,#163c40,#0d2b32);border:1px solid #ffffff15;border-radius:22px;padding:24px;margin:14px 0}.mode{min-height:180px;cursor:pointer;text-align:left;color:#eff5ec;width:100%;font-weight:400}.mode strong{display:block;font-size:25px;margin:18px 0 8px}.icon{font-size:30px}.tag{border:1px solid #b5c8bc30;border-radius:100px;padding:7px 12px;font-size:13px;color:#d7c8a3}.muted{color:#9fb9b6;font-size:13px}.table{background:radial-gradient(ellipse at center,#226556,#103d3d 65%,#0a2931);border:1px solid #729b7833;border-radius:26px;padding:20px;min-height:410px}.players{display:flex;justify-content:space-between;gap:14px}.player{background:#071e2480;border-radius:14px;padding:13px;min-width:135px}.active{outline:2px solid #e7bc6b}.score{color:#f2cf8c;font-weight:700}.center{text-align:center;padding:22px 8px;min-height:140px}.hand{display:flex;flex-wrap:wrap;justify-content:center;gap:5px;padding:15px 0}.card{width:49px;height:72px;border-radius:7px;background:#faf7e9;color:#182c32;padding:5px 3px;font-size:21px;border:2px solid transparent;box-shadow:0 4px 8px #0003;cursor:pointer}.card:disabled{opacity:1}.card.red{color:#b44237}.card.joker{font-size:13px!important;white-space:nowrap}.card.selected{transform:translateY(-12px);border:2px solid #e5b24f;background:#ffe9ab}.card small{display:block;font-size:15px}.mini .card{width:38px;height:55px;font-size:17px;display:inline-block;margin:2px}.actions{display:flex;justify-content:center;gap:10px;flex-wrap:wrap}.round{color:#dfc58d;font-size:20px}.log{font-size:13px;color:#b0c6c0;max-height:110px;overflow:auto;margin-top:18px;line-height:1.8}.error{color:#ffb9a6}#toast{position:fixed;bottom:25px;left:50%;transform:translateX(-50%);padding:13px 23px;background:#f2d6a3;color:#142f32;border-radius:12px;display:none;z-index:5;max-width:90%}a{color:#edce8e}label{font-size:14px;color:#b7ceca}.rules{line-height:1.9;color:#c5d5cf}table{width:100%;border-collapse:collapse}td,th{padding:12px;border-bottom:1px solid #ffffff15;text-align:left}@media(max-width:600px){.shell{padding:16px}.hero{padding-top:25px}h1{font-size:36px}.grid{grid-template-columns:1fr}.mode{min-height:130px}.panel{padding:18px}.player{min-width:0;flex:1;font-size:13px;padding:10px}.table{padding:12px}.card{width:40px;height:62px;font-size:18px}.players{gap:8px}button{padding:12px 16px}}
/* Table and bottom hand layout */
.game-shell{--dock-height:250px}
.live-game{height:100dvh;height:100vh;overflow:hidden;display:flex;flex-direction:column;gap:12px}
@supports(height:100dvh){.live-game{height:100dvh}}
.game-bar{margin:0;flex-shrink:0;gap:6px}
.game-bar .round{font-size:18px}.game-bar .tag{font-size:12px}
.game-shell>.table{position:relative;display:flex;flex-direction:column;min-height:300px}
.live-game>.table{flex:1;min-height:0;margin-bottom:var(--dock-height)}
.game-shell .players{flex-shrink:0}.game-shell .player p{margin:9px 0}
.game-shell .center{flex:1;display:flex;flex-direction:column;justify-content:center;min-height:0;padding:16px 0 78px}
.played-cards{min-height:60px;margin:12px 0;display:flex;justify-content:center;flex-wrap:wrap}
.bottom-cards{position:absolute;right:14px;bottom:10px;text-align:right}
.bottom-cards>.muted{font-size:11px;letter-spacing:2px}
.bottom-cards .mini .card{width:29px;height:42px;padding:3px 2px;font-size:14px;margin:4px 1px 0;border-radius:4px}
.bottom-cards .card small{font-size:11px}.bottom-hidden{display:block;margin-top:8px;color:#d1bb87}
.hand-dock{position:relative;height:var(--dock-height);overflow:hidden;background:linear-gradient(180deg,transparent,#071e24 38%);flex-shrink:0}
.live-game .hand-dock{position:fixed;bottom:0;left:50%;transform:translateX(-50%);width:min(100%,960px);z-index:10}
.self-player{position:absolute;top:8px;left:18px;right:18px;font-size:14px}
.hand-dock .actions{position:absolute;top:47px;left:8px;right:8px;min-height:44px;align-items:center}
.hand-dock .actions button{min-width:88px;padding:12px 16px}
.hand{position:absolute;top:116px;left:12px;right:12px;height:190px;padding:0;display:block;isolation:isolate;touch-action:manipulation}
.hand .card{position:absolute;top:0;left:calc((100% - var(--spread-width))/2 + var(--i)*var(--step));width:var(--card-width);height:184px;border:1px solid #cdc8b7;border-radius:10px;background:linear-gradient(135deg,#fffdf5,#eee9d9);padding:0;text-align:left;box-shadow:-3px 2px 6px #0005;transition:transform .16s ease,background .16s ease;transform:translateY(0);-webkit-tap-highlight-color:transparent;overflow:hidden}
.hand .card-corner{position:absolute;top:9px;left:3px;display:flex;flex-direction:column;align-items:center;gap:2px;font-size:var(--rank-size);line-height:1.15;font-weight:750}
.hand .card small{font-size:16px}.hand .card.joker .card-rank{writing-mode:vertical-rl;font-size:12px;letter-spacing:1px}
.hand .card-watermark{position:absolute;top:64px;right:9px;font-size:54px;opacity:.12;pointer-events:none}
.hand .card.selected{transform:translateY(-24px);background:linear-gradient(135deg,#fff1bd,#f4d683);border-color:#e7bc6b;box-shadow:-3px 2px 6px #0005,inset 0 0 0 1px #c9953b}
.live-game>.log{display:none}
.finished-game .hand-dock{margin-top:16px}
@media(max-height:700px){.game-shell{--dock-height:224px}.hand{top:102px}.hand-dock .actions{top:39px}.self-player{top:3px}.live-game{gap:8px;padding-top:10px;padding-bottom:8px}.game-shell .player{padding:8px}.game-shell .player p{margin:5px 0}.game-shell .center{padding:6px 0 60px}.played-cards{min-height:45px;margin:5px 0}.played-cards .card{width:30px;height:43px;font-size:14px}.played-cards .card small{font-size:11px}.bottom-cards .mini .card{height:32px;width:24px;font-size:12px}.bottom-cards .card small{font-size:9px}.bottom-cards{bottom:5px}}
@media(prefers-reduced-motion:reduce){.hand .card{transition:none}}
/* Compact landscape table */
@media(orientation:landscape) and (max-height:500px){
.game-shell{--dock-height:170px}.live-game{padding:8px 16px;gap:6px}.live-game>.row:first-child{display:none}
.game-shell .table{padding:8px}.game-shell .players{position:absolute;top:8px;left:8px;right:8px}.game-shell .player{flex:0 1 170px;font-size:11px;padding:6px}.game-shell .player p{margin:2px 0}.game-shell .center{padding:54px 130px 6px}.game-shell .center>.muted{font-size:11px}.played-cards{min-height:40px;margin:2px 0}
.hand-dock .self-player{top:14px;right:auto;max-width:240px;font-size:12px}.hand-dock .actions{top:6px;left:270px;right:14px}.hand{top:72px}.hand-dock .actions button{padding:10px 16px}
}
#toast{z-index:100;max-width:calc(100vw - 32px);width:max-content;text-align:center;line-height:1.5;box-shadow:0 6px 24px #0005;pointer-events:none}
.has-result{overflow:hidden}
.result-overlay{position:fixed;inset:0;z-index:80;background:#020e16bd;backdrop-filter:blur(5px);display:flex;align-items:center;justify-content:center;padding:16px}
.result-dialog{width:min(620px,100%);max-height:calc(100vh - 32px);max-height:calc(100dvh - 32px);display:flex;flex-direction:column;gap:18px;overflow:auto;padding:26px;border:1px solid #d6b77b66;border-radius:24px;background:radial-gradient(ellipse at top,#245148,#102e35 75%);box-shadow:0 24px 80px #0009}
.result-header{display:flex;align-items:center;gap:18px}.result-header>div{min-width:0}.result-emblem{display:grid;place-items:center;flex-shrink:0;width:66px;height:66px;font-size:36px;border-radius:50%;background:#e7bc6b15;color:#e7bc6b;border:1px solid #e7bc6b55}
.result-header h2{font-size:30px;margin:6px 0}.result-header p{margin:0;color:#e4c98e;font-size:15px;overflow-wrap:anywhere;line-height:1.5}.result-header .brand{letter-spacing:2px;font-size:11px}
.result-scores{background:#061d2455;border:1px solid #ffffff12;border-radius:14px;overflow:hidden;flex-shrink:0}.result-scores table{table-layout:fixed;font-size:16px}.result-scores th{font-weight:400;color:#a4bcb6;font-size:12px}.result-scores td,.result-scores th{padding:13px 14px}.result-scores td:not(:first-child),.result-scores th:not(:first-child){text-align:right}.result-scores th:first-child{width:44%}.result-scores tbody tr:last-child td{border-bottom:0}.result-scores .result-name{display:block;overflow-wrap:anywhere;font-weight:650}.result-scores small{display:block;color:#99b2ab;font-size:11px;margin-top:3px}.result-scores .is-me{background:#ffffff06}.positive{color:#eac67e}.negative{color:#e99b91}
.final-result .result-scores th:first-child{width:13%}.final-result .result-scores th:nth-child(2){width:39%}.final-result .result-scores td:nth-child(2),.final-result .result-scores th:nth-child(2){text-align:left}.is-winner{background:#e7bc6b10}.rank-badge{color:#dfc58d;font-size:20px;font-weight:750}
.result-footer{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.result-footer .muted{font-size:12px}.result-buttons{display:flex;gap:10px;margin-left:auto}.result-buttons button{min-width:112px}.result-buttons button:focus-visible{outline:2px solid #fff4d5;outline-offset:3px}
@media(max-height:500px){.result-overlay{padding:10px}.result-dialog{width:min(620px,100%);max-height:calc(100vh - 20px);max-height:calc(100dvh - 20px);padding:16px 20px;gap:10px;border-radius:18px}.result-emblem{width:48px;height:48px;font-size:27px}.result-header{gap:12px}.result-header h2{font-size:24px;margin:2px 0}.result-header p{font-size:13px}.result-scores th,.result-scores td{padding:7px 12px}.result-scores table{font-size:14px}.result-scores small{margin-top:1px;font-size:10px}.result-footer button{padding:10px 16px}.result-footer .muted{font-size:11px}}
@media(max-width:450px){.result-dialog{padding:18px;gap:16px}.result-header{gap:12px}.result-emblem{width:48px;height:48px;font-size:28px}.result-header h2{font-size:26px}.result-header .brand{letter-spacing:1px}.result-scores td,.result-scores th{padding:12px 8px}.result-scores table{font-size:14px}.result-scores th{font-size:11px}.result-footer{justify-content:center}.result-buttons{margin:0;justify-content:center;width:100%}.final-result .result-scores th:nth-child(2){width:35%}}
@media(max-height:360px){.result-dialog{padding:10px 16px;gap:7px}.result-emblem{width:40px;height:40px}.result-header h2{font-size:20px;line-height:1.15;margin:1px 0}.result-header .brand{font-size:10px}.result-header p{font-size:12px;line-height:1.25}.result-scores th,.result-scores td{padding:3px 10px}.result-footer button{padding:8px 14px}}
.sound-button{padding:7px 12px!important;min-width:36px;font-size:18px}
.game-bar .sound-button{margin-left:auto}.game-shell>.row .sound-button{display:none}
.sound-overlay{z-index:90}.sound-dialog{width:min(460px,100%);gap:12px}.sound-dialog h2{margin:0;font-size:24px}.sound-dialog input[type=range]{margin:8px 0 0;padding:0;accent-color:#e7bc6b;cursor:pointer}.sound-switch{display:flex;align-items:center;justify-content:space-between;color:#eff5ec;font-size:16px}.sound-switch input{width:22px;height:22px;margin:0;accent-color:#e7bc6b}.sound-dialog p{margin:0}.sound-dialog .result-buttons{width:100%;justify-content:flex-end}
@media(max-height:400px){.sound-dialog{gap:7px}.sound-dialog h2{font-size:21px}.sound-dialog .sound-switch{font-size:14px}.sound-dialog input[type=range]{height:16px;margin:4px 0}.sound-dialog .result-buttons button{padding:8px 14px}}
/* All menus share a bounded viewport; content reflows before any fallback fit. */
html,body,#app{width:100%;height:100%;overflow:hidden;overscroll-behavior:none}
.screen-page{height:var(--app-height,100dvh);max-width:1040px;padding:16px 22px;display:flex;flex-direction:column;gap:12px;overflow:hidden}
.screen-page .topbar{flex-shrink:0;min-height:40px;flex-wrap:nowrap}.screen-page .topbar>.row{gap:8px;flex-wrap:nowrap}.screen-page .topbar button{padding:9px 16px;min-height:36px}.screen-page .topbar .brand{white-space:nowrap}
.screen-content{flex:1;min-height:0;min-width:0;overflow:hidden}.screen-canvas{width:100%;min-height:100%;display:flex;flex-direction:column;gap:12px;transform-origin:top left}
.view-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-shrink:0}.view-heading h2{margin:0;font-size:25px}.view-heading p{margin:0;font-size:14px}.view-heading .tag{font-size:11px;padding:5px 10px}
.screen-page h3{font-size:19px;margin:0 0 12px}.screen-page p{line-height:1.6}.screen-page .panel{margin:0;padding:18px;border-radius:18px;min-width:0}.screen-page button{min-height:38px;padding:10px 18px}
.screen-page input,.screen-page select{margin:0;padding:9px 12px;min-height:38px;border-radius:9px;font-size:15px;min-width:0}.screen-page label.field{display:flex;flex-direction:column;gap:6px;min-width:0;font-size:13px}
.home-heading h1{font-size:36px;margin:8px 0 0;letter-spacing:2px}.home-heading>p{max-width:190px;text-align:right;color:#9fb9b6}
.home-modes{grid-template-columns:1fr 1fr;gap:14px;flex:1;min-height:125px}.screen-page .mode{min-height:125px;display:flex;flex-direction:column;justify-content:center;align-items:flex-start;padding:20px 24px}.screen-page .mode strong{font-size:27px;margin:8px 0}.screen-page .mode .icon{font-size:28px;line-height:1}.screen-page .mode .muted{font-size:13px}
.account-strip{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-shrink:0}.account-strip>div{display:flex;align-items:center;gap:16px;min-width:0}.account-strip strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.account-strip button{flex-shrink:0}.view-footer{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-shrink:0}.view-footer .muted{font-size:12px}.view-footer button{min-height:34px;padding:7px 14px}
.setup-grid{display:grid;grid-template-columns:1.3fr 1fr;gap:14px;flex:1;min-height:0}.setup-main{display:flex;flex-direction:column;justify-content:center;gap:18px}.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}.setting-summary{display:flex;justify-content:space-between;gap:10px;color:#aec3bb;font-size:12px;flex-wrap:wrap}.setting-summary b{color:#e7bc6b;margin-left:4px}.primary-action{align-self:stretch}.setup-side{display:flex;flex-direction:column;justify-content:center;gap:10px}.setup-side h3{margin:0}.setup-side p{font-size:14px;margin:0}.setup-side .field{gap:5px}.setup-side .icon{color:#e7bc6b}
.view-tabs{display:flex;gap:8px;flex-shrink:0}.view-tabs button{flex:1;min-width:0;min-height:36px;padding:8px 12px;font-size:14px}.view-tabs .tab-active{background:#e7bc6b;color:#172c29}
.auth-card,.connection-card,.profile-card{flex:1;display:flex;flex-direction:column;justify-content:center;gap:16px}.auth-fields{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:14px}.auth-actions{display:flex;gap:12px}.auth-actions button{flex:1}.compact-note{font-size:12px;color:#9fb9b6;margin:0;line-height:1.5!important}.connection-status{display:flex;align-items:center;gap:10px;justify-content:space-between;border-top:1px solid #ffffff16;padding-top:10px}.connection-status>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px}.screen-page .text-button{background:transparent;color:#e7bc6b;font-size:12px;white-space:nowrap;padding:4px 0;min-height:28px}.connection-card{max-width:760px;width:100%;align-self:center}.connection-card h3{margin:0}.profile-card{align-items:center;text-align:center}.profile-card h3{margin:0}.profile-card p{margin:0}.profile-symbol{font-size:42px;color:#e7bc6b}
.rules-card{flex:1;display:flex;flex-direction:column;justify-content:center}.rules-card h3{color:#e7bc6b}.rules-columns{display:grid;grid-template-columns:1fr 1fr;gap:24px}.rules-columns p{font-size:15px;margin:0;line-height:1.8}.rules-tabs button{font-size:13px}
.waiting-card{flex:1;display:flex;flex-direction:column;justify-content:center;gap:22px}.room-invite{display:flex;justify-content:center;align-items:center;gap:18px}.room-code{font-size:44px;letter-spacing:6px;color:#e7bc6b}.waiting-seats{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}.waiting-seat{display:flex;flex-direction:column;gap:8px;align-items:center;padding:14px 8px;border-radius:12px;background:#061d2455;min-width:0}.waiting-seat strong{max-width:100%;font-size:14px;overflow-wrap:anywhere}.seat-icon{font-size:28px;color:#e7bc6b}
@media(orientation:portrait){.screen-page{padding:14px 16px;gap:12px}.home-heading{align-items:flex-start}.home-heading h1{font-size:29px}.home-heading>p{display:none}.screen-page .mode{padding:18px 14px}.screen-page .mode strong{font-size:22px}.screen-page .mode .muted{font-size:11px}.account-strip>div{flex-direction:column;align-items:flex-start;gap:4px}.account-strip{padding:14px!important}.setup-grid{grid-template-columns:1fr;grid-template-rows:1fr auto;gap:12px}.setup-main{gap:16px}.setup-side{gap:8px}.setup-side>.icon{display:none}.setup-side h3{font-size:17px}.setup-side p{font-size:13px}.auth-fields{grid-template-columns:1fr}.auth-actions{flex-direction:column;gap:8px}.rules-columns{grid-template-columns:1fr;gap:16px}.rules-tabs{gap:5px}.rules-tabs button{padding:8px 5px;font-size:11px}.room-invite{flex-direction:column;gap:8px}.room-code{font-size:37px}.waiting-card{gap:20px}.waiting-seats{gap:6px}.waiting-seat{padding:12px 4px}.waiting-seat strong{font-size:12px}.waiting-seat .muted{font-size:11px}}
@media(orientation:landscape) and (max-height:500px){.screen-page{padding:10px 18px;gap:8px}.screen-page .topbar{min-height:34px}.screen-page .topbar button{min-height:32px;padding:6px 13px}.screen-canvas{gap:9px}.view-heading h2{font-size:21px}.view-heading .muted{font-size:12px}.home-heading h1{font-size:28px;margin:4px 0 0}.home-heading .tag{display:none}.screen-page .panel{padding:14px 18px;border-radius:14px}.home-modes{min-height:105px;gap:12px}.screen-page .mode{min-height:105px;padding:14px 20px}.screen-page .mode .icon{font-size:23px}.screen-page .mode strong{font-size:24px;margin:5px 0}.screen-page .account-strip{padding:10px 16px}.screen-page .account-strip button{min-height:34px;padding:7px 14px}.setup-grid{gap:12px}.setup-main{gap:13px}.setup-side h3{font-size:17px}.setup-side p{font-size:13px}.auth-card,.connection-card,.profile-card{gap:12px}.auth-fields{gap:12px}.view-tabs button{min-height:32px;padding:6px 12px}.screen-page label.field{gap:4px;font-size:12px}.screen-page input,.screen-page select{min-height:36px;padding:7px 10px}.connection-status{padding-top:7px}.rules-columns{gap:22px}.rules-columns p{font-size:14px;line-height:1.65}.rules-card h3{font-size:18px;margin-bottom:10px}.waiting-card{gap:12px}.room-code{font-size:34px}.waiting-seat{gap:5px;padding:10px 8px}.seat-icon{font-size:24px}}
@media(max-height:360px){.screen-page{padding:7px 14px;gap:6px}.screen-canvas{gap:7px}.screen-page .topbar{min-height:30px}.screen-page .panel{padding:11px 14px}.home-heading h1{font-size:25px}.screen-page .mode{min-height:86px;padding:10px 16px}.home-modes{min-height:86px}.screen-page .mode strong{font-size:22px}.screen-page .mode .icon{font-size:20px}.screen-page .mode .muted{font-size:11px}.view-heading h2{font-size:20px}.screen-page h3{font-size:16px}.setup-main,.auth-card,.connection-card{gap:10px}.screen-page button{min-height:34px;padding:7px 14px}.screen-page input,.screen-page select{min-height:34px}.compact-note{font-size:11px}.setting-summary{font-size:11px}.view-tabs button{min-height:30px;padding:5px 10px;font-size:12px}.rules-columns p{font-size:13px;line-height:1.6}.view-footer button{min-height:30px;padding:5px 12px}.waiting-card{gap:8px}.room-code{font-size:29px}.waiting-seat{padding:7px 6px}}
.keyboard-open .screen-page .view-heading,.keyboard-open .screen-page .compact-note,.keyboard-open .screen-page .connection-status{display:none}
