:root {
  --felt: #0f5a3f;
  --felt-dark: #0b3d2e;
  --gold: #f2c14e;
  --gold-dark: #b8862b;
  --red: #e5484d;
  --green: #30a46c;
  --ink: #f5f3ea;
  --muted: #b9c7bf;
  --panel: rgba(4, 24, 18, 0.82);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* A dark-green backstop behind everything, so no phone ever shows a white strip below the table (mobile
   browser chrome / safe areas can leave the body short of the physical screen). */
html { height: 100%; background: #04231a; }
body {
  margin: 0; overflow: hidden;
  height: 100%; height: 100dvh; min-height: 100%; /* 100dvh fills the real visible area on mobile (URL bar, etc.) */
  /* ambient room light: a warm glow from above, green mid-tones, and darker corners so the table pops */
  background:
    radial-gradient(130% 90% at 50% -12%, rgba(255,238,200,0.10), rgba(255,238,200,0) 55%),
    radial-gradient(circle at 50% 38%, #176a4c, #0a3527 62%, #04231a 100%);
  color: var(--ink);
  font-family: system-ui, "Noto Sans Myanmar", "Myanmar Text", Padauk, sans-serif;
  user-select: none;
}
.hidden { display: none !important; }
.screen { position: fixed; inset: 0; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }

#rotate { display: none; }
@media (orientation: portrait) and (max-width: 700px) {
  #rotate { display: flex; position: fixed; inset: 0; z-index: 99; align-items: center; justify-content: center;
    text-align: center; padding: 2rem; background: #062a1f; font-size: 1.2rem; }
}

/* ---------- buttons & inputs ---------- */
.btn { border: 0; border-radius: 999px; padding: 0.7em 1.4em; font: inherit; font-weight: 700; color: #1b1405;
  background: linear-gradient(#ffe08a, var(--gold)); box-shadow: 0 3px 0 var(--gold-dark); cursor: pointer; }
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--gold-dark); }
.btn:disabled { filter: grayscale(1) brightness(0.7); cursor: default; }
.btn.small { padding: 0.4em 0.9em; font-size: 0.85rem; }
.btn.tiny { padding: 0.15em 0.45em; font-size: 0.75rem; }
.ad-search { width: 100%; box-sizing: border-box; padding: 0.45rem 0.6rem; border-radius: 10px; border: 1px solid rgba(255,255,255,0.15); background: rgba(0,0,0,0.25); color: inherit; font: inherit; }
.btn.green { background: linear-gradient(#5fd39a, var(--green)); box-shadow: 0 3px 0 #1d6b46; color: #04140c; }
.btn.red { background: linear-gradient(#ff8a8d, var(--red)); box-shadow: 0 3px 0 #8e2226; color: #1d0405; }
.btn.blue { background: linear-gradient(#9cc8ff, #4b8de8); box-shadow: 0 3px 0 #2a5797; color: #04101f; }
.btn.ghost { background: rgba(255, 255, 255, 0.1); color: var(--ink); box-shadow: none; }
/* Danger hierarchy (placed after .ghost so a `ghost danger` combo still shows its colour):
   .danger = solid red, destroys or affects others (close a room, delete, block);
   .leave  = red outline, you are only exiting (leave seat / leave room / off the table). */
.btn.danger { background: linear-gradient(#ff8a8d, var(--red)); box-shadow: 0 3px 0 #8e2226; color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,0.35); }
.btn.danger:active { transform: translateY(2px); box-shadow: 0 1px 0 #8e2226; }
.btn.leave { background: rgba(229, 72, 77, 0.16); color: #ff9ea0; box-shadow: none; border: 1px solid rgba(229, 72, 77, 0.6); }
.btn.leave:hover { background: rgba(229, 72, 77, 0.26); }
.btn.leave:active { transform: translateY(1px); box-shadow: none; }
input { width: 100%; padding: 0.7em 1em; border-radius: 12px; border: 1px solid rgba(255,255,255,0.2);
  background: rgba(0,0,0,0.35); color: var(--ink); font: inherit; outline: none; }
input:focus { border-color: var(--gold); }

/* ---------- login ---------- */
/* scrollable + safe-centered so the whole card is always reachable on short landscape phones */
#screen-login { display: flex; align-items: safe center; justify-content: center; overflow-y: auto; padding-block: 0.8rem; }
.login-card { width: min(380px, 92vw); display: grid; gap: 0.7rem; padding: 1.4rem; border-radius: 20px;
  background: var(--panel); box-shadow: 0 10px 40px rgba(0,0,0,0.5); text-align: center; flex: none; margin: auto; }
/* short screens (landscape phones): a compact card that fits without being cut off */
@media (max-height: 560px) {
  .login-card { padding: 0.85rem 1.2rem; gap: 0.5rem; }
  .login-card h1 { font-size: 1.5rem; }
  .logo { width: 42px; height: 42px; }
  .login-card input { padding: 0.5em 0.9em; }
  .login-card .hint { font-size: 0.76rem; line-height: 1.35; }
}
.login-card h1 { margin: 0; font-size: 2rem; letter-spacing: 0.02em; }
.login-card h1 span { color: var(--gold); }
.brand { display: flex; align-items: center; justify-content: center; gap: 0.6rem; }
.logo { width: 54px; height: 54px; flex: none; filter: drop-shadow(0 2px 6px rgba(0,0,0,0.55)); }
.sub, .hint { margin: 0; color: var(--muted); font-size: 0.85rem; }
.msg { margin: 0; min-height: 1.2em; color: var(--muted); font-size: 0.9rem; }
.msg.warn { color: #ffb4b4; }
details summary { color: var(--muted); font-size: 0.85rem; cursor: pointer; text-align: left; }
details input { margin-top: 0.4rem; }

/* ---------- lobby ---------- */
.topbar { display: flex; align-items: center; gap: 0.8rem; padding: 0.6rem 1rem; background: rgba(0,0,0,0.3); }
.topbar .who { display: flex; align-items: center; gap: 0.5rem; flex: 1; }
.coins { font-size: 1.1rem; padding: 0.3em 0.9em; border-radius: 999px; background: rgba(0,0,0,0.35); }
.avatar { display: inline-flex; width: 2.2em; height: 2.2em; border-radius: 50%; align-items: center; justify-content: center;
  font-weight: 800; background: linear-gradient(135deg, #f2c14e, #e5484d); color: #1b1405;
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.35), 0 1px 3px rgba(0,0,0,0.45); }

/* ---------- table ---------- */
.felt { position: absolute; inset: 0; }
.table-oval { position: absolute; left: 9%; right: 9%; top: 15%; bottom: 22%; border-radius: 50% / 50%;
  /* an overhead spotlight on the cloth, a soft edge vignette, then the felt itself */
  background:
    radial-gradient(ellipse 56% 42% at 50% 32%, rgba(255,255,255,0.16), rgba(255,255,255,0) 60%),
    radial-gradient(ellipse at 50% 50%, rgba(0,0,0,0) 56%, rgba(0,0,0,0.40) 100%),
    radial-gradient(ellipse at 50% 42%, #22a271, var(--felt) 52%, var(--felt-dark) 100%);
  /* lit rail rim, the wood rail, an inner depth shade near the rail, and a deep drop shadow */
  box-shadow:
    inset 0 2px 1px rgba(255,220,160,0.18),
    inset 0 0 0 10px #5b3a1e, inset 0 0 0 14px #2c1b0c,
    inset 0 0 46px 16px rgba(0,0,0,0.34),
    0 20px 44px rgba(0,0,0,0.66); }
.table-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 0.5rem; padding: 0.45rem 0.7rem; z-index: 5; }
.table-top .spacer { flex: 1; }
/* force-close countdown banner: sits just under the top bar, spans the felt, impossible to miss */
.closing-banner { position: absolute; top: 2.4rem; left: 0; right: 0; z-index: 8; display: flex; justify-content: center; align-items: center; gap: 0.7rem;
  padding: 0.4rem 0.8rem; background: rgba(140, 20, 20, 0.92); color: #fff; font-weight: 600; font-size: 0.9rem; box-shadow: 0 2px 10px rgba(0,0,0,0.35); }
.closing-banner.hidden { display: none; }
#room-name { font-weight: 700; color: var(--muted); font-size: 0.9rem; }
/* the middle column: phase text, timer, then the action bar right under it; anchored at its top so it grows
   downward when the bar appears instead of jumping */
.center { position: absolute; left: 50%; top: 40%; transform: translateX(-50%); text-align: center; width: 34%; z-index: 7; }
.phase { white-space: nowrap; display: inline-block; } /* as wide as its words, not the whole column */
.phase { margin-top: 0.35rem; font-weight: 700; font-size: 1rem; text-shadow: 0 1px 2px #000;
  line-height: 1.6; } /* fixed: Burmese and English lines are the same height, so the bar below never shifts */
.timer { height: 5px; margin: 0.4rem auto 0; width: 70%; border-radius: 3px; background: rgba(0,0,0,0.35); overflow: hidden; }
#timer-bar { height: 100%; width: 0; background: linear-gradient(90deg, #ffe9a8, var(--gold)); box-shadow: 0 0 6px rgba(242,193,78,0.55); transition: width 0.25s linear; }
.room-line { font-size: 0.7rem; color: var(--muted); margin-bottom: 0.25rem; }
.log { margin-top: 0.35rem; font-size: 0.75rem; color: var(--muted); min-height: 1em; }

/* seats */
:root {
  --card-h: clamp(50px, 15vh, 92px);       /* other players */
  --my-card-h: clamp(78px, 24vh, 140px);   /* your own hand */
  --peek-h: clamp(170px, 52vh, 300px);     /* peeling a card */
}
.seat { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 4px; z-index: 3; }
.seat.at-mid { transform: translate(-50%, -50%); }
.seat.at-left { transform: translate(0, -50%); align-items: flex-start; }
.seat.at-right { transform: translate(-100%, -50%); align-items: flex-end; }
.seat.at-top { transform: translate(-50%, 0); }
.seat.at-bottom { transform: translate(-50%, -100%); flex-direction: column-reverse; }
.seat.you { flex-direction: row-reverse; align-items: flex-end; gap: 8px; }
.seat.empty .plate { opacity: 0.35; }
.plate { position: relative; display: flex; align-items: center; gap: 0.35rem; padding: 0.2rem 0.65rem 0.2rem 0.2rem; border-radius: 999px;
  background: linear-gradient(180deg, rgba(22,44,34,0.82), rgba(2,14,10,0.86)); border: 2px solid transparent; white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 3px 9px rgba(0,0,0,0.5); }
.seat.you .plate { border-color: var(--gold); }
.seat.banker .plate { border-color: #9cc8ff; }
.seat.turn .plate { box-shadow: 0 0 0 3px rgba(242,193,78,0.6), 0 0 16px rgba(242,193,78,0.85), 0 3px 9px rgba(0,0,0,0.5); }
.seat.offline .plate { opacity: 0.5; }
.plate .avatar { width: 1.9em; height: 1.9em; font-size: 0.85rem; flex: none; }
.plate .info { display: flex; flex-direction: column; line-height: 1.15; }
.plate .name { font-size: 0.72rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; max-width: 76px; }
.plate .money { font-size: 0.68rem; color: var(--gold); }
.tags { position: absolute; top: -11px; right: -12px; display: flex; gap: 3px; z-index: 7; } /* above the cards */
.badge { font-size: 0.7rem; line-height: normal; padding: 0 0.45rem; /* normal: the font's own height fits Burmese marks above and below */ border-radius: 999px; background: #4b8de8; color: #fff; font-weight: 800; white-space: nowrap; }
.bet-chip { font-size: 0.65rem; padding: 0.05rem 0.4rem; border-radius: 999px; background: var(--gold); color: #1b1405; font-weight: 800; }
.hand { display: flex; align-items: center; min-height: var(--card-h); } /* room for the cards even before the deal: seats don't jump */
.seat.you .hand { min-height: var(--my-card-h); }
.hand .cards { position: relative; display: flex; align-items: center; }
.hand .card + .card { margin-left: calc(var(--card-h) * -0.28); }
.seat.you .hand .card + .card { margin-left: calc(var(--my-card-h) * -0.22); }
.score { font-size: 0.72rem; font-weight: 800; padding: 0.1rem 0.4rem; border-radius: 6px; background: #fff; color: #111; margin-left: 4px; white-space: nowrap;
  animation: pop 0.3s ease-out; }
.score.hidden { display: none; }
/* the score hangs beside the cards without moving them (on the side facing into the table) */
.hand { position: relative; }
.hand .score { position: absolute; top: 50%; left: 100%; transform: translateY(-50%); margin-left: 5px; z-index: 6; }
.seat.at-right .hand .score { left: auto; right: 100%; margin: 0 5px 0 0; }
.seat.you .hand .score { position: static; transform: none; margin-left: 6px; } /* mine sits between my cards and my plate */
.score.shan { background: var(--red); color: #fff; }
.seat.you .score { font-size: 0.9rem; }
.outcome { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 1.1rem; font-weight: 900;
  padding: 0.1rem 0.6rem; border-radius: 999px; background: rgba(0,0,0,0.72); box-shadow: 0 2px 8px rgba(0,0,0,0.6);
  animation: pop-c 0.4s ease-out; z-index: 6; pointer-events: none; white-space: nowrap; }
.outcome.win { color: #7dffb5; }
.outcome.lose { color: #ff8a8d; }
.outcome.push { color: #fff; }
@keyframes pop { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes pop-c { from { transform: translate(-50%, -50%) scale(0.4); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }

/* cards: real images, 3D flip, fly in from the dealer */
.card { position: relative; flex: none; height: var(--card-h); aspect-ratio: 167 / 243; perspective: 700px; }
.seat.you .card { height: var(--my-card-h); }
.card .inner { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform 0.5s cubic-bezier(.3,.7,.3,1.2); }
.card.up .inner { transform: rotateY(180deg); }
.card.noanim .inner { transition: none; }
.card .face, .card .back { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: 6%/4.2%; box-shadow: 0 3px 7px rgba(0,0,0,0.5), 0 1px 2px rgba(0,0,0,0.4); overflow: hidden; }
.card .back { background: url(cards/back.png) center / cover; }
.card .face { transform: rotateY(180deg); background: #fff; }
.card .face img, .mini img { width: 100%; height: 100%; display: block; }
.card.fly { animation: fly 0.42s cubic-bezier(.2,.8,.3,1) both; }
@keyframes fly {
  from { transform: translate(var(--dx), var(--dy)) rotate(-30deg) scale(0.55); opacity: 0; }
  12% { opacity: 1; }
  to { transform: none; opacity: 1; }
}

/* peel your own card */
.squeeze { position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem;
  background: radial-gradient(ellipse at 50% 45%, rgba(0,0,0,0.6), rgba(0,0,0,0.88)); }
.felt.peeking .actions { visibility: hidden; }
.sq-row { display: flex; align-items: flex-end; gap: 14px; }
.sq-known { display: flex; gap: 6px; }
.mini { height: calc(var(--peek-h) * 0.62); aspect-ratio: 167 / 243; border-radius: 6%/4.2%; overflow: hidden; box-shadow: 0 4px 10px rgba(0,0,0,0.6); }
.peek { position: relative; height: var(--peek-h); aspect-ratio: 167 / 243; touch-action: none; }
.peek-card { position: absolute; inset: 0; border-radius: 6%/4.2%; overflow: hidden; background: #fff; box-shadow: 0 10px 30px rgba(0,0,0,0.7); }
.peek-card img { width: 100%; height: 100%; display: block; pointer-events: none; }
.peek-card.top { cursor: grab; will-change: transform; box-shadow: 0 6px 18px rgba(0,0,0,0.6); }
.peek-card.top:active { cursor: grabbing; }
.peek-card.top.spring { transition: transform 0.45s cubic-bezier(.3,1.5,.5,1); }
.peek-card.top.away { transition: transform 0.45s ease-in, opacity 0.45s ease-in; opacity: 0; }
/* corner zones (smaller than the rest) */
.peek-card .corner { position: absolute; width: 22%; height: 16%; pointer-events: none; }
.peek-card .corner::after { content: ''; position: absolute; width: 38%; height: 38%; border: 3px solid rgba(242,193,78,0.85); }
.peek-card .corner.tl { left: 0; top: 0; } .peek-card .corner.tl::after { left: 10%; top: 10%; border-right: 0; border-bottom: 0; border-top-left-radius: 6px; }
.peek-card .corner.tr { right: 0; top: 0; } .peek-card .corner.tr::after { right: 10%; top: 10%; border-left: 0; border-bottom: 0; border-top-right-radius: 6px; }
.peek-card .corner.bl { left: 0; bottom: 0; } .peek-card .corner.bl::after { left: 10%; bottom: 10%; border-right: 0; border-top: 0; border-bottom-left-radius: 6px; }
.peek-card .corner.br { right: 0; bottom: 0; } .peek-card .corner.br::after { right: 10%; bottom: 10%; border-left: 0; border-top: 0; border-bottom-right-radius: 6px; }
.sq-text { text-align: center; font-weight: 700; text-shadow: 0 1px 3px #000; }
.sq-text small { display: block; font-weight: 400; color: var(--muted); font-size: 0.75rem; }
.sq-text .big { font-size: 1.6rem; color: var(--gold); }
.sq-text .big.shan { color: #ff8a8d; font-size: 2rem; }
.sq-timer { width: min(240px, 50vw); }
#sq-timer-bar { height: 100%; width: 0; background: linear-gradient(90deg, #ffe9a8, var(--gold)); box-shadow: 0 0 6px rgba(242,193,78,0.55); transition: width 0.25s linear; }

/* chat bubbles */
.bubble { position: absolute; left: 0; top: 0; width: max-content; max-width: min(230px, 42vw); padding: 0.25rem 0.6rem; border-radius: 12px;
  background: #fff; color: #111; font-size: 0.8rem; line-height: 1.4; white-space: normal; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; /* up to 3 lines (80 letters) */
  animation: pop 0.25s; z-index: 6; pointer-events: none; }
.bubble.emoji { background: none; font-size: 2rem; padding: 0; }

/* actions */
.actions { position: relative; left: 50%; transform: translateX(-50%); width: max-content; max-width: 96vw; margin: 0.55rem 0 0.25rem; display: flex; gap: 0.5rem; align-items: center;
  padding: 0.4rem 0.6rem; border-radius: 999px; background: var(--panel); z-index: 7; }
.actions:empty { display: none; }
.actions .btn { white-space: nowrap; }
.actions input[type=range] { width: 110px; padding: 0; accent-color: var(--gold); }
.bet-amount { min-width: 3.5em; text-align: center; font-weight: 800; color: var(--gold); white-space: nowrap; }
.chips { display: flex; gap: 0.25rem; }
.chips button { font-size: 0.7rem; padding: 0.3em 0.6em; }

/* chat panel */
.chat-panel { position: absolute; right: 0.6rem; top: 2.8rem; width: 260px; padding: 0.6rem; border-radius: 14px; background: var(--panel); z-index: 9; display: grid; gap: 0.5rem; }
.emoji-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.2rem; }
.emoji-row button { font-size: 1.4rem; background: none; border: 0; cursor: pointer; }
.quick-row { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.quick-row button { font-size: 0.75rem; }
#chat-form { display: flex; gap: 0.3rem; }

.toast { position: fixed; left: 50%; top: 12%; transform: translateX(-50%); padding: 0.5rem 1.1rem; border-radius: 999px;
  background: rgba(0,0,0,0.85); z-index: 50; font-size: 0.9rem; max-width: 90vw; text-align: center; }



/* ---------- bet spots, bank pile, chips ---------- */
#spots { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.spot { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 3px; }
.spot.hidden { display: none; }
.spot .stack { display: flex; align-items: flex-end; justify-content: center; gap: 2px; min-height: 22px; }
.spot .col { position: relative; width: 26px; height: calc(18px + (var(--n) - 1) * 3.5px); }
.spot .amt { font-size: 0.7rem; font-weight: 800; padding: 0.05rem 0.5rem; border-radius: 999px; background: rgba(0,0,0,0.62);
  color: #fff; white-space: nowrap; line-height: 1.35; }
.spot.bank .col { width: 30px; height: calc(20px + (var(--n) - 1) * 3.5px); }
.spot.bank .amt { font-size: 0.78rem; color: var(--gold); border: 1px solid rgba(242,193,78,0.6); }
/* a chip seen slightly from above: an oval face with edge stripes, and its thickness underneath */
.chip { position: absolute; left: 0; bottom: calc(var(--k) * 3.5px); width: 26px; height: 18px; border-radius: 50%;
  border: 2px dashed rgba(255,255,255,0.88); box-sizing: border-box;
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.45), 0 2px 0 var(--edge, #222), 0 3px 3px rgba(0,0,0,0.35); }
.spot.bank .chip { width: 30px; height: 20px; }
.chip.w { background: radial-gradient(ellipse at 50% 40%, #ffffff, #e4e6ea 60%, #b9bec7); border-color: #3a6fd1; --edge: #8d939c; }
.chip.r { background: radial-gradient(ellipse at 50% 40%, #ff6b6b, #c62828 60%, #8e1c1c); --edge: #6d1414; }
.chip.g { background: radial-gradient(ellipse at 50% 40%, #6fd18f, #2e7d32 60%, #1b5e20); --edge: #134016; }
.chip.k { background: radial-gradient(ellipse at 50% 40%, #555, #1f1f1f 60%, #000); border-color: #f2c14e; --edge: #000; }
.chip.gold { background: radial-gradient(ellipse at 50% 40%, #fff3c0, #e0a92c 60%, #a8771c); border-color: #fff5d6; --edge: #7a560f; }
/* chips flying between seat, bet and bank */
.flychip { position: absolute; width: 22px; height: 15px; border-radius: 50%; border: 2px dashed rgba(255,255,255,0.88);
  box-shadow: 0 2px 0 rgba(0,0,0,0.5), 0 3px 6px rgba(0,0,0,0.45); z-index: 30; pointer-events: none; box-sizing: border-box; }
.flychip.c0 { background: #c62828; } .flychip.c1 { background: #e4e6ea; border-color: #3a6fd1; }
.flychip.c2 { background: #2e7d32; } .flychip.c3 { background: #1f1f1f; border-color: #f2c14e; }
.flychip.gold { background: radial-gradient(ellipse at 50% 40%, #fff3c0, #e0a92c 60%, #a8771c); border-color: #fff5d6; }
.actions .bet-amount small { color: var(--muted); font-weight: 600; }

/* floating +/- numbers */
.plate, .spot { position: relative; }
.spot { position: absolute; }
.float { position: absolute; left: 50%; top: -4px; transform: translateX(-50%); font-weight: 900; font-size: 1rem; white-space: nowrap;
  pointer-events: none; z-index: 40; text-shadow: 0 2px 3px #000, 0 0 6px #000; animation: floatUp 1.8s ease-out forwards; }
.float.up { color: #7dffb5; }
.float.down { color: #ff8a8d; }
.float.even { color: #fff; }
/* someone's ဒို: shown in their own spot */
.float.do { top: 50%; color: #ffd76a; font-size: 1.2rem; z-index: 7; animation: doPop 2.4s ease-out forwards; } /* pops on the cards, doesn't rise over the name */
@keyframes doPop { 0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); } 12% { opacity: 1; transform: translate(-50%, -50%) scale(1.25); }
  25% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1); } }
.seat.do-glow .cards { filter: drop-shadow(0 0 8px rgba(255, 215, 106, 0.95)) drop-shadow(0 0 16px rgba(255, 215, 106, 0.55)); }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, 6px) scale(0.7); } 15% { opacity: 1; transform: translate(-50%, -6px) scale(1.15); }
  70% { opacity: 1; transform: translate(-50%, -26px) scale(1); } 100% { opacity: 0; transform: translate(-50%, -38px); } }

/* banners: SHAN!, Catch all! */
.banner { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 45; pointer-events: none; white-space: nowrap;
  font-size: clamp(1.4rem, 7vh, 2.6rem); font-weight: 900; letter-spacing: 0.02em; padding: 0.15em 0.8em; border-radius: 16px;
  background: rgba(0,0,0,0.6); text-shadow: 0 3px 6px #000; animation: bannerIn 1.7s ease-out forwards; }
.banner.shan { color: #ffd76a; border: 2px solid #ffd76a; box-shadow: 0 0 30px rgba(255,215,106,0.6); }
.banner.catch { color: #ff8a8d; border: 2px solid #ff8a8d; }
@keyframes bannerIn { 0% { opacity: 0; transform: translate(-50%, -50%) scale(0.4); } 12% { opacity: 1; transform: translate(-50%, -50%) scale(1.12); }
  22% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -60%) scale(1); } }

/* spotlight on the hand being caught */
.seat.caught .cards { animation: caught 1.3s ease-out; border-radius: 8px; }
@keyframes caught { 0% { box-shadow: 0 0 0 0 rgba(255,231,140,0); } 25% { box-shadow: 0 0 0 6px rgba(255,231,140,0.9), 0 0 30px 10px rgba(255,231,140,0.6); }
  100% { box-shadow: 0 0 0 0 rgba(255,231,140,0); } }

/* your win / loss */
.burst { position: absolute; left: 50%; top: 50%; width: 12px; height: 12px; margin: -6px; border-radius: 50%; z-index: 41; pointer-events: none;
  background: radial-gradient(circle at 35% 35%, #fff3c0, #f2c14e 60%, #b8862b); animation: burst 1s ease-out forwards; }
@keyframes burst { from { transform: translate(0, 0) scale(0.5); opacity: 1; } to { transform: translate(var(--x), var(--y)) scale(1); opacity: 0; } }
.plate.shake { animation: shake 0.45s; }
@keyframes shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
#timer-bar.urgent, #sq-timer-bar.urgent { background: var(--red); }
.table-top .room-line { margin: 0; font-size: 0.75rem; }
.money.rolling { color: #7dffb5; text-shadow: 0 0 6px rgba(125,255,181,0.7); }

/* rules card */
.help { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.6); }
.help-card { position: relative; width: min(620px, 94vw); max-height: 90vh; overflow-y: auto; padding: 1rem 1.2rem; border-radius: 16px; background: var(--panel); }
.help-card h2 { margin: 0 0 0.5rem; font-size: 1.1rem; color: var(--gold); }
.help-card ul { margin: 0; padding-left: 1.1rem; display: grid; gap: 0.35rem; font-size: 0.85rem; line-height: 1.35; }
.help-x { position: absolute; top: 0.6rem; right: 0.6rem; }

/* the deck in front of the banker: cards are dealt from here */
.deck { position: absolute; transform: translate(-50%, -50%) rotate(-8deg); height: calc(var(--card-h) * 0.85); aspect-ratio: 167 / 243; z-index: 3; pointer-events: none; }
.deck i { position: absolute; inset: 0; border-radius: 6%/4.2%; background: url(cards/back.png) center / cover; box-shadow: 0 1px 2px rgba(0,0,0,0.5); }
.deck i:nth-child(1) { transform: translate(3px, 3px); }
.deck i:nth-child(2) { transform: translate(2px, 2px); }
.deck i:nth-child(3) { transform: translate(1px, 1px); }
.banner.warn { color: #ffcc66; border: 2px solid #ffcc66; font-size: clamp(1.1rem, 5.5vh, 2rem); }
.spot .amt .warn { color: #ffcc66; margin-left: 0.3em; }

/* countdown: main timer seconds + ring around everyone who still has to act */
.timer-row { display: flex; align-items: center; justify-content: center; gap: 0.4rem; }
.timer-row .timer { margin: 0.4rem 0 0; }
.timer-sec { min-width: 2.2em; margin-top: 0.4rem; font-weight: 800; font-size: 0.85rem; color: var(--gold); text-align: left; }
.avatar-wrap { position: relative; display: inline-flex; flex: none; }
.ring { position: absolute; inset: -5px; width: calc(100% + 10px); height: calc(100% + 10px); transform: rotate(-90deg); pointer-events: none; display: none; }
.seat.turn .ring { display: block; }
.ring circle { fill: none; stroke-width: 3.5; }
.ring .track { stroke: rgba(255,255,255,0.15); }
.ring .prog { stroke: #5fd39a; stroke-linecap: round; transition: stroke-dashoffset 0.2s linear, stroke 0.3s; }
.outcome.win:not(.paid) { color: #ffe08a; }
/* lobby: still seated at a table */
.seated { display: flex; align-items: center; gap: 0.6rem; margin: 0.6rem 1rem 0; padding: 0.5rem 0.8rem; border-radius: 14px;
  background: rgba(242,193,78,0.15); border: 1px solid rgba(242,193,78,0.5); font-size: 0.9rem; }
.seated span { flex: 1; }

.peek-card .top-face { position: absolute; inset: 0; display: block; }

.seat.gone { display: none; }

/* text face shown under the card image: only visible if the image is missing */
.face-fallback { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #fff; color: #111; font-weight: 900; line-height: 1; }
.face-fallback b { font-size: 2.2em; }
.face-fallback i { font-style: normal; font-size: 2.4em; }
.face-fallback.red { color: #d0202b; }
/* image after the fallback in the markup + positioned (no z-index) = painted over it, without
   changing which card lies on top of which */
.card .face img, .peek-card img, .mini img { position: relative; }
.card .face { container-type: size; }
.mini { position: relative; container-type: size; }
.card .face .face-fallback { font-size: 22cqh; }
.peek-card .face-fallback, .mini .face-fallback { font-size: 14cqh; }
.peek-card .top-face, .peek-card.bottom { container-type: size; }

.peek-card.bottom { z-index: 1; }
.peek-card.top { z-index: 2; }
.outcome.win.short { color: #ffe08a; font-size: 0.85rem; }

/* small screens (phones in landscape): compact action bar that stays between the side seats */
@media (max-height: 500px) {
  .actions { gap: 0.3rem; padding: 0.3rem 0.45rem; max-width: 60vw; margin-top: 0.35rem; flex-wrap: wrap; justify-content: center; border-radius: 16px; }
  .phase .lbl-en { display: none; } /* Burmese only on phones: one short line */
  .chips .opt { display: none; } /* ×2 / ×5: the slider does it; keeps the bet bar on one row */
  .actions .lbl-en, .actions .you-score { display: none; }
  .actions .btn { font-size: 0.76rem; padding: 0.45em 0.75em; }
  .actions .bet-amount { font-size: 0.8rem; min-width: 2.6em; }
  .actions input[type=range] { width: 80px; }
  .chips button { font-size: 0.65rem; padding: 0.25em 0.5em; }
  /* slightly smaller chips so bets fit between the cards on a phone */
  .spot { gap: 2px; }
  .spot .stack { min-height: 16px; }
  .spot .col { width: 22px; height: calc(15px + (var(--n) - 1) * 3px); }
  .chip { width: 22px; height: 15px; bottom: calc(var(--k) * 3px); }
  .spot.bank .col { width: 25px; height: calc(17px + (var(--n) - 1) * 3px); }
  .spot.bank .chip { width: 25px; height: 17px; }
  .spot .amt { font-size: 0.62rem; }
  .spot.bank .amt { font-size: 0.7rem; }
  /* banker badge sits above the plate, clear of the name */
  .tags { top: -15px; right: -8px; }
  .badge { font-size: 0.64rem; } /* Burmese letters need the size to stay readable */
  /* a seat at the very top edge: badge beside the plate instead (above would be off screen) */
  .seat.at-edge .tags { top: 50%; right: auto; left: 100%; transform: translateY(-50%); margin-left: 4px; }
  .center { top: 33%; }
  .actions .btn { padding: 0.38em 0.7em; }
  .deck { height: calc(var(--card-h) * 0.72); } /* a smaller deck fits beside the bank pile */
}

/* short phone screens (360-370 px tall, e.g. 740x360): a slimmer middle column and bet bar */
@media (max-height: 370px), (max-height: 500px) and (max-width: 700px) {
  .center { top: 32%; }
  .phase { font-size: 0.9rem; }
  .timer-row .timer, .timer-sec { margin-top: 0.25rem; }
  .actions { margin-top: 0.25rem; padding: 0.22rem 0.4rem; gap: 0.25rem; }
  .actions .btn { font-size: 0.7rem; padding: 0.32em 0.62em; }
  .actions input[type=range] { width: 64px; }
  .actions .bet-amount { font-size: 0.74rem; }
  /* a slimmer top bar, so the seat at the top centre fits between its buttons even with a long name */
  .table-top { padding: 0.22rem 0.4rem; gap: 0.25rem; }
  .table-top .stakes-part { display: none; }
  .table-top .my-coins { font-size: 0.62rem; }
  .table-top .btn { font-size: 0.64rem; padding: 0.28em 0.5em; }
  .seat.at-edge .plate .name { max-width: 56px; }
}
/* phones: your own cards fan a little tighter (corners still readable), room for your neighbours' 3 cards */
@media (max-height: 500px) and (max-width: 900px) {
  .seat.you .hand .card + .card { margin-left: calc(var(--my-card-h) * -0.34); }
}

/* very small screens (old small phones, 568x320): compact cards, plates and top bar so 8 players fit */
@media (max-height: 340px), (max-width: 600px) {
  :root { --card-h: 40px; --my-card-h: 64px; }
  .table-top { padding: 0.25rem 0.4rem; gap: 0.3rem; }
  .table-top .btn { font-size: 0.66rem; padding: 0.35em 0.6em; }
  .table-top .room-line { font-size: 0.62rem; }
  .plate { padding: 0.1rem 0.45rem 0.1rem 0.1rem; gap: 0.25rem; }
  .plate .avatar { font-size: 0.7rem; }
  .plate .name { font-size: 0.62rem; max-width: 60px; }
  .plate .money { font-size: 0.6rem; }
  .phase { font-size: 0.85rem; }
}

/* ---------- the landing (create / join / your room) ---------- */
.rooms-wrap { max-width: 560px; margin: 0 auto; padding: 1.4rem 1rem 2rem; display: grid; gap: 1rem; }
.rooms-actions { display: grid; gap: 1rem; }
.big-choice { font-size: 1.15rem; padding: 0.9em 1.2em; width: 100%; box-sizing: border-box; }
.join-box { display: grid; gap: 0.4rem; }
.join-row { display: flex; gap: 0.4rem; align-items: stretch; }
.join-row input { flex: 1; min-width: 0; padding: 0.7rem; border-radius: 12px; border: 1px solid rgba(255,255,255,0.15); background: rgba(0,0,0,0.25); color: inherit; font: inherit; text-transform: uppercase; letter-spacing: 0.12em; text-align: center; }
.join-row .big-choice { width: auto; white-space: nowrap; }
.room-card { border-radius: 18px; padding: 1rem 1.2rem; background: var(--panel); display: grid; gap: 0.5rem; }
.rc-head { display: flex; justify-content: space-between; align-items: center; }
.rc-head b { font-size: 1.3rem; }
.rc-coins { font-size: 1rem; color: var(--gold); }
.rc-sub { color: var(--muted); font-size: 0.85rem; }
.rc-closing { color: #ffb4b4; font-weight: 600; font-size: 0.85rem; }
.rc-btns { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin-top: 0.3rem; }
.rc-btns #btn-continue { font-size: 1.05rem; }
/* the my-coins chip in the table top bar, and the sit button over the felt */
.my-coins { font-size: 0.85rem; color: var(--gold); white-space: nowrap; }
.sit-btn { font-size: 1rem; padding: 0.6em 1.2em; }
/* dev console invites + coin log */
.dv-invites { display: grid; gap: 0.3rem; }
.inv-row { display: flex; align-items: center; gap: 0.6rem; font-size: 0.85rem; }
.inv-row .code { font-size: 1rem; letter-spacing: 0.12em; }
.coin-log { display: grid; gap: 0.2rem; max-height: 22vh; overflow-y: auto; font-size: 0.8rem; color: var(--muted); }
.cl-row { padding: 0.2rem 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
.room-panel-card .code-row { margin-bottom: 0.4rem; }
/* leaderboard + trade */
.leaderboard { display: grid; gap: 0.25rem; margin-bottom: 0.3rem; }
.lb-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.25rem 0.5rem; border-radius: 8px; background: rgba(255,255,255,0.04); }
.lb-rank { width: 1.4rem; text-align: center; color: var(--muted); font-weight: 700; }
.lb-name { flex: 1; }
.lb-name.me { color: var(--gold); font-weight: 700; }
.lb-pnl { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 3.4em; text-align: right; }
.lb-pnl.up { color: #7dffb5; } .lb-pnl.down { color: #ff8a8d; } .lb-pnl.flat { color: var(--muted); }
.lb-coins { color: var(--muted); font-size: 0.82rem; font-variant-numeric: tabular-nums; }

/* throw coins: tap another player's plate at the table to fling them chips */
.seat.throwable .plate { cursor: pointer; }
.seat.throwable:hover .plate { outline: 2px solid rgba(242,193,78,0.55); outline-offset: 1px; }
.throw-pop { position: absolute; z-index: 15; background: var(--panel); border: 1px solid rgba(242,193,78,0.4); border-radius: 12px;
  padding: 0.5rem 0.6rem; display: grid; gap: 0.4rem; box-shadow: 0 6px 20px rgba(0,0,0,0.55); min-width: 158px; }
.throw-pop.hidden { display: none; }
.tp-title { font-size: 0.8rem; font-weight: 700; color: var(--gold); }
.tp-quick { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.tp-row { display: flex; gap: 0.3rem; }
.tp-amt { flex: 1; min-width: 0; padding: 0.3em 0.5em; border-radius: 8px; border: 1px solid rgba(255,255,255,0.2); background: rgba(0,0,0,0.35); color: var(--ink); font: inherit; }

/* the admin (dev) account: management only */
.admin-only-note { margin: 1rem; padding: 0.8rem 1rem; border-radius: 12px; background: rgba(242,193,78,0.12);
  border: 1px solid rgba(242,193,78,0.4); font-size: 0.9rem; line-height: 1.5; }
.trade-row { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.trade-row select, .trade-row input { padding: 0.45rem 0.5rem; border-radius: 8px; border: 1px solid rgba(255,255,255,0.15); background: rgba(0,0,0,0.3); color: inherit; font: inherit; }
.trade-row select { flex: 1; min-width: 7rem; }
.trade-row input { width: 7rem; }
/* chat history (incl. the balance log) */
.chat-log { max-height: 30vh; overflow-y: auto; display: grid; gap: 0.2rem; margin-bottom: 0.4rem; font-size: 0.85rem; }
.cl-msg { padding: 0.15rem 0.3rem; }
.cl-msg.system { color: var(--gold); font-size: 0.78rem; opacity: 0.85; }

/* ---------- admin ---------- */
#screen-admin { overflow-y: auto; }
.admin-wrap { display: grid; gap: 0.8rem; padding: 0.9rem 1rem 2rem; max-width: 760px; margin: 0 auto; }
.admin-card { border-radius: 16px; padding: 0.9rem 1rem; background: var(--panel); display: grid; gap: 0.55rem; }
.admin-card h3 { margin: 0; font-size: 1.05rem; color: var(--gold); }
.admin-card .muted { color: var(--muted); font-weight: 400; font-size: 0.85rem; }
.code-row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.code { font-size: 1.5rem; letter-spacing: 0.18em; font-family: ui-monospace, Consolas, monospace; padding: 0.15rem 0.6rem; border-radius: 10px; background: rgba(0,0,0,0.35); }
.ad-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.5rem 0.8rem; }
.ad-grid label, .ad-row label { display: grid; gap: 0.2rem; font-size: 0.78rem; color: var(--muted); }
.ad-grid label.check { display: flex; align-items: center; justify-content: flex-start; gap: 0.45rem; font-size: 0.9rem; color: inherit; align-self: end; padding-bottom: 0.45rem; }
.ad-grid label.check input { width: auto; margin: 0; transform: scale(1.25); }
label.check { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.9rem; }
label.check input { width: auto !important; margin: 0; transform: scale(1.2); }
.admin-card input[type=number], .admin-card input[type=text] { width: 100%; box-sizing: border-box; padding: 0.4rem 0.5rem; border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.15); background: rgba(0,0,0,0.3); color: inherit; font: inherit; }
.ad-players { display: grid; gap: 0.45rem; }
.ad-player { border-radius: 12px; padding: 0.55rem 0.7rem; background: rgba(0,0,0,0.25); display: grid; gap: 0.4rem; }
.ad-player .top { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.ad-player .pname { font-weight: 700; }
.ad-player .tag { font-size: 0.7rem; padding: 0.05rem 0.45rem; border-radius: 999px; background: rgba(255,255,255,0.1); }
.ad-player .tag.on { background: #1f7a4c; }
.ad-player .tag.blocked { background: var(--red); }
.ad-player .tag.admin { background: #4b8de8; }
.ad-player .coins-row { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.ad-player .coins-row input { width: 9rem; }
.ad-player .more { display: none; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.ad-player.open .more { display: flex; }
.ad-player .more input { width: 9rem; }
/* dev console: rooms & balances */
.dv-rooms { display: grid; gap: 0.6rem; }
.dv-room { border-radius: 12px; padding: 0.55rem 0.7rem; background: rgba(0,0,0,0.18); display: grid; gap: 0.45rem; }
.dv-room-head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.dv-room-head b { font-size: 1rem; }
.dv-room-head .hint { flex: 1; }
.dv-room .rc-coins { font-size: 0.85rem; color: var(--gold); }

/* ---------- break / sitting out ---------- */
/* A personal break is just a button in the top bar (#btn-break) — no overlay. A seat that is away or out of
   coins is dimmed with a small badge. */
.seat.away .avatar, .seat.away .hand, .seat.broke .avatar, .seat.broke .hand { opacity: 0.45; }
.badge.away { background: rgba(242,193,78,0.22); color: var(--gold); }
.badge.broke { background: rgba(229,72,77,0.22); color: #ff9a9d; }
.badge.ready { background: rgba(95,211,154,0.25); color: #8ff0bd; }
/* the bottle-spin that picks the first banker */
.spinner { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 6; pointer-events: none; display: grid; place-items: center; }
.spinner .bottle { font-size: 3.2rem; transform-origin: 50% 50%; will-change: transform; filter: drop-shadow(0 3px 8px rgba(0,0,0,0.7)); grid-area: 1 / 1; }
/* a clockwise ring (the gap + arrowhead rotate clockwise) shows which way the bank passes */
.spinner .spin-ring { grid-area: 1 / 1; width: 148px; height: 148px; border-radius: 50%;
  border: 3px dashed rgba(242,193,78,0.55); border-right-color: transparent; border-bottom-color: transparent;
  animation: spin-cw 2.2s linear infinite; }
@keyframes spin-cw { to { transform: rotate(360deg); } }
.spinner .spin-dir { grid-area: 1 / 1; align-self: end; transform: translateY(108px); white-space: nowrap;
  font-size: 0.78rem; font-weight: 700; color: var(--gold); text-shadow: 0 1px 3px #000; }
#btn-break.gold { color: #1b1405; }
.dev-tools { position: absolute; left: 0.4rem; bottom: 0.4rem; z-index: 4; display: flex; gap: 0.3rem; opacity: 0.8; }
.dev-tools .btn { font-size: 0.65rem; padding: 0.3em 0.6em; }
