:root{
  --bg:#08100f;
  --felt:#176c58;
  --felt-light:#247f69;
  --felt-dark:#0c4b3e;
  --rail:#5a301d;
  --rail-light:#936247;
  --rail-dark:#2d160e;
  --panel:#14201dcc;
  --ink:#171717;
  --muted:#a6b0ac;
  --red:#d83d49;
  --blue:#4ba2ff;
  --gold:#f3ca68;
  --orange:#f3a332;
}
*{box-sizing:border-box}
html,body{margin:0;width:100%;height:100%;overflow:hidden;background:#050908;color:#fff;font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei","Segoe UI",sans-serif}
button,input{font:inherit} button{-webkit-tap-highlight-color:transparent}.hidden{display:none!important}.screen{width:100%;height:100%}

/* ===== Lobby ===== */
.lobby-screen{display:grid;place-items:center;padding:18px;background:radial-gradient(circle at 50% 20%,#213a34 0,#101b18 42%,#070b0a 100%)}
.lobby-card{width:min(760px,96vw);padding:28px;border:1px solid #ffffff18;border-radius:24px;background:linear-gradient(180deg,#192723f2,#0e1715f2);box-shadow:0 24px 70px #0009,inset 0 1px #ffffff12}
.brand{font-size:34px;font-weight:950;text-align:center;color:#f6e7bd;letter-spacing:3px}.subbrand{text-align:center;color:#9aa7a2;margin:5px 0 20px}
.lobby-fields{display:grid;grid-template-columns:1fr 1fr;gap:10px}.lobby-fields input{min-height:50px;border:1px solid #ffffff20;border-radius:12px;padding:0 14px;background:#0a110fff;color:#fff;outline:none}.lobby-fields input:focus{border-color:#6f9e8f}
.lobby-actions{display:grid;grid-template-columns:1fr 1fr 1.15fr;gap:10px;margin-top:10px}.btn{min-height:50px;border:none;border-radius:12px;font-weight:900}.btn.secondary{background:#293a35;color:#e6efec}.btn.primary{background:linear-gradient(180deg,#dfa64b,#b66d1c);color:#fff}.btn:disabled{opacity:.35}
.room-line{display:flex;justify-content:space-between;gap:12px;margin:16px 2px 10px;color:#89958f}.room-line strong{color:#e8eee9}
.seat-chooser{display:grid;grid-template-columns:repeat(6,1fr);gap:8px}.lobby-seat{min-height:76px;border-radius:12px;border:2px solid transparent;background:#101a17;padding:7px;text-align:center;color:#fff}.lobby-seat.team-a{border-color:#3c8bd4}.lobby-seat.team-b{border-color:#bd4b55}.lobby-seat.me{box-shadow:0 0 0 2px #f2d58055}.lobby-seat .n{font-weight:900;font-size:18px}.lobby-seat .name{font-size:12px;margin-top:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.lobby-seat .team{font-size:11px;color:#8e9994}

/* ===== 1920 × 900 landscape game canvas ===== */
.game-screen{position:relative;display:grid;grid-template-rows:8.6% 65.4% 26%;width:min(100vw,calc(100dvh * 32 / 15));height:min(100dvh,calc(100vw * 15 / 32));margin:auto;overflow:hidden;background:radial-gradient(ellipse at 50% 48%,#1d2926 0,#111816 48%,#070b0a 100%);box-shadow:0 0 0 1px #ffffff0d,0 30px 90px #000b}

/* ===== Top bar: understated, reference-game-like ===== */
.game-topbar{z-index:60;display:grid;grid-template-columns:auto 1fr auto;align-items:center;padding:0 22px;color:#fff;background:linear-gradient(180deg,#101817,#0a100f);border-bottom:1px solid #ffffff10;box-shadow:0 8px 20px #0004}
.scoreboard{display:flex;align-self:center;height:calc(100% - 12px);min-height:0;overflow:visible;border-radius:10px;background:#0a0f0e;border:1px solid #ffffff10;box-shadow:0 5px 16px #0007}.score{min-width:92px;padding:4px 15px 6px;text-align:center;position:relative;display:flex;flex-direction:column;justify-content:center;overflow:visible}.score+.score{border-left:1px solid #ffffff12}.score span{display:block;font-size:13px;font-weight:800;line-height:1.05;color:#c6ceca}.score b{display:block;margin-top:2px;font-size:31px;line-height:1.02;color:#f0d88e;text-shadow:0 2px 8px #000}.score.own:after,.score.opp:after{content:"";position:absolute;left:12%;right:12%;bottom:1px;height:3px;border-radius:999px}.score.own:after{background:var(--blue)}.score.opp:after{background:#ff6974}
.game-status{text-align:center;min-width:0}.room-badge{font-size:12px;color:#9ba7a2;font-weight:700}.turn-text{font-size:23px;color:#f1d17b;font-weight:950;line-height:1.1;margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-shadow:0 2px 6px #000}.direction-text{display:none}
.top-tools{display:flex;align-items:center;gap:10px}.tool-chip{display:flex;flex-direction:column;align-items:center;color:#aeb8b4;font-size:9px;gap:1px}.tool-icon{width:29px;height:29px;border:1px solid #ffffff15;border-radius:50%;display:grid;place-items:center;font-size:13px;background:#111b18}.next-round{border:none;border-radius:9px;padding:8px 14px;background:linear-gradient(#e8aa45,#bd731d);color:#fff;font-size:13px;font-weight:900}

/* ===== Table stage ===== */
.table-area{min-height:0;position:relative;background:linear-gradient(180deg,#0a0e0d,#111815 35%,#111815)}
.felt{position:relative;width:100%;height:100%;overflow:visible;background:transparent;isolation:isolate}
/* real tabletop silhouette */
.felt:before{content:"";position:absolute;left:4.2%;right:4.2%;top:5.5%;bottom:4%;z-index:0;border-radius:50% / 44%;background:linear-gradient(180deg,var(--rail-light) 0%,var(--rail) 28%,var(--rail-dark) 100%);box-shadow:0 18px 35px #000a,0 2px 0 #bd8663 inset,0 -8px 14px #170a05 inset}
.felt:after{content:"";position:absolute;left:6.2%;right:6.2%;top:8.4%;bottom:7.6%;z-index:1;border-radius:50% / 44%;background:radial-gradient(ellipse at 50% 40%,#28816b 0%,#176a57 55%,#0d4d40 100%);box-shadow:inset 0 0 0 3px #caa17b33,inset 0 0 55px #00342b99,0 2px 8px #000a}

/* subtle felt pattern */
.table-center:before{content:"";position:absolute;width:620px;height:260px;left:50%;top:50%;transform:translate(-50%,-50%);border:1px solid #ffffff0b;border-radius:50%;box-shadow:0 0 80px #ffffff05 inset;pointer-events:none}

/* ===== Seat geometry ===== */
.opponent,.self-seat{position:absolute;z-index:20;pointer-events:none;overflow:visible}
.pos-top-left,.pos-top-center,.pos-top-right{top:1.2%;width:22%;height:42%;display:flex;flex-direction:column;align-items:center}
.pos-top-left{left:12.4%}.pos-top-center{left:39%}.pos-top-right{right:12.4%}
.pos-bottom-left,.pos-bottom-right{top:46%;width:27%;height:39%;display:flex;align-items:center}
.pos-bottom-left{left:2.3%;flex-direction:row}.pos-bottom-right{right:2.3%;flex-direction:row}
.pos-bottom-left .player-box{order:0}.pos-bottom-left .played-cards{order:1}.pos-bottom-right .played-cards{order:0}.pos-bottom-right .player-box{order:1}
.self-seat{left:50%;bottom:-3px;transform:translateX(-50%);z-index:28}

/* ===== Player avatar UI ===== */
.player-box{position:relative;pointer-events:auto;width:116px!important;height:105px!important;display:flex!important;flex-direction:column!important;align-items:center!important;justify-content:flex-start!important;padding:0!important;background:transparent!important;border:none!important;border-radius:0!important;box-shadow:none!important;overflow:visible!important;flex:none!important;color:#fff;text-align:center}
.avatar-wrap{position:relative;width:72px;height:72px;flex:0 0 auto}
.avatar{width:72px;height:72px;border-radius:50%;display:grid;place-items:center;background:radial-gradient(circle at 35% 28%,#697c78 0,#324741 52%,#172522 100%);border:3px solid #7c8c87;color:#edf2ef;font-size:29px;font-weight:950;text-shadow:0 2px 5px #000b;box-shadow:0 7px 15px #0009,inset 0 1px #ffffff55}
.player-box.team-a .avatar{border-color:#55a9ff;box-shadow:0 0 0 2px #174c7c,0 0 12px #3c93ef77,0 7px 15px #0009}
.player-box.team-b .avatar{border-color:#f06773;box-shadow:0 0 0 2px #762832,0 0 12px #e54e5a66,0 7px 15px #0009}
.player-box.turn .avatar{border-color:#ffe28a;box-shadow:0 0 0 3px #fff3b066,0 0 25px #ffd75b,0 7px 15px #0009;animation:turnPulse 1.25s ease-in-out infinite alternate}
@keyframes turnPulse{from{filter:brightness(1)}to{filter:brightness(1.18)}}
.player-box.out{opacity:.42;filter:grayscale(.45)}
.card-badge{position:absolute;right:-15px;bottom:2px;min-width:43px;height:29px;padding:0 8px;border-radius:15px;display:flex;align-items:center;justify-content:center;gap:2px;background:linear-gradient(180deg,#111817,#050807);border:1px solid #ffffff23;box-shadow:0 4px 9px #0008;color:#f5df9f}
.pcards{font-size:20px;font-weight:950;line-height:1}.punit{font-size:9px;color:#c5ceca;font-weight:700}
.pname{max-width:116px;margin-top:4px;padding:3px 10px 4px;border-radius:10px;background:#080d0cce;box-shadow:0 2px 8px #0006;color:#e9eeeb;font-size:14px;font-weight:800;line-height:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.self-player{transform:scale(.9);transform-origin:center bottom}

/* ===== Played cards ===== */
.played-cards{display:flex;justify-content:center;align-items:flex-start;overflow:visible!important;z-index:24;min-width:0;flex:none!important;filter:drop-shadow(0 5px 6px #0005)}
.pos-top-left .played-cards,.pos-top-center .played-cards,.pos-top-right .played-cards{width:100%;height:158px;margin-top:-4px}
.pos-bottom-left .played-cards,.pos-bottom-right .played-cards{width:calc(100% - 105px);height:160px;align-items:center;margin:0 2px}
.play-card{--pw:82px;--ph:146px;position:relative;width:var(--pw);height:var(--ph);flex:0 0 auto;border-radius:8px;background:linear-gradient(145deg,#fffefb,#f3f0e8);border:1px solid #b5b2a9;box-shadow:0 3px 8px #0005;color:#111;overflow:hidden}
.play-card.red{color:#c82f3b}.play-card+.play-card{margin-left:var(--overlap,-34px)}
.play-rank,.card-rank{position:absolute;font-family:"Arial Narrow","Helvetica Neue Condensed",Arial,"PingFang SC",sans-serif;font-weight:900;font-variant-numeric:lining-nums tabular-nums;letter-spacing:-1.5px;white-space:nowrap}
.play-rank{left:8px;top:7px;font-size:calc(var(--pw) * .38);line-height:.9}.play-suit-small{position:absolute;left:10px;top:calc(10px + var(--pw) * .39);font-size:calc(var(--pw) * .27);line-height:1}.play-suit-large{position:absolute;right:8px;bottom:8px;font-size:calc(var(--pw) * .44);line-height:1;opacity:.96}
.joker-stack{display:flex;flex-direction:column;align-items:center;justify-content:flex-start;line-height:.78;font-family:Arial,sans-serif;font-weight:900}.play-joker-stack{position:absolute;left:8px;top:8px;font-size:calc(var(--pw) * .19)}.play-card.big-joker{color:#c9333f}.play-card.small-joker{color:#111}
.pass-mark{font-size:29px;color:#e4eee9c0;font-weight:950;text-shadow:0 3px 8px #000b;white-space:nowrap}

/* ===== Center ===== */
.table-center{position:absolute;left:50%;top:49%;transform:translate(-50%,-50%);z-index:90;text-align:center;color:var(--gold);pointer-events:none}
.center-emblem{font-size:52px;font-weight:950;letter-spacing:10px;color:#d9e4df0c;text-shadow:0 2px #ffffff08}
.trick-points{margin-top:-10px;font-size:74px;line-height:.95;font-weight:950;color:#f1cf78;text-shadow:0 4px 10px #0009}
.self-play{position:absolute;left:50%;bottom:4.5%;transform:translateX(-50%);width:40%;height:152px;display:flex;justify-content:center;align-items:flex-end;z-index:26;overflow:visible}

/* ===== Hand dock ===== */
.hand-dock{position:relative;z-index:50;background:linear-gradient(180deg,#0b2520 0,#071410 20%,#060d0b 100%);border-top:1px solid #ffffff10;padding:0 20px 4px;overflow:visible;box-shadow:0 -10px 24px #0006}
.hand-toolbar{position:absolute;left:0;right:0;top:-61px;height:58px;display:flex;align-items:center;justify-content:flex-end;padding-right:3%;z-index:70;pointer-events:none}
.hand-meta{position:absolute;left:27px;bottom:6px;display:flex;gap:16px;align-items:center;color:#aeb8b4;font-size:12px;white-space:nowrap}.hand-meta strong{font-size:18px;color:#efd27c}
.action-cluster{display:flex;gap:11px;align-items:center;pointer-events:auto}.action{min-width:112px;height:49px;border:none;border-radius:24px;font-weight:950;font-size:20px;color:#fff;box-shadow:0 7px 15px #0007,inset 0 1px #ffffff4d;text-shadow:0 2px 3px #0006}.action.secondary{background:linear-gradient(#477fd0,#285da6)}.action.secondary:nth-child(2){background:linear-gradient(#6d62bc,#4d428d)}.action.primary{min-width:130px;background:linear-gradient(#f0b14a,#c67a1d)}.action:disabled{opacity:.36}
.hand-track{--cw:101px;--ch:182px;--step:51px;display:flex;justify-content:center;align-items:flex-end;height:100%;width:100%;overflow:visible;touch-action:none;user-select:none;padding:13px 12px 5px}
.card{position:relative;width:var(--cw);height:var(--ch);flex:0 0 auto;border-radius:8px;border:1px solid #b6b1a7;background:linear-gradient(145deg,#fffefa 0,#f7f4ed 68%,#ece8de 100%);box-shadow:0 3px 8px #0006;color:#111;padding:0;transition:transform .09s ease,filter .09s ease;overflow:hidden}
.card+.card{margin-left:calc(var(--step) - var(--cw))}.card.red{color:#c82f3b}.card.selected{transform:translateY(-28px)!important;filter:brightness(1.035);box-shadow:0 10px 18px #0009!important}
.card-rank{top:9px;left:9px;font-size:calc(var(--cw) * .38);line-height:.9}.card-suit-small{position:absolute;top:calc(12px + var(--cw) * .39);left:11px;font-size:calc(var(--cw) * .27);line-height:1}.card-suit-large{position:absolute;right:9px;bottom:9px;font-size:calc(var(--cw) * .45);line-height:1;opacity:.98}
.card-joker-stack{position:absolute;top:8px;left:9px;font-size:calc(var(--cw) * .19)}.card.big-joker{color:#c9333f}.card.small-joker{color:#111}

.toast{position:fixed;left:50%;top:10px;transform:translate(-50%,-16px);opacity:0;padding:8px 14px;border-radius:999px;background:#18201eee;color:#fff;font-size:12px;z-index:120;transition:.16s;pointer-events:none}.toast.show{opacity:1;transform:translate(-50%,0)}
.modal{position:fixed;inset:0;background:#0009;display:grid;place-items:center;z-index:100}.modal-card{min-width:280px;max-width:84vw;background:#f5f2ea;color:#1b231f;border-radius:18px;padding:20px;text-align:center;box-shadow:0 20px 50px #0007}.modal-title,.result-title{font-size:23px;font-weight:900}.lead-choices{display:flex;justify-content:center;gap:10px;margin-top:16px}.lead-choices button{border:none;border-radius:10px;background:#1b7b5e;color:#fff;padding:10px 18px;font-weight:900}.result-reason{margin-top:8px;color:#6b746f}


/* ===== v0.11.1 fixed logical stage =====
   Mobile landscape is the master canvas. The whole 1600×750 scene scales as one unit,
   so no seat or hand card can drift outside the phone viewport. */
html,body{
  min-height:100%;
  min-height:100dvh;
  overscroll-behavior:none;
  -webkit-text-size-adjust:100%;
  touch-action:manipulation;
  background:#050908;
}
body{padding:0!important}
input,button,.card{-webkit-touch-callout:none}
.card{touch-action:none}

/* Lobby remains responsive; only the actual game uses the fixed stage. */
@media (max-width:900px){
  .lobby-screen{padding:max(10px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) max(10px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left))}
  .lobby-card{width:min(720px,96vw);padding:18px;border-radius:18px}
  .brand{font-size:28px}.subbrand{margin-bottom:14px}
  .lobby-fields input,.btn{min-height:44px}
  .lobby-seat{min-height:66px}
}

.game-screen{
  position:fixed!important;
  left:0!important;
  top:0!important;
  width:1600px!important;
  height:750px!important;
  max-width:none!important;
  max-height:none!important;
  margin:0!important;
  grid-template-rows:65px 490px 195px!important;
  transform-origin:0 0!important;
  will-change:transform;
  overflow:hidden!important;
  box-shadow:none!important;
}

/* Logical-stage refinements: these values are stable on every device because the stage scales as a whole. */
.game-topbar{padding:0 20px!important}
.scoreboard{height:53px!important}
.score{min-width:88px!important;padding:4px 14px 6px!important}
.score span{font-size:12px!important}.score b{font-size:29px!important}
.room-badge{font-size:12px!important}.turn-text{font-size:22px!important}
.top-tools{gap:8px!important}.tool-icon{width:28px!important;height:28px!important}.tool-chip{font-size:9px!important}

.felt:before{left:4.2%!important;right:4.2%!important;top:5.5%!important;bottom:4%!important;border-radius:50% / 44%!important}
.felt:after{left:6.2%!important;right:6.2%!important;top:8.4%!important;bottom:7.6%!important;border-radius:50% / 44%!important}
.table-center{top:49%!important}
.table-center:before{width:520px!important;height:220px!important}
.center-emblem{font-size:46px!important}.trick-points{font-size:68px!important}

.pos-top-left,.pos-top-center,.pos-top-right{top:1%!important;width:22%!important;height:42%!important}
.pos-top-left{left:12.4%!important}.pos-top-center{left:39%!important}.pos-top-right{right:12.4%!important}
.pos-bottom-left,.pos-bottom-right{top:45%!important;width:27%!important;height:40%!important}
.pos-bottom-left{left:2.3%!important}.pos-bottom-right{right:2.3%!important}
.self-seat{bottom:14px!important}

.player-box{width:108px!important;height:98px!important}
.avatar-wrap,.avatar{width:68px!important;height:68px!important}
.avatar{font-size:27px!important;border-width:3px!important}
.card-badge{right:-14px!important;bottom:2px!important;min-width:41px!important;height:27px!important;padding:0 7px!important}
.pcards{font-size:19px!important}.punit{font-size:9px!important}
.pname{max-width:110px!important;margin-top:3px!important;padding:3px 9px 4px!important;font-size:13px!important}
.self-player{transform:scale(.88)!important}

.pos-top-left .played-cards,.pos-top-center .played-cards,.pos-top-right .played-cards{height:145px!important;margin-top:-4px!important}
.pos-bottom-left .played-cards,.pos-bottom-right .played-cards{width:calc(100% - 100px)!important;height:145px!important;margin:0 2px!important}
.self-play{bottom:5%!important;width:40%!important;height:140px!important}
.pass-mark{font-size:27px!important}

.hand-dock{padding:0 18px 4px!important}
.hand-toolbar{top:-58px!important;height:55px!important;padding-right:2.5%!important}
.hand-meta{left:24px!important;bottom:6px!important;gap:14px!important;font-size:11px!important}.hand-meta strong{font-size:17px!important}
.action-cluster{gap:10px!important}
.action{height:52px!important;min-width:116px!important;padding:0 18px!important;border-radius:26px!important;font-size:19px!important}
.action.primary{min-width:128px!important}
.hand-track{height:100%!important;width:100%!important;padding:10px 4px 4px!important;align-items:flex-end!important;justify-content:center!important;overflow:visible!important}
.card.selected{transform:translateY(-24px)!important}

@media (orientation:portrait){
  body:before{content:"请旋转手机横屏游戏";position:fixed;inset:0;display:grid;place-items:center;background:#0d1513;color:#eee5ce;font-size:20px;font-weight:900;z-index:999}
}
