:root {
  --w: 430px;
  --design-h: 470px;
  --s: 1;
  --table-h: 60vh;          /* set in px by applyScale() */
  --wood: #2a140c;
  --wood-deep: #150a06;
  --brass: #c9a25a;
  --brass-hi: #f3dfa6;
  --brass-deep: #7d5a22;
  --ivory: #f6ead0;
  --andar: #ff9a2e;
  --andar-hi: #ffd08a;
  --bahar: #2bb7c4;
  --bahar-hi: #a6ecf2;
  --font-title: "Baloo 2", "Trebuchet MS", sans-serif;
  --font-num: "Rubik", "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: transparent;
  color: #fff;
  font-family: var(--font-num);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--brass-hi); outline-offset: 2px; }
img { -webkit-user-drag: none; }
.hidden { display: none !important; }

.phone-shell {
  position: fixed;
  left: 50%;
  top: 0;
  width: min(100vw, var(--w));
  height: 100vh;
  height: 100dvh;
  transform: translateX(-50%);
  overflow: hidden;
  background: transparent;
}
.phone-shell.closed .table-panel,
.phone-shell.closed .toast-root { display: none; }

/* transparent: the live stream sits behind this area */
.live-stage {
  position: absolute;
  inset: 0 0 var(--table-h) 0;
  pointer-events: none;
}

/* ── TABLE ─────────────────────────────────────────────────── */
/*
 * No hard top edge: the haveli art fades in from transparent, so the table
 * melts into the stream. Below the art the panel is dark walnut.
 */
.table-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--table-h) + env(safe-area-inset-bottom));
  background:
    linear-gradient(180deg,
      rgba(21, 10, 6, 0) 0%,
      rgba(21, 10, 6, 0.9) 12%,
      #1d0f09 45%,
      var(--wood-deep) 100%);
  z-index: 5;
  overflow: hidden;
}
.table-inner {
  position: absolute;
  top: max(0px, (var(--table-h) - var(--design-h) * var(--s)) / 2);
  left: 50%;
  width: 390px;
  height: var(--design-h);
  transform: translateX(-50%) scale(var(--s));
  transform-origin: top center;
}

