:root {
  --felt: #0f5132; --felt-d: #0b3d26; --felt-l: #13603e; --cream: #fffaf0; --ink: #8b1a2b; --gold: #f2b632;
  --wa: #17803f; --text: #f6f1e6; --muted: #d3e3da; --panel: #123f2b; --line: rgba(255,255,255,.14);
  --gold-t: #ffd36b; /* gold for text on the felt (readable, 4.5:1 or more); --gold stays for backgrounds */
}
/* Text sizes are in rem (1rem = 16 px at normal text size). On the scrolling screens app.js sets 1rem to the
   player's own text size, so bigger text reflows there; on the game table the whole page is scaled instead. */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { height: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; } /* no automatic text boost when a phone turns sideways */
/* min-height (not height): on long screens the felt gradient stretches with the page instead of repeating with a seam */
body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(circle at 50% 35%, var(--felt-l), var(--felt) 45%, var(--felt-d)) no-repeat;
  background-color: var(--felt-d);
  color: var(--text); font: .9375rem/1.4 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  overscroll-behavior: none;
}
#app { max-width: 520px; margin: 0 auto; min-height: 100vh; min-height: var(--app-h, 100vh); }
button { font: inherit; color: inherit; cursor: pointer; }
a.btn { color: inherit; text-decoration: none; } /* "Save picture" is a link: same look as the other buttons */
h1, h2, h3 { margin: .3em 0; }
/* long names without spaces break instead of spilling out of boxes */
h1, h2, h3, p, .btn, .note, .big-note { overflow-wrap: break-word; word-wrap: break-word; }
h2, .btn.big { overflow-wrap: anywhere; }
h1:focus, h2:focus { outline: none; } /* focused only so screen readers start there */
h3 { font-size: .9375rem; color: var(--gold-t); margin-top: 18px; }
h3 small { color: var(--muted); font-weight: 400; }
small { font-size: .75rem; }

