/* ============================================================================
   Baraha Pa More — felt table surface, playing cards, pods, HUD. Used by every
   game table. A table screen sets .screen--felt to swap the cream shell for felt.
   ========================================================================== */

.screen--felt{background:radial-gradient(120% 90% at 50% -8%, var(--felt-mid), var(--felt-deeper) 62%, var(--felt-darkest));
  color:var(--on-felt)}
.screen--felt .screen__body{color:var(--on-felt)}
.screen--felt::after{content:"";position:absolute;inset:0;pointer-events:none;background-image:var(--banig);
  opacity:.5;mix-blend-mode:overlay}

/* felt HUD */
.thud{display:flex;align-items:center;gap:var(--s-3);padding:calc(env(safe-area-inset-top,0px) + 8px) var(--s-4) 4px;position:relative;z-index:2}
.thud .iconbtn{background:rgba(0,0,0,.28);color:var(--on-felt)}
.turn-pill{display:inline-flex;align-items:center;gap:8px;padding:7px 14px;border-radius:var(--r-pill);
  font-weight:800;font-size:12px;color:var(--on-felt);background:rgba(0,0,0,.32);border:1px solid rgba(244,236,216,.16)}
.turn-pill.is-mine{background:var(--vermilion);border-color:transparent;box-shadow:var(--shadow-cta)}
.turn-pill__dot{width:8px;height:8px;border-radius:50%;background:currentColor}

/* opponent pod */
.pod{display:inline-flex;align-items:center;gap:8px;padding:6px 12px 6px 6px;border-radius:var(--r-pill);
  background:rgba(0,0,0,.26);border:1px solid rgba(244,236,216,.14)}
