:root {
  --bg: #0b1220; --panel: #131c31; --panel2: #1b2740; --line: #263352;
  --ink: #e8edf7; --muted: #9fb0cc; --accent: #4f8cff; --good: #37c26b;
  --bad: #ff5d6c; --gold: #ffcf5c; --red: #ff6b7a;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 700; letter-spacing: .3px; }
.top-right { display: flex; align-items: center; gap: 10px; }
.rules-btn { padding: 6px 12px; font-size: 13px; font-weight: 600; background: var(--panel2); }
.conn { font-size: 12px; padding: 3px 9px; border-radius: 999px; }
.conn--on { background: rgba(55,194,107,.16); color: var(--good); }
.conn--off { background: rgba(255,93,108,.16); color: var(--bad); }
main { padding: 16px; max-width: 720px; margin: 0 auto; }
.loading { color: var(--muted); text-align: center; padding: 40px; }

h1, h2, h3 { margin: 0 0 12px; }
.card-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 16px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input, select {
  width: 100%; padding: 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel2); color: var(--ink); font-size: 16px;
}
button {
  cursor: pointer; border: none; border-radius: 10px; padding: 12px 16px;
  font-size: 16px; font-weight: 600; background: var(--panel2); color: var(--ink);
  border: 1px solid var(--line); transition: transform .05s ease, background .15s;
}
button:active { transform: translateY(1px); }
button.primary { background: var(--accent); border-color: transparent; color: #fff; }
button.ghost { background: transparent; }
button:disabled { opacity: .4; cursor: not-allowed; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1; }
.spacer { height: 10px; }
.muted { color: var(--muted); }
.err { color: var(--bad); min-height: 20px; font-size: 14px; margin-top: 8px; }

/* ---- passkey auth: account bar + admin panel ---- */
.account-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 14px; margin-bottom: 14px; font-size: 14px; color: var(--muted);
}
.account-actions { display: flex; gap: 8px; }
button.mini { padding: 6px 12px; font-size: 13px; font-weight: 600; }
button.mini.danger { color: var(--bad); border-color: rgba(255,93,108,.4); }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--line); color: var(--muted); }
.tag-admin { color: var(--gold); background: rgba(255,207,92,.14); }
.tag-active { color: var(--good); background: rgba(55,194,107,.14); }
.tag-used { color: var(--muted); }
.tag-expired { color: var(--bad); background: rgba(255,93,108,.12); }
.admin-body h3 { margin: 0 0 10px; }
.admin-row { display: flex; gap: 8px; align-items: center; }
.admin-row select { width: auto; flex: 1; }
.admin-list { display: flex; flex-direction: column; gap: 8px; }
.admin-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; }
.admin-item code { background: var(--panel2); padding: 2px 6px; border-radius: 6px; font-size: 13px; }
.invite-link { display: flex; gap: 8px; margin-top: 6px; }
.invite-link input { font-size: 13px; }