/* buttons */
.btn { background: rgba(255,255,255,.1); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; min-height: 44px; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.big { display: block; width: 100%; padding: 14px; font-size: 1.0625rem; font-weight: 700; margin: 8px 0; text-align: center; text-decoration: none; }
.btn.big small { display: block; font-weight: 400; opacity: .85; }
.btn.primary { background: var(--gold); color: #2a1c00; border-color: #ffd36b; }
.btn.wa { background: var(--wa); color: #fff; border-color: #3cc27a; }
.btn.warn { background: #c0392b; border-color: #e3685a; color: #fff; font-weight: 700; }
.btn.go { background: rgba(255,255,255,.16); font-weight: 600; }
.btn.icon { min-width: 44px; padding: 6px 10px; font-size: 1.125rem; }
.btn.sm { min-width: 42px; min-height: 42px; padding: 2px 8px; font-size: .875rem; }
/* Flex layouts use margins, not `gap`: flex gap needs Chrome 84+ / iOS 14.1+ (old WebViews would lose all spacing). */
.row { display: flex; margin: 6px 0; }
.row > * + * { margin-left: 8px; }
.row .btn { flex: 1; }

/* screens */
.screen { padding: 12px 16px 28px; }
.hdr { display: flex; align-items: center; margin: 0 0 6px; }
.hdr > * + * { margin-left: 8px; }
.hdr h2 { font-size: 1.25rem; }
.logo { text-align: center; padding-top: 6px; }
.logo h1 { font-size: 2.5rem; letter-spacing: .5px; color: var(--gold); text-shadow: 0 3px 0 #6b4500; font-weight: 900; }
.logo.small h1 { font-size: 1.875rem; }
.tag { color: var(--muted); margin: 0 auto; max-width: 340px; }
.fan { position: relative; height: 96px; width: 150px; margin: 6px auto 0; }
.fan-card { position: absolute; left: 50%; bottom: 0; width: 58px; margin-left: -29px; filter: drop-shadow(0 3px 4px rgba(0,0,0,.35)); transform-origin: 50% 120%; }
.fan-card:nth-child(1) { transform: rotate(-18deg); }
.fan-card:nth-child(3) { transform: rotate(18deg); }
.menu { margin-top: 12px; }
.promise { background: rgba(0,0,0,.22); border: 1px solid var(--line); border-radius: 14px; padding: 8px 14px; margin-top: 12px; }
.promise h3 { margin-top: 6px; }
.promise ul { padding-left: 18px; margin: 4px 0; }
.promise li { margin: 3px 0; color: #e3ece6; }
.note { color: var(--muted); font-size: .8125rem; }
.big-note { font-size: 1rem; text-align: center; }
.text p, .text li { color: #e8efe9; }
.center-msg { text-align: center; }

/* toggles + rules */
.toggles { display: flex; flex-wrap: wrap; margin: 12px 0; }
.toggles > .sw { margin: 3px 16px 3px 0; }
.sw { display: inline-flex; align-items: center; cursor: pointer; min-height: 44px; }
.sw > input + span { margin-right: 8px; } /* space between the switch and its text */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); border: 0; white-space: nowrap; }
.sw input { position: absolute; opacity: 0; pointer-events: none; }
.sw > span { width: 42px; height: 24px; border-radius: 12px; background: rgba(255,255,255,.2); position: relative; flex: none; transition: background .15s; }
.sw > span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .15s; }
.sw input:checked + span { background: var(--wa); }
.sw input:checked + span::after { left: 21px; }
.sw input:focus-visible + span { outline: 2px solid var(--gold); }
.rules { background: rgba(0,0,0,.18); border-radius: 14px; padding: 4px 12px; }
.rule > * + * { margin-left: 10px; }
.rule { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.rule:last-child { border-bottom: 0; }
.rule b { display: block; }
.rule small { color: var(--muted); }
.rule > span:first-child { min-width: 0; }
.rule .seg { flex: none; margin-left: auto; } /* the option buttons never shrink (the "5" was cut at 320 px) */
.rule { flex-wrap: wrap; } /* with big text the options go onto their own line instead of off the screen */
.rule > .seg { margin-top: 4px; margin-bottom: 2px; }
.rule.dis { opacity: .5; }
.rules-sum { background: rgba(0,0,0,.18); border-radius: 12px; padding: 10px 12px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { background: transparent; border: 0; min-width: 40px; min-height: 40px; padding: 0 10px; }
.seg button { text-transform: capitalize; }
.seg button.on { background: var(--gold); color: #2a1c00; font-weight: 700; }
.inp { width: 100%; background: rgba(0,0,0,.25); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 11px 12px; font: inherit; margin: 4px 0; }
.inp.code { font-family: ui-monospace, Consolas, monospace; font-size: .75rem; word-break: break-all; resize: none; }
/* simple wrapping rows instead of CSS grid, so very old browsers lay these out too */
.names { display: flex; flex-wrap: wrap; margin: 6px -4px 0; }
.names > .inp { width: calc(50% - 8px); margin: 4px; }

/* progress */
.stats { display: flex; flex-wrap: wrap; margin: -4px; }
.stat { background: rgba(0,0,0,.2); border-radius: 12px; padding: 10px 6px; text-align: center; width: calc(33.33% - 8px); margin: 4px; }
.stat b { display: block; font-size: 1.375rem; color: var(--gold-t); }
.stat span { font-size: .75rem; color: var(--muted); }
.backs { display: flex; flex-wrap: wrap; margin: -4px -4px 6px; }
.bk { background: rgba(0,0,0,.2); border: 2px solid transparent; border-radius: 12px; padding: 8px 4px; font-size: .75rem; display: flex; flex-direction: column; align-items: center; width: calc(25% - 8px); min-width: 64px; margin: 4px; flex-grow: 1; }
.bk > * + * { margin-top: 4px; }
.bk { overflow-wrap: anywhere; text-align: center; }
.bk.on { border-color: var(--gold); }
.bk small { color: var(--muted); }
.bk .mini-back { width: 34px; height: 48px; }

/* card backs (CSS only, original pattern) */
.back { border-radius: 8px; border: 2px solid var(--cream); }
.back-green { background: repeating-linear-gradient(45deg, #12603b 0 6px, #0c4429 6px 12px), #12603b; }
.back-indigo { background: repeating-linear-gradient(45deg, #2b3a8c 0 5px, #1d2763 5px 10px, #f4f1e8 10px 11px), #2b3a8c; }
.back-gold { background: repeating-linear-gradient(90deg, #d99a1b 0 6px, #1d1d1d 6px 9px, #2f9e5b 9px 13px, #c0392b 13px 16px), #d99a1b; }
.back-red { background: radial-gradient(circle at 50% 50%, #e8604c 0 22%, transparent 23%) 0 0/14px 14px, #9b2318; }
.mini-back { display: inline-block; width: 13px; height: 18px; border-radius: 3px; border-width: 1.5px; vertical-align: -3px; }

/* game table: any size, any orientation.
   Tall screens: one column (table, then your hand). Wide screens (sideways phone, tablet, PC, TV): table on the
   left, your hand on the right. app.js scales the whole page for very small or very big screens (--app-h is the
   visible height in page units) and sizes the hand's cards from the space that is really there (fitHand). */
#app.scr-game { max-width: none; }
.scr-game { height: 100vh; height: var(--app-h, 100vh); overflow: hidden; }
.table { display: flex; flex-direction: column; height: 100%; max-width: 1400px; margin: 0 auto; padding: 6px 8px 8px; padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
.side-a, .side-b { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.side-a { flex: 0 0 auto; }
.side-b { flex: 1 1 auto; margin-top: 4px; }
.side-a > * + *, .side-b > * + * { margin-top: 4px; }
/* .wide is set by app.js (screen wider than tall AND enough page width for two columns) */
.wide .table { flex-direction: row; }
.wide .side-a { flex: 1 1 52%; }
.wide .side-b { flex: 1 1 48%; margin-top: 0; margin-left: 10px; }
/* wide: seats at the top, piles + turn text grouped together in the middle of the free space */
.wide .side-a .center { margin-top: auto; }
.wide .side-a .status { margin-bottom: auto; }
.wide .side-a .center + .pend-row, .wide .side-a .pend-row + .status { margin-top: 8px; }
.topbar { display: flex; align-items: center; }
.topbar > * + * { margin-left: 6px; }
.topbar .rd { flex: 1; font-weight: 600; color: var(--muted); }
.lock { background: rgba(0,0,0,.25); border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; font-family: ui-monospace, Consolas, monospace; font-size: .75rem; min-height: 42px; }
.opps { display: flex; flex-wrap: wrap; justify-content: center; margin: -3px; }
.opps > .seat { margin: 3px; }
.seat { background: rgba(0,0,0,.22); border: 2px solid transparent; border-radius: 12px; padding: 5px 6px; width: calc(33.3% - 6px); min-width: 96px; max-width: 220px; display: flex; align-items: center; transition: border-color .2s; }
.opps.n1 .seat { width: 60%; }
.opps.n2 .seat { width: calc(50% - 6px); }
.seat .av { margin-right: 6px; }
.seat .info { min-width: 0; flex: 1 1 auto; }
.seat .nm { display: block; font-weight: 600; font-size: .8125rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat .cnt { display: block; }
.seat .cnt { font-size: .8125rem; color: var(--muted); }
.seat.on { border-color: var(--gold); box-shadow: 0 0 12px rgba(242,182,50,.45); }
.seat.away { opacity: .6; }
.lc { color: #ffcf5a; font-size: .625rem; letter-spacing: .5px; }
.tagbot { background: rgba(255,255,255,.15); border-radius: 6px; padding: 0 4px; font-size: .625rem; font-weight: 600; }
.av { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; flex: none; border: 2px solid rgba(255,255,255,.6); }
.av.xl { width: 72px; height: 72px; font-size: 2rem; }

.center { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; min-height: 130px; }
.center > * + * { margin-left: 26px; }
.pile { width: 82px; height: 115px; position: relative; padding: 0; }
.market { display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; box-shadow: 3px 3px 0 #08301d, 6px 6px 0 #062616; }
.market b { font-size: 1.5rem; background: rgba(0,0,0,.45); border-radius: 8px; padding: 0 8px; }
.market small { max-width: 92%; overflow: hidden; white-space: nowrap; text-overflow: clip; font-size: .625rem; letter-spacing: 1px; background: rgba(0,0,0,.45); border-radius: 6px; padding: 1px 5px; margin-top: 4px; }
.market:disabled { opacity: 1; filter: saturate(.8); }
.discard .card { width: 82px; display: block; filter: drop-shadow(0 4px 6px rgba(0,0,0,.4)); }
.card.fresh { animation: land .28s ease-out; }
@keyframes land { from { transform: translateY(-40px) scale(1.15) rotate(-8deg); opacity: .3; } to { transform: none; opacity: 1; } }
.need { position: absolute; left: 50%; bottom: -14px; transform: translateX(-50%); background: var(--gold); color: var(--ink); border-radius: 12px; padding: 2px 10px; font-weight: 800; white-space: nowrap; display: flex; align-items: center; font-size: .8125rem; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.sico { width: 16px; height: 16px; }
.pend-row { text-align: center; }
.pend { display: inline-block; background: #c0392b; color: #fff; font-weight: 800; border-radius: 14px; padding: 2px 14px; animation: pulse 1s infinite alternate; }
@keyframes pulse { to { transform: scale(1.08); } }
.status { text-align: center; color: var(--muted); min-height: 22px; font-size: .875rem; }
.status.mine { color: #fff; font-weight: 700; }
.need .sico { margin-left: 4px; }
.mebar > * + * { margin-left: 8px; }
.mebar { display: flex; align-items: center; background: rgba(0,0,0,.25); border: 2px solid transparent; border-radius: 14px; padding: 5px 6px; }
.mebar.on { border-color: var(--gold); }
.mebar .nm { flex: 0 1 auto; font-weight: 600; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mebar .btn { white-space: nowrap; }
.mebar .mycnt { flex: none; font-weight: 600; margin-left: 4px; } /* the count stays visible, only the name is cut */
.mebar .acts { display: flex; margin-left: auto; flex: none; } /* name and count stay together on the left */
.mebar .acts > * + * { margin-left: 6px; }
/* the sticker tray gives way (scrolls) before the hand does */
/* the ✕ stays put on the left; only the list of stickers scrolls */
.stickers { display: flex; align-items: flex-start; padding: 4px 0; flex: 0 1 auto; min-height: 50px; overflow: hidden; }
.stickers > .st-close { flex: none; margin: 3px; }
.st-list { display: flex; flex-wrap: wrap; flex: 1 1 auto; min-width: 0; align-self: stretch; overflow-y: auto; }
.st-list > button { margin: 3px; }
.stickers button { background: var(--cream); color: var(--ink); border: 0; border-radius: 16px; padding: 6px 10px; font-weight: 700; font-size: .8125rem; min-height: 42px; }

/* the hand takes all the room left; app.js (fitHand) sets each card's width and overlap so all cards fit */
.hand { flex: 1 1 auto; min-height: 80px; display: flex; flex-wrap: wrap; justify-content: center; align-content: flex-start; padding: 8px 4px 2px; overflow-y: auto; }
.hand .card { background: none; border: 0; padding: 0; width: 56px; transition: transform .12s; position: relative; border-radius: 10px; margin: 3px 2px; }
.hand .card svg { display: block; width: 100%; height: auto; }
.hand .card.ok { transform: translateY(-6px); }
.hand .card.glow { box-shadow: 0 0 0 3px var(--gold), 0 0 14px 3px rgba(242,182,50,.7); }
.hand .card.dim { filter: brightness(.72); }
.hand .card.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.covered-note { margin: auto; color: var(--muted); }

/* overlays */
/* pop-ups sit above speech bubbles and stickers (#fx, 30), below the ad (40) and toasts (50) */
.ovl { position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 35; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 16px; width: 100%; max-width: 420px; max-height: 100%; overflow-y: auto; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.panel.wide { max-width: 500px; text-align: left; }
.panel h2 { font-size: 1.25rem; }
.cover { background: var(--felt-d); }
/* pop-ups over the table use the player's own text size even where the table itself could not grow (app.js --pfs) */
.scr-game .ovl { zoom: var(--pfs, 1); }
.warn-text { color: #ffb4a8; font-weight: 700; }
.shapes { display: flex; flex-wrap: wrap; justify-content: center; margin: 12px -3px; }
.shapes > .shape-btn { flex: 1 1 52px; margin: 3px; min-height: 64px; }
.shape-btn { background: var(--cream); color: var(--ink); border: 0; border-radius: 12px; padding: 8px 2px; display: flex; flex-direction: column; align-items: center; font-size: .6875rem; font-weight: 700; }
.shape-btn .big { width: 36px; height: 36px; margin-bottom: 4px; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .75rem; word-break: break-all; background: rgba(0,0,0,.25); border-radius: 8px; padding: 8px; }

/* results: card-by-card count */
.res-row { background: rgba(0,0,0,.2); border-radius: 12px; padding: 8px 10px; margin: 8px 0; border: 2px solid transparent; }
.res-row.won { border-color: var(--gold); }
.res-head { display: flex; align-items: center; }
.res-head > * + * { margin-left: 8px; }
.res-head .pts { margin-left: auto; font-weight: 800; color: var(--gold-t); font-size: 1.0625rem; flex: none; }
/* long names without spaces are cut with "…" instead of pushing points off the panel */
.res-head b, .st-row span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-head .av, .res-head .crown, .st-row span:last-child { flex: none; }
.st-row span:first-child { margin-right: 8px; }
.res-head .av { width: 28px; height: 28px; font-size: .8125rem; }
.crown { font-size: .75rem; color: var(--gold-t); margin-right: 8px; }
.res-cards { display: flex; flex-wrap: wrap; margin-top: 6px; }
.res-cards > * { margin: 0 6px 6px 0; }
.rc { display: inline-flex; flex-direction: column; align-items: center; width: 40px; font-size: .6875rem; }
.rc .run { color: var(--gold-t); font-weight: 700; }
.mini-face { display: inline-block; width: 34px; }
.mini-face svg { display: block; width: 100%; height: auto; }
.sum { margin-top: 6px; font-size: .875rem; color: #e8efe9; }
.sum b { color: var(--gold-t); }
.none { color: var(--muted); font-size: .8125rem; }
.anim .rc, .anim .sum { animation: pop .3s backwards; }
@keyframes pop { from { opacity: 0; transform: scale(.4) translateY(8px); } to { opacity: 1; transform: none; } }
.standings { background: rgba(0,0,0,.2); border-radius: 12px; padding: 4px 10px; }
.st-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); }
.st-row:last-child { border-bottom: 0; }
/* narrow rows / big text: the points go under the name rather than cutting the name down to "Em…" */
.st-row { flex-wrap: wrap; }
.st-row span:first-child { flex: 1 1 auto; min-width: 6em; }
.st-row span:last-child { margin-left: auto; }
.st-row.won { color: var(--gold-t); font-weight: 700; }
.fair { display: block; width: 100%; text-align: left; background: rgba(47,158,91,.22); border: 1px solid #2f9e5b; border-radius: 12px; padding: 10px; margin: 12px 0 4px; }
.fair.bad { background: rgba(192,57,43,.3); border-color: #c0392b; }
.checks { padding-left: 4px; list-style: none; }
.dh { background: rgba(0,0,0,.2); border-radius: 12px; padding: 8px; margin: 6px 0; }
.row-cards { display: flex; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.row-cards > * { margin: 0 3px 3px 0; }
.row-cards small { width: 46px; color: var(--muted); }
.row-cards .mini-face { width: 26px; }
.deckgrid { display: flex; flex-wrap: wrap; margin: -3px -2px; }
.deckgrid > .dk { width: 38px; margin: 3px 2px; }
.dk { display: flex; flex-direction: column; align-items: center; font-size: .625rem; color: var(--muted); }
.dk .mini-face { width: 32px; }
.dk i { font-style: normal; color: #fff; border-radius: 6px; padding: 0 4px; font-size: .625rem; font-weight: 700; margin-top: 1px; }
.dk i.st { background: var(--gold); color: #2a1c00; }
.dk i.mk { background: rgba(255,255,255,.15); }

/* lobby */
.invite { background: rgba(0,0,0,.2); border-radius: 14px; padding: 10px 12px; }
.link { display: block; font-size: .6875rem; color: var(--muted); word-break: break-all; margin-top: 6px; }
.vlist { list-style: none; padding: 0; margin: 8px 0; }
.vl > * + * { margin-left: 6px; }
.vl { display: flex; align-items: center; background: rgba(0,0,0,.2); border: 2px solid transparent; border-radius: 12px; padding: 6px 8px; margin: 6px 0; }
.vl.rec { border-color: #e3685a; }
.vt { flex: 1; min-width: 0; }
.vt b { display: block; }
.vt small { color: var(--muted); }
.wincard { display: block; width: 62%; max-width: 260px; margin: 8px auto; border-radius: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.5); }
.qr-toggle { width: 100%; margin-top: 8px; }
.qr-box { text-align: center; margin-top: 8px; }
#qr { width: 220px; max-width: 70%; margin: 0 auto; background: #fff; border-radius: 12px; padding: 6px; }
#qr svg { display: block; width: 100%; height: auto; }
.seatlist { list-style: none; padding: 0; margin: 0; }
.seatlist li > * + * { margin-left: 10px; }
.seatlist li { display: flex; align-items: center; padding: 8px; background: rgba(0,0,0,.18); border-radius: 12px; margin: 6px 0; }
.seatlist .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seatlist li > .btn, .seatlist li > .dot, .seatlist .tags { flex: none; }
.seatlist .tags:empty { display: none; }
.seatlist small { color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #777; }
.dot.up { background: #3ddc84; }

/* fx: speech bubbles + stickers (pointer-events off so they never block cards) */
#fx { position: fixed; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; z-index: 30; }
.bubble { max-width: calc(100% - 8px); white-space: normal; text-align: center; position: fixed; background: var(--cream); color: #3b0b13; font-weight: 800; padding: 6px 12px; border-radius: 16px; font-size: .875rem; box-shadow: 0 3px 10px rgba(0,0,0,.4); animation: bub 2.1s forwards; }
.bubble.down { transform: translate(-50%, 0); }
.bubble.up { transform: translate(-50%, -100%); }
@keyframes bub { 0% { opacity: 0; } 8% { opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; } }
.sticker { position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%) rotate(-6deg); background: var(--gold); color: #3b0b13; border: 4px solid var(--cream); border-radius: 18px; padding: 10px 18px; font-size: 1.5rem; font-weight: 900; text-align: center; max-width: 86%; box-shadow: 0 8px 24px rgba(0,0,0,.5); animation: stick 1.4s forwards; }
.sticker.small { font-size: 1.125rem; background: var(--cream); }
.sticker.win { background: #3ddc84; font-size: 1.75rem; }
@keyframes stick { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.3) rotate(-20deg); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.1) rotate(-6deg); } 25% { transform: translate(-50%, -50%) scale(1) rotate(-6deg); } 85% { opacity: 1; } 100% { opacity: 0; } }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); background: #1d1d1d; color: #fff; border-radius: 12px; padding: 10px 14px; opacity: 0; transition: .2s; z-index: 50; max-width: 90%; text-align: center; pointer-events: none; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#conn { position: fixed; top: 0; left: 0; right: 0; background: #c0392b; color: #fff; text-align: center; padding: 6px; font-weight: 700; z-index: 60; transform: translateY(-100%); transition: transform .2s; }
#conn.show { transform: none; }

/* ads (mock) */
.ad-banner { margin-top: 14px; border: 1px dashed rgba(255,255,255,.35); border-radius: 10px; padding: 8px 10px; font-size: .75rem; color: var(--muted); }
.ad-tag { font-size: .625rem; letter-spacing: 1px; color: #ffd36b; font-weight: 700; }
.ad-overlay { position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(0,0,0,.85); z-index: 40; display: flex; align-items: center; justify-content: center; padding: 20px; }
.ad-box { background: #fff; color: #222; border-radius: 16px; padding: 16px; max-width: 360px; width: 100%; text-align: center; max-height: 100%; overflow-y: auto; }
.ad-box .ad-tag { color: #8a6100; }
.ad-art { background: linear-gradient(135deg, #fde3a7, #f7b2a0); border-radius: 12px; padding: 30px 12px; margin: 10px 0; display: flex; flex-direction: column; }
.ad-art > * + * { margin-top: 6px; }
.ad-art b { font-size: 1.25rem; }
.ad-close { background: #222; color: #fff; width: 100%; }

/* Height-based sizes use the html classes set by app.js from the visible height in page units
   (media queries would see the real screen, not the scaled page). */
.tall .pile, .tall .discard .card { width: 90px; }
.tall .pile { height: 126px; }
/* short screens (small phones, phones sideways, URL bar showing): smaller seats and piles */
.short .table { padding-top: 4px; }
.short .side-a > * + *, .short .side-b > * + * { margin-top: 2px; }
.short .seat { padding: 3px 5px; min-width: 86px; }
.short .seat .av { width: 26px; height: 26px; font-size: .75rem; border-width: 1px; }
.short .seat .nm, .short .seat .cnt { font-size: .75rem; }
.short .center { min-height: 92px; padding-bottom: 14px; } /* room for the "Need ●" badge */
.short .center > * + * { margin-left: 18px; }
.short .pile { width: 62px; height: 87px; }
.short .discard .card { width: 62px; }
.short .market b { font-size: 1.125rem; }
.short .mebar { padding: 3px 6px; }
.short .topbar .btn.icon, .short .lock { min-height: 40px; }
/* very short (phone sideways): the seats get even smaller */
.vshort .seat .cnt .mini-back { display: none; }
.vshort .center { min-height: 80px; padding-bottom: 12px; }
.vshort .pile { width: 52px; height: 73px; }
.vshort .discard .card { width: 52px; }
/* high-contrast modes (e.g. Windows "Contrast themes"): colours are replaced by system colours, so on/off,
   whose turn it is and playable cards are shown with borders and outlines instead of colour and glow */
@media (forced-colors: active) {
  .sw > span { border: 1px solid CanvasText; }
  .sw > span::after { background: CanvasText; forced-color-adjust: none; }
  .sw input:checked + span { background: Highlight; forced-color-adjust: none; }
  .sw input:checked + span::after { background: HighlightText; }
  .seat.on, .mebar.on, .res-row.won, .bk.on { border: 3px solid Highlight; }
  .seg button.on { background: Highlight; color: HighlightText; forced-color-adjust: none; }
  .hand .card.ok { outline: 3px solid Highlight; outline-offset: 1px; }
  .hand .card svg, .discard .card svg, .mini-face svg { forced-color-adjust: none; } /* card faces keep their own colours */
}
/* notched / rounded-corner screens (viewport-fit=cover): keep everything clear of the notch, the corners and the
   home bar, in any orientation (env() is 0 on screens without them, and ignored by browsers that lack it) */
/* the page may be scaled (zoom --z, set by app.js), the notch is not: insets are divided by it */
:root { --sat: calc(env(safe-area-inset-top, 0px) / var(--z, 1)); --sar: calc(env(safe-area-inset-right, 0px) / var(--z, 1));
        --sab: calc(env(safe-area-inset-bottom, 0px) / var(--z, 1)); --sal: calc(env(safe-area-inset-left, 0px) / var(--z, 1)); }
.screen { padding-top: calc(12px + var(--sat)); padding-left: calc(16px + var(--sal)); padding-right: calc(16px + var(--sar)); padding-bottom: calc(28px + var(--sab)); }
.table, .short .table { padding-top: calc(6px + var(--sat)); padding-left: calc(8px + var(--sal)); padding-right: calc(8px + var(--sar)); padding-bottom: calc(8px + var(--sab)); }
.short .table { padding-top: calc(4px + var(--sat)); }
.ovl, .ad-overlay { padding: calc(16px + var(--sat)) calc(16px + var(--sar)) calc(16px + var(--sab)) calc(16px + var(--sal)); }
#conn { padding-top: calc(6px + var(--sat)); pointer-events: none; }
/* while the "reconnecting" bar shows, the page starts below it */
.conn-down .table { padding-top: calc(var(--conn-h, 40px) + 6px); }
.conn-down .screen { padding-top: calc(var(--conn-h, 40px) + 12px); }
#toast { bottom: calc(24px + var(--sab)); }
/* card backs and the shape picker keep their look in high-contrast modes too */
@media (forced-colors: active) {
  .back { forced-color-adjust: none; }
  .shape-btn, .stickers button { border: 2px solid ButtonText; }
  .shape-btn .big { forced-color-adjust: none; }
}
/* mouse users: every tappable thing reacts under the pointer */
@media (hover: hover) and (pointer: fine) {
  .seg button:hover:not(.on), .stickers button:hover, .shape-btn:hover, .bk:hover, .lock:hover { filter: brightness(1.15); }
  .seg button:hover:not(.on) { background: rgba(255,255,255,.1); }
  .pile.market:not(:disabled):hover { filter: brightness(1.15); }
}
/* small piles: the MARKET label stays whole */
.short .market small, .vshort .market small { letter-spacing: 0; font-size: .5625rem; padding: 1px 3px; }
/* short screens: the sticker tray floats instead of taking the cards' room; its ✕ is always in view */
.short .stickers { position: fixed; left: calc(6px + var(--sal)); right: calc(6px + var(--sar)); bottom: calc(6px + var(--sab)); z-index: 15; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 4px; box-shadow: 0 6px 20px rgba(0,0,0,.5); }
.short .st-list { max-height: calc(var(--app-h, 100vh) * .4); }
/* very short: compact pop-ups so their buttons come into view sooner */
.vshort .panel { padding: 10px 12px; }
.vshort .panel h2 { font-size: 1.0625rem; }
.vshort .btn.big { padding: 9px; margin: 5px 0; font-size: .9375rem; }
/* people who ask their system for less motion get no animations */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
  /* their animation ends faded out: without it they simply show, and app.js removes them after 2 s */
  .bubble, .sticker { animation: none !important; }
}
@media (forced-colors: active) {
  .bubble, .sticker { border: 2px solid CanvasText; }
  /* playable cards already carry a Highlight outline: the focused one gets a different, dashed ring */
  html .hand .card:focus-visible { outline: 4px dashed CanvasText; outline-offset: 4px; } /* (html: wins over the general focus rule below) */
}
/* short screens: stickers ("Round 1!", "General market!") smaller so they cover less of the table */
.short .sticker { font-size: 1.125rem; padding: 6px 12px; border-width: 3px; }
.short .sticker.small { font-size: .9375rem; }
.short .sticker.win { font-size: 1.3125rem; }
/* very short screens: the results buttons scroll with the rest instead of taking half of the window */
.vshort .res-actions, .pshort .res-actions { position: static; margin: 10px 0 0; padding: 8px 0 0; }
/* pop-ups with little height left (big text on a small screen): compact, the two result buttons side by side */
.pshort .panel { padding: 10px 12px; }
.pshort .panel h2 { font-size: 1.0625rem; }
.pshort .res-actions { display: flex; }
.pshort .res-actions .btn { flex: 1 1 0; margin: 2px; padding: 8px 4px; font-size: .9375rem; }
/* card-by-card rows: with big text the points go under the name instead of squeezing it to "…" */
.res-head { flex-wrap: wrap; }
.res-head b { flex: 1 1 auto; min-width: 5em; }
/* focus ring: dark on the white ad box; inside the option rows (which clip their edges) drawn inside the button */
.ad-box .btn:focus-visible { outline-color: #222; }
/* match standings: points may go under a long name, and wrap rather than run off the panel */
.st-row span:last-child { flex: 0 1 auto; min-width: 0; text-align: right; overflow-wrap: anywhere; }
/* deck view: players' colours as a dot, the name in light text (readable on the dark panel) */
.pdot { display: inline-block; width: .7em; height: .7em; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
/* the WhatsApp button's small line stays readable on green */
.btn.wa small { opacity: 1; }
/* wide screens: the hand sits in the middle of its column, cards a bit bigger (app.js fitHand) */
.wide .hand { align-content: center; }
/* no grey flash / double-tap zoom delay on taps (older mobile browsers) */
button, a, input, label { touch-action: manipulation; }
/* mouse users: a playable card lifts a little more under the pointer */
@media (hover: hover) and (pointer: fine) {
  .hand .card.ok:hover { transform: translateY(-10px); }
  .btn:hover { filter: brightness(1.1); }
}
.hand .card:focus-visible, .btn:focus-visible, .pile:focus-visible, .seg button:focus-visible, .lock:focus-visible,
.shape-btn:focus-visible, .bk:focus-visible, .fair:focus-visible, .stickers button:focus-visible, .vl button:focus-visible,
a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
/* your bar with big text: the name keeps at least a few letters; the buttons move under it when there is no room */
.mebar { flex-wrap: wrap; }
.mebar .nm { flex: 0 0 auto; max-width: 6em; }
/* results: Next / Home stay in reach at the bottom of the panel */
.res-actions { position: -webkit-sticky; position: sticky; bottom: -16px; margin: 12px -16px -16px; padding: 10px 16px 16px; background: var(--panel); border-top: 1px solid var(--line); }
.res-actions .btn { width: 100%; margin: 4px 0; }
/* (after the general focus rule) option rows clip their edges: their ring is drawn inside the button */
.seg button:focus-visible { outline-offset: -4px; }
.seg button.on:focus-visible { outline-color: #2a1c00; } /* dark ring on the gold (chosen) option */
/* a control reached with Tab is scrolled fully into view, with a little room around it */
button, a, input, textarea, .sw { scroll-margin: 24px; }