.pod.is-active{border-color:var(--gold);box-shadow:0 0 0 2px rgba(231,169,40,.4)}
.pod.is-passed{opacity:.55}
.pod__name{font-weight:800;font-size:12px;color:var(--on-felt);line-height:1}
.pod__meta{font-size:11px;color:var(--on-felt-soft);margin-top:2px;display:flex;align-items:center;gap:4px}
.pod__cards{display:inline-flex}
.pod__cardback{width:14px;height:20px;border-radius:3px;margin-left:-8px;
  background:var(--cb-bg,repeating-linear-gradient(45deg,var(--felt-mid) 0 3px,#17564E 3px 6px));
  background-size:cover;border:1px solid rgba(0,0,0,.3)}

/* ── playing card ─────────────────────────────────────────────────────────── */
/* --card-top/--card-bottom/--card-red/--card-black and --cb-* are set from the
   equipped cosmetics by js/cosmetics.js; the values in app.css are the house
   deck and back, used until a profile arrives. */
.pc{position:relative;width:var(--pcw,52px);aspect-ratio:5/7;border-radius:calc(var(--pcw,52px)*.12);
  background:linear-gradient(180deg,var(--card-top),var(--card-bottom));
  box-shadow:0 2px 5px rgba(0,0,0,.35),var(--edge-top);
  border:1px solid color-mix(in srgb, var(--card-edge,var(--ink)) 14%, transparent);
  color:var(--card-black);flex:none;user-select:none}
.pc__rank{position:absolute;top:5%;left:8%;font-family:var(--font-display);font-weight:800;
  font-size:calc(var(--pcw,52px)*.34);line-height:1}
.pc__suit{position:absolute;top:34%;left:8%;font-size:calc(var(--pcw,52px)*.28);line-height:1}
.pc__center{position:absolute;inset:0;display:grid;place-items:center;font-size:calc(var(--pcw,52px)*.5);opacity:.9}
.pc.red{color:var(--card-red)}
.pc.blue{color:var(--suit-diamond)} .pc.green{color:var(--suit-club)}
/* The back is the `cardback` cosmetic: --cb-bg carries the whole weave (all
   seven patterns are built as gradients in js/cosmetics.js), --cb-frame the
   inset border, --cb-med the medallion. Previously this tracked --felt-mid, so
   the back changed when the FELT did and no cardback could alter it. */
.pc.back{background:var(--cb-bg,repeating-linear-gradient(45deg,var(--felt-mid) 0 6px,#17564E 6px 12px));
  border-color:rgba(0,0,0,.35);overflow:hidden}
.pc.back::after{content:"";position:absolute;inset:14%;border-radius:6px;
  border:1.5px solid var(--cb-frame,rgba(248,218,119,.5))}
.pc.back::before{content:"";position:absolute;left:50%;top:50%;width:44%;aspect-ratio:1;
  transform:translate(-50%,-50%);border-radius:50%;
  background:var(--cb-med,radial-gradient(circle at 38% 32%,#F2C14E,#E7A928 58%,#C6870F));
  border:1px solid color-mix(in srgb, var(--cb-frame,#F4ECD8) 92%, transparent);z-index:1}
.pc.back .pc__rank,.pc.back .pc__suit,.pc.back .pc__center{display:none}
.pc.sel{transform:translateY(-14%);box-shadow:0 10px 16px rgba(0,0,0,.4),0 0 0 2px var(--gold)}
.pc.dim{opacity:.5;filter:grayscale(.2)}
.pc.playable{cursor:pointer}
.pc.hl{box-shadow:0 2px 6px rgba(0,0,0,.35),0 0 0 2px var(--win-mint)}
/* Pekwa: an OPEN END of a suit row — the rank that would extend it. Drawn as a
   ghost slot so you can read at a glance what the table is waiting for. */
.pc--slot{background:transparent;border:1.5px dashed rgba(248,218,119,.45);box-shadow:none;
  display:flex;align-items:center;justify-content:center;color:rgba(248,218,119,.75);
  font-weight:800;font-size:calc(var(--pcw,52px) * 0.42)}

/* my hand (fanned / overlapped, scrolls if wide) */
.hand{display:flex;justify-content:center;align-items:flex-end;overflow-x:auto;overflow-y:visible;
  padding:6px 0 2px;scrollbar-width:none}
.hand::-webkit-scrollbar{display:none}
.hand .pc{margin-left:calc(var(--pcw,52px) * -0.34)}
.hand .pc:first-child{margin-left:0}
/* Tongits: a gold ring marks the card just drawn — it stays legible wherever
   sorting and meld grouping placed it, and does not fight the select-lift.
   .grp-end opens a gap after each group. */
.hand .pc.drawn{box-shadow:0 2px 6px rgba(0,0,0,.35),0 0 0 3px var(--gold)}
.hand .pc.grp-end{margin-right:calc(var(--pcw,52px) * 0.30)}

/* center play pile / discard */
.pile{display:flex;justify-content:center;align-items:center;gap:6px;min-height:calc(var(--pcw,52px)*1.5);flex-wrap:wrap}
.pile--empty{color:var(--on-felt-soft);font-size:13px;font-weight:700}

/* meld group (tongits/pusoy rows) */
.meld{display:inline-flex;padding:4px;border-radius:var(--r-sm);background:rgba(0,0,0,.18)}
.meld .pc{margin-left:calc(var(--pcw,42px) * -0.42)}
.meld .pc:first-child{margin-left:0}

/* action bar */
.actbar{display:flex;gap:var(--s-2);padding:var(--s-2) var(--s-4) calc(env(safe-area-inset-bottom,0px) + var(--s-3));position:relative;z-index:2}
.actbar .btn{flex:1}

/* event cue banner */
.cue{position:absolute;top:64px;left:0;right:0;display:flex;justify-content:center;z-index:5;pointer-events:none}
.cue__inner{padding:8px 18px;border-radius:var(--r-pill);font-weight:800;font-size:14px;color:var(--on-gold);
  background:linear-gradient(180deg,var(--gold-bright),var(--gold-deep));box-shadow:var(--shadow-gold);
  animation:cuePop var(--dur-slow) var(--ease-out) both}
@keyframes cuePop{from{opacity:0;transform:translateY(-8px) scale(.9)}to{opacity:1;transform:none}}

/* Tongits showdown: each seat's row lands on its own beat so the reveal reads
   as a sequence instead of appearing all at once. */
@keyframes tgReveal{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion:reduce){
  /* Honour the preference without hiding the result: land immediately. */
  [style*="tgReveal"]{animation:none!important;opacity:1!important}
}

/* Tongits: the ways to spend a card buhat'd from the tapon, one tap each. The
   gold ring marks that card inside the option — it is the only thing that tells
   two otherwise similar melds apart. .pc is positioned, so the z-index lifts the
   ring above the card overlapping it. */
.meld--pick{cursor:pointer;background:rgba(0,0,0,.28);border:1px solid rgba(231,169,40,.55)}
.meld--pick .pc.drawn{z-index:1;box-shadow:0 2px 6px rgba(0,0,0,.35),0 0 0 3px var(--gold)}

/* seat layout helpers for 4-seat tables */
.seats{position:relative;flex:1;min-height:0}
.seat{position:absolute}
.seat--top{top:6px;left:50%;transform:translateX(-50%)}
.seat--left{top:44%;left:8px;transform:translateY(-50%)}
.seat--right{top:44%;right:8px;transform:translateY(-50%)}
.seat--tl{top:8px;left:10px}.seat--tr{top:8px;right:10px}

/* ── emotes ───────────────────────────────────────────────────────────────── */
/* The one player→player channel: a closed set of curated glyphs, never text. */
.screen.has-emotes{position:relative}
.pod{position:relative}
.emote-bubble{position:absolute;top:-26px;left:6px;width:30px;height:30px;border-radius:50%;
  display:grid;place-items:center;font-size:16px;background:var(--cream);
  box-shadow:0 3px 8px rgba(0,0,0,.35);animation:emote-pop .18s ease-out;z-index:4;pointer-events:none}
@keyframes emote-pop{from{transform:scale(.4);opacity:0}to{transform:scale(1);opacity:1}}
@media (prefers-reduced-motion:reduce){.emote-bubble{animation:none}}
/* Clear of the whole bottom stack. Measured at a 375px viewport with a 13-card
   hand: .actbar is 68px, .hand 78px, so the hand's top edge lands 186px off the
   bottom — hence 210px, which leaves 24px of air. At the old bottom:96px the
   button sat on the card strip and, because .hand is overflow-x:auto and a
   13-card hand (395px of content) is wider than any phone viewport, it
   swallowed the drag that scrolls the hand rather than merely blocking a tap.
   Both this and .actbar carry the same env() term, so they move together. */
.emote-btn{position:absolute;right:12px;bottom:calc(210px + env(safe-area-inset-bottom));
  width:40px;height:40px;border-radius:50%;
  border:0;background:rgba(0,0,0,.38);color:var(--cream);font-size:19px;cursor:pointer;z-index:6}
.emote-btn:hover{background:rgba(0,0,0,.5)}
.emote-btn .emote-bubble{top:-34px;left:5px}
.emote-tray{position:absolute;right:12px;bottom:calc(264px + env(safe-area-inset-bottom));
  z-index:20;display:flex;flex-wrap:wrap;gap:6px;
  max-width:220px;padding:10px;border-radius:var(--r-md,14px);background:var(--cream);
  box-shadow:0 10px 28px rgba(0,0,0,.4)}
.emote-tray__item{width:42px;height:42px;border-radius:12px;border:1px solid rgba(36,28,23,.1);
  background:rgba(255,255,255,.7);font-size:22px;cursor:pointer;line-height:1}
.emote-tray__item:hover{background:#fff}

/* ── Gawain (Quests) ───────────────────────────────────────────────────────
   Only the pieces the design system does not already provide: the rest of the
   screen reuses .panel, .segmented, .chip and .btn. */
.quest__ring{flex:0 0 auto;width:46px;height:46px;border-radius:50%;display:grid;place-items:center;
  font-size:11px;font-weight:800;border:3px solid rgba(36,28,23,.08);background:#fff;color:var(--text)}
.quest__bar{margin-top:6px;height:5px;border-radius:999px;background:rgba(36,28,23,.08);overflow:hidden}
.quest__bar>span{display:block;height:100%;border-radius:999px;background:var(--vermilion);
  transition:width .25s ease}
.quest__badge{margin-left:6px;padding:1px 6px;border-radius:999px;background:var(--win,#2e9e6b);
  color:#fff;font-size:10px;font-weight:800}
.quest__ico{flex:0 0 auto;width:38px;height:38px;border-radius:11px;display:grid;place-items:center;
  font-size:18px;background:rgba(46,158,107,.12)}
.is-dim{opacity:.55}
