:root {
  --velvet: #4B1426;
  --velvet-deep: #2A0B15;
  --velvet-hi: #6A1E36;
  --brass: #C9A24D;
  --brass-hi: #E8CB7E;
  --ivory: #F8F1E3;
  --ink: #1F1A1D;
  --red: #B22234;
  --blush: #F2B8B0;
  --text: #F6E9DC;
  --muted: #C9ABA9;
  --line: rgba(201, 162, 77, .28);
  --display: 'Gloock', Georgia, 'Times New Roman', serif;
  --ui: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --cw: clamp(62px, 19.5vw, 96px);
  --pile: 1.1;
  --star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cg fill='none' stroke='%23C9A24D' stroke-width='1'%3E%3Crect x='14' y='14' width='20' height='20'/%3E%3Crect x='14' y='14' width='20' height='20' transform='rotate(45 24 24)'/%3E%3Cpath d='M0 24h7M41 24h7M24 0v7M24 41v7'/%3E%3C/g%3E%3C/svg%3E");
  color-scheme: dark;
}

/* i18n (P2 fonts, wired in P0): Arabic rides the SAME two font variables everything else
   uses. Rakkas = Arabic display (single-weight, warm — echoes Gloock); Cairo = UI/body. */
[dir="rtl"] {
  --display: 'Rakkas', 'Cairo', serif;
  --ui: 'Cairo', system-ui, sans-serif;
}