.arena {
  position: absolute;
  top: 0;
  left: 0;
  width: 390px;
  height: 252px;
  background: url("assets/art/arena.webp") center top / 100% 100% no-repeat;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 9%, #000 90%, transparent 100%),
                      linear-gradient(90deg, transparent 0, #000 4%, #000 96%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(180deg, transparent 0, #000 9%, #000 90%, transparent 100%),
              linear-gradient(90deg, transparent 0, #000 4%, #000 96%, transparent 100%);
  mask-composite: intersect;
  pointer-events: none;
}

.fx-canvas {
  position: absolute;
  left: 0;
  top: 0;
  width: 390px;
  height: var(--design-h);
  pointer-events: none;
  z-index: 2;
}
.fx-canvas.top { z-index: 9; }

/* ── TOP BAR ───────────────────────────────────────────────── */
.table-topbar {
  position: absolute;
  top: 6px;
  left: 8px;
  right: 8px;
  height: 34px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 5;
}
.topbar-side { display: flex; gap: 5px; }
.logo {
  position: absolute;
  left: 50%;
  top: -3px;
  width: 152px;
  transform: translateX(-50%);
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.65));
  pointer-events: none;
}
.round-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: url("assets/art/btn.webp") center / 100% 100% no-repeat;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.55));
  transition: transform 120ms ease;
}
.round-btn:active { transform: scale(0.9); }
.round-btn svg { width: 16px; height: 16px; fill: var(--ivory); }
.round-btn .ln { fill: none; stroke: var(--ivory); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.sound-btn svg { width: 18px; height: 18px; }
.sound-btn .ln { stroke-width: 2; }
.sound-btn .snd-slash { display: none; }
.sound-btn.muted svg { fill: #a8937a; }
.sound-btn.muted .ln { stroke: #a8937a; }
.sound-btn.muted .snd-waves { display: none; }
.sound-btn.muted .snd-slash { display: inline; }

/* ── BOARD: card piles left / right, Joker in the doorway ──── */
.board { position: absolute; inset: 0; pointer-events: none; z-index: 4; }

.side-tag {
  position: absolute;
  top: 49px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 74px;
  height: 18px;
  padding: 1px 9px 0;            /* Baloo sits high in its line box */
  border-radius: 999px;
  transform: translateX(-50%);   /* centred over its pile of cards */
  font-family: var(--font-title);
  font-size: 11.5px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.8px;
  white-space: nowrap;
  background: rgba(21, 10, 6, 0.82);
}
.side-tag b { font-family: var(--font-num); font-size: 10.5px; line-height: 1; letter-spacing: 0; color: var(--ivory); margin-top: -1px; }
.side-tag.andar { left: 69px; color: var(--andar-hi); border: 1px solid rgba(255, 154, 46, 0.7); }
.side-tag.bahar { left: 321px; color: var(--bahar-hi); border: 1px solid rgba(43, 183, 196, 0.7); }

/* each pile is exactly as wide as its archway in the art */
.pile {
  position: absolute;
  top: 70px;
  width: 96px;
  height: 116px;
  transition: filter 300ms ease;
}
.pile-andar { left: 22px; }
.pile-bahar { left: 273px; }
.pile.win { filter: drop-shadow(0 0 7px rgba(255, 225, 140, 0.9)); }
.pile.lose { filter: brightness(0.55) saturate(0.6); }

.mini {
  position: absolute;
  width: 26px;
  height: 38px;
  border-radius: 3px;
  background: linear-gradient(160deg, #fffdf4, #f1e4c6);
  border: 1px solid #b08a4a;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.55);
  color: #1c1612;
  transition: transform 260ms cubic-bezier(0.3, 1.5, 0.5, 1), box-shadow 200ms;
}
.mini.red { color: #c8202f; }
.mini .m-rank {
  position: absolute;
  left: 1.5px;
  top: 1px;
  font-size: 11.5px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -1px;
}
.mini .m-suit-s { position: absolute; left: 2px; top: 12.5px; font-size: 8.5px; line-height: 1; }
.mini .m-suit { position: absolute; right: 1.5px; bottom: 1px; font-size: 16px; line-height: 1; }
.mini.match {
  z-index: 60 !important;
  transform-origin: 50% 15%;
  transform: scale(1.3);
  box-shadow: 0 0 0 1.5px var(--brass-hi), 0 0 14px 4px rgba(255, 215, 110, 0.95);
}

.joker {
  position: absolute;
  left: 150px;
  top: 50px;
  width: 78px;
  height: 114px;
  transform: scale(1.154);       /* drawn at 78 x 114, shown at 90 x 132 */
  transform-origin: 0 0;
}
.joker-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.7));
}
.joker::before {                /* dark niche behind the card */
  content: "";
  position: absolute;
  left: 17px;
  top: 28px;
  width: 44px;
  height: 73px;
  background: rgba(14, 7, 4, 0.78);
}
.card {
  position: absolute;
  left: 18.5px;
  top: 30px;
  width: 41px;
  height: 69px;
  perspective: 500px;
  opacity: 0;
}
.card.dealt { opacity: 1; }
.card-inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 520ms cubic-bezier(0.3, 0.7, 0.3, 1);
}
.card.flipped .card-inner { transform: rotateY(180deg); }
.card-back, .card-front {
  position: absolute;
  inset: 0;
  border-radius: 4px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.card-back { background: url("assets/art/card-back.webp") center / 100% 100% no-repeat; }
.card-front {
  transform: rotateY(180deg);
  background: linear-gradient(160deg, #fffdf4, #f1e4c6);
  border: 1px solid #b08a4a;
  color: #1c1612;
  overflow: hidden;
}
.card-front.red { color: #c8202f; }
.card-front .c-rank {
  position: absolute;
  left: 3px;
  top: 2px;
  font-size: 17px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -1px;
}
.card-front .c-suit-s { position: absolute; left: 4px; top: 20px; font-size: 11px; line-height: 1; }
.card-front .c-suit { position: absolute; right: 3px; bottom: 2px; font-size: 27px; line-height: 1; }
.joker.win .card-front { box-shadow: inset 0 0 0 2px #f2b63a, inset 0 0 12px rgba(255, 200, 80, 0.8); }
.joker.win .joker-frame { animation: frame-glow 900ms ease-in-out infinite; }

/* row on the chowki: timer | road | round number */
.timer {
  position: absolute;
  left: 8px;
  top: 194px;
  width: 44px;
  height: 46px;
  transform: scale(1.12);
  transform-origin: 0 50%;
  display: grid;
  place-items: center;
  background: url("assets/art/timer.webp") center / 100% 100% no-repeat;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
  transition: opacity 200ms ease;
}
.timer-ring { position: absolute; left: 9px; top: 10px; width: 26px; height: 26px; transform: rotate(-90deg); }
.timer-ring circle { fill: none; stroke-width: 6; }
.ring-track { stroke: rgba(0, 0, 0, 0.35); }
.ring-fill {
  stroke: #ffd35c;
  stroke-linecap: round;
  transition: stroke-dashoffset 250ms linear, stroke 200ms;
}
.timer.urgent .ring-fill { stroke: #ff4d3d; }
.timer-value {
  position: relative;
  font-size: 13px;
  font-weight: 800;
  color: var(--ivory);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}
.timer.urgent .timer-value { color: #ff9a8a; animation: beat 1s ease infinite; }
.phone-shell:not([data-phase="betting"]) .timer { opacity: 0.35; }
.phone-shell:not([data-phase="betting"]) .timer-value { visibility: hidden; }

.road {
  position: absolute;
  top: 199px;
  left: 60px;
  right: 60px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: flex-start;      /* fills from the left; 13 beads reach the right edge exactly */
  gap: 3.5px;                       /* (250 - 13 x 16) / 12: the same spacing whether there are 3 results or 13 */
  padding: 0;
  border: 9px solid transparent;
  border-width: 9px 16px;
  border-image: url("assets/art/tray.webp") 48 86 fill / 9px 16px stretch;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.55));
}
/* the cloth of the tray starts inside its rounded ends: let the row reach it */
.road .bead:first-child { margin-left: -6px; }

.bead {
  flex: none;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-family: var(--font-num);
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.75), 0 0 2px rgba(0, 0, 0, 0.5);
  box-shadow: inset 0 -2px 2px rgba(0, 0, 0, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.35), 0 1px 1px rgba(0, 0, 0, 0.4);
}
.bead.a { background: radial-gradient(circle at 40% 30%, #ffa53a, #c9520a); }
.bead.b { background: radial-gradient(circle at 40% 30%, #2fb9c6, #075f6c); }
.road .bead:last-child { box-shadow: 0 0 0 1.5px #5a3312, 0 0 5px rgba(90, 50, 15, 0.8); }
.road .bead.new { animation: bead-in 420ms cubic-bezier(0.3, 1.6, 0.5, 1); }

.round-pill {
  position: absolute;
  right: 8px;
  top: 208px;
  width: 46px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  background: url("assets/art/pill.webp") center / 100% 100% no-repeat;
  font-size: 8.5px;
  font-weight: 700;
  color: var(--brass-hi);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ── BET ZONES ─────────────────────────────────────────────── */
.zones {
  position: absolute;
  top: 248px;
  left: 8px;
  right: 8px;
  height: 138px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  z-index: 4;
}
.zone {
  position: relative;
  display: block;
  padding: 0;
  border: 0;
  border-radius: 6px;
  overflow: visible;
  text-align: center;
  transition: transform 120ms ease, filter 300ms ease;
}
.zone::after {                 /* win glow ring */
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 7px;
  pointer-events: none;
  opacity: 0;
  box-shadow: 0 0 0 2px var(--brass-hi), 0 0 20px 5px rgba(255, 210, 110, 0.75), inset 0 0 22px rgba(255, 225, 150, 0.55);
}
.zone-andar { background: url("assets/art/zone-andar.webp") center / 100% 100% no-repeat; }
.zone-bahar { background: url("assets/art/zone-bahar.webp") center / 100% 100% no-repeat; }
.zone:active { transform: scale(0.97); }
.zone.flash { animation: zone-flash 320ms ease; }

.zone-title {
  position: absolute;
  left: 0;
  right: 0;
  top: 33px;
  font-family: var(--font-title);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 1.5px;
  line-height: 1;
  color: #fff;
}
.zone-andar .zone-title { color: #fff3da; text-shadow: 0 2px 0 #7a3306, 0 0 10px rgba(120, 50, 0, 0.7); }
.zone-bahar .zone-title { color: #e9fdff; text-shadow: 0 2px 0 #06434b, 0 0 10px rgba(0, 50, 60, 0.7); }
.zone-odds {
  position: absolute;
  left: 50%;
  top: 59px;
  transform: translateX(-50%);
  padding: 1px 10px;
  border-radius: 999px;
  background: rgba(21, 10, 6, 0.6);
  font-size: 12px;
  font-weight: 800;
  color: var(--brass-hi);
  white-space: nowrap;
}
.zone-pot {
  position: absolute;
  left: 50%;
  bottom: 9px;
  transform: translateX(-50%);
  min-width: 64%;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(21, 10, 6, 0.72);
  border: 1px solid rgba(243, 223, 166, 0.35);
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.82);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  z-index: 7;
}
.zone-pot b { color: var(--brass-hi); }
.zone-pot.tick { animation: pot-tick 260ms ease; }
.zone.win::after { opacity: 1; animation: glow-pulse 900ms ease-in-out infinite; }
.zone.lose { filter: brightness(0.45) saturate(0.6); }
.phone-shell:not([data-phase="betting"]) .zone { cursor: default; }
.phone-shell:not([data-phase="betting"]) .zone:active { transform: none; }

/* ── CHIPS (carved wood plates with a painted token) ───────── */
.chip-row {
  position: absolute;
  top: 392px;
  left: 8px;
  right: 8px;
  height: 36px;
  display: flex;
  align-items: center;
  gap: 5px;
  z-index: 4;
}
.repeat-btn {
  flex: none;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: url("assets/art/btn.webp") center / 100% 100% no-repeat;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5));
}
.repeat-btn svg { width: 17px; height: 17px; }
.repeat-btn .ln { fill: none; stroke: var(--ivory); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.repeat-btn:disabled { opacity: 0.4; }
.chip-bar { flex: 1; display: flex; gap: 4px; }
.chip {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--ivory);
  background: url("assets/art/pill.webp") center / 100% 100% no-repeat;
  transition: transform 120ms ease, filter 120ms ease;
}
.chip-dot {
  width: 21px;
  height: 22px;
  flex-shrink: 0;
  background: url("assets/art/chip-100.webp") center / 100% 100% no-repeat;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.5));
}
[data-chip="1000"] .chip-dot { background-image: url("assets/art/chip-1000.webp"); }
[data-chip="10000"] .chip-dot { background-image: url("assets/art/chip-10000.webp"); }
[data-chip="100000"] .chip-dot { background-image: url("assets/art/chip-100000.webp"); }
.chip:active { transform: translateY(1px) scale(0.95); }
.chip.active {
  color: #fff;
  transform: translateY(-2px);
  filter: brightness(1.5) drop-shadow(0 0 6px rgba(255, 200, 90, 0.9));
}
.chip.poor { opacity: 0.45; filter: saturate(0.4); }
.phone-shell:not([data-phase="betting"]) .chip-row { opacity: 0.55; }

.wallet-row {
  position: absolute;
  top: 433px;
  left: 8px;
  right: 10px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 4;
}
.balance-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 15px 0 5px;
  border-radius: 999px;
  background: linear-gradient(180deg, #3a2014, #1d0f09);
  border: 1.5px solid var(--brass);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 2px 4px rgba(0, 0, 0, 0.4);
  font-size: 15.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--brass-hi);
}
.balance-pill.bump { animation: bump 260ms ease; }
.coin-icon { width: 23px; height: 23px; object-fit: contain; }
.my-bet { font-size: 12px; font-weight: 700; color: rgba(246, 234, 208, 0.7); }
.my-bet b { margin-left: 4px; font-size: 15.5px; color: var(--brass-hi); font-variant-numeric: tabular-nums; }

/* ── FLYING CHIPS ──────────────────────────────────────────── */
.fly-layer { position: absolute; inset: 0; pointer-events: none; z-index: 6; }

/*
 * WIN badges: one over each bet zone, in their own layer ABOVE the flying
 * chips (the zones sit below the chip layer, so a badge inside a zone was
 * buried under the pile). Shown by .table-inner[data-winner].
 */
.win-badges {
  position: absolute;
  top: 248px;
  left: 8px;
  right: 8px;
  height: 138px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  pointer-events: none;
  z-index: 7;
}
.zone-badge {
  place-self: center;
  transform: translateY(24px) scale(0.4);    /* centred on the chip band */
  padding: 2px 20px 0;
  border-radius: 7px;
  background: linear-gradient(180deg, #fff1c4, #e2b45a 55%, #9c6f24);
  border: 1px solid #fff3cf;
  color: #3a1d00;
  font-family: var(--font-title);
  font-size: 23px;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: 1.5px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.7), 0 0 14px rgba(255, 210, 110, 0.7);
  opacity: 0;
}
.table-inner[data-winner="andar"] .zone-badge.andar,
.table-inner[data-winner="bahar"] .zone-badge.bahar {
  opacity: 1;
  transform: translateY(24px) scale(1);
  transition: transform 380ms cubic-bezier(0.3, 1.7, 0.5, 1), opacity 200ms;
}
.disc {
  position: absolute;
  left: 0;
  top: 0;
  width: 24px;
  height: 25px;
  margin: -12.5px 0 0 -12px;
  color: #3a1d0c;
  background: url("assets/art/chip-100.webp") center / 100% 100% no-repeat;
  filter: drop-shadow(0 1.5px 1.5px rgba(0, 0, 0, 0.55));
}
/*
 * The value sits exactly on the middle of the chip's face (the art has a rim
 * at the bottom, so the face centre is at 48%, not 50%). It is drawn at 12px
 * and scaled down: browsers with a minimum font size would otherwise blow a
 * 6px label up and push it off centre.
 */
.disc span {
  position: absolute;
  left: 50%;
  top: 48%;
  transform: translate(-50%, -50%) scale(0.5);
  font-size: 13.5px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}
.disc[data-v="1000"] { background-image: url("assets/art/chip-1000.webp"); }
.disc[data-v="10000"] { background-image: url("assets/art/chip-10000.webp"); color: #fff3da; }
.disc[data-v="100000"] { background-image: url("assets/art/chip-100000.webp"); color: #eafcff; }
.disc[data-v="100000"] span { transform: translate(-50%, -50%) scale(0.4); }
.disc.mine { filter: drop-shadow(0 0 1.5px #fff3c4) drop-shadow(0 0 3px rgba(255, 220, 130, 0.9)) drop-shadow(0 1.5px 1.5px rgba(0, 0, 0, 0.5)); }
.coin-fly {
  position: absolute;
  left: 0;
  top: 0;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  background: url("assets/ui/coin.png") center / contain no-repeat;
}

/* ── BIG MOMENT ────────────────────────────────────────────── */
.stage-fx { position: absolute; inset: 0; pointer-events: none; }
.stage-fx > * { position: absolute; opacity: 0; z-index: 8; will-change: transform, opacity; }
.fx-scrim {
  inset: 0 -80px -60px;
  background: radial-gradient(ellipse at 50% 40%, rgba(21, 10, 6, 0.72), rgba(10, 4, 2, 0.94) 75%);
  /* soft top edge, so the dark doesn't cut a hard line across the live stream */
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 12%);
  mask-image: linear-gradient(180deg, transparent 0, #000 12%);
}
.fx-flash {
  inset: -40px;
  background: radial-gradient(circle at 50% 38%, rgba(255, 255, 255, 0.95), rgba(255, 230, 170, 0.5) 25%, transparent 60%);
  mix-blend-mode: screen;
}
.fx-flash.warm { background: radial-gradient(circle at 50% 38%, rgba(255, 245, 220, 0.95), rgba(255, 150, 40, 0.55) 30%, transparent 65%); }
.fx-flash.cool { background: radial-gradient(circle at 50% 38%, rgba(235, 252, 255, 0.95), rgba(40, 180, 200, 0.55) 30%, transparent 65%); }
/* win clip (transparent WebM) or the still: 4:3 */
.fx-win { left: 3px; top: 8px; width: 384px; height: 288px; object-fit: contain; }
.fx-banner {
  left: 68px;
  top: 306px;
  width: 254px;
  height: 120px;
  background: url("assets/art/banner.webp") center / 100% 100% no-repeat;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6));
}
.fx-title {
  position: absolute;
  left: 40px;
  right: 40px;
  top: 39px;
  height: 42px;
  display: grid;
  place-items: center;
  font-family: var(--font-title);
  font-size: 22.5px;
  font-weight: 800;
  letter-spacing: 0.5px;
  line-height: 1;
  white-space: nowrap;
  color: #a8480a;
}
.fx-title.andar { color: #c2560a; text-shadow: 0 1px 0 #fff3d0; }
.fx-title.bahar { color: #0b7785; text-shadow: 0 1px 0 #f2fdff; }
.table-inner.shake { animation: shake 420ms cubic-bezier(0.36, 0.07, 0.19, 0.97); }

/* ── RIBBON / WIN POP ──────────────────────────────────────── */
.ribbon {
  position: absolute;
  left: 50%;
  top: 201px;
  transform: translateX(-50%);
  padding: 4px 28px 3px;
  white-space: nowrap;
  font-family: var(--font-title);
  font-size: 17.5px;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: #3a1d00;
  background: linear-gradient(180deg, #fff3cf, #e8be68 55%, #a87628);
  clip-path: polygon(0 50%, 8% 0, 92% 0, 100% 50%, 92% 100%, 8% 100%);
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.6));
  z-index: 10;
  animation: ribbon-in 380ms cubic-bezier(0.3, 1.5, 0.5, 1) both;
}
.ribbon.out { animation: ribbon-out 240ms ease forwards; }
.win-pop {
  position: absolute;
  left: 50%;
  top: 288px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 18px 7px 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(58, 32, 20, 0.97), rgba(21, 10, 6, 0.97));
  border: 1.5px solid var(--brass);
  box-shadow: 0 0 24px rgba(255, 200, 80, 0.55), 0 6px 14px rgba(0, 0, 0, 0.6);
  z-index: 11;
  animation: pop-in 480ms cubic-bezier(0.3, 1.6, 0.5, 1) both;
}
/* shown instead of the win pop when my bets lost */
.lose-pop {
  position: absolute;
  left: 50%;
  top: 292px;
  transform: translateX(-50%);
  padding: 9px 20px 8px;
  border-radius: 999px;
  white-space: nowrap;
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.4px;
  line-height: 1;
  color: var(--ivory);
  background: linear-gradient(180deg, rgba(58, 32, 20, 0.97), rgba(21, 10, 6, 0.97));
  border: 1.5px solid var(--brass);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.6);
  z-index: 11;
  animation: pop-in 480ms cubic-bezier(0.3, 1.6, 0.5, 1) both;
}
.win-pop img { width: 30px; height: 30px; }
.win-amount {
  font-size: 26px;
  font-weight: 800;
  color: var(--brass-hi);
  text-shadow: 0 0 10px rgba(255, 200, 80, 0.8);
  font-variant-numeric: tabular-nums;
}

/* ── MODALS ────────────────────────────────────────────────── */
/* covers only the game table — the live-stream area above stays untouched */
.modal {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--table-h) + env(safe-area-inset-bottom));
  display: grid;
  place-items: end center;
  padding: 0 10px calc(10px + env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.5);
  z-index: 20;
}
.modal-card {
  position: relative;
  width: 100%;
  max-height: calc(var(--table-h) - 10px);
  overflow: auto;
  padding: 14px 16px 16px;
  border-radius: 14px;
  background: linear-gradient(180deg, #3a2014, #1a0d08);
  border: 2px solid var(--brass);
  box-shadow: 0 -6px 30px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(246, 234, 208, 0.15);
  font-size: 13px;
  line-height: 1.45;
  animation: sheet-up 260ms cubic-bezier(0.2, 0.9, 0.3, 1);
}
.modal-card h2 {
  margin: 0 0 8px;
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 800;
  color: var(--brass-hi);
  text-align: center;
}
.modal-card h3 { margin: 12px 0 6px; font-size: 13px; color: var(--brass-hi); }
.modal-card h3 small { color: rgba(246, 234, 208, 0.55); font-weight: 500; }
.modal-close {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: url("assets/art/btn.webp") center / 100% 100% no-repeat;
}
.modal-close svg { width: 13px; height: 13px; }
.modal-close .ln { fill: none; stroke: var(--ivory); stroke-width: 2.4; stroke-linecap: round; }
.how-list { margin: 0; padding-left: 18px; color: rgba(246, 234, 208, 0.9); }
.how-list li + li { margin-top: 5px; }
.c-andar { color: var(--andar-hi); }
.c-bahar { color: var(--bahar-hi); }
.c-joker { color: var(--brass-hi); }
.pay-table { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.pay-table div {
  display: grid;
  justify-items: center;
  padding: 6px 4px;
  border-radius: 10px;
  background: rgba(246, 234, 208, 0.07);
  border: 1px solid rgba(246, 234, 208, 0.14);
  font-weight: 700;
}
.pay-table b { font-size: 17px; color: var(--brass-hi); }
.rank-line { margin: 10px 0 0; text-align: center; font-size: 11.5px; color: rgba(246, 234, 208, 0.65); }
.trend-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin-bottom: 10px; }
.trend-stats div {
  padding: 6px 4px;
  border-radius: 10px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  background: rgba(246, 234, 208, 0.07);
}
.trend-stats b { display: block; font-size: 17px; }
.bead-plate {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(6, 18px);
  grid-auto-columns: 18px;
  gap: 3px;
  justify-content: start;
  padding: 6px;
  border-radius: 10px;
  background: var(--ivory);
  overflow-x: auto;
}
.bead-plate .bead { width: 18px; height: 18px; font-size: 11.5px; }
.trend-note { margin: 8px 0 0; font-size: 11px; color: rgba(246, 234, 208, 0.5); text-align: center; }

/* ── TOASTS ────────────────────────────────────────────────── */
.toast-root {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--table-h) + 8px);
  display: grid;
  gap: 6px;
  pointer-events: none;
  z-index: 30;
}
.toast {
  justify-self: center;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(21, 10, 6, 0.9);
  border: 1px solid rgba(201, 162, 90, 0.6);
  font-size: 12px;
  font-weight: 700;
  animation: toast 2s ease forwards;
}

/* ── KEYFRAMES ─────────────────────────────────────────────── */
@keyframes frame-glow {
  0%, 100% { filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 4px rgba(255, 210, 100, 0.6)); }
  50% { filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 12px rgba(255, 220, 120, 1)); }
}
@keyframes glow-pulse {
  0%, 100% { opacity: 0.65; }
  50% { opacity: 1; }
}
@keyframes zone-flash {
  0% { filter: brightness(1); }
  40% { filter: brightness(1.4); }
  100% { filter: brightness(1); }
}
@keyframes shake {
  10%, 90% { transform: translateX(calc(-50% - 1px)) scale(var(--s)); }
  20%, 80% { transform: translateX(calc(-50% + 3px)) scale(var(--s)); }
  30%, 50%, 70% { transform: translateX(calc(-50% - 5px)) scale(var(--s)); }
  40%, 60% { transform: translateX(calc(-50% + 5px)) scale(var(--s)); }
}
@keyframes ribbon-in {
  from { opacity: 0; transform: translateX(-50%) scale(0.5); }
  to { opacity: 1; transform: translateX(-50%) scale(1); }
}
@keyframes ribbon-out {
  to { opacity: 0; transform: translateX(-50%) scale(0.9); }
}
@keyframes pop-in {
  from { opacity: 0; transform: translateX(-50%) scale(0.4); }
  to { opacity: 1; transform: translateX(-50%) scale(1); }
}
@keyframes bead-in {
  from { transform: scale(0); }
  to { transform: scale(1); }
}
@keyframes sheet-up {
  from { transform: translateY(40px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes toast {
  0% { opacity: 0; transform: translateY(8px); }
  12%, 82% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-8px); }
}
@keyframes beat {
  0%, 100% { transform: scale(1); }
  30% { transform: scale(1.22); }
}
@keyframes pot-tick {
  0%, 100% { transform: translateX(-50%) scale(1); }
  40% { transform: translateX(-50%) scale(1.1); }
}
@keyframes bump {
  0%, 100% { transform: scale(1); }
  40% { transform: scale(1.08); }
}

@media (prefers-reduced-motion: reduce) {
  .zone.win::after, .joker.win .joker-frame { animation: none !important; }
}