:root{
  --bg:#080b25;
  --panel:rgba(25,28,60,.78);
  --panel2:rgba(45,39,88,.74);
  --line:rgba(255,255,255,.13);
  --text:#f6f3ff;
  --muted:rgba(246,243,255,.68);
  --gold:#ffdb6b;
  --purple:#a855f7;
  --purple2:#6d5dfc;
  --green:#4ade80;
  --red:#fb7185;
  --black:#111827;
  --shadow:0 22px 70px rgba(0,0,0,.38);
}
*{box-sizing:border-box}
html,body{min-height:100%;margin:0}
body{
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",Arial,sans-serif;
  color:var(--text);
  background:radial-gradient(circle at 20% 10%, #42206f 0, transparent 34%),radial-gradient(circle at 82% 5%, #332b75 0, transparent 35%),linear-gradient(180deg,#090a26,#070923 58%,#050617);
  overflow-x:hidden;
}
body::before{
  content:"";position:fixed;inset:0;pointer-events:none;opacity:.45;
  background-image:linear-gradient(rgba(255,255,255,.04) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.04) 1px,transparent 1px);
  background-size:72px 72px;
  mask-image:linear-gradient(#000,transparent 92%);
}
button,input,select{font:inherit}
button{cursor:pointer;color:inherit;border:0}
input,select{
  width:100%;border:1px solid rgba(255,255,255,.15);border-radius:14px;padding:12px 13px;
  background:rgba(7,10,33,.85);color:var(--text);outline:none;
}
input:focus,select:focus{border-color:rgba(255,219,107,.68);box-shadow:0 0 0 3px rgba(255,219,107,.12)}
label{display:grid;gap:7px;color:var(--muted);font-size:13px}
.hidden{display:none!important}
.glass{
  background:linear-gradient(180deg,rgba(255,255,255,.095),rgba(255,255,255,.045));
  border:1px solid var(--line);box-shadow:var(--shadow);backdrop-filter:blur(16px);
}
.app-shell{width:min(1280px,calc(100vw - 32px));margin:18px auto 40px;position:relative;z-index:1}
.topbar{display:grid;grid-template-columns:290px minmax(340px,520px) 96px;gap:16px;align-items:center;margin-bottom:16px}
.brand,.top-stats,.top-exit{height:72px;border-radius:18px}
.brand{padding:16px 20px}.brand-title{font-weight:900;font-size:22px}.brand-sub{font-size:13px;color:var(--muted);margin-top:4px}
.top-stats{display:grid;grid-template-columns:1fr 1px 1fr 1px 1fr;align-items:center;text-align:center;padding:0 20px}.top-stats b{display:block;color:var(--gold);font-size:24px;line-height:1}.top-stats span{font-size:12px;color:var(--muted)}.top-stats i{height:30px;background:var(--line)}
.top-exit{background:rgba(255,255,255,.09);border:1px solid var(--line);font-weight:800}.top-exit:hover,.ghost-btn:hover{background:rgba(255,255,255,.14)}
.primary-btn{background:linear-gradient(135deg,#7c3aed,#d946ef);border-radius:15px;padding:12px 18px;font-weight:900;box-shadow:0 10px 28px rgba(168,85,247,.3)}
.primary-btn:disabled,.action-btn:disabled{opacity:.45;cursor:not-allowed;filter:grayscale(.35)}
.ghost-btn{background:rgba(255,255,255,.09);border:1px solid var(--line);border-radius:14px;padding:10px 14px;font-weight:800}.full{width:100%}
.mini-label{display:inline-flex;color:#160d24;background:var(--gold);border-radius:999px;padding:5px 10px;font-size:12px;font-weight:900}

/* lobby */
.lobby-view{display:grid;grid-template-columns:1.3fr .9fr .9fr;gap:18px;align-items:stretch}.hero-card,.entry-card{border-radius:24px;padding:24px}.hero-card h1{font-size:38px;line-height:1.08;margin:20px 0 12px}.hero-card p{color:var(--muted);line-height:1.7}.hero-rules{display:flex;gap:12px;flex-wrap:wrap;margin-top:24px}.hero-rules span{background:rgba(255,255,255,.08);border:1px solid var(--line);padding:10px 12px;border-radius:999px}.entry-card{display:grid;gap:14px}.entry-card h2{margin:0 0 4px;font-size:20px}

/* room */
.room-view{display:grid;grid-template-columns:minmax(0,1fr) 300px;gap:16px;align-items:start}.main-board{border-radius:24px;padding:16px}.room-head{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:14px;align-items:center;padding:14px 16px;border-radius:18px;background:rgba(5,8,30,.35);border:1px solid rgba(255,255,255,.08)}.room-code-box span,.room-code-box em{display:block;color:var(--muted);font-style:normal;font-size:12px}.room-code-box strong{display:block;margin:3px 0;color:var(--gold);font-size:24px;letter-spacing:2px}.self-summary{display:flex;align-items:center;gap:8px;min-height:40px;background:rgba(94,67,190,.25);border:1px solid rgba(168,85,247,.5);border-radius:999px;padding:7px 14px;font-weight:800}.banker-pill,.mini-badge,.bet-pill{display:inline-flex;align-items:center;justify-content:center;border-radius:999px;font-size:12px;font-weight:900;padding:2px 6px}.banker-pill{background:var(--gold);color:#2d1800}.mini-badge{background:rgba(255,255,255,.13);color:#fff}.mini-badge.ai{background:#54e8d2;color:#061927}.mini-badge.offline{background:#6b7280}.self-delta.win,.delta.win,.viewer.win{color:#86efac}.self-delta.lose,.delta.lose,.viewer.lose{color:#fda4af}
.status-banner{margin-top:14px;display:flex;gap:14px;align-items:center;border-radius:18px;border:1px solid rgba(255,255,255,.12);background:linear-gradient(90deg,rgba(117,79,201,.38),rgba(117,79,201,.14));padding:15px 18px}.status-banner.my-turn{box-shadow:0 0 0 1px rgba(255,219,107,.5),0 0 28px rgba(255,219,107,.15)}.status-icon{width:42px;height:42px;border-radius:50%;display:grid;place-items:center;background:rgba(255,255,255,.11)}.status-banner strong{display:block;font-size:18px}.status-banner span{display:block;color:var(--muted);font-size:13px;margin-top:3px}

.waiting-panel{margin-top:16px;border-radius:20px;background:rgba(5,8,30,.35);border:1px solid rgba(255,255,255,.08);padding:20px}.waiting-copy h2{margin:0 0 8px}.waiting-copy p{margin:0;color:var(--muted)}.waiting-players{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:12px;margin:18px 0}.wait-player{border:1px solid rgba(255,255,255,.12);background:rgba(255,255,255,.06);border-radius:16px;padding:12px}.wait-player strong{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wait-player p{margin:8px 0 0;color:var(--muted);font-size:12px}.waiting-actions{display:flex;gap:12px;justify-content:flex-end}

.game-panel{margin-top:16px}.round-stats{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-bottom:14px}.round-stats>div{background:rgba(5,8,30,.62);border:1px solid rgba(255,255,255,.08);border-radius:14px;padding:11px 13px}.round-stats span{display:block;color:var(--muted);font-size:12px}.round-stats b{display:block;font-size:17px;margin-top:3px}.table-layout{min-height:520px;position:relative;border-radius:24px;overflow:hidden;padding:18px;display:grid;grid-template-columns:230px minmax(0,1fr) 230px;gap:14px;background:radial-gradient(ellipse at center,rgba(83,65,201,.34),rgba(12,16,52,.78) 62%,rgba(8,10,34,.96));border:1px solid rgba(255,255,255,.1)}.table-layout::before,.table-layout::after{content:"";position:absolute;border:2px solid rgba(139,92,246,.25);border-radius:50%;pointer-events:none}.table-layout::before{width:88%;height:70%;left:6%;top:15%}.table-layout::after{width:56%;height:42%;left:22%;top:30%}.seat-column,.center-table{position:relative;z-index:1}.seat-column{display:flex;flex-direction:column;justify-content:center;gap:14px;min-width:0}.seat-column:empty::before{content:"";display:block}.center-table{display:grid;grid-template-rows:auto minmax(210px,1fr) 108px;gap:12px;align-items:stretch;min-width:0}.table-status{justify-self:center;min-width:min(100%,360px);text-align:center;border-radius:18px;background:rgba(5,8,30,.72);border:1px solid rgba(255,255,255,.1);padding:12px 20px}.table-status span{display:block;color:var(--muted);font-size:12px}.table-status strong{display:block;color:var(--gold);font-size:28px;line-height:1.18;margin-top:3px}.my-hand-card{align-self:center;justify-self:center;width:min(100%,560px);border-radius:22px;background:rgba(37,26,92,.72);border:1px solid rgba(168,85,247,.44);padding:18px;text-align:center}.my-hand-title{font-weight:900;color:#fff;margin-bottom:12px}.my-cards{display:flex;justify-content:center;align-items:center;gap:10px;min-height:96px}.my-hand-type{margin-top:12px;font-size:20px;font-weight:900;color:#fff}.my-hand-type.strong{color:var(--gold);text-shadow:0 0 18px rgba(255,219,107,.3)}.log-card{display:grid;grid-template-rows:auto minmax(0,1fr);border-radius:18px;background:rgba(5,8,30,.68);border:1px solid rgba(255,255,255,.1);padding:12px;min-height:0}.log-title{font-weight:900;margin-bottom:8px}.round-log{overflow:auto;display:grid;gap:6px;padding-right:4px}.round-log p{margin:0;background:rgba(255,255,255,.06);border-radius:10px;padding:7px 9px;color:#f4f1ff;font-size:13px}.round-log .muted{color:var(--muted)}

.seat-card{width:100%;border-radius:18px;background:rgba(5,8,30,.72);border:1px solid rgba(255,255,255,.11);padding:12px;box-shadow:0 10px 28px rgba(0,0,0,.25);min-width:0}.seat-card.is-banker{border-color:rgba(255,219,107,.65);box-shadow:0 0 0 1px rgba(255,219,107,.24),0 10px 28px rgba(0,0,0,.25)}.seat-card.need-action{animation:pulseGlow 1.7s ease-in-out infinite}.seat-top{display:flex;align-items:center;justify-content:space-between;gap:8px}.seat-name{display:flex;align-items:center;gap:5px;min-width:0}.seat-name b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:104px}.player-index{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;border-radius:50%;font-size:12px;background:rgba(255,255,255,.16);font-weight:900}.seat-score{white-space:nowrap;font-weight:800}.seat-meta{display:flex;align-items:center;justify-content:center;gap:8px;color:var(--muted);font-size:12px;margin:9px 0}.seat-cards{display:flex;justify-content:center;gap:5px}.seat-card-row .poker-card{width:30px;height:42px;border-radius:8px;font-size:14px}.seat-card-row .poker-card em{font-size:13px}.seat-result{font-size:12px;text-align:center;color:var(--gold);min-height:16px;margin-top:7px}

.poker-card{width:62px;height:86px;border-radius:12px;background:#f8fafc;color:#111827;display:flex;flex-direction:column;justify-content:space-between;align-items:flex-start;padding:8px 9px;font-weight:950;box-shadow:0 8px 18px rgba(0,0,0,.22),inset 0 0 0 1px rgba(0,0,0,.08);flex:0 0 auto}.poker-card.red{color:#dc143c}.poker-card.black{color:#0f172a}.poker-card b{font-size:22px;line-height:1}.poker-card em{font-style:normal;font-size:21px;align-self:flex-end}.card-back{background:linear-gradient(145deg,#163074,#071a47);color:#fff;align-items:center;justify-content:center;padding:0;box-shadow:inset 0 0 0 2px rgba(255,255,255,.18),0 8px 16px rgba(0,0,0,.25)}.card-back i{font-style:normal;border:1px solid rgba(255,255,255,.45);border-radius:50%;width:24px;height:24px;display:grid;place-items:center;color:#a5b4fc;font-weight:900}.mini-cards .poker-card{width:36px;height:50px;border-radius:9px;padding:6px;font-size:14px}.mini-cards .poker-card b{font-size:16px}.mini-cards .poker-card em{font-size:15px}
@keyframes pulseGlow{0%,100%{box-shadow:0 0 0 0 rgba(255,219,107,.26)}50%{box-shadow:0 0 0 4px rgba(255,219,107,.18),0 0 28px rgba(255,219,107,.12)}}

.side-panel{border-radius:24px;padding:14px;max-height:calc(100vh - 116px);overflow:auto}.side-section{padding:12px;border-bottom:1px solid rgba(255,255,255,.1)}.side-section:last-child{border-bottom:0}.side-title{font-weight:900;margin-bottom:12px}.with-close{display:flex;justify-content:space-between;align-items:center}.with-close button,.drawer-panel header button,.modal-close{background:rgba(255,255,255,.13);border:1px solid rgba(255,255,255,.13);border-radius:999px;padding:7px 12px;font-weight:800}.host-settings{display:grid;gap:12px}.ai-box{border:1px solid rgba(255,255,255,.1);background:rgba(255,255,255,.05);border-radius:16px;padding:12px}.ai-box div{display:flex;gap:8px;margin:9px 0}.ai-box p,.settings-tip,.rules-box p{color:var(--muted);font-size:12px;line-height:1.5}.history-list{display:grid;gap:10px}.history-empty{color:var(--muted);padding:12px;border-radius:14px;background:rgba(255,255,255,.05)}.history-item{background:rgba(5,8,30,.56);border:1px solid rgba(255,255,255,.09);border-radius:16px;padding:12px}.history-item header{display:flex;justify-content:space-between;gap:8px}.history-item p{margin:8px 0 0;color:#fff;line-height:1.45}.history-actions{display:flex;align-items:center;justify-content:space-between;margin-top:10px}.viewer{font-size:12px;font-weight:900;padding:3px 8px;border-radius:999px;background:rgba(255,255,255,.1)}

.action-panel{grid-column:1/2;margin-top:14px;border-radius:22px;padding:12px;display:grid;grid-template-columns:minmax(0,1fr) 190px 160px 160px 160px;gap:10px;align-items:center}.action-info{background:rgba(255,255,255,.06);border:1px solid rgba(255,255,255,.1);border-radius:16px;padding:12px 14px;min-width:0}.action-info strong{display:block;color:var(--gold);font-size:18px}.action-info span{display:block;color:var(--muted);font-size:12px;margin-top:3px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.bet-control label{font-size:12px}.bet-control select{padding:10px 12px}.action-btn{height:54px;border-radius:16px;font-size:20px;font-weight:950;background:linear-gradient(135deg,#7c3aed,#c026d3);box-shadow:0 10px 26px rgba(124,58,237,.3)}.action-next{height:54px}.action-panel .hidden{display:none!important}.room-view:has(.action-next.hidden) .action-panel{grid-template-columns:minmax(0,1fr) 190px 160px 160px}.room-view:has(#betControl.hidden) .action-panel{grid-template-columns:minmax(0,1fr) 160px 160px 160px}.room-view:has(#betBtn.hidden):has(#revealBtn.hidden) .action-panel{grid-template-columns:minmax(0,1fr) 160px}

.mobile-menu-btn,.mobile-menu-list{display:none}

.drawer,.modal,.confirm-dialog{position:fixed;inset:0;z-index:200}.drawer-backdrop,.modal-backdrop,.confirm-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.46)}.drawer-panel{position:absolute;right:18px;top:18px;bottom:18px;width:min(420px,calc(100vw - 36px));border-radius:22px;padding:16px;display:grid;grid-template-rows:auto minmax(0,1fr) auto}.drawer-panel header,.drawer-panel footer{display:flex;align-items:center;justify-content:space-between;gap:10px}.chat-messages{overflow:auto;display:grid;align-content:start;gap:10px;padding:12px 2px}.chat-message{max-width:88%;background:rgba(255,255,255,.08);border-radius:16px;padding:10px}.chat-message.mine{justify-self:end;background:rgba(124,58,237,.32)}.chat-message div{display:flex;gap:8px;color:var(--muted);font-size:12px}.chat-message p{margin:6px 0 0}.chat-panel footer input{flex:1}.history-panel .history-list{overflow:auto;padding-right:4px}
.modal-panel{position:relative;margin:36px auto;max-width:min(860px,calc(100vw - 28px));max-height:calc(100vh - 72px);overflow:auto;border-radius:24px;padding:22px}.modal-close{position:absolute;right:16px;top:16px}.modal-kicker{color:var(--gold);font-weight:900}.modal-panel h2{margin:8px 0 6px;font-size:28px}.modal-panel p{color:var(--muted);line-height:1.55}.result-players{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:12px;margin:16px 0}.result-row{border-radius:18px;padding:12px;background:rgba(5,8,30,.58);border:1px solid rgba(255,255,255,.1)}.result-row.is-banker{border-color:rgba(255,219,107,.54)}.result-row-top{display:flex;align-items:center;justify-content:space-between;gap:8px}.result-row-name{display:flex;align-items:center;gap:6px;min-width:0}.result-row-name b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.result-cards{display:flex;gap:6px;justify-content:center;margin:10px 0}.result-cards .poker-card{width:42px;height:58px;border-radius:9px;padding:6px}.result-cards .poker-card b{font-size:17px}.result-cards .poker-card em{font-size:16px}.result-row-bottom{display:flex;justify-content:space-between;gap:8px;color:var(--muted);font-size:13px}.replay-body{background:rgba(5,8,30,.54);border:1px solid rgba(255,255,255,.1);border-radius:18px;padding:14px;margin:12px 0}.replay-steps{display:flex;gap:8px;overflow:auto;padding-bottom:6px}.replay-step{min-width:86px;border-radius:12px;padding:8px 10px;background:rgba(255,255,255,.08);border:1px solid transparent;color:var(--muted);text-align:center}.replay-step.active{border-color:rgba(255,219,107,.7);color:#fff;background:rgba(255,219,107,.13)}.replay-actions{display:flex;justify-content:center;gap:10px;margin-top:12px}.confirm-panel{position:relative;margin:18vh auto 0;width:min(420px,calc(100vw - 32px));border-radius:22px;padding:22px}.confirm-panel h3{margin:0 0 8px}.confirm-panel p{color:var(--muted)}.confirm-panel div{display:flex;justify-content:flex-end;gap:10px;margin-top:18px}.toast-root{position:fixed;right:18px;top:18px;z-index:500;display:grid;gap:10px}.toast{border-radius:14px;padding:12px 14px;background:rgba(20,23,50,.95);border:1px solid rgba(255,255,255,.14);box-shadow:0 14px 40px rgba(0,0,0,.35);font-weight:800}.toast.success{border-color:rgba(74,222,128,.5)}.toast.error{border-color:rgba(251,113,133,.5)}

@media (max-width:1180px){
  .app-shell{width:min(100vw - 24px,1120px)}.topbar{grid-template-columns:260px 1fr 84px}.room-view{grid-template-columns:minmax(0,1fr) 280px}.table-layout{grid-template-columns:205px minmax(0,1fr) 205px}.poker-card{width:56px;height:78px}.my-hand-card{width:min(100%,500px)}.action-panel{grid-template-columns:minmax(0,1fr) 170px 145px 145px 145px}
}
@media (max-width:920px){
  .topbar{grid-template-columns:1fr;gap:10px}.brand,.top-stats,.top-exit{height:auto;min-height:58px}.top-exit{width:100%}.lobby-view{grid-template-columns:1fr}.room-view{display:block}.side-panel{display:none}.action-panel{grid-column:auto}.table-layout{grid-template-columns:1fr;min-height:0}.seat-column{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));justify-content:stretch}.center-table{grid-row:auto;grid-template-rows:auto auto 120px;order:2}.seat-column:first-child{order:1}.seat-column:last-child{order:3}.round-stats{grid-template-columns:repeat(2,1fr)}.seat-card{max-width:none}.action-panel{grid-template-columns:1fr 150px 130px 130px;}.action-next{grid-column:auto}
}
@media (max-width:640px){
  body{padding-bottom:112px}.app-shell{width:calc(100vw - 16px);margin:8px auto 18px}.topbar{margin-bottom:8px}.brand{padding:12px 14px}.brand-title{font-size:18px}.top-stats{grid-template-columns:1fr 1px 1fr 1px 1fr;padding:10px 12px}.top-stats b{font-size:19px}.lobby-view{gap:10px}.hero-card,.entry-card{padding:16px;border-radius:18px}.hero-card h1{font-size:28px}.room-head{grid-template-columns:1fr;gap:10px;padding:12px}.self-summary{justify-content:center;border-radius:14px}.main-board{padding:10px;border-radius:18px}.status-banner{padding:12px;border-radius:16px}.status-banner strong{font-size:16px}.round-stats{grid-template-columns:repeat(2,1fr);gap:8px}.round-stats>div{padding:9px}.table-layout{padding:10px;border-radius:18px;gap:10px}.center-table{grid-template-rows:auto auto 102px}.table-status strong{font-size:22px}.my-hand-card{padding:12px}.my-cards{gap:5px;min-height:74px}.poker-card{width:47px;height:66px;border-radius:10px;padding:6px}.poker-card b{font-size:17px}.poker-card em{font-size:16px}.my-hand-type{font-size:18px}.seat-column{grid-template-columns:1fr 1fr;gap:8px}.seat-card{padding:9px;border-radius:14px}.seat-name b{max-width:72px}.seat-score{font-size:12px}.seat-meta{font-size:11px;margin:6px 0}.seat-card-row .poker-card{width:25px;height:36px;border-radius:6px;padding:4px}.seat-card-row .poker-card b{font-size:12px}.seat-card-row .poker-card em{font-size:11px}.round-log p{font-size:12px;padding:6px 8px}.waiting-actions{flex-direction:column}.action-panel{position:fixed;left:8px;right:8px;bottom:8px;z-index:120;margin:0;border-radius:18px;padding:9px;display:grid;grid-template-columns:1fr 112px;gap:8px}.action-info{grid-column:1/2;grid-row:1/3;padding:10px}.action-info strong{font-size:15px}.action-info span{white-space:normal;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.bet-control{grid-column:2}.bet-control label{font-size:11px}.bet-control select{padding:8px 9px;border-radius:11px}.action-btn,.action-next{grid-column:2;height:46px;font-size:17px;border-radius:13px}.action-panel #revealBtn:not(.hidden)+#nextRoundBtn{} .mobile-menu-btn{display:block;position:fixed;right:12px;bottom:116px;z-index:150;background:linear-gradient(135deg,#f59e0b,#fbbf24);color:#371500;border-radius:999px;padding:12px 15px;font-weight:950;box-shadow:0 14px 36px rgba(0,0,0,.3)}.mobile-menu-list{display:flex;position:fixed;right:12px;bottom:166px;z-index:151;flex-direction:column;gap:8px}.mobile-menu-list button{background:rgba(31,25,70,.96);border:1px solid rgba(255,255,255,.18);border-radius:14px;padding:10px 14px;font-weight:900;box-shadow:0 10px 28px rgba(0,0,0,.28)}.side-panel{display:block;position:fixed;z-index:160;right:8px;top:8px;bottom:8px;width:min(360px,calc(100vw - 16px));transform:translateX(calc(100% + 16px));transition:transform .18s ease;border-radius:18px;max-height:none}.room-view.settings-open .side-panel{transform:translateX(0)}.drawer-panel{right:8px;left:8px;top:8px;bottom:8px;width:auto;border-radius:18px}.modal-panel{margin:12px auto;max-height:calc(100vh - 24px);padding:18px;border-radius:18px}.result-players{grid-template-columns:1fr}.toast-root{top:10px;right:10px;left:10px}.toast{width:100%;text-align:center}.history-list{max-height:none}
}

/* v11 compact header + card scale fixes */
.topbar{grid-template-columns:minmax(240px,340px) minmax(300px,520px)}
body.in-room .topbar{display:none}
.room-head{grid-template-columns:minmax(0,1fr) auto auto auto;gap:10px;padding:12px 14px}
.room-code-box{min-width:0}
.room-code-box strong{font-size:22px;margin:2px 0}
.room-code-box em{max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.room-exit{min-width:72px;text-align:center}
.status-banner{margin-top:10px;padding:11px 14px;border-radius:16px}
.status-icon{width:34px;height:34px;font-size:16px}
.status-banner strong{font-size:16px}
.status-banner span{font-size:12px}
.game-panel{margin-top:10px}
.round-stats{display:none!important}
.table-layout{min-height:470px;margin-top:0;padding:16px}
.center-table{grid-template-rows:minmax(220px,1fr) 92px;gap:10px}
.table-status{display:none!important}
.my-hand-card{width:min(100%,520px);padding:16px}
.my-cards{min-height:88px}
.log-card{min-height:92px;padding:10px}
.round-log p{font-size:12px;padding:6px 8px}
.seat-card{padding:10px;border-radius:16px}
.seat-meta{margin:7px 0;font-size:11px}
.seat-card-row .poker-card{width:32px;height:46px;border-radius:7px;padding:4px 5px;font-size:10px}
.seat-card-row .poker-card b{font-size:11px;line-height:1}
.seat-card-row .poker-card em{font-size:10px;line-height:1}
.seat-card-row .card-back i{width:18px;height:18px;font-size:10px}
.result-cards .poker-card{width:40px;height:56px;padding:5px}
.result-cards .poker-card b{font-size:14px}
.result-cards .poker-card em{font-size:13px}

@media (max-width:1180px){
  .topbar{grid-template-columns:minmax(220px,320px) minmax(280px,1fr)}
  .room-head{grid-template-columns:minmax(0,1fr) auto auto auto}
  .table-layout{grid-template-columns:200px minmax(0,1fr) 200px;min-height:455px}
}
@media (max-width:920px){
  body.in-room .topbar{display:none}
  .room-head{grid-template-columns:1fr auto;align-items:stretch}
  .room-code-box,.self-summary{grid-column:1/-1}
  .room-exit,.room-head #copyRoomBtn{width:100%}
  .center-table{grid-template-rows:auto 96px;order:2}
  .table-status{display:none!important}
}
@media (max-width:640px){
  body.in-room .topbar{display:none}
  .room-head{grid-template-columns:1fr 1fr;gap:8px;padding:10px}
  .room-code-box,.self-summary{grid-column:1/-1}
  .room-head #copyRoomBtn,.room-exit{grid-column:auto;width:100%}
  .status-banner{padding:10px 12px;gap:10px}
  .table-layout{padding:9px;min-height:0}
  .center-table{grid-template-rows:auto 88px;gap:8px}
  .my-hand-card{padding:10px;border-radius:16px}
  .my-cards{min-height:68px}
  .seat-card-row .poker-card{width:24px;height:34px;border-radius:6px;padding:3px 4px}
  .seat-card-row .poker-card b{font-size:9px}
  .seat-card-row .poker-card em{font-size:8px}
  .seat-card-row .card-back i{width:15px;height:15px;font-size:8px}
}

/* v12: 独立手机端布局修复，避免桌面牌桌被硬塞进窄屏 */
@media (max-width:640px){
  html,body{overflow-x:hidden}
  body.in-room{padding-bottom:150px}
  .app-shell{width:100%;max-width:100%;margin:0 auto 14px;padding:8px}
  .room-view{display:block;width:100%}
  .main-board{padding:8px;border-radius:16px;overflow:visible}
  .room-head{grid-template-columns:1fr 1fr;gap:8px;padding:10px;border-radius:16px}
  .room-code-box,.self-summary{grid-column:1/-1}
  .room-code-box strong{font-size:20px;letter-spacing:1.5px}
  .room-code-box em{white-space:normal;line-height:1.35}
  .self-summary{justify-content:center;border-radius:14px;min-height:36px;padding:7px 10px;font-size:14px}
  .room-head #copyRoomBtn,.room-exit{grid-column:auto;width:100%;padding:10px 8px;border-radius:13px}
  .status-banner{margin-top:9px;padding:10px 12px;gap:9px;border-radius:15px}
  .status-icon{width:32px;height:32px;flex:0 0 32px}
  .status-banner strong{font-size:15px}
  .status-banner span{font-size:12px;line-height:1.35}
  .game-panel{margin-top:9px}

  .table-layout{
    display:flex!important;
    flex-direction:column;
    gap:9px;
    min-height:0!important;
    padding:9px;
    border-radius:16px;
    overflow:visible;
  }
  .table-layout::before{width:112%;height:260px;left:-6%;top:78px;opacity:.75}
  .table-layout::after{display:none}
  .center-table{
    order:1!important;
    display:flex!important;
    flex-direction:column;
    gap:8px;
    min-width:0;
  }
  .table-status{display:none!important}
  .my-hand-card{
    order:1;
    width:100%;
    padding:12px 10px;
    border-radius:16px;
    align-self:stretch;
  }
  .my-hand-title{font-size:14px;margin-bottom:8px}
  .my-cards{gap:6px;min-height:68px;flex-wrap:nowrap;overflow:visible}
  .my-cards .poker-card{width:48px;height:66px;border-radius:10px;padding:6px;flex:0 0 auto}
  .my-cards .poker-card b{font-size:16px;line-height:1}
  .my-cards .poker-card em{font-size:15px;line-height:1}
  .my-hand-type{font-size:16px;margin-top:8px}
  .log-card{order:3;min-height:74px;max-height:92px;padding:8px;border-radius:14px}
  .log-title{font-size:13px;margin-bottom:5px}
  .round-log{max-height:58px;overflow:auto;gap:5px}
  .round-log p{font-size:11px;line-height:1.35;padding:5px 7px;border-radius:8px}

  .seat-column{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:8px;
    justify-content:stretch;
    min-width:0;
  }
  #leftSeats{order:2!important}
  #rightSeats{order:3!important}
  .seat-card{padding:8px;border-radius:14px;min-height:106px;max-width:none;overflow:hidden}
  .seat-top{align-items:flex-start;gap:5px}
  .seat-name{gap:4px;min-width:0;flex-wrap:nowrap}
  .player-index{width:18px;height:18px;font-size:11px;flex:0 0 18px}
  .seat-name b{max-width:54px;font-size:13px;line-height:18px}
  .seat-score{font-size:12px;line-height:18px}
  .mini-badge,.banker-pill,.bet-pill{font-size:10px;padding:1px 4px}
  .seat-meta{display:grid;grid-template-columns:1fr 1fr;gap:2px 4px;margin:6px 0 7px;font-size:10px;line-height:1.25;text-align:center}
  .seat-cards,.seat-card-row{gap:3px;justify-content:center;min-width:0}
  .seat-card-row .poker-card{width:24px;height:33px;border-radius:6px;padding:3px;flex:0 0 auto}
  .seat-card-row .poker-card b{font-size:8.5px;line-height:1}
  .seat-card-row .poker-card em{font-size:8px;line-height:1}
  .seat-card-row .card-back i{width:14px;height:14px;font-size:8px}
  .seat-result{font-size:10px;min-height:12px;margin-top:4px}

  .action-panel{
    position:fixed;
    left:8px;right:8px;bottom:8px;
    z-index:120;
    margin:0;
    border-radius:17px;
    padding:9px;
    display:grid;
    grid-template-columns:minmax(0,1fr) minmax(108px,128px);
    grid-template-areas:"info info" "bet act";
    gap:8px;
    align-items:end;
  }
  .action-info{grid-area:info;padding:9px 10px;border-radius:14px;min-width:0}
  .action-info strong{font-size:15px;line-height:1.15}
  .action-info span{font-size:11px;line-height:1.35;white-space:normal;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
  .bet-control{grid-area:bet;min-width:0}
  .bet-control label{gap:4px;font-size:11px;white-space:nowrap}
  .bet-control select{height:42px;padding:8px 10px;border-radius:12px}
  #betBtn,#revealBtn,#nextRoundBtn{grid-area:act;width:100%;min-width:0}
  .action-btn,.action-next{height:42px;font-size:16px;border-radius:13px;padding:0 10px}
  .mobile-menu-btn{display:block;position:fixed;right:14px;bottom:158px;z-index:150;background:linear-gradient(135deg,#f59e0b,#fbbf24);color:#371500;border-radius:999px;padding:11px 14px;font-size:14px;font-weight:950;box-shadow:0 14px 36px rgba(0,0,0,.3)}
  .mobile-menu-list{display:flex;position:fixed;right:14px;bottom:207px;z-index:151;flex-direction:column;gap:8px}
  .mobile-menu-list button{background:rgba(31,25,70,.96);border:1px solid rgba(255,255,255,.18);border-radius:14px;padding:10px 14px;font-size:14px;font-weight:900;box-shadow:0 10px 28px rgba(0,0,0,.28)}
}

@media (max-width:370px){
  .my-cards{gap:4px}
  .my-cards .poker-card{width:43px;height:60px;border-radius:9px;padding:5px}
  .my-cards .poker-card b{font-size:15px}
  .my-cards .poker-card em{font-size:14px}
  .seat-column{gap:7px}
  .seat-card{padding:7px}
  .seat-name b{max-width:46px;font-size:12px}
  .seat-card-row .poker-card{width:22px;height:31px;padding:3px 2px}
  .action-panel{grid-template-columns:minmax(0,1fr) 104px}
}

/* v13: 状态合并到底部操作栏 + 手机端操作区重排 + 结算遮罩加深 */
/* 顶部状态提示与底部 action-info 内容重复，统一只保留底部操作栏状态 */
.status-banner{display:none!important}
.game-panel{margin-top:12px}

/* 结算弹窗背景加深，避免牌桌内容透出来干扰阅读 */
#resultModal .modal-backdrop{background:rgba(0,0,0,.8)!important}
#resultModal .modal-panel{background:rgba(25,28,60,.88)!important}

@media (max-width:640px){
  body.in-room{padding-bottom:104px!important}
  .game-panel{margin-top:8px!important}
  .table-layout{margin-top:8px!important}

  /* 底部操作栏改为一行：状态 / 下拉框 / 操作按钮，避免下拉框和按钮重叠 */
  .action-panel{
    position:fixed!important;
    left:8px!important;
    right:8px!important;
    bottom:8px!important;
    z-index:120!important;
    margin:0!important;
    min-height:72px!important;
    padding:8px!important;
    border-radius:17px!important;
    display:grid!important;
    grid-template-columns:minmax(0,1fr) minmax(112px,126px) minmax(86px,104px)!important;
    grid-template-areas:"info bet act"!important;
    gap:7px!important;
    align-items:stretch!important;
  }
  .action-info{
    grid-area:info!important;
    min-width:0!important;
    padding:8px 9px!important;
    border-radius:13px!important;
    align-self:stretch!important;
    display:flex!important;
    flex-direction:column!important;
    justify-content:center!important;
  }
  .action-info strong{font-size:14px!important;line-height:1.15!important}
  .action-info span{font-size:11px!important;line-height:1.25!important;margin-top:3px!important;-webkit-line-clamp:2!important;overflow:hidden!important}
  .bet-control{
    grid-area:bet!important;
    min-width:0!important;
    align-self:stretch!important;
  }
  .bet-control label{
    height:100%!important;
    display:flex!important;
    flex-direction:column!important;
    justify-content:center!important;
    gap:3px!important;
    font-size:10px!important;
    white-space:nowrap!important;
    min-width:0!important;
  }
  .bet-control select{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    height:38px!important;
    padding:6px 8px!important;
    border-radius:11px!important;
    font-size:13px!important;
  }
  #betBtn,#revealBtn,#nextRoundBtn{
    grid-area:act!important;
    width:100%!important;
    min-width:0!important;
    align-self:stretch!important;
  }
  .action-btn,.action-next{
    height:100%!important;
    min-height:52px!important;
    padding:0 8px!important;
    border-radius:13px!important;
    font-size:16px!important;
    white-space:nowrap!important;
  }

  /* 非下注阶段没有下拉框时，按钮自动靠右，不留下空列 */
  .action-panel:has(#betControl.hidden){
    grid-template-columns:minmax(0,1fr) minmax(92px,110px)!important;
    grid-template-areas:"info act"!important;
  }
  .action-panel:has(#betBtn.hidden):has(#revealBtn.hidden):has(#nextRoundBtn.hidden){
    grid-template-columns:1fr!important;
    grid-template-areas:"info"!important;
  }

  /* 菜单固定靠右竖排，抬到操作栏上方，不挡下注/开牌 */
  .mobile-menu-btn{right:12px!important;bottom:94px!important;z-index:150!important}
  .mobile-menu-list{right:12px!important;bottom:142px!important;z-index:151!important;flex-direction:column!important}
}

@media (max-width:370px){
  .action-panel{
    grid-template-columns:minmax(0,1fr) minmax(96px,108px) minmax(78px,92px)!important;
    gap:6px!important;
  }
  .action-info strong{font-size:13px!important}
  .action-info span{font-size:10px!important}
  .bet-control select{font-size:12px!important;padding-left:6px!important;padding-right:6px!important}
  .action-btn,.action-next{font-size:15px!important;padding:0 6px!important}
}

/* v14: 历史固定高度 + 详情替代回放 + 手机底部操作栏上移 */
.side-panel .history-list{gap:9px}
.side-panel .history-item{
  height:158px;
  min-height:158px;
  overflow:hidden;
  display:flex;
  flex-direction:column;
}
.side-panel .history-item header{flex:0 0 auto}
.side-panel .history-banker{
  flex:0 0 auto;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.side-panel .history-summary{
  flex:1 1 auto;
  display:-webkit-box;
  -webkit-line-clamp:3;
  -webkit-box-orient:vertical;
  overflow:hidden;
  text-overflow:ellipsis;
}
.side-panel .history-actions{flex:0 0 auto;margin-top:8px}
.side-panel .history-actions .ghost-btn{padding:7px 12px}
.full-history .history-item{cursor:default}
.full-history .history-summary{
  display:-webkit-box;
  -webkit-line-clamp:4;
  -webkit-box-orient:vertical;
  overflow:hidden;
}
.replay-panel .replay-steps,
.replay-panel .replay-actions{display:none!important}
.history-detail-head{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:10px;
  margin:8px 0 12px;
}
.history-detail-head>div{
  background:rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.1);
  border-radius:14px;
  padding:10px 12px;
  min-width:0;
}
.history-detail-head span{display:block;color:var(--muted);font-size:12px;margin-bottom:4px}
.history-detail-head b{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.history-detail-summary{
  margin:10px 0 0!important;
  padding:10px 12px;
  border-radius:14px;
  background:rgba(255,219,107,.08);
  border:1px solid rgba(255,219,107,.18);
  color:#fff!important;
}
.history-detail-players{margin-top:12px!important}
.history-detail-players .result-row-bottom{grid-template-columns:1fr auto auto;display:grid;align-items:center}

@media (max-width:640px){
  body.in-room{padding-bottom:124px!important}
  .action-panel{bottom:24px!important}
  .mobile-menu-btn{bottom:112px!important}
  .mobile-menu-list{bottom:160px!important}
  .side-panel .history-item{height:142px;min-height:142px}
  .side-panel .history-summary{-webkit-line-clamp:2}
  .history-detail-head{grid-template-columns:1fr;gap:8px}
  .history-detail-summary{font-size:13px;line-height:1.45}
  .history-detail-players .result-row-bottom{grid-template-columns:1fr;gap:4px}
}

/* v15: 底部操作栏贴底 + 历史卡片单条不拉伸 */
@media (max-width:640px){
  body.in-room{
    padding-bottom:calc(104px + env(safe-area-inset-bottom, 0px))!important;
  }
  .action-panel{
    position:fixed!important;
    left:6px!important;
    right:6px!important;
    bottom:env(safe-area-inset-bottom, 0px)!important;
    z-index:120!important;
    border-radius:17px 17px 0 0!important;
    margin:0!important;
  }
  .mobile-menu-btn{
    bottom:calc(88px + env(safe-area-inset-bottom, 0px))!important;
  }
  .mobile-menu-list{
    bottom:calc(136px + env(safe-area-inset-bottom, 0px))!important;
  }
}

/* 历史列表不要因为只有一条记录就被 grid/stretch 拉满 */
.history-list,
.side-panel .history-list,
.history-panel .history-list,
.full-history{
  align-content:start!important;
  align-items:start!important;
  grid-auto-rows:max-content!important;
}
.history-item{
  align-self:start!important;
}
.side-panel .history-item{
  height:148px!important;
  min-height:148px!important;
  max-height:148px!important;
}
.full-history .history-item,
.history-panel .history-item{
  height:152px!important;
  min-height:152px!important;
  max-height:152px!important;
  overflow:hidden!important;
}
.full-history .history-summary,
.history-panel .history-summary{
  display:-webkit-box!important;
  -webkit-line-clamp:3!important;
  -webkit-box-orient:vertical!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
}
.history-list:has(.history-item:only-child){
  grid-template-rows:max-content!important;
}
@media (max-width:640px){
  .side-panel .history-item,
  .full-history .history-item,
  .history-panel .history-item{
    height:136px!important;
    min-height:136px!important;
    max-height:136px!important;
  }
}


/* v16: 右侧历史只展示一条 + 电脑端底部操作栏固定 */
body.in-room{
  padding-bottom:104px;
}
body.in-room .action-panel{
  position:fixed;
  z-index:130;
  bottom:14px;
  margin:0;
  width:min(964px, calc(100vw - 348px));
  left:max(16px, calc((100vw - 1280px) / 2));
  box-shadow:0 18px 56px rgba(0,0,0,.34), inset 0 1px 0 rgba(255,255,255,.08);
  backdrop-filter:blur(18px);
}
.side-panel #sideHistoryList{
  max-height:158px;
  overflow:hidden;
}
.side-panel #sideHistoryList .history-item:nth-child(n+2){
  display:none!important;
}

@media (max-width:1180px) and (min-width:921px){
  body.in-room .action-panel{
    left:12px;
    width:calc(100vw - 324px);
  }
}

@media (max-width:920px) and (min-width:641px){
  body.in-room{padding-bottom:112px;}
  body.in-room .action-panel{
    left:12px;
    right:12px;
    width:auto;
    bottom:12px;
  }
}

@media (max-width:640px){
  body.in-room{
    padding-bottom:calc(104px + env(safe-area-inset-bottom, 0px))!important;
  }
  body.in-room .action-panel{
    left:6px!important;
    right:6px!important;
    width:auto!important;
    bottom:env(safe-area-inset-bottom, 0px)!important;
  }
  .side-panel #sideHistoryList{
    max-height:146px;
  }
}

/* v17: 牌局记录加高 + 完整历史详情按钮固定可见 */
.center-table{
  grid-template-rows:auto minmax(190px,1fr) 148px!important;
}
.log-card{
  min-height:148px!important;
}
.round-log{
  max-height:104px;
}

/* 完整历史弹窗里的卡片：摘要负责省略，底部详情按钮始终露出 */
.history-panel .history-list.full-history,
.full-history{
  display:grid!important;
  gap:10px!important;
  align-content:start!important;
  align-items:start!important;
  grid-auto-rows:max-content!important;
}
.full-history .history-item,
.history-panel .history-item{
  height:156px!important;
  min-height:156px!important;
  max-height:156px!important;
  overflow:hidden!important;
  display:grid!important;
  grid-template-rows:auto auto minmax(0,1fr) auto!important;
  gap:6px!important;
  padding:12px!important;
}
.full-history .history-item header,
.history-panel .history-item header{
  min-height:22px!important;
}
.full-history .history-banker,
.history-panel .history-banker{
  margin:0!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
}
.full-history .history-summary,
.history-panel .history-summary{
  margin:0!important;
  min-height:0!important;
  line-height:1.38!important;
  display:-webkit-box!important;
  -webkit-line-clamp:2!important;
  -webkit-box-orient:vertical!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
}
.full-history .history-actions,
.history-panel .history-actions{
  margin-top:0!important;
  display:flex!important;
  align-items:center!important;
  justify-content:space-between!important;
  gap:8px!important;
}
.full-history .history-detail-btn,
.history-panel .history-detail-btn{
  flex:0 0 auto!important;
  padding:7px 12px!important;
}

@media (max-width:640px){
  .center-table{
    grid-template-rows:auto auto 118px!important;
  }
  .log-card{
    min-height:96px!important;
    max-height:118px!important;
  }
  .round-log{
    max-height:82px!important;
  }
  .full-history .history-item,
  .history-panel .history-item{
    height:148px!important;
    min-height:148px!important;
    max-height:148px!important;
    padding:10px!important;
  }
  .full-history .history-summary,
  .history-panel .history-summary{
    -webkit-line-clamp:2!important;
    font-size:13px!important;
  }
}
