/* 台山麻将 V4 · 可运行网页的新实物牌风格。影像被裁成34张独立牌面素材，不是桌面背景。 */
:root{--felt:#084c38;--cream:#faf3df;--gold:#dfc17e}
html,body{min-width:900px}
body{background:radial-gradient(ellipse at 50% -7%,#174b37 0%,#061911 72%)}
.topbar{height:72px;background:linear-gradient(90deg,#08251b,#0b2b1d 48%,#081f17);padding:0 clamp(22px,3.6vw,68px);border-bottom:1px solid #c6a06172}
.brand{gap:12px;letter-spacing:1px}
.brand b{font-family:"Noto Serif CJK SC","Songti SC","SimSun",serif;color:#eecf90;letter-spacing:4px;font-size:27px;text-shadow:0 2px 7px #0007}
.brand span{font-size:10px;letter-spacing:3px}
.brandIcon{display:block;width:27px;height:34px;object-fit:fill;border-radius:3px;box-shadow:0 3px 0 #196243,0 4px 7px #0009}
.deskWrap{max-width:1750px;margin:7px auto 6px;padding:0 clamp(8px,1.1vw,25px)}
.deskWrap > .row.space{min-height:48px;padding:0 19px}
.deskWrap h2{font-size:18px}
.status{margin:0 auto 6px;font-size:13px}
.desk{width:100%;height:auto;min-height:700px;max-height:none;aspect-ratio:1.94;border:22px ridge #4d3120;border-radius:39px;background:radial-gradient(ellipse at 47% 45%,#0f654a 0%,#08503b 53%,#064332 100%);box-shadow:inset 0 0 0 3px #cba16d99,inset 0 0 0 10px #042f24, inset 0 0 120px #001f19b5,0 17px 48px #000b}
.desk::before{inset:-20px;border-color:#b18350}
.desk::after{inset:6px;border-color:#c8a96d3b}
.tablePattern{background-image:radial-gradient(circle at center,#9cd0ab0a 0 1px,transparent 1px),repeating-linear-gradient(60deg,#f5d99907 0 1px, transparent 1px 10px);background-size:8px 8px,100% 100%;opacity:.65}
.playerBox{background:linear-gradient(90deg,#061c16e8,#0a3327e8);border:1px solid #d9b06b8a;border-radius:10px;box-shadow:0 7px 23px #001b1699;min-width:132px;padding:9px 13px}
.playerBox strong{font-size:14px;color:#ffedc2}.playerBox small{font-size:13px;color:#e8c782}
.playerBox.north{top:1.2%}
.playerBox.west{top:39%;left:1%}
.playerBox.east{top:39%;right:1%}
.playerBox.south{bottom:17%;left:1%;top:auto}
.playerBox .otherHand{display:none}
.wall{gap:2px}
.wall.n{top:13%;left:24%;right:24%}
.wall.s{bottom:18%;left:24%;right:24%;z-index:1;opacity:.55}
.wall.w{top:24%;left:13.2%}
.wall.e{top:24%;right:13.2%}
.wallUnit{width:24px;height:33px;filter:drop-shadow(0 2px 2px #001e169c)}
.wall.w .wallUnit,.wall.e .wallUnit{width:33px;height:24px}
.wallTop,.wallBottom{height:16px;border-color:#e7dcc5;background:linear-gradient(135deg,#fff6df 0%,#dcd4b5 36%,#166844 39%,#0d4a35 100%)}
.wall.w .wallTop,.wall.e .wallTop,.wall.w .wallBottom,.wall.e .wallBottom{width:16px;height:24px}
.wall.w .wallBottom,.wall.e .wallBottom{left:auto;right:0}
.discard{grid-template-columns:repeat(6,42px);grid-auto-rows:56px;gap:3px;max-width:267px}
.discard.north{top:26%;left:50%}
.discard.south{bottom:35.5%;left:50%}
.discard.west{top:33%;left:23%}
.discard.east{top:33%;right:23%}
.tinyTile,.markerCard{padding:0;border:1px solid #ddceab;background:linear-gradient(165deg,#fff9e4,#decda6);box-shadow:0 4px 0 #0f683f,0 6px 8px #001e175e;border-radius:4px;overflow:hidden}
.tinyTile{width:42px;height:56px}
.tinyTile.highlight{border-color:#f4d270;box-shadow:0 0 0 2px #f8d27c,0 0 20px #e9c74e,0 4px 0 #0f683f}
.tinyTile .tileFace{width:100%;height:100%;object-fit:fill}
.centerBoard{top:48%;min-width:154px;min-height:164px;padding:11px 13px;background:linear-gradient(140deg,#073426f5,#0b3a2ef6);border:1px solid #d4b574d4;box-shadow:inset 0 0 0 3px #1b543a,0 10px 25px #001e168d;border-radius:15px}
.centerBoard .centerWind{font-size:29px;width:47px;height:47px;border-color:#e3c17f}
.centerBoard .remaining{font-size:25px;color:#ffe1a2}
.centerBoard small{font-size:10px}
.myHand{bottom:2.6%;max-width:98%;gap:3px;filter:drop-shadow(0 8px 7px #001c1590)}
.tile{flex:0 0 clamp(54px,4.35vw,79px);width:clamp(54px,4.35vw,79px);height:clamp(82px,6.55vw,115px);border:2px solid #e1d0aa;border-radius:8px 8px 6px 6px;padding:0;overflow:hidden;background:#f6ead6;box-shadow:inset 1px 1px #fff9,0 5px 0 #28835d,0 8px 0 #0c553c,1px 13px 14px #001910c2}
.tile .tileFace{width:100%;height:100%;object-fit:fill;filter:none}
.tile:hover{transform:translateY(-5px);border-color:#efcc86}
.tile.selected{transform:translateY(-18px);border-color:#ffdf83;box-shadow:0 0 0 2px #ffee9f,0 5px 0 #1c7a53,0 8px 0 #07452f,0 0 30px #ecc34da9}
.tile.drawn{margin-left:20px}
.controlBar{margin:13px auto;gap:10px}
.controlBar button{min-width:134px;min-height:47px;font-size:15px}
.controlBar .primary{color:#19392b;border:1px solid #e8cc8d;background:linear-gradient(#fae8b7,#ccaa63);box-shadow:inset 0 1px #fff9,0 6px 10px #0004}
.score{padding:9px;border-color:#7f74517d;background:#103329}
.score b{color:#f3d394}
.markerCard{width:68px;height:92px}.markerCard .tileFace{object-fit:fill}
@media(max-width:1350px){.wallUnit{width:18px;height:28px}.wallTop,.wallBottom{height:14px}.wall.w .wallUnit,.wall.e .wallUnit{width:28px;height:18px}.wall.w .wallTop,.wall.e .wallTop,.wall.w .wallBottom,.wall.e .wallBottom{width:14px;height:18px}.discard{grid-template-columns:repeat(6,34px);grid-auto-rows:45px}.tinyTile{width:34px;height:45px}.tile{flex-basis:clamp(49px,4.1vw,61px);width:clamp(49px,4.1vw,61px);height:clamp(72px,6.3vw,91px)}.desk{min-height:660px}}

/* Square-ended walls: remove the diagonal artifact that made the stacked tiles look like zigzags. */
.wallTop,.wallBottom{background:linear-gradient(to bottom,#fff9e9 0%,#eee5ca 15%,#247a55 16%,#165b42 87%,#104a35 100%);box-shadow:inset 0 1px #fff8,0 2px 0 #0e402c}
.discard.south{bottom:29.5%}

.controlBar .picked{font-size:13px;color:#e4c98d;min-width:100px;text-align:center;padding:10px 0}

/* Keep opponents' concealed tile counts visible without exposing their faces. */
.playerBox .handCount{display:block;font-size:11px;margin-top:3px}
.playerBox:not(.me) .otherHand{display:flex}
.playerBox .otherHand .tinyTile{width:8px;height:13px;flex:none}
.tileFallback{display:grid;place-items:center;width:100%;height:100%;color:#153c2b;font-size:clamp(10px,1.3vw,22px);font-weight:700}
.joinSeats{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:18px}
.seatChoice{display:flex;flex-direction:column;gap:6px;align-items:center;min-height:112px;min-width:0}
.seatChoice strong{font-size:23px;color:#f0d5a0}
.seatChoice span{max-width:100%;overflow-wrap:anywhere}
.seatChoice small{font-size:12px;color:#b7d9bd}
.seatChoice.occupied:disabled{opacity:.8;background:#132a23;border-color:#58614b}
.seatChoice.occupied small{color:#d6b5a3}
.seatChoice.chosen{border:2px solid #f4d484;box-shadow:0 0 0 2px #e8cd7644;background:#29583e}
.joinSeatActions{justify-content:center}

/* Give game events a stable reading area instead of a narrow inline scroller. */
.journalPanel{margin:16px 0 24px;min-width:0;border:1px solid #85734966;border-radius:14px;background:linear-gradient(145deg,#12372b,#0a251d);box-shadow:inset 0 1px #d5c18c12;overflow:hidden}
.journalHeader{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px 20px;border-bottom:1px solid #9b8b5a30}
.journalHeader h3{margin:0;font-size:15px;font-weight:600;letter-spacing:2px;color:#ecd3a0}
.journalHeader>span{font-size:11px;color:#a0b4a4}
.journalPanel .journal{border:0;padding:8px 12px;max-height:184px;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;scrollbar-color:#6a8064 #0d2b21;scrollbar-gutter:stable;font-size:13px;color:#c6d5c8}
.journalPanel .journal::-webkit-scrollbar{width:6px}
.journalPanel .journal::-webkit-scrollbar-track{background:#0d2b21}
.journalPanel .journal::-webkit-scrollbar-thumb{background:#6a8064;border-radius:8px}
.journalEntries{list-style:none;margin:0;padding:0}
.journalEntry{display:flex;align-items:baseline;gap:12px;padding:9px 12px;line-height:1.6;border-radius:7px}
.journalEntry::before{content:'';flex:0 0 5px;width:5px;height:5px;align-self:center;border-radius:50%;background:#6c8d76}
.journalText{flex:1;min-width:0;overflow-wrap:anywhere}
.journalEntry.isLatest{background:#d8bf7012;color:#f0d6a3}
.journalEntry.isLatest::before{background:#e4c47d;box-shadow:0 0 7px #d3b86750}
.journalLatest{flex:none;font-size:10px;letter-spacing:1px;color:#e8cc8a;border:1px solid #bb9d4d66;border-radius:4px;padding:1px 6px}
.journalNote{margin:0;padding:10px 20px;border-top:1px solid #9b8b5a26;font-size:11px;color:#90a595}
.journalEmpty{margin:8px 12px;color:#a0b4a4;line-height:1.8}

/* Four bounded rivers reserve the centre and cannot grow into a neighbour. */
.discardLayout{container-type:size;position:absolute;top:calc(18% + 50px);bottom:24%;left:50%;width:min(760px,72%);transform:translateX(-50%);z-index:3;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,2fr) minmax(0,1fr);grid-template-rows:minmax(0,1fr) 128px minmax(0,1fr);gap:12px;pointer-events:none}
.discardLayout .discard{position:relative;inset:auto;transform:none;display:block;min-width:0;min-height:0;max-width:none;padding:0}
.discardLayout .discard.north{grid-area:1 / 2 / 2 / 3}
.discardLayout .discard.south{grid-area:3 / 2 / 4 / 3}
.discardLayout .discard.west{grid-area:1 / 1 / 4 / 2}
.discardLayout .discard.east{grid-area:1 / 3 / 4 / 4}
.riverTiles{--river-gap:var(--river-spacing,3px);--river-width:min(34px,calc(((100cqw - 2 * var(--river-zone-gap,12px)) / 2 - (var(--river-horizontal-columns) - 1) * var(--river-spacing,3px) - var(--river-padding,12px)) / var(--river-horizontal-columns)),calc(((100cqh - var(--river-center-space,152px)) / 2 - (var(--river-horizontal-rows) - 1) * var(--river-spacing,3px) - var(--river-padding,12px)) / var(--river-horizontal-rows) / 1.5),calc(((100cqw - 2 * var(--river-zone-gap,12px)) / 4 - (var(--river-side-rows) - 1) * var(--river-spacing,3px) - var(--river-padding,12px)) / var(--river-side-rows) / 1.5),calc((100cqh - 5 * var(--river-spacing,3px) - var(--river-padding,12px)) / 6));position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);display:grid;grid-template-columns:repeat(var(--river-columns),var(--river-width));grid-auto-rows:calc(var(--river-width) * 1.5);gap:var(--river-gap)}
.riverTiles .tinyTile{width:var(--river-width);height:calc(var(--river-width) * 1.5);min-width:0;box-shadow:0 2px 0 #0f683f,0 3px 4px #001e1740}
.riverTiles .tinyTile.highlight{border-color:#f4d270;box-shadow:0 0 0 2px #f8d27c,0 0 12px #e9c74e,0 2px 0 #0f683f}
.discard.north .riverTiles{top:auto;bottom:6px;transform:translateX(-50%)}
.discard.south .riverTiles{top:6px;transform:translateX(-50%)}
.discard.west .riverTiles{transform:translate(-50%,-50%) rotate(90deg)}
.discard.east .riverTiles{transform:translate(-50%,-50%) rotate(-90deg)}
.desk .centerBoard{top:calc(47% + 25px);min-width:114px;min-height:100px;height:100px;padding:6px 10px;gap:1px}
.desk .centerBoard .centerLabel,.desk .centerBoard .centerRule{display:none}
.desk .centerBoard b.centerWind{width:28px;height:28px;font-size:19px}
.desk .centerBoard .remaining{font-size:18px;line-height:1.2}
.desk .centerBoard small{font-size:9px;line-height:1.3}

/* Compact green-backed stacks with two ivory edges, matching a real closed wall. */
.desk .wall{gap:0;align-items:flex-start;width:max-content;z-index:2;opacity:1;pointer-events:none}
.desk .wall .wallUnit{flex:none;width:clamp(16px,1.4vw,22px);height:34px;background:none;border:0;border-radius:0;box-shadow:none;filter:drop-shadow(0 2px 1px #001d13a0);isolation:isolate}
.desk .wallUnit.empty{visibility:hidden;opacity:0}
.desk .wall .wallTop,.desk .wall .wallBottom{display:block;position:absolute;left:0;right:auto;bottom:auto;width:100%;height:30px;box-sizing:border-box;border:1px solid #285b35;border-bottom:0;border-radius:2px 2px 1px 1px;background:linear-gradient(to bottom,#3e9554 0px,#2b8044 3px,#1c6635 23px,#d9d3b8 24px,#fff8dc 25px,#f0e9ca 27px,#b4b394 28px,#345d3b 30px);box-shadow:inset 1px 0 #82bd6540,inset -1px 0 #123c2760,inset 0 1px #94ca7a70;filter:none}
.desk .wall .wallTop{top:0;z-index:2}
.desk .wall .wallBottom{top:4px;z-index:1}
.desk .wall.n{top:18%;bottom:auto;left:50%;right:auto;transform:translateX(-50%)}
.desk .wall.s{top:auto;bottom:18%;left:50%;right:auto;transform:translateX(-50%)}
.desk .wall.w{top:50%;bottom:auto;left:14%;right:auto;flex-direction:row;transform:translate(-50%,-50%) rotate(90deg)}
.desk .wall.e{top:50%;bottom:auto;right:14%;left:auto;flex-direction:row;transform:translate(50%,-50%) rotate(-90deg)}
@media(max-width:1200px){.desk .playerBox.west,.desk .playerBox.east{top:3%}}

/* One coherent engraved set: ivory face, bevelled resin edge and jade backing. */
.myHand .tile{border:1px solid #cfbf9b;border-radius:8px 8px 6px 6px;padding:5px 3px 7px;background:linear-gradient(125deg,#fffdf0 0%,#f8f1df 42%,#e9ddc0 100%);box-shadow:inset 0 2px 1px #fffdf7,inset 2px 0 2px #fff9,inset -2px -1px 3px #b8a78070,0 4px 0 #d4c7a7,0 8px 0 #1b7650,0 11px 0 #0e5038,1px 15px 12px #00170f80}
.myHand .tile .tileFace{width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 1px .35px #fff9)}
.myHand .tile:hover{background:linear-gradient(125deg,#fffdf0,#f8f1df 42%,#e9ddc0);border-color:#e6c77e;filter:brightness(1.03)}
.myHand .tile.selected{border-color:#efd07c;box-shadow:0 0 0 2px #ffe4a1,inset 0 2px 1px #fffdf7,inset -2px -1px 3px #b8a78070,0 4px 0 #d4c7a7,0 8px 0 #1b7650,0 11px 0 #0e5038,0 5px 25px #ebc66865}
.tinyTile,.markerCard{border:1px solid #cebd98;background:linear-gradient(125deg,#fffdf0,#f6eed9 50%,#e9ddc0);border-radius:4px;padding:2px;box-shadow:inset 0 1px 1px #fff,0 2px 0 #d2c3a0,0 4px 0 #206b4c,0 6px 6px #001b1240}
.tinyTile .tileFace,.markerCard .tileFace{width:100%;height:100%;object-fit:contain}
.riverTiles .tinyTile{padding:1px;border-radius:3px;background:linear-gradient(125deg,#fffdf0,#f2e8d1);box-shadow:inset 0 1px #fff9,0 1px 0 #c9ba98,0 3px 0 #206b4c}
.riverTiles .tinyTile.highlight{border-color:#edc76e;box-shadow:0 0 0 2px #f0ce7c,0 1px 0 #c9ba98,0 3px 0 #206b4c,0 0 12px #e9c74e60}
.markerCard{padding:5px}
.brandIcon{padding:2px;background:linear-gradient(125deg,#fffdf0,#e9ddc0);object-fit:contain}

/* Render the complete approved resin models, including their own bevel and base. */
.myHand .tile,.myHand .tile:hover,.myHand .tile.selected,.tinyTile,.markerCard,.riverTiles .tinyTile{padding:0;border:0;background:transparent;box-shadow:none;border-radius:10% 10% 7% 7%;filter:drop-shadow(0 3px 3px #001b1280)}
.myHand .tile .tileFace,.tinyTile .tileFace,.markerCard .tileFace{display:block;width:100%;height:100%;border-radius:10% 10% 7% 7%;overflow:hidden;filter:none}
.myHand .tile:hover{filter:brightness(1.04) drop-shadow(0 4px 4px #001b1280)}
.myHand .tile.selected{filter:drop-shadow(0 0 5px #f4d27d) drop-shadow(0 6px 4px #001b12a0)}
.riverTiles .tinyTile.highlight{border:0;box-shadow:0 0 0 2px #f4d27d;filter:drop-shadow(0 0 4px #e9c74e)}

/* Keep the hand and action buttons above the fold, including browser chrome. */
.desk{height:clamp(520px,calc(100dvh - 220px),820px);min-height:0;aspect-ratio:auto}
.controlBar{min-height:48px;margin:8px auto;gap:8px}
.controlBar button{min-height:44px}
.desk .centerBoard{width:196px;min-width:196px;height:128px;min-height:128px;padding:5px;display:grid;grid-template-columns:24px minmax(0,1fr) 24px;grid-template-rows:22px minmax(0,1fr) 22px;gap:3px;z-index:4}
.centerBoard .centerSeat{position:static;inset:auto;transform:none;display:grid;place-items:center;border:1px solid #8a956655;border-radius:5px;color:#a7bcaa;background:#143f30;font-size:13px;line-height:1}
.centerBoard .centerSeat.north{grid-area:1 / 2 / 2 / 3;justify-self:center;width:34px}
.centerBoard .centerSeat.south{grid-area:3 / 2 / 4 / 3;justify-self:center;width:34px}
.centerBoard .centerSeat.west{grid-area:2 / 1 / 3 / 2;align-self:center;height:34px}
.centerBoard .centerSeat.east{grid-area:2 / 3 / 3 / 4;align-self:center;height:34px}
.centerBoard .centerSeat.active{background:#efd18b;color:#143726;border-color:#ffe9b3;font-weight:800;box-shadow:0 0 9px #e9c76d70}
.centerBoard .centerInfo{grid-area:2 / 2 / 3 / 3;min-width:0;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:1px}
.centerBoard .centerDealer{display:flex;gap:3px;align-items:center;max-width:100%;font-size:10px;color:#d6c391;line-height:14px}
.desk .centerBoard .centerDealer .centerWind{display:inline;width:auto;height:auto;border:0;border-radius:0;background:none;font-size:11px;line-height:14px}
.centerBoard .centerDealer small{font-size:10px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.desk .centerBoard .remaining{font-size:16px;line-height:18px}
.centerBoard .status{max-width:100%;margin:0;font-size:11px;letter-spacing:0;line-height:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#ffe2a0}
.desk .centerBoard .centerDice{font-size:8px;line-height:11px;white-space:nowrap}
.previewMode .centerBoard .status:before{content:none}
@media(max-height:800px){.discardLayout{width:min(960px,78%)}.topbar{height:58px}.deskWrap>.row.space{min-height:44px}.desk{height:calc(100dvh - 190px);min-height:480px;border-width:16px}.playerBox{padding:6px 10px}.myHand .tile{height:80px;flex-basis:54px;width:54px}.myHand{bottom:2%}}


.myHand .tile{touch-action:manipulation}

/* Keep the hand compact without scaling its interaction coordinates. */
@media(min-width:1024px){.myHand .tile{flex-basis:clamp(46px,3.5vw,60px);width:clamp(46px,3.5vw,60px);height:auto;aspect-ratio:347 / 532}}

@media(min-width:1024px) and (max-width:1200px){.desk .wall.w{left:9%}.desk .wall.e{right:9%}}

.spectating .myHand,.spectating .mobileMelds{display:none}.spectating .playerBox.south{left:50%;bottom:3%;transform:translateX(-50%)}
