:root{color-scheme:dark;--bg:#141414;--fg:#f8f2df;--muted:#d8e6e6;--gold:#ffd76a;--line:#ffffff22;--red:#d33b45;--orange:#f46b2a;--green:#19c647;font-family:system-ui,-apple-system,"Noto Sans SC",sans-serif}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--fg);min-height:100dvh}button,input,textarea{font:inherit}button{cursor:pointer;border:1px solid var(--line);color:var(--fg);background:#ffffff0d;border-radius:10px;padding:10px 13px;font-weight:650;touch-action:manipulation}button:active{transform:translateY(1px)}button:disabled{opacity:.35;cursor:default}button.primary{background:var(--gold);color:#292315;border-color:var(--gold)}button.secondary{background:#295047;border-color:#426359}button.minor{padding:5px 10px;font-size:12px;background:transparent}.full{width:100%;margin-top:9px}small{font-size:12px;font-weight:400;opacity:.7;float:right}input,textarea{border:1px solid var(--line);background:#091e1a;color:var(--fg);border-radius:9px;padding:11px;min-width:0}textarea{width:100%;min-height:68px;margin-top:8px;resize:vertical;font-size:12px}[hidden]{display:none!important}
.lobby{max-width:520px;margin:auto;padding:24px 22px 20px}.brand{display:flex;justify-content:space-between;font-size:11px;letter-spacing:.12em;color:#c9d8d5}.brand span:first-child{color:var(--gold);font-size:18px}.welcome{margin-top:32px}.eyebrow{font-size:12px;letter-spacing:.15em;color:var(--gold)}h1{font-size:84px;line-height:1;margin:8px 0 16px;letter-spacing:-.09em;font-weight:950}h1 span{color:var(--gold)}.intro{font-size:17px;line-height:1.6;color:#c8d6cb}.panel{border-top:1px solid var(--line);padding-top:16px}.panel label{display:block;font-size:12px;color:#cfd8d6;margin:12px 0 8px}.options{display:flex;gap:7px}.options button{flex:1;font-size:13px}.options .chosen{border-color:var(--gold);color:var(--gold);background:#f0c87814}.join{display:flex;gap:8px;margin-top:9px}.join input{flex:1;text-transform:uppercase}.network{padding:12px 0;font-size:13px;color:var(--gold)}.room{display:flex;align-items:center;gap:12px;margin:8px 0}.room strong{font-size:26px;letter-spacing:.18em}details{margin-top:15px;font-size:13px;color:#cfd8d6}details summary{cursor:pointer}details p{line-height:1.5}.fine,footer{font-size:11px;color:#bfc8c6;text-align:center}.fine{margin:16px 0 0}footer{margin:24px 0 0}

#table{max-width:1360px;margin:0 auto;position:relative;padding:18px 18px 10px}.top{position:absolute;left:18px;right:18px;top:18px;display:flex;justify-content:space-between;align-items:flex-start;pointer-events:none;z-index:10}.top>*{pointer-events:auto}.brandmini{padding:10px 14px;background:#ffffff2a;border-radius:16px;backdrop-filter:blur(10px);box-shadow:0 6px 16px #0002;color:#154174}.brandmini b{font-size:22px}.muted{display:block;font-size:12px;color:#204e73;margin-top:2px}.scorepack{display:flex;align-items:flex-start;gap:12px}.roundbadge,.teamdisk,.levelbadge,.exitbtn{box-shadow:0 5px 16px #0003}.roundbadge{background:#fff0b9;color:#9c6b12;border:4px solid #e4bb42;border-radius:26px;padding:8px 12px;display:flex;flex-direction:column;align-items:center;min-width:72px}.roundbadge span{font-size:12px}.roundbadge strong{font-size:20px}.teamdisk{width:86px;height:86px;border-radius:50%;display:flex;flex-direction:column;align-items:center;justify-content:center;background:#fff7ff;border:5px solid #7ebdf3;position:relative}.teamdisk.theirs{border-color:#f2b0c1}.disklabel{position:absolute;bottom:-24px;font-size:12px;font-weight:800}.ours .disklabel{color:#4a9ef0}.theirs .disklabel{color:#f36d7f}.teamdisk strong{font-size:42px;line-height:1;color:#4a9ef0}.teamdisk.theirs strong{color:#f296a6}.levelbadge{background:#ffffffb8;color:#255089;padding:12px 18px;border-radius:18px;min-width:96px;text-align:center;font-weight:900}.exitbtn{background:linear-gradient(180deg,#ff5656,#f01c1c);color:#fff;border:3px solid #b90808;border-radius:18px;padding:16px 26px;font-size:22px;font-weight:900}
.felt{height:min(76dvh,980px);min-height:760px;position:relative;isolation:isolate;overflow:hidden;border-radius:28px;background:linear-gradient(180deg,#0d4a71 0%,#1aa5bf 28%,#44d2d0 52%,#6acb74 73%,#3f8e34 100%);box-shadow:0 16px 40px #0007}.felt::before{content:"";position:absolute;inset:0;background:radial-gradient(circle at 14% 22%,#fff2a277 0 5%,transparent 18%),radial-gradient(circle at 21% 14%,#ffdf7e44 0 6%,transparent 22%),radial-gradient(circle at 85% 17%,#fff4cc55 0 3%,transparent 15%),radial-gradient(circle at 25% 80%,#78b532aa 0 12%,transparent 28%),radial-gradient(circle at 78% 84%,#5cae34aa 0 10%,transparent 23%),linear-gradient(145deg,transparent 35%,#2b7a2b55 42%,transparent 48%,transparent 61%,#f1cc5540 68%,transparent 72%),repeating-linear-gradient(12deg,#ffffff10 0 6px,transparent 6px 18px,#e2bf5330 18px 23px,transparent 23px 35px);mix-blend-mode:screen;opacity:.6}.felt::after{content:"";position:absolute;left:-8%;right:-8%;bottom:-2%;height:46%;background:radial-gradient(ellipse at 18% 72%,#4cae37 0 18%,transparent 19%),radial-gradient(ellipse at 38% 68%,#5ab23c 0 14%,transparent 15%),radial-gradient(ellipse at 72% 74%,#47a133 0 17%,transparent 18%),radial-gradient(ellipse at 88% 68%,#519c39 0 10%,transparent 11%),linear-gradient(180deg,transparent 0,#6ed05c11 25%,#53a43d77 100%);filter:blur(1px)}
.seat{position:absolute;display:flex;flex-direction:column;gap:8px;z-index:2;font-size:12px}.seat.north{top:76px;left:50%;transform:translateX(-50%);width:300px}.seat.west{left:30px;top:48%;transform:translateY(-50%);width:260px}.seat.east{right:30px;top:48%;transform:translateY(-50%);width:260px}.seat.south{display:none}.seatpanel{background:#ffffffcc;color:#17385b;border-radius:20px;padding:14px 16px 12px;box-shadow:0 10px 20px #0002}.panelhead{display:flex;align-items:flex-start;gap:12px}.avatar{background:linear-gradient(180deg,#9fd8ff,#6eb8f7);color:#134576;border:2px solid #ffffff;border-radius:50%;width:44px;height:44px;display:grid;place-items:center;font-size:18px;font-weight:800;flex:none}.enemy .avatar{background:linear-gradient(180deg,#ffd1dc,#fab3c7);color:#ac3752}.ally .avatar{background:linear-gradient(180deg,#ade889,#86ca60);color:#2e6d1d}.active .seatpanel{outline:4px solid #ffe16f}.seat .seatname{font-size:17px;font-weight:900;line-height:1.1}.seat .count,.seat .team{font-size:12px;color:#455f76;margin-top:3px}.seat .team{font-weight:700}.minirow{margin-top:10px;height:24px;position:relative;overflow:hidden}.minicard{position:absolute;top:0;width:15px;height:22px;border-radius:3px;background:linear-gradient(180deg,#fff,#f1f1f1);border:1px solid #c5ccd7;box-shadow:0 1px 2px #0001}.minicard::before{content:"";position:absolute;inset:2px 2px 2px 2px;border-radius:2px;background:repeating-linear-gradient(90deg,#1d1d1d 0 2px,#fff 2px 4px,#d82c2c 4px 6px,#fff 6px 8px)}
.center{position:absolute;left:50%;top:50%;transform:translate(-50%,-54%);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;text-align:center;width:min(58vw,520px);z-index:3}.turn{font-size:22px;color:#fff8d4;font-weight:900;text-shadow:0 2px 8px #0005}.last{min-height:120px;display:flex;justify-content:center;align-items:flex-end;max-width:100%;padding:3px 0}.last .card{width:82px;height:118px;font-size:40px;margin-left:-20px;flex:none;border-radius:9px;box-shadow:0 6px 12px #0004;transform:rotate(calc(var(--i,0) * 6deg));transform-origin:bottom center}.last .card:first-child{margin-left:0}.last .card .suit{font-size:32px}.trail{font-size:16px;color:#f1fbff;line-height:1.45;text-shadow:0 1px 5px #0004;max-width:100%}.logbutton{font-size:11px!important;background:#ffffff40;border-color:#ffffff66}
.bottom{position:absolute;left:18px;right:18px;bottom:16px;z-index:5}.noticebar{margin:0 auto 10px;max-width:720px;background:#0000003f;color:#fff;backdrop-filter:blur(6px);border-radius:16px;padding:10px 20px;text-align:center;font-size:18px;min-height:48px;display:grid;place-items:center}.hand{display:flex;justify-content:center;align-items:flex-end;gap:0;max-width:1240px;margin:0 auto;padding-top:8px;overflow-x:auto;overflow-y:hidden;padding-bottom:8px}.hand::-webkit-scrollbar{height:6px}.hand::-webkit-scrollbar-thumb{background:#ffffff45;border-radius:8px}.card{position:relative;background:linear-gradient(145deg,#fffdf3,#ece8dc);color:#20292a;border:1px solid #ddd;border-radius:8px;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;line-height:1;box-shadow:0 3px 5px #0005;font-weight:800;font-size:clamp(22px,3vw,34px);width:58px;height:164px;padding:8px 2px 2px;transition:transform .12s,background .12s;user-select:none;-webkit-user-select:none;flex:none;margin-left:-4px}.card:first-child{margin-left:0}.card.red{color:var(--red)}.card .suit{font-size:clamp(20px,2.2vw,28px);margin-top:9px}.card.joker{font-size:15px;line-height:1.1;writing-mode:vertical-rl;text-orientation:mixed;justify-content:center;padding:6px 0}.card.wild{border:3px solid #e0b53f}.card .tag{position:absolute;right:3px;top:3px;font-size:10px;color:#76520b;background:#ffe09c;border-radius:3px;padding:2px 3px}.card.pick{transform:translateY(-18px);background:#ffe5a4;border:3px solid #eab34b;box-shadow:0 0 0 1px #b68732}.controlsWrap{display:grid;grid-template-columns:170px 1fr 170px;gap:18px;align-items:end;max-width:1240px;margin:8px auto 0}.cta{height:74px;border-radius:16px;font-size:28px;font-weight:900;color:#fff;border:3px solid #ffffff55;box-shadow:0 8px 20px #0003}.hintbtn{background:linear-gradient(180deg,#ff8747,#f05d23)}.passbtn{background:linear-gradient(180deg,#37d96a,#14ba47)}.midcontrols{display:flex;align-items:center;justify-content:center;gap:12px;flex-wrap:wrap;background:#00000026;border-radius:16px;padding:8px 14px;backdrop-filter:blur(6px)}.smallctrl{padding:10px 18px;font-size:16px;border-radius:12px;background:#ffffff28}.playbtn{background:#ffd86e;color:#3b2d02;border-color:#f3c451}.midcontrols #selected{font-size:14px;color:#f7fffb;text-align:center}.handfoot{display:flex;justify-content:space-between;margin-top:8px;color:#eef8f5;font-size:12px;text-shadow:0 1px 3px #0004}
dialog{background:#16372f;color:var(--fg);border:1px solid #6e8165;border-radius:16px;width:min(92vw,420px);padding:22px}dialog::backdrop{background:#000a}dialog h2{margin:0 0 12px;color:var(--gold)}#ranks{line-height:2}#logs{max-height:55vh;overflow:auto;font-size:13px;line-height:1.8}
@media(max-width:1100px){#table{padding:10px} .top{left:10px;right:10px;top:10px}.felt{min-height:700px;height:78dvh}.seat.north{width:260px;top:88px}.seat.west,.seat.east{width:210px;top:50%}.center{width:min(64vw,420px)}.last .card{width:68px;height:98px;font-size:32px}.card{width:50px;height:148px}.controlsWrap{grid-template-columns:140px 1fr 140px}}
@media(max-width:850px){.top{position:static;margin-bottom:10px;gap:10px;align-items:center;flex-wrap:wrap}.scorepack{order:3;width:100%;justify-content:center}.brandmini{display:none}.exitbtn{margin-left:auto}.felt{min-height:760px;height:auto;padding-top:0}.seat.north{top:18px}.seat.west{left:10px;top:300px;transform:none}.seat.east{right:10px;top:300px;transform:none}.center{top:240px;transform:translateX(-50%);width:min(76vw,360px)}.bottom{left:10px;right:10px}.controlsWrap{grid-template-columns:1fr;gap:10px}.cta{height:64px;font-size:24px}.midcontrols{order:2}.hintbtn{order:1}.passbtn{order:3}.card{width:42px;height:128px;font-size:28px}.card .suit{font-size:21px}.noticebar{font-size:16px;min-height:40px}.handfoot{font-size:11px}}
@media(orientation:landscape) and (max-height:780px){.felt{height:calc(100dvh - 88px);min-height:580px}.seat.north{top:50px}.seat.west,.seat.east{top:46%}.center{top:47%}.last .card{width:58px;height:86px;font-size:28px;margin-left:-15px}.last .card .suit{font-size:22px}.noticebar{min-height:38px;font-size:14px}.card{width:43px;height:120px;font-size:24px;padding-top:5px}.card .suit{font-size:18px;margin-top:6px}.controlsWrap{grid-template-columns:130px 1fr 130px;gap:10px}.cta{height:54px;font-size:22px}.midcontrols{padding:6px 10px}.smallctrl{padding:8px 14px;font-size:14px}.midcontrols #selected{font-size:12px}.handfoot{margin-top:4px}.seatpanel{padding:10px 12px}.seat .seatname{font-size:15px}.minirow{height:20px}.minicard{height:18px;width:12px}}

/* V3: viewport-native table and overlapping real-card hand. */
#table{--h:100dvh;--w:100vw;--edge:clamp(6px,1.4vw,24px);--card-h:clamp(66px,19.2dvh,220px);--card-w:min(calc(var(--card-h)*.71),15vw);--corner-font:clamp(12px,min(2.5vw,4.1dvh),32px);--control-h:clamp(36px,7.5dvh,80px);width:100%;max-width:none;height:100dvh;min-height:0;padding:0;overflow:hidden;isolation:isolate}
#table .felt{position:absolute;inset:0;width:100%;max-width:none;height:100%;min-height:0;margin:0;padding:0;border-radius:0;box-shadow:none;overflow:hidden}
#table .top{position:absolute;inset:var(--edge) var(--edge) auto;display:flex;flex-wrap:nowrap;align-items:flex-start;margin:0;gap:8px;z-index:6}
#table .brandmini{display:block;padding:5px 9px;border-radius:9px;font-size:12px;background:#f4fffbbd;color:#17446e;max-width:22%}#table .brandmini b{font-size:clamp(13px,2.7dvh,23px)}#table .muted{font-size:clamp(9px,1.8dvh,13px)}
#table .scorepack{order:0;width:auto;margin-left:auto;gap:clamp(4px,1vw,14px);align-items:center;justify-content:flex-end}
#table .roundbadge{min-width:0;flex:none;border:0;border-radius:7px;padding:3px 6px;background:#fff0b9c9;box-shadow:none}#table .roundbadge span{font-size:clamp(8px,1.8dvh,13px)}#table .roundbadge strong{font-size:clamp(10px,2.4dvh,22px)}
#table .teamdisk{width:clamp(28px,6.8dvh,68px);height:clamp(28px,6.8dvh,68px);border-width:3px;flex:none}#table .teamdisk strong{font-size:clamp(15px,4.1dvh,36px)}#table .disklabel{bottom:calc(-1.8dvh - 3px);font-size:clamp(8px,1.8dvh,14px);white-space:nowrap}
#table .levelbadge{min-width:0;font-size:clamp(10px,2.1dvh,16px);border-radius:8px;padding:5px 7px;white-space:nowrap}#table .exitbtn{padding:5px clamp(9px,1.5vw,24px);font-size:clamp(13px,3dvh,25px);border-radius:10px;margin:0;align-self:center;border-width:2px;white-space:nowrap}
#table .seat{width:22%;max-width:300px;min-width:0;gap:0}#table .seat.north{left:50%;top:var(--edge);transform:translateX(-50%)}#table .seat.west{left:var(--edge);top:39%;transform:translateY(-50%)}#table .seat.east{right:var(--edge);top:39%;transform:translateY(-50%)}
#table .seatpanel{padding:clamp(4px,1.3dvh,13px);border-radius:clamp(7px,2dvh,20px);background:#e8fbf5c7;box-shadow:0 3px 9px #0002;min-width:0}#table .panelhead{gap:clamp(4px,1vw,11px);align-items:center}#table .avatar{width:clamp(22px,6dvh,56px);height:clamp(22px,6dvh,56px);font-size:clamp(12px,3.6dvh,28px);border-width:2px}#table .meta{min-width:0}#table .seatname{font-size:clamp(10px,min(2.1vw,2.8dvh),23px);white-space:nowrap;color:#1461a0}#table .enemy .seatname{color:#bc3b29}#table .count,#table .team{font-size:clamp(8px,min(1.4vw,1.9dvh),15px);line-height:1.25;margin-top:2px}#table .team{white-space:nowrap}#table .minirow{height:clamp(10px,4dvh,39px);margin-top:clamp(3px,1dvh,8px);overflow:hidden;background:#e9f6f4;border-radius:4px}#table .minicard{width:10%;height:100%;border-radius:2px}#table .minicard::before{inset:2px;background:repeating-linear-gradient(45deg,#a32d39 0 1px,#fff 1px 3px,#173446 3px 4px,#fff 4px 6px)}#table .active .seatpanel{outline:3px solid #ffde66}
#table .center{left:50%;top:39%;transform:translate(-50%,-50%);width:48%;max-width:none;gap:clamp(3px,1dvh,8px)}#table .turn{font-size:clamp(11px,2.8dvh,23px);padding:3px 8px;border-radius:8px;background:#173d3e66}#table .trail{font-size:clamp(10px,2.1dvh,17px);text-shadow:0 1px 4px #0008}#table .logbutton{display:block;font-size:clamp(9px,1.6dvh,12px)!important;padding:2px 6px}#table .last{--played-w:clamp(30px,12dvh,92px);width:100%;height:clamp(48px,17dvh,136px);min-height:0;align-items:center;padding:4px 0;overflow:visible}
#table .bottom{position:absolute;left:var(--edge);right:var(--edge);bottom:max(var(--edge),env(safe-area-inset-bottom));padding:0;margin:0;max-width:none;display:flex;flex-direction:column;gap:clamp(3px,1dvh,10px)}
#table .noticebar{order:3;min-height:0;height:auto;min-width:0;max-width:none;margin:0;background:transparent;padding:0;font-size:clamp(9px,1.8dvh,14px);color:white;text-shadow:0 1px 4px #000;line-height:1.2;display:none}#table .noticebar:not(:empty){display:block;position:absolute;left:20%;right:20%;bottom:calc(var(--control-h) + var(--card-h) + 4dvh);background:#193f45bb;padding:4px 8px;z-index:9;pointer-events:none}
#table .hand{order:1;display:flex;align-items:flex-end;justify-content:center;gap:0;width:100%;max-width:none;margin:0;min-height:0;padding:clamp(10px,3dvh,26px) 1px 2px;overflow:visible;--step:min(calc(var(--card-w)*.82),calc((100% - var(--card-w) - 4px)/var(--gaps,26)))}
#table .card{position:relative;display:block;background:#fffefa;color:#131b21;border:1px solid #232626;border-radius:clamp(3px,.65dvh,7px);box-shadow:1px 2px 3px #0005;font-family:Arial,sans-serif;font-weight:700;padding:0;line-height:1;flex:none;writing-mode:horizontal-tb;text-orientation:initial;user-select:none;-webkit-user-select:none;touch-action:manipulation;transform:none;overflow:hidden}
#table .hand .card{height:var(--card-h);width:var(--card-w);margin-left:calc(var(--step) - var(--card-w));font-size:var(--corner-font);transition:transform .12s ease,background .12s}
#table .hand .card:first-child{margin-left:0}#table .card.red{color:#d51020}#table .card.wild{background:linear-gradient(145deg,#fff0f2 18%,#fffafa 18%,#fffafa 43%,#fff4c5 43%,#fff4c5 56%,#fff 56%,#e6fff5 86%);border-color:#bb9028}#table .hand .card.pick{transform:translateY(calc(-1 * clamp(8px,2.7dvh,25px)));background:#fff0b1;border-color:#d49f12;box-shadow:inset 0 0 0 2px #e2b84d,1px 2px 3px #0005}#table .card .corner{position:absolute;left:clamp(2px,.45vw,6px);top:clamp(3px,.8dvh,8px);display:flex;flex-direction:column;align-items:center;gap:0;line-height:1;letter-spacing:-.07em}#table .card .rank{font-size:1em;line-height:1}#table .card .suit{font-size:.9em;line-height:1;margin:0}#table .card .lower{top:auto;left:auto;right:clamp(2px,.45vw,6px);bottom:clamp(3px,.8dvh,8px);transform:rotate(180deg)}#table .card .pip{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);font-size:2.2em;line-height:.8;text-align:center}#table .card .jokerword{font-size:.6em;letter-spacing:0;line-height:1.05}#table .card .jokerword span{writing-mode:vertical-rl;text-orientation:upright;font-size:.82em;letter-spacing:-.16em}#table .card.joker .lower{writing-mode:vertical-rl;text-orientation:upright;font-size:.47em}#table .card .jokerpip{font-size:1em;color:#111;letter-spacing:0}#table .jokerpip i{font-style:normal;color:#d51020}#table .card .tag{top:auto;bottom:4px;left:3px;right:auto;font-size:clamp(7px,1.3dvh,12px);padding:1px 2px}
#table .last .card{height:100%;width:var(--played-w);font-size:clamp(13px,3.6dvh,29px);margin-left:max(calc(-.62 * var(--played-w)),calc((100% - var(--played-w))/var(--played-gaps,1) - var(--played-w)));transform:rotate(clamp(-7deg,calc(var(--i,0)*3deg),7deg));transform-origin:bottom center}#table .last .card:first-child{margin-left:0}
#table .controlsWrap{order:2;display:grid;grid-template-columns:minmax(64px,15%) 1fr minmax(64px,15%);width:100%;max-width:none;gap:clamp(5px,1.1vw,18px);margin:0;align-items:center;height:var(--control-h)}#table .cta{height:100%;font-size:clamp(15px,3.7dvh,32px);border-radius:clamp(6px,1.5dvh,13px);border:2px solid #ffffff66;padding:0;box-shadow:0 2px 0 2px #0003}#table .midcontrols{height:100%;order:0;min-width:0;flex-wrap:nowrap;gap:clamp(3px,1vw,12px);padding:3px 5px;border-radius:8px;justify-content:center;background:#164f5ba3}#table .smallctrl{font-size:clamp(11px,2.5dvh,20px);padding:4px clamp(6px,1.1vw,16px);border-radius:6px;white-space:nowrap}#table .midcontrols #selected{font-size:clamp(8px,1.9dvh,16px);line-height:1.15;text-align:center;min-width:0}#table .hintbtn,#table .passbtn{order:0}#table .handfoot{display:none}
/* Compact landscape: enough room for all 27 visible rank strips, even on 20:9. */
@media (orientation:landscape){#table{--corner-font:clamp(11px,min(2.45vw,4.5dvh),33px)}#table .hand .card .corner{left:clamp(1px,.25vw,4px)}#table .hand .card .lower{left:auto;right:3px}#table .seat.north{top:var(--edge)}#table .bottom{bottom:max(var(--edge),env(safe-area-inset-bottom))}}
@media (orientation:landscape) and (min-aspect-ratio:19/10){#table{--card-h:clamp(58px,25dvh,200px);--control-h:clamp(34px,9.5dvh,74px)}#table .seat.west,#table .seat.east{top:36%}#table .center{top:36%}#table .logbutton{display:none}}
/* Portrait fallback: three visible rows, never force microscopic overlapping cards. */
@media (orientation:portrait){#table{--edge:7px;--card-h:clamp(42px,8.4dvh,85px);--control-h:clamp(40px,6dvh,64px);--corner-font:clamp(12px,4vw,22px)}#table .top{gap:3px}#table .brandmini{display:none}#table .scorepack{margin-left:0;flex:1;justify-content:flex-start}#table .seat.north{top:11%;width:38%}#table .seat.west,#table .seat.east{top:34%;width:25%}#table .center{top:33%;width:48%}#table .seat .avatar{display:none}#table .seatname{font-size:clamp(9px,2.8vw,15px)}#table .seat .count,#table .seat .team{font-size:clamp(8px,2.2vw,12px)}#table .hand{display:grid;grid-template-columns:repeat(9,minmax(0,1fr));gap:4px;padding-top:10px}#table .hand .card{width:100%;height:var(--card-h);margin:0}#table .hand .card.pick{transform:translateY(-5px)}#table .hand .card .pip,#table .hand .card .lower{display:none}#table .hand .card .corner{left:50%;transform:translateX(-50%)}#table .hand .card .tag{left:auto;right:2px}#table .controlsWrap{grid-template-columns:19% 1fr 19%}#table .midcontrols{gap:3px}#table .noticebar:not(:empty){bottom:calc(var(--control-h) + var(--card-h)*3 + 28px)}#table .last{--played-w:clamp(23px,8vw,52px);height:clamp(42px,10dvh,82px)}#table .last .card{font-size:clamp(10px,3vw,17px)}}
#table .top .exitbtn{background:linear-gradient(180deg,#ff5656,#ec1d21);border-color:#ad1616;box-shadow:inset 0 0 0 2px #ff9c8570,0 2px 3px #0003}
@media (min-aspect-ratio:1/1){#table .hand .card:not(:last-child) .pip,#table .hand .card:not(:last-child) .lower{visibility:hidden}}
@media (min-aspect-ratio:1/1) and (max-aspect-ratio:6/5){#table{--card-h:clamp(58px,20dvh,160px);--card-w:calc(var(--card-h)*.71);--corner-font:clamp(11px,2.4vw,24px)}#table .hand{display:flex;grid-template-columns:none;gap:0;padding:18px 1px 2px}#table .hand .card{width:var(--card-w);height:var(--card-h);margin-left:calc(var(--step) - var(--card-w));font-size:var(--corner-font)}#table .hand .card:first-child{margin-left:0}#table .hand .card .corner{left:2px;transform:none}#table .hand .card .lower{left:auto;right:3px;transform:rotate(180deg)}#table .hand .card:last-child .pip,#table .hand .card:last-child .lower{display:block}#table .hand .card.pick{transform:translateY(-12px)}#table .seat.north{top:12%;width:28%}#table .seat.west,#table .seat.east{top:42%;width:23%}#table .center{top:42%;width:48%}#table .noticebar:not(:empty){bottom:calc(var(--control-h) + var(--card-h) + 4dvh)}}

/* V4: unfolded / near-square display, including 2160 x 1916 native panels.
   CSS viewport dimensions, not hardware pixels, govern layout. */
@media (min-aspect-ratio:1/1) and (max-aspect-ratio:7/5) {
  #table {
    --u: min(1vw, 1.2dvh);
    --edge: max(calc(1.8 * var(--u)), env(safe-area-inset-left), env(safe-area-inset-right));
    --card-h: min(19.8dvh, 17.4vw);
    --card-w: calc(var(--card-h) * .71);
    --corner-font: calc(2.5 * var(--u));
    --control-h: calc(6.2 * var(--u));
  }
  #table .top {inset:max(var(--edge),env(safe-area-inset-top)) var(--edge) auto;gap:calc(.6 * var(--u));}
  #table .brandmini {max-width:20%;padding:calc(.7 * var(--u)) calc(1 * var(--u));border-radius:calc(1.2 * var(--u));}
  #table .brandmini b {font-size:calc(2.4 * var(--u));}
  #table .muted {font-size:calc(1.5 * var(--u));}
  #table .scorepack {gap:calc(.8 * var(--u));}
  #table .roundbadge {padding:calc(.45 * var(--u)) calc(.65 * var(--u));border-radius:calc(.8 * var(--u));}
  #table .roundbadge span {font-size:calc(1.35 * var(--u));}
  #table .roundbadge strong {font-size:calc(2.1 * var(--u));}
  #table .teamdisk {width:calc(5.1 * var(--u));height:calc(5.1 * var(--u));border-width:max(2px,calc(.32 * var(--u)));}
  #table .teamdisk strong {font-size:calc(3.1 * var(--u));}
  #table .disklabel {font-size:calc(1.45 * var(--u));bottom:calc(-1.8 * var(--u));}
  #table .levelbadge {font-size:calc(1.7 * var(--u));padding:calc(.6 * var(--u));border-radius:calc(.8 * var(--u));}
  #table .exitbtn {font-size:calc(2.15 * var(--u));padding:calc(1 * var(--u)) calc(1.4 * var(--u));border-radius:calc(1.1 * var(--u));}
  #table .seat {max-width:none;}
  #table .seat.north {top:max(var(--edge),env(safe-area-inset-top));width:23%;}
  #table .seat.west,#table .seat.east {top:42%;width:23%;}
  #table .seatpanel {padding:calc(1.05 * var(--u));border-radius:calc(1.7 * var(--u));}
  #table .panelhead {gap:calc(.8 * var(--u));}
  #table .avatar {width:calc(4.7 * var(--u));height:calc(4.7 * var(--u));font-size:calc(2.8 * var(--u));}
  #table .seatname {font-size:calc(1.95 * var(--u));}
  #table .count,#table .team {font-size:calc(1.45 * var(--u));margin-top:calc(.25 * var(--u));}
  #table .minirow {height:calc(3.5 * var(--u));margin-top:calc(.8 * var(--u));}
  #table .center {top:42%;width:45%;gap:calc(.9 * var(--u));}
  #table .turn {font-size:calc(2.3 * var(--u));}
  #table .trail {font-size:calc(1.75 * var(--u));}
  #table .logbutton {font-size:calc(1.4 * var(--u))!important;}
  #table .last {height:calc(12.8 * var(--u));--played-w:calc(9 * var(--u));}
  #table .last .card {font-size:calc(2.9 * var(--u));}
  #table .bottom {bottom:max(var(--edge),env(safe-area-inset-bottom));gap:calc(.7 * var(--u));}
  #table .hand {display:flex;gap:0;grid-template-columns:none;padding:calc(3 * var(--u)) 1px 2px;}
  #table .hand .card {width:var(--card-w);height:var(--card-h);margin-left:calc(var(--step) - var(--card-w));font-size:var(--corner-font);border-radius:calc(.48 * var(--u));border-width:max(1px,calc(.11 * var(--u)));}
  #table .hand .card:first-child {margin-left:0;}
  #table .hand .card .corner {left:calc(.3 * var(--u));top:calc(.6 * var(--u));transform:none;}
  #table .hand .card .lower {left:auto;top:auto;right:calc(.3 * var(--u));bottom:calc(.6 * var(--u));transform:rotate(180deg);}
  #table .hand .card.pick {transform:translateY(calc(-2.5 * var(--u)));}
  #table .hand .card .tag {font-size:calc(1.05 * var(--u));}
  #table .controlsWrap {grid-template-columns:16% 1fr 16%;gap:calc(1.2 * var(--u));}
  #table .cta {font-size:calc(2.9 * var(--u));border-radius:calc(1.1 * var(--u));}
  #table .midcontrols {gap:calc(1 * var(--u));}
  #table .smallctrl {font-size:calc(1.95 * var(--u));padding:calc(.65 * var(--u)) calc(1.3 * var(--u));}
  #table .midcontrols #selected {font-size:calc(1.65 * var(--u));}
  #table .noticebar:not(:empty) {font-size:calc(1.5 * var(--u));bottom:calc(var(--control-h) + var(--card-h) + 4 * var(--u));}
}

/* V5: original supplied meadow artwork, proportional fullscreen crop. */
#table .felt{background:#719847 url('./meadow.png') 65% center / cover no-repeat;}
#table .felt::before,#table .felt::after{content:none;display:none;}

/* V6 — two interaction layouts, refined ivory playing cards. */
#table .top .brandmini{display:flex;flex-direction:column;gap:3px;padding:0;max-width:30%;background:none;box-shadow:none;backdrop-filter:none;flex-shrink:0}
#table .brandmini .muted{color:#fff;text-shadow:0 1px 4px #183e43;font-size:clamp(9px,1.65dvh,16px);margin:0 2px}
#table .toolbuttons{display:flex;gap:4px;align-items:center}
#table .toolbtn{display:flex;align-items:center;justify-content:center;gap:4px;padding:5px 7px;white-space:nowrap;min-height:32px;border:1px solid #e8faf7b8;border-radius:7px;background:#f5fffbd9;color:#254c59;font-size:clamp(10px,1.7dvh,16px);font-weight:700;box-shadow:0 2px 5px #17373726}
#table .toolbtn svg{width:clamp(16px,2.8dvh,24px);height:clamp(16px,2.8dvh,24px);flex:none}
#table .toolbtn[aria-pressed=true]{background:#244b54;color:#fff9dc;border-color:#fff4c6}
#table .bottom{--gap:clamp(3px,.8dvh,8px);--action-h:clamp(30px,5.6dvh,58px);display:grid;grid-template-columns:minmax(55px,16%) minmax(0,1fr) minmax(0,1fr) minmax(55px,16%);grid-template-areas:'. clear play .' 'hand hand hand hand' 'hint status status pass';grid-template-rows:var(--action-h) auto var(--control-h);gap:var(--gap);align-items:center}
#table .bottom #hand{grid-area:hand;order:0;min-width:0;align-self:end;padding-top:clamp(10px,2.5dvh,25px)}
#table .bottom #hint{grid-area:hint}#table .bottom #pass{grid-area:pass}#table .bottom #clear{grid-area:clear}#table .bottom #play{grid-area:play}
#table .bottom .smallctrl{height:100%;min-width:0;max-width:180px;width:100%;justify-self:center;border-radius:8px;font-size:clamp(13px,2.8dvh,25px);padding:0 5px;font-weight:800;border:1px solid #ffffff99;box-shadow:0 2px 5px #0003}
#table .bottom #clear{background:linear-gradient(180deg,#426b76,#284d58);color:#fff}
#table .bottom #play{background:linear-gradient(180deg,#fff1b5,#eac36b);color:#503b16;border-color:#f6e3a8}
#table .bottom .statuspanel{grid-area:status;min-width:0;min-height:0;max-height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;background:#164b50bd;color:#fff;border-radius:8px;padding:3px 8px;line-height:1.2;text-align:center;overflow:hidden;font-size:clamp(10px,1.8dvh,17px);align-self:stretch}
#table .bottom .noticebar:not(:empty){position:static;display:block;inset:auto;background:none;padding:0;border-radius:0;max-width:100%;font-size:clamp(9px,1.65dvh,15px);text-shadow:none;overflow-wrap:anywhere}
#table .bottom .noticebar:empty{display:none}
#table .card{background:linear-gradient(145deg,#fffefa 0%,#fcfaf3 70%,#f0ebdf 100%);border:1px solid #4b4c45;border-radius:clamp(3px,.75dvh,8px);color:#16272b;box-shadow:inset 0 0 0 1px #fffc,1px 2px 4px #142b2b44;font-family:Georgia,'Times New Roman',serif;font-weight:600}
#table .card.red{color:#ab263a}
#table .card .rank{font-variant-numeric:lining-nums tabular-nums;letter-spacing:-.085em}
#table .card .suit{font-family:Arial,sans-serif;font-size:.84em}
#table .card .pip{font-size:1.42em;font-family:Georgia,'Times New Roman',serif;opacity:.94}
#table .card .jokerpip{font-size:.76em;color:#16272b}#table .jokerpip i{color:#ab263a}
#table .card .jokerword{font-family:Arial,sans-serif;letter-spacing:.015em;font-weight:700}
#table .card.wild{background:linear-gradient(145deg,#fffaf0,#f8e8c6 100%);border-color:#a58a48}
#table .hand .card.pick{background:linear-gradient(145deg,#fffdf4,#f7e1a5);border-color:#a47729;box-shadow:inset 0 0 0 1px #e6c46c,0 3px 6px #0004}
#table .card .tag{background:#e8d6a3;color:#674b20}
/* Right-hand mode: reserve a dedicated rail rather than covering any card. */
#table.onehand .bottom{--rail:clamp(56px,12vw,140px);--rail-h:clamp(30px,5.7dvh,62px);grid-template-columns:minmax(0,1fr) var(--rail);grid-template-areas:'status hint' 'hand clear' 'hand play' 'hand pass';grid-template-rows:repeat(4,minmax(var(--rail-h),auto));gap:var(--gap) clamp(5px,1vw,12px);align-items:stretch}
#table.onehand .bottom #hand{align-self:end;--card-w:min(calc(var(--card-h)*.71),14vw);--corner-font:clamp(10px,min(2.12vw,3.8dvh),30px)}
#table.onehand .bottom .statuspanel{align-self:end;min-height:24px;max-height:none;background:#164b50a8}
#table.onehand .bottom #hint,#table.onehand .bottom #pass,#table.onehand .bottom #clear,#table.onehand .bottom #play{width:100%;height:100%;max-width:none;min-height:var(--rail-h);font-size:clamp(12px,2.7dvh,25px);padding:0 3px;justify-self:stretch;align-self:stretch}
#table.onehand .bottom .card{font-size:var(--corner-font)}
/* Preserve room for the center play area when the upper action row is present. */
@media (orientation:landscape) and (max-height:460px){#table{--card-h:clamp(55px,21dvh,100px);--control-h:clamp(31px,8.7dvh,45px)}#table .bottom{--action-h:clamp(27px,7.4dvh,34px)}#table .center{top:33%;gap:2px}#table .seat.west,#table .seat.east{top:35%}#table .last{height:clamp(43px,15dvh,70px)}#table .logbutton{display:none}#table .toolbtn{min-height:29px;padding:4px 5px}}
@media (orientation:portrait){#table .top .brandmini{max-width:none}#table .toolbtn span{display:none}#table .toolbtn{min-width:30px;padding:5px}#table .top{gap:4px}#table .scorepack{flex:1;margin-left:auto;justify-content:flex-end;gap:4px}#table .seat.north{top:12%}#table.onehand .bottom #hand{--corner-font:clamp(11px,3.3vw,20px);grid-template-columns:repeat(9,minmax(0,1fr));gap:3px}#table.onehand .bottom .hand .card{width:100%;margin:0}#table .bottom .smallctrl{max-width:none}}
@media (orientation:landscape) and (min-aspect-ratio:1/1) and (max-aspect-ratio:7/5){#table .toolbtn{font-size:clamp(10px,1.65vw,23px);min-height:clamp(30px,4.6vw,65px)}#table .toolbtn svg{width:clamp(15px,2.6vw,37px);height:clamp(15px,2.6vw,37px)}}

/* V7: all normal controls above the hand; three-button one-hand rail. */
#table .bottom{grid-template-columns:minmax(54px,18%) minmax(54px,18%) minmax(0,1fr) minmax(65px,20%);grid-template-areas:'hint clear status pass' 'hand hand hand hand';grid-template-rows:var(--control-h) auto;gap:var(--gap);align-items:center}
#table .bottom #hint,#table .bottom #pass,#table .bottom #clear{height:100%;width:100%;max-width:none;min-width:0;padding:0 4px;font-size:clamp(13px,3dvh,27px);justify-self:stretch}
#table .bottom #pass.submitplay{background:linear-gradient(180deg,#ffe6a0,#eac36b);color:#483516;border-color:#f6e3a8}
#table .bottom #hand,#table .bottom #hand .card{touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
#table.onehand .bottom{grid-template-areas:'status hint' 'hand clear' 'hand pass';grid-template-rows:repeat(3,minmax(var(--rail-h),auto));}
#table .pass-float{position:absolute;z-index:22;pointer-events:none;padding:6px 13px;border-radius:999px;background:#204a55e8;color:#fff8de;border:1px solid #ffffff80;font-size:clamp(14px,3dvh,27px);font-weight:800;white-space:nowrap;box-shadow:0 3px 12px #0003}
@media (orientation:portrait){#table .bottom{grid-template-columns:repeat(3,minmax(0,1fr));grid-template-areas:'status status status' 'hint clear pass' 'hand hand hand';grid-template-rows:auto var(--control-h) auto}#table.onehand .bottom{grid-template-areas:'status hint' 'hand clear' 'hand pass';grid-template-rows:repeat(3,minmax(var(--rail-h),auto))}}

/* V8: full-panel turn indication, thumb rail beside the right seat, and
   identical overlapping card geometry in portrait fullscreen. */
#table .seatpanel{transition:background-color .16s,box-shadow .16s,outline-color .16s;outline:2px solid transparent;outline-offset:-1px}
#table .active .seatpanel,#table .acting .seatpanel{background:#fff0b7;outline:2px solid #e6c46a;box-shadow:0 3px 13px #5e4b2445}
#table .active .minirow,#table .acting .minirow{background:#fff9e0}
#table.animating-turn .active:not(.acting) .seatpanel{background:#e8fbf5c7;outline-color:transparent;box-shadow:0 3px 9px #0002}
#table.animating-turn .active:not(.acting) .minirow{background:#e9f6f4}
#table.self-turn:not(.animating-turn) .statuspanel,#table.self-acting .statuspanel{background:#fff0b7;color:#55401e;box-shadow:inset 0 0 0 1px #e6c46a}
#table.self-turn:not(.animating-turn) .statuspanel .noticebar,#table.self-acting .statuspanel .noticebar{color:#55401e}
#table .thumbrail{display:none}
#table.onehand .thumbrail{position:absolute;z-index:7;right:var(--edge);top:var(--rail-top,48%);width:clamp(76px,15vw,190px);height:var(--rail-height,135px);display:grid;grid-template-rows:repeat(3,minmax(0,1fr));gap:clamp(3px,.7dvh,9px);align-items:stretch}
#table.onehand .thumbrail button{min-width:0;min-height:0;width:100%;height:100%;max-width:none;padding:0 3px;font-size:clamp(12px,min(2.8dvh,3vw),26px);border-radius:clamp(5px,1.2dvh,12px);font-weight:800}
#table.onehand .thumbrail #clear{background:linear-gradient(180deg,#426b76,#284d58);color:#fff;border:1px solid #ffffff99}
#table.onehand .thumbrail #pass.submitplay{background:linear-gradient(180deg,#ffe6a0,#eac36b);color:#483516;border-color:#f6e3a8}
#table.onehand .bottom{grid-template-columns:minmax(0,1fr);grid-template-areas:'status' 'hand';grid-template-rows:auto auto;align-items:center}
#table.onehand .bottom .statuspanel{justify-self:center;width:min(68%,580px);min-height:22px;max-height:none;align-self:stretch}
#table.onehand .bottom #hand{--card-w:min(calc(var(--card-h)*.71),15vw);--corner-font:inherit;width:100%;}
#table.onehand .seat.east{top:33%}
@media (orientation:landscape) and (max-height:460px){#table.onehand .seat.east{top:25%}#table.onehand .thumbrail{width:clamp(65px,12vw,145px)}}
@media (orientation:portrait){#table.onehand .seat.east{top:25%}#table.onehand .bottom #hand{--corner-font:clamp(11px,3.3vw,20px)}}
@media (orientation:portrait){
 #table.is-fullscreen{--card-h:clamp(64px, min(18dvh,22vw),155px);--card-w:calc(var(--card-h)*.71);--corner-font:clamp(8px,2.4vw,24px)}
 #table.is-fullscreen .bottom #hand{display:flex;grid-template-columns:none;gap:0;padding:clamp(10px,2.5dvh,25px) 1px 2px;--step:min(calc(var(--card-w)*.82),calc((100% - var(--card-w) - 4px)/var(--gaps,26)))}
 #table.is-fullscreen .bottom #hand .card{width:var(--card-w);height:var(--card-h);font-size:var(--corner-font);margin:0 0 0 calc(var(--step) - var(--card-w))}
 #table.is-fullscreen .bottom #hand .card:first-child{margin-left:0}
 #table.is-fullscreen .bottom #hand .card .corner{left:1px;top:clamp(3px,.6dvh,8px);transform:none}
 #table.is-fullscreen .bottom #hand .card .lower{display:block;left:auto;top:auto;right:2px;bottom:4px;transform:rotate(180deg)}
 #table.is-fullscreen .bottom #hand .card .pip{display:block}
 #table.is-fullscreen .bottom #hand .card:not(:last-child) .pip,#table.is-fullscreen .bottom #hand .card:not(:last-child) .lower{visibility:hidden}
 #table.is-fullscreen .bottom #hand .card.pick{transform:translateY(calc(-1 * clamp(8px,2dvh,18px)))}
 #table.is-fullscreen .bottom #hand .card .tag{left:1px;right:auto;font-size:clamp(7px,1.6vw,12px)}
 #table.is-fullscreen.onehand .bottom #hand{--corner-font:clamp(8px,2.4vw,24px)}
}
/* Keep the portrait fullscreen turn label clear of the north seat. */
@media (orientation:portrait){#table.is-fullscreen .center{top:43%;gap:5px}#table.is-fullscreen .turn{font-size:clamp(10px,3.8vw,17px);line-height:1.25}#table.is-fullscreen .trail{font-size:clamp(10px,3vw,14px)}}

/* V9: last actual play remains highlighted even when later seats pass. */
#table .active .seatpanel,#table .acting .seatpanel{background:#e8fbf5c7;outline:2px solid transparent;box-shadow:0 3px 9px #0002}
#table .active .minirow,#table .acting .minirow{background:#e9f6f4}
#table .last-actor .seatpanel{background:#fff0b7;outline:2px solid #e6c46a;box-shadow:0 3px 13px #5e4b2445}
#table .last-actor .minirow{background:#fff9e0}
#table.self-turn:not(.animating-turn) .statuspanel{background:#164b50a8;color:#fff}
#table.self-turn:not(.animating-turn) .statuspanel .noticebar{color:#fff}
#table.self-last .statuspanel,#table.self-last.self-turn .statuspanel{background:#fff0b7;color:#55401e;box-shadow:inset 0 0 0 1px #e6c46a}
#table.self-last .statuspanel .noticebar,#table.self-last.self-turn .statuspanel .noticebar{color:#55401e}
#table #music{padding-inline:6px;flex:none}
#table #music .music-slash{display:none}
#table #music[aria-pressed=false] .music-slash{display:block}
#table .top .brandmini{max-width:none}
@media(max-width:500px){#table .toolbtn{padding:4px;min-width:26px}#table .toolbtn svg{width:16px;height:16px}#table #music{padding-inline:4px}}
@media(max-width:360px) and (orientation:portrait){#table .toolbuttons{gap:2px}#table .top{gap:3px}#table .teamdisk{width:34px;height:34px}#table .teamdisk strong{font-size:20px}#table .levelbadge{padding:4px;font-size:11px}#table .exitbtn{padding:4px 6px;font-size:14px}#table .roundbadge{padding:3px 4px}}

/* V10: compact overlapping fan, even for two or three cards.
   The negative margin is bounded by available center width for long bombs. */
#table .last {isolation:isolate; flex-wrap:nowrap; }
#table .last .card {width:min(var(--played-w), 86%); margin-left:min(calc(-.62 * min(var(--played-w),86%)),calc((100% - min(var(--played-w),86%) - 12px)/var(--played-gaps,1) - min(var(--played-w),86%)));transform:rotate(clamp(-6deg,calc(var(--i,0)*4deg),6deg));transform-origin:50% 70%;}
#table .last .card:first-child {margin-left:0;}