/* Table cloth presets (shared across the table). Override the three "velvet" vars. */
body[data-cloth="emerald"]  { --velvet: #124f36; --velvet-deep: #0b2a1d; --velvet-hi: #1b6e4b; }
body[data-cloth="sapphire"] { --velvet: #12345f; --velvet-deep: #0a1b33; --velvet-hi: #1b4a84; }
body[data-cloth="onyx"]     { --velvet: #1a1a22; --velvet-deep: #0d0d12; --velvet-hi: #2b2b36; }
body[data-cloth="amethyst"] { --velvet: #371d55; --velvet-deep: #1b0f2b; --velvet-hi: #4e2a7a; }
body[data-cloth="crimson"]  { --velvet: #5a1118; --velvet-deep: #2a0808; --velvet-hi: #7e1a24; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--ui);
  color: var(--text);
  background:
    var(--star) center / 64px 64px,
    radial-gradient(120% 80% at 50% 45%, var(--velvet-hi) 0%, var(--velvet) 45%, var(--velvet-deep) 100%);
  background-blend-mode: soft-light, normal;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  transition: background-color .5s ease;
}
body::before { /* keep the lattice faint — derives from the cloth vars so it recolours */
  content: ''; position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(120% 80% at 50% 45%,
    color-mix(in srgb, var(--velvet) 72%, transparent),
    color-mix(in srgb, var(--velvet-deep) 90%, transparent));
  transition: background .5s ease;
}
#app { position: relative; min-height: 100dvh; max-width: 760px; margin: 0 auto; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
input { font: inherit; }
:focus-visible { outline: 2px solid var(--brass-hi); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- buttons ---------- */
.btn {
  appearance: none; border: 1px solid var(--line); background: rgba(248, 241, 227, .06);
  border-radius: 999px; padding: .72rem 1.2rem; font-weight: 600; font-size: 1rem; line-height: 1.1;
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 46px;
  transition: background .15s, transform .1s, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--brass); border-color: var(--brass); color: var(--velvet-deep); }
.btn.primary:hover:not(:disabled) { background: var(--brass-hi); }
.btn.blush { background: var(--blush); border-color: var(--blush); color: var(--velvet-deep); }
.btn.rose { background: #FF8FA3; border-color: #FF8FA3; color: var(--velvet-deep); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 36px; padding: .45rem .85rem; font-size: .9rem; }
.btn.wide { width: 100%; }
.icon-btn {
  appearance: none; border: 1px solid transparent; background: transparent; width: 42px; height: 42px;
  border-radius: 50%; display: grid; place-items: center; position: relative; font-size: 1.25rem;
}
.icon-btn:hover { background: rgba(248, 241, 227, .08); }
.badge {
  position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px;
  background: var(--blush); color: var(--velvet-deep); font-size: .72rem; font-weight: 700; display: grid; place-items: center;
}

/* ---------- cards ---------- */
.card {
  --w: var(--cw);
  width: var(--w); height: calc(var(--w) * 1.4); border-radius: calc(var(--w) * .085);
  position: relative; overflow: hidden; flex: none; user-select: none; -webkit-user-select: none;
  font-family: var(--display); color: var(--ink);
  background: var(--ivory);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .6) inset, 0 2px 3px rgba(0, 0, 0, .25), 0 8px 18px rgba(20, 0, 8, .35);
}
.card.red { color: var(--red); }
.card .ix {
  position: absolute; top: 5%; left: 6%; width: 22%; display: flex; flex-direction: column; align-items: center;
  font-size: calc(var(--w) * .29); font-weight: 700; line-height: .9; letter-spacing: -.02em; z-index: 3;
}
/* Corner suit: ~58% of a pip and bonded to the numeral, so a 7 never reads as 9 (Myra R11). */
.card .ix i { font-style: normal; font-size: .46em; font-weight: 600; margin-top: -.2em; font-family: var(--ui); -webkit-text-stroke: .3px currentColor; }
.card .ix.b { top: auto; left: auto; bottom: 5%; right: 6%; transform: rotate(180deg); }
.card.r10 .ix { font-size: calc(var(--w) * .225); letter-spacing: -.07em; }
.card .pips { position: absolute; inset: 0; }
.card .pips span {
  position: absolute; transform: translate(-50%, -50%); font-family: var(--ui); font-weight: 700; line-height: 1;
  font-size: calc(var(--w) * .23); -webkit-text-stroke: .3px currentColor;
}
.card .pips span.flip { transform: translate(-50%, -50%) rotate(180deg); }
.card .ace { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--ui); font-weight: 700; font-size: calc(var(--w) * .66); line-height: 1; }
.card .art {
  position: absolute; inset: 15% 13%; border-radius: calc(var(--w) * .04);
  display: grid; place-items: center; overflow: hidden;
}
.card .art.court {
  border: 0; box-shadow: none; background: none;
}
.card .art.court b { font-weight: 400; font-size: calc(var(--w) * .62); line-height: 1; }
.card .art.court em { position: absolute; bottom: 6%; font-style: normal; font-family: var(--ui); font-weight: 700; font-size: calc(var(--w) * .16); }
.card .art.photo { background-size: cover; background-position: center; box-shadow: 0 0 0 1px rgba(0, 0, 0, .25) inset; }
.card .art.photo em {
  position: absolute; left: 4px; bottom: 3px; font-style: normal; font-family: var(--ui); font-weight: 700; font-size: calc(var(--w) * .15);
  background: var(--ivory); border-radius: 50%; width: 1.4em; height: 1.4em; display: grid; place-items: center;
}
.card.r8 .art { inset: 13% 11%; border: 2px solid var(--brass); box-shadow: 0 0 0 2px var(--ivory) inset, 0 0 0 3px var(--brass) inset; }
.card.r8 .art.eight { background: radial-gradient(circle at 50% 40%, #fff8e6, #f1e2bd); }
.card.r8 .art.eight b {
  font-weight: 400; font-size: calc(var(--w) * .82); line-height: 1; margin-top: -8%;
  text-shadow: 1px 1px 0 var(--brass-hi), 2px 2px 0 rgba(201, 162, 77, .55);
}
.card.r8 .art.eight em { position: absolute; bottom: 5%; font-style: normal; font-family: var(--ui); font-weight: 700; font-size: calc(var(--w) * .15); color: inherit; }

.card.back {
  background:
    var(--star) center / calc(var(--w) * .42) calc(var(--w) * .42),
    radial-gradient(circle at 50% 45%, var(--velvet-hi), var(--velvet-deep));
  box-shadow: 0 0 0 calc(var(--w) * .045) var(--ivory) inset, 0 0 0 calc(var(--w) * .06) var(--brass) inset,
    0 2px 3px rgba(0, 0, 0, .3), 0 8px 18px rgba(20, 0, 8, .35);
}
.card.back.photo { background-size: cover; background-position: center; }
.card.back::after { /* small brass medallion */
  content: '8'; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: calc(var(--w) * .34); height: calc(var(--w) * .34); border-radius: 50%;
  display: grid; place-items: center; font-family: var(--display); font-size: calc(var(--w) * .22);
  background: radial-gradient(circle at 35% 30%, var(--brass-hi), var(--brass) 60%, #8d6b25);
  color: var(--velvet-deep); box-shadow: 0 1px 3px rgba(0, 0, 0, .45);
}
.card.back.photo::after { display: none; }

/* ---------- home ---------- */
.home { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; gap: 1.4rem; padding: 2rem 1.4rem calc(2rem + env(safe-area-inset-bottom)); max-width: 440px; margin: 0 auto; }
.hero { text-align: center; }
.fan3 { position: relative; height: 150px; margin: 0 auto 1.2rem; width: 200px; }
.fan3 .card { --w: 88px; position: absolute; left: 50%; top: 10px; transform-origin: 50% 120%; }
.fan3 .card:nth-child(1) { translate: -50% 0; rotate: -16deg; }
.fan3 .card:nth-child(2) { translate: -50% -6px; rotate: 0deg; }
.fan3 .card:nth-child(3) { translate: -50% 0; rotate: 16deg; }
h1 { font-family: var(--display); font-weight: 400; font-size: clamp(2.6rem, 11vw, 3.6rem); line-height: 1; margin: 0 0 .7rem; letter-spacing: -.01em; }
.lede { color: var(--muted); margin: 0 auto; max-width: 30ch; line-height: 1.5; }
.field { display: flex; flex-direction: column; gap: .4rem; font-size: .9rem; color: var(--muted); }
.field input, .joinrow input, .chat-form input {
  background: rgba(20, 0, 8, .35); border: 1px solid var(--line); color: var(--text);
  border-radius: 14px; padding: .8rem 1rem; font-size: 1.05rem; width: 100%;
}
.joinrow { display: flex; gap: .6rem; }
.joinrow input { text-transform: uppercase; letter-spacing: .3em; font-family: var(--display); text-align: center; }
.divider { text-align: center; color: var(--muted); font-size: .85rem; }
.recent { display: flex; flex-direction: column; gap: .5rem; }
.recent h2 { font-size: .9rem; font-weight: 600; color: var(--muted); margin: .4rem 0 0; }
.recent button {
  display: flex; justify-content: space-between; align-items: center; text-align: left; gap: 1rem;
  background: rgba(248, 241, 227, .05); border: 1px solid var(--line); border-radius: 14px; padding: .75rem 1rem;
}
.recent b { font-family: var(--display); font-weight: 400; font-size: 1.2rem; letter-spacing: .12em; }
.recent span { color: var(--muted); font-size: .9rem; display: inline-flex; align-items: center; gap: .4rem; }
.gtag { font-style: normal; font-size: .7rem; font-weight: 700; padding: .1rem .45rem; border-radius: 7px; letter-spacing: .02em; flex: none; }
.gtag.g8s { background: rgba(201, 162, 77, .22); color: var(--brass-hi); }
.gtag.g400 { background: rgba(134, 217, 201, .2); color: #86d9c9; }
.gtag.guno { background: rgba(224, 64, 47, .2); color: #ff9472; }
.gtag.glikha { background: rgba(185, 150, 230, .22); color: #c7a8f0; }

/* ---------- the hall: game-picker strip + live tables rail ---------- */
.hero.slim { margin-bottom: -.2rem; }
.hero.slim h1 { font-size: clamp(1.9rem, 8vw, 2.6rem); margin-bottom: .45rem; }
/* All four games visible at once — a 2x2 grid on phones, one row when it fits.
   (Was a hidden-scrollbar swipe strip; Likha lived off-screen and nobody knew.) */
.gamecards { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; padding: .1rem 0 .3rem; }
.gamecard {
  display: flex; flex-direction: column; align-items: center;
  gap: .3rem; text-align: center; background: rgba(248, 241, 227, .05); border: 1px solid var(--line);
  border-radius: 16px; padding: .85rem .6rem .9rem;
}
.gamecard:active { background: rgba(248, 241, 227, .1); }
/* Square icon tile; the game's signature card sits inside it. */
.gamecard-art {
  width: 84px; aspect-ratio: 1; border-radius: 16px;
  background: rgba(248, 241, 227, .06); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.gamecard-art .card { --w: 46px; }
.gamecard-art .ucard { width: 46px; height: 67px; }
.gamecard b { font-family: var(--display); font-weight: 400; font-size: 1.05rem; }
.gamecard span { font-size: .74rem; color: var(--muted); line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.hallwrap { display: flex; flex-direction: column; gap: .6rem; }
.hall-h2 { font-size: .9rem; font-weight: 600; color: var(--muted); margin: .2rem 0 0; }
.hallrail { display: flex; flex-direction: column; gap: .5rem; }
.hall-empty { color: var(--muted); font-size: .92rem; text-align: center; background: rgba(248, 241, 227, .04); border: 1px dashed var(--line); border-radius: 14px; padding: 1.1rem; margin: 0; }
.hallrow {
  display: flex; align-items: center; gap: .65rem; text-align: left; width: 100%;
  background: rgba(248, 241, 227, .05); border: 1px solid var(--line); border-radius: 14px; padding: .6rem .8rem;
}
.hallrow:active { background: rgba(248, 241, 227, .1); }
.hallrow-avatars { display: flex; flex: none; }
.hallrow-avatars .avatar { --s: 32px; border-width: 1.5px; margin-left: -10px; }
.hallrow-avatars .avatar:first-child { margin-left: 0; }
.hallrow-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.hallrow-main b {
  font-family: var(--display); font-weight: 400; font-size: 1.08rem; letter-spacing: .02em;
  display: flex; align-items: baseline; gap: .4rem; min-width: 0;
}
/* Flexbox gotcha: text-overflow:ellipsis never fires on a flex container's own raw text — it
   needs its own non-flex box with min-width:0 so it can actually shrink below its content size. */
.hallrow-main b .hname { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hallrow-main b .yours {
  font-style: normal; font-family: var(--ui); font-size: .62rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .03em; color: var(--velvet-deep); background: var(--brass-hi); padding: .1rem .4rem; border-radius: 6px; flex: none;
}
.hallrow-sub { display: flex; align-items: center; gap: .4rem; font-size: .82rem; color: var(--muted); min-width: 0; }
.hallrow-names { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hallrow-status { flex: none; font-size: .76rem; color: var(--muted); text-align: right; max-width: 92px; }
.hallrow-status.live { color: #7bd389; font-weight: 600; }

/* ---------- lobby ---------- */
.lobby { padding: calc(1rem + env(safe-area-inset-top)) 1.2rem calc(2rem + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 1.6rem; }
.lobby-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.lobby-head h2 { min-width: 0; overflow-wrap: anywhere;  font-family: var(--display); font-weight: 400; font-size: 1.9rem; margin: 0; }
.lobby-head h2 small { display: block; font-family: var(--ui); font-size: .85rem; color: var(--muted); margin-top: .2rem; }
.code-big { font-family: var(--display); letter-spacing: .18em; color: var(--brass-hi); }
.panel { border-top: 1px solid var(--line); padding-top: 1.1rem; display: flex; flex-direction: column; gap: .9rem; }
.panel h3 { margin: 0; font-size: 1.05rem; font-weight: 600; }
.panel p.note { margin: -.4rem 0 0; color: var(--muted); font-size: .9rem; line-height: 1.45; }
.seats { display: flex; flex-direction: column; gap: .6rem; }
.seat-row { display: flex; align-items: center; gap: .8rem; }
.seat-row .who { flex: 1; min-width: 0; }
.seat-row .who b { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-row .who span { font-size: .85rem; color: var(--muted); }
.seat-row.empty { color: var(--muted); font-style: italic; }
.avatar {
  --s: 44px; width: var(--s); height: var(--s); border-radius: 50%; flex: none; position: relative;
  background: var(--velvet-deep) center / cover; border: 2px solid var(--brass);
  display: grid; place-items: center; font-family: var(--display); font-size: calc(var(--s) * .42); color: var(--brass-hi);
}
.avatar.off { filter: grayscale(.8) brightness(.7); }
.avatar .dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; background: #7bd389; border: 2px solid var(--velvet-deep); }
.avatar.off .dot { background: #8a7b7d; }
button.avatar { padding: 0; }
.deck-slots { display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; }
.slot { display: flex; flex-direction: column; align-items: center; gap: .35rem; background: none; border: 0; padding: 0; }
.slot .card { --w: min(15vw, 78px); }
.slot span { font-size: .78rem; color: var(--muted); }
.slot .clear { font-size: .75rem; color: var(--blush); background: none; border: 0; padding: 0; text-decoration: underline; }
.rules-form { display: flex; flex-direction: column; gap: .2rem; }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid rgba(201, 162, 77, .12); }
.opt label, .opt > span { flex: 1; line-height: 1.35; }
.opt small { display: block; color: var(--muted); font-size: .82rem; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; flex: none; }
.seg button { border: 0; background: transparent; padding: .45rem .7rem; font-size: .88rem; min-width: 40px; }
.seg button[aria-pressed='true'] { background: var(--brass); color: var(--velvet-deep); font-weight: 700; }
.seg button:disabled { cursor: default; }
.switch { appearance: none; width: 46px; height: 28px; border-radius: 14px; background: rgba(248, 241, 227, .15); position: relative; flex: none; border: 1px solid var(--line); cursor: pointer; transition: background .15s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--ivory); transition: transform .15s; }
.switch:checked { background: var(--brass); }
.switch:checked::after { transform: translateX(18px); }
.switch:disabled { opacity: .55; cursor: default; }
.record table, .results table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.record td, .results td, .results th { padding: .4rem .2rem; border-bottom: 1px solid rgba(201, 162, 77, .12); }
.h2h { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.h2h-side { display: flex; flex-direction: column; gap: .15rem; min-width: 0; flex: 1 1 0; }
.h2h-side.right { align-items: flex-end; text-align: right; }
.h2h-name { font-weight: 700; font-size: 1rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h2h-pts { color: var(--muted); font-size: .8rem; }
.h2h-score { flex: none; display: flex; align-items: baseline; gap: .35rem; font-family: var(--display, serif); font-size: 2.1rem; font-weight: 700; color: var(--brass-hi, var(--brass)); }
.h2h-score span { color: var(--muted); font-size: 1.1rem; font-family: inherit; }
.h2h-sub { margin: .1rem 0 0; text-align: center; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .09em; }
.h2h-streak { margin: .3rem 0 0; text-align: center; font-size: .9rem; color: var(--brass-hi, var(--brass)); }
.h2h-ahhh { margin: .5rem 0 0; display: flex; align-items: center; justify-content: center; gap: .5rem; flex-wrap: wrap; font-size: .88rem; color: var(--muted); }
.h2h-ahhh span { text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; }
.h2h-ahhh b { font-family: var(--display); font-weight: 400; color: #FF8FB0; font-size: 1.1rem; }
.results th { text-align: left; font-weight: 600; color: var(--muted); font-size: .8rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--display); font-size: 1.05em; }

/* ---------- table ---------- */
.table {
  height: 100dvh; display: grid;
  grid-template-rows: auto auto 1fr auto auto auto auto;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  overflow: hidden;
}
.bar { display: flex; align-items: center; gap: .3rem; padding: .35rem .5rem; }
.scores { flex: 1; display: flex; justify-content: center; gap: .4rem; overflow-x: auto; scrollbar-width: none; }
.chip {
  display: flex; align-items: center; gap: .4rem; padding: .22rem .6rem .22rem .22rem; border-radius: 999px;
  background: rgba(20, 0, 8, .35); border: 1px solid transparent; white-space: nowrap; transition: border-color .2s;
}
.chip .avatar { --s: 26px; border-width: 1.5px; }
.chip .avatar .dot { width: 8px; height: 8px; border-width: 1.5px; }
.chip b { font-family: var(--display); font-weight: 400; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.chip span { font-size: .8rem; color: var(--muted); max-width: 7ch; overflow: hidden; text-overflow: ellipsis; }
.chip.turn { border-color: var(--blush); }
.target { font-size: .75rem; color: var(--muted); align-self: center; white-space: nowrap; flex-shrink: 0; }
.ahhh-chip { flex: none; align-self: center; display: inline-flex; align-items: center; gap: .25rem; padding: .2rem .5rem; border-radius: 999px; background: rgba(255, 143, 176, .16); border: 1px solid rgba(255, 143, 176, .42); color: #FF8FB0; font-size: .82rem; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }

.opps { display: flex; justify-content: center; gap: 1.2rem; padding: .4rem .8rem 0; min-height: 104px; }
.opp { display: flex; flex-direction: column; align-items: center; gap: .35rem; position: relative; }
.opp .minihand { display: flex; justify-content: center; height: calc(var(--cw) * .6 * 1.4); }
.opp .minihand .card { --w: calc(var(--cw) * .6); margin-left: calc(var(--cw) * -.44); box-shadow: 0 0 0 calc(var(--w) * .045) var(--ivory) inset, 0 0 0 calc(var(--w) * .06) var(--brass) inset, 0 2px 5px rgba(0, 0, 0, .35); }
.opp .minihand .card:first-child { margin-left: 0; }
.opps.many .opp .minihand .card { margin-left: calc(var(--cw) * -.5); }
.opp .tag { display: flex; align-items: center; gap: .4rem; font-size: .85rem; }
.opp .tag .avatar { --s: 28px; border-width: 1.5px; }
.opp .tag .avatar .dot { width: 9px; height: 9px; }
.opp .count { color: var(--muted); }
.opp.turn .tag { color: var(--blush); }
.opp.turn .minihand { filter: drop-shadow(0 0 10px rgba(242, 184, 176, .45)); }
.opp.away .minihand { opacity: .45; }
.opp .seat-remove { display: inline-flex; gap: .3rem; }
.opp .seat-remove .btn { padding: .12rem .55rem; font-size: .72rem; line-height: 1.5; min-height: 0; }
.opp-msg {
  max-width: min(44vw, 170px); margin-top: .15rem; padding: .28rem .6rem; border-radius: 12px 12px 12px 3px;
  background: linear-gradient(180deg, var(--velvet-hi), var(--velvet)); border: 1px solid var(--line);
  font-size: .82rem; line-height: 1.25; color: var(--text); text-align: center; box-shadow: 0 4px 12px rgba(0, 0, 0, .35);
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; animation: opp-msg-in .25s ease;
}
@keyframes opp-msg-in { from { opacity: 0; transform: translateY(-5px) scale(.92); } to { opacity: 1; transform: none; } }
.thinking { display: inline-flex; gap: 3px; }
.thinking i { width: 5px; height: 5px; border-radius: 50%; background: var(--blush); animation: blink 1.2s infinite; }
.thinking i:nth-child(2) { animation-delay: .2s; } .thinking i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.center { display: flex; align-items: center; justify-content: center; gap: clamp(1.6rem, 9vw, 3.5rem); position: relative; }
.stock { position: relative; background: none; border: 0; padding: 0; width: calc(var(--cw) * var(--pile)); height: calc(var(--cw) * var(--pile) * 1.4); }
.stock .card { --w: calc(var(--cw) * var(--pile)); position: absolute; left: 0; top: 0; }
.stock .layer { position: absolute; inset: 0; border-radius: calc(var(--cw) * .09); background: var(--velvet-deep); border: 1px solid rgba(201, 162, 77, .35); }
.stock .count {
  position: absolute; bottom: -1.7rem; left: 0; right: 0; text-align: center; font-size: .82rem; color: var(--muted);
}
.stock.live .card { box-shadow: 0 0 0 calc(var(--w) * .045) var(--ivory) inset, 0 0 0 calc(var(--w) * .06) var(--brass) inset, 0 0 0 3px var(--blush), 0 10px 24px rgba(20, 0, 8, .5); }
.stock.empty .card { opacity: .25; }
.discard { position: relative; width: calc(var(--cw) * var(--pile)); height: calc(var(--cw) * var(--pile) * 1.4); }
.discard .card { --w: calc(var(--cw) * var(--pile)); position: absolute; left: 0; top: 0; }
.seal {
  position: absolute; right: calc(var(--cw) * -.42); top: calc(var(--cw) * -.32); width: 54px; height: 54px; border-radius: 50%;
  display: grid; place-items: center; z-index: 5; font-size: 1.6rem; line-height: 1;
  background: radial-gradient(circle at 35% 30%, var(--brass-hi), var(--brass) 55%, #8d6b25);
  box-shadow: 0 0 0 3px rgba(141, 107, 37, .6), 0 4px 10px rgba(0, 0, 0, .45);
  color: var(--ink);
}
.seal::before { content: ''; position: absolute; inset: 5px; border-radius: 50%; border: 1px dashed rgba(42, 11, 21, .45); }
.seal.red { color: var(--red); }
.seal.stamp { animation: stamp .45s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes stamp { from { transform: scale(1.8) rotate(-25deg); opacity: 0; } to { transform: none; opacity: 1; } }
.seal-label { position: absolute; z-index: 6; right: calc(var(--cw) * -.42); top: calc(var(--cw) * -.32 + 58px); width: 54px; text-align: center; font-size: .72rem; color: var(--brass-hi); text-shadow: 0 1px 2px rgba(0, 0, 0, .8); }
.penalty {
  position: absolute; left: 50%; bottom: -1.8rem; translate: -50% 0; white-space: nowrap;
  background: var(--red); color: #fff; border-radius: 999px; padding: .15rem .6rem; font-weight: 700; font-size: .85rem;
}

.status { display: flex; align-items: center; justify-content: center; gap: .6rem; padding: .5rem 1rem .2rem; min-height: 52px; text-align: center; }
.status p { margin: 0; font-size: .98rem; line-height: 1.3; }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.status.mine .dot { background: var(--blush); animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(242, 184, 176, .6); } 100% { box-shadow: 0 0 0 10px rgba(242, 184, 176, 0); } }
.callout { display: flex; justify-content: center; gap: .6rem; }
.btn.call { background: var(--blush); color: var(--velvet-deep); border-color: var(--blush); animation: throb 1s infinite; }
.btn.catch { background: var(--red); color: #fff; border-color: var(--red); animation: throb .8s infinite; }
@keyframes throb { 50% { transform: scale(1.06); } }

.hand { position: relative; height: calc(var(--cw) * 1.4 + 36px); margin: 0 .5rem; touch-action: manipulation; }
.hand.two { height: calc(var(--cw) * 1.4 * 1.55 + 36px); }
.hand .slot-card { position: absolute; transition: top .18s ease, left .25s ease, rotate .25s ease, filter .2s; transform-origin: 50% 110%; background: none; border: 0; padding: 0; border-radius: calc(var(--cw) * .085); }
.hand .slot-card .card { pointer-events: none; }
.hand.live .slot-card.no .card { filter: brightness(.62) saturate(.7); }
.hand.live .slot-card.ok .card { box-shadow: 0 0 0 2px var(--brass-hi), 0 2px 3px rgba(0, 0, 0, .25), 0 10px 20px rgba(20, 0, 8, .4); }
.hand .slot-card.sel .card { box-shadow: 0 0 0 3px var(--blush), 0 14px 26px rgba(20, 0, 8, .55); }
.wiggle { animation: wiggle .32s; }
@keyframes wiggle { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.actions { display: flex; align-items: center; justify-content: center; gap: .5rem; padding: .3rem .6rem .7rem; min-height: 64px; flex-wrap: wrap; }
.reacts { position: absolute; bottom: 70px; right: 10px; width: 168px; display: flex; flex-direction: column; gap: .55rem; max-height: 74vh; overflow-y: auto; background: rgba(20, 0, 8, .9); border: 1px solid var(--line); border-radius: 18px; padding: .55rem .45rem; z-index: 30; }
.reacts .r-group { display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
.reacts .r-label { font-size: .58rem; letter-spacing: .13em; text-transform: uppercase; opacity: .5; padding-left: .35rem; }
.reacts .r-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; }
.reacts button { background: none; border: 0; font-size: 1.55rem; width: 44px; height: 44px; border-radius: 50%; }
.reacts button:hover { background: rgba(248, 241, 227, .1); }
.reacts .r-group > .sticker-btn { width: 100%; height: 38px; padding: 0 .75rem; border-radius: 999px; font-size: .9rem; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: .3rem; background: var(--blush); color: var(--velvet-deep); white-space: nowrap; }
.reacts .icon-sticker-btn { width: 44px; height: 40px; padding: 4px; border-radius: 12px; background: rgba(248, 241, 227, .08); border: 1px solid var(--line); display: grid; place-items: center; }
.reacts .icon-sticker-btn svg { width: 34px; height: 28px; }
.reacts .icon-sticker-btn.emoji { font-size: 1.75rem; }
.results-pill { position: absolute; left: 50%; translate: -50% 0; bottom: 138px; z-index: 20; }
/* The reacts palette (right:10px, 168px wide, z-index 30) can be open at the same time as a
   dismissed results pill (both just need S state, no mutual exclusion) — it would sit on top of
   the pill's right half. Hide the pill rather than chase a width-dependent reposition. */
.table:has(> .reacts) .results-pill { display: none; }

/* chat dock — a slim bar under the cards; tap to open the full chat */
.chatdock {
  display: flex; align-items: center; gap: .55rem; margin: .15rem .5rem .4rem; padding: .5rem .85rem;
  min-height: 46px; background: rgba(248, 241, 227, .06); border: 1px solid var(--line);
  border-radius: 999px; color: var(--text); text-align: left; position: relative;
}
.chatdock:active { background: rgba(248, 241, 227, .11); }
.chatdock .d-ico { flex: none; font-size: 1.15rem; line-height: 1; }
.chatdock .d-msg { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .92rem; }
.chatdock .d-msg b { font-family: var(--display); font-weight: 400; color: var(--brass-hi); }
.chatdock .d-empty { color: var(--muted); }
.chatdock .d-chev { flex: none; opacity: .5; font-size: 1.05rem; line-height: 1; }
.chatdock .badge { position: static; flex: none; }

.banner { position: fixed; top: 0; left: 0; right: 0; z-index: 90; background: var(--red); color: #fff; text-align: center; padding: calc(.35rem + env(safe-area-inset-top)) 1rem .35rem; font-size: .9rem; }

/* ---------- overlays ---------- */
.scrim { position: fixed; inset: 0; background: rgba(20, 0, 8, .62); z-index: 60; display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.scrim.center-modal { align-items: center; padding: 1rem; }
@keyframes fade { from { opacity: 0; } }
.sheet, .modal {
  background: linear-gradient(180deg, #3a101e, #2a0b15); border: 1px solid var(--line);
  width: 100%; max-width: 560px; max-height: 88dvh; overflow: auto;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .5);
}
.sheet { border-radius: 22px 22px 0 0; padding: .9rem 1.2rem calc(1.4rem + env(safe-area-inset-bottom)); animation: rise .25s cubic-bezier(.2, .8, .2, 1); }
.modal { border-radius: 22px; padding: 1.6rem 1.3rem; animation: pop .28s cubic-bezier(.2, 1.3, .4, 1); }
@keyframes rise { from { transform: translateY(40px); opacity: .4; } }
@keyframes pop { from { transform: scale(.92); opacity: 0; } }
.grip { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto .8rem; }
.sheet h2, .modal h2 { font-family: var(--display); font-weight: 400; font-size: 1.7rem; margin: 0 0 .6rem; line-height: 1.1; }
.menu-list { display: flex; flex-direction: column; }
.menu-list button { text-align: left; background: none; border: 0; border-bottom: 1px solid rgba(201, 162, 77, .12); padding: .95rem .2rem; font-size: 1.02rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.menu-list button span { color: var(--muted); font-size: .9rem; }
.menu-list button.danger { color: var(--blush); }
.rules-text { line-height: 1.55; color: var(--text); }
.rules-text h3 { font-size: 1rem; margin: 1.1rem 0 .3rem; }
.rules-text p, .rules-text li { color: #e9d7cb; }
.rules-text ul { padding-left: 1.1rem; margin: .3rem 0; }

.suits { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-top: .8rem; }
.suits button { background: var(--ivory); border: 0; border-radius: 18px; padding: 1.1rem .5rem; display: flex; flex-direction: column; align-items: center; gap: .3rem; color: var(--ink); }
.suits button.red { color: var(--red); }
.suits button b { font-size: 2.6rem; line-height: 1; }
.suits button span { font-size: .85rem; color: #5b4b4f; }
.suits button small { font-size: .75rem; color: #8a7478; }

.results .headline { text-align: center; margin-bottom: 1rem; }
.results .headline h2 { font-size: 2rem; }
.results .gain { font-family: var(--display); font-size: 2.4rem; color: var(--brass-hi); margin: 0; }
.results .sub { color: var(--muted); margin: .2rem 0 0; }
.standing { display: grid; grid-template-columns: auto 1fr auto; gap: .2rem .8rem; align-items: center; padding: .7rem 0; border-bottom: 1px solid rgba(201, 162, 77, .12); }
.standing .avatar { --s: 38px; grid-row: span 2; }
.standing .name { font-weight: 600; }
.standing .bar-track { grid-column: 2 / 4; height: 6px; border-radius: 3px; background: rgba(248, 241, 227, .1); overflow: hidden; }
.standing .bar-fill { height: 100%; background: var(--brass); border-radius: 3px; transition: width .6s; }
.standing .left { grid-column: 1 / 4; display: flex; gap: 3px; flex-wrap: wrap; align-items: center; margin-top: .3rem; font-size: .82rem; color: var(--muted); }
.standing .left .card { --w: 30px; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.standing .left .card .pips span, .standing .left .card .art, .standing .left .card .ace { display: none; }
.standing .left .card .ix { font-size: 11px; left: 50%; transform: translateX(-50%); width: auto; top: 12%; }
.standing .left .card .ix.b { display: none; }
.results details { margin: 1rem 0; }
.results summary { cursor: pointer; color: var(--muted); font-size: .92rem; }
.results .btns { display: flex; flex-direction: column; gap: .6rem; margin-top: 1.2rem; }

.chat { display: flex; flex-direction: column; gap: .45rem; min-height: 40dvh; max-height: 56dvh; overflow-y: auto; padding: .3rem 0 .6rem; }
.msg { max-width: 80%; padding: .5rem .8rem; border-radius: 16px; background: rgba(248, 241, 227, .09); line-height: 1.35; align-self: flex-start; word-wrap: break-word; }
.msg.me { align-self: flex-end; background: var(--blush); color: var(--velvet-deep); }
.msg small { display: block; font-size: .72rem; opacity: .7; margin-bottom: .1rem; }
.msg .meta { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; font-size: .62rem; color: rgba(248, 241, 227, .5); white-space: nowrap; vertical-align: baseline; }
.msg.me .meta { color: rgba(42, 11, 21, .55); }
.msg time { font-variant-numeric: tabular-nums; }
.msg .tick { letter-spacing: -2px; }
.msg .tick.seen { color: #0b8a4b; }
.logline { align-self: center; font-size: .8rem; color: var(--muted); text-align: center; max-width: 90%; }
.logline.big { color: var(--brass-hi); }
.chat-form { display: flex; gap: .5rem; }
.quick { display: flex; gap: .2rem; overflow-x: auto; padding-bottom: .5rem; }
.quick button { background: rgba(248, 241, 227, .06); border: 1px solid var(--line); border-radius: 999px; font-size: 1.3rem; width: 46px; height: 42px; flex: none; }
/* Chat / Game log toggle inside the talk sheet */
.chat-tabs { display: flex; gap: .4rem; margin-bottom: .7rem; }
.chat-tabs button { flex: 1; background: rgba(248, 241, 227, .05); border: 1px solid var(--line); color: var(--muted); border-radius: 999px; padding: .55rem; font-weight: 600; font-size: .95rem; transition: background .15s, color .15s; }
.chat-tabs button.on { background: var(--blush); color: var(--velvet-deep); border-color: transparent; }
.chat.logview .logline { align-self: flex-start; text-align: left; max-width: 100%; }

/* On-table incoming-message bubbles (visible while the chat sheet is closed) */
#chatpop { position: fixed; top: calc(env(safe-area-inset-top, 0px) + .6rem); left: 50%; transform: translateX(-50%); z-index: 70; width: min(92vw, 440px); display: flex; flex-direction: column; align-items: center; gap: .4rem; pointer-events: none; }
/* The "Reconnecting…" banner (z-index 90, fixed to the very top) outranks a chat bubble (z-index
   70) arriving at the same moment — drop the bubble below the banner instead of under it. */
body:has(> #banner:not([hidden])) #chatpop { top: calc(env(safe-area-inset-top, 0px) + .6rem + 38px); }
.chatpop { pointer-events: auto; max-width: 100%; background: linear-gradient(180deg, var(--velvet-hi), var(--velvet)); border: 1px solid var(--line); border-radius: 16px; padding: .5rem .85rem; box-shadow: 0 10px 28px rgba(0, 0, 0, .5); cursor: pointer; line-height: 1.35; animation: chatpop-in .28s cubic-bezier(.2, .8, .2, 1); }
.chatpop b { font-family: var(--display); font-weight: 400; color: var(--brass-hi); margin-right: .35rem; }
.chatpop span { word-break: break-word; }
.chatpop.out { animation: chatpop-out .32s ease forwards; }
@keyframes chatpop-in { from { opacity: 0; transform: translateY(-10px) scale(.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes chatpop-out { to { opacity: 0; transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) { .chatpop { animation: none; } .chatpop.out { animation: none; opacity: 0; } }

.toast {
  position: fixed; left: 50%; top: calc(58px + env(safe-area-inset-top)); translate: -50% 0; z-index: 100; pointer-events: none;
  background: var(--ivory); color: var(--ink); padding: .6rem 1rem; border-radius: 14px; font-size: .95rem; max-width: 90vw; text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4); animation: rise .2s;
}
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 80; overflow: hidden; }

/* ---------- video call: ringing-in / ringing-out (untouched, C12 — "idle ring" flow is out of
   scope for the redesign below) ---------- */
/* #call is now ONLY the pre-live surface: the full-screen incoming-call overlay, and a small
   status pill while dialing out. Once the call is actually live, this renders nothing — the
   call container (further down) takes over. */
#call { position: fixed; right: 10px; bottom: calc(136px + env(safe-area-inset-bottom)); z-index: 90; width: auto; display: flex; flex-direction: column; gap: 6px; touch-action: none; }
#call .call-tiles, #call .call-controls { display: none; }
#call[data-state="ringing-out"] .call-tiles { display: block; position: relative; }
#call[data-state="ringing-out"] .call-controls { display: flex; }
.call-remote { width: 100%; aspect-ratio: 148 / 200; object-fit: cover; border-radius: 16px; background: #000; border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0, 0, 0, .55); display: block; }
.call-local { position: absolute; right: 6px; bottom: 6px; width: 50px; height: 68px; object-fit: cover; border-radius: 9px; border: 1px solid var(--line); background: #111; }
.call-status { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); text-align: center; font-size: .82rem; color: var(--ivory); text-shadow: 0 1px 4px #000; pointer-events: none; padding: 0 .4rem; }
.call-controls { justify-content: center; gap: 8px; }
.call-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: rgba(20, 0, 8, .75); font-size: 1.1rem; display: grid; place-items: center; }
.call-btn.off { opacity: .45; }
.call-btn.danger { background: var(--red); border-color: var(--red); }
#call .call-incoming { display: none; }
#call[data-state="ringing-in"] .call-incoming { position: fixed; inset: 0; z-index: 96; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; background: rgba(20, 0, 8, .9); }
.call-inc-text { font-size: 1.3rem; font-family: var(--display); text-align: center; padding: 0 1rem; }
.call-inc-btns { display: flex; gap: .7rem; }

/* ---------- call heads: small live video/voice tiles anchored on seat avatars ---------- */
#callHeads { position: fixed; inset: 0; z-index: 45; pointer-events: none; }
.call-head { position: fixed; pointer-events: auto; cursor: pointer; }
.call-head video {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: none; background: #111;
  box-shadow: 0 0 0 2px var(--brass), 0 2px 8px rgba(0, 0, 0, .4);
}
.call-head.has-video video { display: block; }
.call-head.dialing video { opacity: .55; }
.call-head.reconnecting video { box-shadow: 0 0 0 2px var(--blush), 0 2px 8px rgba(0, 0, 0, .4); }
.call-head .mic-badge {
  position: absolute; right: -2px; bottom: -2px; width: 1.35em; height: 1.35em; font-size: .72rem;
  background: rgba(20, 0, 8, .88); border: 1.5px solid var(--velvet-deep); border-radius: 50%;
  display: grid; place-items: center; line-height: 1; pointer-events: none;
}
.call-head.has-video .mic-badge { display: none; }

/* ---------- call container v2: header chip (C1) → draggable 2x2 grid (C2/C3) → near-fullscreen
   expanded view (C5–C8). A second, "summoned" surface on top of the always-on seat avatars
   above — see .call-head for the ambient tier, which this never touches. */
.call-chip-slot { flex: none; display: flex; align-items: center; }
.callchip { display: flex; align-items: center; gap: 3px; padding: 3px 8px 3px 4px; border-radius: 999px; background: rgba(20, 0, 8, .55); border: 1px solid var(--line); flex: none; }
.callchip:active { transform: scale(.96); }
.chip-stack { display: flex; }
.chip-ava { width: 17px; height: 17px; border-radius: 6px; margin-left: -6px; background: linear-gradient(145deg, var(--brass-hi), var(--brass)); background-size: cover; background-position: center; font-family: var(--display); font-weight: 700; font-size: .56rem; color: var(--velvet-deep); display: grid; place-items: center; border: 1.5px solid var(--velvet); }
.chip-stack .chip-ava:first-child { margin-left: 0; }
.chip-overflow { font-size: .58rem; color: var(--muted); margin-left: 2px; font-variant-numeric: tabular-nums; }
.chip-live { width: 6px; height: 6px; border-radius: 50%; background: var(--brass-hi); margin-left: 3px; animation: livepulse 1.6s infinite; }
@keyframes livepulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

#callpanel { position: fixed; z-index: 50; touch-action: none; }
#callpanel[data-mode="grid"] { width: 198px; cursor: grab; }
#callpanel[data-mode="grid"].dragging { cursor: grabbing; }
#callpanel[data-mode="collapsed"], #callpanel[data-tucked="1"] { display: none; }
#callpanel[data-mode="grid"] .cb-expanded { display: none; }
#callpanel[data-mode="expanded"] .cb-grid { display: none; }
#callpanel[data-mode="expanded"] {
  top: calc(env(safe-area-inset-top) + 54px); right: 8px; left: 8px;
  bottom: calc(env(safe-area-inset-bottom) + 100px); width: auto; display: flex; flex-direction: column;
}

.cb-grid { background: linear-gradient(180deg, var(--velvet-hi), var(--velvet)); border: 1px solid var(--line); border-radius: 16px; padding: 8px; box-shadow: 0 10px 28px rgba(0, 0, 0, .5); }
.cb-head { display: flex; align-items: center; gap: 6px; }
.cb-grip { flex: none; display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px; width: 9px; height: 13px; align-content: space-between; }
.cb-grip span { width: 3px; height: 3px; border-radius: 50%; background: var(--muted); }
.cb-title { flex: 1; font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; font-variant-numeric: tabular-nums; }
.cb-ic { flex: none; width: 25px; height: 25px; border-radius: 50%; border: 1px solid var(--line); background: rgba(20, 0, 8, .5); color: var(--text); font-size: .8rem; display: grid; place-items: center; }
.cb-ic.danger { background: var(--red); border-color: var(--red); color: #fff; }

/* WhatsApp-PiP-style minimized tab (C16) */
.call-tab {
  position: fixed; z-index: 50; width: 17px; height: 66px; border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--velvet-hi), var(--velvet)); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 5px; padding: 6px 0; box-shadow: 0 8px 22px rgba(0, 0, 0, .5);
  cursor: pointer; animation: tab-in .22s cubic-bezier(.2, .8, .2, 1);
}
.call-tab[hidden] { display: none; }
.call-tab.side-left { left: 0; border-radius: 0 10px 10px 0; border-left-color: transparent; }
.call-tab.side-right { right: 0; border-radius: 10px 0 0 10px; border-right-color: transparent; }
.call-tab .tab-grip { width: 3px; height: 3px; border-radius: 50%; background: var(--muted); flex: none; }
.call-tab .tab-init { font-family: var(--display); font-weight: 700; font-size: .7rem; color: var(--velvet-deep); background: linear-gradient(145deg, var(--brass-hi), var(--brass)); background-size: cover; background-position: center; width: 16px; height: 16px; border-radius: 5px; display: grid; place-items: center; transform: rotate(90deg); flex: none; }
.call-tab .tab-live { width: 6px; height: 6px; border-radius: 50%; background: var(--brass-hi); animation: livepulse 1.6s infinite; flex: none; }
.call-tab .tab-audio { font-size: .55rem; flex: none; }
@keyframes tab-in { from { opacity: 0; transform: scale(.7); } }

.tiles { display: grid; gap: 6px; margin-top: 6px; grid-template-columns: repeat(2, 1fr); }
.tiles[data-count="1"] { grid-template-columns: 1fr; }
.tile {
  position: relative; aspect-ratio: 1/1; border-radius: 12px; border: 0; padding: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  background: linear-gradient(180deg, var(--velvet-hi), var(--velvet-deep));
}
.tile video { display: none; width: 100%; height: 100%; object-fit: cover; }
.tile.has-video video { display: block; }
.tile.has-video .t-fallback { display: none; }
.tile .t-fallback {
  width: 46%; aspect-ratio: 1; border-radius: 50%; background: var(--velvet-deep) center/cover;
  border: 2px solid var(--brass); display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-weight: 700; color: var(--brass-hi); font-size: 1.2rem;
}
.tile.reconnecting { box-shadow: 0 0 0 2px var(--blush) inset; }
.tile.reconnecting video, .tile.reconnecting .t-fallback { filter: grayscale(.7) brightness(.6); }
.tile .t-mic { position: absolute; right: 5px; bottom: 5px; width: 1.5em; height: 1.5em; font-size: .62rem; background: rgba(20, 0, 8, .88); border: 1.5px solid var(--velvet-deep); border-radius: 50%; display: grid; place-items: center; z-index: 2; }
.tile .t-name { position: absolute; left: 5px; bottom: 4px; font-size: .56rem; color: var(--text); text-shadow: 0 1px 3px rgba(0, 0, 0, .85); z-index: 2; }
.tile .t-spin { position: absolute; z-index: 2; width: 24px; height: 24px; border-radius: 50%; border: 3px solid rgba(246, 233, 220, .25); border-top-color: var(--blush); animation: spin .9s linear infinite; }
.tile .t-recon { position: absolute; bottom: 4px; left: 0; right: 0; text-align: center; font-size: .52rem; color: var(--blush); z-index: 2; }
@keyframes spin { to { transform: rotate(360deg); } }
.tile.big { aspect-ratio: auto; width: 100%; height: 100%; border-radius: 16px; }
.tile.big .t-fallback { width: 86px; font-size: 2rem; }
.tile.big .t-spin { width: 44px; height: 44px; }
.tile.big .t-recon { font-size: .74rem; bottom: 10px; }
.tile.big .t-name { font-size: .78rem; left: 10px; bottom: 10px; }
.tile.big .t-mic { right: 10px; bottom: 10px; width: 2em; height: 2em; font-size: .9rem; }

.overflow-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; padding-top: 7px; border-top: 1px dashed var(--line); }
.chip-audio { font-size: .64rem; padding: .2rem .5rem; border-radius: 999px; background: rgba(20, 0, 8, .5); border: 1px solid var(--line); color: var(--muted); }
.chip-audio.self-overflow { color: var(--brass-hi); border-color: var(--brass); }

.cb-expanded { flex: 1; display: flex; flex-direction: column; gap: 7px; min-height: 0; background: linear-gradient(180deg, var(--velvet-hi), var(--velvet-deep)); border: 1px solid var(--line); border-radius: 18px; padding: 10px; box-shadow: 0 16px 40px rgba(0, 0, 0, .6); }
.cb-exp-top { display: flex; }
.cb-back { display: inline-flex; align-items: center; gap: 4px; padding: .4rem .7rem; border-radius: 999px; background: rgba(20, 0, 8, .6); border: 1px solid var(--line); color: var(--brass-hi); font-size: .8rem; font-weight: 600; min-height: 32px; }
.cb-film { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 1px; flex: none; }
.film-thumb { position: relative; flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0; padding: 0; overflow: hidden; background: var(--velvet-deep); display: grid; place-items: center; opacity: .88; }
.film-thumb .t-fallback { width: 100%; height: 100%; border-radius: 50%; border: 0; font-size: .95rem; }
.film-thumb .t-mic.sm { position: absolute; right: 2px; bottom: 2px; width: 1.25em; height: 1.25em; font-size: .5rem; background: rgba(20, 0, 8, .88); border-radius: 50%; display: grid; place-items: center; }
.cb-stage { flex: 1; display: flex; min-height: 0; }
.cb-controls { display: flex; justify-content: center; gap: 10px; flex: none; }
.ctrl-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: rgba(20, 0, 8, .75); color: var(--text); font-size: 1rem; display: grid; place-items: center; }
.ctrl-btn.off { opacity: .4; }
.ctrl-btn.danger { background: var(--red); border-color: var(--red); color: #fff; }

/* A pulsing pill (same look as the "Last card!" callout) inviting idle players onto a live call. */
.join-call-pill { position: absolute; left: 50%; translate: -50% 0; bottom: 192px; z-index: 21; }
.table:has(> .reacts) .join-call-pill { display: none; }
/* floating reactions: pop in with overshoot, hold at full size, then rise + fade */
.reaction { position: absolute; transform: translate(-50%, -50%); display: grid; place-items: center; pointer-events: none; animation: react-rise 2.8s cubic-bezier(.2, .7, .2, 1) forwards; }
.reaction > * { grid-area: 1 / 1; }
.reaction .em { font-size: clamp(3rem, 12vw, 3.8rem); line-height: 1; filter: drop-shadow(0 3px 10px rgba(0, 0, 0, .6)); animation: react-pop 2.8s cubic-bezier(.34, 1.56, .64, 1) forwards; }
.reaction .halo { width: 5rem; height: 5rem; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--brass-hi) 50%, transparent) 0%, transparent 68%); animation: react-halo 2.8s ease-out forwards; }
.reaction .ring { width: 3.2rem; height: 3.2rem; border-radius: 50%; border: 2px solid var(--brass-hi); animation: react-ring 1.1s ease-out forwards; }
.reaction .who { align-self: center; transform: translateY(2.1rem); font: 600 .72rem/1 var(--ui); color: var(--brass-hi); background: rgba(20, 0, 8, .72); border: 1px solid var(--line); padding: .16rem .55rem; border-radius: 999px; white-space: nowrap; }
@keyframes react-rise { 0% { transform: translate(-50%, -50%); opacity: 0; } 9% { opacity: 1; } 68% { transform: translate(-50%, calc(-50% - 12px)); opacity: 1; } 100% { transform: translate(-50%, calc(-50% - 140px)); opacity: 0; } }
@keyframes react-pop { 0% { transform: scale(.3) rotate(-8deg); } 11% { transform: scale(1.3) rotate(5deg); } 22% { transform: scale(1) rotate(0); } 55% { transform: scale(1.07) rotate(-3deg); } 70% { transform: scale(1) rotate(2deg); } 100% { transform: scale(.92) rotate(0); } }
@keyframes react-halo { 0% { transform: scale(.4); opacity: 0; } 18% { transform: scale(1); opacity: .9; } 70% { opacity: .45; } 100% { transform: scale(1.1); opacity: 0; } }
@keyframes react-ring { 0% { transform: scale(.4); opacity: .85; } 100% { transform: scale(1.9); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .reaction { animation: react-fade 1.5s ease-out forwards; }
  .reaction .em { animation: none; }
  .reaction .halo, .reaction .ring { display: none; }
}
@keyframes react-fade { 0% { opacity: 0; } 12% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }

/* big playful stickers (Yalla nudge, Senno) — chunky comic pop in the middle of the table */
.sticker {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: .1rem; pointer-events: none;
  animation: sticker-pop 2.6s cubic-bezier(.22, 1, .36, 1) forwards; will-change: transform, opacity;
}
.sticker .s-run { font-size: clamp(2.3rem, 11vw, 3.8rem); line-height: 1; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .45)); animation: sticker-bob 1.1s ease-in-out infinite; }
.sticker .s-word {
  font-family: 'Baloo 2', system-ui, sans-serif; font-weight: 800; white-space: nowrap;
  font-size: clamp(3.2rem, 18vw, 7rem); line-height: .95; letter-spacing: .01em;
  -webkit-text-stroke: 3px var(--velvet-deep); paint-order: stroke fill;
}
.sticker .s-icon { display: block; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .5)); animation: sticker-bob 1.2s ease-in-out infinite; }
.sticker .s-icon svg { width: clamp(5.5rem, 36vw, 11rem); height: auto; display: block; }
.sticker.icon.eggplant .s-icon { font-size: clamp(5.5rem, 34vw, 11rem); line-height: 1; }
.squirt { position: fixed; z-index: 60; pointer-events: none; will-change: transform, opacity; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .4)); transform: translate(-50%, -50%); animation: squirt-shoot 1.3s cubic-bezier(.2, .55, .4, 1) forwards; }
.squirt.big { filter: drop-shadow(0 5px 10px rgba(0, 0, 0, .5)); }
@keyframes squirt-shoot {
  0% { transform: translate(-50%, -50%) scale(.3); opacity: 0; }
  16% { opacity: 1; }
  48% { transform: translate(calc(-50% + var(--dx, 0) * .5), calc(-50% - var(--rise, 150px))) scale(1); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx, 0)), calc(-50% - var(--rise, 150px) + 52vh)) scale(.85) rotate(26deg); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .squirt { animation-duration: .8s; } }
/* icon stickers are a tap-to-grab: pop in, hold (so it can be tapped), then fade or claim */
.sticker.icon { cursor: default; animation: sticker-popin .5s cubic-bezier(.22, 1, .36, 1) both; }
.sticker.icon.grab { pointer-events: auto; cursor: pointer; }
.sticker.icon.out { animation: sticker-fade .42s ease forwards; }
.sticker.icon.claimed { animation: sticker-claim .56s cubic-bezier(.3, .8, .4, 1) forwards; }
@keyframes sticker-popin { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.3); } 60% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); } 100% { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes sticker-fade { to { opacity: 0; transform: translate(-50%, -50%) scale(.95); } }
@keyframes sticker-claim { 0% { transform: translate(-50%, -50%) scale(1); } 40% { transform: translate(-50%, -50%) scale(1.3); } 100% { opacity: 0; transform: translate(-50%, -78%) scale(.5); } }
.sticker.yalla .s-word { color: #FFC93C; text-shadow: 0 6px 0 #B8781E, 0 10px 22px rgba(0, 0, 0, .5), 0 0 34px rgba(255, 201, 60, .5); }
.sticker.senno .s-word { color: #FFB0C4; text-shadow: 0 6px 0 #C45E7A, 0 10px 22px rgba(0, 0, 0, .5), 0 0 34px rgba(255, 176, 196, .55); }
.sticker.byee .s-word { color: #FF7E8C; text-shadow: 0 6px 0 #C43E52, 0 10px 22px rgba(0, 0, 0, .5), 0 0 34px rgba(255, 126, 140, .5); }
.sticker.boobs .s-word, .sticker.butt .s-word { font-size: clamp(2.6rem, 13vw, 5rem); color: #FF8FB0; text-shadow: 0 6px 0 #C44E76, 0 10px 22px rgba(0, 0, 0, .5), 0 0 34px rgba(255, 143, 176, .5); }
@keyframes sticker-pop {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(.3); }
  14%  { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
  26%  { transform: translate(-50%, -50%) scale(.95); }
  36%  { transform: translate(-50%, -50%) scale(1.03); }
  46%  { transform: translate(-50%, -50%) scale(1); }
  78%  { opacity: 1; transform: translate(-50%, -54%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -80%) scale(1.04); }
}
@keyframes sticker-bob { 50% { transform: translateY(-6px) rotate(-5deg); } }
@media (prefers-reduced-motion: reduce) {
  .sticker { animation: react-fade 1.6s ease-out forwards; }
  .sticker.icon { animation: none; opacity: 1; }
  .sticker .s-run, .sticker .s-icon { animation: none; }
}

/* "opponent is low on cards" center flash */
.bigalert {
  position: fixed; left: 50%; top: 40%; translate: -50% -50%; z-index: 120; pointer-events: none;
  display: flex; align-items: center; gap: .55rem; white-space: nowrap;
  padding: .85rem 1.5rem; border-radius: 999px;
  font-family: var(--display, serif); font-size: 1.5rem; font-weight: 700; letter-spacing: .01em;
  color: var(--velvet-deep); background: linear-gradient(135deg, var(--brass-hi), var(--brass));
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45), 0 0 0 3px rgba(248, 241, 227, .25) inset;
  animation: bigalert 2.2s ease forwards;
}
.bigalert.urgent { font-size: 1.75rem; color: #fff; background: linear-gradient(135deg, #e0545f, #B22234); }
.bigalert .ba-dot { font-size: 1.1em; }
@keyframes bigalert {
  0% { opacity: 0; translate: -50% -50%; scale: .6; }
  12% { opacity: 1; scale: 1.12; }
  22% { scale: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; scale: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .bigalert { animation: bigalert-fade 2.2s ease forwards; }
  @keyframes bigalert-fade { 0% { opacity: 0; } 10% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
}

/* table cloth swatches */
.cloth-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .9rem; margin-top: .5rem; }
.cloth-swatch { display: flex; flex-direction: column; align-items: center; gap: .45rem; background: none; border: 0; padding: .3rem; color: var(--text); font-size: .85rem; }
.cloth-swatch .sw { width: 100%; aspect-ratio: 1.3; border-radius: 12px; border: 2px solid transparent; box-shadow: 0 2px 8px rgba(0, 0, 0, .4); }
.cloth-swatch.on .sw { border-color: var(--brass-hi); box-shadow: 0 0 0 2px var(--brass-hi), 0 2px 8px rgba(0, 0, 0, .4); }
.cloth-swatch.on { font-weight: 700; color: var(--brass-hi); }
.sw[data-cloth="velvet"]   { background: radial-gradient(circle at 35% 30%, #6A1E36, #4B1426 60%, #2A0B15); }
.sw[data-cloth="emerald"]  { background: radial-gradient(circle at 35% 30%, #1b6e4b, #124f36 60%, #0b2a1d); }
.sw[data-cloth="sapphire"] { background: radial-gradient(circle at 35% 30%, #1b4a84, #12345f 60%, #0a1b33); }
.sw[data-cloth="onyx"]     { background: radial-gradient(circle at 35% 30%, #2b2b36, #1a1a22 60%, #0d0d12); }
.sw[data-cloth="amethyst"] { background: radial-gradient(circle at 35% 30%, #4e2a7a, #371d55 60%, #1b0f2b); }
.sw[data-cloth="crimson"]  { background: radial-gradient(circle at 35% 30%, #7e1a24, #5a1118 60%, #2a0808); }
.shake { animation: shake .5s; }
@keyframes shake { 10%, 90% { translate: -2px 0; } 20%, 80% { translate: 4px 0; } 30%, 50%, 70% { translate: -6px 0; } 40%, 60% { translate: 6px 0; } }

@media (min-width: 700px) {
  :root { --cw: 92px; }
  .opps { min-height: 130px; }
}
@media (min-height: 780px) and (max-width: 699px) {
  :root { --cw: clamp(64px, 21.5vw, 100px); --pile: 1.22; }
  .opps { min-height: 118px; }
}
@media (max-height: 700px) {
  :root { --cw: clamp(56px, 16.5vw, 82px); }
  .opps { min-height: 88px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- 400 / Tarneeb ---------- */
/* Team accents: A is gold (the house brass), B is a cool mint to tell partnerships apart. */
.team0 { --accent: var(--brass-hi); }
.team1 { --accent: #86d9c9; }

.table.four00 { grid-template-rows: auto auto 1fr auto auto auto auto auto; }

/* team scores in the top bar */
.teamscore { flex: 1; display: flex; justify-content: center; align-items: baseline; gap: .5rem; font-family: var(--display); min-width: 0; }
.teamscore .t { display: inline-flex; gap: .3rem; align-items: baseline; font-size: .9rem; color: var(--muted); white-space: nowrap; }
.teamscore .t b { font-size: 1.45rem; font-variant-numeric: tabular-nums; }
.teamscore .t.a b { color: var(--brass-hi); }
.teamscore .t.b b { color: #86d9c9; }
.teamscore .sep { color: var(--muted); }

/* the trick in the middle of the table */
.trick-area { position: relative; width: min(82vw, 360px); height: calc(var(--cw) * 3); margin: 0 auto; }
.trick-area .tcard { position: absolute; }
.trick-area .tcard .card { --w: calc(var(--cw) * var(--pile) * .88); box-shadow: 0 2px 5px rgba(0, 0, 0, .3), 0 10px 22px rgba(20, 0, 8, .4); }
.tcard.top    { top: 0;    left: 50%; transform: translateX(-50%) rotate(1deg); z-index: 2; }
.tcard.bottom { bottom: 0; left: 50%; transform: translateX(-50%) rotate(-1deg); z-index: 4; }
.tcard.left   { left: 0;   top: 50%; transform: translateY(-50%) rotate(-5deg); z-index: 3; }
.tcard.right  { right: 0;  top: 50%; transform: translateY(-50%) rotate(5deg); z-index: 3; }
.trick-hint { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: var(--muted); font-size: .85rem; font-style: italic; }
.trump-badge {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%; z-index: 1;
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 1.5rem; line-height: 1;
  background: radial-gradient(circle at 35% 30%, var(--brass-hi), var(--brass) 55%, #8d6b25); color: var(--red);
  box-shadow: 0 0 0 3px rgba(141, 107, 37, .6), 0 4px 10px rgba(0, 0, 0, .45);
}

/* bid / tricks chips carry the team accent */
.chip.team0, .chip.team1 { border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.chip .bt { color: var(--accent); }
.chip.me { padding: .28rem .8rem .28rem .28rem; }
.chip.me .avatar { --s: 30px; }
.selfline { display: flex; justify-content: center; align-items: center; padding: .1rem 0; }

.opp.team0 .count, .opp.team1 .count { color: var(--accent); font-weight: 700; }
.opp.partner .avatar { box-shadow: 0 0 0 2px var(--accent), 0 0 10px rgba(134, 217, 201, .3); }
.opp.partner .tag span:first-of-type { color: var(--accent); }

/* bidding bar replaces draw/pass */
.bidbar { display: flex; align-items: center; gap: .55rem; }
.icon-btn.round { width: 40px; height: 40px; border: 1px solid var(--line); background: rgba(248, 241, 227, .06); font-size: 1.4rem; line-height: 1; }
.bidn { display: flex; flex-direction: column; align-items: center; min-width: 48px; }
.bidn b { font-family: var(--display); font-weight: 400; font-size: 1.8rem; line-height: 1; color: var(--brass-hi); }
.bidn span { font-size: .66rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.hand .slot-card.dim .card { filter: brightness(.82) saturate(.85); }

/* lobby partnership tinting */
.seat-row.team0 .avatar { border-color: var(--brass-hi); }
.seat-row.team1 .avatar { border-color: #86d9c9; }

/* 400 results modal */
.teamtotals { display: flex; flex-direction: column; gap: .7rem; margin-bottom: 1.1rem; }
.teamtotal { display: grid; grid-template-columns: 1fr auto; gap: .25rem .6rem; align-items: baseline; }
.teamtotal .tt-name { font-weight: 600; }
.teamtotal .tt-num { font-family: var(--display); font-size: 1.6rem; color: var(--accent); font-variant-numeric: tabular-nums; }
.teamtotal .bar-track { grid-column: 1 / 3; height: 8px; border-radius: 4px; background: rgba(248, 241, 227, .1); overflow: hidden; }
.teamtotal .bar-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width .6s; }
.teamtotal.win .tt-name::after { content: ' 🏆'; }
.standings400 .standing { grid-template-columns: auto 1fr auto; align-items: center; }
.standings400 .standing .s-mid { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.standings400 .standing .name::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: .45rem; vertical-align: middle; }
.standing .bidres { font-size: .82rem; color: var(--muted); }
.standing .bidres.made { color: #9ad6a0; }
.standing .bidres.miss { color: var(--blush); }

/* home hero: personalized party title */
.hero h1 .amp { color: var(--brass); font-weight: 400; }
.hero h1 .partysub { display: block; font-size: .4em; color: var(--brass-hi); letter-spacing: .04em; margin-top: .25rem; }

.nudge { display: flex; align-items: center; justify-content: center; gap: .6rem; flex-wrap: wrap;
  margin: 0 0 .6rem; padding: .6rem .8rem; border-radius: 12px; text-align: center;
  background: rgba(224, 84, 95, .14); border: 1px solid var(--line); color: var(--ivory); }
.cash { display: flex; align-items: center; justify-content: center; gap: .6rem; flex-wrap: wrap;
  margin: .5rem 0; padding: .55rem .8rem; border-radius: 12px; text-align: center; font-size: .95rem;
  background: rgba(201, 162, 77, .14); border: 1px solid var(--brass, #c9a24d); color: var(--ivory); }
.cash b { color: var(--brass-hi, #e8cb7e); }
.cash-won { flex-direction: column; gap: .7rem; font-size: 1.15rem; padding: 1rem; }
.cash-won .btn { width: auto; }

.call-resize { display: none; }
@media (hover: hover) and (pointer: fine) {
  #call[data-state="ringing-out"] .call-resize { display: block; }
  /* top-left corner: #call is anchored bottom-right, so this is the free corner that grows on-screen */
  .call-resize { position: absolute; left: 2px; top: 2px; width: 20px; height: 20px; z-index: 3;
    cursor: nwse-resize; touch-action: none; border-radius: 14px 0 0 0;
    background:
      linear-gradient(315deg, transparent 46%, var(--ivory) 46%, var(--ivory) 54%, transparent 54%,
      transparent 66%, var(--ivory) 66%, var(--ivory) 74%, transparent 74%); opacity: .7; }
  .call-resize:hover { opacity: 1; }
}

/* ---------- UNO ---------- */
.ucard { position: relative; width: 56px; height: 82px; border-radius: 9px; background: #fff; color: #fff;
  display: grid; place-items: center; border: 3px solid #fff; box-shadow: 0 2px 7px rgba(0, 0, 0, .45); overflow: hidden; }
.ucard .u-oval { position: absolute; inset: 9px 5px; border-radius: 50%; background: rgba(255, 255, 255, .28); transform: rotate(42deg); }
.ucard .u-big { position: relative; z-index: 1; font: 800 1.9rem/1 var(--ui, system-ui); text-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
.ucard .u-corner { position: absolute; z-index: 1; font: 800 .72rem/1 var(--ui, system-ui); }
/* Pulled in from 4/5px to 2/2px: in a fanned uno-hand the TL corner is the only part of a buried
   card that's visible, often in a sliver as narrow as ~15px — every px of margin here is budget
   the next (overlapping) card eats into. */
.ucard .u-corner.tl { top: 2px; left: 2px; }
.ucard .u-corner.br { bottom: 4px; right: 5px; transform: rotate(180deg); }
/* Two-glyph labels (+2, +4) need to be narrower than a single digit to still fit the sliver. */
.ucard.u-wide .u-corner { font-size: .6rem; letter-spacing: -.02em; }
@media (max-width: 480px) {
  .ucard .u-corner.tl { font-size: .84rem; }
  .ucard.u-wide .u-corner.tl { font-size: .64rem; }
}
.u-R { background: #e0402f; } .u-Y { background: #f3b32b; color: #5a3d00; } .u-G { background: #2a9d4a; } .u-B { background: #2e7ad1; }
.u-Y .u-big, .u-Y .u-corner { text-shadow: none; }
.u-wild { background: #1b1b22; }
.u-wild .u-oval { inset: 7px 4px; border-radius: 10px; opacity: 1; transform: none;
  background: conic-gradient(#e0402f 0 25%, #f3b32b 0 50%, #2a9d4a 0 75%, #2e7ad1 0); }
.u-wild .u-big { color: #fff; -webkit-text-stroke: 1.2px rgba(0, 0, 0, .45); }
.u-wild .u-corner { color: #fff; }
.u-back { background: #16131b; border-color: #2a2533; }
.u-back .u-logo { font: 800 .95rem/1 var(--display, Georgia, serif); color: #e0402f; -webkit-text-stroke: 1px #fff; transform: rotate(-18deg); }

.table.uno .uno-center { display: flex; align-items: center; justify-content: center; gap: 1.3rem; padding: .5rem 0; }
.uno-center .stock { position: relative; background: none; border: 0; padding: 0; }
.uno-center .stock .ucard { width: 64px; height: 94px; }
.uno-center .stock .count { position: absolute; bottom: -7px; left: 50%; transform: translateX(-50%); font-size: .68rem; background: rgba(0, 0, 0, .65); color: #fff; padding: 1px 7px; border-radius: 999px; }
.uno-mid { display: flex; flex-direction: column; align-items: center; gap: .4rem; position: relative; }
.uno-discard .ucard { width: 72px; height: 104px; }
.uno-dir { position: absolute; top: -2px; right: -24px; font-size: 1.35rem; opacity: .65; }
.ucolor-chip { font: 700 .72rem/1 var(--ui); letter-spacing: .08em; text-transform: uppercase; color: #fff; padding: .28rem .75rem; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .3); }
.ucolor-chip.u-Y { color: #4a3300; }

.uno-hand { display: flex; justify-content: center; align-items: flex-start; height: auto; overflow: visible; padding: .6rem .5rem 1rem; }
/* 13+ cards: smaller cards so each buried card's corner label stays readable */
.uno-hand.crowd .ucard { width: 46px; height: 68px; border-width: 2px; }
.uno-hand.crowd .ucard .u-big { font-size: 1.45rem; }
.uslot { flex: 0 0 auto; background: none; border: 0; padding: 0; transition: transform .12s, margin-left .18s ease; }
.uno-hand.live .uslot.ok { cursor: pointer; }
.uno-hand.live .uslot.ok:hover { transform: translateY(-8px); }
.uno-hand .uslot:hover { z-index: 40 !important; }
.uno-hand .uslot.no { opacity: .48; }
.uno-hand.live .uslot.ok .ucard { box-shadow: 0 0 0 2px var(--brass-hi, #e8cb7e), 0 4px 11px rgba(0, 0, 0, .5); }

.ucolors { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.ucolors button { height: 66px; border-radius: 14px; border: 2px solid rgba(255, 255, 255, .25); color: #fff; font: 800 1.1rem/1 var(--ui); }
.ucolors .u-R { background: #e0402f; } .ucolors .u-Y { background: #f3b32b; color: #4a3300; } .ucolors .u-G { background: #2a9d4a; } .ucolors .u-B { background: #2e7ad1; }

/* turn-event chips (UNO skips/reverses/pickups, Likha ouch) — their own lane, never
   overlapping .bigalert: smaller, higher, and stacking downward per --tf-slot */
.turnflash { position: fixed; left: 50%; top: calc(14% + (var(--tf-slot, 0) * 44px)); translate: -50% 0;
  display: flex; align-items: center; gap: .45rem; padding: .4rem .95rem; border-radius: 999px;
  background: rgba(20, 0, 8, .88); border: 1px solid var(--line); color: var(--ivory);
  font-size: .95rem; font-weight: 600; z-index: 110; pointer-events: none;
  animation: tf-pop 1.9s ease forwards; }
.turnflash .ba-dot { font-size: 1.1em; }
@keyframes tf-pop { 0% { opacity: 0; translate: -50% 8px; } 10% { opacity: 1; translate: -50% 0; }
  75% { opacity: 1; } 100% { opacity: 0; translate: -50% -8px; } }

/* ---------- table access control (knock / password / bans) ---------- */
.lock-note { color: var(--blush); background: rgba(20, 0, 8, .35); border: 1px solid var(--line); border-radius: 12px; padding: .6rem .8rem; margin: 0; font-size: .92rem; }
.hlock { font-size: .82em; opacity: .85; }
.joinpass-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.joinpass-row .note { margin: 0; }

/* the joiner's "waiting at the door" dots */
.knockwait { display: flex; justify-content: center; gap: .55rem; padding: 1.1rem 0; }
.knockwait i { width: 12px; height: 12px; border-radius: 50%; background: var(--brass-hi); animation: blink 1.3s infinite; }
.knockwait i:nth-child(2) { animation-delay: .22s; }
.knockwait i:nth-child(3) { animation-delay: .44s; }

/* host approval cards: float over lobby AND table; multiple knocks stack upward */
.knockcards { position: fixed; left: 50%; bottom: 86px; translate: -50% 0; display: flex; flex-direction: column; gap: .5rem; z-index: 80; width: min(92vw, 380px); }
.knockcard { display: flex; flex-direction: column; gap: .55rem; padding: .7rem .85rem; border-radius: 14px;
  background: rgba(20, 0, 8, .92); border: 1px solid var(--brass); color: var(--ivory);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .5); animation: pop .22s ease; font-size: .95rem; }
.knockcard-btns { display: flex; gap: .5rem; justify-content: flex-end; }