/* lobby */
.code { font-size: 40px; font-weight: 800; letter-spacing: 8px; color: var(--gold); text-align: center; }
.qr { display: block; margin: 12px auto; width: 180px; height: 180px; border-radius: 12px; background: #fff; padding: 8px; }
.seatlist { display: grid; gap: 8px; }
.seat { display: flex; align-items: center; gap: 10px; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.seat .idx { width: 26px; height: 26px; border-radius: 50%; background: var(--line); display: grid; place-items: center; font-size: 13px; }
.seat .who { flex: 1; }
.seat .tag { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--line); color: var(--muted); }
.seat .tag.human { color: var(--good); background: rgba(55,194,107,.14); }
.seat .tag.ai { color: var(--accent); background: rgba(79,140,255,.14); }
.seat .tag.open { color: var(--gold); background: rgba(255,207,92,.14); }
.seatctl { display: flex; gap: 6px; }
.seatctl button { padding: 6px 10px; font-size: 13px; }
.seatctl button.on { background: var(--accent); color: #fff; border-color: transparent; }
.cfg-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 2px; }
.stepper { display: flex; align-items: center; gap: 12px; }
.stepper button { padding: 4px 14px; font-size: 18px; line-height: 1; }
.stepper span { min-width: 22px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

/* game */
.gamehead { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.trump { font-weight: 700; }
.players { display: grid; gap: 8px; margin: 12px 0; }
.pl { display: flex; align-items: center; gap: 10px; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.pl.turn { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.pl .nm { flex: 1; font-weight: 600; }
.pl .bt { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; }
.pl .sc { font-weight: 700; color: var(--gold); min-width: 34px; text-align: right; }
.pill { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--line); color: var(--muted); }
/* per-seat "last action" badge (Hand and Foot) — keeps opponent moves legible between renders */
.pl .act { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: rgba(79,140,255,.14);
  color: var(--accent); font-weight: 600; white-space: nowrap; }

.trick { min-height: 96px; display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap;
  background: rgba(255,255,255,.02); border: 1px dashed var(--line); border-radius: 12px; padding: 12px; margin: 12px 0; }
.trick .tp { text-align: center; }
.trick .tp small { display: block; color: var(--muted); font-size: 11px; margin-top: 4px; }
.trick .tp.win .pcard { outline: 3px solid var(--good); box-shadow: 0 0 14px rgba(55,194,107,.5); }
.trick .tp.win small { color: var(--good); font-weight: 700; }

.hand { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.pcard {
  min-width: 52px; height: 74px; border-radius: 10px; background: #f7fafc; color: #0b1220;
  border: 1px solid #cbd5e1; font-size: 22px; font-weight: 800; display: grid; place-items: center;
  padding: 0 8px; box-shadow: 0 2px 6px rgba(0,0,0,.3);
}
.pcard.red { color: #d21f3c; }
.pcard:disabled { opacity: .45; box-shadow: none; }
.pcard.play { cursor: pointer; }
.pcard.play:active { transform: translateY(2px); }
.pcard.sel { outline: 3px solid var(--accent); box-shadow: 0 0 12px rgba(79,140,255,.5); transform: translateY(-4px); }
.pcard.drew { position: relative; }
.pcard.drew::after { content: 'new'; position: absolute; top: -7px; right: -6px; font-size: 9px; font-weight: 800; letter-spacing: .3px; color: #0b1220; background: var(--gold); border-radius: 6px; padding: 1px 4px; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
/* ---- UNO (shared by Classic client/uno.js and Table client/uno-table.js) ---- */
.pcard.u-R { background: #d8112b; color: #fff; border-color: #a10d20; }
.pcard.u-Y { background: #f5b301; color: #3a2e00; border-color: #c99400; }
.pcard.u-G { background: #1aa64b; color: #fff; border-color: #127a37; }
.pcard.u-B { background: #1a72c4; color: #fff; border-color: #12558f; }
.pcard.u-W { background: conic-gradient(#d8112b 0 90deg, #1aa64b 90deg 180deg, #1a72c4 180deg 270deg, #f5b301 270deg 360deg); color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.75); border-color: #0b1220; }
.pcard.u-back { background: repeating-linear-gradient(45deg, #22314f 0 7px, #1a2740 7px 14px); color: #cdd8ee; border-color: #0b1220; }
.uno-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; font-size: 14px; }
.uno-color { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.uno-swatch { width: 18px; height: 18px; border-radius: 5px; border: 1px solid rgba(0,0,0,.35); display: inline-block; }
.uno-dir { font-size: 18px; }
.uno-players { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 12px; }
.uno-pl { flex: 1 1 120px; display: flex; align-items: center; gap: 10px; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.uno-pl.turn { outline: 2px solid var(--accent); box-shadow: 0 0 12px rgba(79,140,255,.35); }
.uno-pl .cnt { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.uno-pl .nm { flex: 1; min-width: 0; }
.uno-pl .act { font-size: 11px; color: var(--muted); }
.uno-center { display: flex; align-items: center; justify-content: center; gap: 22px; margin: 16px 0; }
.uno-pilelbl { display: block; text-align: center; color: var(--muted); font-size: 11px; margin-top: 4px; }
.uno-catch { background: rgba(255,207,92,.12); border: 1px solid var(--gold); border-radius: 12px; padding: 12px; margin: 12px 0; text-align: center; }
.uno-colorpick { display: flex; gap: 12px; justify-content: center; margin: 12px 0; }
.uno-colorpick button { width: 46px; height: 46px; border-radius: 10px; border: 2px solid rgba(255,255,255,.25); }
.uno-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 12px 0; }
.uno-call { background: var(--gold); color: #0b1220; font-weight: 800; letter-spacing: .3px; }
.uno-uno { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; border-radius: 999px; padding: 6px 14px; }
.uno-uno.called { color: var(--good); background: rgba(55,194,107,.12); border: 1px solid var(--good); }
.pcard.uno-armed { outline: 3px solid var(--gold); box-shadow: 0 0 14px rgba(255,207,92,.6); }
.melds-area { display: grid; gap: 6px; margin: 10px 0; }
.meldrow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.meldrow .who { font-size: 12px; color: var(--muted); min-width: 64px; }
.meldrow .book { color: var(--good); font-weight: 700; }
.meldrow .pcard { min-width: 30px; height: 42px; font-size: 15px; border-radius: 6px; box-shadow: none; }
.meldrow .clean { box-shadow: 0 0 0 2px rgba(255,93,108,.0); }
.hf-meld { border-radius: 8px; padding: 3px 6px; display: inline-flex; gap: 4px; align-items: center; }
.hf-meld.redh { background: rgba(255,93,108,.12); }
.hf-meld.blackh { background: rgba(160,160,170,.14); }
.hf-meld.addable { outline: 2px dashed var(--accent); cursor: pointer; }
.stockrow { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 10px 0; }
.stockrow .pile { text-align: center; }
.stockrow .pile small { display: block; color: var(--muted); font-size: 11px; margin-top: 4px; }
.win-need { font-size: 12px; color: var(--muted); }
/* Hand and Foot scoreboard */
.round-recap { max-width: 340px; margin: 6px auto; display: grid; gap: 4px; }
.re-row { display: flex; align-items: center; gap: 10px; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; }
.re-row > span:first-child { flex: 1; font-weight: 600; }
.re-row .good { color: var(--good); font-weight: 700; }
.re-row .bad { color: var(--bad); font-weight: 700; }
.re-row .re-tot { color: var(--gold); font-weight: 700; font-variant-numeric: tabular-nums; }
.bids { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.bids button { min-width: 48px; }
.log { margin-top: 14px; font-size: 13px; color: var(--muted); max-height: 260px; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.log div { padding: 2px 0; border-bottom: 1px solid rgba(255,255,255,.03); }
.banner { text-align: center; font-size: 20px; font-weight: 800; padding: 14px; border-radius: 12px;
  background: rgba(255,207,92,.12); color: var(--gold); margin: 10px 0; }
.hint { text-align: center; color: var(--muted); margin: 8px 0; }

/* rules modal */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(2px); }
.modal-card {
  position: relative; z-index: 1; width: 100%; max-width: 560px; max-height: 85vh; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; }
.modal-x { background: transparent; border: none; color: var(--muted); font-size: 18px; padding: 6px 10px; }
.modal-body { padding: 6px 20px 20px; overflow: auto; }
.modal-body h3 { margin: 18px 0 6px; color: var(--accent); font-size: 15px; }
.modal-body p { margin: 6px 0; color: var(--ink); }
.modal-body ul { margin: 6px 0; padding-left: 20px; }
.modal-body li { margin: 4px 0; color: var(--ink); }
.modal-body .k { color: var(--gold); font-weight: 700; }
.modal-body .s-red { color: var(--red); }

/* ============================================================================
   Table layout (Hand and Foot "Table" UI) — scoped under .gt-*; Classic untouched.
   ============================================================================ */
main:has(.gt-table) { max-width: none; padding: 0; }
main:has(.gt-table) > .row { padding: 8px 10px; margin-top: 0; }

/* in-game per-device view switch (Classic / Table) */
.viewswitch { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 12px; }
.viewswitch .seatctl button { padding: 6px 12px; font-size: 13px; }
main:has(.gt-table) > .viewswitch { padding: 0 10px 6px; }

.gt-table {
  display: flex; flex-direction: column; gap: 8px;
  min-height: calc(100dvh - 56px); padding: 8px 10px 0;
}
.gt-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.gt-need { font-size: 12px; }
.gt-panels-btn { padding: 4px 10px; font-size: 12px; }

/* seats */
.gt-arena { display: flex; flex-direction: column; gap: 8px; } /* portrait: opponents strip + felt flow */
.gt-opponents { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; padding-bottom: 2px; }
.gt-seat { position: relative; flex: 0 0 auto; min-width: 104px; background: var(--panel2); border: 1px solid var(--line);
  border-radius: 10px; padding: 6px 9px; }
.gt-seat.turn { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.gt-seat.you { background: var(--panel); border-color: rgba(79,140,255,.4); }
.gt-seat-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.gt-nm { font-weight: 600; }
.gt-seat-sub { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.gt-act-wrap { min-height: 18px; margin-top: 3px; }
.gt-act { font-size: 11px; font-weight: 600; color: var(--accent); background: rgba(79,140,255,.14);
  border-radius: 999px; padding: 1px 7px; white-space: nowrap; }

/* Action animation (see docs/ANIMATIONS.md). The per-seat FLIP anchor is an invisible, fixed point at
   the seat's centre that a played card flies from; put it inside any position:relative player card
   (.gt-seat, and the Classic .pl / .uno-pl / .hf-pl / .mj-pl / .lami-pl rows). `.flip-glow` is added by
   flip.js only when a card genuinely enters, so it fires once and never on unrelated re-renders. */
.pl, .uno-pl, .mj-pl, .lami-pl { position: relative; } /* contain the per-seat FLIP anchor */
.gt-flip-anchor { position: absolute; left: 50%; top: 50%; width: 1px; height: 1px;
  opacity: 0; pointer-events: none; }
@keyframes flipGlow {
  0%   { box-shadow: 0 0 0 0 rgba(79,140,255,0); }
  25%  { box-shadow: 0 0 14px 3px rgba(79,140,255,.75); }
  100% { box-shadow: 0 0 0 0 rgba(79,140,255,0); }
}
.flip-glow { animation: flipGlow .6s ease-out; border-radius: 8px; }

/* felt centre */
.gt-felt-ctl { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.gt-felt { display: flex; justify-content: center; align-items: flex-start; gap: 18px; }
.gt-pile { text-align: center; }
.gt-pile small { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.gt-back { background: #334155; color: #cbd5e1; }
.gt-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; align-items: center; }
.gt-actions button { min-width: 48px; }
.gt-hint { color: var(--muted); text-align: center; margin: 2px 0; font-size: 13px; }

/* meld shelf — compact tap-to-expand rank chips; the scrolling middle of the table */
.gt-melds { max-height: 42vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.gt-lane { display: flex; align-items: center; gap: 6px; overflow-x: auto; background: var(--panel2);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.22) transparent; }
.gt-lane::-webkit-scrollbar { height: 6px; }
.gt-lane::-webkit-scrollbar-thumb { background: rgba(255,255,255,.22); border-radius: 3px; }
.gt-lane::-webkit-scrollbar-track { background: transparent; }
/* the host's own meld strip: centred, growing both sides and wrapping to more lines as melds pile up */
.gt-lane.mine { border-color: rgba(79,140,255,.4); flex-wrap: wrap; justify-content: center; overflow: visible; }
.gt-lane.mine .gt-lane-lbl { flex-basis: 100%; text-align: center; }
/* Partners: opponent team's books — centred, wrapping (positioned at top-centre in landscape below). */
.gt-lane.lane-tc { flex-wrap: wrap; justify-content: center; overflow: visible; }
.gt-lane.lane-tc .gt-lane-lbl { flex-basis: 100%; text-align: center; }
.gt-lane-lbl { flex: 0 0 auto; font-size: 11px; color: var(--muted); white-space: nowrap; min-width: 72px; }
/* A meld = a book drawn as a fanned stack of its real cards + a rank·size tag (meldChip). A completed
   book gets a bold coloured frame — the only hickey signal (no "book" text): red = clean (red hickey),
   dark = dirty (black hickey). */
.gt-meld { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px 3px 5px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px; }
.gt-meld.clean { border: 2px solid var(--red); background: rgba(255,93,108,.14); }
.gt-meld.dirty { border: 2px solid #7f8794; background: rgba(120,128,140,.18); }
.gt-meld.addable { outline: 2px dashed var(--accent); outline-offset: 1px; cursor: pointer; }
/* the fan: naturals first, wilds (gold) on top; cards overlap so only the corner index shows */
.gt-book-fan { display: inline-flex; }
.gt-book-fan .pcard.sm { margin-left: -16px; justify-content: flex-start; align-items: flex-start;
  padding: 2px 0 0 3px; box-shadow: -1px 0 2px rgba(0,0,0,.45); }
.gt-book-fan .pcard.sm:first-child { margin-left: 0; box-shadow: none; }
.gt-book-fan .pcard.sm.wild { background: var(--gold); color: #3a2c00; border-color: #b8912f; font-weight: 800; }
/* completed books collapse to a squared-up stack: near-full overlap (a thin stacked edge), wilds
   underneath so the book's rank (a natural) sits on top — see the m.book sort in meldChip. */
.gt-meld.clean .gt-book-fan .pcard.sm, .gt-meld.dirty .gt-book-fan .pcard.sm { margin-left: -25px; }
.gt-meld.clean .gt-book-fan .pcard.sm:first-child, .gt-meld.dirty .gt-book-fan .pcard.sm:first-child { margin-left: 0; }
.gt-book-tag { display: inline-flex; align-items: baseline; gap: 3px; }
.gt-book-tag b { font-weight: 800; font-size: 16px; }
.gt-x { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.pcard.sm { min-width: 29px; height: 37px; font-size: 14px; font-weight: 700; border-radius: 5px; box-shadow: none;
  padding: 0 4px; display: inline-flex; align-items: center; justify-content: center; }

/* your seat + hand dock + action bar. Normal flow (no sticky) so it never overlaps the felt/melds;
   on tall phones the whole table fits, on short screens the page scrolls — nothing is clipped. */
.gt-you { display: flex; flex-direction: column; gap: 6px; padding: 6px 0; }
.gt-hand { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; padding: 4px 0; }
.gt-hand .pcard { flex: 0 0 auto; }
.gt-handbar { }

/* panels drawer (scores + action feed) */
.gt-panels { position: fixed; top: 46px; right: 0; bottom: 0; width: min(360px, 92vw); z-index: 20;
  background: var(--panel); border-left: 1px solid var(--line); overflow: auto; padding: 12px; }
.gt-panels-hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.gt-panels-x { background: transparent; border: none; color: var(--muted); font-size: 18px; padding: 4px 10px; }
.gt-score-row { display: flex; gap: 4px; align-items: center; padding: 2px 0; }
.gt-score-row > span { flex: 1; text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); }
.gt-score-row .nm { flex: 1.6; text-align: left; color: var(--ink); font-weight: 600; }
.gt-score-row .tot { color: var(--gold); font-weight: 700; }
.gt-score-head > span { color: var(--muted); font-weight: 600; }
.gt-score-row.mine .nm::after { content: ' ●'; color: var(--accent); font-size: 10px; }
.gt-log { margin-top: 12px; font-size: 12px; color: var(--muted); }
.gt-log div { padding: 2px 0; border-bottom: 1px solid rgba(255,255,255,.03); }

/* round / match end overlay */
.gt-overlay { position: fixed; inset: 46px 0 0 0; z-index: 25; display: grid; place-items: center;
  background: rgba(0,0,0,.5); backdrop-filter: blur(2px); }
.gt-overlay-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px 26px; text-align: center; max-width: 90vw; max-height: 86vh; overflow-y: auto; }
.gt-overlay-card .lami-reveal { text-align: left; width: min(560px, 84vw); margin: 12px auto 4px; }
.gt-overlay-t { font-size: 22px; font-weight: 800; color: var(--gold); }
.gt-overlay-s { color: var(--muted); margin-top: 8px; }
.gt-overlay-x { margin-top: 16px; padding: 8px 20px; font-weight: 700; }

/* landscape / wider: a round-oval table — opponents arced N/E/W around a central felt, piles in the
   middle, your hand docked below. (Base layout still flows/scrolls, so nothing clips.) */
@media (orientation: landscape) and (min-width: 720px) {
  .gt-table { padding: 10px 18px; gap: 10px; }
  .gt-felt { gap: 26px; }
  .gt-felt .pcard { height: 60px; min-width: 44px; font-size: 19px; }
  .gt-seat { min-width: 128px; }
}
/* Rectangular felt (tablets/desktop): a rounded-rectangle table reclaims the oval's dead corners,
   giving the central lay-down ~20% more usable width — the ellipse used to pinch inward exactly
   where the tiles live. Opponents hug the top edge and the two side-edge centres (table-style
   seating); your hand docks below the arena. Short phone-landscape keeps the simple flowing strip. */
@media (orientation: landscape) and (min-width: 820px) and (min-height: 480px) {
  .gt-arena { display: block; position: relative; min-height: 52vh; }
  .gt-arena::before { content: ''; position: absolute; inset: 2%; border-radius: 22px; z-index: 0;
    background: radial-gradient(ellipse 130% 130% at center, rgba(46,120,80,.22), rgba(20,44,32,.12) 72%, rgba(16,32,24,.10));
    border: 1px solid var(--line); box-shadow: inset 0 0 0 5px rgba(0,0,0,.10); }
  .gt-opponents { display: contents; }            /* let seats be positioned within the arena */
  .gt-arena .gt-seat { position: absolute; z-index: 2; }
  /* top edge (across / opposite) */
  .gt-seat.pos-n  { top: 6px; left: 50%; transform: translateX(-50%); }
  .gt-seat.pos-nw { top: 6px; left: 1.5%; }
  .gt-seat.pos-ne { top: 6px; right: 1.5%; }
  /* side edges, vertically centred — left / right players of a rectangular table */
  .gt-seat.pos-w  { left: 6px; top: 50%; transform: translateY(-50%); }
  .gt-seat.pos-e  { right: 6px; top: 50%; transform: translateY(-50%); }
  /* Mahjong wraps its seat card in .mj-opp and positions the WRAPPER; keep the inner card in normal
     flow so the seat card sits ABOVE its melds instead of overlapping them. */
  .gt-arena .mj-opp .gt-seat { position: static; }
  /* Lami lays the shared melds ON the felt — a wide well filling the rectangle BETWEEN the top seat
     and your hand. Anchored by a fixed top offset (clears the top card) + bottom, never centred, so a
     growing lay-down can't slide up under AI 2's card. Width leaves a ~150px rail for the side seats. */
  .gt-arena > .lami-tablemelds { position: absolute; top: 88px; bottom: 10px; left: 50%; transform: translateX(-50%);
    z-index: 1; width: min(72%, calc(100% - 300px)); overflow-y: auto; align-content: center; margin: 0; }
  /* piles centred in the rectangle; draw controls pinned to the bottom edge */
  .gt-arena > .gt-felt { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 1; }
  .gt-arena .gt-felt-ctl { position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%);
    z-index: 2; max-width: 92%; }
  .gt-arena .gt-felt-ctl .gt-actions { flex-wrap: nowrap; }
  .gt-arena .gt-felt-ctl .gt-actions .gt-hint { display: none; } /* drop the "Draw 2" label on the felt */
  .gt-arena .gt-felt-ctl button { padding: 8px 12px; font-size: 14px; white-space: nowrap; }

  /* opponent melds float on the table by their seat; your team's melds are the strip below the felt.
     Override the base max-height:42vh so this positioning layer actually fills the arena — otherwise
     the lanes' % offsets resolve against a short box and the side lanes ride up onto the seats. */
  .gt-arena .gt-melds { position: absolute; inset: 0; max-height: none; z-index: 3; pointer-events: none; gap: 0; }
  .gt-arena .gt-lane { position: absolute; pointer-events: auto; max-width: 30%;
    background: rgba(19,28,49,.92); }
  .gt-arena .gt-lane-lbl { min-width: 0; }
  /* top-centre opponent (solo): the top corners are free (side seats sit at mid-height), so this lane
     can be wide — fits the larger books in one row without a scrollbar in the common case. */
  .gt-lane.lane-n  { top: 90px; left: 50%; transform: translateX(-50%); max-width: 72%; }
  .gt-lane.lane-nw { top: 90px; left: 3%; }
  .gt-lane.lane-ne { top: 90px; right: 3%; }
  /* Partners opponent team: books start centred below the top seat and expand sideways + downwards.
     Capped so it never reaches the (lowered) piles; the felt drops for it via .hf-partners below. */
  .gt-lane.lane-tc { top: 92px; left: 50%; transform: translateX(-50%); max-width: 66%;
    max-height: 38%; overflow-y: auto; }
  .gt-arena.hf-partners > .gt-felt { top: 74%; }
  /* side teams (W/E): a wrapped meld column beside their seat, just below it (the seat is at mid-height) */
  .gt-lane.lane-w  { left: 4px; top: 63%; max-width: 33%; flex-wrap: wrap; justify-content: flex-start; overflow: visible; }
  .gt-lane.lane-e  { right: 4px; top: 63%; max-width: 33%; flex-wrap: wrap; justify-content: flex-start; overflow: visible; }
  .gt-lane.lane-w .gt-lane-lbl, .gt-lane.lane-e .gt-lane-lbl { flex-basis: 100%; }
}

/* ================= Texas Hold'em (Classic client/holdem.js + Table client/holdem-table.js) ======== */
/* Reuses the `.pcard` card faces and the `.gt-*` table primitives; only the centre (board + pot) and
   the betting action bar are poker-specific. */
.holdem-center { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.holdem-classic-center { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 10px 0; }
.holdem-pot { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.holdem-pot-n { font-size: 22px; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }
.holdem-pot small { color: var(--muted); font-size: 11px; }
.holdem-board { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.holdem-slot { opacity: .3; border-style: dashed; background: transparent; box-shadow: none; }
.holdem-hole { justify-content: center; }
.holdem-oppcards { display: flex; gap: 3px; margin-top: 4px; align-items: center; flex-wrap: wrap; }
.holdem-handname { font-size: 10px; color: var(--muted); margin-left: 2px; }
.holdem-btn-pill { background: var(--gold); color: #0b1220; font-weight: 800; }
.holdem-dim { opacity: .5; }
.holdem-reveal { display: flex; flex-direction: column; gap: 4px; align-items: center; margin: 8px 0; }
.holdem-reveal-row { display: flex; align-items: center; gap: 4px; }
.holdem-result { text-align: center; color: var(--ink); background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 12px; margin: 8px auto; display: flex; flex-direction: column; gap: 3px; max-width: 92%; }
.holdem-result small { color: var(--muted); }
/* betting action bar: Fold / Check·Call buttons + a Bet/Raise slider with quick sizes */
.holdem-actions { align-items: center; }
.holdem-raise { display: flex; flex-direction: column; align-items: center; gap: 6px; background: var(--panel2);
  border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; width: min(420px, 96%); }
.holdem-raise-lbl { font-size: 13px; color: var(--muted); }
.holdem-raise-lbl b { color: var(--ink); font-size: 16px; font-variant-numeric: tabular-nums; }
.holdem-slider { width: 100%; accent-color: var(--accent); }
.holdem-quick { display: flex; gap: 6px; }
.holdem-quick button { padding: 5px 10px; font-size: 12px; background: var(--panel); }
.holdem-go { min-width: 90px; }
.holdem-next { margin-top: 14px; padding: 8px 20px; font-weight: 700; }
/* between-hand summary overlay */
.holdem-summary { width: min(560px, 92vw); }
/* Classic layout reuses the summary blocks inline (not in an overlay card) — centre them. */
.holdem-summary-classic { text-align: center; margin: 8px 0 4px; }
.holdem-summary-classic .holdem-summary-pots { align-items: center; }
.holdem-summary-board { margin: 12px 0 10px; }
.holdem-summary-pots { color: var(--ink); font-weight: 600; display: flex; flex-direction: column; gap: 4px; }
.holdem-summary-hands { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.holdem-summary-hand { display: flex; align-items: center; gap: 4px; justify-content: center;
  padding: 4px 8px; border-radius: 8px; }
.holdem-summary-hand.win { background: rgba(255,207,92,.14); border: 1px solid var(--gold); }
/* final standings (match end) */
.holdem-standings { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; width: min(360px, 90%); margin-left: auto; margin-right: auto; }
.holdem-standings-classic { margin-top: 10px; }
.holdem-standings-row { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 8px;
  background: var(--panel2); border: 1px solid var(--line); }
.holdem-standings-row.win { background: rgba(255,207,92,.14); border-color: var(--gold); }
.holdem-rank { min-width: 20px; text-align: center; font-weight: 800; color: var(--muted); }
.holdem-standings-row.win .holdem-rank { color: var(--gold); }
.holdem-standings-nm { flex: 1; text-align: left; font-weight: 600; }
.holdem-standings-chips { font-weight: 800; font-variant-numeric: tabular-nums; }
/* landscape felt: centre the board + pot in the rectangle, clear of the ~150px side rails */
@media (orientation: landscape) and (min-width: 820px) and (min-height: 480px) {
  .gt-arena > .holdem-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    z-index: 1; width: min(62%, calc(100% - 320px)); }
  .holdem-board .pcard { height: 58px; min-width: 42px; font-size: 18px; }
}

/* ================= Mahjong (Classic client/mahjong.js + Table client/mahjong-table.js) ============ */
/* Tiles as CSS/text `.mtile` (the Mahjong Unicode block renders inconsistently on phones), reusing
   the `.pcard` sizing vocabulary. */
.mtile {
  /* Fixed width AND height (both derived from --mt-h) so EVERY tile is identical, regardless of its
     content — the pip grid must never dictate tile size. box-sizing keeps border/padding inside. */
  --mt-h: 56px; width: calc(var(--mt-h) * .76); height: var(--mt-h); box-sizing: border-box;
  flex: 0 0 auto; /* as a flex item (hand/meld/pond are flex) keep the fixed width — never size to content */
  border-radius: 8px; background: #f7fafc; color: #14203a; border: 1px solid #cbd5e1; border-bottom-width: 3px;
  font-size: 22px; font-weight: 800; line-height: 1; display: inline-grid; place-items: center;
  padding: 0; box-shadow: 0 2px 5px rgba(0,0,0,.28); user-select: none;
}
.mtile i { font-style: normal; font-size: 12px; opacity: .8; margin-left: 1px; }
.mtile.wind { color: #1a2440; font-size: 24px; } /* dark, like the printed winds */
.mtile.dragon.r { color: #d21f3c; }
.mtile.dragon.g { color: #1aa64b; }
/* Dots — real pip circles. Pip size is a fraction of the tile height (var(--mt-h)) so pips scale
   with the tile in every context and never overflow the fixed-height tile. Per-rank colours (r/g/b,
   plus the ornate multi-toned 1-dot) echo a printed Cantonese set. */
/* The pip area is a FIXED-size grid centred in the tile (never width:100%, which would let a wide
   rank stretch the tile). Pip diameter is a fraction of the tile height. */
.pips { display: grid; grid-template-columns: repeat(3, 1fr); place-items: center;
  width: calc(var(--mt-h) * .64); height: calc(var(--mt-h) * .86); }
.pip { --pf: .2; width: calc(var(--mt-h) * var(--pf)); height: calc(var(--mt-h) * var(--pf));
  border-radius: 50%; margin: 0; opacity: 1; box-shadow: 0 0 0 .5px rgba(0,0,0,.3) inset; }
.mtile.dot.p7 .pip { --pf: .16; }              /* 5 rows → smaller pips to fit */
.mtile.dot.p8 .pip { --pf: .17; }              /* 4 rows */
.pip.g { background: radial-gradient(circle at 42% 38%, #eafff2 0 15%, #23b158 22% 54%, #0f7a37 60% 100%); }
.pip.b { background: radial-gradient(circle at 42% 38%, #eaf3ff 0 15%, #2f86d6 22% 54%, #12558f 60% 100%); }
.pip.r { background: radial-gradient(circle at 42% 38%, #ffedf0 0 15%, #e5384b 22% 54%, #b01020 60% 100%); }
/* The 1-dot is a single big pip: use a plain centred flex (not the 3-col grid, whose equal 1fr
   tracks would stretch to the big pip's width and widen the whole tile). */
.mtile.dot.p1 .pips { display: flex; align-items: center; justify-content: center; }
.mtile.dot.p1 .pip { --pf: .42;                /* the big ornate single dot: red core, green mid, blue rim */
  background: radial-gradient(circle at 50% 50%, #ffdede 0 10%, #d21f3c 13% 33%, #23b158 39% 61%, #2f86d6 67% 100%); }
/* White dragon 白板 — a blank tile with an L-frame: left+bottom green, top+right red (no character). */
.mtile.dragon.w .wd { display: block; width: calc(var(--mt-h) * .4); height: calc(var(--mt-h) * .6);
  border: 2px solid; border-top-color: #d21f3c; border-right-color: #d21f3c;
  border-bottom-color: #1aa64b; border-left-color: #1aa64b; border-radius: 2px; }
/* Flowers 梅蘭菊竹 (green) / Seasons 春夏秋冬 (red), with a small corner index. */
.mtile.flower { position: relative; font-size: 21px; }
.mtile.flower.fset { color: #1aa64b; }
.mtile.flower.sset { color: #d21f3c; }
.mtile.flower .fl-num { position: absolute; top: 2px; left: 4px; font-size: 9px; opacity: .7; margin: 0; }
/* Animals: SVG silhouettes coloured via currentColor — cat 貓 (green) · rat 鼠 (blue) ·
   rooster 雞 (red) · centipede 蜈 (purple). Sized off the tile height so they scale everywhere. */
.mtile.animal .asvg { display: block; height: calc(var(--mt-h) * .82); width: calc(var(--mt-h) * .68); }
.mtile.animal.a1 { color: #1aa64b; }
.mtile.animal.a2 { color: #2f86d6; }
.mtile.animal.a3 { color: #d21f3c; }
.mtile.animal.a4 { color: #8a5cd6; }
.mtile.joker { color: #d21f3c; font-weight: 900; font-size: 24px; } /* Fei 飛 — red, like a real set */
.mtile.back { background: repeating-linear-gradient(45deg, #22314f 0 7px, #1a2740 7px 14px); color: transparent; border-color: #0b1220; }
.mtile.latest { outline: 3px solid var(--gold); box-shadow: 0 0 12px rgba(255,207,92,.6); }
.mtile.play { cursor: pointer; }
.mtile.play:active { transform: translateY(2px); }
.mtile.play:hover { border-color: var(--accent); }

.mmeld { display: inline-flex; gap: 2px; padding: 2px; border-radius: 8px; background: rgba(255,255,255,.04); }
.mmeld .mtile { --mt-h: 40px; min-width: 28px; font-size: 16px; box-shadow: none; border-bottom-width: 2px; }
.mmeld.concealed { outline: 1px dashed var(--line); }
/* Just-drawn tile: a small "new" badge in the hand (mirrors Hand and Foot's .pcard.drew). */
.mtile.drew { position: relative; }
.mtile.drew::after { content: 'new'; position: absolute; top: -7px; right: -6px; font-size: 9px; font-weight: 800;
  letter-spacing: .3px; color: #0b1220; background: var(--gold); border-radius: 6px; padding: 1px 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,.4); z-index: 3; }
/* Winning hand revealed on the round-over screen (below the banner). */
.mj-winhand { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; justify-content: center; margin: 8px 0; }
.mj-winhand-tiles { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; }

/* ---- Classic ---- */
.mj-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.mj-wind { color: var(--gold); font-weight: 700; }
/* Scores drawer toggle in the classic Mahjong/Lami/UNO headers — pin to the right edge. */
.mj-scores-btn, .lami-scores-btn, .uno-scores-btn { margin-left: auto; }
/* Mahjong per-hand score breakdown (Hand-and-Foot style): a sideways-scrolling delta matrix. A real
   table so every column shares one width across rows; numbers are tabular + right-aligned. */
.mj-scorewrap { overflow-x: auto; }
.mj-scoretable { border-collapse: collapse; width: 100%; font-size: 12px; }
.mj-scoretable th, .mj-scoretable td { padding: 3px 7px; text-align: right; white-space: nowrap;
  font-variant-numeric: tabular-nums; }
.mj-scoretable thead th { color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); }
.mj-scoretable tbody tr + tr td { border-top: 1px solid rgba(255,255,255,.04); }
.mj-scoretable .nm { text-align: left; color: var(--ink); font-weight: 600;
  position: sticky; left: 0; background: var(--panel); }
.mj-scoretable th.tot, .mj-scoretable td.tot { color: var(--gold); font-weight: 700; }
.mj-scoretable thead th.tot { color: var(--muted); font-weight: 600; }
.mj-scoretable th.mj-h.wash { color: var(--gold); }
.mj-scoretable td.up { color: var(--good); }
.mj-scoretable td.down { color: var(--bad); }
.mj-scoretable td.win { color: var(--gold); font-weight: 700; }
.mj-scoretable td.zero { color: var(--muted); }
.mj-scoretable tr.mine .nm::after { content: ' ●'; color: var(--accent); font-size: 10px; }
.mj-scoresum { margin-top: 12px; font-size: 12px; color: var(--muted); }
.mj-scoresum-hd { font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.mj-scoresum-row { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
.mj-scoresum-row .nm { color: var(--ink); font-weight: 600; }
.mj-players { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.mj-pl { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.mj-pl.turn { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.mj-pl-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mj-seatwind { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px;
  background: var(--line); color: var(--ink); font-weight: 800; }
.mj-cnt { color: var(--muted); font-variant-numeric: tabular-nums; }
.mj-sc { margin-left: auto; font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; }
.mj-pl-mid { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 4px; margin-top: 4px; }
.mj-badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--line); color: var(--muted); }
.mj-badge.wait { color: var(--gold); background: rgba(255,207,92,.14); }
.mj-badge.ok { color: var(--good); background: rgba(55,194,107,.14); }
.mj-fl { display: inline-flex; gap: 2px; }
.mj-fl .mtile { --mt-h: 34px; min-width: 24px; font-size: 14px; box-shadow: none; }
.mj-melds { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.mj-pondwrap { background: rgba(255,255,255,.02); border: 1px dashed var(--line); border-radius: 12px; padding: 10px; margin: 10px 0; }
.mj-pond { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.mj-pond .mtile { --mt-h: 40px; min-width: 28px; font-size: 16px; }
.mj-hand { gap: 5px; }
.mj-yourmelds { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.mj-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 8px 0; }
.mj-claim { background: rgba(255,207,92,.10); border: 1px solid var(--gold); border-radius: 12px; padding: 12px; margin: 10px 0; text-align: center; }
.mj-claim-open { display: flex; gap: 6px; align-items: center; justify-content: center; margin-bottom: 8px; }
.mj-next { display: block; margin: 10px auto; }
.mj-result { text-align: center; }
.mj-faan { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin: 8px 0; }
.mj-faan span { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line); color: var(--ink); }
.mj-pay { font-variant-numeric: tabular-nums; margin: 6px 0; }
.mj-pay .up { color: var(--good); font-weight: 700; }
.mj-pay .down { color: var(--bad); }

/* ---- Table ---- */
.mj-felt { flex-direction: column; align-items: center; gap: 8px; }
.mj-indicator { display: flex; align-items: center; gap: 10px; background: rgba(0,0,0,.25); border-radius: 10px; padding: 4px 12px; }
.mj-wall { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 700; }
.mj-round { font-size: 22px; font-weight: 800; color: var(--gold); }
.mj-pond.felt { max-width: min(92vw, 460px); }
.mj-opp { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.mj-opp-melds { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; max-width: 260px; }
/* opponents' laid tiles match the discard/pond tile size (--mt-h:40px) so melds read as clearly as the pond */
.mj-opp-melds .mtile { --mt-h: 40px; min-width: 28px; font-size: 16px; box-shadow: none; border-bottom-width: 2px; }
.gt-hand.mj-hand .mtile { flex: 0 0 auto; }

@media (min-width: 620px) {
  .gt-arena .mj-opp { position: absolute; z-index: 2; }
  /* 3-player mahjong: the two opponents sit on the left/right edges (real-life seating), melds
     hanging below each card; the wall + pond sit centred between them. */
  .gt-arena .mj-opp.pos-w { left: 6px; top: 50%; transform: translateY(-50%); }
  .gt-arena .mj-opp.pos-e { right: 6px; top: 50%; transform: translateY(-50%); }
  .gt-arena .mj-opp.pos-n  { top: 6px; left: 50%; transform: translateX(-50%); }
}

/* ================= Lami (card-tile rummy — client/lami.js) ======================================= */
/* Card-faced tiles reuse the fixed-size `.mtile` box (above) so every tile is identical; only the
   face changes. LOCKED design (docs/LAMI-PLAN.md): corner index (rank + small suit) + a big centre
   pip, one colour per suit. */
.mtile.card { position: relative; background: #fbfdff; }
.mtile.card .cidx { position: absolute; top: 4px; left: 5px; display: flex; flex-direction: column;
  align-items: center; line-height: .85; }
.mtile.card .cidx .cr { font-size: calc(var(--mt-h) * .29); }   /* rank — large, legible */
.mtile.card .cidx .cs { font-size: calc(var(--mt-h) * .2); }    /* corner suit */
.mtile.card .cpip { font-size: calc(var(--mt-h) * .34); transform: translateY(calc(var(--mt-h) * .08)); }
.mtile.card.spade   { color: #1a2440; }
.mtile.card.club    { color: #1a8f47; }
.mtile.card.heart   { color: #d21f3c; }
.mtile.card.diamond { color: #2f86d6; }
.mtile.card.joker   { color: #b8860b; }
.mtile.card.empty { color: var(--muted); background: rgba(255,255,255,.04); box-shadow: none; }
.mtile.card.sel { outline: 3px solid var(--accent); outline-offset: 1px; transform: translateY(-6px);
  box-shadow: 0 6px 12px rgba(0,0,0,.35); }

/* End-of-hand reveal: each player's leftover tiles + score (shared by Classic and the Table overlay). */
.lami-reveal { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.lami-reveal-row { display: flex; flex-direction: column; gap: 4px; background: var(--panel2);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; }
.lami-reveal .rv-hd { font-size: 13px; font-weight: 600; }
.lami-reveal .rv-up { color: var(--good); font-weight: 700; }
.lami-reveal .rv-dn { color: var(--bad); font-weight: 700; }
.lami-reveal .rv-tiles { display: flex; flex-wrap: wrap; gap: 3px; }
.lami-reveal .rv-tiles .mtile.card { --mt-h: 34px; box-shadow: none; }
.lami-reveal .rv-out { font-size: 12px; }

.lami-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.lami-players { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.lami-pl { display: flex; align-items: center; gap: 10px; background: var(--panel2); border: 1px solid var(--line);
  border-radius: 10px; padding: 6px 10px; }
.lami-pl.turn { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.lami-pl.elim { opacity: .55; }
.lami-pl .cnt { min-width: 30px; text-align: center; font-weight: 800; font-size: 18px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 4px 0; }
.lami-pl .nm { line-height: 1.25; }
.lami-pl .act { color: var(--muted); font-size: 12px; }
.pill.open { background: rgba(26,143,71,.2); color: #4ade80; }
.pill.warn { background: rgba(245,179,1,.18); color: #f5b301; }
.pill.out  { background: rgba(210,31,60,.18); color: #f87171; }

.lami-melds { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.lami-run { display: inline-flex; align-items: flex-end; gap: 2px; padding: 4px 6px 2px; border-radius: 10px;
  background: rgba(255,255,255,.04); border: 1px solid transparent; position: relative; }
.lami-run .mtile { --mt-h: 44px; }
.lami-run .who { align-self: center; margin-left: 6px; color: var(--muted); font-size: 11px; }
.lami-run.addable { border-color: var(--accent); cursor: pointer; box-shadow: 0 0 0 1px var(--accent) inset; }
.lami-run.redeemable { border-color: var(--gold); cursor: pointer; box-shadow: 0 0 0 1px var(--gold) inset; }

.lami-center { display: flex; gap: 18px; justify-content: center; align-items: flex-start; margin: 12px 0; }
.lami-center .pilecol { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.lami-center small { color: var(--muted); }

.lami .hand.mtiles { display: flex; flex-wrap: wrap; gap: 4px; margin: 10px 0; }
.lami-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }

/* Lami Table layout: shared melds run in a scrollable band under the felt; hand tiles dock below. */
.gt-felt-note { color: var(--muted); font-size: 12px; padding: 8px 14px; border: 1px dashed var(--line); border-radius: 10px; }
.lami-tablemelds { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-content: flex-start;
  max-height: 34vh; overflow-y: auto; padding: 6px; margin: 6px 0; }
.gt-hand.mtiles { gap: 4px; }
.gt-hand.mtiles .mtile { --mt-h: 50px; }
