:root{color-scheme:dark;--gold:#e8c27a;--gold2:#b8893a;--ink:#fff6e6;--muted:#b9c6c0;--felt:#173d36;--felt2:#0c2622;--red:#c8323c;--black:#1d1b2a;font-family:"PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;color:var(--ink);background:#081614}
*{box-sizing:border-box}
[hidden]{display:none!important}
body{margin:0;min-height:100dvh;background:radial-gradient(ellipse at top,#163a33,#081614 65%)}
a{color:var(--gold);text-decoration:none}a:hover{text-decoration:underline}
button{font:inherit;color:inherit;cursor:pointer}
:focus-visible{outline:3px solid #8bd6c3;outline-offset:3px}
.toolbar{max-width:1400px;margin:auto;display:flex;justify-content:space-between;align-items:center;gap:16px;padding:10px 20px}
.toolbar h1{font:600 18px/1 "Songti SC","Noto Serif SC","Noto Serif CJK SC",serif;letter-spacing:.2em;margin:0;color:var(--gold)}
.toolbar-actions{display:flex;gap:10px}
.toolbar-actions button{background:rgba(255,255,255,.06);border:1px solid rgba(232,194,122,.4);border-radius:999px;padding:6px 14px}

/* 牌桌：16:9，界面尺寸随宽度缩放 */
.table-wrap{padding:0 12px 20px}
.table{position:relative;width:min(100%,calc((100dvh - 80px) * 16 / 9),1500px);aspect-ratio:16/9;margin:0 auto;container-type:size;overflow:hidden;border-radius:2cqw;font-size:1.5cqw;
  background:radial-gradient(ellipse at 50% 45%,#22564c 0%,var(--felt) 45%,var(--felt2) 100%);box-shadow:inset 0 0 0 .5cqw #3a2a14,inset 0 0 0 .75cqw var(--gold2),inset 0 0 6cqw rgba(0,0,0,.55),0 2cqw 4cqw rgba(0,0,0,.4)}
.table::before{content:"九";position:absolute;left:50%;top:44%;transform:translate(-50%,-50%);font:700 22cqw/1 "Songti SC","Noto Serif SC","Noto Serif CJK SC",serif;color:rgba(232,194,122,.05);pointer-events:none}
.screen{position:absolute;inset:0;display:none}
.screen.active{display:block}

/* 按钮 */
.btn{display:inline-flex;flex-direction:column;align-items:center;justify-content:center;gap:.15em;min-height:2.6em;padding:.4em 1.4em;border-radius:999px;border:1px solid rgba(232,194,122,.55);background:rgba(10,24,22,.7);font-weight:600;transition:transform .12s,background .12s}
.btn:hover:not(:disabled){transform:translateY(-1px);background:rgba(232,194,122,.16)}
.btn small{font-size:.66em;font-weight:400;color:var(--muted)}
.btn.primary{background:linear-gradient(180deg,#f3d48e,#c99a52);color:#2a1a08;border-color:#f3d48e}
.btn.primary small{color:#5a3e18}
.btn.ghost{background:transparent}
.btn.small{min-height:2em;padding:.2em .9em;font-size:.85em}
.btn:disabled{opacity:.38;cursor:not-allowed}
.row{display:flex;gap:1cqw;flex-wrap:wrap;align-items:flex-end}
.row.center{justify-content:center;align-items:center}

/* 标题 */
#scr-title .title-box{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1.2cqw;text-align:center}
.eyebrow{margin:0;letter-spacing:.35em;font-size:.8em;color:#8bd6c3}
.title-box h2{margin:0;font:700 6cqw/1.1 "Songti SC","Noto Serif SC","Noto Serif CJK SC",serif;letter-spacing:.12em;color:var(--gold);text-shadow:0 .3cqw 1.5cqw rgba(0,0,0,.5)}
.fan{position:relative;height:11cqw;width:40cqw;margin:1cqw 0}
.fan .card{position:absolute;left:50%;bottom:0;transform-origin:50% 120%}
.menu{display:flex;gap:2cqw}
.menu .btn{min-width:18cqw;font-size:1.15em}

/* 面板 */
.panel{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:76cqw;max-height:92%;overflow:auto;background:rgba(8,20,18,.94);border:1px solid rgba(232,194,122,.45);border-radius:1.4cqw;padding:2cqw 2.4cqw;box-shadow:0 2cqw 5cqw rgba(0,0,0,.5)}
.panel.small{width:40cqw;text-align:center}
.panel h2{margin:0 0 .6em;font:600 2.2cqw/1.3 "Songti SC","Noto Serif SC","Noto Serif CJK SC",serif;letter-spacing:.12em;color:var(--gold)}
.panel h3{margin:.2em 0 .5em;font-size:1.05em;color:#8bd6c3}
.panel-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:.8em}
.panel-head h2{margin:0}
.lobby{display:grid;grid-template-columns:1fr 1fr;gap:2.4cqw}
.col{display:flex;flex-direction:column;gap:1cqw;min-width:0}
.field{display:flex;flex-direction:column;gap:.3em;font-size:.82em;color:var(--muted)}
.field.grow{flex:1}
.field input{font:inherit;font-size:1.15em;color:var(--ink);background:rgba(255,255,255,.06);border:1px solid rgba(255,255,255,.22);border-radius:.6cqw;padding:.45em .7em}
.field input:focus{border-color:var(--gold);outline:none}
#join-code{text-transform:uppercase;letter-spacing:.3em}
#join-code:placeholder-shown{letter-spacing:normal;text-transform:none}
.status{min-height:1.4em;margin:0;font-size:.85em;color:#8bd6c3}
.fine{font-size:.76em;color:var(--muted);line-height:1.6}
.rooms-head{display:flex;justify-content:space-between;align-items:center}
.rooms-head h3{margin:0}
.rooms{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:.5cqw;min-height:10cqw;max-height:22cqw;overflow:auto}
.rooms li{display:flex;align-items:center;gap:.8em;background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.1);border-radius:.6cqw;padding:.45em .8em;font-size:.85em}
.rooms li.empty{color:var(--muted);justify-content:center;border-style:dashed}
.rooms .nm{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.rooms .meta{color:var(--muted);font-size:.85em}
.code{letter-spacing:.25em;color:var(--ink);user-select:all}
.seats{list-style:none;margin:1em 0;padding:0;display:grid;gap:.6cqw;text-align:left}
.seats li{display:flex;align-items:center;gap:1em;background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.12);border-radius:.8cqw;padding:.5em .9em}
.seats li.wait{color:var(--muted);border-style:dashed}
.seats .av{width:3cqw;height:3cqw;border-radius:50%;background:#0b1c19 center/cover;border:2px solid var(--gold2);flex:none}
.seats em{margin-left:auto;font-style:normal;font-size:.8em;color:#8bd6c3}

/* 扑克牌 */
.card{--cw:5.4cqw;position:relative;width:var(--cw);height:calc(var(--cw)*1.42);border-radius:calc(var(--cw)*.09);flex:none;user-select:none;-webkit-user-select:none;
  background:linear-gradient(160deg,#fffdf6,#f3e6c8);border:1px solid #c9ad74;box-shadow:0 .25cqw .6cqw rgba(0,0,0,.35);overflow:hidden;--sc:var(--black)}
.card.red{--sc:var(--red)}
.card .art{position:absolute;left:12%;right:9%;top:17%;bottom:7%;border-radius:calc(var(--cw)*.06);background:#e8dcc0 center top/cover no-repeat;box-shadow:0 0 0 calc(var(--cw)*.025) var(--sc),0 0 0 calc(var(--cw)*.045) #f7eccf}
.card .idx{position:absolute;left:5%;top:3%;display:flex;flex-direction:column;align-items:center;line-height:.95;font-weight:800;color:var(--sc);font-size:calc(var(--cw)*.26);letter-spacing:-.04em;z-index:1;text-shadow:0 0 .2em #fffaf0,0 0 .2em #fffaf0}
.card .idx i{font-style:normal;font-size:.72em}
.card .idx.br{left:auto;top:auto;right:5%;bottom:3%;transform:rotate(180deg)}
.card.joker .idx{font-size:calc(var(--cw)*.16);writing-mode:vertical-rl;letter-spacing:.05em}
.card.joker .art{left:7%;right:7%;top:6%;bottom:6%;background-position:center 8%}
.card.big{--sc:#c8323c;background:linear-gradient(160deg,#fff6dc,#f0cf86)}
.card.face .art{inset:0;border-radius:0;box-shadow:none;background:center/100% 100% no-repeat}
.card.face .idx{display:none}
.card.face{background:#fbf7ee;border-color:#cdb78a}
.card.small{--sc:#2a7a66;background:linear-gradient(160deg,#f6fffb,#cfe9df)}
.card.back{background:radial-gradient(circle at 50% 50%,#2c6a5c 0 28%,transparent 29%),repeating-linear-gradient(45deg,#14382f 0 .35cqw,#1c4a3f .35cqw .7cqw);border-color:var(--gold2)}
.card.back::after{content:"九";position:absolute;inset:0;display:grid;place-items:center;font:700 calc(var(--cw)*.5)/1 "Songti SC","Noto Serif SC","Noto Serif CJK SC",serif;color:var(--gold);text-shadow:0 0 .3em rgba(0,0,0,.5)}
.card.back::before{content:"";position:absolute;inset:6%;border:1px solid rgba(232,194,122,.6);border-radius:calc(var(--cw)*.06)}

/* 牌桌上的区域 */
.hud-top{position:absolute;left:0;right:0;top:1.2cqw;display:flex;flex-direction:column;align-items:center;gap:.5cqw;pointer-events:none}
.bottom-cards{display:flex;gap:.5cqw}
.bottom-cards .card{--cw:3.6cqw}
.info{display:flex;gap:1.4em;font-size:.82em;color:var(--muted);background:rgba(0,0,0,.25);padding:.2em 1em;border-radius:999px}
.info b{color:var(--gold)}
.seat{position:absolute;display:flex;flex-direction:column;align-items:center;gap:.3cqw;width:11cqw;text-align:center}
.seat-left{left:2cqw;top:9cqw}
.seat-right{right:2cqw;top:9cqw}
.seat .av{position:relative;width:6.4cqw;height:6.4cqw;border-radius:50%;background:#0b1c19 center/cover;border:.25cqw solid rgba(232,194,122,.6);box-shadow:0 .4cqw 1cqw rgba(0,0,0,.4)}
.seat.turn .av{border-color:#8bd6c3;box-shadow:0 0 0 .3cqw rgba(139,214,195,.35),0 0 2cqw rgba(139,214,195,.6)}
.seat .role{position:absolute;bottom:-.4cqw;left:50%;transform:translateX(-50%);font-size:.7em;font-weight:800;padding:.05em .6em;border-radius:999px;background:#2a4a44;border:1px solid #8bd6c3;white-space:nowrap}
.seat .role.ll{background:linear-gradient(180deg,#f3d48e,#c99a52);color:#2a1a08;border-color:#fff2c4}
.seat .name{font-size:.86em;font-weight:600;max-width:11cqw;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.seat .cnt{display:flex;align-items:center;gap:.4em;font-size:.85em}
.seat .cnt .card{--cw:2.2cqw}
.seat .cnt b{font-size:1.25em;color:var(--gold)}
.seat .cnt.warn b{color:#ff7a6a}
.seat .bubble{min-height:1.5em;font-size:.82em;color:#fff2c4;font-weight:700}
.seat .timer{width:100%;height:.35cqw;border-radius:9px;background:rgba(255,255,255,.12);overflow:hidden}
.seat .timer i{display:block;height:100%;background:#8bd6c3;transform-origin:left;transition:transform .25s linear}
.played{position:absolute;display:flex;justify-content:center;pointer-events:none}
.played .card{--cw:3.9cqw}
.played .card+.card{margin-left:calc(var(--cw)*-.58)}
.played-left{left:15cqw;top:14cqw;justify-content:flex-start}
.played-right{right:15cqw;top:14cqw;justify-content:flex-end}
.played-me{left:0;right:0;top:25cqw}
.played .pass{font:700 1.6em/1 "Songti SC","Noto Serif SC","Noto Serif CJK SC",serif;color:rgba(255,246,230,.75);letter-spacing:.2em}
.played .fly{animation:fly .32s cubic-bezier(.2,.8,.3,1) both}
@keyframes fly{from{transform:translateY(var(--fy,3cqw)) scale(.85);opacity:0}}
.played .ctype{position:absolute;top:-1.6em;font-size:.82em;color:var(--gold);font-weight:700}
.me-bar{position:absolute;left:0;right:0;bottom:12.4cqw;display:flex;flex-direction:column;align-items:center;gap:.4cqw}
.seat-me{position:absolute;left:2cqw;bottom:-11cqw;width:10cqw}
.seat-me .av{width:5.4cqw;height:5.4cqw}
.actions{display:flex;gap:1cqw;min-height:2.9em}
.actions .btn{min-width:8cqw}
.tip{margin:0;min-height:1.3em;font-size:.82em;color:#ffb0a6}
.hand{position:absolute;left:13cqw;right:4cqw;bottom:1.6cqw;display:flex;justify-content:center;align-items:flex-end;height:9.4cqw;touch-action:none}
.hand .card{cursor:pointer;transition:transform .12s}
.hand .card+.card{margin-left:calc(var(--cw)*-.5)}
.hand .card.sel{transform:translateY(-1.6cqw)}
.hand .card:hover{filter:brightness(1.05)}
.hand .card.deal{animation:deal .35s ease-out both}
@keyframes deal{from{transform:translateY(-12cqw) scale(.6);opacity:0}}
.hand.locked .card{cursor:default}
.banner{position:absolute;left:50%;top:40%;transform:translate(-50%,-50%);font:800 5cqw/1 "Songti SC","Noto Serif SC","Noto Serif CJK SC",serif;color:var(--gold);text-shadow:0 .4cqw 0 #3a1a08,0 0 3cqw rgba(255,200,100,.6);pointer-events:none;opacity:0;white-space:nowrap}
.banner.show{animation:banner 1.2s ease-out}
.banner.boom{color:#ff8a5a}
@keyframes banner{0%{opacity:0;transform:translate(-50%,-50%) scale(1.8)}15%{opacity:1;transform:translate(-50%,-50%) scale(1)}75%{opacity:1}100%{opacity:0;transform:translate(-50%,-62%)}}
.table.shake{animation:shake .4s}
@keyframes shake{20%{transform:translate(-.5cqw,.3cqw)}40%{transform:translate(.5cqw,-.3cqw)}60%{transform:translate(-.3cqw,.2cqw)}80%{transform:translate(.3cqw,0)}}

/* 覆盖层 */
.overlay{position:absolute;inset:0;background:rgba(4,10,9,.6);z-index:10}
.result h2{font-size:3cqw}
.res-table{width:100%;border-collapse:collapse;margin:.6em 0 1em;font-size:.9em}
.res-table td{padding:.35em .6em;border-bottom:1px solid rgba(255,255,255,.08)}
.res-table td:last-child{text-align:right;font-weight:800}
.res-table .plus{color:#8be0a0}.res-table .minus{color:#ff8a7a}
.res-table .hand-left{display:flex;gap:2px;flex-wrap:wrap}
.res-table .hand-left .card{--cw:1.9cqw}
.count{font:900 6cqw/1.1 "Songti SC","Noto Serif SC","Noto Serif CJK SC",serif;color:var(--gold)}
.rules{display:grid;grid-template-columns:1fr 1fr;gap:1.2cqw 2.4cqw;text-align:left}
.rules p{margin:0;font-size:.82em;line-height:1.7;color:#d8e2dd}
@media (max-width:700px){.toolbar{padding:8px 12px;gap:8px}.toolbar h1{font-size:15px;white-space:nowrap}.toolbar>a{font-size:13px;white-space:nowrap}.toolbar-actions{gap:6px}.toolbar-actions button{padding:4px 10px;font-size:13px;white-space:nowrap}.table-wrap{padding:0 4px 12px}}
/* 手机横屏：工具栏收紧，牌桌尽量大 */
@media (max-height:500px) and (orientation:landscape){.toolbar{padding:4px 12px}.toolbar h1{font-size:14px}.toolbar-actions button{padding:3px 10px;font-size:13px}.table{width:min(100%,calc((100dvh - 44px) * 16 / 9))}.table-wrap{padding:0 8px 6px}}
/* 牌桌窄的时候手牌放大、叠得更紧，方便点 */
@container (max-width:720px){.hand{left:11cqw;right:1cqw;height:10.4cqw}.hand .card{--cw:7.2cqw}.hand .card+.card{margin-left:calc(var(--cw)*-.62)}.played .card{--cw:4.6cqw}}
.rotate-tip{display:none}
@media (orientation:portrait) and (max-width:700px){.rotate-tip{display:block;text-align:center;color:var(--muted);font-size:13px;margin:2px 0 10px}}
@media (prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}
.panel.result{width:58cqw}
.res-table td:nth-child(2){white-space:nowrap;text-align:left}
.res-table td:nth-child(3){width:46%}

.my-record{margin:1.2cqw 0 0;font-size:1.3cqw;color:var(--gold);min-height:1.5em}
