/* Briscola: a sunlit Italian ceramic-and-linen card table. */
*{box-sizing:border-box}
:root{color-scheme:light;--ink:#542b18;--sky:#147cae;--sand:#f4e1bb}
body{margin:0;background:#e5c7a4;color:var(--ink);font-family:Georgia,'Times New Roman',serif}
body>header{height:30px;padding:5px 14px;background:#faeed7;border-bottom:1px solid #c19e70;font:12px/20px system-ui,sans-serif;text-align:center}
a{color:#245c7d}main{max-width:none;margin:0;padding:0}
.br-scene{--u:min(calc(100vw / 390),calc((100svh - 30px) / 810),1.2px);position:relative;width:calc(390 * var(--u));height:calc(810 * var(--u));margin:0 auto;isolation:isolate;background:#8bcbef url('../assets/play/briscola/backdrop.webp') center top/100% 100% no-repeat;box-shadow:0 12px 45px #70462138}
.br-scene h1{position:absolute;left:calc(20 * var(--u));top:calc(8 * var(--u));width:calc(350 * var(--u));height:calc(100 * var(--u));margin:0;z-index:2;font-size:0}
.br-scene h1 img{display:block;width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 3px 2px #74371966)}
.hud{position:absolute;left:calc(22 * var(--u));right:calc(22 * var(--u));top:calc(113 * var(--u));display:grid;grid-template-columns:repeat(6,1fr);gap:calc(3 * var(--u));margin:0}
.hud>div{grid-column:span 2;white-space:nowrap;display:flex;align-items:center;justify-content:center;gap:calc(4 * var(--u));height:calc(28 * var(--u));font-size:calc(10 * var(--u));background:#f8e6c5;border:1px solid #cfac78;border-radius:calc(10 * var(--u));box-shadow:0 2px 2px #773f2255}
.hud>div:nth-child(-n+2){grid-column:span 3;height:calc(45 * var(--u));font-size:calc(16 * var(--u));font-weight:700;background:transparent url('../assets/play/briscola/plaque.webp') center/100% 100% no-repeat;border:0;border-radius:0;box-shadow:none}
.hud b{font-size:calc(13 * var(--u));color:#185878;font-variant-numeric:tabular-nums}
.hud>div:nth-child(-n+2) b{font-size:calc(28 * var(--u));margin-left:calc(4 * var(--u))}
#br-status{position:absolute;top:calc(193 * var(--u));left:calc(20 * var(--u));right:calc(20 * var(--u));min-height:calc(38 * var(--u));margin:0;padding:calc(4 * var(--u)) calc(10 * var(--u));display:flex;align-items:center;justify-content:center;text-align:center;font:600 calc(12 * var(--u))/1.24 system-ui,sans-serif;color:#4e2c1d;background:#fff0dbe8;border:1px solid #d2ac76;border-radius:calc(12 * var(--u));box-shadow:0 2px 3px #713b2333}
.stage{position:absolute;left:0;top:calc(235 * var(--u));width:100%;height:calc(505 * var(--u));touch-action:none;user-select:none;-webkit-user-select:none}
.stage::before{content:'';position:absolute;inset:calc(101 * var(--u)) 0 0;background:url('../assets/play/briscola/table.webp') center/100% 100% no-repeat;filter:drop-shadow(0 5px 2px #74432677);pointer-events:none;z-index:-1}
.row{position:absolute;left:0;width:100%}
.opponent{top:0;height:calc(126 * var(--u))}
.who{position:absolute;text-align:center;color:var(--ink);font-size:calc(9 * var(--u));line-height:1.1}
.who b{display:block;font-size:calc(17 * var(--u));font-weight:700}
.opponent .who{top:0;left:calc(101 * var(--u));width:calc(188 * var(--u));height:calc(33 * var(--u));padding:calc(2 * var(--u)) 0;background:url('../assets/play/briscola/plaque.webp') center/100% 100% no-repeat}
.hand{display:flex;gap:calc(7 * var(--u));justify-content:center;align-items:center;flex-wrap:nowrap}
.opponent .hand{position:absolute;top:calc(40 * var(--u));left:calc(83 * var(--u));width:calc(224 * var(--u));height:calc(85 * var(--u))}
.pile{position:absolute;text-align:center;font:600 calc(10 * var(--u))/1.3 system-ui,sans-serif;color:var(--ink)}
.opponent .pile{right:calc(13 * var(--u));top:calc(45 * var(--u));width:calc(54 * var(--u));background:#ffefcfdc;border-radius:calc(9 * var(--u));padding:calc(5 * var(--u)) 0}
.stack{width:calc(34 * var(--u));height:calc(47 * var(--u));margin:0 auto calc(4 * var(--u));border-radius:calc(6 * var(--u));background:#ffefce url('../assets/play/briscola/card-back.webp') center/100% 100% no-repeat;box-shadow:1px 2px 0 #c7ac7c,2px 4px 0 #f8e3b8,3px 5px 2px #61381c66}
.stack.empty{background:#e6c88f55;box-shadow:inset 0 1px 3px #7c4b3633;border:1px dashed #a47b47}
.felt{position:absolute;top:calc(145 * var(--u));left:calc(14 * var(--u));right:calc(14 * var(--u));height:calc(136 * var(--u));display:flex;align-items:center;gap:calc(4 * var(--u))}
.deckwrap{position:relative;width:calc(100 * var(--u));height:calc(118 * var(--u));flex:none}
.deckwrap .card.trumpcard{position:absolute;left:calc(21 * var(--u));top:calc(25 * var(--u));transform:rotate(90deg);width:calc(60 * var(--u));height:calc(86 * var(--u))}
.deckwrap .stack{position:absolute;left:calc(12 * var(--u));top:calc(9 * var(--u));width:calc(56 * var(--u));height:calc(78 * var(--u));z-index:2}
.deckwrap .dl{position:absolute;bottom:calc(-3 * var(--u));left:calc(4 * var(--u));width:calc(92 * var(--u));padding:calc(5 * var(--u)) 0;text-align:center;font:bold calc(12 * var(--u))/1 Georgia,serif;background:url('../assets/play/briscola/plaque.webp') center/100% 100% no-repeat;z-index:3}
.trick{display:flex;justify-content:center;align-items:center;gap:calc(16 * var(--u));flex:1}
.slot{display:flex;flex-direction:column-reverse;align-items:center;gap:calc(5 * var(--u));font:bold calc(11 * var(--u))/1.1 Georgia,serif;white-space:nowrap}
.slot>span{padding:calc(4 * var(--u)) calc(7 * var(--u));background:#fff0cb;border:1px solid #bf965e;border-radius:calc(12 * var(--u));box-shadow:0 2px 2px #79502733}
.ph,.card{width:calc(78 * var(--u));height:calc(112 * var(--u));border-radius:calc(9 * var(--u));flex:none}
.ph{border:calc(2 * var(--u)) solid #b88b4a88;box-shadow:inset 0 4px 8px #80552c33;background:#a8772f12}
.card{position:relative;padding:0;min-height:0;background:#fff0d6 url('../assets/play/briscola/card-paper.webp') center/100% 100%;color:#26221e;border:1px solid #b49b72;box-shadow:inset 0 0 0 2px #fff5de,0 3px 0 #c6a573,0 6px 6px #65401c66;font-family:Georgia,'Times New Roman',serif;transition:transform .12s;cursor:default}
.card .ck{position:absolute;left:calc(6 * var(--u));top:calc(4 * var(--u));font-size:calc(25 * var(--u));line-height:1;font-weight:700;z-index:1}
.card .cv{position:absolute;right:calc(4 * var(--u));top:calc(5 * var(--u));min-width:calc(24 * var(--u));padding:calc(2 * var(--u)) calc(4 * var(--u));font:bold calc(13 * var(--u))/1.2 Georgia,serif;text-align:center;border-radius:calc(8 * var(--u));background:#ffe3a9;border:1px solid #d1a465;box-shadow:0 1px 2px #83592644;z-index:1}
.card .cv.z{color:#876f50;background:#f4e6cd;box-shadow:none}
.card .cw{position:absolute;left:0;right:0;bottom:calc(4 * var(--u));text-align:center;font:bold calc(9 * var(--u))/1.1 system-ui,sans-serif;letter-spacing:.3px;color:#755538}
.card-art{position:absolute;left:10%;right:10%;top:28%;bottom:14%;pointer-events:none}
.card-art img{display:block;width:100%;height:100%;object-fit:contain;pointer-events:none}
.pips{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:minmax(0,1fr);gap:3%}
.pips.v1{grid-template-columns:1fr}.pips.v2,.pips.v3{grid-template-columns:repeat(3,minmax(0,1fr))}.pips.v2{grid-template-columns:repeat(2,minmax(0,1fr))}
.pips.v5 img:last-child,.pips.v7 img:last-child{grid-column:span 2}
.court{left:5%;right:5%;top:25%;bottom:12%}
.court-suit{position:absolute;left:0;bottom:0;width:28%;height:39%;padding:2px;background:#fff3db;border-radius:5px;border:1px solid #bda16e}
.card.back{background:#fff0d6 url('../assets/play/briscola/card-back.webp') center/100% 100% no-repeat;border:0}
.opponent .card{width:calc(61 * var(--u));height:calc(86 * var(--u))}
.card.trump{border:calc(2 * var(--u)) solid #d69a27;box-shadow:0 0 0 1px #ffe5a2,0 3px 0 #a77d37,0 6px 6px #62401966}
.card.won{outline:3px solid #40995b;outline-offset:2px;box-shadow:0 0 12px #70dc88}
.player{top:calc(288 * var(--u));height:calc(164 * var(--u))}
.player::before{content:'';position:absolute;left:calc(82 * var(--u));bottom:0;width:calc(226 * var(--u));height:calc(32 * var(--u));background:url('../assets/play/briscola/plaque.webp') center/100% 100% no-repeat;pointer-events:none}
.player .hand{position:absolute;left:calc(38 * var(--u));right:calc(38 * var(--u));top:0;height:calc(135 * var(--u))}
.player .card{width:calc(91 * var(--u));height:calc(132 * var(--u))}
.player .who{left:calc(100 * var(--u));bottom:calc(3 * var(--u));width:calc(80 * var(--u))}
.player .pile{right:calc(103 * var(--u));bottom:calc(9 * var(--u))}
.player .pile .stack{position:absolute;right:calc(-27 * var(--u));bottom:calc(-6 * var(--u));width:calc(19 * var(--u));height:calc(25 * var(--u));margin:0}
button.card{cursor:pointer}button.card:hover:not(:disabled){transform:translateY(calc(-5 * var(--u)))}button.card:disabled{cursor:default}
.card.sel,.card.sel:hover:not(:disabled){transform:translateY(calc(-13 * var(--u)));outline:calc(3 * var(--u)) solid #1682b4;outline-offset:calc(2 * var(--u));box-shadow:0 4px 0 #b99764,0 8px 10px #5d442e66}
.choices{position:absolute;left:calc(27 * var(--u));right:calc(27 * var(--u));top:calc(457 * var(--u));min-height:calc(44 * var(--u));display:flex;flex-direction:column;align-items:center;justify-content:center;gap:calc(2 * var(--u));text-align:center}
.choices>span{font:600 calc(11 * var(--u))/1.2 system-ui,sans-serif;color:#452d1e;background:#ffefcfe8;padding:calc(4 * var(--u)) calc(10 * var(--u));border-radius:calc(9 * var(--u));max-width:100%}
button{font-family:Georgia,'Times New Roman',serif;cursor:pointer}
.br-scene button:not(.card){min-height:calc(44 * var(--u));padding:calc(7 * var(--u)) calc(25 * var(--u));border:0;border-radius:calc(24 * var(--u));background:transparent url('../assets/play/briscola/button.webp') center/100% 100% no-repeat;color:#fff3dd;font-size:calc(18 * var(--u));font-weight:700;text-shadow:0 2px 1px #194a64;filter:drop-shadow(0 3px 1px #72432166)}
.br-scene .choices button{font-size:calc(13 * var(--u));min-height:calc(35 * var(--u));padding:calc(7 * var(--u)) calc(32 * var(--u));width:100%;line-height:1.15}
button:focus-visible{outline:3px solid #142c80;outline-offset:4px}
.toolbar{position:absolute;top:calc(747 * var(--u));left:calc(17 * var(--u));right:calc(17 * var(--u));height:calc(57 * var(--u));display:flex;gap:calc(9 * var(--u));margin:0}
.br-scene .toolbar button{width:50%;height:100%;font-size:calc(20 * var(--u));white-space:nowrap;padding:0 calc(18 * var(--u))}
#br-over{position:absolute;inset:calc(5 * var(--u)) calc(14 * var(--u)) calc(4 * var(--u));z-index:10;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:calc(17 * var(--u));padding:calc(22 * var(--u));border:calc(8 * var(--u)) solid #bc6945;border-radius:calc(30 * var(--u));background:#fae8c5 url('../assets/play/briscola/card-paper.webp') center/100% 100%;box-shadow:0 7px 18px #58311a88;text-align:center}
#br-over[hidden]{display:none}
#br-over p{font-size:calc(23 * var(--u));line-height:1.2;font-weight:700;margin:0;color:#743519}
.tally{border-collapse:collapse;width:100%;font:calc(13 * var(--u))/1.35 system-ui,sans-serif}
.tally th,.tally td{padding:calc(7 * var(--u)) calc(4 * var(--u));border-bottom:1px solid #ceaf7d;text-align:center}
.tally th:first-child,.tally td:first-child{text-align:left}.tally tr:last-child td{font-size:calc(17 * var(--u));font-weight:800;color:#195e87;border:0}
.br-guide{max-width:780px;margin:0 auto;padding:26px 24px 40px;font:16px/1.65 system-ui,sans-serif;background:#fff5e4;color:#573e2e}
.br-guide h2{font:700 25px/1.2 Georgia,serif;color:#834329}.br-guide p{margin:0 0 20px}.br-guide li{margin:9px 0}.br-guide ul{padding-left:22px}
@media(prefers-reduced-motion:reduce){.card{transition:none}}
/* Comparison pass 2: deeper wells, a clearer trump, and a fuller hand. */
.ph{border:1px solid #b58c53;box-shadow:inset 0 5px 7px #77532c50,inset 0 0 0 2px #ffe4b155,0 1px 0 #fff1cc;background:#98714016}
.deckwrap{height:calc(132 * var(--u))}
.deckwrap .card.trumpcard{top:calc(47 * var(--u))}
.deckwrap .stack{top:calc(4 * var(--u))}
.deckwrap .dl{bottom:calc(-6 * var(--u))}
.player{top:calc(272 * var(--u));height:calc(178 * var(--u))}
.player .hand{height:calc(147 * var(--u))}
.player .card{height:calc(145 * var(--u))}
.player .card:first-child:not(.sel){transform:rotate(-4deg)}
.player .card:last-child:not(.sel){transform:rotate(4deg)}
.br-scene .choices button{min-height:calc(44 * var(--u));padding:0;border:solid transparent;border-width:calc(14 * var(--u)) calc(40 * var(--u));border-image:url('../assets/play/briscola/button.webp') 50 140 fill stretch;background:none}
.br-scene .toolbar button{font-size:calc(18 * var(--u))}
#br-status{background:#fff0dbeF;border-radius:calc(18 * var(--u));box-shadow:inset 0 0 0 2px #fff8e8,0 2px 3px #713b2344}
/* Comparison pass 3: preserve room for the real trick hint and two-digit scores. */
.hud>div:nth-child(-n+2){font-size:calc(14 * var(--u));gap:calc(3 * var(--u))}
.hud>div:nth-child(-n+2) b{font-size:calc(25 * var(--u));margin-left:calc(2 * var(--u))}
.choices{top:calc(451 * var(--u))}
.choices button+span{font-size:calc(10 * var(--u));padding:calc(2 * var(--u)) calc(10 * var(--u))}
.toolbar{top:calc(753 * var(--u));height:calc(51 * var(--u))}
.opponent .pile{top:calc(42 * var(--u));display:flex;flex-direction:column-reverse;gap:calc(3 * var(--u));border:1px solid #c1a16b;background:#fce6bf url('../assets/play/briscola/card-paper.webp') center/100% 100%;box-shadow:inset 0 0 0 2px #fff2d7,0 2px 3px #77442344}
.opponent .pile .stack{margin-bottom:0}
.s0 .v3,.s1 .v3{grid-template-columns:repeat(2,minmax(0,1fr))}
.s0 .v3 img:first-child,.s1 .v3 img:first-child{grid-column:span 2;width:50%;justify-self:center}
/* Final comparison: the instruction ribbon and captured-trick labels stay legible. */
.choices>span:first-child{width:100%;min-height:calc(43 * var(--u));padding:calc(6 * var(--u)) calc(30 * var(--u));display:flex;align-items:center;justify-content:center;background:transparent url('../assets/play/briscola/plaque.webp') center/100% 100% no-repeat;font-size:calc(12 * var(--u));font-family:Georgia,'Times New Roman',serif}
.player::before{left:calc(69 * var(--u));width:calc(252 * var(--u))}
.player .pile{right:calc(100 * var(--u));font-size:calc(11 * var(--u))}
.player .who{font-size:calc(10 * var(--u))}
.hud>div:nth-child(-n+2){font-size:calc(13 * var(--u))}
.hud>div:nth-child(-n+2) b{font-size:calc(24 * var(--u))}
