:root {
  /* WhatsApp-dark tokens — reuse these everywhere */
  --wa-bg: #0b141a;
  --wa-bg-2: #111b21;
  --wa-panel: #202c33;
  --wa-panel-2: #2a3942;
  --wa-stroke: #2a3942;
  --wa-stroke-2: #3b4a54;
  --wa-text: #e9edef;
  --wa-muted: #8696a0;
  --wa-faint: #667781;
  --wa-accent: #00a884;
  --wa-accent-2: #25d366;
  --wa-accent-ink: #052e24;
  --wa-bubble: #005c4b;
  --wa-you: #00a884;
  --wa-bot: #3b4a54;
  --wa-wait: #ffce31;
  --wa-gold: #ffb938;
  --wa-danger: #ea4335;
  --wa-ok: #25d366;
  --wa-blue: #53bdeb;
  --wa-shadow: 0 8px 24px rgba(0, 0, 0, .35);

  /* App aliases (old names keep working) */
  --brand: var(--wa-accent);
  --brand2: var(--wa-accent-2);
  --mint: var(--wa-bg-2);
  --mint2: var(--wa-panel);
  --card: var(--wa-panel);
  --stroke: var(--wa-stroke);
  --stroke2: var(--wa-stroke-2);
  --text: var(--wa-text);
  --muted: var(--wa-muted);
  --faint: var(--wa-faint);
  --gold: var(--wa-gold);
  --red: var(--wa-danger);
  --yellow: var(--wa-wait);
  --green: var(--wa-ok);
  --blue: var(--wa-blue);
  --danger: var(--wa-danger);
  --ok: var(--wa-ok);
  --dark: var(--wa-bg);
  --radius: 18px;
  --kb-nav-h: calc(72px + env(safe-area-inset-bottom, 0px));
  --kb-play-bottom: max(14px, env(safe-area-inset-bottom, 0px));
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  font-family: Outfit, Inter, ui-sans-serif, system-ui, sans-serif;
  background: var(--wa-bg);
  color: var(--text);
  color-scheme: dark;
  touch-action: pan-x pan-y;
  -ms-touch-action: pan-x pan-y;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overscroll-behavior: auto;
}
body { min-height: 100dvh; }
@media (display-mode: standalone), (display-mode: fullscreen), (display-mode: minimal-ui) {
  html, body {
    background: var(--wa-bg);
    overscroll-behavior: auto;
    min-height: 100dvh;
    min-height: -webkit-fill-available;
  }
  body { padding-top: env(safe-area-inset-top); }
  #install-bar, #ios-tip { display: none !important; }
  .screen { padding-top: calc(16px + env(safe-area-inset-top, 0px)); }
  .play-wrap .topbar { padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
  .play-wrap { background: #07111f; }
}
html.kb-app body {
  padding-top: env(safe-area-inset-top);
  overscroll-behavior: auto;
}
html.kb-app, html.kb-app body {
  overscroll-behavior: auto;
  -webkit-user-select: none;
  user-select: none;
}
html.kb-app input, html.kb-app textarea, html.kb-app [contenteditable] {
  -webkit-user-select: text;
  user-select: text;
}
html.kb-app #install-bar, html.kb-app #ios-tip { display: none !important; }
html.kb-app .screen { padding-top: calc(16px + env(safe-area-inset-top, 0px)); }
html.kb-app .play-wrap .topbar { padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
.hidden { display: none !important; }
#install-bar,
#ios-tip {
  display: none !important;
}
button, input, select { font: inherit; }
button { cursor: pointer; }

.app-toast {
  position: fixed;
  left: 50%;
  bottom: var(--kb-nav-h);
  transform: translateX(-50%);
  z-index: 80;
  background: #0f172a;
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: .9rem;
  max-width: 90vw;
}
.app-toast.err { background: var(--danger); }

/* Invisible Firebase phone auth — never show Google badge / challenge chrome */
#recaptcha-container,
.grecaptcha-badge,
iframe[src*="recaptcha"],
iframe[src*="google.com/recaptcha"],
body.kb-hide-recaptcha #recaptcha-container,
body.kb-hide-recaptcha .grecaptcha-badge,
body.kb-hide-recaptcha iframe[src*="recaptcha"],
body.kb-hide-recaptcha iframe[src*="google.com/recaptcha"] {
  position: fixed !important;
  left: -9999px !important;
  top: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  z-index: -1 !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
}

.screen { min-height: 100dvh; padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom)); overflow-x: clip; overflow-y: visible; }
/* Stake / arena screens keep bottom nav — lift CTAs above it */
#view-game-home.screen,
#view-ludo-home.screen {
  padding-bottom: calc(20px + var(--kb-nav-h));
}
#view-game-home .match-cta,
#view-ludo-home .match-cta {
  position: sticky;
  bottom: calc(8px + var(--kb-nav-h));
  z-index: 5;
  margin-top: 10px;
  padding: 8px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(11,20,26,0), var(--wa-bg) 38%);
  backdrop-filter: blur(8px);
}
.center-col {
  max-width: 420px;
  margin: 0 auto;
  display: grid;
  gap: 14px;
}

.brand-head { text-align: center; padding-top: 12px; }
.brand-head img { width: 72px; height: 72px; filter: drop-shadow(0 10px 18px rgba(0, 168, 132, .28)); }
.brand-head h1 { margin: 10px 0 4px; font-size: 1.45rem; }
.brand-head p { margin: 0; color: var(--muted); }

.panel {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 22px;
  padding: 18px;
}
.panel h2 { margin: 0 0 6px; }
.lead { margin: 0 0 14px; color: var(--muted); font-size: .92rem; }

.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field label { font-size: .78rem; color: var(--muted); font-weight: 600; }
.field input, .field select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--stroke2);
  background: var(--mint);
  color: var(--text);
}
.phone-row {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--stroke2);
  border-radius: 14px;
  overflow: hidden;
  background: var(--mint);
}
.phone-row span {
  display: grid;
  place-items: center;
  padding: 0 12px;
  font-weight: 800;
  color: var(--brand);
  border-right: 1px solid var(--stroke2);
  white-space: nowrap;
}
.phone-row input {
  border: 0 !important;
  border-radius: 0 !important;
  flex: 1;
}
.otp-input {
  text-align: center;
  letter-spacing: .4em;
  font-weight: 800;
  font-size: 1.35rem;
}

.btn {
  border: 0;
  border-radius: 14px;
  padding: 13px 16px;
  width: 100%;
  font-weight: 800;
  background: linear-gradient(180deg, var(--wa-accent-2) 0%, var(--wa-accent) 100%);
  color: #fff;
  box-shadow:
    0 1px 0 rgba(255,255,255,.22) inset,
    0 -2px 0 rgba(0,0,0,.22) inset,
    0 8px 18px rgba(0, 168, 132, .28);
  text-shadow: 0 1px 0 rgba(0,0,0,.25);
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.btn:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(1px);
  box-shadow:
    0 1px 0 rgba(255,255,255,.2) inset,
    0 3px 8px rgba(15, 118, 110, .22);
}
.btn:disabled { opacity: .5; }
.btn.ghost {
  background: var(--wa-panel);
  color: var(--wa-accent-2);
  border: 1px solid var(--wa-stroke);
  box-shadow: none;
  text-shadow: none;
}
.btn.gold {
  background: linear-gradient(180deg, #fcd34d, #f59e0b 50%, #d97706);
  color: #fff;
  box-shadow:
    0 1px 0 rgba(255,255,255,.4) inset,
    0 -2px 0 rgba(0,0,0,.12) inset,
    0 8px 16px rgba(217, 119, 6, .28);
}
.btn.ai {
  margin-top: 10px;
  background: #0f172a;
  color: #fff;
}
.or {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--faint);
  font-size: .75rem;
  font-weight: 700;
  margin: 12px 0;
}
.or:before, .or:after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--stroke);
}
#google-btn { display: flex; justify-content: center; min-height: 44px; }
.hint-box {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #ecfeff;
  color: var(--muted);
  font-size: .8rem;
  border: 1px solid var(--stroke);
}
.linkish { background: none; border: 0; color: var(--brand2); font-weight: 700; padding: 8px; width: auto; }

.banner {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--card);
  color: var(--text);
  border-radius: 16px;
  padding: 10px 14px;
  margin: 8px auto;
  max-width: 1120px;
  border: 1px solid var(--stroke);
}
.banner:not(.hidden) { display: flex; }
@media (min-width: 900px) {
  .banner:not(.hidden) { display: none !important; }
}

.shell {
  width: min(1120px, calc(100% - clamp(16px, 3vw, 80px)));
  margin: 0 auto;
  padding: 16px 0 var(--kb-nav-h);
}
@media (min-width: 900px) {
  .shell { padding: 28px 0 48px; }
}
.hello {
  margin: 18px 4px 6px;
  font-size: clamp(1.35rem, 3vw, 2rem);
  font-weight: 800;
}
.hello span { color: var(--brand); }
.subhead {
  margin: 0 4px 16px;
  color: var(--muted);
  font-size: clamp(.9rem, 2vw, 1.05rem);
}
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 22px;
  padding: 14px 16px;
}
.avatar { width: 48px; height: 48px; }
@media (min-width: 900px) {
  .avatar { width: 56px; height: 56px; }
  .who b { font-size: 1.15rem; }
  .bal { font-size: 1.15rem; padding: 10px 16px; }
}

.games {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}
@media (min-width: 700px) {
  .games { gap: 14px; }
}
@media (min-width: 1024px) {
  .games { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
}
.game {
  aspect-ratio: 1 / 1;
  min-height: 0;
  border: 0;
  padding: 0;
  border-radius: 18px;
  overflow: hidden;
  position: relative;
  background:
    linear-gradient(160deg, #1a2744 0%, #0b1220 55%, #07111f 100%);
  text-align: left;
  cursor: pointer;
  isolation: isolate;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .18) inset,
    0 -2px 0 rgba(0, 0, 0, .35) inset,
    0 12px 28px rgba(7, 17, 31, .28),
    0 2px 0 rgba(15, 118, 110, .12);
  transform: translateZ(0);
  transition: transform .22s cubic-bezier(.2, .9, .2, 1), box-shadow .22s ease;
}
.game::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 3;
  box-shadow:
    inset 0 0 0 1.5px rgba(255, 255, 255, .14),
    inset 0 0 0 3px rgba(7, 17, 31, .35);
}
.game::after {
  content: '';
  position: absolute;
  top: -40%;
  left: -30%;
  width: 55%;
  height: 160%;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(
    105deg,
    transparent 0%,
    rgba(255, 255, 255, .0) 38%,
    rgba(255, 255, 255, .28) 50%,
    rgba(255, 255, 255, .0) 62%,
    transparent 100%
  );
  transform: translateX(-120%) rotate(8deg);
  transition: transform .65s ease;
}
.game:hover::after,
.game:focus-visible::after {
  transform: translateX(220%) rotate(8deg);
}
.game img {
  position: absolute;
  top: 6px;
  left: 6px;
  width: calc(100% - 12px);
  height: calc(100% - 42px);
  max-width: none;
  max-height: none;
  border-radius: 12px;
  object-fit: contain;
  object-position: center center;
  background:
    radial-gradient(ellipse 70% 60% at 50% 40%, rgba(45, 212, 191, .12), transparent 65%),
    linear-gradient(165deg, #1a2744 0%, #0b1220 100%);
  display: block;
  z-index: 0;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .35);
  transition: transform .35s cubic-bezier(.2, .9, .2, 1), filter .35s ease;
}
.game span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px 9px;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: -.01em;
  color: #f8fafc;
  background:
    linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border-top: 1px solid rgba(255, 255, 255, .1);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .55);
  box-shadow: 0 -8px 18px rgba(0, 0, 0, .25);
}
.game span::after {
  content: 'PLAY';
  flex-shrink: 0;
  font-size: .58rem;
  font-weight: 900;
  letter-spacing: .08em;
  padding: 4px 7px;
  border-radius: 999px;
  color: #042f2e;
  background: linear-gradient(180deg, #5eead4, #14b8a6 55%, #0f766e);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .45) inset,
    0 2px 6px rgba(15, 118, 110, .45);
}
.game:hover,
.game:focus-visible {
  transform: translateY(-5px) scale(1.015);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .22) inset,
    0 -2px 0 rgba(0, 0, 0, .4) inset,
    0 18px 36px rgba(7, 17, 31, .38),
    0 0 0 1px rgba(45, 212, 191, .28);
}
.game:hover img,
.game:focus-visible img {
  transform: scale(1.02);
  filter: saturate(1.05) contrast(1.02) brightness(1.02);
}
.game:active {
  transform: translateY(-1px) scale(.985);
}
@media (min-width: 900px) {
  .game { border-radius: 20px; }
  .game span { font-size: .9rem; min-height: 38px; padding: 9px 12px 10px; }
  .game img {
    top: 6px;
    left: 6px;
    width: calc(100% - 12px);
    height: calc(100% - 44px);
    border-radius: 14px;
  }
}
.quick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}
@media (min-width: 900px) {
  .quick { grid-template-columns: repeat(3, 1fr); gap: 16px; }
}
.quick button {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 20px;
  padding: 18px;
  text-align: left;
  font-weight: 800;
  font-size: 1rem;
  color: var(--text);
}
.quick button small { display: block; font-weight: 500; color: var(--muted); margin-top: 4px; }

.nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(32, 44, 51, .94);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--wa-stroke);
  box-shadow: 0 -10px 28px rgba(0, 0, 0, .35);
}
/* Immersive play / lobby: never let bottom nav cover game docks / dice / CTAs */
body:has(#view-table-play:not(.hidden)) #app-nav,
body:has(#view-ludo-play:not(.hidden)) #app-nav,
body:has(#view-ludo-lobby:not(.hidden)) #app-nav {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
}
.nav button {
  appearance: none;
  background: none;
  border: 0;
  color: #94a3b8;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .01em;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 2px 2px;
  min-height: 56px;
  border-radius: 16px;
}
.nav-ico {
  width: 48px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 16px;
}
.nav-ico svg { width: 24px; height: 24px; display: block; }
.nav-ico .in { display: none; }
.nav button.on {
  color: var(--brand);
  font-weight: 700;
}
.nav button.on .nav-ico {
  background: rgba(0, 168, 132, .18);
}
.nav button.on .out { display: none; }
.nav button.on .in { display: block; }
@media (min-width: 900px) {
  .nav {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(1120px, calc(100% - clamp(24px, 4vw, 96px)));
    bottom: 14px;
    border: 1px solid var(--stroke);
    border-radius: 28px;
    padding: 8px 10px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, .12);
  }
  .shell { padding-bottom: calc(var(--kb-nav-h) + 48px); }
}
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 800;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.who b { display: block; }
.who span { color: var(--muted); font-size: .8rem; }
.bal {
  background: var(--mint);
  border: 1px solid var(--stroke2);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 800;
  color: var(--brand);
}

.tx { display: grid; gap: 8px; }
.tx > div {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  font-size: .9rem;
}

/* Ludo board (dark play surface) */
.play-wrap { background: var(--dark); color: #f4f7fb; min-height: 100dvh; padding: 12px; padding-bottom: 24px; }
.play-wrap .topbar {
  display: flex; justify-content: space-between; align-items: center;
  background: #10233c; border: 1px solid #1d3a5c; border-radius: 16px; padding: 10px 12px; margin-bottom: 12px;
}
.play-wrap .btn { width: auto; padding: 10px 14px; }
.layout { display: grid; grid-template-columns: minmax(0,1fr) 280px; gap: 12px; }
@media (max-width: 860px) { .layout { grid-template-columns: 1fr; } }
.board-wrap { position: relative; background: #10233c; border: 1px solid #1d3a5c; border-radius: 16px; padding: 10px; display: grid; place-items: center; overflow: visible; }
.board {
  width: min(100%, 72vh, 640px);
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  grid-template-rows: repeat(15, 1fr);
  gap: 1px;
  background: #1a1a1a;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  touch-action: manipulation;
}
.cell { position: relative; background: #f7f4ee; }
.token {
  position: absolute; width: 70%; height: 70%; left: 15%; top: 15%;
  border-radius: 50%; z-index: 2; border: 2px solid #111;
}
.panel-dark { display: grid; gap: 10px; }
.panel-dark .card { background: #10233c; border: 1px solid #1d3a5c; border-radius: 16px; padding: 12px; }
.player { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 12px; border: 1px solid #1d3a5c; }
.player > div { display: grid; }
.player.active { border-color: #14b8a6; background: #0d2a32; }
.dot { width: 12px; height: 12px; border-radius: 50%; }
.dot.red { background: var(--red); }
.dot.yellow { background: var(--yellow); }
.dot.white { background: #f8fafc; border: 1px solid #111; }
.dot.black { background: #111; }
.dot.X, .dot.teal { background: #0d9488; }
.dot.O, .dot.gold { background: #d97706; }
.dot.blue { background: #38bdf8; }
.dice { width: 72px; height: 72px; border-radius: 14px; background: #fff; color: #111; display: grid; place-items: center; font-size: 2rem; font-weight: 800; margin: 0 auto; }
.dice.spin { animation: diceShake .28s ease-out 1; }
@keyframes spin { to { transform: rotate(360deg); } }
.log { max-height: 120px; overflow: auto; color: #93a4bb; font-size: .85rem; }
.code { font-family: ui-monospace, monospace; letter-spacing: .16em; font-size: 1.4rem; }
.friends-banner, .refer-banner {
  width: 100%;
  border: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  margin-top: 0;
  border-radius: 16px;
  padding: 14px;
  color: #fff;
}
.friends-banner {
  background: linear-gradient(120deg, #0f766e, #0d9488 55%, #134e4a);
}
.refer-banner {
  background: linear-gradient(120deg, #fff7ed, #ffedd5);
  color: #9a3412;
  border: 1px solid #fdba74;
}
.friends-banner b, .refer-banner b { display: block; font-size: .95rem; }
.friends-banner small, .refer-banner small { display: block; opacity: .88; font-weight: 500; margin-top: 2px; }
.ico {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center; font-size: 1.15rem;
  background: rgba(255,255,255,.16); flex-shrink: 0;
}
.refer-banner .ico { background: #fff; }
.friends-ico::before {
  content: '';
  width: 18px; height: 12px;
  background:
    radial-gradient(circle at 30% 40%, #fff 0 3px, transparent 3.5px),
    radial-gradient(circle at 70% 40%, #fff 0 3px, transparent 3.5px),
    radial-gradient(circle at 50% 100%, #fff 0 5px, transparent 5.5px);
}
.refer-ico::before {
  content: '';
  width: 12px; height: 12px;
  background: #ea580c;
  clip-path: polygon(50% 0, 100% 38%, 82% 100%, 18% 100%, 0 38%);
}

.table-board {
  width: min(100%, 72vh, 640px);
  aspect-ratio: 1;
  margin: 0 auto;
  display: grid;
  gap: 0;
  border-radius: 12px;
  overflow: hidden;
  background: #1a1a1a;
  touch-action: manipulation;
}
.table-board.chess, .table-board.checkers { grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); }
.table-board.checkers {
  background: #2c1810 url("/web/assets/packages/flutter_chess_board/images/brown_board.png") center / 100% 100% no-repeat;
  gap: 0;
  box-shadow: 0 0 0 5px #5d4037, 0 0 0 8px #c4a35a, 0 14px 32px rgba(0,0,0,.45);
  border-radius: 4px;
  overflow: hidden;
  aspect-ratio: 1;
}
.table-board.checkers .sq {
  background: transparent;
  position: relative;
}
.table-board.checkers .sq.light,
.table-board.checkers .sq.dark {
  background: transparent;
}
.table-board.checkers .sq.can::before {
  inset: 10%;
  border: 2.5px solid rgba(34, 197, 94, .75);
  border-radius: 50%;
  background: transparent;
}
.table-board.checkers .sq.must::before,
.table-board.checkers .sq.jump::before {
  border-color: #fbbf24;
  animation: ckPulse .9s ease-in-out infinite;
}
.table-board.checkers .sq.hi::before {
  content: "";
  position: absolute;
  inset: 4%;
  border: 3px solid #fbbf24;
  border-radius: 8px;
  background: rgba(251, 191, 36, .22);
  pointer-events: none;
}
.table-board.checkers .sq.legal::after {
  width: 26%;
  height: 26%;
  background: rgba(34, 197, 94, .92);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .28);
}
.table-board.checkers .sq.cap {
  box-shadow: none;
}
.table-board.checkers .sq.cap::after {
  display: block;
  width: 72%;
  height: 72%;
  background: transparent;
  border: 3px solid #ef4444;
  box-shadow: none;
}
.table-board.checkers .sq.last {
  box-shadow: inset 0 0 0 3px rgba(251, 191, 36, .55);
}

/* Tournament draughts — rosewood vs ivory, chess-board language */
.ck-man {
  width: 76%;
  height: 76%;
  border-radius: 50%;
  position: relative;
  z-index: 1;
  pointer-events: none;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 4px 5px rgba(0,0,0,.45));
}
.ck-man > i {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  display: block;
}
.ck-man .ck-shadow {
  inset: 8% -2% -10% 6%;
  background: rgba(0,0,0,.28);
  filter: blur(2px);
  z-index: 0;
}
.ck-man .ck-disc {
  inset: 0;
  z-index: 1;
  box-shadow:
    inset 0 6px 10px rgba(255,255,255,.28),
    inset 0 -8px 10px rgba(0,0,0,.32),
    0 2px 0 rgba(0,0,0,.25);
}
.ck-man .ck-rim {
  inset: 11%;
  z-index: 2;
  border: 2px solid rgba(255,255,255,.22);
  box-shadow: inset 0 0 0 1.5px rgba(0,0,0,.22);
  background: transparent;
}
.ck-man .ck-gloss {
  width: 34%;
  height: 18%;
  top: 16%;
  left: 22%;
  z-index: 3;
  background: rgba(255,255,255,.38);
  filter: blur(1px);
  border-radius: 50%;
}
.ck-man .ck-pip {
  width: 18%;
  height: 18%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  background: rgba(0,0,0,.16);
  box-shadow: inset 0 1px 2px rgba(255,255,255,.28);
}
.ck-man.dark .ck-disc,
.ck-man.red .ck-disc {
  background:
    radial-gradient(circle at 30% 24%, #6b3a22 0%, #3b1d12 42%, #1a0d08 100%);
  border: 2px solid #120804;
}
.ck-man.light .ck-disc,
.ck-man.cream .ck-disc {
  background:
    radial-gradient(circle at 30% 24%, #fffaf0 0%, #f0e6d2 46%, #cbbfa6 100%);
  border: 2px solid #8a7a60;
}
.ck-man.light .ck-rim,
.ck-man.cream .ck-rim,
.ck-man.cream .ck-ring {
  border-color: rgba(90, 70, 40, .28);
}
.ck-man.king .ck-disc {
  box-shadow:
    inset 0 6px 10px rgba(255,255,255,.28),
    inset 0 -8px 10px rgba(0,0,0,.32),
    0 2px 0 rgba(0,0,0,.25),
    0 0 0 2px rgba(212, 175, 55, .75);
}
.ck-man .ck-crown {
  inset: auto;
  width: 46%;
  height: 46%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fde68a, #d4af37 55%, #92400e);
  box-shadow: inset 0 1px 2px rgba(255,255,255,.5), 0 0 0 1px #78350f;
  z-index: 4;
}
.ck-man .ck-crown::before { content: none; }
.ck-man.king .ck-pip { display: none; }

.ck-seat {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(15, 23, 42, .82);
  color: #e2e8f0;
  box-sizing: border-box;
  flex-shrink: 0;
}
.ck-seat.on { box-shadow: inset 0 0 0 1px #22c55e; }
.ck-seat > i {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 800; color: #fff; overflow: hidden; flex-shrink: 0;
}
.ck-seat > i.red,
.ck-seat > i.dark {
  background: radial-gradient(circle at 32% 28%, #6b3a22, #3b1d12 55%, #1a0d08);
  border: 2px solid #120804;
}
.ck-seat > i.cream,
.ck-seat > i.light {
  background: radial-gradient(circle at 32% 28%, #fffaf0, #f0e6d2 50%, #cbbfa6);
  color: #3b2a16; border: 2px solid #8a7a60;
}
.ck-seat > i img { width: 100%; height: 100%; object-fit: cover; }
.ck-seat > div:nth-child(2) { min-width: 0; flex: 1; }
.ck-seat b { display: block; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ck-seat span { display: block; color: #94a3b8; font-size: .72rem; font-weight: 600; }
.ck-stats { text-align: right; flex-shrink: 0; }
.ck-stats em { display: block; font-style: normal; font-weight: 800; font-size: .82rem; color: #f8fafc; }
.ck-stats small { display: block; color: #fbbf24; font-weight: 800; font-size: .72rem; }
.ck-caps { display: flex; justify-content: flex-end; gap: 3px; margin-top: 4px; flex-wrap: wrap; max-width: 110px; }
.ck-caps i {
  width: 10px; height: 10px; border-radius: 50%; display: block;
  box-shadow: 0 1px 1px rgba(0,0,0,.35);
}
.ck-caps i.red, .ck-caps i.dark { background: #3b1d12; }
.ck-caps i.cream, .ck-caps i.light { background: #f0e6d2; border: 1px solid #8a7a60; }
.ck-caps b { font-size: .65rem; color: #94a3b8; }
@keyframes ckPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .55; transform: scale(1.06); }
}
.table-board.chess {
  background: #2c1810 url("/web/assets/packages/flutter_chess_board/images/brown_board.png") center / 100% 100% no-repeat;
  box-shadow: 0 0 0 5px #5d4037, 0 0 0 8px #c4a35a, 0 14px 32px rgba(0,0,0,.45);
  border-radius: 4px;
  overflow: hidden;
}
.table-board.chess .sq {
  background: transparent;
  font-size: 0;
  overflow: visible;
}
.table-board.chess .sq.light,
.table-board.chess .sq.dark { background: transparent; }
.table-board.ttt {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 8px;
  background: #0f172a;
  padding: 10px;
  border-radius: 18px;
  aspect-ratio: 1;
  width: min(92vw, 360px);
  max-width: 100%;
  margin: 0 auto;
  box-shadow: 0 0 0 1px rgba(148,163,184,.2), 0 16px 36px rgba(0,0,0,.35);
}
.sq.ttt {
  background: #1e293b;
  border-radius: 14px;
  font-size: clamp(2rem, 12vw, 3rem);
  color: #f8fafc;
  border: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
  transition: transform .08s ease, background .12s ease;
}
.sq.ttt.legal {
  box-shadow: inset 0 0 0 2px #22c55e;
  cursor: pointer;
}
.sq.ttt.legal:active { transform: scale(.96); }
.sq.ttt.mark-x { color: #38bdf8; }
.sq.ttt.mark-o { color: #fb7185; }
.sq.ttt.win {
  background: #14532d;
  box-shadow: inset 0 0 0 2px #4ade80;
}
#view-table-play.ttt-mode .panel-dark { display: none; }
#view-table-play.ttt-mode .check-banner { display: none !important; }
#view-table-play.ttt-mode {
  height: 100dvh;
  overflow: hidden;
  padding: 8px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
}
#view-table-play.ttt-mode .layout {
  height: 100%;
  grid-template-columns: 1fr;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  max-width: 420px;
  margin: 0 auto;
}
#view-table-play.ttt-mode .board-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: transparent;
  border: 0;
  padding: 0;
}
.ttt-seat {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(92vw, 360px);
  padding: 8px 4px;
  color: #e2e8f0;
  font-family: Outfit, system-ui, sans-serif;
}
.ttt-seat.opp { justify-content: flex-end; text-align: right; flex-direction: row-reverse; }
.ttt-seat.me { justify-content: flex-start; }
.ttt-seat.on .ttt-mark {
  box-shadow: 0 0 0 2px #0b1220, 0 0 0 4px #fbbf24;
}
.ttt-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 1.2rem;
  background: #1e293b;
  color: #f8fafc;
}
.ttt-seat b { display: block; font-size: .95rem; }
.ttt-seat small { display: block; color: #94a3b8; font-size: .72rem; font-weight: 700; }
@media (max-width: 420px) {
  .table-board.ttt { width: min(94vw, 340px); gap: 6px; padding: 8px; }
  .sq.ttt { border-radius: 12px; }
}
.table-board.quoridor {
  display: block;
  background: #15202B;
  padding: 0;
  gap: 0;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 0 0 3px #111827, 0 16px 36px rgba(0,0,0,.45);
}
.table-board.quoridor.q-live {
  aspect-ratio: 1;
  width: 100%;
  height: auto;
}
.table-board.quoridor canvas.q-cv {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: pointer;
  position: relative;
  z-index: 2;
}
#view-table-play.quoridor-mode .check-banner,
#view-table-play.checkers-mode .check-banner { display: none !important; }
.table-board.quoridor.wall-pick canvas.q-cv { cursor: crosshair; }
.table-board.carrom-live {
  display: block;
  position: relative;
  background: #3a2410;
  padding: 0;
  overflow: visible;
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0,0,0,.4);
}
.table-board.carrom-live canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
#view-table-play.carrom-mode {
  overflow: hidden;
  height: 100dvh;
  padding: 8px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
}
#view-table-play.carrom-mode .topbar { margin-bottom: 8px; padding: 8px 10px; }
#view-table-play.carrom-mode .panel-dark { display: none; }
#view-table-play.carrom-mode .layout { grid-template-columns: 1fr; gap: 0; }
#view-table-play.carrom-mode .board-wrap {
  background: transparent;
  border: none;
  padding: 0;
  overflow: visible;
}
#view-table-play.carrom-mode .table-board.carrom-live {
  width: min(100%, calc(100dvh - 210px), 720px);
}
#view-table-play.carrom-mode .play-turn {
  left: 44px;
  right: 44px;
  font-size: .78rem;
}
.carrom-legend {
  display: flex;
  gap: 8px;
  width: min(100%, calc(100dvh - 210px), 720px);
  margin: 36px auto 8px;
  z-index: 8;
  pointer-events: none;
}
.carrom-chip {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(15, 23, 42, .82);
  color: #fff;
  border: 1px solid rgba(255,255,255,.08);
}
.carrom-chip.mine { box-shadow: none; }
.carrom-chip.active { outline: 2px solid #22d3ee; }
.carrom-chip i {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid #c4b59a;
  background: #f3e9d2;
  box-shadow: inset 0 1px 2px #fff8;
}
.carrom-chip.black i {
  background: #1a1816;
  border-color: #6b7280;
  box-shadow: none;
}
.carrom-chip span { min-width: 0; flex: 1; }
.carrom-chip b {
  display: block;
  font-size: .78rem;
  font-weight: 800;
  line-height: 1.15;
}
.carrom-chip small {
  display: block;
  color: #cbd5e1;
  font-size: .68rem;
  font-weight: 600;
  margin-top: 1px;
}
.carrom-chip em {
  font-style: normal;
  font-weight: 800;
  font-size: 1.05rem;
  color: #fbbf24;
}
.carrom-chip.opp em { color: #94a3b8; }
.carrom-rail {
  display: flex;
  align-items: center;
  gap: 4px;
  width: min(100%, calc(100dvh - 210px), 720px);
  margin: 8px auto 0;
  background: rgba(0,0,0,.42);
  border-radius: 26px;
  padding: 2px 6px;
}
.carrom-rail button {
  width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: #23262e; color: #fff; font-size: 22px; line-height: 1;
}
.carrom-rail input[type=range] {
  flex: 1; accent-color: #2a6ef0; height: 28px;
}
.carrom-speed {
  position: absolute;
  right: -28px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 9;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s ease;
}
.carrom-speed.on { opacity: 1; }
.carrom-speed-label {
  font: 800 .62rem Outfit, system-ui, sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #94a3b8;
}
.carrom-speed-track {
  width: 14px;
  height: min(38vh, 220px);
  border-radius: 999px;
  background: rgba(15, 23, 42, .78);
  border: 1px solid rgba(255,255,255,.16);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  box-shadow: 0 8px 18px rgba(0,0,0,.35);
}
.carrom-speed-fill {
  display: block;
  width: 100%;
  height: 0%;
  border-radius: 999px;
  background: linear-gradient(180deg, #4ade80, #16a34a);
  transition: height .05s linear;
}
.carrom-speed-fill.mid { background: linear-gradient(180deg, #fbbf24, #d97706); }
.carrom-speed-fill.hot { background: linear-gradient(180deg, #f87171, #dc2626); }
.carrom-speed-val {
  font: 800 .95rem Outfit, system-ui, sans-serif;
  color: #f8fafc;
  text-shadow: 0 1px 4px #000;
  min-width: 2ch;
  text-align: center;
}
@media (max-width: 520px) {
  .carrom-speed { right: 6px; }
  .carrom-speed-track { width: 11px; height: min(32vh, 180px); }
  .carrom-speed-val { font-size: .82rem; }
}
#view-table-play.paper-mode {
  overflow: hidden;
  height: 100dvh;
  padding: 0;
  background: #F4F6F8;
}
#view-table-play.paper-mode .topbar,
#view-table-play.paper-mode .panel-dark,
#view-table-play.paper-mode .play-turn { display: none !important; }
#view-table-play.paper-mode .layout {
  display: block;
  height: 100%;
  width: 100%;
  grid-template-columns: none;
  gap: 0;
}
#view-table-play.paper-mode .board-wrap {
  background: transparent;
  border: none;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  display: block;
  border-radius: 0;
}
#view-table-play.paper-mode .table-board.paper-live {
  display: block;
  position: relative;
  width: 100% !important;
  height: 100% !important;
  max-width: none;
  min-height: 100dvh;
  aspect-ratio: auto;
  margin: 0;
  border-radius: 0;
  background: #F4F6F8;
  overflow: hidden;
}
#view-table-play.paper-mode .play-exit {
  background: rgba(0,0,0,.54);
  color: #fff;
  top: 10px;
  left: 10px;
  z-index: 20;
}
.pio-wrap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.pio-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  background: #E8EEF4;
  cursor: none;
  image-rendering: auto;
}
.pio-hud {
  position: absolute;
  top: 10px;
  left: 56px;
  right: 10px;
  pointer-events: none;
  z-index: 4;
  font-family: Outfit, system-ui, sans-serif;
}
.pio-time {
  text-align: center;
  font-size: 1.28rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: .04em;
  text-shadow: 0 1px 0 rgba(255,255,255,.85);
}
.pio-kill {
  text-align: center;
  color: #dc2626;
  font-weight: 700;
  font-size: .78rem;
  min-height: 1.05em;
}
.pio-board {
  position: absolute;
  right: 0;
  top: 48px;
  width: 128px;
  padding: 6px 7px 5px;
  border-radius: 12px;
  background: rgba(255,255,255,.88);
  box-shadow: 0 4px 14px rgba(15,23,42,.12);
  border: 1px solid rgba(255,255,255,.95);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.pio-board-h {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 3px;
}
.pio-alive {
  text-align: center;
  font-size: .68rem;
  font-weight: 700;
  color: #64748b;
  margin-top: 1px;
}
.pio-row {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 0;
  font-size: 10px;
  color: #0f172a;
  line-height: 1.15;
}
.pio-row + .pio-row { border-top: 1px solid rgba(148,163,184,.14); }
.pio-rank,
.pio-row em {
  width: 14px;
  height: 14px;
  border-radius: 5px;
  font-style: normal;
  font-weight: 800;
  font-size: 9px;
  color: #64748b;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: rgba(148,163,184,.18);
}
.pio-rank.gold,
.pio-row em.gold {
  background: linear-gradient(180deg, #fde68a, #f59e0b);
  color: #78350f;
}
.pio-rank.silver,
.pio-row em.silver {
  background: linear-gradient(180deg, #f1f5f9, #94a3b8);
  color: #1e293b;
}
.pio-rank.bronze,
.pio-row em.bronze {
  background: linear-gradient(180deg, #fdba74, #c2410c);
  color: #fff7ed;
}
.pio-row i {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(15,23,42,.12);
}
.pio-row b {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 600; font-size: 10px;
}
.pio-row.me b { font-weight: 800; }
.pio-row.me {
  background: rgba(59,130,246,.08);
  margin: 0 -3px;
  padding-left: 3px; padding-right: 3px;
  border-radius: 6px;
}
.pio-row span {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-size: 9.5px;
  color: #475569;
  flex-shrink: 0;
}
.pio-row.me span { color: #1d4ed8; }
.pio-row.dead { color: #94a3b8; opacity: .72; }
.pio-row.dead span { color: #94a3b8; }
.pio-mm,
.pio-mm-map,
.pio-mm-zoom-wrap,
.pio-mm-zoom { display: none !important; }
.seg.seg-scroll {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 6px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.seg.seg-scroll::-webkit-scrollbar { display: none; }
.seg.seg-scroll button {
  flex: 0 0 auto;
  min-width: 52px;
}
.pio-stick {
  position: absolute;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  width: 92px;
  height: 92px;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 5;
  transition: opacity .2s ease;
}
@media (max-width: 420px) {
  .pio-board { width: 112px; top: 44px; padding: 5px 6px 4px; }
  .pio-row b { font-size: 9px; }
}
.pio-base {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0,0,0,.38);
}
.pio-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 36px;
  height: 36px;
  margin: -18px 0 0 -18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 10px rgba(0,0,0,.25);
  will-change: transform;
}
.pio-hint {
  position: absolute;
  left: 50%;
  bottom: calc(128px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(17,24,39,.72);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  pointer-events: none;
  z-index: 6;
  transition: opacity .5s ease;
  white-space: nowrap;
}
.pio-lobby {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  z-index: 8;
  padding: 14px 18px;
  border-radius: 16px;
  background: rgba(15, 23, 42, .88);
  color: #e2e8f0;
  font-weight: 800;
  font-size: .92rem;
  text-align: center;
  box-shadow: 0 10px 28px rgba(0,0,0,.28);
  pointer-events: none;
}
.pio-lobby.hidden { display: none !important; }
.pio-lobby.actions { pointer-events: auto; }
.pio-lobby.actions p { margin: 0 0 10px; font-size: .84rem; font-weight: 600; color: #cbd5e1; }
.pio-lobby .pio-lb-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.pio-lobby .pio-lb-row .btn { font-size: .8rem; padding: 8px 14px; }
.pio-end {
  position: absolute; inset: 0; z-index: 8;
  background: rgba(0,0,0,.54);
  display: grid; place-items: center;
}
.pio-end > div {
  width: min(280px, 86%);
  background: #fff; color: #111827;
  border-radius: 16px; padding: 20px; text-align: center;
}
.pio-end b { display: block; font-size: 1.35rem; margin-bottom: 6px; }
.pio-end p { margin: 0 0 14px; color: #4b5563; }
.sq { display: grid; place-items: center; font-size: clamp(.9rem, 4vw, 1.7rem); font-weight: 800; user-select: none; touch-action: manipulation; }
.sq.light { background: #f0d9b5; }
.sq.dark { background: #b58863; }
.sq.hi { outline: 3px solid #14b8a6; outline-offset: -3px; }
.sq.legal { box-shadow: inset 0 0 0 4px #22c55e; }
.sq.ttt { background: #fff; border-radius: 12px; font-size: 2.4rem; } /* overridden by .table-board.ttt .sq.ttt */
.sq.qcell { background: #d1fae5; border-radius: 6px; }
.sq.qcell.wall-h { box-shadow: inset 0 -7px 0 #111827; }
.sq.qcell.wall-v { box-shadow: inset -7px 0 0 #111827; }
.sq.qcell.wall-h.wall-v { box-shadow: inset 0 -7px 0 #111827, inset -7px 0 0 #111827; }
.sq.qcell.ghost-h { box-shadow: inset 0 -7px 0 #fbbf24; }
.sq.qcell.ghost-v { box-shadow: inset -7px 0 0 #fbbf24; }
.sq.qcell.ghost-h.ghost-v { box-shadow: inset 0 -7px 0 #fbbf24, inset -7px 0 0 #fbbf24; }
.sq.pawn0 { background: #fb7185; color: #fff; border-radius: 50%; }
.sq.pawn1 { background: #38bdf8; color: #fff; border-radius: 50%; }
.sq.pocket { background: #111; }
.sq.coin-b { background: #111; color: #fff; border-radius: 50%; }
.sq.coin-w { background: #f8fafc; color: #111; border-radius: 50%; }
.sq.coin-q { background: #eab308; color: #111; border-radius: 50%; }
.sq.p0 { background: #0d9488; }
.sq.p1 { background: #d97706; }
.sq.t0 { background: #5eead4; }
.sq.t1 { background: #fbbf24; }
.sq.head { box-shadow: inset 0 0 0 3px #fff; }
.wall-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.cover-wide {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  border-radius: 0;
  margin: 0;
  border: 0;
  box-shadow: none;
}
.game-arena-art .cover-wide {
  position: absolute;
  inset: 0;
}
.game-arena-art {
  margin-bottom: 12px;
}
.ios-tip { margin: 8px 12px; background: #fff4cc; color: #3b2a00; border-radius: 12px; padding: 10px; font-size: .85rem; }
.row { display: flex; gap: 8px; }
.row .btn { flex: 1; }

/* Matching lobby — Flutter stake chips */
.wide-match { max-width: 520px; width: 100%; min-width: 0; }
.match-panel { padding: 18px 16px 20px; min-width: 0; overflow: visible; }
.match-user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--stroke);
}
.match-user b { display: block; }
.match-user span { display: block; color: var(--brand); font-weight: 800; font-size: .92rem; }
.arena-head { display: flex; gap: 12px; align-items: center; margin-bottom: 4px; }
.arena-head h2 { margin: 0; }
.arena-head .lead { margin: 2px 0 0; }
.arena-ico {
  width: 52px; height: 52px; border-radius: 16px;
  background: var(--mint); display: grid; place-items: center; font-size: 1.5rem;
  flex-shrink: 0;
}
.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0 4px;
}
.seg button {
  border: 1px solid var(--wa-stroke-2);
  background: var(--wa-bg-2);
  color: var(--wa-text);
  border-radius: 14px;
  padding: 10px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}
.seg button:hover { border-color: var(--wa-accent); }
.seg button:focus-visible { outline: 2px solid var(--wa-accent-2); outline-offset: 2px; }
.seg button.on {
  background: linear-gradient(180deg, var(--wa-accent-2), var(--wa-accent));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(0, 168, 132, .28);
}
.seg button:only-child { grid-column: 1 / -1; }
.stake-title {
  margin: 22px 0 14px; font-size: .88rem;
  display: flex; align-items: baseline; justify-content: space-between;
}
.stake-title small {
  font-size: .68rem; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; color: var(--wa-muted);
}
.stakes-wrap {
  position: relative;
  margin: 4px -2px 14px;
  padding: 12px 0 8px;
  overflow: visible;
}
.stakes-wrap::after {
  content: "";
  position: absolute; top: 18px; right: 0; bottom: 18px; width: 28px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--kb-surface) 55%, var(--kb-bg)));
  pointer-events: none;
  border-radius: 0 16px 16px 0;
  z-index: 1;
}
.stakes {
  display: flex;
  gap: 12px;
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: clip;
  overscroll-behavior-x: contain;
  overscroll-behavior-y: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 10px;
  /* Room for selected lift + coin shadow — was cropping tops on mobile */
  padding: 18px 18px 18px 6px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.stakes::-webkit-scrollbar { display: none; }
.stake {
  --tone: #fbbf24;
  --tone-ink: #fcd34d;
  --tone-line: rgba(251, 191, 36, .45);
  --tone-soft: rgba(251, 191, 36, .16);
  position: relative;
  flex: 0 0 132px;
  width: 132px;
  min-width: 132px;
  scroll-snap-align: start;
  text-align: center;
  border: 1.5px solid var(--tone-line);
  background:
    radial-gradient(circle at 50% -12%, var(--tone-soft), transparent 62%),
    linear-gradient(180deg, #1d2a31, #16232a);
  border-radius: 18px;
  padding: 16px 8px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  overflow: visible;
  color: var(--wa-text);
  box-shadow:
    0 1px 0 rgba(255,255,255,.06) inset,
    0 10px 22px rgba(0,0,0,.34);
  transform: translateZ(0);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.stake:hover {
  transform: translateY(-2px);
  border-color: var(--tone);
}
.stake:active {
  transform: translateY(0) scale(.98);
}
.stake:focus-visible { outline: 2px solid var(--wa-accent-2); outline-offset: 2px; }
.stake:nth-child(4n+2) {
  --tone: #2dd4bf;
  --tone-ink: #5eead4;
  --tone-line: rgba(45, 212, 191, .42);
  --tone-soft: rgba(45, 212, 191, .15);
}
.stake:nth-child(4n+3) {
  --tone: #fb7185;
  --tone-ink: #fda4af;
  --tone-line: rgba(251, 113, 133, .42);
  --tone-soft: rgba(251, 113, 133, .15);
}
.stake:nth-child(4n+4) {
  --tone: #a78bfa;
  --tone-ink: #c4b5fd;
  --tone-line: rgba(167, 139, 250, .42);
  --tone-soft: rgba(167, 139, 250, .16);
}
.stake .st-coin {
  width: 42px; height: 42px; border-radius: 50%;
  background: radial-gradient(circle at 30% 28%, #fff7d6, #fbbf24 48%, #b45309);
  border: 2px solid #fde68a;
  box-shadow: 0 4px 10px rgba(180,83,9,.3);
  display: grid; place-items: center;
  color: #7c2d12; font-weight: 900; font-size: .85rem;
}
.stake:nth-child(4n+2) .st-coin {
  background: radial-gradient(circle at 30% 28%, #ccfbf1, #14b8a6 50%, #0f766e);
  border-color: #99f6e4; color: #134e4a;
}
.stake:nth-child(4n+3) .st-coin {
  background: radial-gradient(circle at 30% 28%, #ffe4e6, #fb7185 50%, #be123c);
  border-color: #fecdd3; color: #9f1239;
}
.stake:nth-child(4n+4) .st-coin {
  background: radial-gradient(circle at 30% 28%, #ede9fe, #8b5cf6 50%, #5b21b6);
  border-color: #ddd6fe; color: #4c1d95;
}
.stake .st-entry { min-width: 0; display: grid; gap: 0; justify-items: center; }
.stake .st-entry small {
  color: var(--tone-ink);
  opacity: .85;
  font-size: .58rem;
  font-weight: 800;
  letter-spacing: .1em;
}
.stake .st-entry b {
  display: block;
  font-size: 1.15rem;
  line-height: 1.1;
  color: var(--tone-ink);
  white-space: nowrap;
}
.stake .st-win {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: max-content;
  max-width: 100%;
  background: rgba(52, 211, 153, .12);
  border: 1px solid rgba(110, 231, 183, .35);
  border-radius: 999px;
  padding: 3px 8px 3px 4px;
  color: #6ee7b7;
}
.stake .st-win i {
  width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
  background: radial-gradient(circle at 30% 28%, #fff7d6, #f59e0b 55%, #b45309);
  box-shadow: 0 1px 3px rgba(180,83,9,.3);
}
.stake .st-win em {
  font-style: normal;
  font-size: .58rem;
  font-weight: 800;
  letter-spacing: .04em;
  color: #86efac;
  text-transform: uppercase;
}
.stake .st-win strong {
  font-size: .78rem;
  font-weight: 900;
  color: #6ee7b7;
  white-space: nowrap;
}
.stake.on {
  border-color: var(--wa-accent);
  transform: translateY(-3px) scale(1.02);
  box-shadow:
    0 12px 26px rgba(0,0,0,.4),
    0 0 0 3px rgba(0, 168, 132, .22);
}
.stake.on .st-win {
  background: linear-gradient(90deg, rgba(52, 211, 153, .3), rgba(251, 191, 36, .22));
  border-color: rgba(110, 231, 183, .6);
}
.stake.on .st-win em, .stake.on .st-win strong { color: #d1fae5; }
.stake.poor { opacity: .55; }
.stake.poor .st-entry b { color: var(--wa-danger); }
.match-cta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 6px;
}
#btn-ai-ludo,
#btn-ai-game { display: none !important; }
.match-cta .btn { width: 100%; margin: 0; }
.match-more {
  margin-top: 12px;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 12px 12px 4px;
  background: var(--wa-bg-2);
  color: var(--wa-text);
}
.match-more > b { display: block; margin-bottom: 2px; }
.match-more summary {
  cursor: pointer;
  font-weight: 700;
  font-size: .9rem;
  padding: 12px 0;
  color: var(--muted);
  list-style: none;
}
.match-more summary::-webkit-details-marker { display: none; }
.match-more[open] summary { color: var(--text); }
.match-more .btn { width: 100%; margin: 0 0 8px; }
.match-more .lead { color: var(--wa-muted); }
.join-row { display: flex; gap: 8px; margin-bottom: 12px; }
.join-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--stroke2);
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 800;
  letter-spacing: .08em;
  background: var(--wa-bg-2);
  color: var(--wa-text);
}
.join-row .btn { width: auto; flex: 0 0 auto; padding: 10px 16px; margin: 0; }
.match-back {
  display: block;
  width: 100%;
  margin-top: 10px;
  border: 0;
  background: none;
  color: var(--muted);
  font-weight: 700;
  font-size: .88rem;
}
.match-sum {
  background: rgba(0, 168, 132, .10);
  border: 1px solid rgba(0, 168, 132, .28);
  color: var(--wa-text);
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 700;
  margin: 10px 0;
  font-size: .92rem;
  font-variant-numeric: tabular-nums;
}
.search-strip {
  text-align: center;
  background: var(--wa-bg-2);
  color: var(--text);
  border: 1px solid var(--stroke);
  border-radius: 18px;
  padding: 16px 14px 18px;
  margin: 10px 0 14px;
  box-shadow: var(--wa-shadow);
}
.search-strip .scan-timer {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--wa-accent-2);
}
.search-strip .search-hint {
  color: var(--muted);
  margin: 4px 0 16px;
  font-size: .82rem;
}
.lobby-players {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 0 4px;
  text-align: left;
}
.lobby-seat {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .04);
}
.lobby-seat.you { background: rgba(0, 168, 132, .16); }
.lobby-av {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: #0f766e;
  color: #fff;
  flex-shrink: 0;
}
.lobby-av img { width: 100%; height: 100%; object-fit: cover; }
.lobby-seat b { font-size: .92rem; }
#btn-lobby-start.hidden { display: none !important; }
.vs-duel {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 8px;
}
.vs-side { display: grid; justify-items: start; gap: 6px; min-width: 0; }
.vs-side.end { justify-items: end; text-align: right; }
.vs-side b {
  font-size: .82rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vs-side small { font-size: .7rem; color: var(--faint); font-weight: 600; }
.vs-side .scan-lab { color: var(--wa-blue); }
.vs-av {
  width: 72px; height: 72px; border-radius: 14px;
  overflow: hidden;
  background: var(--wa-panel-2);
  border: 1.5px solid var(--wa-stroke-2);
  box-shadow: 0 6px 16px rgba(30, 20, 60, .12);
  display: grid; place-items: center;
  font-weight: 800; color: var(--wa-muted);
  position: relative;
}
.vs-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vs-av.scan {
  border-color: var(--kb-primary-ring);
}
.vs-av.scan::after {
  content: '';
  position: absolute;
  right: 5px; bottom: 5px;
  width: 14px; height: 14px;
  border: 2px solid var(--wa-accent-2);
  border-right-color: transparent;
  border-radius: 50%;
  animation: vs-spin .9s linear infinite;
  background: var(--wa-panel);
}
.vs-av.slide img { animation: vs-slide .38s cubic-bezier(.33,1,.68,1); }
.vs-badge {
  width: 40px; height: 40px; margin-top: 16px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 900; font-size: .72rem; letter-spacing: .04em;
  color: #d97706;
  background: rgba(251, 191, 36, .18);
  border: 1px solid rgba(217, 119, 6, .55);
}
@keyframes vs-spin { to { transform: rotate(360deg); } }
@keyframes vs-slide {
  from { transform: translateY(70%); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* Ludo feel — custom coloured board, no board.png */
.play-wrap {
  background:
    linear-gradient(rgba(7, 17, 31, .84), rgba(7, 17, 31, .9)),
    url("/web/assets/images/ludo_bg.webp") center/cover;
}
.board {
  background: #111;
  gap: 1px;
  overflow: visible;
  border-radius: 12px;
  box-shadow: 0 0 0 2px #111, 0 12px 28px rgba(0,0,0,.42);
}
.board::before { display: none; content: none; }
.cell { background: #f7f4ee; }
.cell.void { background: #0b1220; }
.cell.red { background: var(--red); }
.cell.yellow { background: var(--yellow); }
.cell.green { background: var(--green); }
.cell.blue { background: var(--blue); }
.cell.center { background: #ece7dc; box-shadow: none; }
.cell.yard {
  position: relative;
  z-index: 1;
}
.cell.yard.red {
  background: var(--red);
  box-shadow: 0 0 0 1px var(--red);
}
.cell.yard.yellow {
  background: var(--yellow);
  box-shadow: 0 0 0 1px var(--yellow);
}
.cell.yard.green {
  background: var(--green);
  box-shadow: 0 0 0 1px var(--green);
}
.cell.yard.blue {
  background: var(--blue);
  box-shadow: 0 0 0 1px var(--blue);
}
.cell.yard.yard-inner {
  border-radius: 0;
  filter: none;
}
.cell.yard.pad::after {
  content: '';
  position: absolute;
  inset: 16%;
  border-radius: 50%;
  background: rgba(0, 0, 0, .22);
  box-shadow: none;
  pointer-events: none;
  z-index: 1;
}
.cell.yard.red.pad::after { background: rgba(127, 29, 29, .38); }
.cell.yard.yellow.pad::after { background: rgba(120, 53, 15, .32); }
.cell.yard.green.pad::after { background: rgba(20, 83, 45, .36); }
.cell.yard.blue.pad::after { background: rgba(30, 58, 138, .36); }
.ludo-hub {
  position: absolute;
  left: calc(6 * 100% / 15);
  top: calc(6 * 100% / 15);
  width: calc(3 * 100% / 15);
  height: calc(3 * 100% / 15);
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
  background: transparent;
  border-radius: 0;
  box-shadow: 0 0 0 1px #111;
}
.hub-tri { position: absolute; inset: 0; }
.hub-g { clip-path: polygon(0 0, 0 100%, 50% 50%); background: linear-gradient(135deg, #86efac, var(--green) 58%, #166534); }
.hub-y { clip-path: polygon(0 0, 100% 0, 50% 50%); background: linear-gradient(180deg, #fde047, var(--yellow) 58%, #a16207); }
.hub-b { clip-path: polygon(100% 0, 100% 100%, 50% 50%); background: linear-gradient(225deg, #93c5fd, var(--blue) 58%, #1d4ed8); }
.hub-r { clip-path: polygon(0 100%, 100% 100%, 50% 50%); background: linear-gradient(0deg, #fca5a5, var(--red) 58%, #b91c1c); }
.ludo-hub::after { content: none !important; display: none !important; }
.ludo-clock-bar {
  display: none;
  justify-content: center;
  align-items: center;
  min-height: 0;
  pointer-events: none;
  z-index: 5;
}
.ludo-clock-bar.on,
.ludo-clock-bar:has(.ludo-clock:not(.hidden)) {
  display: flex;
}
.ludo-clock {
  position: relative;
  top: auto;
  left: auto;
  transform: none;
  z-index: 5;
  min-width: 108px;
  padding: 6px 16px 5px;
  border-radius: 14px;
  background: rgba(15, 23, 42, .92);
  border: 1.5px solid #fbbf24;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  box-shadow: 0 6px 16px rgba(0,0,0,.35);
}
.ludo-clock.hidden { display: none !important; }
.ludo-clock b {
  font-size: 1.05rem;
  letter-spacing: .08em;
  color: #fbbf24;
  line-height: 1.1;
}
.ludo-clock span {
  font-size: .72rem;
  font-weight: 800;
  color: #e2e8f0;
}
.ludo-clock.urgent {
  border-color: #ef4444;
  animation: clockPulse 1s ease-in-out infinite;
}
.ludo-clock.urgent b { color: #fca5a5; }
@keyframes clockPulse {
  0%, 100% { box-shadow: 0 6px 16px rgba(0,0,0,.35); }
  50% { box-shadow: 0 0 0 4px rgba(239, 68, 68, .28); }
}
.cell.dest {
  background: rgba(34, 197, 94, .42);
  box-shadow: inset 0 0 0 2px #22c55e;
  z-index: 1;
  border-radius: 4px;
}

/* Ludo pawn hop — short on-board step, no air leap */
.token {
  position: absolute;
  width: calc(100% / 15 * 0.82);
  height: calc(100% / 15 * 1.06);
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  z-index: 6;
  overflow: visible;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  will-change: left, top;
  transition: left 175ms cubic-bezier(0.22, 1, 0.36, 1), top 175ms cubic-bezier(0.22, 1, 0.36, 1);
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.45));
}
.token.legal { z-index: 10; }
.pawn-ripple {
  display: none;
  position: absolute;
  left: 50%;
  top: 62%;
  width: 70%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: none;
}
.token.legal .pawn-ripple {
  display: block;
  box-shadow: 0 0 0 0 rgba(255, 255, 255, .7);
  animation: pawnRipple 1.15s ease-out infinite;
}
@keyframes pawnRipple {
  0% { box-shadow: 0 0 0 0 rgba(255, 210, 64, .85); opacity: 1; }
  100% { box-shadow: 0 0 0 16px transparent; opacity: 0; }
}
.pawn-ring {
  display: none;
  position: absolute;
  left: 50%;
  bottom: -4%;
  width: 130%;
  height: 42%;
  transform: translateX(-50%);
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow:
    0 0 0 3px #f59e0b,
    0 0 14px rgba(251, 191, 36, .95);
  pointer-events: none;
  z-index: 1;
}
.token.legal .pawn-ring {
  display: block;
  animation: pawnRingPulse .85s ease-in-out infinite;
}
@keyframes pawnRingPulse {
  0%, 100% { transform: translateX(-50%) scale(1); opacity: 1; }
  50% { transform: translateX(-50%) scale(1.22); opacity: .72; }
}
.pawn-arrow {
  display: none;
  position: absolute;
  left: 50%;
  top: -34%;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 15px solid #fff;
  filter: drop-shadow(0 1px 0 #f59e0b) drop-shadow(0 0 4px rgba(0,0,0,.55));
  pointer-events: none;
  z-index: 12;
}
.pawn-arrow::before {
  content: '';
  position: absolute;
  left: -7px;
  top: -16px;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 12px solid #fbbf24;
}
.token.legal .pawn-arrow {
  display: block;
  animation: pawnArrowBob .7s ease-in-out infinite;
}
@keyframes pawnArrowBob {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-28%); }
}
.board-wrap.ludo-flip .token.legal .pawn-arrow {
  top: auto;
  bottom: -34%;
  animation: pawnArrowBobFlip .7s ease-in-out infinite;
}
@keyframes pawnArrowBobFlip {
  0%, 100% { transform: translateX(-50%) rotate(180deg) translateY(0); }
  50% { transform: translateX(-50%) rotate(180deg) translateY(-28%); }
}
.pawn {
  position: absolute;
  inset: 0;
  transform-origin: 50% 88%;
}
.token.legal .pawn { animation: pawnBob 1s ease-in-out infinite; }
.token.tapped .pawn { animation: none; transform: scale(0.92); }
.token.hop .pawn { animation: pawnHop 170ms ease-out; }
.board-wrap.ludo-flip .token.hop .pawn { animation: pawnHopFlip 170ms ease-out; }
html[data-gfx="high"] .token.hop .pawn { animation: pawnHopHi 220ms cubic-bezier(0.16, 1, 0.3, 1); }
html[data-gfx="high"] .board-wrap.ludo-flip .token.hop .pawn { animation: pawnHopFlipHi 220ms cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes pawnBob {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-6%) scale(1.04); }
}
@keyframes pawnHop {
  0% { transform: translateY(0) scale(1); }
  35% { transform: translateY(-22%) scale(1.08); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes pawnHopFlip {
  0% { transform: translateY(0) scale(1); }
  35% { transform: translateY(22%) scale(1.08); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes pawnHopHi {
  0% { transform: translateY(0) scale(1); }
  28% { transform: translateY(-38%) scale(1.14); }
  62% { transform: translateY(-10%) scale(1.06); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes pawnHopFlipHi {
  0% { transform: translateY(0) scale(1); }
  28% { transform: translateY(38%) scale(1.14); }
  62% { transform: translateY(10%) scale(1.06); }
  100% { transform: translateY(0) scale(1); }
}
.hop-spark {
  position: absolute;
  width: 8%;
  aspect-ratio: 1;
  margin-left: 1.2%;
  margin-top: 1.2%;
  border-radius: 50%;
  pointer-events: none;
  z-index: 14;
  background: radial-gradient(circle, #fff 0%, #fbbf24 45%, transparent 72%);
  box-shadow: 0 0 12px rgba(251, 191, 36, .85);
  animation: hopSparkOut .45s ease-out forwards;
}
@keyframes hopSparkOut {
  0% { transform: scale(.4); opacity: 1; }
  100% { transform: scale(2.4); opacity: 0; }
}
html[data-gfx="high"] .token {
  transition: left 210ms cubic-bezier(0.16, 1, 0.3, 1), top 210ms cubic-bezier(0.16, 1, 0.3, 1);
  filter: drop-shadow(0 3px 4px rgba(0,0,0,.5));
}
html[data-gfx="high"] .token.legal .pawn {
  animation: pawnBobHi 1.05s ease-in-out infinite;
}
@keyframes pawnBobHi {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-10%) scale(1.07); }
}
html[data-gfx="high"] .dice.spin {
  animation: diceShakeHi .42s cubic-bezier(0.16, 1, 0.3, 1) 1;
}
@keyframes diceShakeHi {
  0% { transform: rotate(-28deg) scale(1.12); }
  20% { transform: rotate(24deg) scale(1.16); }
  40% { transform: rotate(-16deg) scale(1.1); }
  60% { transform: rotate(12deg) scale(1.08); }
  80% { transform: rotate(-6deg) scale(1.04); }
  100% { transform: rotate(0) scale(1); }
}
html[data-gfx="high"] .cell.dest::after,
html[data-gfx="high"] .board .cell.dest {
  animation: destPulse 1s ease-in-out infinite;
}
@keyframes destPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.25); }
}
.pawn-base, .pawn-body, .pawn-neck, .pawn-head, .pawn-band {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}
.pawn-base {
  bottom: 0;
  width: 92%;
  height: 26%;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--pawn-dark), #111);
  border: 1px solid color-mix(in srgb, var(--pawn-dark) 70%, #000);
}
.pawn-body {
  bottom: 10%;
  width: 78%;
  height: 54%;
  border-radius: 38% 38% 46% 46%;
  background: linear-gradient(135deg, var(--pawn-lite) 0%, var(--pawn) 42%, var(--pawn-dark) 100%);
  border: 1.5px solid var(--pawn-dark);
}
.pawn-neck {
  bottom: 56%;
  width: 46%;
  height: 18%;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--pawn-dark), var(--pawn), var(--pawn-lite), var(--pawn), var(--pawn-dark));
}
.pawn-head {
  top: 0;
  width: 52%;
  height: 40%;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, var(--pawn-lite), var(--pawn) 48%, var(--pawn-dark));
  border: 1.5px solid var(--pawn-dark);
  box-shadow: 0 2px 3px rgba(0,0,0,.35);
}
.pawn-head i {
  display: block;
  width: 38%;
  height: 28%;
  margin: 18% auto 0;
  border-radius: 40%;
  background: linear-gradient(180deg, rgba(255,255,255,.8), transparent);
}
.pawn-band {
  bottom: 32%;
  width: 64%;
  height: 7%;
  border-radius: 4px;
  background: rgba(255,255,255,.28);
}
.token.green { --pawn: #009739; --pawn-lite: #8af0b0; --pawn-dark: #045c28; }
.token.blue { --pawn: #1d6fd8; --pawn-lite: #9ec8ff; --pawn-dark: #063a7a; }
.token.red { --pawn: #e53935; --pawn-lite: #ffb3ab; --pawn-dark: #8b1512; }
.token.yellow { --pawn: #ffd100; --pawn-lite: #fff4b0; --pawn-dark: #b8860a; }
.dice {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  background: #fff;
  padding: 4px;
  box-shadow: 0 6px 14px rgba(0,0,0,.28);
}
.dice img { width: 100%; height: 100%; object-fit: contain; display: block; }
.dice.spin { animation: diceShake .28s ease-out 1; }
@keyframes diceShake {
  0% { transform: rotate(-18deg) scale(1.06); }
  25% { transform: rotate(16deg) scale(1.08); }
  50% { transform: rotate(-12deg) scale(1.04); }
  75% { transform: rotate(8deg) scale(1.03); }
  100% { transform: rotate(0) scale(1); }
}

.sq { position: relative; }
.sq.can::before {
  content: "";
  position: absolute;
  inset: 8%;
  border: 2px solid rgba(20, 184, 166, .55);
  border-radius: 6px;
  pointer-events: none;
}
.sq.legal::after {
  content: "";
  width: 30%;
  height: 30%;
  background: rgba(20, 184, 166, .9);
  border-radius: 50%;
  pointer-events: none;
}
.sq.cap {
  box-shadow: inset 0 0 0 4px #ef4444;
}
.sq.cap::after { display: none; }
.sq.pop { animation: piecePop .18s ease-out; }
@keyframes piecePop {
  from { transform: scale(.82); }
  to { transform: scale(1); }
}

/* Flutter ChessLegalMovesPainter + CheckHighlight + Staunton pieces */
.table-board.chess { position: relative; }
.table-board.chess .coach-arrow {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 6;
  pointer-events: none;
  overflow: visible;
}
.table-board.chess .sq.coach-from,
.table-board.chess .sq.coach-to {
  box-shadow: inset 0 0 0 80px rgba(250, 204, 21, .26), inset 0 0 0 3px rgba(250, 204, 21, .9);
}
#view-table-play .board-wrap { position: relative; }
.chess-coach-tip {
  width: 100%;
  margin: 0;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, .72);
  color: #fde68a;
  font-size: .86rem;
  line-height: 1.35;
  font-weight: 700;
  text-align: center;
  box-sizing: border-box;
}
.table-board.chess .sq.can::before,
.table-board.chess .sq.legal::before,
.table-board.chess .sq.cap::before,
.table-board.chess .sq.hi::before,
.table-board.chess .sq.check::before,
.table-board.chess .sq.last::before,
.table-board.chess .sq.mate::before {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: 2;
  border-radius: 2px;
  box-sizing: border-box;
}
.table-board.chess .sq.legal::after,
.table-board.chess .sq.cap::after { display: none; }
.table-board.chess .sq.can::before {
  inset: 6%;
  border: 2.5px solid rgba(46, 125, 79, .70);
  background: transparent;
  border-radius: 2px;
}
.table-board.chess .sq.hi::before {
  inset: 1.8%;
  background: rgba(246, 201, 69, .50);
  border: 4px solid #f6c945;
}
.table-board.chess .sq.legal::before {
  inset: 6%;
  background: rgba(46, 125, 79, .38);
  border: 3px solid rgba(46, 125, 79, .95);
}
.table-board.chess .sq.cap::before {
  inset: 3%;
  background: rgba(198, 40, 40, .32);
  border: 3.5px solid #e53935;
  box-shadow: none;
}
.table-board.chess .sq.cap { box-shadow: none; }
.table-board.chess .sq.last::after {
  content: "";
  position: absolute;
  inset: 0;
  width: auto;
  height: auto;
  background: rgba(246, 201, 69, .28);
  border: 0;
  border-radius: 0;
  z-index: 0;
  display: block;
  pointer-events: none;
}
.table-board.chess .sq.check::before {
  inset: 4%;
  background: rgba(255, 109, 0, .45);
  border: 4px solid #ff9100;
}
.table-board.chess .sq.mate::before {
  inset: 4%;
  background: rgba(211, 47, 47, .60);
  border: 4px solid #ff1744;
}
.ch-promo {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: rgba(7, 17, 31, .55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  padding: 16px;
}
.ch-promo-panel {
  width: min(100%, 340px);
  padding: 14px 14px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, #1e293b, #0f172a);
  border: 1px solid rgba(148,163,184,.28);
  box-shadow: 0 18px 40px rgba(0,0,0,.45);
  color: #f8fafc;
  text-align: center;
}
.ch-promo-panel b {
  display: block;
  font-size: 1.05rem;
  margin-bottom: 2px;
}
.ch-promo-panel p {
  margin: 0 0 12px;
  color: #94a3b8;
  font-size: .82rem;
  font-weight: 600;
}
.ch-promo-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.ch-promo-btn {
  appearance: none;
  border: 1px solid rgba(148,163,184,.28);
  background: rgba(15, 23, 42, .85);
  border-radius: 14px;
  padding: 10px 4px 8px;
  cursor: pointer;
  color: #e2e8f0;
  display: grid;
  justify-items: center;
  gap: 6px;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.ch-promo-btn:hover,
.ch-promo-btn:focus-visible {
  border-color: #38bdf8;
  background: rgba(30, 41, 59, .95);
  transform: translateY(-2px);
  outline: none;
}
.ch-promo-btn .ch-piece {
  width: 42px;
  height: 42px;
}
.ch-promo-btn span {
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .02em;
}
@media (max-width: 380px) {
  .ch-promo-btn .ch-piece { width: 34px; height: 34px; }
  .ch-promo-btn span { font-size: .6rem; }
}
.ch-piece {
  position: relative;
  z-index: 1;
  width: 88%;
  height: 88%;
  display: grid;
  place-items: center;
  transform: translateY(-4%);
  filter: drop-shadow(0 1px 0 rgba(255,255,255,.28));
  pointer-events: none;
}
.ch-piece.black { filter: drop-shadow(0 0 3px rgba(196,163,90,.25)); }
.ch-piece svg { width: 100%; height: 100%; display: block; overflow: visible; }
.ch-shadow {
  position: absolute;
  left: 26%;
  right: 26%;
  bottom: 2%;
  height: 12%;
  border-radius: 50%;
  background: rgba(0,0,0,.42);
  filter: blur(2px);
  z-index: -1;
}
.ch-coord {
  position: absolute;
  font-size: clamp(7px, 1.6vw, 11px);
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
  z-index: 3;
  opacity: .85;
}
.ch-coord.rank { top: 5%; left: 6%; }
.ch-coord.file { bottom: 5%; right: 7%; }
.table-board.chess .sq.light .ch-coord { color: #6b4f35; }
.table-board.chess .sq.dark .ch-coord { color: #f3e2c7; }
.ch-fly {
  position: absolute;
  z-index: 8;
  pointer-events: none;
  will-change: transform;
  display: grid;
  place-items: center;
}
.ch-fly .ch-piece { width: 100%; height: 100%; }
.ch-fly .ck-man { width: 74%; height: 74%; }
.ch-hide { visibility: hidden; }
.check-banner {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9;
  padding: 6px 14px;
  border-radius: 10px;
  color: #fff;
  font-weight: 800;
  font-size: .85rem;
  background: rgba(230, 81, 0, .92);
  pointer-events: none;
}
.check-banner.mate { background: rgba(183, 28, 28, .92); }

.atm-card {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  padding: 14px 14px 12px;
  color: #fff;
  background:
    radial-gradient(circle at 92% -8%, rgba(251, 191, 36, .32), transparent 42%),
    radial-gradient(circle at 6% 115%, rgba(45, 212, 191, .26), transparent 46%),
    linear-gradient(145deg, #0f766e 0%, #0d9488 48%, #115e59 100%);
  border: 1px solid rgba(255,255,255,.16);
  box-shadow: 0 12px 26px rgba(15, 118, 110, .26);
}
.atm-card::before, .atm-card::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.atm-card::before {
  width: 120px; height: 120px;
  right: -28px; top: -36px;
  background: rgba(255,255,255,.08);
}
.atm-card::after {
  width: 100px; height: 100px;
  left: -22px; bottom: -40px;
  background: rgba(251, 191, 36, .14);
}
.atm-head, .atm-mid, .atm-foot { position: relative; z-index: 1; }
.atm-head { display: flex; align-items: center; gap: 8px; }
.atm-av {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(255,255,255,.18); color: #fff;
  display: grid; place-items: center; font-size: .75rem; font-weight: 800;
  overflow: hidden; flex-shrink: 0;
}
.atm-av img { width: 100%; height: 100%; object-fit: cover; }
.atm-who b { display: block; font-size: .78rem; line-height: 1.1; }
.atm-who small { color: rgba(255,255,255,.72); font-size: .72rem; }
.atm-mid {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 10px; margin-top: 10px;
}
.atm-lab { display: block; color: rgba(255,255,255,.78); font-size: .78rem; font-weight: 600; }
.atm-amt-row { display: flex; align-items: center; gap: 4px; }
.atm-amt-row strong { font-size: 1.55rem; font-weight: 800; line-height: 1.1; }
.atm-eye {
  background: none; border: 0; color: rgba(255,255,255,.7);
  font-size: .72rem; font-weight: 700; padding: 6px 4px;
}
.atm-add {
  background: #fff; color: #0f766e; border: 0;
  border-radius: 12px; padding: 9px 14px;
  font-weight: 800; font-size: .78rem; white-space: nowrap;
}
.atm-foot {
  display: flex; align-items: flex-end; gap: 10px; margin-top: 14px;
}
.atm-foot > div { flex: 1; min-width: 0; }
.atm-foot span { display: block; color: rgba(255,255,255,.6); font-size: .72rem; }
.atm-foot b { display: block; margin-top: 2px; font-size: .95rem; }
.atm-wd {
  background: none; border: 0; color: #fff;
  font-weight: 700; font-size: .78rem; padding: 6px 4px; white-space: nowrap;
}
.qa-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 8px;
}
#view-home .hello.home-games-title {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: -.02em;
}
#view-home .home-sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 6px 2px 12px;
}
#view-home .home-sec-head small {
  color: var(--muted);
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}
/* Home games — responsive grid: 4 / 3 / 2 by screen size */
#view-home .home-games-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 8px;
  align-content: start;
  margin: 0;
  padding: 2px 0 4px;
  width: 100%;
  box-sizing: border-box;
}
#view-home .home-games-grid .game {
  aspect-ratio: 1 / 1;
  min-height: 0;
  height: auto;
  width: 100%;
  border-radius: 14px;
  background:
    radial-gradient(circle at 20% 12%, rgba(45, 212, 191, .22), transparent 42%),
    linear-gradient(165deg, #24314d 0%, #0b1220 48%, #060a12 100%);
  animation: gameTileIn .45s cubic-bezier(.16, 1, .3, 1) both;
}
#view-home .home-games-grid .game:nth-child(1) { animation-delay: .03s; }
#view-home .home-games-grid .game:nth-child(2) { animation-delay: .05s; }
#view-home .home-games-grid .game:nth-child(3) { animation-delay: .07s; }
#view-home .home-games-grid .game:nth-child(4) { animation-delay: .09s; }
#view-home .home-games-grid .game:nth-child(5) { animation-delay: .11s; }
#view-home .home-games-grid .game:nth-child(6) { animation-delay: .13s; }
#view-home .home-games-grid .game:nth-child(7) { animation-delay: .15s; }
#view-home .home-games-grid .game:nth-child(8) { animation-delay: .17s; }
#view-home .home-games-grid .game:nth-child(9) { animation-delay: .19s; }
#view-home .home-games-grid .game:nth-child(10) { animation-delay: .21s; }
@keyframes gameTileIn {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
#view-home .home-games-grid .game img {
  top: 5px !important;
  left: 5px !important;
  right: auto !important;
  bottom: auto !important;
  width: calc(100% - 10px) !important;
  height: calc(100% - 36px) !important;
  max-width: none !important;
  max-height: none !important;
  border-radius: 10px;
  object-fit: contain !important;
  object-position: center center !important;
  background:
    radial-gradient(ellipse 70% 55% at 50% 42%, rgba(45, 212, 191, .14), transparent 62%),
    linear-gradient(165deg, #24314d 0%, #0b1220 100%);
  filter: none;
}
#view-home .home-games-grid .game span {
  z-index: 5;
  min-height: 32px;
  padding: 6px 8px 7px;
  font-size: .72rem;
  background:
    linear-gradient(180deg, #334155 0%, #0f172a 70%, #020617 100%);
}
#view-home .home-games-grid .game:hover,
#view-home .home-games-grid .game:focus-visible {
  transform: translateY(-3px) scale(1.02);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .25) inset,
    0 -2px 0 rgba(0, 0, 0, .45) inset,
    0 14px 28px rgba(7, 17, 31, .35),
    0 0 0 1px rgba(45, 212, 191, .32);
}
#view-home .home-games-grid .game:hover img,
#view-home .home-games-grid .game:focus-visible img {
  transform: scale(1.02);
  filter: saturate(1.05) contrast(1.02);
}
#view-home .home-games-grid .game:active {
  transform: translateY(-1px) scale(.985);
}
/* Phone landscape / large phone → 3 cols */
@media (min-width: 420px) {
  #view-home .home-games-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px 10px;
  }
  #view-home .home-games-grid .game span { font-size: .74rem; }
}
/* Tablet / laptop / desktop → 4 cols (screenshot look) */
@media (min-width: 640px) {
  #view-home .home-games-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px 12px;
    max-width: none;
    margin-left: auto;
    margin-right: auto;
  }
  #view-home .home-games-grid .game {
    border-radius: 16px;
  }
  #view-home .home-games-grid .game span {
    font-size: .78rem;
    min-height: 34px;
    padding: 7px 9px 8px;
  }
  #view-home .home-games-grid .game img {
    top: 6px !important;
    left: 6px !important;
    width: calc(100% - 12px) !important;
    height: calc(100% - 40px) !important;
    border-radius: 11px;
  }
}
@media (min-width: 900px) {
  #view-home .home-games-grid {
    gap: clamp(12px, 1.4vw, 20px);
    max-width: none;
  }
}
@media (max-width: 360px) {
  #view-home .home-games-grid { gap: 8px 6px; }
  #view-home .home-games-grid .game span { font-size: .66rem; padding: 5px 6px 6px; min-height: 28px; }
}
#view-home.home-shell {
  position: relative;
}
#view-home.home-shell::before {
  content: '';
  position: fixed;
  inset: 0 auto auto 0;
  width: min(100vw, 1120px);
  height: 280px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 70% at 18% 0%, rgba(45, 212, 191, .18), transparent 58%),
    radial-gradient(ellipse 70% 60% at 88% 8%, rgba(251, 191, 36, .12), transparent 55%);
}
#view-home.home-shell > * { position: relative; z-index: 1; }
.home-greet {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  animation: homeRise .55s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.home-greet-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.home-greet-brand img {
  width: 42px;
  height: 42px;
  border-radius: 0;
  object-fit: contain;
  border: 0;
  background: transparent;
  filter: drop-shadow(0 6px 12px rgba(0, 168, 132, .26));
}
.home-greet-brand b {
  display: block;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.1;
}
.home-greet-brand small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 600;
}
.home-greet-cash {
  border: 0;
  background: var(--wa-accent);
  color: #fff;
  font-weight: 800;
  font-size: .78rem;
  padding: 10px 14px;
  border-radius: 12px;
  white-space: nowrap;
  box-shadow: 0 6px 14px rgba(15, 118, 110, .22);
}
#view-home .atm-card {
  animation: homeRise .55s .06s cubic-bezier(0.16, 1, 0.3, 1) both;
}
#view-home .atm-card::before {
  animation: atmShine 5.5s ease-in-out infinite;
}
@keyframes atmShine {
  0%, 100% { transform: translate(0, 0); opacity: .9; }
  50% { transform: translate(-10px, 8px); opacity: 1; }
}
#view-home .qa-row {
  animation: homeRise .55s .12s cubic-bezier(0.16, 1, 0.3, 1) both;
  margin: 14px 0 4px;
}
#view-home .home-games-sec {
  animation: homeRise .55s .18s cubic-bezier(0.16, 1, 0.3, 1) both;
  margin-top: 6px;
}
.home-link-row {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  animation: homeRise .55s .24s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes homeRise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
html[data-gfx="low"] #view-home .home-games-grid .game,
html[data-gfx="low"] #view-home .home-games-grid .game img,
html[data-gfx="low"] #view-home .home-games-grid .game::after,
html[data-gfx="low"] #view-home .atm-card::before {
  transition: none !important;
  animation: none !important;
}
html[data-gfx="low"] .home-greet,
html[data-gfx="low"] #view-home .atm-card,
html[data-gfx="low"] #view-home .qa-row,
html[data-gfx="low"] #view-home .home-games-sec,
html[data-gfx="low"] .home-link-row {
  animation: none !important;
}
@media (min-width: 700px) {
  .home-greet-brand b { font-size: 1.3rem; }
}
.qa-row button {
  background: none; border: 0; padding: 0;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  font-size: .68rem; font-weight: 600; color: var(--muted);
}
.qa-ico {
  width: 44px; height: 44px; border-radius: 13px;
  display: grid; place-items: center; color: #fff; font-size: 1.05rem;
}
.qa-ico.add { background: linear-gradient(135deg, #2dd4bf, #0f766e); }
.qa-ico.wd { background: linear-gradient(135deg, #34d399, #059669); }
.qa-ico.hist { background: linear-gradient(135deg, #fbbf24, #d97706); }
.qa-ico.ref { background: linear-gradient(135deg, #fcd34d, #b45309); }
.qa-ico.add::before {
  content: '+';
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1;
  color: #fff;
}
.qa-ico.wd::before {
  content: '';
  width: 2.5px;
  height: 14px;
  background: #fff;
  border-radius: 2px;
  box-shadow: 5px 5px 0 -1px #fff, -5px 5px 0 -1px #fff;
  transform: translateY(-2px);
}
.qa-ico.hist::before {
  content: '';
  width: 15px;
  height: 15px;
  border: 2.5px solid #fff;
  border-radius: 50%;
  box-shadow: inset -3px 0 0 -1px #fff;
  position: relative;
}
.qa-ico.ref::before {
  content: '';
  width: 11px;
  height: 11px;
  background: #fff;
  clip-path: polygon(50% 0, 100% 38%, 82% 100%, 18% 100%, 0 38%);
}
.page-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.page-head .back {
  width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid var(--stroke); background: var(--card); color: var(--text); font-size: 1.1rem;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 14px; }
.chip, .gw-chip {
  border: 1px solid var(--stroke2); background: var(--card);
  border-radius: 999px; padding: 8px 12px; font-weight: 700; font-size: .82rem;
  color: var(--text);
}
.gw-chip.on, .chip.on { background: #6d28d9; color: #fff; border-color: #6d28d9; }
.hist-h { margin: 16px 4px 8px; font-size: .95rem; }
.hist-row, .tx .hist-row {
  background: var(--card); border: 1px solid var(--stroke); border-radius: 12px;
  padding: 10px 12px; display: flex; justify-content: space-between; gap: 10px; align-items: center;
  width: 100%; text-align: left; color: inherit; cursor: pointer; font: inherit;
}
.hist-row b { display: block; text-transform: capitalize; }
.hist-row small { display: block; color: var(--muted); font-size: .75rem; font-weight: 500; }
.hist-row.in strong { color: var(--ok); }
.hist-row.out strong { color: var(--danger); }
.hist-amt {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 6px;
  flex-shrink: 0;
  text-align: right;
}
.hist-amt em {
  font-style: normal;
  font-size: .68rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
.hist-empty { color: var(--muted); padding: 12px 4px; }
.match-money-rows { list-style: none; margin: 0; padding: 0; }
.match-money-rows li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--stroke);
  font-size: .92rem;
}
.match-money-rows li span { color: var(--muted); }
.match-money-rows li b { font-weight: 700; text-align: right; word-break: break-all; }
.support-note { text-align: center; color: var(--faint); font-size: .75rem; margin-top: 18px; }
.pay-overlay {
  position: fixed; inset: 0; z-index: 100; background: #fff;
  display: flex; flex-direction: column;
}
.pay-overlay.hidden { display: none !important; }
.pay-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid #e5e7eb; font-weight: 700;
  background: #fff; color: #0f172a;
}
.pay-bar button { border: 0; background: #e2e8f0; color: #0f172a; border-radius: 10px; padding: 8px 12px; font-weight: 700; }
.pay-overlay iframe { flex: 1; width: 100%; border: 0; }
.wallet-page { padding-bottom: var(--kb-nav-h); }

.pl-tabs {
  display: flex; align-items: center; gap: 4px;
  border-bottom: 1px solid var(--wa-stroke); overflow-x: auto;
}
.pl-tabs button {
  background: none; border: 0; padding: 10px 12px;
  font-weight: 600; color: var(--wa-muted); border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.pl-tabs button.on { color: var(--wa-accent-2); font-weight: 800; border-bottom-color: var(--wa-accent); }
.pl-bell { margin-left: auto; font-size: 1.1rem; }
.pl-list { display: grid; gap: 8px; margin-top: 8px; }
.pl-row {
  background: var(--card); border: 1px solid var(--stroke); border-radius: 12px;
  padding: 8px 10px; display: flex; align-items: center; gap: 10px;
}
.pl-av {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(99,102,241,.12); color: #312e81;
  display: grid; place-items: center; font-weight: 800; overflow: hidden; flex-shrink: 0;
}
.pl-av img { width: 100%; height: 100%; object-fit: cover; }
.pl-meta { flex: 1; min-width: 0; }
.pl-meta b { display: block; }
.pl-meta small { color: var(--muted); }
.pl-meta .dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #cbd5e1; margin-right: 6px;
}
.pl-meta .dot.on { background: #10b981; }
.pl-pill {
  border: 0; border-radius: 12px; padding: 8px 12px;
  font-weight: 800; font-size: .78rem; background: rgba(99,102,241,.12); color: #6366f1;
}
.pl-pill.on { background: #6366f1; color: #fff; }
.pl-pill.ok { background: rgba(5,150,105,.12); color: #059669; }
.pl-pill.wait { background: rgba(217,119,6,.12); color: #d97706; }
/* ===== Tournament — WhatsApp dark, reusable tokens, all device sizes ===== */
.tn-title { margin: 4px 0 12px; font-size: clamp(1rem, 2.8vw, 1.2rem); text-align: center; color: var(--wa-text); }
#view-tournaments,
#view-tourney {
  display: grid;
  gap: clamp(10px, 1.6vw, 16px);
  padding-bottom: calc(12px + var(--kb-nav-h));
  color: var(--wa-text);
  width: min(1080px, calc(100% - clamp(12px, 3vw, 80px)));
}
#view-tournaments.hidden,
#view-tourney.hidden { display: none !important; }
.tn-head { padding: 4px 2px 0; text-align: left; min-width: 0; }
.tn-head .tn-kicker {
  display: inline-block;
  margin: 0 0 8px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(0, 168, 132, .16);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--wa-accent-2);
}
.tn-head h1 {
  margin: 0;
  font-family: Syne, Outfit, ui-sans-serif, system-ui, sans-serif;
  font-size: clamp(1.7rem, 6.4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: .95;
  color: var(--wa-text);
}
.tn-sub {
  margin: 8px 0 0;
  color: var(--wa-muted);
  font-size: clamp(.82rem, 2.4vw, .95rem);
  font-weight: 600;
  line-height: 1.35;
  max-width: 36em;
}
.tn-filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.tn-filters::-webkit-scrollbar { display: none; }
.tn-filters button {
  border: 1px solid var(--wa-stroke);
  background: var(--wa-panel);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 800;
  font-size: .8rem;
  color: var(--wa-muted);
  white-space: nowrap;
  flex: 0 0 auto;
}
.tn-filters button.on {
  background: var(--wa-accent);
  color: #fff;
  border-color: var(--wa-accent);
}
.tn-list { display: grid; gap: clamp(10px, 1.5vw, 14px); }
.tn-event {
  background: var(--wa-panel);
  border: 1px solid var(--wa-stroke);
  border-radius: clamp(14px, 2vw, 18px);
  overflow: hidden;
  text-align: left;
  box-shadow: var(--wa-shadow);
  min-width: 0;
}
.tn-event.feat { border-color: var(--wa-gold); }
.tn-event-art {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--wa-bg);
}
.tn-event-art img {
  width: 100%; height: 100%;
  object-fit: contain; object-position: center;
  display: block;
}
.tn-pill {
  position: absolute; top: 10px; left: 10px;
  background: rgba(11, 20, 26, .78);
  color: var(--wa-text);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .06em;
  padding: 4px 8px;
  border-radius: 999px;
}
.tn-pill.live, .tn-pill.open { background: var(--wa-accent); color: #fff; }
.tn-pill.joined { background: var(--wa-gold); color: #1a1408; }
.tn-pill.done { background: var(--wa-bot); }
.tn-event-body { padding: clamp(10px, 1.6vw, 14px); display: grid; gap: 6px; }
.tn-event-body em {
  font-style: normal;
  font-size: .7rem;
  font-weight: 800;
  color: var(--wa-gold);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.tn-event-body b { font-size: clamp(.95rem, 2.4vw, 1.08rem); color: var(--wa-text); }
.tn-event-body p { margin: 0; color: var(--wa-muted); font-size: .82rem; }
.tn-event-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 4px;
}
.tn-event-stats span {
  background: var(--wa-bg-2);
  border-radius: 10px;
  padding: 6px 8px;
  min-width: 0;
}
.tn-event-stats small { display: block; color: var(--wa-accent-2); font-size: .65rem; font-weight: 800; }
.tn-event-stats strong { font-size: clamp(.8rem, 2vw, .92rem); color: var(--wa-text); }
.tn-event-bar {
  height: 6px;
  background: var(--wa-stroke);
  border-radius: 99px;
  overflow: hidden;
}
.tn-event-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--wa-accent), var(--wa-gold));
  border-radius: 99px;
}
.tn-join-btn { width: 100%; margin-top: 4px; }
.tn-empty {
  text-align: center;
  background: var(--wa-panel);
  border: 1px dashed var(--wa-stroke);
  border-radius: 16px;
  padding: 28px 16px;
  color: var(--wa-text);
}
.tn-empty b { display: block; margin-bottom: 4px; }
.tn-empty p { margin: 0; color: var(--wa-muted); }
.tn-help {
  margin: 4px 4px 0;
  padding: 0 0 0 18px;
  color: var(--wa-muted);
  font-size: clamp(.72rem, 2vw, .8rem);
  line-height: 1.5;
}
.tn-switch {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  background: var(--wa-bg-2); border-radius: 12px; padding: 4px; margin-bottom: 4px;
}
.tn-switch button {
  border: 0; background: none; border-radius: 10px; padding: 10px 8px;
  font-weight: 600; color: var(--wa-muted); font-size: .78rem;
}
.tn-switch button.on { background: var(--wa-panel); color: var(--wa-accent-2); font-weight: 800; }
.tn-card {
  display: grid; grid-template-columns: minmax(88px, 120px) minmax(0, 1fr); gap: 12px;
  background: var(--wa-panel); border: 1px solid var(--wa-stroke); border-radius: 14px;
  padding: 10px; text-align: left; overflow: hidden; color: var(--wa-text);
}
.tn-card.feat { border-color: var(--wa-gold); }
.tn-thumb {
  width: 100%; aspect-ratio: 16 / 9; height: auto;
  border-radius: 10px; overflow: hidden; background: var(--wa-bg);
}
.tn-card img, .tn-ph {
  width: 100%; height: 100%; object-fit: contain; object-position: center;
  background: var(--wa-bg); color: var(--wa-text); display: block;
}
.tn-ph { display: grid; place-items: center; font-size: 1.4rem; }
.tn-body { display: grid; align-content: start; gap: 4px; min-width: 0; }
.tn-body b { font-size: .9rem; }
.tn-body small { color: var(--wa-muted); }
.tn-body .btn { width: auto; padding: 8px 12px; margin-top: 4px; justify-self: start; }

/* Lobby */
#view-tourney .page-head { margin-bottom: 6px; min-width: 0; }
#view-tourney .page-head b {
  font-family: Syne, Outfit, ui-sans-serif, system-ui, sans-serif;
  font-size: clamp(.92rem, 3.2vw, 1.08rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  color: var(--wa-text);
}
#tn-detail { padding-bottom: calc(18px + var(--kb-nav-h)); min-width: 0; }
.tn-hub {
  display: grid;
  gap: clamp(10px, 1.6vw, 16px);
  color: var(--wa-text);
  min-width: 0;
}
.tn-hub-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: clamp(8px, 2vw, 16px);
  padding: 4px 2px 12px;
  border-bottom: 1px solid var(--wa-stroke);
  min-width: 0;
}
.tn-hub-top > div { min-width: 0; flex: 1; }
.tn-hub-game {
  margin: 0 0 4px;
  font-size: clamp(.66rem, 1.8vw, .74rem);
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--wa-accent-2);
}
.tn-hub-top b {
  display: block;
  font-family: Syne, Outfit, ui-sans-serif, system-ui, sans-serif;
  font-size: clamp(1.15rem, 4.6vw, 1.5rem);
  letter-spacing: -.03em;
  line-height: 1.1;
  word-break: break-word;
}
.tn-hub-top small {
  display: block;
  margin-top: 4px;
  color: var(--wa-muted);
  font-weight: 700;
  font-size: clamp(.72rem, 2vw, .8rem);
}
.tn-hub-pill {
  flex-shrink: 0;
  margin-top: 4px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 168, 132, .16);
  color: var(--wa-accent-2);
  font-size: .68rem;
  font-weight: 800;
  white-space: nowrap;
}
.tn-tbl {
  background: var(--wa-panel);
  border: 1px solid var(--wa-stroke);
  border-radius: clamp(14px, 2vw, 18px);
  padding: clamp(10px, 1.6vw, 14px);
  min-width: 0;
}
.tn-tbl.mine {
  border-color: var(--wa-accent);
  box-shadow: 0 0 0 1px rgba(0, 168, 132, .25);
}
.tn-tbl-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  min-width: 0;
}
.tn-tbl-h.tight { margin-bottom: 8px; padding: 0 2px; }
.tn-tbl-h b { font-size: clamp(.8rem, 2.2vw, .9rem); color: var(--wa-text); }
.tn-tbl-h span { color: var(--wa-faint); font-size: .75rem; font-weight: 700; }
.tn-tbl-st {
  font-style: normal;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--wa-accent-2);
  background: rgba(0, 168, 132, .14);
  border-radius: 999px;
  padding: 4px 8px;
  white-space: nowrap;
}
.tn-tbl-st.waiting { color: var(--wa-wait); background: rgba(255, 206, 49, .12); }
.tn-tbl-st.playing { color: var(--wa-blue); background: rgba(83, 189, 235, .14); }
.tn-tbl-st.ready { color: var(--wa-ok); background: rgba(37, 211, 102, .14); }
.tn-tbl-st.joined { color: var(--wa-accent-2); background: rgba(0, 168, 132, .14); }
.tn-tbl-st.done { color: var(--wa-muted); background: var(--wa-bg-2); }
.tn-tables { min-width: 0; }
.tn-tables-scroll {
  display: grid;
  gap: clamp(8px, 1.4vw, 12px);
  max-height: min(52dvh, 560px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2px 2px 16px;
  grid-template-columns: 1fr;
}
.tn-vs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(6px, 2vw, 14px);
  min-width: 0;
}
.tn-vs-side {
  display: flex;
  gap: clamp(8px, 2vw, 14px);
  flex: 1;
  min-width: 0;
  align-items: center;
}
.tn-vs-side.right { justify-content: flex-end; }
.tn-vs.n4 .tn-vs-side {
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}
.tn-vs.n4 .tn-vs-side.right { align-items: flex-end; }
.tn-vs-mid {
  flex: 0 0 auto;
  width: clamp(28px, 8vw, 36px);
  height: clamp(28px, 8vw, 36px);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--wa-bg-2);
  color: var(--wa-muted);
  font-size: .72rem;
  font-weight: 800;
  text-transform: lowercase;
}
.tn-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  width: clamp(48px, 16vw, 76px);
}
.tn-chip-av {
  width: clamp(40px, 12vw, 56px);
  height: clamp(40px, 12vw, 56px);
  border-radius: 50%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--wa-bubble);
  color: #fff;
  font-weight: 800;
  font-size: clamp(.9rem, 3vw, 1.05rem);
}
.tn-chip-av img { width: 100%; height: 100%; object-fit: cover; }
.tn-chip b {
  font-size: clamp(.62rem, 2vw, .74rem);
  line-height: 1.1;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--wa-text);
}
.tn-chip small {
  font-size: .6rem;
  font-weight: 700;
  color: var(--wa-muted);
  text-transform: lowercase;
}
.tn-chip.you .tn-chip-av { box-shadow: 0 0 0 2px var(--wa-you); background: var(--wa-accent); color: #fff; }
.tn-chip.bot .tn-chip-av { background: var(--wa-bot); color: var(--wa-text); }
.tn-chip.on .tn-chip-av { box-shadow: 0 0 0 2px var(--wa-ok); }
.tn-chip.out { opacity: .48; }
.tn-chip.wait .tn-chip-av {
  border: 2px dashed var(--wa-stroke-2);
  background: var(--wa-bg-2);
  color: var(--wa-faint);
  box-shadow: none;
}
.tn-empty-line { margin: 8px 2px; color: var(--wa-muted); font-size: .85rem; }
.tn-dock {
  position: sticky;
  bottom: calc(var(--kb-nav-h) + 8px);
  z-index: 6;
  display: grid;
  gap: 8px;
  padding: 12px 0 2px;
  background: linear-gradient(180deg, rgba(11,20,26,0), var(--wa-bg) 32%);
}
.tn-dock .btn { width: 100%; border-radius: 999px; min-height: 48px; font-weight: 800; }
.tn-hub .tn-outcome {
  border-radius: 14px;
  padding: 12px 14px;
  margin: 0;
  color: var(--wa-text);
  background: var(--wa-panel);
  border: 1px solid var(--wa-stroke);
}
.tn-hub .tn-outcome b { display: block; margin-bottom: 2px; }
.tn-hub .tn-outcome p { margin: 0; color: var(--wa-muted); font-size: .82rem; }
.tn-hub .tn-outcome.win { background: rgba(37, 211, 102, .12); border-color: rgba(37, 211, 102, .35); }
.tn-hub .tn-outcome.loss { background: rgba(234, 67, 53, .12); border-color: rgba(234, 67, 53, .35); }
.tn-hub .tn-outcome.next { background: rgba(83, 189, 235, .12); border-color: rgba(83, 189, 235, .35); }
.tn-hub .tn-outcome.done { background: var(--wa-bg-2); }

@media (max-width: 380px) {
  .tn-event-stats { grid-template-columns: 1fr 1fr 1fr; gap: 4px; }
  .tn-event-stats span { padding: 5px 6px; }
  .tn-hub-top { flex-wrap: wrap; }
  .tn-hub-pill { margin-top: 0; }
  .tn-card { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .tn-vs.n4 { flex-wrap: wrap; justify-content: center; }
  .tn-vs.n4 .tn-vs-side,
  .tn-vs.n4 .tn-vs-side.right {
    flex-direction: row;
    justify-content: center;
    align-items: center;
    flex: 1 1 100%;
  }
  .tn-vs.n4 .tn-vs-mid { order: -1; margin: 0 auto 4px; }
}
@media (min-width: 640px) {
  .tn-tables-scroll {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: min(58dvh, 640px);
  }
  .tn-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 900px) {
  #view-tournaments,
  #view-tourney { padding-bottom: 48px; }
  .tn-tables-scroll { max-height: none; }
  .tn-dock { position: static; background: none; }
}
@media (min-width: 1080px) {
  .tn-hub {
    grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
    align-items: start;
  }
  .tn-hub-top,
  .tn-outcome,
  .tn-dock { grid-column: 1 / -1; }
  .tn-tbl.mine { position: sticky; top: 12px; }
  .tn-tables { min-width: 0; }
  .tn-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.pt-lead { margin: 0 2px 12px; color: var(--wa-muted); font-size: .92rem; font-weight: 600; line-height: 1.4; }
.pt-form { display: grid; gap: 10px; }
.pt-form label { display: grid; gap: 4px; font-size: .78rem; font-weight: 800; color: var(--wa-muted); }
.pt-form input, .pt-form select {
  border: 1px solid var(--wa-stroke); border-radius: 12px; padding: 10px 12px;
  font: inherit; font-weight: 700; color: var(--wa-text); background: var(--wa-bg-2);
}
.pt-form .btn { margin-top: 4px; }
.pt-agree {
  max-height: 180px; overflow: auto; white-space: pre-wrap;
  background: var(--wa-bg-2); border: 1px solid var(--wa-stroke); border-radius: 14px;
  padding: 12px; font: inherit; font-size: .78rem; color: var(--wa-muted); line-height: 1.45;
}
.pt-check { display: flex; align-items: center; gap: 8px; font-weight: 700 !important; }
.pt-check input { width: 18px; height: 18px; }
.pt-earn, .pt-prev {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px;
  background: var(--wa-panel); border: 1px solid var(--wa-stroke); border-radius: 16px; padding: 12px;
}
.pt-earn span, .pt-prev span { display: grid; gap: 2px; }
.pt-earn small, .pt-prev small { color: #0f766e; font-size: .65rem; font-weight: 800; text-transform: uppercase; }
.pt-earn b, .pt-prev b { font-size: .95rem; }
.pt-split { margin: 10px 2px; color: #64748b; font-size: .8rem; font-weight: 600; }
.pt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pt-h { margin: 18px 2px 8px; font-size: .88rem; }
.pt-list { display: grid; gap: 8px; }
.pt-row {
  display: grid; text-align: left; background: var(--wa-panel); border: 1px solid var(--wa-stroke);
  border-radius: 14px; padding: 12px; gap: 2px; color: inherit;
}
.pt-row small { color: var(--wa-muted); }
.pt-row em { font-style: normal; font-weight: 800; color: var(--wa-accent-2); font-size: .82rem; }
.pt-actions { margin-top: 8px; }
.pt-actions .btn { width: 100%; border-radius: 999px; }
@media (max-width: 380px) {
  .pt-grid { grid-template-columns: 1fr; }
}
.tn-lobby {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  padding: 22px 16px 18px;
  color: #fff;
  background:
    radial-gradient(circle at 10% 0%, rgba(251,191,36,.62), transparent 38%),
    radial-gradient(circle at 96% 8%, rgba(244,63,94,.42), transparent 36%),
    radial-gradient(circle at 78% 92%, rgba(34,211,238,.32), transparent 42%),
    linear-gradient(165deg, #0f766e 0%, #134e4a 36%, #1e1b4b 100%);
  box-shadow: 0 20px 44px rgba(15, 23, 42, .32);
}
.tn-hero-img {
  position: relative; z-index: 1;
  margin: 0 0 14px;
  aspect-ratio: 16 / 9;
  height: auto;
  border-radius: 18px;
  overflow: hidden;
  background: #04131a;
  box-shadow: 0 12px 28px rgba(0,0,0,.28);
  border: 2px solid rgba(253, 230, 138, .55);
}
.tn-hero-img img {
  width: 100%; height: 100%; object-fit: contain; object-position: center; display: block;
}
.tn-card.tn-8p img {
  object-position: center;
}
.tn-float-coins { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.tn-float-coins span {
  position: absolute;
  width: 26px; height: 26px; border-radius: 50%;
  background: radial-gradient(circle at 30% 28%, #fff7d6, #fbbf24 46%, #b45309);
  border: 2px solid #fde68a;
  box-shadow: 0 4px 10px rgba(180,83,9,.35);
  animation: tnCoinFloat 4.6s ease-in-out infinite;
}
.tn-float-coins span:nth-child(1) { top: 10%; left: 6%; animation-delay: 0s; }
.tn-float-coins span:nth-child(2) { top: 18%; right: 8%; animation-delay: .4s; width: 20px; height: 20px; }
.tn-float-coins span:nth-child(3) { top: 42%; left: 2%; animation-delay: .8s; width: 18px; height: 18px; }
.tn-float-coins span:nth-child(4) { top: 58%; right: 4%; animation-delay: 1.1s; }
.tn-float-coins span:nth-child(5) { top: 30%; left: 8%; animation-delay: 1.4s; width: 22px; height: 22px; }
.tn-float-coins span:nth-child(6) { top: 12%; right: 22%; animation-delay: .6s; }
.tn-float-coins span:nth-child(7) { top: 8%; left: 46%; animation-delay: 1.8s; width: 16px; height: 16px; }
.tn-float-coins span:nth-child(8) { top: 38%; right: 12%; animation-delay: 2.1s; width: 14px; height: 14px; }
.tn-lobby .tn-kicker {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.tn-lobby h1 {
  position: relative; z-index: 1;
  margin: 12px 0 6px;
  font-size: clamp(1.7rem, 7vw, 2.4rem);
  line-height: 1.05;
  font-weight: 900;
  letter-spacing: -.02em;
  text-shadow: 0 6px 22px rgba(0,0,0,.35);
}
.tn-lobby .tn-sub {
  position: relative; z-index: 1;
  margin: 0 0 12px;
  opacity: .92;
  font-weight: 600;
  font-size: .86rem;
}
.tn-coin-line {
  position: relative; z-index: 1;
  display: flex; justify-content: center; gap: 10px; margin: 8px 0 14px;
}
.tn-coin-line .gold-coin {
  width: 42px; height: 42px; font-size: .85rem;
  animation: tnCoinFloat 3.2s ease-in-out infinite;
}
.tn-coin-line .gold-coin:nth-child(2) { animation-delay: .15s; }
.tn-coin-line .gold-coin:nth-child(3) { animation-delay: .3s; }
.tn-coin-line .gold-coin:nth-child(4) { animation-delay: .45s; }
.tn-prize-row {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px;
}
.tn-stat {
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 16px;
  padding: 12px 10px;
  text-align: center;
  backdrop-filter: blur(8px);
}
.tn-stat small {
  display: block; opacity: .82; font-weight: 800; font-size: .66rem; letter-spacing: .1em;
}
.tn-stat b { display: block; font-size: 1.28rem; margin-top: 4px; }
.tn-fill {
  position: relative; z-index: 1;
  display: flex; justify-content: space-between;
  font-size: .75rem; font-weight: 800; opacity: .9; margin-bottom: 6px;
}
.tn-progress {
  position: relative; z-index: 1;
  height: 10px; background: rgba(0,0,0,.28); border-radius: 99px; overflow: hidden;
}
.tn-progress i {
  display: block; height: 100%;
  background: linear-gradient(90deg, #fbbf24, #f59e0b 40%, #34d399);
  border-radius: 99px;
}
.tn-wait {
  position: relative; z-index: 1;
  margin-top: 16px;
  background: #fff;
  color: #0f172a;
  border-radius: 20px;
  padding: 16px 12px 14px;
  box-shadow: 0 14px 32px rgba(0,0,0,.2);
}
.tn-wait-head {
  display: grid; grid-template-columns: 1fr auto; align-items: start; gap: 8px;
  margin-bottom: 14px;
}
.tn-wait-head h3 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.25;
  background: linear-gradient(90deg, #0f766e, #d97706);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tn-wait-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff7ed; color: #c2410c;
  border-radius: 99px; padding: 6px 10px;
  font-size: .7rem; font-weight: 800; white-space: nowrap;
}
.tn-wait-badge i {
  width: 8px; height: 8px; border-radius: 50%; background: #f97316;
  animation: tnPulse 1.4s ease-in-out infinite;
}
.tn-wait-badge.full { background: #ecfdf5; color: #047857; }
.tn-wait-badge.full i { background: #10b981; animation: none; }
.tn-dots::after {
  content: '';
  animation: tnDots 1.4s steps(4, end) infinite;
}
.tn-seats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px;
}
.tn-seats.n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tn-seats.n4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tn-seat { display: grid; justify-items: center; gap: 6px; }
.tn-seat-av {
  width: 58px; height: 58px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 900; font-size: 1.05rem;
  background: #f1f5f9;
  border: 3px dashed #cbd5e1;
  color: #94a3b8;
  overflow: hidden;
}
.tn-seat-av img { width: 100%; height: 100%; object-fit: cover; }
.tn-seat.on .tn-seat-av {
  border-style: solid; border-color: #0f766e;
  background: linear-gradient(180deg, #ccfbf1, #99f6e4);
  color: #115e59;
  box-shadow: 0 0 0 4px rgba(15,118,110,.16);
}
.tn-seat.wait .tn-seat-av { animation: tnPulse 1.8s ease-in-out infinite; }
.tn-seat small {
  font-size: .68rem; font-weight: 800; color: #64748b;
  max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tn-seat.on small { color: #0f766e; }
.tn-roster {
  margin-top: 14px;
  padding: 12px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}
.tn-roster .tn-wait-head { margin-bottom: 10px; }
.tn-roster-list {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.tn-roster-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
}
.tn-roster-row.you {
  border-color: #99f6e4;
  background: #f0fdfa;
}
.tn-roster-row.out { opacity: .55; }
.tn-roster-row.up { border-color: #86efac; }
.tn-roster-av {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 800; font-size: .85rem;
  background: #e2e8f0; color: #334155;
  overflow: hidden; flex-shrink: 0;
}
.tn-roster-av img { width: 100%; height: 100%; object-fit: cover; }
.tn-roster-meta { min-width: 0; flex: 1; }
.tn-roster-meta b {
  display: block; font-size: .85rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tn-roster-meta small {
  display: block; color: #64748b; font-size: .68rem; font-weight: 700;
}
.tn-roster-tag {
  font-style: normal;
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: #0f766e;
  background: #ecfdf5;
  border-radius: 999px;
  padding: 4px 8px;
  white-space: nowrap;
}
.tn-roster-row.out .tn-roster-tag { color: #b91c1c; background: #fef2f2; }
.tn-lobby-actions {
  position: relative; z-index: 1;
  display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap;
}
.tn-lobby-actions .btn { flex: 1; min-width: 140px; }
.tn-payout {
  position: relative; z-index: 1;
  display: flex; gap: 8px; flex-wrap: wrap;
  margin: 4px 0 12px;
}
.tn-payout span {
  flex: 1; min-width: 72px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 12px; padding: 8px 10px;
  display: grid; gap: 2px;
}
.tn-payout small { opacity: .75; font-size: .68rem; font-weight: 700; }
.tn-payout b { font-size: 1rem; color: #fde68a; }
.tn-outcome {
  position: relative; z-index: 1;
  border-radius: 14px; padding: 12px 14px; margin: 0 0 14px;
  background: rgba(255,255,255,.14);
}
.tn-outcome b { display: block; font-size: 1.05rem; margin-bottom: 4px; }
.tn-outcome p { margin: 0; opacity: .9; font-size: .88rem; }
.tn-outcome.win { background: rgba(16,185,129,.28); border: 1px solid rgba(167,243,208,.5); }
.tn-outcome.loss { background: rgba(239,68,68,.22); border: 1px solid rgba(254,202,202,.4); }
.tn-outcome.next { background: rgba(59,130,246,.28); border: 1px solid rgba(191,219,254,.45); }
.tn-steps {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px; margin: 0 0 10px;
}
.tn-step {
  display: flex; align-items: center; gap: 6px;
  font-size: .72rem; font-weight: 700; opacity: .45;
  background: rgba(255,255,255,.08); border-radius: 999px; padding: 6px 8px;
}
.tn-step i {
  width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255,255,255,.16); font-size: .65rem; font-style: normal;
}
.tn-step.on { opacity: 1; background: rgba(253,230,138,.18); }
.tn-step.now { box-shadow: 0 0 0 1px #fde68a; }
.tn-rounds {
  position: relative; z-index: 1;
  display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px;
}
.tn-round {
  min-width: 42px; text-align: center;
  border-radius: 10px; padding: 6px 8px;
  font-size: .75rem; font-weight: 800;
  background: rgba(255,255,255,.1);
}
.tn-round.on { background: #fde68a; color: #134e4a; }
.tn-round.done { background: rgba(16,185,129,.35); }
.tn-how {
  position: relative; z-index: 1;
  margin: 12px 0 0; padding: 0 0 0 18px;
  font-size: .8rem; line-height: 1.45; opacity: .9;
}
.tn-hist-empty { margin: 0; opacity: .8; font-size: .85rem; }
.tn-hist {
  position: relative; z-index: 1;
  margin-top: 16px; background: rgba(0,0,0,.18);
  border-radius: 14px; padding: 12px 14px;
}
.tn-hist h3 { margin: 0 0 8px; font-size: .9rem; }
.tn-hist ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.tn-hist li { font-size: .85rem; opacity: .95; }
.tn-seat.dead { opacity: .45; }
#view-tourney, #view-tournaments {
  box-sizing: border-box;
  padding-left: 8px;
  padding-right: 8px;
}
@media (min-width: 760px) {
  #view-tourney, #view-tournaments {
    width: min(720px, calc(100% - 48px));
    padding-left: 0;
    padding-right: 0;
  }
  .tn-lobby { padding: 26px 24px 22px; }
  .wide-match { max-width: 560px; padding: 0 12px; box-sizing: border-box; }
  .center-col.wide-match { max-width: 560px; width: 100%; }
}
@keyframes tnPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
@keyframes tnCoinFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-12px) rotate(18deg); }
}
@keyframes tnDots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}
@media (max-width: 420px) {
  .tn-seats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .tn-seat-av { width: 50px; height: 50px; }
  .tn-lobby h1 { font-size: 1.55rem; }
  .tn-wait-head { grid-template-columns: 1fr; }
}
.nav-ico svg { width: 22px; height: 22px; }

.win-overlay {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(7, 17, 31, .72);
  backdrop-filter: blur(7px);
  display: grid;
  place-items: center;
  align-content: safe center;
  justify-items: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: max(12px, env(safe-area-inset-top, 0px)) 12px calc(16px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  transition: background .25s ease, backdrop-filter .25s ease;
}
.win-overlay.peek {
  background: transparent;
  backdrop-filter: none;
  pointer-events: none;
  place-items: end center;
  overflow: hidden;
}
.win-overlay.peek .win-card {
  pointer-events: none;
  opacity: 0;
  transform: translateY(24px) scale(.96);
  visibility: hidden;
}
.win-float-pill {
  pointer-events: auto;
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 121;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 800;
  font-size: .9rem;
  color: #0f172a;
  background: linear-gradient(180deg, #fde68a, #f59e0b);
  box-shadow: 0 10px 28px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.25) inset;
  cursor: pointer;
}
.win-float-pill.hidden { display: none !important; }
.win-card {
  position: relative;
  width: min(420px, calc(100vw - 24px));
  max-height: min(86dvh, 640px);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: radial-gradient(120% 90% at 50% -10%, #4c3a16 0%, #1e1b4b 46%, #0b1220 100%);
  color: #fff; border-radius: 26px 26px 22px 22px; padding: 22px 16px 16px;
  text-align: center;
  box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 28px 80px rgba(0,0,0,.55), 0 0 70px rgba(251,191,36,.2);
  border: 2px solid rgba(251, 191, 36, .55);
  transition: opacity .22s ease, transform .22s ease, visibility .22s ease;
  margin: auto;
  box-sizing: border-box;
}
.win-card::before {
  content: '';
  position: absolute;
  left: 18%; right: 18%;
  bottom: -42%;
  height: 70%;
  background: radial-gradient(circle, rgba(251,191,36,.3), transparent 70%);
  pointer-events: none;
}
.win-overlay.loss .win-card {
  border-color: rgba(148,163,184,.4);
  background: radial-gradient(120% 90% at 50% -10%, #334155 0%, #0f172a 55%, #020617 100%);
  box-shadow: 0 28px 80px rgba(0,0,0,.55);
}
.win-overlay.draw .win-card { border-color: rgba(148,163,184,.5); }
.win-ring {
  width: 78px; height: 78px; margin: 0 auto 4px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 38% 32%, #fde68a, #f59e0b 58%, #b45309);
  box-shadow: 0 10px 24px rgba(245,158,11,.5), inset 0 2px 0 rgba(255,255,255,.45);
  position: relative; z-index: 1;
}
.win-overlay.loss .win-ring,
.win-overlay.draw .win-ring {
  background: radial-gradient(circle at 38% 32%, #e2e8f0, #64748b 62%, #334155);
  box-shadow: 0 8px 18px rgba(15,23,42,.4);
}
.win-badge { font-size: 2.35rem; line-height: 1; }
.win-card h2 { margin: 6px 0 2px; font-size: 1.55rem; position: relative; z-index: 1; }
.win-sub {
  margin: 0 0 2px;
  font-size: .86rem;
  font-weight: 700;
  color: #fde68a;
  position: relative; z-index: 1;
}
.win-overlay.loss .win-sub { color: #cbd5e1; }
.win-amt {
  margin: 2px 0 10px; font-size: 1.85rem; font-weight: 800;
  color: #fbbf24; position: relative; z-index: 1;
}
.win-overlay.loss .win-amt, .win-overlay.draw .win-amt { color: #e2e8f0; font-size: 1.15rem; }
.win-vs {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: stretch;
  margin: 0 0 12px;
  position: relative; z-index: 1;
}
.win-vs-card {
  min-width: 0;
  padding: 10px 8px;
  border-radius: 14px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  text-align: center;
}
.win-vs-card.win {
  border-color: rgba(251,191,36,.55);
  background: rgba(251,191,36,.12);
}
.win-vs-card.lose {
  border-color: rgba(148,163,184,.28);
  opacity: .92;
}
.win-vs-name {
  display: block;
  font-size: .82rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.win-vs-tag {
  display: block;
  margin-top: 2px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #94a3b8;
}
.win-vs-amt {
  display: block;
  margin-top: 6px;
  font-size: .95rem;
  font-weight: 800;
}
.win-vs-card.win .win-vs-amt { color: #fbbf24; }
.win-vs-card.lose .win-vs-amt { color: #f87171; }
.win-vs-mid {
  align-self: center;
  font-size: .72rem;
  font-weight: 800;
  color: #64748b;
  letter-spacing: .08em;
}
.win-card .lead { color: #cbd5e1; margin: 0 0 10px; position: relative; z-index: 1; font-size: .88rem; }
.win-rows {
  list-style: none; margin: 0 0 14px; padding: 0;
  background: rgba(255,255,255,.06); border-radius: 14px; overflow: hidden;
  position: relative; z-index: 1;
}
.win-rows li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 12px; font-size: .86rem;
  border-top: 1px solid rgba(255,255,255,.06);
}
.win-rows li:first-child { border-top: 0; }
.win-rows span { color: #94a3b8; text-align: left; }
.win-rows b { color: #fff; }
.win-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1.15fr;
  gap: 8px;
  position: relative; z-index: 1;
}
.win-home-cd {
  position: relative;
  z-index: 1;
  margin-top: 12px;
  height: 28px;
  border-radius: 999px;
  background: rgba(15, 23, 42, .55);
  border: 1px solid rgba(255,255,255,.12);
  overflow: hidden;
  display: grid;
  place-items: center;
}
.win-home-cd.hidden { display: none !important; }
.win-home-cd i {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, rgba(251,191,36,.55), rgba(251,191,36,.25));
  border-radius: inherit;
  transition: width .35s linear;
  pointer-events: none;
}
.win-home-cd span {
  position: relative;
  z-index: 1;
  font-size: .78rem;
  font-weight: 750;
  color: #fde68a;
  letter-spacing: .02em;
}
.win-overlay.loss .win-home-cd span { color: #cbd5e1; }
.win-overlay.loss .win-home-cd i {
  background: linear-gradient(90deg, rgba(148,163,184,.5), rgba(148,163,184,.2));
}
.win-card .btn {
  background: #fbbf24; color: #1e1b4b; margin: 0;
  width: auto !important;
  min-height: 46px;
}
.win-card .btn.ghost {
  background: rgba(255,255,255,.08);
  color: #e2e8f0;
  border: 1px solid rgba(255,255,255,.16);
}
.win-overlay.loss .win-card .btn { background: #94a3b8; color: #0f172a; }
@media (max-width: 520px) {
  .win-overlay {
    place-items: center;
    padding: max(10px, env(safe-area-inset-top, 0px)) 10px calc(12px + env(safe-area-inset-bottom, 0px));
  }
  .win-card {
    width: min(420px, calc(100vw - 20px));
    max-height: min(82dvh, 100%);
    padding: 16px 12px 12px;
    border-radius: 20px;
  }
  .win-ring { width: 64px; height: 64px; }
  .win-badge { font-size: 2rem; }
  .win-card h2 { font-size: 1.28rem; }
  .win-amt { font-size: 1.45rem; margin-bottom: 8px; }
  .win-vs { gap: 6px; margin-bottom: 10px; }
  .win-vs-card { padding: 8px 6px; }
  .win-rows { margin-bottom: 10px; }
  .win-rows li { padding: 8px 10px; font-size: .82rem; }
  .win-actions { grid-template-columns: 1fr 1fr; }
  .win-actions #btn-win-home { grid-column: 1 / -1; }
  .win-card .btn { min-height: 44px; }
}
@media (max-width: 380px) {
  .win-actions { grid-template-columns: 1fr; }
  .win-vs-name { font-size: .76rem; }
}

.pf-hero {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--stroke);
  border-radius: 18px; padding: 14px; margin-bottom: 8px;
}
.pf-hero-av, .avatar.pf-hero-av {
  width: 56px; height: 56px; border-radius: 50%;
  overflow: hidden; display: grid; place-items: center;
  font-weight: 800; background: var(--wa-bubble); color: #fff;
  border: 0; padding: 0; flex-shrink: 0;
}
.pf-hero-av img { width: 100%; height: 100%; object-fit: cover; }
.pf-hero-meta { min-width: 0; flex: 1; }
.pf-hero-row { display: flex; align-items: baseline; gap: 8px; }
.pf-hero-row b { font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-ver { margin-left: auto; color: var(--muted); font-size: .72rem; font-weight: 700; }
.pf-gold { color: var(--wa-gold); font-weight: 800; margin-top: 4px; font-size: 1rem; }
.pf-sec {
  margin: 16px 2px 8px; color: var(--muted);
  font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.pf-tile {
  width: 100%; display: flex; align-items: center; gap: 12px;
  text-align: left; background: var(--card); border: 1px solid var(--stroke);
  border-radius: 16px; padding: 12px; margin-bottom: 8px;
  color: var(--text);
}
.pf-tile b { display: block; font-size: .95rem; }
.pf-tile small { display: block; color: var(--muted); font-weight: 500; margin-top: 2px; }
.pf-tile.danger b { color: #b91c1c; }
.pf-ico {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center; background: var(--wa-bg-2); flex-shrink: 0;
}
.pf-logout { width: 100%; margin-top: 10px; background: var(--wa-danger); color: #fff; }
.pf-card {
  background: var(--card); border: 1px solid var(--stroke);
  border-radius: 16px; padding: 14px; margin-bottom: 10px;
}
.pf-man .field { margin-top: 10px; }
.pf-copy { white-space: pre-wrap; color: var(--muted); font-size: .9rem; line-height: 1.45; margin: 0; }
.pf-sheet {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(15, 23, 42, .45);
  display: flex; align-items: flex-end; justify-content: center;
}
.pf-sheet.hidden { display: none !important; }
.pf-sheet-card {
  width: min(560px, 100%);
  max-height: 82dvh;
  background: var(--wa-panel);
  border-radius: 20px 20px 0 0;
  padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column;
}
.pf-sheet-card .grab {
  width: 40px; height: 4px; border-radius: 99px; background: #cbd5e1;
  margin: 6px auto 10px;
}
.pf-sheet-card h2 { margin: 0 0 8px; font-size: 1.1rem; }
.pf-sheet-body { overflow: auto; flex: 1; padding-bottom: 8px; }
.pf-sw {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--stroke); border-radius: 14px;
  padding: 10px 12px; margin-bottom: 8px;
}
.pf-sw span { flex: 1; min-width: 0; }
.pf-sw b { display: block; font-size: .9rem; }
.pf-sw small { display: block; color: var(--muted); font-size: .75rem; }
.pf-sw input[type="checkbox"] { width: 22px; height: 22px; }
.pf-sw select { border: 1px solid var(--stroke); border-radius: 10px; padding: 6px 8px; font-weight: 700; }

/* 2P Ludo HUD — you under red home (bottom-left), opponent over yellow (top-right) */
.ludo-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
}
.ludo-hud {
  position: absolute;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: 72%;
  pointer-events: none;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.ludo-hud .dice { pointer-events: auto; }
.ludo-hud-opp { top: 6px; right: 6px; }
.ludo-hud-me { bottom: 6px; left: 6px; }
.ludo-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: #ef4444;
  pointer-events: none;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.ludo-hud-opp .ludo-chip {
  flex-direction: row-reverse;
  text-align: right;
  color: #eab308;
}
.ludo-chip.active .ludo-avatar {
  box-shadow: 0 0 0 2px #0b1220, 0 0 0 4px currentColor;
}
.ludo-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 15px;
  color: #fff;
  background: #334155;
  border: 2px solid currentColor;
}
.ludo-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ludo-avatar.red { background: #b91c1c; }
.ludo-avatar.yellow { background: #a16207; }
.ludo-avatar.green { background: #047857; }
.ludo-avatar.blue { background: #1d4ed8; }
.ludo-name {
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.15;
  text-shadow: 0 1px 4px #000;
  max-width: 108px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ludo-sub {
  color: #94a3b8;
  font-size: 11px;
  font-weight: 700;
}
.ludo-hearts {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 2px;
  line-height: 1;
}
.ludo-hearts i {
  font-style: normal;
  font-size: 11px;
  color: #fb7185;
  text-shadow: 0 1px 2px #000;
}
.ludo-hearts i.off { color: #64748b; }
.ludo-hearts b {
  margin-left: 3px;
  font-size: 9px;
  font-weight: 800;
  color: #cbd5e1;
}
.ludo-hearts.out b { color: #f87171; }
.ludo-kills {
  display: flex;
  gap: 3px;
  margin-top: 2px;
}
.ludo-kills i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: block;
  border: 1px solid #fff;
}
.ludo-kills i.red { background: #ef4444; }
.ludo-kills i.yellow { background: #eab308; }
.play-wrap .ludo-dice.dice {
  position: relative;
  width: 52px;
  height: 52px;
  padding: 3px;
  margin: 0;
  border-radius: 12px;
  border: 2px solid #cbd5e1;
  flex-shrink: 0;
  cursor: default;
  overflow: visible;
}
.play-wrap .ludo-dice.dice.red { border-color: #ef4444; background: #fff5f5; }
.play-wrap .ludo-dice.dice.yellow { border-color: #eab308; background: #fffbeb; }
.play-wrap .ludo-dice.dice.can-roll {
  border-color: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, .4), 0 4px 12px rgba(0,0,0,.3);
  cursor: pointer;
}
.dice-timer {
  position: absolute;
  top: -9px;
  left: -9px;
  z-index: 2;
  min-width: 22px;
  height: 22px;
  padding: 0 4px;
  border-radius: 999px;
  background: #0f172a;
  color: #fbbf24;
  font-size: 10px;
  font-weight: 800;
  display: grid;
  place-items: center;
  border: 2px solid #fbbf24;
  pointer-events: none;
}
.ludo-dice.urgent .dice-timer {
  color: #fecaca;
  border-color: #ef4444;
  animation: clockPulse 1s ease-in-out infinite;
}
.ludo-dice.has-timer {
  --turn-pct: 1;
}
.ludo-dice.has-timer::before {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 16px;
  background: conic-gradient(#22c55e calc(var(--turn-pct) * 1%), rgba(15,23,42,.55) 0);
  z-index: -1;
  pointer-events: none;
}
.ludo-dice.urgent.has-timer::before {
  background: conic-gradient(#ef4444 calc(var(--turn-pct) * 1%), rgba(15,23,42,.55) 0);
}
.ludo-pt-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 9;
  overflow: visible;
}
.ludo-pt-pop {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, 8px);
  font-weight: 900;
  font-size: clamp(1.4rem, 4.5vw, 2.1rem);
  color: #fbbf24;
  text-shadow: 0 2px 10px #000, 0 0 18px rgba(251, 191, 36, .45);
  animation: ludoPtPop 1.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  white-space: nowrap;
}
.ludo-pt-pop.kill {
  color: #fb7185;
  text-shadow: 0 2px 10px #000, 0 0 18px rgba(251, 113, 133, .5);
}
.ludo-pt-pop.home {
  color: #4ade80;
  font-size: clamp(1.7rem, 5.5vw, 2.6rem);
  text-shadow: 0 2px 12px #000, 0 0 22px rgba(74, 222, 128, .55);
  animation: ludoPtHome 1.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.ludo-pt-pop small {
  display: block;
  font-size: .45em;
  font-weight: 800;
  letter-spacing: .04em;
  opacity: .92;
  text-align: center;
}
@keyframes ludoPtPop {
  0% { opacity: 0; transform: translate(-50%, 22px) scale(.55); }
  16% { opacity: 1; transform: translate(-50%, 0) scale(1.18); }
  100% { opacity: 0; transform: translate(-50%, -36px) scale(1); }
}
@keyframes ludoPtHome {
  0% { opacity: 0; transform: translate(-50%, 28px) scale(.4); }
  14% { opacity: 1; transform: translate(-50%, -4px) scale(1.28); }
  40% { opacity: 1; transform: translate(-50%, -10px) scale(1.08); }
  100% { opacity: 0; transform: translate(-50%, -48px) scale(1); }
}
.ludo-pts-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(251, 191, 36, .38), rgba(245, 158, 11, .22));
  border: 1px solid rgba(251, 191, 36, .7);
  color: #fef3c7;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .03em;
  line-height: 1.2;
  box-shadow: 0 0 14px rgba(251, 191, 36, .28);
}
.ludo-pts-badge.bump {
  animation: ptsBump .55s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes ptsBump {
  0% { transform: scale(1); filter: brightness(1); }
  35% { transform: scale(1.28); filter: brightness(1.25); }
  100% { transform: scale(1); filter: brightness(1); }
}
.ludo-end-pts {
  margin: 6px 0 10px;
  font-size: 1.05rem;
  font-weight: 800;
  color: #fbbf24;
  letter-spacing: .02em;
}
.dice-pip {
  position: absolute;
  right: -6px;
  bottom: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: #0f172a;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
}
.dice.spin .dice-pip { opacity: .35; }
#dice-opp { pointer-events: none; }
.ludo-turn-hint, .ludo-roll-btn, #view-ludo-play .ludo-side { display: none !important; }
#view-ludo-play { overflow: hidden; height: 100dvh; padding: 8px; }
#view-ludo-play .topbar { margin-bottom: 8px; padding: 8px 10px; }
#view-ludo-play .layout { grid-template-columns: 1fr; gap: 0; }
#view-ludo-play .board-wrap {
  background: transparent;
  border: none;
  padding: 0;
  width: 100%;
  max-width: 100%;
}
/* Square sizing handled by #ludo-board-wrap .ludo-board-frame / .board below */
#view-table-play .panel-dark { display: none; }
#view-table-play {
  overflow: hidden;
  height: 100dvh;
  padding: 8px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
}
#view-table-play .topbar { margin-bottom: 8px; padding: 8px 10px; }
#view-table-play .layout { grid-template-columns: 1fr; gap: 0; }
#view-table-play .board-wrap {
  background: transparent;
  border: none;
  padding: 0;
}
#view-table-play .table-board {
  width: min(100%, calc(100dvh - 148px), 720px);
}
.games .game.kb-hidden,
.games .game[hidden] {
  display: none !important;
}
#view-table-play.quoridor-mode .panel-dark,
#view-table-play.quoridor-mode .play-turn,
#view-table-play.quoridor-mode .topbar {
  display: none !important;
}
#view-table-play.quoridor-mode .layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  height: 100%;
  padding: 40px 8px calc(8px + var(--kb-play-bottom));
  gap: 8px;
  box-sizing: border-box;
}
#view-table-play.quoridor-mode .board-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(100%, calc(100dvh - 168px), 560px);
  flex: 1;
  min-height: 0;
}
#view-table-play.quoridor-mode .table-board {
  width: 100%;
  max-height: min(100%, calc(100dvh - 268px), 560px);
}
#view-table-play.checkers-mode .layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 12px 12px 10px;
  gap: 8px;
  box-sizing: border-box;
}
#view-table-play.checkers-mode .board-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(100%, calc(100dvh - 140px), 720px);
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
}
#view-table-play.checkers-mode .table-board {
  width: min(100%, calc(100dvh - 220px), 680px);
  max-height: min(100%, calc(100dvh - 220px), 680px);
  height: auto;
}
@media (min-width: 900px) {
  #view-table-play.checkers-mode .layout {
    padding: 16px 20px 14px;
    gap: 10px;
  }
  #view-table-play.checkers-mode .board-wrap {
    width: min(100%, calc(100dvh - 160px), 760px);
    gap: 10px;
  }
  #view-table-play.checkers-mode .table-board {
    width: min(100%, calc(100dvh - 240px), 720px);
    max-height: min(100%, calc(100dvh - 240px), 720px);
  }
  #view-table-play.checkers-mode .ck-seat {
    max-width: 720px;
    margin: 0 auto;
  }
}
#view-table-play.chess-mode .play-turn { display: none !important; }
#view-table-play.chess-mode .layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px 12px 18px;
  gap: 8px;
  box-sizing: border-box;
}
#view-table-play.chess-mode .board-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: min(92vw, calc(100dvh - 196px), 680px);
  flex: 0 1 auto;
  min-height: 0;
  margin: auto;
}
#view-table-play.chess-mode .table-board {
  width: min(100%, calc(100dvh - 250px), 620px);
  max-height: min(100%, calc(100dvh - 250px), 620px);
  height: auto;
  aspect-ratio: 1;
  margin: 0 auto;
}
.ch-match { display: none; }
.ch-tools { display: none !important; }
.ch-tools button {
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: #f8fafc;
  color: #0f172a;
  font-weight: 800;
  font-size: .78rem;
}
.ch-tools button.ghost {
  background: rgba(15, 23, 42, .7);
  color: #e2e8f0;
}
.ch-tools small { color: #94a3b8; font-weight: 600; }
.ch-seat {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 2px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #e2e8f0;
  box-sizing: border-box;
  flex-shrink: 0;
  justify-self: stretch;
}
.ch-seat.opp { flex-direction: row-reverse; }
.ch-seat > i.ch-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 800; font-size: 15px; color: #fff;
  overflow: hidden; flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, .6);
  box-shadow: 0 0 0 2px #0b1220;
}
.ch-seat.side-white > i.ch-avatar { border-color: #e2e8f0; }
.ch-seat.side-black > i.ch-avatar { border-color: #f59e0b; }
.ch-seat > i.ch-avatar.white {
  background: radial-gradient(circle at 32% 28%, #fff, #f8fafc 50%, #cbd5e1);
  color: #0f172a;
}
.ch-seat > i.ch-avatar.black {
  background: radial-gradient(circle at 32% 28%, #475569, #1e293b 55%, #0f172a);
}
.ch-seat > i.ch-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ch-seat.on > i.ch-avatar { box-shadow: 0 0 0 2px #0b1220, 0 0 0 4px #22c55e; }
.ch-id { min-width: 0; max-width: 132px; }
.ch-seat.opp .ch-id { text-align: right; }
.ch-seat b {
  display: block; font-size: .82rem; font-weight: 700;
  color: #fff; text-shadow: 0 1px 4px #000; line-height: 1.15;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ch-caps {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 0 1px; min-height: 15px; margin-top: 1px;
}
.ch-seat.opp .ch-caps { justify-content: flex-end; }
.ch-caps i {
  font-style: normal; font-size: 1rem; line-height: 1;
  opacity: .88; color: #cbd5e1;
}
.ch-caps em {
  font-style: normal; font-weight: 800; color: #86efac;
  margin-left: 5px; font-size: .78rem;
}
.ch-clkbar {
  position: absolute;
  top: 36px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(15, 23, 42, .85);
  border: 1px solid rgba(148, 163, 184, .18);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
  pointer-events: none;
}
.ch-clk-side {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
}
.ch-clk-side time {
  font-family: Outfit, ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: .95rem;
  letter-spacing: .02em;
  color: #94a3b8;
  line-height: 1.15;
}
.ch-clk-side.run { background: #f8fafc; }
.ch-clk-side.run time { color: #0f172a; }
.ch-clk-side.low { background: #b91c1c; }
.ch-clk-side.low time { color: #fff; }
.ch-side {
  width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0;
}
.ch-side.white { background: #f8fafc; box-shadow: inset 0 0 0 1px #cbd5e1; }
.ch-side.black { background: #0f172a; box-shadow: inset 0 0 0 1px #64748b; }
.play-pot {
  position: absolute;
  top: 36px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, .78);
  border: 1px solid rgba(148, 163, 184, .22);
  color: #94a3b8;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
  pointer-events: none;
}
.play-pot.hidden { display: none !important; }
.play-pot b { color: #f8fafc; font-size: .8rem; font-weight: 800; margin-left: 2px; }
.play-pot .pot-win b { color: #86efac; }
#view-table-play.chess-mode .play-pot { top: 74px; }
#view-ludo-play .play-pot { top: 8px; }
#view-ludo-play:has(.ludo-clock-bar.on) .play-pot { top: 56px; }
@media (min-width: 900px) {
  #view-table-play.chess-mode .layout {
    padding: 44px 20px 20px;
    gap: 10px;
  }
  #view-table-play.chess-mode .board-wrap {
    width: min(100%, calc(100dvh - 200px), 680px);
    gap: 10px;
  }
  #view-table-play.chess-mode .table-board {
    width: min(100%, calc(100dvh - 260px), 640px);
    max-height: min(100%, calc(100dvh - 260px), 640px);
  }
  #view-table-play.chess-mode .ch-match,
  #view-table-play.chess-mode .chess-coach-tip {
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
  }
}
@media (max-width: 520px) {
  #view-table-play.checkers-mode .layout { padding: 8px 6px; gap: 6px; }
  #view-table-play.checkers-mode .board-wrap {
    width: min(100%, calc(100dvh - 120px));
  }
  #view-table-play.checkers-mode .table-board {
    width: min(100%, calc(100dvh - 188px));
    max-height: calc(100dvh - 188px);
  }
  #view-table-play.chess-mode .layout { padding: 38px 8px 14px; gap: 6px; }
  #view-table-play.chess-mode .board-wrap {
    width: min(100%, calc(100dvh - 180px));
  }
  #view-table-play.chess-mode .table-board {
    width: min(100%, calc(100dvh - 230px));
    max-height: calc(100dvh - 230px);
  }
  .ch-clk-side { padding: 2px 8px; }
  .ch-clk-side time { font-size: .88rem; }
  .ch-id { max-width: 104px; }
}
.q-seat {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(15, 23, 42, .78);
  color: #e2e8f0;
  box-sizing: border-box;
}
.q-seat.on { box-shadow: inset 0 0 0 1px #22c55e; }
.q-seat i {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 800; color: #fff; overflow: hidden; flex-shrink: 0;
}
.q-seat i.blue { background: #3B82F6; }
.q-seat i.gold { background: #F59E0B; }
.q-seat i img { width: 100%; height: 100%; object-fit: cover; }
.q-seat div { min-width: 0; flex: 1; }
.q-seat b { display: block; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-seat span { display: block; color: #94a3b8; font-size: .72rem; font-weight: 600; }
.q-seat em { font-style: normal; font-weight: 800; color: #E8C39E; font-size: .78rem; }
.q-dock {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: min(100%, 560px);
  z-index: 45;
  padding: 8px;
  margin-bottom: var(--kb-play-bottom);
  border-radius: 16px;
  background: rgba(21, 32, 43, .94);
  border: 1px solid rgba(232, 195, 158, .18);
  box-sizing: border-box;
  touch-action: manipulation;
  flex-shrink: 0;
  pointer-events: auto;
}
.q-dock.hidden { display: none !important; }
.q-mode, .q-ori {
  border: 0;
  border-radius: 12px;
  background: #1e293b;
  color: #e2e8f0;
  font-weight: 800;
  font-family: inherit;
  padding: 8px 10px;
  min-height: 52px;
}
.q-mode { flex: 1.2; font-size: .85rem; }
.q-mode b { display: block; font-size: .72rem; color: #fbbf24; }
.q-ori {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 72px;
}
.q-ori em { font-style: normal; font-size: .62rem; letter-spacing: .04em; text-transform: uppercase; color: #94a3b8; }
.q-mode.on, .q-ori.on { background: #1d4ed8; color: #fff; }
.q-ori.on em { color: #E8C39E; }
.q-line-h {
  display: block;
  width: 28px;
  height: 5px;
  background: #E8C39E;
  border-radius: 99px;
  box-shadow: 0 1px 0 #8b6914;
}
.q-line-v {
  display: block;
  width: 5px;
  height: 26px;
  background: #E8C39E;
  border-radius: 99px;
  box-shadow: 1px 0 0 #8b6914;
}
.q-mode:disabled { opacity: .45; }
.board-wrap.ludo-flip .ludo-board-frame .board { transform: rotate(180deg); }
.board-wrap.ludo-flip .token { transform: rotate(180deg); }
.dot.green { background: var(--green); }

@media (min-width: 861px) {
  .play-wrap .ludo-dice.dice { width: 64px; height: 64px; }
}
@media (max-width: 860px) {
  .play-wrap .ludo-dice.dice { width: 52px; height: 52px; }
  .ludo-avatar { width: 36px; height: 36px; font-size: 13px; }
  .ludo-name { font-size: 13px; max-width: 92px; }
  .board-wrap { padding: 6px; }
}

html, body {
  touch-action: pan-x pan-y;
  overscroll-behavior: auto;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
.play-wrap, .ludo-stage, .board-wrap, .board, .table-board {
  touch-action: none;
  -ms-touch-action: none;
}
.shell, .screen {
  max-width: 100vw;
  overflow-x: clip;
  overflow-y: visible;
}
.play-wrap { max-width: 100vw; }
/* Match lobbies: don't clip lifted stake chips / coin tops */
#view-ludo-home.screen,
#view-game-home.screen {
  overflow-x: visible;
  overflow-y: visible;
  height: auto;
}
@media (min-width: 900px) {
  #view-ludo-home.screen,
  #view-game-home.screen {
    padding-bottom: 150px;
  }
}
#view-ludo-home .wide-match,
#view-game-home .wide-match,
#view-ludo-home .match-panel,
#view-game-home .match-panel {
  overflow: visible;
}
@media (min-width: 1100px) {
  .shell { max-width: none; margin: 0 auto; }
  .wide-match { max-width: min(720px, 100%); }
}

/* Featured tournament on home */
.feat-banner {
  width: 100%; border: 0; margin: 14px 0 0; padding: 10px;
  overflow: hidden; border-radius: 20px;
  display: grid; grid-template-columns: 84px 1fr auto; gap: 12px; align-items: center;
  text-align: left; color: #fff; cursor: pointer;
  background:
    radial-gradient(circle at 0 0, rgba(255, 185, 56, .28), transparent 42%),
    linear-gradient(115deg, var(--wa-bubble) 0%, var(--wa-panel) 58%, #1a2a24 140%);
  box-shadow: var(--wa-shadow);
}
.feat-art {
  width: 84px; height: 84px; border-radius: 16px; overflow: hidden;
  display: grid; place-items: center;
  background: rgba(0, 0, 0, .22);
  border: 1px solid rgba(255, 255, 255, .16);
}
.feat-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.feat-art img[hidden] { display: none; }
.feat-copy { min-width: 0; display: grid; gap: 3px; }
.feat-kicker {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: #fde68a;
}
.feat-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #4ade80;
  box-shadow: 0 0 0 4px rgba(74, 222, 128, .18);
}
.feat-banner b { display: block; font-size: 1rem; line-height: 1.2; }
.feat-banner small { display: block; opacity: .88; font-weight: 600; }
.feat-side { display: grid; gap: 4px; justify-items: end; }
.feat-side em {
  font-style: normal; font-weight: 800; font-size: .75rem;
  background: rgba(255, 255, 255, .14); border-radius: 999px; padding: 4px 8px;
}
.feat-enter {
  margin-top: 2px; background: var(--wa-accent); color: #fff; font-weight: 800;
  border-radius: 999px; padding: 6px 12px; font-size: .78rem;
}

/* Colorful match lobby — Unity cover + chrome */
.match-panel.arena-lux {
  background:
    radial-gradient(circle at 12% 0%, rgba(0,168,132,.22), transparent 42%),
    radial-gradient(circle at 100% 10%, rgba(37,211,102,.12), transparent 40%),
    var(--wa-panel);
  border: 1px solid var(--wa-stroke);
  overflow: visible;
  box-shadow: var(--wa-shadow);
}
.match-panel {
  border-radius: 22px;
  box-shadow: var(--wa-shadow);
}
.arena-art {
  position: relative;
  height: auto;
  aspect-ratio: 16 / 9;
  margin: 0 0 14px;
  border-radius: 18px;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 20%, rgba(45,212,191,.2), transparent 50%),
    linear-gradient(160deg, #1e293b, #0b1220);
  box-shadow:
    0 1px 0 rgba(255,255,255,.16) inset,
    0 -2px 0 rgba(0,0,0,.35) inset,
    0 12px 28px rgba(7, 17, 31, .28);
}
.arena-art::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  border-radius: inherit;
  box-shadow:
    inset 0 0 0 1.5px rgba(255,255,255,.14),
    inset 0 0 0 4px rgba(7,17,31,.28);
}
.arena-art::after {
  content: 'ARENA';
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  font-size: .62rem;
  font-weight: 900;
  letter-spacing: .12em;
  color: #042f2e;
  padding: 5px 9px;
  border-radius: 999px;
  background: linear-gradient(180deg, #5eead4, #14b8a6 55%, #0f766e);
  box-shadow: 0 1px 0 rgba(255,255,255,.4) inset, 0 4px 12px rgba(15,118,110,.35);
}
.arena-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transform: scale(1.02);
  transition: transform .45s ease;
}
.arena-art:hover img { transform: scale(1.06); }
.arena-art.points { background: #1c1008; }
.arena-head h2 {
  font-size: 1.35rem;
  letter-spacing: -.03em;
}
.arena-ico {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background:
    linear-gradient(160deg, #fff, #ecfdf5);
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  flex-shrink: 0;
  box-shadow:
    0 1px 0 rgba(255,255,255,.8) inset,
    0 8px 18px rgba(15, 118, 110, .18);
  overflow: hidden;
}
.arena-ico img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pawn-orbit {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 6px;
  pointer-events: none;
}
.mini-pawn {
  width: 22px; height: 30px; border-radius: 10px 10px 6px 6px;
  box-shadow: 0 4px 8px rgba(0,0,0,.35);
  animation: pawnFloat 2.4s ease-in-out infinite;
}
.mini-pawn:nth-child(1) { background: #e53935; animation-delay: 0s; }
.mini-pawn:nth-child(2) { background: #ffd100; animation-delay: .2s; }
.mini-pawn:nth-child(3) { background: #009739; animation-delay: .4s; }
.mini-pawn:nth-child(4) { background: #1d6fd8; animation-delay: .6s; }
.mini-pawn:nth-child(5) { background: #e53935; animation-delay: .8s; }
.mini-pawn:nth-child(6) { background: #ffd100; animation-delay: 1s; }
.mini-pawn:nth-child(7) { background: #009739; animation-delay: 1.2s; }
.mini-pawn:nth-child(8) { background: #1d6fd8; animation-delay: 1.4s; }
@keyframes pawnFloat {
  0%, 100% { transform: translateY(8px); }
  50% { transform: translateY(-10px); }
}
.coin-row { display: flex; justify-content: center; gap: 8px; margin-top: -18px; position: relative; z-index: 2; }
.gold-coin {
  width: 36px; height: 36px; border-radius: 50%;
  background: radial-gradient(circle at 30% 28%, #fff7d6, #fbbf24 46%, #b45309);
  border: 2px solid #fde68a;
  box-shadow: 0 4px 10px rgba(180,83,9,.35);
  display: grid; place-items: center;
  color: #7c2d12; font-weight: 900; font-size: .78rem;
}
.seats-8 {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0 4px;
}
.seat-chip {
  background: #fff; border: 1px dashed #cbd5e1; border-radius: 12px; padding: 8px 4px;
  text-align: center; font-size: .7rem; font-weight: 700; color: #64748b;
}
.seat-chip.on { border-style: solid; border-color: #0f766e; color: #0f766e; background: #ecfdf5; }

/* Ludo safe stars (path only) — black, centered */
.cell.safe:not(.yard) {
  background: #f7f4ee !important;
}
.cell.safe:not(.yard)::before {
  content: none !important;
  display: none !important;
  background: none !important;
}
.cell.safe:not(.yard)::after {
  content: "★" !important;
  position: absolute !important;
  inset: auto !important;
  left: 50% !important;
  top: 50% !important;
  width: auto !important;
  height: auto !important;
  transform: translate(-50%, -50%) !important;
  background: none !important;
  color: #111;
  -webkit-text-stroke: 0;
  font-size: clamp(8px, 2.4vw, 14px);
  text-shadow: none;
  z-index: 2;
  line-height: 1;
  pointer-events: none;
  display: block !important;
}
.cell.yard::before,
.cell.yard.safe::before {
  content: none !important;
  display: none !important;
  background: none !important;
}
.cell.center {
  background: #ece7dc !important;
  box-shadow: none;
}
.ludo-hub {
  background: transparent;
  border-radius: 0;
  box-shadow: 0 0 0 1px #111;
}
.ludo-hub::after {
  content: none !important;
  display: none !important;
}
.hub-g { background: linear-gradient(135deg, #bbf7d0, #16a34a 70%, #14532d); }
.hub-y { background: linear-gradient(180deg, #fef08a, #eab308 70%, #854d0e); }
.hub-b { background: linear-gradient(225deg, #bfdbfe, #2563eb 70%, #1e3a8a); }
.hub-r { background: linear-gradient(0deg, #fecaca, #dc2626 70%, #7f1d1d); }

/* In-game: no fat header, leave as overlay */
.play-wrap .topbar { display: none !important; }
.play-exit {
  position: absolute; top: 8px; left: 8px; z-index: 12;
  width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: rgba(15,23,42,.72); color: #fff; font-size: 18px; font-weight: 800;
}
.play-turn {
  position: absolute; top: 10px; left: 48px; right: 48px;
  text-align: center; color: #f8fafc; font-weight: 800; font-size: .85rem;
  z-index: 8; pointer-events: none; text-shadow: 0 1px 4px #000;
}
.play-guide {
  position: absolute; top: 8px; right: 8px; z-index: 12;
  height: 36px; padding: 0 12px; border: 0; border-radius: 999px;
  background: rgba(15,23,42,.72); color: #94a3b8;
  font-weight: 800; font-size: .75rem; letter-spacing: .01em;
}
.play-guide.on { color: #f5c542; }
#view-table-play.guide-slot .play-turn { right: 108px; }
#view-ludo-play, #view-table-play {
  position: relative;
  height: 100dvh;
  padding: 0;
  padding-bottom: var(--kb-play-bottom);
  overflow: hidden;
}
#view-ludo-play .layout, #view-table-play .layout {
  height: 100%;
  grid-template-columns: 1fr;
}
#view-ludo-play .ludo-stage {
  height: 100%;
  width: 100%;
  max-width: 100vw;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 8px 2% 10px;
  gap: 4px;
  box-sizing: border-box;
  overflow: hidden;
}
/* Dice HUDs live inside board-frame corners — not flex rows above/below */
#view-ludo-play .ludo-hud {
  position: relative !important;
  top: auto !important;
  bottom: auto !important;
  left: auto !important;
  right: auto !important;
  width: max-content;
  max-width: min(52vw, 200px);
  gap: 6px;
  z-index: 6;
  flex: 0 0 auto;
  padding: 0;
  margin: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  outline: none;
}
#view-ludo-play .ludo-hud-opp,
#view-ludo-play .ludo-hud-me {
  justify-content: flex-start;
  padding: 0;
  min-height: 0;
}
#view-ludo-play .ludo-clock-bar {
  order: 1;
  align-self: center;
  width: 100%;
  flex: 0 0 auto;
  min-height: 0;
  padding: 2px 0 4px;
  margin: 0;
  z-index: 5;
}
#view-ludo-play .ludo-clock-bar:not(.on):not(:has(.ludo-clock:not(.hidden))) {
  display: none !important;
  min-height: 0;
  margin: 0;
  padding: 0;
}
#view-ludo-play #ludo-board-wrap {
  order: 2;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  margin: 0;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  /* Space for corner HUDs above/below without stretching the board */
  padding: clamp(54px, 9vh, 74px) 0;
  box-sizing: border-box;
}
#view-ludo-play #ludo-board-wrap .ludo-board-frame {
  position: relative;
  /* Same value for width+height = true square (aspect-ratio alone was stretching) */
  --ludo-side: min(92vw, 100%, calc(100dvh - 200px), 560px);
  --ludo-gold: #e8c872;
  --ludo-gold-deep: #9a6b1f;
  --ludo-gold-bright: #ffe9a8;
  width: var(--ludo-side);
  height: var(--ludo-side);
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  flex: 0 0 auto;
  box-sizing: border-box;
  padding: 7px;
  border-radius: 14px;
  background:
    linear-gradient(145deg, var(--ludo-gold-bright) 0%, var(--ludo-gold) 28%, var(--ludo-gold-deep) 52%, var(--ludo-gold) 78%, var(--ludo-gold-bright) 100%);
  box-shadow:
    0 0 0 1px rgba(255, 236, 180, .55),
    0 0 0 3px rgba(74, 45, 8, .85),
    0 10px 28px rgba(0, 0, 0, .48),
    0 0 22px rgba(232, 200, 114, .22);
}
/* Inner bevel ring so board sits in a gold “frame” */
#view-ludo-play #ludo-board-wrap .ludo-board-frame::before {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 11px;
  pointer-events: none;
  z-index: 2;
  box-shadow:
    inset 0 0 0 1px rgba(255, 248, 220, .55),
    inset 0 0 0 2px rgba(90, 55, 12, .55),
    inset 0 0 10px rgba(0, 0, 0, .18);
}
/* Fancy corner caps — gold studs on 4 corners */
#view-ludo-play #ludo-board-wrap .ludo-board-frame::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 16px;
  pointer-events: none;
  z-index: 3;
  background:
    radial-gradient(circle at 6px 6px, var(--ludo-gold-bright) 0 3px, var(--ludo-gold-deep) 4px, transparent 5px),
    radial-gradient(circle at calc(100% - 6px) 6px, var(--ludo-gold-bright) 0 3px, var(--ludo-gold-deep) 4px, transparent 5px),
    radial-gradient(circle at 6px calc(100% - 6px), var(--ludo-gold-bright) 0 3px, var(--ludo-gold-deep) 4px, transparent 5px),
    radial-gradient(circle at calc(100% - 6px) calc(100% - 6px), var(--ludo-gold-bright) 0 3px, var(--ludo-gold-deep) 4px, transparent 5px);
  opacity: .95;
}
#view-ludo-play #ludo-board-wrap .board {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  aspect-ratio: 1 / 1 !important;
  box-sizing: border-box;
  border-radius: 10px;
  position: relative;
  z-index: 1;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, .35),
    0 0 0 1px rgba(154, 107, 31, .35);
}
.ludo-corners {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 8;
}
/* Anchor only — no pill / border / dummy chrome */
.ludo-corner {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 0;
  max-width: 52%;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
  opacity: 1;
}
.ludo-corner.empty,
.ludo-corner:not(:has(.ludo-hud)) { display: none; }
.ludo-corner.has-hud { pointer-events: none; }
.ludo-corner.has-hud .ludo-hud { pointer-events: none; }
.ludo-corner.has-hud .dice { pointer-events: auto; }
.ludo-corner.tl { top: 0; left: 1%; transform: translateY(calc(-105% - 6px)); }
.ludo-corner.tr { top: 0; right: 1%; transform: translateY(calc(-105% - 6px)); }
.ludo-corner.bl { bottom: 0; left: 1%; transform: translateY(calc(105% + 6px)); }
.ludo-corner.br { bottom: 0; right: 1%; transform: translateY(calc(105% + 6px)); }
.ludo-corner.tr .ludo-hud,
.ludo-corner.br .ludo-hud {
  flex-direction: row-reverse;
  text-align: right;
}
.ludo-corner.tl .ludo-hud,
.ludo-corner.bl .ludo-hud {
  flex-direction: row;
  text-align: left;
}
.ludo-corner .ludo-chip {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}
.ludo-corner .ludo-chip.active .ludo-avatar {
  box-shadow: 0 0 0 2px rgba(11,18,32,.9), 0 0 0 3px currentColor;
}
.ludo-corner.you .ludo-name { color: #ffd54f; }
@media (max-width: 420px) {
  .ludo-corner .ludo-avatar { width: 28px; height: 28px; }
  .ludo-corner .ludo-name { font-size: 11px; max-width: 72px; }
  #view-ludo-play #ludo-board-wrap {
    padding: clamp(50px, 8vh, 64px) 0;
  }
  #view-ludo-play #ludo-board-wrap .ludo-board-frame {
    --ludo-side: min(94vw, 100%, calc(100dvh - 168px), 560px);
  }
  #view-ludo-play .ludo-hud { max-width: min(58vw, 168px); gap: 4px; }
}
.play-wrap .ludo-dice.dice {
  box-shadow: 0 8px 18px rgba(0,0,0,.35);
}
#dice-opp.spin, .dice.spin {
  outline: 3px solid #fbbf24;
}
@media (min-width: 900px) {
  #view-ludo-play .ludo-stage {
    max-width: 920px;
    margin: 0 auto;
    padding: 14px 3% 16px;
    gap: 10px;
  }
  #view-ludo-play #ludo-board-wrap .ludo-board-frame {
    --ludo-side: min(88vw, 100%, calc(100dvh - 220px), 560px);
  }
  .play-wrap .ludo-dice.dice { width: 58px; height: 58px; }
  #view-ludo-play .ludo-clock {
    min-width: 120px;
    padding: 7px 18px 6px;
  }
  #view-ludo-play .ludo-clock b { font-size: 1.12rem; }
}
@media (max-width: 860px) {
  #view-ludo-play .ludo-stage {
    padding: 6px 4px calc(10px + var(--kb-play-bottom) + 36px);
    gap: 6px;
  }
  #view-ludo-play #ludo-board-wrap .ludo-board-frame {
    --ludo-side: min(94vw, 100%, calc(100dvh - 176px), 560px);
  }
  #view-ludo-play .ludo-hud-opp { margin-right: 0; }
  #view-ludo-play .ludo-hud-me { margin-left: 0; }
}
@media (max-width: 520px) {
  #view-ludo-play .ludo-stage {
    padding: 4px 2px calc(8px + var(--kb-play-bottom) + 40px);
    gap: 5px;
  }
  #view-ludo-play #ludo-board-wrap .ludo-board-frame {
    --ludo-side: min(96vw, 100%, calc(100dvh - 156px), 520px);
  }
  .ludo-name { max-width: 84px; font-size: 12px; }
}

/* Chess path */
.sq.path::after {
  content: "";
  width: 18%; height: 18%;
  background: rgba(251, 191, 36, .9);
  border-radius: 50%;
  pointer-events: none;
}
.sq.legal::after {
  width: 34%; height: 34%;
  background: rgba(20, 184, 166, .95);
  box-shadow: 0 0 0 4px rgba(20, 184, 166, .2);
}
.sq.hi { box-shadow: inset 0 0 0 4px #fbbf24; }

/* Chat */
.chat-page { display: flex; flex-direction: column; height: calc(100dvh - var(--kb-nav-h)); }
.chat-msgs { flex: 1; overflow: auto; display: grid; gap: 8px; padding: 8px 0; }
.chat-bubble {
  max-width: 78%; padding: 8px 12px; border-radius: 14px; font-size: .9rem;
  background: #fff; border: 1px solid var(--stroke);
}
.chat-bubble.me { margin-left: auto; background: #ccfbf1; border-color: #99f6e4; }
.chat-send { display: flex; gap: 8px; }
.chat-send input { flex: 1; }

/* Integrity overlay */
.fair-lock {
  position: fixed; inset: 0; z-index: 200; background: rgba(7,17,31,.92);
  display: grid; place-items: center; align-content: safe center;
  padding: max(16px, env(safe-area-inset-top, 0px)) 16px calc(16px + env(safe-area-inset-bottom, 0px));
  color: #fff; text-align: center;
  backdrop-filter: blur(6px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
}
.fair-lock.hidden { display: none !important; }
.fair-lock .panel {
  width: min(420px, 100%);
  max-width: 420px;
  max-height: min(88dvh, 100%);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid rgba(251,191,36,.35);
  border-radius: 18px;
  padding: 22px 18px;
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
  box-sizing: border-box;
  margin: auto;
}
.fair-lock .panel h2 { margin: 0 0 8px; color: #fde68a; }
.fair-lock .fair-kind {
  margin: 0 0 8px;
  font-weight: 800;
  color: #fbbf24;
  font-size: .95rem;
}
.fair-lock .fair-detail {
  margin: 8px 0 14px;
  font-size: .82rem;
  color: #94a3b8;
  word-break: break-word;
}
.fair-lock .fair-actions {
  display: grid;
  gap: 8px;
}
.fair-lock .fair-actions .btn.ghost {
  background: transparent;
  border: 1px solid rgba(148,163,184,.35);
  color: #e2e8f0;
}
.fair-lock .fair-actions .btn.fair-off {
  background: linear-gradient(135deg, #7f1d1d, #b91c1c);
  border: 1px solid rgba(252,165,165,.45);
  color: #fff;
  font-weight: 800;
}
html.kb-fair-locked,
html.kb-fair-locked body {
  overflow: hidden !important;
}
#view-table-play,
#view-ludo-play,
.table-board,
.ludo-board-frame {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Rooms always visible */
.match-more { display: block; margin-top: 12px; }
.match-more summary { font-weight: 800; cursor: pointer; margin-bottom: 8px; }

@media (max-width: 420px) {
  .games { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .atm-card { padding: 14px; }
}

/* Wallet page — teal theme */
#view-wallet {
  display: grid;
  gap: 12px;
  padding-bottom: var(--kb-nav-h);
}
#view-wallet.hidden { display: none !important; }
.wal-hero {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  padding: 18px 16px 16px;
  color: #fff;
  background:
    radial-gradient(circle at 88% -10%, rgba(251, 191, 36, .35), transparent 42%),
    radial-gradient(circle at 8% 110%, rgba(45, 212, 191, .28), transparent 46%),
    linear-gradient(145deg, #0f766e 0%, #0d9488 48%, #115e59 100%);
  border: 1px solid rgba(255,255,255,.16);
  box-shadow: 0 14px 28px rgba(15, 118, 110, .28);
}
.wal-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.wal-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.wal-user b { display: block; font-size: .95rem; line-height: 1.15; }
.wal-user small { color: rgba(255,255,255,.72); font-size: .75rem; }
.wal-hero .atm-av {
  width: 40px;
  height: 40px;
  font-size: .95rem;
  border: 2px solid rgba(255,255,255,.35);
}
.wal-eye {
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.22);
  color: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: .75rem;
  font-weight: 700;
}
.wal-lab {
  display: block;
  margin-top: 16px;
  color: rgba(255,255,255,.78);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.wal-amt {
  display: block;
  margin-top: 4px;
  font-size: 2.05rem;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.1;
}
.wal-cta {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 8px;
  margin-top: 16px;
}
.wal-cta button {
  border: 0;
  border-radius: 14px;
  padding: 12px 10px;
  font-weight: 800;
  font-size: .88rem;
  background: #fff;
  color: #0f766e;
}
.wal-cta button.ghost {
  background: rgba(255,255,255,.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,.28);
}
.wal-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.wal-pill {
  background: var(--card);
  border: 1px solid var(--stroke2);
  border-radius: 16px;
  padding: 12px 14px;
}
.wal-pill span {
  display: block;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.wal-pill b {
  display: block;
  margin-top: 4px;
  font-size: 1.15rem;
  color: var(--brand);
}
.wal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.wal-actions button {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  border: 1px solid var(--stroke2);
  background: var(--card);
  color: var(--text);
  border-radius: 16px;
  padding: 12px 12px;
  transition: background .15s ease, border-color .15s ease;
}
.wal-actions button:active { background: var(--wa-panel-2); border-color: var(--brand); }
.wal-actions b { display: block; font-size: .88rem; color: var(--text); }
.wal-actions small { display: block; color: var(--muted); font-size: .72rem; font-weight: 600; }
.wal-ico {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 1.05rem;
  flex-shrink: 0;
}
.wal-ico.add { background: linear-gradient(135deg, #2dd4bf, #0f766e); }
.wal-ico.wd { background: linear-gradient(135deg, #34d399, #047857); }
.wal-ico.hist { background: linear-gradient(135deg, #fbbf24, #d97706); }
.wal-ico.ref { background: linear-gradient(135deg, #fb7185, #e11d48); }
.wal-sec {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 4px 2px 0;
}
.wal-sec h3 { margin: 0; font-size: 1.02rem; }
.wal-all {
  border: 0;
  background: none;
  color: var(--brand);
  font-weight: 800;
  font-size: .82rem;
  padding: 4px 0;
}
.wal-tx .hist-row {
  border-color: var(--stroke2);
}

/* Add Cash — richer top-up */
#view-add-cash {
  display: grid;
  gap: 12px;
  padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
}
#view-add-cash.hidden { display: none !important; }
#view-add-cash .page-head { margin-bottom: 2px; }
.cash-hero {
  border-radius: 20px;
  padding: 16px 16px 14px;
  color: #fff;
  background:
    radial-gradient(circle at 90% -20%, rgba(251,191,36,.35), transparent 42%),
    radial-gradient(circle at 0% 120%, rgba(45,212,191,.22), transparent 46%),
    linear-gradient(145deg, #0f766e, #115e59 70%);
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 12px 24px rgba(0,0,0,.35);
}
.cash-hero span { display: block; font-size: .75rem; font-weight: 700; opacity: .82; }
.cash-hero strong { display: block; font-size: 1.7rem; margin: 4px 0 2px; }
.cash-hero small { opacity: .82; font-weight: 600; }
.cash-card {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 18px;
  padding: 14px 14px 12px;
}
.cash-card h3 { margin: 0 0 10px; font-size: .98rem; color: var(--text); }
.cash-presets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.cash-amt {
  border: 1px solid var(--stroke2);
  background: var(--wa-bg-2);
  border-radius: 14px;
  padding: 12px 6px;
  font-weight: 800;
  font-size: .92rem;
  color: var(--text);
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.cash-amt:active { transform: scale(.97); }
.cash-amt.on {
  background: linear-gradient(180deg, var(--wa-accent-2), var(--wa-accent));
  color: var(--wa-accent-ink);
  border-color: var(--wa-accent);
  box-shadow: 0 6px 14px rgba(0,168,132,.28);
}
.cash-custom { margin-bottom: 8px; }
.cash-break {
  display: grid;
  gap: 8px;
  background: var(--wa-bg-2);
  border: 1px solid var(--stroke2);
  border-radius: 14px;
  padding: 10px 12px;
  margin: 8px 0 6px;
}
.cash-break > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: .88rem;
  color: var(--muted);
}
.cash-break > div b { color: var(--text); }
.cash-break .total {
  border-top: 1px dashed var(--stroke2);
  padding-top: 8px;
  font-weight: 800;
  color: var(--text);
}
.cash-break .total b { color: var(--brand); font-size: 1.05rem; }
.cash-fee-line { margin: 0; font-size: .8rem; }
.cash-gws { display: grid; gap: 8px; margin-bottom: 12px; }
.cash-gw {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--stroke2);
  background: var(--wa-bg-2);
  color: var(--text);
  border-radius: 14px;
  padding: 10px 12px;
  transition: background .15s ease, border-color .15s ease;
}
.cash-gw i {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--faint); flex-shrink: 0;
  transition: border-color .15s ease, background .15s ease;
}
.cash-gw .gw-ico {
  width: 22px; height: 22px; border-radius: 7px;
  object-fit: cover; flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .14);
}
.cash-gw span { display: grid; gap: 1px; }
.cash-gw b { font-size: .92rem; color: var(--text); }
.cash-gw small { color: var(--muted); font-weight: 600; font-size: .75rem; }
.cash-gw.on {
  border-color: var(--brand);
  background: rgba(0, 168, 132, .12);
  box-shadow: inset 0 0 0 1px var(--brand);
}
.cash-gw.on i {
  border-color: var(--brand);
  background: var(--brand);
  box-shadow: inset 0 0 0 3px var(--wa-bg-2);
}
.cash-pay-btn { margin-top: 4px; }
.cash-notes {
  margin: 10px 2px 0;
  padding: 0 0 0 18px;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.45;
}
.cash-notes li::marker { color: var(--brand); }
.cash-notes li + li { margin-top: 3px; }
.cash-tx-card .hist-row { margin-bottom: 0; }
@media (max-width: 420px) {
  .cash-presets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.kb-push-banner {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 86;
  width: min(420px, calc(100vw - 24px));
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  background: #0f172a;
  color: #fff;
  border: 0;
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, .28);
  font: inherit;
}
.kb-push-banner.hidden { display: none; }
.kb-push-banner img {
  width: 40px; height: 40px; border-radius: 10px; object-fit: cover; flex-shrink: 0;
}
.kb-push-banner div { display: grid; gap: 2px; min-width: 0; }
.kb-push-banner b {
  font-size: .92rem; line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.kb-push-banner span {
  color: #cbd5e1; font-size: .8rem; font-weight: 600;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

html[data-gfx="low"] .play-wrap {
  background: #07111f;
}
html[data-gfx="low"] .token {
  will-change: auto;
  transition: left 90ms linear, top 90ms linear;
  filter: none;
}
html[data-gfx="low"] .token.legal .pawn,
html[data-gfx="low"] .token.legal .pawn-ripple,
html[data-gfx="low"] .token.legal .pawn-ring,
html[data-gfx="low"] .pawn-arrow,
html[data-gfx="low"] .clock.urgent,
html[data-gfx="low"] .dice.spin {
  animation: none !important;
}
html[data-gfx="low"] .pawn-ripple,
html[data-gfx="low"] .pawn-ring,
html[data-gfx="low"] .hop-spark {
  display: none !important;
}
html[data-gfx="low"] .dock,
html[data-gfx="low"] .tabbar,
html[data-gfx="low"] .topbar {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* ——— Snake & Ladder ——— */
.table-board.snakeladder {
  --sl-ink: #4a2b12;
  --sl-a: #fff6e4;
  --sl-b: #f0d7a8;
  position: relative;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  grid-template-rows: repeat(10, 1fr);
  gap: 1.5px;
  padding: 9px;
  aspect-ratio: 1 / 1;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 100%;
  border-radius: 16px;
  overflow: visible;
  background:
    linear-gradient(180deg, rgba(255, 236, 179, .22), transparent 42%),
    repeating-linear-gradient(90deg, rgba(255,255,255,.05) 0 2px, transparent 2px 7px),
    linear-gradient(145deg, #8b5a2b 0%, #6b3e1a 42%, #4a2610 100%);
  box-shadow:
    0 0 0 2px #e8c36a,
    0 0 0 5px #5c3317,
    0 0 0 7px #c9a227,
    0 16px 34px rgba(0, 0, 0, .42);
  flex-shrink: 1;
  min-height: 0;
}
.table-board.snakeladder .sq {
  position: relative;
  appearance: none;
  -webkit-appearance: none;
  border: none;
  outline: none;
  border-radius: 3px;
  margin: 0;
  padding: 0;
  min-height: 0;
  background: transparent;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.42);
  overflow: hidden;
}
.table-board.snakeladder .sq.sl-a {
  background: linear-gradient(180deg, #fffaf0 0%, #fff1d6 100%);
}
.table-board.snakeladder .sq.sl-b {
  background: linear-gradient(180deg, #f4d7a4 0%, #e4bc74 100%);
}
.table-board.snakeladder .sq.sl-start {
  background: linear-gradient(180deg, #bbf7d0, #4ade80);
}
.table-board.snakeladder .sq.sl-end {
  background: linear-gradient(180deg, #fde68a, #f59e0b);
}
.table-board.snakeladder .sq.sl-has-ladder,
.table-board.snakeladder .sq.sl-has-snake {
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
}
.table-board.snakeladder .sq.sl-land { animation: slLand .7s ease; z-index: 3; }
.table-board.snakeladder .sq.sl-step {
  background: #bbf7d0 !important;
  box-shadow: inset 0 0 0 2px #15803d;
  z-index: 3;
}
.table-board.snakeladder .sq.sl-dest {
  background: #86efac !important;
  box-shadow: inset 0 0 0 2px #16a34a;
  z-index: 3;
}
.table-board.snakeladder .sq.sl-warp {
  background: #fde68a !important;
  box-shadow: inset 0 0 0 2px #b45309;
  z-index: 3;
}
.table-board.snakeladder .sq.sl-from { filter: brightness(.97); }
@keyframes slLand {
  0% { box-shadow: inset 0 0 0 3px #ca8a04; }
  100% { box-shadow: inset 0 0 0 0 transparent; }
}
.table-board.snakeladder .sl-num {
  position: absolute;
  top: 2px; left: 3px;
  font-size: clamp(.48rem, 1.7vw, .7rem);
  font-weight: 800;
  color: rgba(74, 43, 18, .78);
  line-height: 1; z-index: 1; pointer-events: none;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 0 rgba(255,255,255,.45);
}
.table-board.snakeladder .sl-badge {
  position: absolute;
  left: 50%;
  bottom: 3px;
  transform: translateX(-50%);
  font-size: clamp(.32rem, 1.15vw, .48rem);
  font-weight: 800;
  letter-spacing: .04em;
  color: #14532d;
  z-index: 1;
  pointer-events: none;
  line-height: 1;
  white-space: nowrap;
}
.table-board.snakeladder .sl-badge.win { color: #7c2d12; }
.table-board.snakeladder .sl-mark { display: none; }
.table-board.snakeladder .sl-overlay {
  position: absolute;
  inset: 9px;
  width: calc(100% - 18px);
  height: calc(100% - 18px);
  pointer-events: none;
  z-index: 2;
  overflow: visible;
}
.table-board.snakeladder .sl-ladder-fill {
  fill: #c47a1a;
  opacity: .38;
  stroke: none;
}
.table-board.snakeladder .sl-ladder-rail {
  fill: none; stroke: #6b3410; stroke-width: 0.72; stroke-linecap: round;
}
.table-board.snakeladder .sl-ladder-rung {
  fill: none; stroke: #f6d08a; stroke-width: 0.48; stroke-linecap: round;
}
.table-board.snakeladder .sl-snake-outline {
  fill: none; stroke-width: 2.05; stroke-linecap: round; stroke-linejoin: round; opacity: .95;
}
.table-board.snakeladder .sl-snake-body {
  fill: none; stroke-width: 1.55; stroke-linecap: round; stroke-linejoin: round; opacity: 1;
}
.table-board.snakeladder .sl-snake-belly {
  fill: none; stroke-width: 0.55; stroke-linecap: round; stroke-linejoin: round; opacity: .7;
}
.table-board.snakeladder .sl-snake-head { stroke-width: .18; }
.table-board.snakeladder .sl-snake-eye { fill: #fffbeb; }
.table-board.snakeladder .sl-snake-pupil { fill: #111827; }
.table-board.snakeladder .sl-snake-tongue {
  fill: none; stroke: #fb7185; stroke-width: .16; stroke-linecap: round;
}
.table-board.snakeladder .sl-snake-tail { stroke-width: .16; }
.table-board.snakeladder .sl-pawns {
  position: absolute;
  inset: 9px;
  z-index: 6;
  pointer-events: none;
  overflow: visible;
}
.table-board.snakeladder .sl-pawns .hop-spark {
  width: 7%;
  margin: 0;
}
.table-board.snakeladder .sl-pawn {
  position: absolute !important;
  left: 0;
  top: 0;
  max-width: none;
  max-height: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  margin: 0;
  appearance: none;
  background: transparent;
  z-index: 6;
  overflow: visible;
  cursor: default;
  pointer-events: auto;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.45));
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.table-board.snakeladder .sl-pawn .pawn {
  position: absolute;
  inset: 0;
}
.table-board.snakeladder .sl-pawn.legal {
  cursor: pointer;
  z-index: 8;
  filter: drop-shadow(0 0 5px #fbbf24) drop-shadow(0 2px 2px rgba(0,0,0,.4));
}
.table-board.snakeladder .sl-pawn.just .pawn,
.table-board.snakeladder .sl-pawn.hop .pawn {
  animation: pawnHop 170ms ease-out;
}
html[data-gfx="high"] .table-board.snakeladder .sl-pawn.hop .pawn {
  animation: pawnHopHi 220ms cubic-bezier(0.16, 1, 0.3, 1);
}
.table-board.snakeladder .sl-pawn:disabled {
  cursor: default;
}

/* Ludo-style HUD — opponent top-right, me bottom-left with dice beside name */
.sl-topbar {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  width: 100%;
  flex: 0 0 auto;
  padding: 0 2px;
}
.sl-seat {
  display: block;
  width: auto;
  max-width: none;
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: 0;
  color: #ecfdf5;
  margin: 0;
  box-shadow: none;
}
.sl-hud-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.sl-hud-row.me { justify-content: flex-start; }
.sl-chip {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 6px 10px 6px 6px;
  border-radius: 14px;
  background: rgba(6, 32, 28, .66);
  border: 1.5px solid rgba(255,255,255,.1);
  color: #ef4444;
  box-shadow: 0 6px 18px rgba(0,0,0,.26);
}
.sl-chip.yellow { color: #eab308; }
.sl-chip.green { color: #34d399; }
.sl-chip.blue { color: #60a5fa; }
.sl-chip.active {
  border-color: currentColor;
  box-shadow: 0 0 0 1.5px currentColor, 0 6px 18px rgba(0,0,0,.3);
}
.sl-chip.active .sl-avatar {
  box-shadow: 0 0 0 2px #06201c, 0 0 0 4px currentColor;
}
.sl-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 15px;
  color: #fff;
  background: #115e59;
  border: 2px solid rgba(253, 230, 138, .7);
  box-shadow: 0 3px 10px rgba(0,0,0,.3);
}
.sl-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sl-avatar.red { background: #b91c1c; color: #fff; border-color: #fca5a5; }
.sl-avatar.yellow { background: #a16207; color: #fff; border-color: #fde68a; }
.sl-avatar.green { background: #047857; border-color: #6ee7b7; }
.sl-avatar.blue { background: #1d4ed8; border-color: #93c5fd; }
.sl-seat-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  text-align: left;
}
.sl-seat-info b {
  display: block;
  color: #fff;
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 118px;
}
.sl-hearts {
  display: flex;
  align-items: center;
  gap: 1px;
  line-height: 1;
}
.sl-hearts i {
  font-style: normal;
  font-size: 11px;
  color: #fb7185;
  text-shadow: 0 1px 2px #000;
}
.sl-hearts i.off { color: #475569; }
.sl-hearts b {
  margin-left: 4px;
  font-size: 9px;
  font-weight: 800;
  color: #cbd5e1;
}
.sl-hearts.out b { color: #f87171; }
.sl-sub {
  display: block;
  margin-top: 1px;
  color: #99f6e4;
  font-size: .6rem;
  font-weight: 700;
  opacity: .82;
  white-space: nowrap;
}
.sl-yard { display: none !important; }
.sl-stats { display: none !important; }
.sl-dots { display: none !important; }
.sl-pick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 2px 0 0;
  justify-content: flex-start;
  pointer-events: auto;
}
.sl-pick {
  border: 0;
  border-radius: 10px;
  padding: 8px 12px;
  font: 800 .74rem Outfit, system-ui, sans-serif;
  background: rgba(15, 118, 110, .9);
  color: #f8fafc;
  box-shadow: 0 0 0 2px #fbbf24;
  -webkit-tap-highlight-color: transparent;
}
.sl-pick.red { background: #b91c1c; }
.sl-pick.yellow { background: #a16207; }
.sl-dock {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  padding: 0 2px;
}
.sl-ludo-dice.dice {
  position: relative;
  width: 52px;
  height: 52px;
  padding: 3px;
  margin: 0;
  border-radius: 12px;
  border: 2px solid #e2e8f0;
  background: #fff;
  flex-shrink: 0;
  cursor: default;
  overflow: visible;
  box-shadow: 0 6px 16px rgba(0,0,0,.28);
  appearance: none;
}
.sl-ludo-dice.dice.red { border-color: #ef4444; background: #fff5f5; }
.sl-ludo-dice.dice.yellow { border-color: #eab308; background: #fffbeb; }
.sl-ludo-dice.dice.green { border-color: #22c55e; background: #f0fdf4; }
.sl-ludo-dice.dice.blue { border-color: #3b82f6; background: #eff6ff; }
.sl-ludo-dice.dice.can-roll {
  border-color: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, .4), 0 4px 12px rgba(0,0,0,.3);
  cursor: pointer;
  animation: slPulse 1.2s ease infinite;
}
.sl-ludo-dice.dice.pick { border-color: #14b8a6; }
.sl-ludo-dice.dice.six { border-color: #f59e0b; }
.sl-ludo-dice.dice:disabled { opacity: .65; cursor: default; animation: none; }
.sl-ludo-dice.dice img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 8px;
}
.sl-dice,
.sl-dice-face,
.sl-dice-btn { display: none !important; }
.sl-tip {
  margin: 0;
  text-align: left;
  color: #99f6e4;
  font-size: .7rem;
  font-weight: 600;
  max-width: 260px;
  opacity: .88;
  line-height: 1.25;
}
.sl-tip.pick {
  color: #fde68a;
  font-weight: 800;
  opacity: 1;
}
@keyframes slPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

#view-table-play.snakeladder-mode .check-banner { display: none !important; }
#view-table-play.snakeladder-mode .play-turn { display: none !important; }
#view-table-play.snakeladder-mode {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  padding: 0;
  padding-bottom: var(--kb-play-bottom);
  box-sizing: border-box;
  background:
    radial-gradient(ellipse 80% 45% at 50% 0%, rgba(245, 158, 11, .16), transparent 58%),
    linear-gradient(180deg, #2c1810 0%, #1a0e09 48%, #120805 100%);
}
#view-table-play.snakeladder-mode .layout {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  max-width: none;
  margin: 0;
  padding: 48px 12px calc(10px + var(--kb-play-bottom));
  gap: 0;
  box-sizing: border-box;
  overflow: hidden;
}
#view-table-play.snakeladder-mode .board-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  background: transparent;
  border: none;
  padding: 0;
  overflow: visible;
  box-sizing: border-box;
}
#view-table-play.snakeladder-mode .sl-topbar { order: 0; }
#view-table-play.snakeladder-mode .table-board {
  order: 1;
  flex: 0 1 auto;
  min-height: 0;
  width: min(100%, calc(100dvh - 168px), 520px);
  max-width: 100%;
  max-height: min(100%, calc(100dvh - 168px));
  height: auto;
  align-self: center;
  margin: 0 auto;
}
#view-table-play.snakeladder-mode .sl-dock-live {
  order: 2;
  flex: 0 0 auto;
  width: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 2px 2px 4px;
  background: transparent;
  border: 0;
  z-index: 45;
  position: relative;
}
#view-table-play.snakeladder-mode .panel-dark {
  display: none !important;
}
@media (min-width: 900px) {
  #view-table-play.snakeladder-mode .layout {
    padding: 52px 24px 16px;
    max-width: 720px;
    margin: 0 auto;
  }
  #view-table-play.snakeladder-mode .board-wrap {
    max-width: 560px;
    gap: 12px;
  }
  #view-table-play.snakeladder-mode .table-board {
    width: min(100%, calc(100dvh - 190px), 500px);
  }
}
@media (max-width: 420px) {
  #view-table-play.snakeladder-mode .layout {
    padding: 44px 8px 8px;
  }
  #view-table-play.snakeladder-mode .board-wrap { gap: 8px; }
  #view-table-play.snakeladder-mode .table-board {
    width: min(100%, calc(100dvh - 156px));
  }
  .table-board.snakeladder .sl-num { font-size: .48rem; }
  .table-board.snakeladder .sl-badge { font-size: .28rem; }
  .sl-avatar { width: 42px; height: 42px; font-size: 14px; }
  .sl-seat-info b { font-size: .66rem; max-width: 96px; }
  .sl-ludo-dice.dice { width: 46px; height: 46px; }
}
@media (min-height: 900px) {
  #view-table-play.snakeladder-mode .table-board {
    width: min(100%, calc(100dvh - 200px), 520px);
  }
}

/* Physical knockout bracket plan + match history */
.tn-bracket-plan {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 6px;
  margin: 10px 0 12px;
}
.tn-bp {
  background: rgba(15,23,42,.55);
  border: 1px solid rgba(148,163,184,.22);
  border-radius: 10px;
  padding: 8px 8px 7px;
  display: grid;
  gap: 2px;
  font-size: .72rem;
  color: #cbd5e1;
}
.tn-bp b { color: #f8fafc; font-size: .82rem; }
.tn-bp.on { border-color: #22c55e; box-shadow: inset 0 0 0 1px #22c55e; }
.tn-bp.fin { border-color: #fbbf24; }
.tn-bp .bye { color: #fbbf24; font-weight: 700; }
.tn-money-flow {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 8px 0 10px;
}
.tn-money-flow span {
  background: rgba(15,23,42,.5);
  border-radius: 10px;
  padding: 8px;
  display: grid;
  gap: 2px;
}
.tn-money-flow small { color: #94a3b8; font-size: .65rem; font-weight: 700; }
.tn-money-flow b { color: #f8fafc; font-size: .9rem; }
.tn-hist-list .tn-w { color: #4ade80; font-weight: 700; }
.tn-hist-list .tn-l { color: #94a3b8; }

/* —— Battleship —— */
#view-table-play.battleship-mode {
  background:
    radial-gradient(90% 55% at 50% -5%, rgba(14,165,233,.22), transparent 50%),
    radial-gradient(60% 40% at 100% 80%, rgba(6,182,212,.1), transparent 45%),
    linear-gradient(180deg, #04101c 0%, #0a1f36 42%, #0b2a44 100%);
  min-height: 100dvh;
  height: 100dvh;
  overflow: hidden;
  padding: 0;
}
#view-table-play.battleship-mode .play-turn { display: none !important; }
#view-table-play.battleship-mode .topbar { display: none !important; }
#view-table-play.battleship-mode .play-exit {
  top: max(6px, env(safe-area-inset-top, 0px));
  left: 8px;
  background: rgba(8, 22, 40, .78);
  border: 1px solid rgba(148,163,184,.22);
}
#view-table-play.battleship-mode .layout {
  max-width: 1100px;
  margin: 0 auto;
  height: 100%;
  padding: 0;
  display: flex;
  flex-direction: column;
}
#view-table-play.battleship-mode .board-wrap {
  max-width: 980px;
  margin: 0 auto;
  background: transparent;
  border: 0;
  padding: max(6px, env(safe-area-inset-top, 0px)) 8px max(8px, env(safe-area-inset-bottom, 0px));
  width: 100%;
  box-sizing: border-box;
  flex: 1;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#view-table-play.battleship-mode .panel-dark { display: none !important; }
#view-table-play.battleship-mode .table-board {
  width: 100% !important;
  max-width: none !important;
  height: 100%;
}
.table-board.battleship {
  position: relative;
  background:
    linear-gradient(180deg, rgba(14,116,144,.14), transparent 38%),
    rgba(8, 20, 36, .88);
  border-radius: 18px;
  padding: 8px 10px 10px;
  min-height: 0;
  flex: 1;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow:
    0 0 0 1px rgba(148,163,184,.14),
    0 14px 32px rgba(0,0,0,.35),
    inset 0 1px 0 rgba(255,255,255,.06);
}
.table-board.battleship::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 8%, rgba(125,211,252,.1), transparent 38%),
    radial-gradient(circle at 85% 92%, rgba(14,165,233,.12), transparent 42%),
    repeating-linear-gradient(0deg, transparent, transparent 11px, rgba(56,189,248,.03) 12px);
  z-index: 0;
  opacity: .9;
}
.bs-root {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: #e2e8f0;
  font-family: Outfit, system-ui, sans-serif;
  min-height: 0;
  flex: 1;
  height: 100%;
}
.bs-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.bs-brand img {
  width: 36px;
  height: 24px;
  object-fit: cover;
  border-radius: 7px;
  box-shadow: 0 0 0 1px rgba(255,255,255,.14);
}
.bs-brand strong {
  font-size: .92rem;
  letter-spacing: .03em;
  color: #f8fafc;
}
.bs-head {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px 10px;
  align-items: center;
  padding-left: 40px; /* room for exit btn */
  min-height: 28px;
  flex-shrink: 0;
}
.bs-status {
  flex: 1;
  min-width: 0;
  opacity: .9;
  font-size: .74rem;
  font-weight: 650;
  color: #bae6fd;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bs-players {
  display: flex;
  align-items: stretch;
  gap: 6px;
  flex-shrink: 0;
}
.bs-p {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  min-width: 0;
  padding: 5px 8px;
  border-radius: 12px;
  background: rgba(15, 23, 42, .58);
  border: 1px solid rgba(148, 163, 184, .18);
  transition: border-color .25s, box-shadow .25s, background .25s;
}
.bs-p.active {
  border-color: rgba(56, 189, 248, .6);
  background: rgba(8, 47, 73, .62);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, .28), 0 0 16px rgba(56, 189, 248, .16);
}
.bs-p.active .bs-av {
  box-shadow: 0 0 0 2px rgba(56, 189, 248, .8);
}
.bs-av {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-weight: 800;
  font-size: .82rem;
  color: #e0f2fe;
  background: linear-gradient(145deg, #164e63, #0c4a6e);
  box-shadow: 0 0 0 1px rgba(148, 163, 184, .35);
}
.bs-p.opp .bs-av {
  background: linear-gradient(145deg, #7f1d1d, #450a0a);
  color: #fee2e2;
}
.bs-av img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.bs-p-txt {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.15;
}
.bs-p-txt b {
  font-size: .76rem;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 32vw;
}
.bs-p-txt small {
  font-size: .62rem;
  color: #7dd3fc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bs-p.opp .bs-p-txt small {
  color: #fca5a5;
}
.bs-vs {
  align-self: center;
  font-size: .58rem;
  font-weight: 800;
  letter-spacing: .12em;
  color: #94a3b8;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, .3);
  background: rgba(2, 6, 23, .6);
  flex-shrink: 0;
}
.bs-turn {
  position: absolute;
  top: 5px;
  right: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, .9);
  animation: bs-turn-pulse 1.6s ease-in-out infinite;
}
@keyframes bs-turn-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .55; transform: scale(.75); }
}
@media (max-width: 420px) {
  .bs-p { padding: 4px 6px; gap: 5px; }
  .bs-p-txt b { max-width: 26vw; }
}
.bs-tools {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}
.bs-tools .btn {
  min-height: 34px;
  padding: 6px 10px;
  font-size: .76rem;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 10px;
}
.bs-tools .bs-ff { margin-left: auto; }
.bs-ico {
  width: 15px;
  height: 15px;
  display: inline-block;
  flex-shrink: 0;
}
.bs-clock {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  background: rgba(15,23,42,.92);
  border: 1px solid rgba(148,163,184,.28);
  border-radius: 999px;
  padding: 6px 12px;
  min-width: 3rem;
  text-align: center;
  color: #f8fafc;
  font-size: .8rem;
}
.bs-clock.low {
  color: #fca5a5;
  border-color: rgba(248,113,113,.55);
  animation: bs-pulse 1s ease-in-out infinite;
}
@keyframes bs-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(248,113,113,.35); }
  50% { box-shadow: 0 0 0 6px rgba(248,113,113,0); }
}
.bs-cell.hunt {
  box-shadow: inset 0 0 0 2px rgba(250,204,21,.85);
  background: rgba(250,204,21,.14) !important;
  animation: bs-hunt 1.2s ease-in-out infinite;
}
@keyframes bs-hunt {
  0%, 100% { box-shadow: inset 0 0 0 2px rgba(250,204,21,.55); }
  50% { box-shadow: inset 0 0 0 2px rgba(250,204,21,1), 0 0 10px rgba(250,204,21,.25); }
}
.bs-cell.last-shot {
  outline: 2px solid #38bdf8;
  outline-offset: -2px;
  z-index: 2;
}
.bs-dual.battle .bs-grid-wrap.enemy {
  transform: scale(1.02);
  transform-origin: top center;
}
.bs-cell.ghost {
  background: rgba(56,189,248,.28) !important;
  box-shadow: inset 0 0 0 1px rgba(125,211,252,.8);
}
.bs-cell.ghost-bad {
  background: rgba(248,113,113,.28) !important;
}
.bs-fleet {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  flex-shrink: 0;
}
.bs-ship-btn {
  border: 1px solid rgba(148,163,184,.28);
  background: rgba(15,23,42,.78);
  color: #e2e8f0;
  border-radius: 11px;
  padding: 6px 4px 5px;
  display: grid;
  gap: 3px;
  justify-items: center;
  cursor: pointer;
  font: inherit;
  min-height: 52px;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .15s, background .15s, transform .1s;
}
.bs-ship-btn:active { transform: scale(.96); }
.bs-ship-btn .bs-ship-ico {
  position: relative;
  height: 12px;
  width: 28px;
  display: block;
}
.bs-ship-ico .bs-skin-bow,
.bs-ship-ico .bs-skin-deck,
.bs-ship-ico .bs-skin-stern {
  position: absolute;
  top: 0;
  height: 100%;
  background: linear-gradient(180deg, #e2e8f0, #64748b);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4);
}
.bs-ship-ico .bs-skin-bow {
  left: 0;
  width: 28%;
  border-radius: 8px 2px 2px 8px;
  clip-path: polygon(0 50%, 100% 0, 100% 100%);
}
.bs-ship-ico .bs-skin-deck {
  left: 24%;
  width: 48%;
  border-radius: 2px;
}
.bs-ship-ico .bs-skin-stern {
  right: 0;
  width: 30%;
  border-radius: 2px 4px 4px 2px;
}
.bs-ship-ico.skin-carrier { width: 34px; }
.bs-ship-ico.skin-carrier .bs-skin-bow,
.bs-ship-ico.skin-carrier .bs-skin-deck,
.bs-ship-ico.skin-carrier .bs-skin-stern { background: linear-gradient(180deg, #cbd5e1, #64748b); }
.bs-ship-ico.skin-battleship .bs-skin-bow,
.bs-ship-ico.skin-battleship .bs-skin-deck,
.bs-ship-ico.skin-battleship .bs-skin-stern { background: linear-gradient(180deg, #bae6fd, #0284c7); }
.bs-ship-ico.skin-cruiser .bs-skin-bow,
.bs-ship-ico.skin-cruiser .bs-skin-deck,
.bs-ship-ico.skin-cruiser .bs-skin-stern { background: linear-gradient(180deg, #a5f3fc, #0891b2); }
.bs-ship-ico.skin-submarine .bs-skin-bow,
.bs-ship-ico.skin-submarine .bs-skin-deck,
.bs-ship-ico.skin-submarine .bs-skin-stern { background: linear-gradient(180deg, #99f6e4, #0d9488); }
.bs-ship-ico.skin-destroyer { width: 20px; }
.bs-ship-ico.skin-destroyer .bs-skin-bow,
.bs-ship-ico.skin-destroyer .bs-skin-deck,
.bs-ship-ico.skin-destroyer .bs-skin-stern { background: linear-gradient(180deg, #fde68a, #d97706); }
.bs-ship-btn[data-ship="carrier"] .bs-ship-ico { width: 34px; }
.bs-ship-btn[data-ship="destroyer"] .bs-ship-ico { width: 20px; }
.bs-ship-btn b { font-size: .62rem; line-height: 1.1; text-align: center; font-weight: 700; }
.bs-ship-btn .bs-pips {
  display: flex;
  gap: 2px;
}
.bs-ship-btn .bs-pips i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(148,163,184,.55);
}
.bs-ship-btn.on {
  border-color: #38bdf8;
  background: rgba(14,165,233,.22);
  box-shadow: 0 0 0 1px rgba(56,189,248,.3), 0 0 14px rgba(56,189,248,.15);
}
.bs-ship-btn.placed {
  opacity: .42;
  filter: grayscale(.35);
}
.bs-ship-btn:disabled { cursor: default; }
.bs-dual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: stretch;
  flex: 1;
  min-height: 0;
}
.bs-grid-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  padding: 8px;
  border-radius: 14px;
  background: rgba(7, 17, 31, .5);
  box-shadow: inset 0 0 0 1px rgba(148,163,184,.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  container-type: size;
  container-name: bsboard;
  flex: 1;
}
.bs-grid-wrap.enemy {
  background:
    linear-gradient(180deg, rgba(14,116,144,.22), rgba(7,17,31,.55));
}
.bs-grid-wrap.mine {
  background:
    linear-gradient(180deg, rgba(51,65,85,.22), rgba(7,17,31,.55));
}
.bs-grid-title {
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  height: 1.1rem;
}
.bs-grid-title small {
  margin-left: auto;
  font-size: .62rem;
  letter-spacing: .02em;
  text-transform: none;
  font-weight: 650;
  color: #7dd3fc;
  opacity: .9;
}
.bs-grid-title::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 8px #38bdf8;
}
.bs-grid-wrap.enemy .bs-grid-title::before { background: #f97316; box-shadow: 0 0 8px #f97316; }
.bs-grid {
  /* Square board that always fits inside wrap (no bottom clip) */
  --bs-side: min(100cqw, calc(100cqh - 1.4rem));
  display: grid;
  grid-template-columns: minmax(10px, 1.05fr) repeat(10, minmax(0, 1fr));
  grid-template-rows: minmax(10px, 1.05fr) repeat(10, minmax(0, 1fr));
  gap: 2px;
  width: var(--bs-side);
  height: var(--bs-side);
  max-width: 100%;
  max-height: 100%;
  margin: 0 auto;
  flex: 0 0 auto;
  align-self: center;
}
@supports not (width: 1cqw) {
  .bs-grid {
    width: min(100%, 460px);
    aspect-ratio: 1;
    height: auto;
    max-height: 100%;
  }
}
.bs-h {
  font-size: .52rem;
  font-weight: 700;
  color: #64748b;
  display: grid;
  place-items: center;
  min-height: 0;
  min-width: 0;
}
.bs-cell {
  border: 0;
  border-radius: 4px;
  background:
    linear-gradient(160deg, rgba(56,189,248,.2), rgba(15,40,70,.72));
  cursor: pointer;
  padding: 0;
  min-height: 0;
  min-width: 0;
  width: 100%;
  height: 100%;
  touch-action: manipulation;
  transition: background .12s ease, transform .08s ease, box-shadow .12s ease;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(14,165,233,.14);
  overflow: hidden;
}
.bs-cell:hover { background: rgba(56, 189, 248, .38); }
.bs-cell:active { transform: scale(.92); }
.bs-cell:focus-visible {
  outline: 2px solid #facc15;
  outline-offset: -2px;
  z-index: 3;
}
.bs-cell[aria-disabled="true"] { cursor: default; }
.bs-cell[aria-disabled="true"]:hover { background: linear-gradient(160deg, rgba(56,189,248,.2), rgba(15,40,70,.72)); }
.bs-cell.bs-firing {
  animation: bs-fire-pulse .32s ease-out;
}
@keyframes bs-fire-pulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(251,146,60,.6); }
  40% { transform: scale(1.12); box-shadow: 0 0 0 8px rgba(251,146,60,0); }
  100% { transform: scale(1); }
}
.bs-cell.bs-pop { animation: bs-cell-pop .45s cubic-bezier(.22,1,.36,1); }
@keyframes bs-cell-pop {
  0% { transform: scale(.7); }
  55% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* Hull skins on board — continuous bow/deck/stern + per-ship colors */
.bs-cell.ship {
  background: transparent;
  box-shadow: none;
}
.bs-cell.ship .bs-hull {
  position: absolute;
  inset: 10%;
  display: block;
  background: linear-gradient(180deg, #cbd5e1 0%, #64748b 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.45),
    0 1px 2px rgba(0,0,0,.35);
  overflow: hidden;
}
.bs-cell.ship .bs-hull .bs-skin-plate,
.bs-cell.ship .bs-hull .bs-skin-edge,
.bs-cell.ship .bs-hull .bs-skin-turret,
.bs-cell.ship .bs-hull .bs-skin-nose,
.bs-cell.ship .bs-hull .bs-skin-stack {
  position: absolute;
  pointer-events: none;
}
.bs-cell.ship .bs-hull .bs-skin-plate {
  inset: 18% 8%;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.28), transparent);
  opacity: .85;
}
.bs-cell.ship .bs-hull .bs-skin-edge {
  inset: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.22);
  border-radius: inherit;
}
.bs-cell.ship-dir-h.ship-bow .bs-hull {
  border-radius: 40% 4px 4px 40%;
  clip-path: polygon(0 50%, 28% 8%, 100% 8%, 100% 92%, 28% 92%);
  inset: 10% 2% 10% 6%;
}
.bs-cell.ship-dir-h.ship-mid .bs-hull { border-radius: 3px; inset: 14% 1%; }
.bs-cell.ship-dir-h.ship-stern .bs-hull { border-radius: 3px 7px 7px 3px; inset: 10% 6% 10% 2%; }
.bs-cell.ship-dir-v.ship-bow .bs-hull {
  border-radius: 40% 40% 4px 4px;
  clip-path: polygon(50% 0, 92% 28%, 92% 100%, 8% 100%, 8% 28%);
  inset: 6% 10% 2% 10%;
}
.bs-cell.ship-dir-v.ship-mid .bs-hull { border-radius: 3px; inset: 1% 14%; }
.bs-cell.ship-dir-v.ship-stern .bs-hull { border-radius: 3px 3px 7px 7px; inset: 2% 10% 6% 10%; }

.bs-cell.ship-dir-h .bs-skin-turret {
  width: 34%;
  height: 34%;
  left: 33%;
  top: 18%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #f8fafc, #475569 70%);
  box-shadow: 0 0 0 1px rgba(15,23,42,.35);
}
.bs-cell.ship-dir-v .bs-skin-turret {
  width: 34%;
  height: 34%;
  left: 18%;
  top: 33%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #f8fafc, #475569 70%);
}
.bs-cell.ship-dir-h .bs-skin-nose {
  right: 8%;
  top: 28%;
  width: 18%;
  height: 44%;
  border-radius: 2px;
  background: rgba(15,23,42,.35);
}
.bs-cell.ship-dir-v .bs-skin-nose {
  left: 28%;
  bottom: 8%;
  width: 44%;
  height: 18%;
  border-radius: 2px;
  background: rgba(15,23,42,.35);
}
.bs-cell.ship-dir-h .bs-skin-stack {
  left: 22%;
  top: 12%;
  width: 22%;
  height: 38%;
  border-radius: 2px 2px 1px 1px;
  background: linear-gradient(180deg, #94a3b8, #334155);
}
.bs-cell.ship-dir-v .bs-skin-stack {
  left: 12%;
  top: 22%;
  width: 38%;
  height: 22%;
  border-radius: 2px;
  background: linear-gradient(90deg, #94a3b8, #334155);
}

.bs-cell.ship-carrier .bs-hull,
.bs-cell.ship .bs-hull.skin-carrier { background: linear-gradient(180deg, #e2e8f0, #64748b); }
.bs-cell.ship-battleship .bs-hull,
.bs-cell.ship .bs-hull.skin-battleship { background: linear-gradient(180deg, #bae6fd, #0369a1); }
.bs-cell.ship-cruiser .bs-hull,
.bs-cell.ship .bs-hull.skin-cruiser { background: linear-gradient(180deg, #a5f3fc, #0e7490); }
.bs-cell.ship-submarine .bs-hull,
.bs-cell.ship .bs-hull.skin-submarine { background: linear-gradient(180deg, #99f6e4, #0f766e); }
.bs-cell.ship-destroyer .bs-hull,
.bs-cell.ship .bs-hull.skin-destroyer { background: linear-gradient(180deg, #fde68a, #b45309); }

.bs-cell.hit .bs-hull { filter: brightness(.85) saturate(1.1); }
.bs-cell.sunk .bs-hull { filter: grayscale(.55) brightness(.55); opacity: .85; }

.bs-cell.ghost {
  background: rgba(74, 222, 128, .5);
  box-shadow: inset 0 0 0 1px #4ade80, 0 0 10px rgba(74,222,128,.25);
}
.bs-cell.ghost-bad {
  background: rgba(248, 113, 113, .48);
  box-shadow: inset 0 0 0 1px #f87171;
}
.bs-cell.miss {
  background: rgba(15,23,42,.72);
  pointer-events: none;
}
.bs-cell.hit {
  background: radial-gradient(circle at 40% 30%, #fdba74, #ea580c 55%, #9a3412);
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.2), 0 0 12px rgba(249,115,22,.45);
}
.bs-cell.sunk {
  background: radial-gradient(circle at 40% 35%, #f87171, #b91c1c 60%, #7f1d1d);
  pointer-events: none;
  box-shadow: 0 0 14px rgba(220,38,38,.45);
}
.bs-mark {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.bs-mark.miss-dot {
  inset: 30%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #f1f5f9, #64748b);
  box-shadow: 0 0 0 1px rgba(255,255,255,.18), 0 0 8px rgba(148,163,184,.25);
}
.bs-mark.flame {
  width: 42%;
  height: 58%;
  left: 50%;
  top: 16%;
  transform: translateX(-50%);
  inset: auto;
  position: absolute;
  background: linear-gradient(180deg, #fff7ed, #f97316 42%, transparent);
  border-radius: 40% 40% 20% 20%;
  animation: bs-flicker .55s ease-in-out infinite alternate;
}
@keyframes bs-flicker {
  from { opacity: .85; transform: translateX(-50%) scaleY(.92); }
  to { opacity: 1; transform: translateX(-50%) scaleY(1.06); }
}
.bs-mark.wreck {
  font-size: clamp(9px, 2.8vw, 14px);
  font-weight: 900;
  color: #fee2e2;
  text-shadow: 0 1px 2px #000;
  font-style: normal;
}
.bs-grid.enemy .bs-cell:not(.miss):not(.hit):not(.sunk) {
  background:
    linear-gradient(160deg, rgba(14,165,233,.26), rgba(12,74,110,.58));
}

/* FX bursts */
.bs-burst {
  position: absolute;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 5;
  animation: bs-burst-out .65s ease-out forwards;
}
.bs-burst-fire {
  background: #fdba74;
  box-shadow: 0 0 16px 6px rgba(251,146,60,.65);
}
.bs-burst-hit {
  background: #fb923c;
  box-shadow: 0 0 22px 10px rgba(234,88,12,.55);
}
.bs-burst-sunk {
  background: #f87171;
  box-shadow: 0 0 28px 12px rgba(220,38,38,.5);
}
.bs-burst-splash {
  background: #7dd3fc;
  box-shadow: 0 0 18px 8px rgba(56,189,248,.45);
}
@keyframes bs-burst-out {
  0% { transform: scale(.4); opacity: 1; }
  100% { transform: scale(4.2); opacity: 0; }
}

.bs-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: .68rem;
  color: #94a3b8;
  padding: 2px 2px 0;
  flex-shrink: 0;
}
.bs-legend b { color: #f8fafc; font-weight: 700; }
.bs-legend .bs-key {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.bs-legend .swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}
.bs-legend .swatch.hit { background: #f97316; }
.bs-legend .swatch.miss { background: #64748b; border-radius: 50%; }
.bs-legend .swatch.sunk { background: #dc2626; }

@media (max-width: 720px) {
  #view-table-play.battleship-mode {
    height: 100dvh;
    max-height: 100dvh;
  }
  #view-table-play.battleship-mode .board-wrap {
    padding: max(4px, env(safe-area-inset-top, 0px)) 4px max(6px, env(safe-area-inset-bottom, 0px));
  }
  .table-board.battleship {
    padding: 5px 5px 6px;
    border-radius: 14px;
  }
  .bs-root { gap: 5px; }
  .bs-root.phase-place .bs-dual {
    flex: 1;
    min-height: 0;
  }
  .bs-head {
    padding-left: 42px;
    gap: 6px;
    min-height: 26px;
  }
  .bs-brand strong { font-size: .82rem; }
  .bs-brand img { width: 30px; height: 20px; }
  .bs-status { font-size: .68rem; }
  .bs-tools .btn { min-height: 32px; padding: 5px 8px; font-size: .72rem; }
  .bs-dual {
    grid-template-columns: 1fr;
    gap: 6px;
    min-height: 0;
  }
  /* Place: only your fleet — full remaining height, no bottom clip */
  .bs-dual.placing {
    grid-template-rows: minmax(0, 1fr);
  }
  .bs-dual.placing .bs-grid-wrap.enemy { display: none; }
  .bs-dual.placing .bs-grid-wrap.mine {
    flex: 1;
    min-height: 0;
    height: 100%;
    padding: 6px;
  }
  /* Battle: enemy large on top, own fleet fits fully below */
  .bs-dual.battle {
    grid-template-rows: minmax(0, 1.15fr) minmax(0, 1fr);
  }
  .bs-dual.battle .bs-grid-wrap.enemy { order: -1; }
  .bs-dual.battle .bs-grid-wrap.mine {
    padding: 5px;
    opacity: .98;
  }
  .bs-dual.battle .bs-grid-wrap.mine .bs-grid-title {
    margin-bottom: 3px;
    height: 1rem;
    font-size: .58rem;
  }
  .bs-clock { font-size: .74rem; padding: 5px 10px; }
  .bs-fleet { gap: 4px; }
  .bs-ship-btn {
    padding: 4px 2px 3px;
    min-height: 44px;
    border-radius: 9px;
  }
  .bs-ship-btn b { font-size: .55rem; }
  .bs-grid { gap: 1.5px; }
  .bs-h { font-size: .48rem; }
  .bs-cell { border-radius: 3px; }
  .bs-legend { font-size: .62rem; gap: 4px 8px; }
  .bs-claim { display: none; }
}
@media (max-width: 380px) {
  .bs-ship-btn b { font-size: .5rem; }
  .bs-head { padding-left: 38px; }
  .bs-ship-btn { min-height: 40px; }
}
@media (max-height: 700px) and (max-width: 720px) {
  .bs-fleet { gap: 3px; }
  .bs-ship-btn { min-height: 38px; padding: 3px 2px; }
  .bs-ship-btn .bs-ship-ico { height: 9px; }
  .bs-tools .btn { min-height: 30px; }
  .bs-dual.battle {
    grid-template-rows: minmax(0, 1.05fr) minmax(0, 1fr);
  }
}

@media (min-width: 721px) and (max-height: 820px) {
  .bs-brand img { width: 32px; height: 21px; }
  .bs-ship-btn { min-height: 46px; }
}

/* —— Jet Clash (militia) —— */
#view-table-play.militia-mode {
  overflow: hidden;
  height: 100dvh;
  max-height: 100dvh;
  padding: 0;
  background: #070d16;
}
#view-table-play.militia-mode .layout {
  height: 100%;
  padding: 0;
  margin: 0;
  max-width: none;
}
#view-table-play.militia-mode .panel-dark { display: none; }
#view-table-play.militia-mode .topbar { display: none; }
#view-table-play.militia-mode .play-turn { display: none; }
#view-table-play.militia-mode .board-wrap {
  max-width: none;
  width: 100%;
  height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 0;
}
.table-board.militia {
  position: relative;
  width: 100%;
  height: 100%;
  background: #0d1b2a;
  border-radius: 0;
  overflow: hidden;
  padding: 0;
}
.jc-cv {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}
.jc-hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-family: Outfit, system-ui, sans-serif;
  color: #e8f4ff;
  z-index: 3;
  padding-top: env(safe-area-inset-top, 0px);
}
.jc-top {
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  font-weight: 800;
  text-shadow: 0 1px 4px #000;
}
.jc-timer { font-variant-numeric: tabular-nums; font-size: 1.15rem; }
.jc-bars { padding: 0 12px; display: grid; gap: 4px; max-width: 220px; }
.jc-bar {
  height: 10px;
  background: rgba(0,0,0,.35);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.15);
}
.jc-bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg,#66bb6a,#43a047); }
.jc-bar.fuel i { background: linear-gradient(90deg,#4fc3f7,#0288d1); }
.jc-meta {
  padding: 6px 12px;
  display: flex;
  gap: 12px;
  font-size: .82rem;
  font-weight: 700;
}
.jc-guns {
  padding: 4px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 280px;
  pointer-events: auto;
}
.jc-guns button {
  border: 0;
  border-radius: 10px;
  padding: 6px 9px;
  font: 800 .68rem Outfit, system-ui, sans-serif;
  letter-spacing: .04em;
  background: rgba(15,23,42,.7);
  color: #cfd8dc;
  box-shadow: 0 0 0 1px rgba(255,255,255,.14);
}
.jc-guns button.on {
  background: #ff8f00;
  color: #1a1200;
  box-shadow: none;
}
.jc-dev { display: none !important; }
.jc-hint {
  padding: 2px 12px 6px;
  font-size: .68rem;
  font-weight: 700;
  color: rgba(227,242,253,.72);
  text-shadow: 0 1px 3px #000;
  max-width: 300px;
  pointer-events: none;
}
.jc-scores {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top, 0px));
  right: 10px;
  background: rgba(7,17,31,.62);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  padding: 8px 10px;
  min-width: 132px;
  font-size: .74rem;
}
.jc-scores div { display: flex; gap: 6px; padding: 2px 0; }
.jc-scores .you { color: #ffd54f; }
.jc-scores em { margin-left: auto; opacity: .85; font-style: normal; }
.jc-actions {
  position: absolute;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  pointer-events: auto;
}
.jc-actions button {
  border: 0;
  border-radius: 14px;
  padding: 11px 14px;
  font: 700 .8rem Outfit, system-ui, sans-serif;
  background: rgba(15,23,42,.72);
  color: #e8f4ff;
  box-shadow: 0 0 0 1px rgba(255,255,255,.12);
  -webkit-tap-highlight-color: transparent;
}
.jc-actions button.fire { display: none !important; }
.jc-rotate {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: none;
  place-items: center;
  background: rgba(5,10,18,.92);
  padding: 20px;
  pointer-events: auto;
}
.jc-rotate.show { display: grid; }
.jc-rotate-card {
  text-align: center;
  color: #e8f4ff;
  font-family: Outfit, system-ui, sans-serif;
  max-width: 280px;
  display: grid;
  gap: 10px;
  justify-items: center;
}
.jc-rotate-card b { font-size: 1.15rem; }
.jc-rotate-card span { font-size: .82rem; opacity: .8; line-height: 1.35; }
.jc-rotate-phone {
  width: 46px;
  height: 72px;
  border: 3px solid #90caf9;
  border-radius: 10px;
  animation: jc-tilt 1.2s ease-in-out infinite;
  box-shadow: inset 0 -8px 0 rgba(144,202,249,.25);
}
@keyframes jc-tilt {
  0%, 100% { transform: rotate(0deg); }
  40% { transform: rotate(90deg); }
  60% { transform: rotate(90deg); }
}
.jc-rotate-go {
  margin-top: 6px;
  border: 0;
  border-radius: 14px;
  padding: 12px 18px;
  font: 800 .9rem Outfit, system-ui, sans-serif;
  background: #ffb300;
  color: #1a1200;
}
.jc-finish {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 12px;
  background: rgba(7,17,31,.68);
  text-align: center;
  pointer-events: auto;
}
.jc-finish.hidden { display: none; }
.jc-finish b { font-size: 1.4rem; }
.jc-finish button {
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  font: 800 .95rem Outfit, system-ui, sans-serif;
  background: #ffb300;
  color: #1a1200;
}
@media (max-width: 720px) {
  .jc-scores { font-size: .68rem; min-width: 110px; }
  .jc-actions button { padding: 12px 12px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .jc-scores { top: 6px; right: 6px; padding: 6px; font-size: .64rem; }
  .jc-bars { max-width: 160px; }
  .jc-actions { bottom: 6px; }
  .jc-actions button { padding: 8px 10px; font-size: .72rem; }
  .jc-hint { font-size: .6rem; }
}

/* Exit / forfeit confirm */
.exit-confirm-overlay {
  position: fixed; inset: 0; z-index: 140;
  background: rgba(7, 17, 31, .72);
  backdrop-filter: blur(6px);
  display: grid; place-items: center; align-content: safe center;
  padding: max(14px, env(safe-area-inset-top, 0px)) 14px calc(14px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
}
.exit-confirm-overlay.hidden { display: none; }
.exit-confirm-card {
  width: min(380px, calc(100vw - 28px));
  max-height: min(88dvh, 100%);
  overflow-y: auto;
  background: linear-gradient(165deg, #1a2740 0%, #0b1220 70%);
  color: #f1f5f9;
  border-radius: 22px;
  padding: 22px 18px 16px;
  text-align: center;
  box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 24px 60px rgba(0,0,0,.5);
  box-sizing: border-box;
  margin: auto;
}
.exit-confirm-ico {
  font-size: 1.8rem;
  line-height: 1;
  margin-bottom: 8px;
}
.exit-confirm-card h2 {
  margin: 0 0 8px;
  font: 800 1.25rem Outfit, system-ui, sans-serif;
}
.exit-confirm-card .lead {
  margin: 0 0 16px;
  color: #94a3b8;
  font-size: .92rem;
  line-height: 1.45;
}
.exit-confirm-actions {
  display: flex; gap: 10px; justify-content: stretch;
}
.exit-confirm-actions .btn { flex: 1; }

/* Mid-match disconnect → rejoin / leave-lose */
.kb-rejoin-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + var(--kb-nav-h));
  z-index: 8500;
  pointer-events: none;
}
.kb-rejoin-banner.hidden { display: none; }
.kb-rejoin-card {
  pointer-events: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, #0f2744 0%, #163a2f 100%);
  border: 1px solid rgba(255,255,255,.16);
  box-shadow: 0 12px 32px rgba(0,0,0,.35);
  color: #fff;
  font-family: Outfit, system-ui, sans-serif;
}
.kb-rejoin-txt { flex: 1 1 140px; min-width: 0; }
.kb-rejoin-txt b { display: block; font-size: .95rem; font-weight: 700; }
.kb-rejoin-txt small { display: block; margin-top: 2px; opacity: .82; font-size: .78rem; line-height: 1.35; }
.kb-rejoin-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.kb-rejoin-actions .btn {
  padding: 8px 12px;
  font-size: .82rem;
  border-radius: 10px;
  border: 0;
  font-weight: 700;
  cursor: pointer;
  background: #22c55e;
  color: #052e16;
}
.kb-rejoin-actions .btn.ghost {
  background: transparent;
  color: #fecaca;
  border: 1px solid rgba(254,202,202,.35);
}
.kb-rejoin-actions .btn.danger:active { opacity: .85; }
.btn.danger {
  background: #dc2626;
  color: #fff;
  border: 0;
}
.btn.danger:active { filter: brightness(.92); }

/* —— Account blocked / banned full-screen —— */
.kb-ban-lock {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 50% 20%, rgba(220,38,38,.28), transparent 55%),
    linear-gradient(180deg, #1a0505 0%, #0b1220 55%, #070d16 100%);
  color: #f8fafc;
  font-family: Outfit, system-ui, sans-serif;
}
.kb-ban-lock.hidden { display: none !important; }
.kb-ban-card {
  width: min(420px, 100%);
  text-align: center;
  background: rgba(15, 23, 42, .88);
  border: 1px solid rgba(248, 113, 113, .35);
  border-radius: 22px;
  padding: 28px 22px 22px;
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
}
.kb-ban-ico {
  font-size: 2.4rem;
  line-height: 1;
  margin-bottom: 10px;
}
.kb-ban-card h2 {
  margin: 0 0 12px;
  font-size: 1.45rem;
  font-weight: 800;
  color: #fecaca;
}
.kb-ban-msg {
  margin: 0 0 10px;
  font-size: 1.02rem;
  font-weight: 650;
  line-height: 1.45;
  color: #f8fafc;
  white-space: pre-wrap;
  word-break: break-word;
}
.kb-ban-sub {
  margin: 0 0 18px;
  font-size: .82rem;
  color: #94a3b8;
  line-height: 1.4;
}
.kb-ban-card .btn {
  width: 100%;
  min-height: 44px;
}
html.kb-ban-locked,
html.kb-ban-locked body {
  overflow: hidden !important;
}
html.kb-ban-locked #app-nav,
html.kb-ban-locked .shell,
html.kb-ban-locked .screen,
html.kb-ban-locked .play-wrap {
  visibility: hidden !important;
  pointer-events: none !important;
}

.tn-howto-strip {
  list-style: none; margin: 12px 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.tn-howto-strip li {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(15,23,42,.35); border: 1px solid rgba(253,230,138,.25);
  border-radius: 999px; padding: 4px 9px; font-size: .72rem; font-weight: 700;
}
.tn-howto-strip b {
  width: 16px; height: 16px; border-radius: 50%;
  display: grid; place-items: center; background: #f59e0b; color: #111; font-size: .65rem;
}
.tn-pill.tourney { background: #b45309; left: 8px; right: auto; }
.tn-event-art .tn-pill:not(.tourney) { right: 8px; left: auto; }
.tn-card-actions { display: grid; grid-template-columns: 1fr 1.2fr; gap: 8px; margin-top: 4px; }
.tn-card-actions .tn-join-btn { margin-top: 0; width: 100%; }
.tn-details-btn { width: 100%; }
.tn-rules-box {
  margin-top: 14px; padding: 12px 14px; border-radius: 12px;
  background: rgba(15,118,110,.08); border: 1px solid rgba(15,118,110,.22);
}
.tn-rules-box > b { display: block; margin-bottom: 6px; color: #0f766e; }
.tn-rules-box .tn-how { margin: 0; }

/* —— Fit: mini phone → large TV —— */
html, body {
  overflow-x: clip;
  overflow-y: visible;
  height: auto;
}
img, video, canvas, svg { max-width: 100%; }
.shell, .screen, .panel, .match-panel, .wide-match { min-width: 0; }

@media (max-width: 360px) {
  .shell { width: calc(100% - 12px); }
  .screen { padding: 10px; }
  .panel { padding: 14px 12px; border-radius: 16px; }
  .brand-head h1 { font-size: 1.25rem; }
  .nav { padding-left: 2px; padding-right: 2px; gap: 0; }
  .nav button { font-size: 9px; letter-spacing: 0; padding-left: 0; padding-right: 0; min-height: 52px; }
  .nav-ico { width: 40px; height: 28px; }
  .qa-row { gap: 4px; }
  .qa-ico { width: 38px; height: 38px; }
  .qa-row button { font-size: .62rem; }
  .atm-amt-row strong { font-size: 1.25rem; }
  .atm-add { padding: 8px 10px; }
  #view-home .home-sec-head { flex-wrap: wrap; }
  #view-home .home-sec-head small { white-space: normal; }
  .home-link-row { gap: 8px; }
  .join-row { flex-wrap: wrap; }
  .join-row input { min-width: 0; flex: 1 1 120px; }
  .pl-tabs { gap: 4px; }
  .pl-tabs button { font-size: .78rem; padding: 8px 6px; }
  .tn-filters { gap: 6px; }
  .tn-filters button { font-size: .72rem; }
  .wal-cta, .cash-presets, .chip-row { gap: 6px; }
}

@media (max-width: 320px) {
  .home-greet { gap: 6px; }
  .home-greet-cash { padding: 8px 8px; font-size: .72rem; }
  .atm-foot { gap: 6px; }
  .atm-foot b { font-size: .82rem; }
}

@media (min-width: 1200px) {
  .shell { width: min(1120px, calc(100% - 56px)); max-width: none; }
  #view-home .home-games-grid { max-width: none; }
  .center-col.wide-match { max-width: 640px; }
  .table-board { width: min(100%, 76vh, 760px); }
  #view-ludo-play .ludo-stage { max-width: 1040px; }
  #view-ludo-play #ludo-board-wrap .ludo-board-frame {
    --ludo-side: min(72vw, 100%, calc(100dvh - 200px), 720px);
  }
}

@media (min-width: 1600px) {
  .shell { width: min(1120px, calc(100% - 96px)); max-width: none; }
  #view-home .home-games-grid { max-width: none; gap: 20px; }
  .center-col { max-width: 480px; }
  .center-col.wide-match { max-width: 720px; }
  .table-board { width: min(100%, 78vh, 860px); }
  #view-ludo-play .ludo-stage { max-width: 1180px; }
  #view-ludo-play #ludo-board-wrap .ludo-board-frame {
    --ludo-side: min(64vw, 100%, calc(100dvh - 180px), 820px);
  }
  .nav { width: min(1120px, calc(100% - 96px)); padding-left: 12px; padding-right: 12px; }
}

@media (min-width: 2200px) {
  .shell { width: min(1120px, calc(100% - 140px)); max-width: none; }
  #view-home .home-games-grid { max-width: none; }
  .table-board { width: min(100%, 80vh, 980px); }
  #view-ludo-play #ludo-board-wrap .ludo-board-frame {
    --ludo-side: min(52vw, 100%, calc(100dvh - 180px), 960px);
  }
}

/* Fluid chrome: iPhone size at ~390px, grows through large laptop (~1440). */
.home-greet { gap: clamp(8px, 2vw, 18px); margin-bottom: clamp(10px, 1.6vw, 18px); }
.home-greet-brand { gap: clamp(8px, 1.4vw, 14px); }
.home-greet-brand img {
  width: clamp(36px, 10px + 8vw, 56px);
  height: clamp(36px, 10px + 8vw, 56px);
  border-radius: 0;
}
.home-greet-brand b { font-size: clamp(1.05rem, .7rem + 1.5vw, 1.55rem); }
.home-greet-brand small { font-size: clamp(.66rem, .5rem + .55vw, .84rem); }
.home-greet-cash {
  font-size: clamp(.72rem, .55rem + .55vw, .95rem);
  padding: clamp(8px, 1vw, 13px) clamp(12px, 1.6vw, 20px);
  border-radius: clamp(10px, 1.4vw, 14px);
}
.atm-card {
  padding: clamp(12px, 8px + 1.6vw, 24px);
  border-radius: clamp(16px, 12px + 1.2vw, 26px);
}
.atm-av {
  width: clamp(26px, 16px + 3vw, 40px);
  height: clamp(26px, 16px + 3vw, 40px);
}
.atm-who b { font-size: clamp(.74rem, .6rem + .45vw, .95rem); }
.atm-amt-row strong { font-size: clamp(1.35rem, .85rem + 2.6vw, 2.45rem); }
.atm-add {
  font-size: clamp(.72rem, .58rem + .5vw, .95rem);
  padding: clamp(8px, 1vw, 12px) clamp(12px, 1.6vw, 20px);
  border-radius: clamp(10px, 1.2vw, 14px);
}
.atm-foot { margin-top: clamp(12px, 1.6vw, 20px); gap: clamp(8px, 1.4vw, 16px); }
.atm-foot b { font-size: clamp(.88rem, .7rem + .6vw, 1.2rem); }
.qa-row { gap: clamp(4px, 1.4vw, 20px); margin: clamp(10px, 1.6vw, 20px) 0 clamp(4px, 1vw, 10px); }
.qa-row button { font-size: clamp(.62rem, .48rem + .55vw, .9rem); gap: clamp(4px, .6vw, 8px); }
.qa-ico {
  width: clamp(36px, 28px + 4vw, 62px);
  height: clamp(36px, 28px + 4vw, 62px);
  border-radius: clamp(11px, 1.4vw, 18px);
  font-size: clamp(.95rem, .7rem + .8vw, 1.35rem);
}
#view-home .hello.home-games-title { font-size: clamp(1.05rem, .75rem + 1.2vw, 1.55rem); }
#view-home .home-sec-head { margin-bottom: clamp(8px, 1.2vw, 16px); }
#view-home .home-sec-head small { font-size: clamp(.7rem, .58rem + .4vw, .88rem); }
#view-home .home-games-grid .game { border-radius: clamp(12px, 1.4vw, 20px); }
#view-home .home-games-grid .game span {
  font-size: clamp(.66rem, .52rem + .5vw, .95rem);
  min-height: clamp(28px, 6vw, 42px);
  padding: clamp(5px, .8vw, 10px) clamp(6px, 1vw, 12px);
}
.friends-banner, .refer-banner {
  gap: clamp(10px, 1.6vw, 16px);
  padding: clamp(12px, 1.2vw, 20px);
  border-radius: clamp(14px, 1.4vw, 22px);
}
.friends-banner b, .refer-banner b { font-size: clamp(.9rem, .7rem + .7vw, 1.2rem); }
.friends-banner small, .refer-banner small { font-size: clamp(.75rem, .65rem + .35vw, .95rem); }
.ico {
  width: clamp(40px, 28px + 3.2vw, 56px);
  height: clamp(40px, 28px + 3.2vw, 56px);
  border-radius: clamp(10px, 1.2vw, 16px);
}
.feat-banner {
  grid-template-columns: clamp(72px, 14vw, 108px) minmax(0, 1fr) auto;
  border-radius: clamp(16px, 1.6vw, 22px);
  margin-top: clamp(12px, 1.4vw, 18px);
}
.feat-art {
  width: clamp(72px, 14vw, 108px);
  height: clamp(72px, 14vw, 108px);
}
.feat-banner b { font-size: clamp(.92rem, .72rem + .55vw, 1.2rem); }
@media (max-width: 420px) {
  .feat-banner { grid-template-columns: 72px minmax(0, 1fr); }
  .feat-side { grid-column: 1 / -1; grid-auto-flow: column; justify-items: start; align-items: center; }
}
.nav button { font-size: clamp(9px, 7px + .8vw, 13px); min-height: clamp(52px, 10vw, 64px); }
.nav-ico { width: clamp(40px, 36px + 2vw, 56px); height: clamp(28px, 24px + 1.4vw, 36px); }
.nav-ico svg { width: clamp(22px, 16px + 2vw, 28px); height: clamp(22px, 16px + 2vw, 28px); }
.wal-amt { font-size: clamp(1.7rem, 1.1rem + 2.4vw, 2.8rem); }
.panel { padding: clamp(14px, 1.4vw, 24px); border-radius: clamp(16px, 1.6vw, 24px); }
.page-head { margin-bottom: clamp(10px, 1.4vw, 18px); }

@media (min-width: 900px) {
  .nav { border-radius: 28px; }
  .shell { padding-top: clamp(16px, 2vw, 32px); }
}

@media (max-width: 360px) {
  .qa-ico { width: 38px; height: 38px; }
  .qa-row button { font-size: .62rem; }
  .atm-amt-row strong { font-size: 1.25rem; }
  .nav button { font-size: 9px; min-height: 52px; }
  .nav-ico { width: 40px; height: 28px; }
  .home-greet-cash { padding: 8px 10px; font-size: .72rem; }
}

/* Refer & Earn — same backend as the Flutter screen */
.refer-page { gap: 12px; padding-bottom: 24px; }
.refer-page .page-head { display: flex; align-items: center; gap: 10px; }
.refer-page .page-head b { flex: 1; }
.refer-refresh {
  border: 0; background: #ecfdf5; color: #0f766e; font-weight: 800;
  border-radius: 999px; padding: 6px 12px; font-size: .75rem;
}
.refer-hero {
  display: flex; gap: 12px; align-items: center;
  padding: 14px; border-radius: 16px;
  background: linear-gradient(90deg, #ffe8d6, #fff1e6);
  border: 1px solid #f3d5bc;
}
.refer-gift {
  width: 42px; height: 42px; border-radius: 12px; background: #fff;
  display: grid; place-items: center; font-size: 1.25rem; flex-shrink: 0;
}
.refer-hero b { display: block; color: #7c2d12; }
.refer-hero small { display: block; margin-top: 2px; color: #9a3412; line-height: 1.35; }
.refer-card {
  background: #fff; border: 1px solid #ccfbf1; border-radius: 16px; padding: 14px;
  display: grid; gap: 10px;
}
.refer-kicker {
  margin: 0; text-align: center; letter-spacing: .14em; text-transform: uppercase;
  color: #94a3b8; font-size: .72rem; font-weight: 800;
}
.refer-code {
  text-align: center; font-weight: 900; letter-spacing: .16em;
  font-size: 1.35rem; color: #0f766e; background: #f0fdfa;
  border: 1px solid rgba(15, 118, 110, .28); border-radius: 12px; padding: 12px 8px;
}
.refer-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.refer-btn {
  border: 1px solid rgba(15, 118, 110, .35); background: #fff; color: #0f172a;
  border-radius: 12px; padding: 10px; font-weight: 800;
}
.refer-btn.fill { background: #0f766e; color: #fff; border-color: #0f766e; }
.refer-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.refer-stat {
  background: #fff; border: 1px solid #ccfbf1; border-radius: 16px; padding: 12px;
  text-align: center;
}
.refer-stat span { display: block; color: #475569; font-size: .75rem; font-weight: 700; }
.refer-stat b { display: block; margin-top: 4px; color: #0f766e; font-size: 1.15rem; }
.refer-stat.gold b { color: #b45309; }
.refer-pending {
  margin: 0; padding: 10px 12px; border-radius: 12px;
  background: rgba(217, 119, 6, .1); border: 1px solid rgba(217, 119, 6, .28);
  color: #7c2d12; font-weight: 800; font-size: .85rem;
}
.refer-h { display: block; }
.refer-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.refer-steps i {
  width: 34px; height: 34px; border-radius: 50%; margin: 0 auto 6px;
  display: grid; place-items: center; font-style: normal; font-weight: 800;
  color: #0f766e; background: rgba(15, 118, 110, .1); border: 1px solid rgba(15, 118, 110, .35);
}
.refer-steps b, .refer-steps small { display: block; }
.refer-steps small { color: #94a3b8; font-size: .72rem; }
.refer-rates { margin: 0; color: #0f766e; font-size: .8rem; font-weight: 700; }
.refer-joined {
  margin: 0; padding: 10px 12px; border-radius: 12px; background: #ecfdf5;
  border: 1px solid #99f6e4; color: #047857; font-weight: 700;
}
.refer-list { display: grid; gap: 8px; }
.refer-row {
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; padding: 10px;
}
.refer-row b { display: block; }
.refer-row small { color: #64748b; font-size: .75rem; }
.refer-row-meta { text-align: right; }
.refer-row-meta em { display: block; font-style: normal; font-size: .72rem; color: #b45309; font-weight: 800; text-transform: capitalize; }
.refer-row-meta em.ok { color: #047857; }
.refer-row-meta span { font-weight: 800; color: #0f766e; font-size: .8rem; }
.refer-empty, .refer-note { margin: 0; color: #94a3b8; font-size: .78rem; text-align: center; }
#refer-search {
  width: 100%; border: 1px solid #ccfbf1; border-radius: 12px; padding: 10px 12px; background: #f0fdfa;
}

/* Off games stay on the grid, dimmed, so players can see they are closed. */
.game.is-off {
  cursor: not-allowed;
}
#view-home .home-games-grid .game.is-off img,
#view-friends-play .games .game.is-off img,
.game.is-off img,
.game.is-off span {
  filter: grayscale(1) brightness(.48) !important;
  opacity: .55;
}
#view-home .home-games-grid .game.is-off span,
.game.is-off span {
  color: rgba(255, 255, 255, .45) !important;
}
.game.is-off::after {
  content: 'Off';
  position: absolute;
  z-index: 6;
  top: 8px;
  right: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(8, 12, 20, .82);
  color: rgba(255, 255, 255, .72);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  pointer-events: none;
}
.tn-event.is-off,
.feat-banner.is-off {
  filter: grayscale(.9) brightness(.62);
  opacity: .72;
  pointer-events: none;
}

/* Home 3D depth — CSS only, no WebGL */
#view-home.home-shell {
  perspective: 1200px;
}
#view-home .atm-card {
  transform: perspective(900px) rotateX(5deg);
  transform-origin: center top;
  transition: transform .28s cubic-bezier(.2, .9, .2, 1), box-shadow .28s ease;
}
#view-home .atm-card:hover,
#view-home .atm-card:focus-within {
  transform: perspective(900px) rotateX(0);
  box-shadow: 0 18px 36px rgba(15, 118, 110, .32);
}
#view-home .home-games-grid {
  perspective: 900px;
}
#view-home .home-games-grid .game {
  transform-style: preserve-3d;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .18) inset,
    0 -2px 0 rgba(0, 0, 0, .35) inset,
    0 14px 28px rgba(7, 17, 31, .32),
    0 8px 0 rgba(7, 17, 31, .18);
}
#view-home .home-games-grid .game img {
  transform: translateZ(10px);
}
@keyframes gameTileIn {
  from { opacity: 0; transform: translateY(16px) rotateX(14deg) scale(.96); }
  to { opacity: 1; transform: translateY(0) rotateX(0) scale(1); }
}
#view-home .home-games-grid .game:hover,
#view-home .home-games-grid .game:focus-visible {
  transform: translateY(-8px) rotateX(-6deg) scale(1.03);
}
#view-home .home-games-grid .game:hover img,
#view-home .home-games-grid .game:focus-visible img {
  transform: translateZ(18px) scale(1.04);
}
@media (prefers-reduced-motion: reduce) {
  #view-home .atm-card,
  #view-home .home-games-grid .game,
  #view-home .home-games-grid .game img {
    transform: none !important;
    animation: none !important;
  }
}

/* The window scrolls. Body must not be its own scroller, or trackpad/touch die. */
html, body {
  overflow-x: clip !important;
  overflow-y: visible !important;
  height: auto !important;
  max-height: none !important;
  overscroll-behavior: auto !important;
  touch-action: pan-x pan-y !important;
}
body { position: static !important; }
.shell,
.screen:not(#view-ludo-play):not(#view-table-play):not(#view-ludo-lobby) {
  overflow: visible !important;
  height: auto !important;
  max-height: none !important;
}

/* Tic Tac Toe larger grids */
.table-board.ttt.ttt-5,
.table-board.ttt.ttt-7 {
  width: min(94vw, 440px);
  gap: 5px;
  padding: 8px;
}
.table-board.ttt.ttt-7 { width: min(96vw, 480px); gap: 3px; padding: 6px; }
.table-board.ttt.ttt-5 .sq.ttt { font-size: clamp(1.2rem, 7vw, 2.1rem); border-radius: 10px; }
.table-board.ttt.ttt-7 .sq.ttt { font-size: clamp(.9rem, 5vw, 1.5rem); border-radius: 8px; }
.seg.seg-modes { margin-top: 6px; }

/* Flippy Bird */
#view-table-play.flippy-mode {
  overflow: hidden;
  height: 100dvh;
  max-height: 100dvh;
  padding: 0;
  background: #0369a1;
}
#view-table-play.flippy-mode .layout { height: 100%; padding: 0; margin: 0; max-width: none; }
#view-table-play.flippy-mode .panel-dark,
#view-table-play.flippy-mode .topbar,
#view-table-play.flippy-mode .play-turn { display: none; }
#view-table-play.flippy-mode .board-wrap {
  max-width: none; width: 100%; height: 100dvh; margin: 0; padding: 0; border: 0;
  background: transparent; border-radius: 0;
}
.table-board.flippy {
  position: relative; width: 100%; height: 100%; background: #0ea5e9;
  border-radius: 0; overflow: hidden; padding: 0; aspect-ratio: auto;
}
#view-table-play.flippy-mode .table-board {
  width: 100%; max-width: none; height: 100%; aspect-ratio: auto; border-radius: 0;
}
.fp-cv { width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
.fp-cv3d { width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
.fp-hud {
  position: absolute; inset: 0; pointer-events: none; overflow: hidden;
  font-family: Outfit, system-ui, sans-serif; user-select: none; -webkit-user-select: none;
}
.fp-top {
  display: flex; align-items: flex-start; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 0 calc(52px + env(safe-area-inset-left, 0px));
  font-weight: 800; color: #fff;
}
.fp-chip, .fp-stat {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  background: rgba(6, 20, 32, .48);
  border: 1px solid rgba(255, 255, 255, .16);
  box-shadow: 0 4px 14px rgba(2, 12, 22, .28);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  text-shadow: 0 1px 2px rgba(2, 12, 22, .5);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.fp-chip {
  font-size: .7rem; font-weight: 900; letter-spacing: .1em;
  color: #fef3c7; border-color: rgba(253, 224, 71, .35);
}
.fp-chip.live { color: #052e24; background: linear-gradient(180deg, #4ade80, #16a34a); border-color: rgba(255, 255, 255, .35); text-shadow: none; }
.fp-stats { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.fp-stat { font-size: .82rem; font-weight: 800; color: #f8fafc; }
.fp-coin { color: #fde68a; border-color: rgba(253, 224, 71, .38); }
.fp-coin::before {
  content: ''; width: 11px; height: 11px; border-radius: 50%; flex: 0 0 auto;
  background: radial-gradient(circle at 34% 30%, #fff3bf 0 18%, #fbbf24 45%, #b45309 100%);
  box-shadow: 0 0 0 1px rgba(69, 26, 3, .55), 0 0 8px rgba(251, 191, 36, .55);
}
.fp-dist { color: #e2e8f0; font-weight: 700; font-size: .76rem; }
.fp-stat.pop { animation: fp-pop .34s ease-out; }
.fp-tools { display: flex; align-items: center; gap: 6px; }
.fp-btn {
  pointer-events: auto; cursor: pointer;
  width: 34px; height: 34px; padding: 0; border-radius: 50%;
  display: grid; place-items: center;
  color: #fff; background: rgba(6, 20, 32, .48);
  border: 1px solid rgba(255, 255, 255, .16);
  box-shadow: 0 4px 14px rgba(2, 12, 22, .28);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: opacity .15s ease, transform .1s ease;
}
.fp-btn svg { width: 17px; height: 17px; display: block; }
.fp-btn:active { transform: scale(.93); }
.fp-btn.off { opacity: .38; }
.fp-big {
  position: absolute; left: 50%; top: 32%; transform: translate(-50%, -50%) scale(.82);
  font-size: clamp(3rem, 15vw, 6.5rem); font-weight: 900; letter-spacing: .02em;
  color: #fff; opacity: 0; pointer-events: none;
  text-shadow: 0 2px 0 #0369a1, 0 10px 30px rgba(2, 12, 22, .45);
}
.fp-big.on { animation: fp-big .5s cubic-bezier(.2, 1.4, .4, 1) forwards; }
.fp-hint {
  position: absolute; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  max-width: 92%; overflow: hidden; text-overflow: ellipsis;
  background: rgba(6, 20, 32, .62); color: #fefce8; padding: 9px 16px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .14);
  font-weight: 800; font-size: .86rem; white-space: nowrap;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.fp-hint.hidden { display: none; }
.fp-load {
  position: absolute; left: 50%; top: 58%; transform: translate(-50%, -50%);
  display: none; align-items: center; gap: 9px;
  padding: 9px 16px; border-radius: 999px;
  background: rgba(6, 20, 32, .58); color: #e2e8f0;
  font-weight: 700; font-size: .82rem; white-space: nowrap;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.fp-load.on { display: flex; }
.fp-load::before {
  content: ''; width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .28); border-top-color: #fbbf24;
  animation: fp-spin .8s linear infinite;
}
.fp-rotate {
  position: absolute; left: 50%; top: calc(64px + env(safe-area-inset-top, 0px));
  transform: translateX(-50%);
  display: none; padding: 7px 14px; border-radius: 999px;
  background: rgba(6, 20, 32, .55); color: #e2e8f0;
  font-size: .74rem; font-weight: 700; white-space: nowrap;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.fp-rotate.on { display: block; animation: fp-rotate-out .5s ease 4.5s forwards; }
@keyframes fp-rotate-out { to { opacity: 0; visibility: hidden; } }
@keyframes fp-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.22); }
  100% { transform: scale(1); }
}
@keyframes fp-big {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.7); }
  60% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes fp-spin { to { transform: rotate(360deg); } }
@media (max-width: 420px) {
  .fp-chip, .fp-stat { padding: 5px 9px; font-size: .72rem; }
  .fp-dist { display: none; }
  .fp-btn { width: 31px; height: 31px; }
}
@media (prefers-reduced-motion: reduce) {
  .fp-stat.pop, .fp-big.on { animation: none; }
  .fp-big.on { opacity: 1; transform: translate(-50%, -50%); }
  .fp-load::before { animation: none; }
}

/* ============================================================
   KBPolish — shared depth, light & feedback layer (all games)
   Transform/opacity only so mid-range phones hold 60–120fps.
   ============================================================ */
.kbp-fx-layer {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  overflow: hidden;
  contain: strict;
}
.kbp-burst { position: absolute; width: 0; height: 0; pointer-events: none; }
.kbp-spark {
  position: absolute;
  left: 0;
  top: 0;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 0 10px currentColor;
  animation: kbpSpark 0.66s cubic-bezier(0.16, 0.84, 0.36, 1) forwards;
}
@keyframes kbpSpark {
  0% { transform: translate3d(0, 0, 0) scale(0.35); opacity: 1; }
  65% { opacity: 1; }
  100% { transform: translate3d(var(--dx), var(--dy), 0) scale(0); opacity: 0; }
}
.kbp-ring {
  position: absolute;
  left: 0;
  top: 0;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  border: 2px solid var(--c, #fff);
  box-shadow: 0 0 14px var(--c, #fff);
  pointer-events: none;
  animation: kbpRing 0.52s ease-out forwards;
}
@keyframes kbpRing {
  0% { transform: scale(0.4); opacity: 0.9; }
  100% { transform: scale(6.5); opacity: 0; }
}
.kbp-float {
  position: absolute;
  transform: translate(-50%, -50%);
  font: 800 15px/1 Outfit, system-ui, sans-serif;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  animation: kbpFloat 1.05s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}
@keyframes kbpFloat {
  0% { opacity: 0; transform: translate(-50%, -40%) scale(0.7); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -140%) scale(1.05); }
}
.kbp-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.kbp-confetti i {
  position: absolute;
  top: -18px;
  width: 7px;
  height: 12px;
  border-radius: 2px;
  animation: kbpConfetti linear forwards;
  will-change: transform;
}
@keyframes kbpConfetti {
  0% { transform: translate3d(0, -10px, 0) rotate(0deg); opacity: 0; }
  8% { opacity: 1; }
  100% { transform: translate3d(var(--sway, 30px), 105vh, 0) rotate(680deg); opacity: 0.9; }
}
.kbp-pulse { animation: kbpPulse 0.46s ease; }
@keyframes kbpPulse {
  0%, 100% { filter: brightness(1); }
  38% { filter: brightness(1.22) saturate(1.08); }
}
.kbp-shake { animation: kbpShake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
@keyframes kbpShake {
  0%, 100% { transform: translate3d(0, 0, 0); }
  18% { transform: translate3d(-5px, 2px, 0) rotate(-0.5deg); }
  38% { transform: translate3d(5px, -2px, 0) rotate(0.5deg); }
  58% { transform: translate3d(-3px, 1px, 0); }
  78% { transform: translate3d(3px, -1px, 0); }
}
.kbp-enter { animation: kbpEnter 0.52s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes kbpEnter {
  0% { opacity: 0; transform: translate3d(0, 16px, 0) scale(0.985); }
  100% { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}
.kbp-tilt-on { transform-style: preserve-3d; }

/* Board light — composed with each board's existing frame shadow. */
.kbp-attached .table-board.chess {
  box-shadow: 0 0 0 5px #5d4037, 0 0 0 8px #c4a35a, 0 20px 46px rgba(0, 0, 0, 0.5),
    0 0 48px rgba(246, 196, 83, 0.18);
}
.kbp-attached .table-board.checkers {
  box-shadow: 0 0 0 5px #5d4037, 0 0 0 8px #c4a35a, 0 20px 46px rgba(0, 0, 0, 0.5),
    0 0 48px rgba(251, 191, 36, 0.2);
}
.kbp-attached .table-board.ttt {
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.2), 0 18px 42px rgba(0, 0, 0, 0.42),
    0 0 42px rgba(56, 189, 248, 0.16);
}
.kbp-attached .table-board.quoridor {
  box-shadow: 0 0 0 3px #111827, 0 20px 46px rgba(0, 0, 0, 0.5),
    0 0 44px rgba(167, 139, 250, 0.22);
}
.kbp-attached .table-board.snakeladder {
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), 0 0 44px rgba(52, 211, 153, 0.16);
}
.kbp-attached .ludo-board-frame #board,
#ludo-board-wrap.kbp-attached #board {
  box-shadow: 0 22px 52px rgba(0, 0, 0, 0.5), 0 0 44px rgba(251, 113, 133, 0.18);
}

/* Chess & draughts depth */
.table-board.chess .sq .ch-piece {
  filter: drop-shadow(0 4px 3px rgba(0, 0, 0, 0.42)) drop-shadow(0 0 1px rgba(255, 255, 255, 0.2));
  transition: transform 0.13s ease;
}
.table-board.chess .sq.dark .ch-piece.black { filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.55)); }
.table-board.chess .sq:active .ch-piece { transform: translateY(-5%) scale(1.04); }
.table-board.chess .sq.last::after,
.table-board.checkers .sq.last::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 2px rgba(246, 196, 83, 0.55), inset 0 0 22px rgba(246, 196, 83, 0.28);
  pointer-events: none;
  animation: kbpLastGlow 2.6s ease-in-out infinite;
}
.table-board.checkers .sq.last::after {
  box-shadow: inset 0 0 0 2px rgba(251, 191, 36, 0.6), inset 0 0 24px rgba(251, 191, 36, 0.3);
}
@keyframes kbpLastGlow {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}
.table-board.chess .sq.check::after,
.table-board.chess .sq.mate::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 3px rgba(239, 68, 68, 0.75), inset 0 0 26px rgba(239, 68, 68, 0.4);
  pointer-events: none;
  animation: kbpLastGlow 0.9s ease-in-out infinite;
}
.table-board.checkers .ck-man {
  filter: drop-shadow(0 6px 5px rgba(0, 0, 0, 0.5));
}
.table-board.checkers .ck-man .ck-disc {
  box-shadow:
    inset 0 7px 12px rgba(255, 255, 255, 0.3),
    inset 0 -9px 12px rgba(0, 0, 0, 0.38),
    0 3px 0 rgba(0, 0, 0, 0.25);
}
.table-board.checkers .ck-man .ck-gloss { background: rgba(255, 255, 255, 0.5); }
.table-board.checkers .ck-man.king .ck-crown { filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.75)); }

/* Tic-Tac-Toe tiles */
.sq.ttt {
  background: linear-gradient(155deg, #243553 0%, #17243a 58%, #101a2b 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -10px 18px rgba(0, 0, 0, 0.3),
    0 4px 10px rgba(0, 0, 0, 0.18);
}
.sq.ttt.legal { box-shadow: inset 0 0 0 2px #22c55e, 0 0 18px rgba(34, 197, 94, 0.16); }
.sq.ttt.legal:hover { box-shadow: inset 0 0 0 2px #4ade80, 0 0 22px rgba(34, 197, 94, 0.3); }
.sq.ttt.legal::after { display: none; }
.sq.ttt.legal::before { display: none; }
.sq.ttt.mark-x { text-shadow: 0 0 18px rgba(56, 189, 248, 0.7), 0 4px 0 rgba(2, 132, 199, 0.32); }
.sq.ttt.mark-o { text-shadow: 0 0 18px rgba(251, 113, 133, 0.7), 0 4px 0 rgba(190, 24, 93, 0.32); }
.sq.ttt.mark-x::before,
.sq.ttt.mark-o::before {
  content: "";
  position: absolute;
  inset: 12%;
  border-radius: 12px;
  background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.14), transparent 62%);
  pointer-events: none;
}
.sq.ttt.win {
  background: linear-gradient(155deg, #166534, #14532d);
  animation: kbpWinTile 0.9s ease-in-out infinite alternate;
}
@keyframes kbpWinTile {
  0% { box-shadow: inset 0 0 0 2px #4ade80, 0 0 18px rgba(74, 222, 128, 0.2); }
  100% { box-shadow: inset 0 0 0 3px #86efac, 0 0 30px rgba(74, 222, 128, 0.45); }
}

/* Quoridor / Snake & Ladder depth */
.table-board.quoridor canvas.q-cv {
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.35));
}
.table-board.snakeladder .sl-pawn .pawn { filter: drop-shadow(0 4px 3px rgba(0, 0, 0, 0.42)); }
.table-board.snakeladder .sl-pawn.just { filter: drop-shadow(0 0 10px rgba(251, 191, 36, 0.65)); }
.table-board.snakeladder .sl-snake-body {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}
.table-board.snakeladder .sl-ladder-fill {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.28));
}

/* Ludo / dice feel */
#dice.spin img,
#dice-opp.spin img,
.sl-ludo-dice.spin img {
  animation: kbpDiceTumble 0.34s linear infinite;
}
@keyframes kbpDiceTumble {
  0% { transform: rotate(0deg) scale(1); }
  45% { transform: rotate(14deg) scale(1.06); }
  100% { transform: rotate(0deg) scale(1); }
}
.play-wrap .ludo-dice.dice,
.sl-ludo-dice.dice {
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.play-wrap .ludo-dice.dice.can-roll {
  animation: kbpDiceReady 1.6s ease-in-out infinite;
}
@keyframes kbpDiceReady {
  0%, 100% { box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.4), 0 8px 18px rgba(0, 0, 0, 0.35); }
  50% { box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.28), 0 0 22px rgba(34, 197, 94, 0.35), 0 8px 18px rgba(0, 0, 0, 0.35); }
}
#board .token {
  filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.4));
  transition: transform 0.16s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Paper.io shell (3D-ish neon arena chrome) */
.pio-wrap {
  background: radial-gradient(circle at 50% 0%, #1b2f4a 0%, #0b1726 58%, #060d18 100%);
}
.pio-wrap canvas {
  filter: drop-shadow(0 18px 34px rgba(0, 0, 0, 0.45));
}
.pio-hud {
  backdrop-filter: blur(10px) saturate(1.25);
  -webkit-backdrop-filter: blur(10px) saturate(1.25);
}
.pio-coin {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 7px auto 0;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(250, 204, 21, 0.55);
  color: #fde68a;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.02em;
  width: max-content;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
}
.pio-coin i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fef3c7, #f59e0b 65%, #b45309);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.7);
  display: block;
}
.pio-skin {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(8, 18, 32, 0.68);
  color: #e2e8f0;
  font: 800 10px/1 Outfit, system-ui, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.pio-skin i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: block;
  box-shadow: 0 0 8px currentColor;
  background: currentColor;
}
.pio-skin:active { transform: scale(0.96); }

@media (prefers-reduced-motion: reduce) {
  .kbp-pulse, .kbp-shake, .kbp-enter, .kbp-confetti i,
  .kbp-spark, .kbp-ring, .kbp-float,
  .sq.ttt.win, .table-board.chess .sq.last::after,
  .table-board.checkers .sq.last::after,
  .play-wrap .ludo-dice.dice.can-roll,
  #dice.spin img, #dice-opp.spin img, .sl-ludo-dice.spin img {
    animation: none !important;
  }
}

.pio-coin b { font-size: 12px; color: #fde68a; }

/* ============================================================
   KB ARENA LUXE — depth pass across every game screen
   Ambient orbs + light floor + motes, 3D cards, glass HUDs.
   Transform/opacity only; lite + reduced-motion keep it calm.
   ============================================================ */

.kb-ambience {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  transition: opacity .55s ease;
  contain: strict;
}
body.kb-game-mode .kb-ambience { opacity: 1; }
.kb-ambience .kb-orb {
  position: absolute;
  border-radius: 50%;
  will-change: transform;
}
.kb-ambience .kb-orb.o1 {
  width: 62vmax; height: 62vmax; left: -26vmax; top: -30vmax;
  background: radial-gradient(circle, rgba(20,184,166,.26), transparent 62%);
  animation: kbOrbA 17s ease-in-out infinite alternate;
}
.kb-ambience .kb-orb.o2 {
  width: 56vmax; height: 56vmax; right: -28vmax; top: -18vmax;
  background: radial-gradient(circle, rgba(99,102,241,.22), transparent 64%);
  animation: kbOrbA 21s ease-in-out -6s infinite alternate-reverse;
}
.kb-ambience .kb-orb.o3 {
  width: 70vmax; height: 70vmax; left: 10vmax; bottom: -40vmax;
  background: radial-gradient(circle, rgba(245,158,11,.13), transparent 66%);
  animation: kbOrbA 19s ease-in-out -11s infinite alternate;
}
@keyframes kbOrbA {
  from { transform: translate3d(-2%, -1%, 0) scale(1); }
  to { transform: translate3d(3%, 4%, 0) scale(1.08); }
}
.kb-ambience .kb-floor {
  position: absolute;
  left: -25%; right: -25%; bottom: -14%;
  height: 46vh;
  background-image:
    linear-gradient(rgba(94,234,212,.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(94,234,212,.12) 1px, transparent 1px);
  background-size: 48px 48px;
  transform: perspective(560px) rotateX(67deg);
  transform-origin: 50% 100%;
  -webkit-mask-image: linear-gradient(to top, #000 12%, transparent 82%);
  mask-image: linear-gradient(to top, #000 12%, transparent 82%);
  opacity: .45;
}
.kb-ambience .kb-mote {
  position: absolute;
  left: var(--x);
  bottom: -4vh;
  width: var(--sz);
  height: var(--sz);
  border-radius: 50%;
  background: rgba(153,246,228,.7);
  box-shadow: 0 0 10px rgba(45,212,191,.55);
  opacity: 0;
  animation: kbMote var(--d) linear var(--dl) infinite;
  will-change: transform, opacity;
}
@keyframes kbMote {
  0% { transform: translate3d(0, 0, 0) scale(.5); opacity: 0; }
  10% { opacity: .55; }
  80% { opacity: .28; }
  100% { transform: translate3d(var(--dx), -112vh, 0) scale(1.15); opacity: 0; }
}
body.kb-game-mode #view-home,
body.kb-game-mode #view-game-home:not(.hidden),
body.kb-game-mode #view-ludo-home:not(.hidden),
body.kb-lobby-mode #view-ludo-lobby:not(.hidden) {
  position: relative;
  z-index: 1;
}

/* Home game grid — floating 3D tiles */
body.kb-game-mode #view-home:not(.hidden) .home-games-grid .game {
  animation: kbTileIn .48s cubic-bezier(.2,.9,.2,1) backwards;
}
body.kb-game-mode #view-home:not(.hidden) .home-games-grid .game:nth-child(1) { animation-delay: .02s; }
body.kb-game-mode #view-home:not(.hidden) .home-games-grid .game:nth-child(2) { animation-delay: .06s; }
body.kb-game-mode #view-home:not(.hidden) .home-games-grid .game:nth-child(3) { animation-delay: .10s; }
body.kb-game-mode #view-home:not(.hidden) .home-games-grid .game:nth-child(4) { animation-delay: .14s; }
body.kb-game-mode #view-home:not(.hidden) .home-games-grid .game:nth-child(5) { animation-delay: .18s; }
body.kb-game-mode #view-home:not(.hidden) .home-games-grid .game:nth-child(6) { animation-delay: .22s; }
body.kb-game-mode #view-home:not(.hidden) .home-games-grid .game:nth-child(7) { animation-delay: .26s; }
body.kb-game-mode #view-home:not(.hidden) .home-games-grid .game:nth-child(8) { animation-delay: .30s; }
body.kb-game-mode #view-home:not(.hidden) .home-games-grid .game:nth-child(9) { animation-delay: .34s; }
body.kb-game-mode #view-home:not(.hidden) .home-games-grid .game:nth-child(10) { animation-delay: .38s; }
body.kb-game-mode #view-home:not(.hidden) .home-games-grid .game:nth-child(11) { animation-delay: .42s; }
@keyframes kbTileIn {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to { opacity: 1; transform: none; }
}
body.kb-game-mode .game {
  border-radius: 20px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.18),
    inset 0 -2px 0 rgba(0,0,0,.35),
    0 18px 40px rgba(2,6,23,.5),
    0 0 0 1px rgba(94,234,212,.10);
}
body.kb-game-mode .game:hover,
body.kb-game-mode .game:focus-visible {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.22),
    inset 0 -2px 0 rgba(0,0,0,.35),
    0 26px 54px rgba(2,6,23,.58),
    0 0 36px rgba(45,212,191,.24),
    0 0 0 1px rgba(94,234,212,.35);
}
body.kb-game-mode .game span {
  background: linear-gradient(180deg, rgba(30,41,59,.96), rgba(9,14,26,.98));
}
body.kb-game-mode .game span::after {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.5),
    0 2px 8px rgba(15,118,110,.5),
    0 0 14px rgba(45,212,191,.45);
  animation: kbPlayPulse 2.6s ease-in-out infinite;
}
@keyframes kbPlayPulse {
  0%, 100% { box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 2px 8px rgba(15,118,110,.5), 0 0 10px rgba(45,212,191,.35); }
  50% { box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 2px 8px rgba(15,118,110,.5), 0 0 20px rgba(45,212,191,.65); }
}
body.kb-game-mode .home-games-title {
  background: linear-gradient(92deg, #f8fafc 8%, #99f6e4 58%, #5eead4 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 10px rgba(45,212,191,.18));
}

/* Matchmaking arena — spotlight panel + 3D cover */
body.kb-game-mode #view-game-home:not(.hidden) .match-panel,
body.kb-game-mode #view-ludo-home:not(.hidden) .match-panel,
body.kb-lobby-mode #view-ludo-lobby:not(.hidden) .panel {
  animation: kbPanelIn .52s cubic-bezier(.2,.9,.2,1) backwards;
}
@keyframes kbPanelIn {
  from { opacity: 0; transform: perspective(1200px) rotateX(5deg) translateY(16px) scale(.985); }
  to { opacity: 1; transform: none; }
}
body.kb-game-mode .match-panel.arena-lux {
  border-radius: 26px;
  border: 1px solid var(--kb-line-2);
  background:
    radial-gradient(340px circle at var(--kb-px, 20%) var(--kb-py, -6%), color-mix(in srgb, var(--kb-primary) 12%, transparent), transparent 62%),
    radial-gradient(circle at 12% 0%, color-mix(in srgb, var(--kb-primary-2) 10%, transparent), transparent 46%),
    radial-gradient(circle at 100% 8%, color-mix(in srgb, var(--kb-gold) 14%, transparent), transparent 44%),
    linear-gradient(165deg, var(--kb-surface) 0%, var(--kb-bg) 62%, var(--kb-bg) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.75),
    0 22px 48px var(--kb-primary-soft);
}
body.kb-game-mode .arena-art {
  border-radius: 20px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.18),
    0 14px 32px rgba(30,20,60,.20),
    0 0 0 1px var(--kb-line-2);
}
body.kb-game-mode .arena-art img { filter: saturate(1.06) contrast(1.02); }
body.kb-game-mode .arena-art::after {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.45),
    0 4px 12px rgba(15,118,110,.4),
    0 0 18px rgba(45,212,191,.5);
}
body.kb-game-mode .coin-row .gold-coin {
  transform: rotate(-8deg);
  box-shadow:
    inset 0 2px 2px rgba(255,255,255,.7),
    inset 0 -4px 6px rgba(120,53,15,.45),
    0 6px 14px rgba(0,0,0,.35),
    0 0 18px rgba(251,191,36,.35);
  transition: transform .25s ease;
}
body.kb-game-mode .coin-row .gold-coin:nth-child(2) {
  transform: translateY(-4px) scale(1.08);
  box-shadow:
    inset 0 2px 2px rgba(255,255,255,.75),
    inset 0 -4px 6px rgba(120,53,15,.45),
    0 10px 20px rgba(0,0,0,.4),
    0 0 26px rgba(251,191,36,.5);
}
body.kb-game-mode .coin-row .gold-coin:nth-child(3) { transform: rotate(8deg); }
body.kb-game-mode .match-user .avatar {
  box-shadow:
    0 0 0 2px var(--kb-primary-ring),
    0 0 0 5px var(--kb-primary-soft),
    0 8px 18px rgba(30,20,60,.16);
}
body.kb-game-mode .arena-ico {
  background: linear-gradient(160deg, var(--kb-surface), var(--kb-surface-2));
  border: 1px solid var(--kb-line-2);
  box-shadow:
    inset 0 1px 0 #fff,
    0 8px 18px var(--kb-primary-soft);
}
body.kb-game-mode .seg button {
  background: var(--kb-surface-2);
  color: var(--kb-ink);
  border: 1px solid var(--kb-line-2);
  box-shadow: none;
}
body.kb-game-mode .seg button.on {
  background: linear-gradient(180deg, var(--kb-primary-2), var(--kb-primary));
  border-color: transparent;
  color: var(--kb-on-primary);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.32),
    0 8px 18px var(--kb-primary-soft);
  text-shadow: none;
}
body.kb-game-mode .stake {
  box-shadow:
    inset 0 1px 0 #fff,
    0 10px 22px rgba(30,20,60,.12);
}
body.kb-game-mode .stake.on {
  transform: translateY(-4px);
  box-shadow:
    inset 0 1px 0 #fff,
    0 0 0 2px var(--tone),
    0 16px 32px rgba(30,20,60,.18),
    0 0 24px var(--tone-soft);
}
body.kb-game-mode .match-sum {
  background: var(--kb-surface-2);
  border: 1px solid var(--kb-line-2);
  color: var(--kb-ink);
  border-radius: 12px;
  padding: 8px 10px;
}

/* Searching state — radar sweep + gold VS */
body.kb-game-mode .search-strip {
  position: relative;
  overflow: hidden;
  border-color: var(--kb-line-2);
  background:
    radial-gradient(120% 90% at 50% -20%, color-mix(in srgb, var(--kb-primary) 10%, transparent), transparent 60%),
    linear-gradient(180deg, var(--kb-surface), var(--kb-bg));
  box-shadow:
    inset 0 1px 0 #fff,
    0 12px 28px var(--kb-primary-soft);
}
body.kb-game-mode .search-strip > * { position: relative; z-index: 1; }
body.kb-game-mode .search-strip::before {
  content: '';
  position: absolute;
  top: -60%; left: -45%;
  width: 60%; height: 220%;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--kb-primary) 14%, transparent), transparent);
  transform: rotate(14deg);
  animation: kbScanSweep 2.8s ease-in-out infinite;
  pointer-events: none;
}
@keyframes kbScanSweep {
  0% { transform: translateX(-40%) rotate(14deg); }
  100% { transform: translateX(360%) rotate(14deg); }
}
body.kb-game-mode .vs-av {
  border-radius: 18px;
  border-color: var(--kb-line-2);
  background: var(--kb-surface-2);
  color: var(--kb-ink);
  box-shadow:
    inset 0 1px 0 #fff,
    0 8px 18px rgba(30,20,60,.14);
}
body.kb-game-mode .vs-av.scan {
  border-color: color-mix(in srgb, var(--kb-primary) 62%, transparent);
  box-shadow:
    0 0 0 1px var(--kb-primary-soft),
    0 0 22px var(--kb-primary-soft),
    0 8px 18px rgba(30,20,60,.14);
}
body.kb-game-mode .vs-badge {
  border: 0;
  color: #3b1d00;
  background: radial-gradient(circle at 35% 30%, #fde68a, #f59e0b 60%, #b45309);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.55),
    0 6px 14px rgba(245,158,11,.35),
    0 0 18px rgba(251,191,36,.3);
  text-shadow: 0 1px 0 rgba(255,255,255,.35);
}

/* Live table — glass stage + HUD cards */
body.kb-play-mode .play-wrap {
  background:
    radial-gradient(90% 60% at 50% -10%, rgba(45,212,191,.20), transparent 62%),
    radial-gradient(60% 45% at 100% 100%, rgba(139,92,246,.14), transparent 72%),
    linear-gradient(rgba(7,17,31,.84), rgba(7,17,31,.94)),
    url("/web/assets/images/ludo_bg.webp") center/cover;
}
body.kb-play-mode .play-wrap > .layout {
  position: relative;
  z-index: 1;
}
body.kb-play-mode .board-wrap {
  border-radius: 20px;
  border-color: rgba(94,234,212,.22);
  background: linear-gradient(160deg, rgba(19,34,54,.94), rgba(8,16,28,.97));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.08),
    0 22px 52px rgba(0,0,0,.5),
    0 0 46px rgba(20,184,166,.10);
}
body.kb-play-mode .panel-dark .card {
  border-color: rgba(94,234,212,.16);
  background: linear-gradient(165deg, rgba(20,36,56,.92), rgba(9,17,30,.96));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.06),
    0 12px 28px rgba(0,0,0,.32);
}
body.kb-play-mode .player {
  background: linear-gradient(155deg, rgba(255,255,255,.045), rgba(255,255,255,.01));
  border-color: rgba(148,163,184,.22);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}
body.kb-play-mode .player.active {
  border-color: rgba(45,212,191,.65);
  background: linear-gradient(155deg, rgba(13,148,136,.22), rgba(15,23,42,.4));
  box-shadow:
    0 0 0 1px rgba(45,212,191,.25),
    0 0 24px rgba(20,184,166,.18);
}
body.kb-play-mode .play-turn {
  width: max-content;
  max-width: calc(100% - 96px);
  margin: 0 auto;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(94,234,212,.22);
  background: rgba(8,16,28,.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  text-shadow: none;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.06),
    0 6px 16px rgba(0,0,0,.3);
}
body.kb-play-mode .play-exit {
  border: 1px solid rgba(148,163,184,.28);
  background: rgba(10,18,32,.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.1),
    0 8px 20px rgba(0,0,0,.4);
  transition: transform .15s ease;
}
body.kb-play-mode .play-exit:active { transform: scale(.94); }
body.kb-play-mode .play-guide {
  background: rgba(10,18,32,.7);
  border: 1px solid rgba(148,163,184,.28);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 20px rgba(0,0,0,.35);
}
body.kb-play-mode #view-ludo-play #ludo-board-wrap .ludo-board-frame {
  box-shadow:
    0 0 0 1px rgba(255,236,180,.55),
    0 0 0 3px rgba(74,45,8,.85),
    0 18px 44px rgba(0,0,0,.55),
    0 0 46px rgba(232,200,114,.28);
}
body.kb-play-mode .ludo-clock {
  border: 1px solid rgba(251,191,36,.35);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.12),
    0 8px 22px rgba(0,0,0,.4);
}
body.kb-play-mode .ludo-chip {
  background: transparent;
  border: 0;
  box-shadow: none;
}

/* Friends lobby — code plate + glowing seats */
body.kb-lobby-mode #view-ludo-lobby:not(.hidden) {
  display: grid;
  align-content: center;
  justify-items: center;
}
body.kb-lobby-mode #view-ludo-lobby:not(.hidden) .center-col { width: 100%; }
body.kb-lobby-mode .panel {
  border-radius: 24px;
  border: 1px solid rgba(94,234,212,.22);
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(45,212,191,.14), transparent 60%),
    linear-gradient(165deg, #16283a, #0b1624);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.07),
    0 26px 64px rgba(0,0,0,.45);
}
body.kb-lobby-mode .code {
  margin: 10px 0 6px;
  padding: 12px 10px;
  border-radius: 14px;
  text-align: center;
  color: #99f6e4;
  font-size: 1.65rem;
  text-shadow: 0 0 24px rgba(45,212,191,.55);
  background: linear-gradient(180deg, #0f2233, #0a1624);
  border: 1px solid rgba(94,234,212,.25);
  box-shadow:
    inset 0 2px 8px rgba(0,0,0,.5),
    0 10px 24px rgba(0,0,0,.35);
}
body.kb-lobby-mode .lobby-seat {
  border: 1px solid rgba(148,163,184,.14);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}
body.kb-lobby-mode .lobby-seat.you {
  border-color: rgba(45,212,191,.4);
  background: linear-gradient(160deg, rgba(13,148,136,.24), rgba(15,23,42,.3));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.07),
    0 0 22px rgba(20,184,166,.14);
}

/* Result screen — gold aura + rotating ring */
body.kb-game-mode .win-overlay .win-card {
  border-color: rgba(251,191,36,.65);
  box-shadow:
    0 0 0 1px rgba(255,255,255,.1),
    0 34px 90px rgba(0,0,0,.6),
    0 0 90px rgba(251,191,36,.28);
}
body.kb-game-mode .win-overlay.loss .win-card,
body.kb-game-mode .win-overlay.draw .win-card {
  box-shadow:
    0 0 0 1px rgba(255,255,255,.08),
    0 34px 90px rgba(0,0,0,.6);
}
body.kb-game-mode .win-ring {
  box-shadow:
    0 12px 28px rgba(245,158,11,.55),
    inset 0 2px 0 rgba(255,255,255,.5),
    0 0 34px rgba(251,191,36,.45);
}
body.kb-game-mode .win-ring::before {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 58%, rgba(253,230,138,.85) 72%, transparent 86%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  animation: kbRingSpin 3.2s linear infinite;
  pointer-events: none;
}
@keyframes kbRingSpin { to { transform: rotate(360deg); } }
body.kb-game-mode .win-overlay.loss .win-ring::before,
body.kb-game-mode .win-overlay.draw .win-ring::before { display: none; }
body.kb-game-mode .win-overlay:not(.loss):not(.draw) #win-title {
  background: linear-gradient(180deg, #ffffff, #fde68a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 10px rgba(251,191,36,.3));
}
body.kb-game-mode .win-overlay:not(.loss):not(.draw) .win-amt {
  text-shadow: 0 0 24px rgba(251,191,36,.45);
}

/* Light devices / reduced motion */
body.kb-lite .kb-ambience { display: none; }
@media (prefers-reduced-motion: reduce) {
  .kb-ambience .kb-orb,
  .kb-ambience .kb-floor,
  .kb-ambience .kb-mote,
  .bs-turn,
  .bs-clock.low,
  .bs-cell.hunt,
  .bs-cell.bs-firing,
  .bs-cell.bs-pop,
  body.kb-game-mode .search-strip::before,
  body.kb-game-mode .win-ring::before,
  body.kb-game-mode .game span::after,
  body.kb-game-mode #view-home:not(.hidden) .home-games-grid .game,
  body.kb-game-mode #view-game-home:not(.hidden) .match-panel,
  body.kb-game-mode #view-ludo-home:not(.hidden) .match-panel,
  body.kb-lobby-mode #view-ludo-lobby:not(.hidden) .panel {
    animation: none !important;
  }
  .kb-ambience .kb-mote { display: none; }
}

/* Account type selector (signup lock-in) */
.reg-lock { text-transform: none; letter-spacing: 0; color: var(--muted); font-weight: 600; font-size: 11px; }
.reg-types { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.reg-type {
  display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 12px; border-radius: 14px; cursor: pointer;
  background: var(--card); color: var(--text);
  border: 1px solid color-mix(in srgb, var(--text) 14%, transparent);
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.reg-type:active { transform: scale(.985); }
.reg-type.on { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, var(--card)); }
.reg-type .rt-flag { font-size: 24px; line-height: 1; }
.reg-type .rt-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.reg-type .rt-copy b { font-size: 14px; }
.reg-type .rt-copy small { color: var(--muted); font-size: 11px; line-height: 1.3; }
.reg-type-note { margin: 8px 2px 0; color: var(--muted); font-size: 12px; }
@media (max-width: 380px) { .reg-types { grid-template-columns: 1fr; } }

/* Partner organizer panel upgrade */
.pt-hero {
  position: relative; overflow: hidden; display: grid; gap: 6px;
  border-radius: 20px; padding: 18px 16px; color: #fff;
  background:
    radial-gradient(circle at 88% 0%, rgba(251,191,36,.45), transparent 42%),
    radial-gradient(circle at 8% 100%, rgba(34,211,238,.24), transparent 46%),
    linear-gradient(158deg, #0f766e 0%, #134e4a 46%, #1e1b4b 100%);
  box-shadow: 0 16px 34px rgba(15, 23, 42, .26);
}
.pt-hero b { font-size: 1.12rem; line-height: 1.25; }
.pt-hero p { margin: 0; color: rgba(255,255,255,.84); font-size: .82rem; font-weight: 600; line-height: 1.45; }
.pt-badge {
  justify-self: start; background: rgba(251,191,36,.18); color: #fde68a;
  border: 1px solid rgba(251,191,36,.42); border-radius: 999px;
  padding: 4px 10px; font-size: .62rem; font-weight: 800;
  letter-spacing: .07em; text-transform: uppercase;
}
.pt-hero-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.pt-hero-stats span {
  display: grid; gap: 1px; padding: 8px 10px; border-radius: 12px;
  background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.14);
}
.pt-hero-stats small { color: #fde68a; font-size: .58rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.pt-hero-stats b { font-size: .96rem; }
.pt-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.pt-stats span {
  display: grid; gap: 2px; padding: 10px 11px; border-radius: 14px;
  background: var(--wa-panel); border: 1px solid var(--wa-stroke);
}
.pt-stats small { color: var(--wa-muted); font-size: .6rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.pt-stats b { font-size: 1rem; }
.pt-form textarea {
  border: 1px solid var(--wa-stroke); border-radius: 12px; padding: 10px 12px;
  font: inherit; font-weight: 700; color: var(--wa-text); background: var(--wa-bg-2);
  resize: vertical; min-height: 64px;
}
.pt-upload {
  display: grid; grid-template-columns: minmax(0, 132px) minmax(0, 1fr); gap: 12px;
  align-items: center; padding: 12px; border-radius: 16px;
  background: var(--wa-panel); border: 1px dashed var(--wa-stroke);
}
.pt-upload-ph {
  aspect-ratio: 2 / 1; border-radius: 12px; overflow: hidden; cursor: pointer;
  background: var(--wa-bg-2); display: grid; place-items: center;
}
.pt-upload-ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pt-upload-empty { display: grid; place-items: center; gap: 3px; color: var(--wa-muted); }
.pt-upload-empty small { font-size: .56rem; font-weight: 700; text-align: center; line-height: 1.25; }
.pt-upload-meta { display: grid; gap: 6px; justify-items: start; }
.pt-upload-meta b { font-size: .84rem; }
.pt-upload-meta small { color: var(--wa-muted); font-size: .72rem; font-weight: 600; line-height: 1.35; }
.pt-upload-meta .btn { padding: 8px 14px; font-size: .74rem; border-radius: 999px; }
.pt-event {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 10px;
  align-items: center; text-align: left; padding: 10px; border-radius: 14px;
  background: var(--wa-panel); border: 1px solid var(--wa-stroke); color: inherit;
}
.pt-event-art {
  width: 56px; height: 56px; border-radius: 12px; overflow: hidden;
  background: var(--wa-bg-2); display: grid; place-items: center; font-size: 1.15rem;
}
.pt-event-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pt-event-main { display: grid; gap: 2px; min-width: 0; }
.pt-event-main b { font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-event-main small { color: var(--wa-muted); font-size: .7rem; font-weight: 600; }
.pt-event-side { display: grid; gap: 3px; justify-items: end; text-align: right; }
.pt-event-side em { font-style: normal; font-weight: 800; color: var(--wa-accent-2); font-size: .82rem; }
.pt-status {
  font-style: normal; font-size: .56rem; font-weight: 800; letter-spacing: .05em;
  text-transform: uppercase; padding: 2px 7px; border-radius: 999px;
  background: var(--wa-bg-2); color: var(--wa-muted);
}
.pt-status.paid { background: rgba(16,185,129,.14); color: #059669; }
.pt-status.pending { background: rgba(245,158,11,.16); color: #b45309; }
.pt-status.live { background: rgba(59,130,246,.14); color: #2563eb; }
.pt-rules {
  margin-top: 18px; padding: 14px; border-radius: 16px;
  background: var(--wa-panel); border: 1px solid var(--wa-stroke);
}
.pt-rules h3 { margin: 0 0 8px; font-size: .9rem; }
.pt-rules ol { margin: 0 0 10px 18px; padding: 0; display: grid; gap: 6px; font-size: .78rem; font-weight: 600; }
.pt-rules ul { margin: 0 0 0 18px; padding: 0; display: grid; gap: 5px; font-size: .74rem; font-weight: 600; color: var(--wa-muted); }

/* Tournaments: partner surfacing */
.tn-switch.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tn-host-cta {
  display: grid; gap: 10px; margin: 6px 0 12px; padding: 14px;
  border-radius: 16px; border: 1px solid var(--wa-stroke);
  background: linear-gradient(135deg, rgba(251,191,36,.16), rgba(15,118,110,.14));
}
.tn-host-cta b { font-size: .9rem; }
.tn-host-cta p { margin: 4px 0 0; color: var(--wa-muted); font-size: .76rem; font-weight: 600; line-height: 1.4; }
.tn-host-cta .btn { justify-self: start; border-radius: 999px; }
.tn-event.partner { border-color: rgba(251,191,36,.55); }
.tn-event-body em.tn-host-em { color: #b45309; }
.tn-host-line { display: block; color: #b45309; font-weight: 800; font-size: .68rem; margin: 2px 0 4px; }
.tn-rules-box p { margin: 0; font-size: .78rem; font-weight: 600; color: var(--wa-text); line-height: 1.45; white-space: pre-wrap; }

/* Home: official tournament strip */
#view-home .home-tn-sec { margin-top: 16px; animation: homeRise .55s .2s cubic-bezier(0.16, 1, 0.3, 1) both; }
html[data-gfx="low"] #view-home .home-tn-sec { animation: none !important; }
#view-home .home-tn-all {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--wa-accent-2); font-size: .74rem; font-weight: 800;
}
#view-home .home-tn-strip {
  display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 8px;
  scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
}
#view-home .home-tn-strip::-webkit-scrollbar { height: 4px; }
#view-home .home-tn-strip::-webkit-scrollbar-thumb { background: var(--wa-stroke); border-radius: 999px; }
.ht-card {
  flex: 0 0 176px; scroll-snap-align: start; display: grid; gap: 4px;
  text-align: left; padding: 8px; border-radius: 16px; cursor: pointer;
  border: 1px solid var(--wa-stroke); background: var(--wa-panel); color: inherit;
}
.ht-card:active { transform: scale(.985); }
.ht-art { position: relative; display: block; aspect-ratio: 16 / 10; border-radius: 12px; overflow: hidden; background: var(--wa-bg-2); }
.ht-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ht-pill {
  position: absolute; top: 6px; left: 6px; font-style: normal;
  font-size: .52rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase;
  color: #fde68a; background: rgba(15, 23, 42, .74); border-radius: 999px; padding: 3px 7px;
}
.ht-card b { font-size: .82rem; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ht-card small { color: var(--wa-muted); font-size: .68rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ht-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.ht-row em { font-style: normal; font-weight: 800; color: var(--wa-accent-2); font-size: .8rem; }
.ht-row i { font-style: normal; font-size: .62rem; font-weight: 700; color: var(--wa-muted); }

/* Partner command center */
.pt-quick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.pt-quick-btn {
  display: grid; gap: 2px; justify-items: start; text-align: left; cursor: pointer;
  padding: 12px; border-radius: 16px; color: inherit;
  border: 1px solid var(--wa-stroke); background: var(--wa-panel);
}
.pt-quick-btn span { font-size: 1.15rem; }
.pt-quick-btn b { font-size: .8rem; }
.pt-quick-btn small { color: var(--wa-muted); font-size: .68rem; font-weight: 700; }
.pt-card {
  margin-top: 14px; padding: 14px; border-radius: 16px;
  background: var(--wa-panel); border: 1px solid var(--wa-stroke);
}
.pt-card-head { display: grid; gap: 3px; margin-bottom: 10px; }
.pt-card-head b { font-size: .9rem; }
.pt-card-head small { color: var(--wa-muted); font-size: .72rem; font-weight: 600; line-height: 1.35; }
.pt-share-row { display: block; }
.pt-share-row code {
  display: block; overflow: auto; white-space: nowrap; font-size: .72rem;
  padding: 10px 12px; border-radius: 12px;
  background: var(--wa-bg-2); border: 1px solid var(--wa-stroke); color: var(--wa-text);
}
.pt-share-actions { display: flex; gap: 8px; margin-top: 8px; }
.pt-share-actions .btn { flex: 1; border-radius: 999px; padding: 8px 12px; font-size: .78rem; }
.pt-share-stat { margin: 10px 0 0; font-size: .76rem; font-weight: 600; color: var(--wa-muted); }
.pt-share-stat b { color: var(--wa-accent-2); font-size: .95rem; }
.pt-rows { display: grid; gap: 6px; }
.pt-rows .pt-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center;
  gap: 10px; padding: 9px 10px; border-radius: 12px;
  background: var(--wa-bg-2); border: 1px solid var(--wa-stroke);
}
.pt-row-av {
  width: 34px; height: 34px; border-radius: 50%; overflow: hidden;
  display: grid; place-items: center; background: var(--wa-panel);
  color: var(--wa-muted); font-weight: 800; font-size: .82rem;
}
.pt-row-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pt-row-main { display: grid; gap: 1px; min-width: 0; text-align: left; }
.pt-row-main b { font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-row-main small { color: var(--wa-muted); font-size: .66rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-rows .pt-row-side {
  display: grid; gap: 3px; justify-items: end; text-align: right;
  font-size: .76rem; font-weight: 800; color: var(--wa-text);
}
.pt-rows .pt-row-side .pt-status { justify-self: end; }
.pt-empty { margin: 0; color: var(--wa-muted); font-size: .76rem; font-weight: 600; }
#view-home .hello.home-tn-title { font-size: clamp(1.05rem, .75rem + 1.2vw, 1.55rem); }
