/* ==========================================================================
   Paisa777 / Rocket — premium dark UI (layout modelled on bustabit's phone flow)
   Phone:   graph → past-rounds strip → bet card → one tall panel with
            vertical side tabs (Chat / Past rounds / Players) filling the rest
            of the screen. Chat input pinned to the bottom of that panel.
   Tablet:  graph + bet on the left, side-tabbed chat on the right,
            player list under the bet card.
   Desktop: bet + players | graph | chat — everything visible.
   ========================================================================== */

:root {
  --bg: #07070c;
  --bg-elevated: #0e0e16;
  --surface: rgba(18, 18, 28, 0.72);
  --surface-solid: #12121c;
  --surface-hover: #1a1a28;
  --border: rgba(255, 255, 255, 0.08);
  --border-bright: rgba(255, 255, 255, 0.14);

  --text: #f4f4f8;
  --muted: #8b8ba3;
  --dim: #5c5c72;

  --accent: #00e676;
  --accent-glow: rgba(0, 230, 118, 0.45);
  --accent-dim: #00c853;
  --gold: #ffc947;
  --gold-glow: rgba(255, 201, 71, 0.35);
  --danger: #ff4757;
  --danger-glow: rgba(255, 71, 87, 0.4);
  --cyan: #00d4ff;
  --purple: #a855f7;

  --font: "Outfit", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-full: 999px;

  --header-h: 52px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --gutter: 12px;
  --page-max: 1500px;

  --glass: blur(20px) saturate(160%);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---- animated background ---- */
.bg-mesh {
  position: fixed;
  inset: 0;
  /* Must sit BELOW in-flow content. At z-index 0 it painted over anything
     non-positioned (the past-rounds chips were invisible). */
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(0, 230, 118, 0.12), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 50%, rgba(168, 85, 247, 0.08), transparent 50%),
    radial-gradient(ellipse 50% 30% at 0% 80%, rgba(0, 212, 255, 0.06), transparent 45%),
    var(--bg);
}

/* ---- page shell: phone = fixed-height app, the main area scrolls ---- */
.game-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

/* ---- header: in the normal flow, never sticky. On game pages the shell is one screen tall so
   it is always visible anyway; on scrolling pages it scrolls away with the content. ---- */
.app-header {
  position: relative;
  z-index: 50;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  height: calc(var(--header-h) + var(--safe-t));
  padding: var(--safe-t) var(--gutter) 0;
  background: rgba(7, 7, 12, 0.85);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  border-bottom: 1px solid var(--border);
}

/* ---- brand: gold coin mark + "Paisa777" wordmark ---- */
.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  text-decoration: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: block;
  filter: drop-shadow(0 0 8px rgba(247, 183, 51, 0.45));
}

.brand-text {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.01em;
  color: var(--text);
  line-height: 1;
}

.brand-777 { color: var(--gold); }

.header-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }

.nav-text {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
}

.nav-text:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }

.header-status { flex: 1; min-width: 0; }

.conn-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.conn-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
}

.conn-pill.ok { color: var(--accent); }
.conn-pill.ok::before {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse-dot 1.5s ease infinite;
}

.conn-pill.bad { color: var(--danger); }
.conn-pill.bad::before { background: var(--danger); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.header-account {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

/* Signed-in vs signed-out header, decided by the <html class="signed-in"> the server sets. */
.header-account .when-in,
.header-account .when-out { display: inline-flex; align-items: center; gap: 6px; }
html:not(.signed-in) .when-in { display: none !important; }
html.signed-in .when-out { display: none !important; }

.header-account .me-balance {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
  color: var(--accent);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: rgba(0, 230, 118, 0.1);
  border: 1px solid rgba(0, 230, 118, 0.25);
  white-space: nowrap;
  text-decoration: none;
}

/* Round person icon that opens the account page (the only way to sign out). */
.me-avatar svg { display: block; width: 20px; height: 20px; }
.me-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  color: #1a1000;
  background: linear-gradient(135deg, #ffc947, #ff9800);
  box-shadow: 0 2px 10px var(--gold-glow);
  text-decoration: none;
}

.header-account .me-name {
  display: none;
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-account .nav-link,
.header-account .btn-ghost,
.header-account .btn-primary {
  font-size: 12px;
  padding: 7px 12px;
}

/* ==========================================================================
   Layout — phone first
   ========================================================================== */
/* HARD RULE (copy-rules.md, mobile rule 9): on a phone a game page is exactly one screen tall.
   The page itself never scrolls; the chat / lists panel takes whatever height is left and scrolls
   inside itself. Everything above it (switcher, stage, past rounds, bet card) must stay compact. */
.app-layout {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 8px var(--gutter) calc(8px + var(--safe-b));
}

.stage-col  { order: 1; flex-shrink: 0; display: flex; flex-direction: column; min-height: 0; }
.bet-dock   { order: 2; flex-shrink: 0; }
.social-col { order: 3; flex: 1 1 0; min-height: 120px; }
.players-col{ order: 4; }

.phone-only { display: inline-flex; }

/* ---- game stage (the hero) ---- */
.game-stage {
  position: relative;
  flex: none;
  height: clamp(150px, 26vh, 240px);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-bright);
  background:
    radial-gradient(ellipse 70% 50% at 50% 100%, rgba(0, 230, 118, 0.08), transparent 60%),
    linear-gradient(180deg, rgba(14, 14, 22, 0.95) 0%, rgba(7, 7, 12, 0.98) 100%);
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

@supports (height: 1dvh) {
  .game-stage { height: clamp(150px, 26dvh, 240px); }
}

/* Phone sizes for the graph, chips, chat and bet card live in the "Phone compaction" section at the END of
   this file (they must come after every rule they override). */

.stage-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(180deg, black 60%, transparent);
  -webkit-mask-image: linear-gradient(180deg, black 60%, transparent);
}

.stage-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.45);
}

#graph {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  display: block;
}

/* ---- past rounds strip (directly under the graph) ---- */
.history-rail {
  padding: 8px 0 0;
  overflow: hidden;
  flex-shrink: 0;
}

.history-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.history-strip::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  scroll-snap-align: start;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(255, 71, 87, 0.12);
  color: var(--danger);
  border: 1px solid rgba(255, 71, 87, 0.25);
}

.chip.good {
  background: rgba(0, 230, 118, 0.12);
  color: var(--accent);
  border-color: rgba(0, 230, 118, 0.3);
}


/* ---- glass panels ---- */
.panel-glass {
  background: var(--surface);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  border: 1px solid var(--border);
}

/* ---- social panel: vertical side tabs + content ---- */
.social-col {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  border-radius: var(--radius);
  overflow: hidden;
}

.side-tabs {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 0;
  border-right: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  overflow: hidden;
  min-height: 0;
}

/* Buttons don't take writing-mode reliably, so the label span is what's
   rotated: reads bottom-to-top like bustabit's CHAT / HISTORY / PLAYERS. */
.tab {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 34px;
  min-height: 44px;
  padding: 12px 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.tab-label {
  display: block;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  line-height: 1;
  white-space: nowrap;
}

.tab:hover { color: var(--text); }

.tab.active {
  color: var(--gold);
  background: rgba(255, 201, 71, 0.1);
  text-shadow: 0 0 12px var(--gold-glow);
}

.tab-badge:not([hidden]) {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold-glow);
}

.tab-panels {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.tab-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.tab-panel.hidden { display: none !important; }

.history-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* ---- chat ---- */
.chat-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-msg {
  font-size: 14px;
  line-height: 1.4;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  overflow-wrap: anywhere;
}

.chat-msg .who {
  color: var(--cyan);
  font-weight: 700;
}

.chat-msg .time {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 11px;
  margin-right: 4px;
  white-space: nowrap;
}

.chat-empty {
  margin: auto;
  text-align: center;
  color: var(--dim);
  font-size: 13px;
  padding: 24px 12px;
}

.chat-form {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-form input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 14px;
  font: 15px var(--font);
}

.chat-form input:focus {
  outline: none;
  border-color: var(--purple);
}

.chat-form input:disabled { color: var(--dim); }

/* ---- who's playing ---- */
.players-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 8px;
  flex-shrink: 0;
}

.section-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.pill-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.05);
  white-space: nowrap;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse-dot 1.2s ease infinite;
}

.players-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: auto;   /* safety net: a very wide profit scrolls instead of being cut off */
  -webkit-overflow-scrolling: touch;
}

/* ---- tables ---- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }

th, td {
  padding: 9px 12px;
  text-align: left;
  white-space: nowrap;
}

/* Players table: compact so name / out at / bet / profit always fit side by side. */
.players th, .players td { padding: 8px 8px; }
.players th:first-child, .players td:first-child { padding-left: 12px; }
.players th:last-child, .players td:last-child { padding-right: 12px; }
.players td:first-child { max-width: 96px; overflow: hidden; text-overflow: ellipsis; }

th {
  color: var(--dim);
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(18, 18, 28, 0.97);
}

td {
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 12px;
}

td:first-child { font-family: var(--font); font-weight: 500; }
.num { text-align: right; }
tr.won td { color: var(--accent); }
tr.lost td { color: var(--danger); }
tr.me td { background: rgba(0, 212, 255, 0.06); }
tr.me td:first-child { color: var(--cyan); font-weight: 700; }
td.empty { color: var(--muted); font-family: var(--font); white-space: normal; text-align: center; padding: 22px 12px; }

/* ---- bet card (in the flow, right under the past rounds) ---- */
.bet-dock {
  padding: 10px;
  border-radius: var(--radius);
}

.bet-dock.signed-out .bet-grid { display: none; }

.bet-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 8px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.field input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 12px;
  font: 600 16px var(--mono);
  transition: border-color 0.15s, box-shadow 0.15s;
  -moz-appearance: textfield;
}

.field input::-webkit-outer-spin-button,
.field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 230, 118, 0.15);
}

.chip-row { display: flex; gap: 4px; }

.chip-btn {
  flex: 1;
  min-height: 32px;
  padding: 0 6px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s;
}

.chip-btn:active { transform: scale(0.96); }
.chip-btn:hover { color: var(--text); border-color: var(--border-bright); }

/* ---- main CTA ---- */
.bet-cta {
  width: 100%;
  min-height: 54px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #041208;
  background: linear-gradient(135deg, #00e676 0%, #00c853 50%, #69f0ae 100%);
  box-shadow: 0 4px 20px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.3);
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, filter 0.12s;
  padding: 0 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bet-cta:hover:not(:disabled) { filter: brightness(1.05); }
.bet-cta:active:not(:disabled) { transform: scale(0.98); }
.bet-cta:disabled {
  background: var(--surface-hover);
  color: var(--dim);
  box-shadow: none;
  cursor: default;
}

.bet-cta.cashout {
  color: #1a1000;
  background: linear-gradient(135deg, #ffc947 0%, #ff9800 50%, #ffe082 100%);
  box-shadow: 0 4px 24px var(--gold-glow);
  animation: cashout-pulse 1s ease infinite;
}

@keyframes cashout-pulse {
  0%, 100% { box-shadow: 0 4px 24px var(--gold-glow); }
  50% { box-shadow: 0 4px 36px rgba(255, 201, 71, 0.6); }
}

.bet-cta.queued {
  background: linear-gradient(135deg, #4c8dff, #00d4ff);
  color: #fff;
  box-shadow: 0 4px 20px rgba(0, 212, 255, 0.35);
}

.bet-cta.login {
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: #fff;
}

.bet-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  line-height: 1.4;
}

.bet-hint:empty { display: none; }

/* Phones: the CTA stays a big thumb target but not a 54px one; the room goes to the chat panel. */
.game-page .bet-cta { min-height: 48px; }

.bet-hint:empty { display: none; }

/* ---- buttons ---- */
.btn-primary, .btn-ghost, .nav-link, .icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.12s;
  border: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  color: #041208;
  padding: 10px 16px;
}

.btn-primary.sm { padding: 10px 14px; font-size: 13px; min-height: 44px; }
.btn-primary:disabled { opacity: 0.45; cursor: default; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 16px;
}

.btn-ghost.sm { padding: 7px 12px; font-size: 12px; }
.btn-ghost:hover { border-color: var(--border-bright); background: rgba(255, 255, 255, 0.04); }

.nav-link {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 12px;
  font-size: 12px;
}

.nav-link.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  border: none;
  color: #041208;
}

.icon-btn {
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 16px;
}

.icon-btn:hover { color: var(--text); }

.hidden { display: none !important; }
[hidden] { display: none !important; }

/* ---- toasts ---- */
.toasts {
  position: fixed;
  top: calc(var(--header-h) + var(--safe-t) + 12px);
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100% - 28px), 420px);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--danger);
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: toast-in 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: auto;
}

.toast-deposit {
  flex-wrap: wrap;
  gap: 6px 10px;
  max-width: min(360px, calc(100vw - 32px));
  padding: 14px 16px;
  line-height: 1.45;
}
.toast-deposit a {
  color: #00e676;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.toast-deposit a:hover { text-decoration: underline; }

.toast.info {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  color: var(--text);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-12px) scale(0.95); }
  to { opacity: 1; transform: none; }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ==========================================================================
   Scrollbars — none on phones (like bustabit), thin and subtle on bigger
   screens so mouse users still see that a list scrolls.
   ========================================================================== */
.game-page, .app-layout, .chat-log, .players-scroll, .history-list, .history-strip, .table-scroll {
  scrollbar-width: none;
}

.game-page::-webkit-scrollbar,
.app-layout::-webkit-scrollbar,
.chat-log::-webkit-scrollbar,
.players-scroll::-webkit-scrollbar,
.history-list::-webkit-scrollbar,
.history-strip::-webkit-scrollbar,
.table-scroll::-webkit-scrollbar { display: none; width: 0; height: 0; }

@media (min-width: 720px) {
  .chat-log, .players-scroll, .history-list, .table-scroll {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
  }

  .chat-log::-webkit-scrollbar,
  .players-scroll::-webkit-scrollbar,
  .history-list::-webkit-scrollbar,
  .table-scroll::-webkit-scrollbar { display: block; width: 6px; height: 6px; }

  .chat-log::-webkit-scrollbar-track,
  .players-scroll::-webkit-scrollbar-track,
  .history-list::-webkit-scrollbar-track,
  .table-scroll::-webkit-scrollbar-track { background: transparent; }

  .chat-log::-webkit-scrollbar-thumb,
  .players-scroll::-webkit-scrollbar-thumb,
  .history-list::-webkit-scrollbar-thumb,
  .table-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.14);
    border-radius: 3px;
  }
}

/* ==========================================================================
   Layout — phone only (< 720px): player list lives inside the tab panel
   ========================================================================== */
@media (max-width: 719.98px) {
  .tab-panels > .players-col {
    flex: 1;
    min-height: 0;
    background: none;
    border: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

/* Short phones (iPhone SE class, or a tall browser bar): squeeze the top so the chat panel keeps
   a usable height. Tap targets stay ≥ 44px; only decoration and spacing shrink. */
@media (max-width: 719.98px) and (max-height: 720px) {
  .app-layout { gap: 6px; padding-top: 6px; }
  .game-stage { height: 104px; }
  .bet-hint { display: none; }
}

/* ==========================================================================
   Layout — tablet (720px+): graph + bet on the left, chat on the right
   ========================================================================== */
@media (min-width: 720px) {
  :root { --gutter: 16px; }

  .phone-only { display: none !important; }
  .game-page .bet-cta { min-height: 54px; }

  /* The shell stays viewport-height so panels scroll inside themselves.
     If the window is shorter than the grid's minimum, the shell scrolls. */
  .game-page { overflow-y: auto; }

  .app-layout {
    overflow: visible;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas:
      "stage   social"
      "dock    social"
      "players social";
    gap: 12px;
    padding-bottom: 12px;
    min-height: 640px;
  }

  .stage-col   { grid-area: stage; }
  .bet-dock    { grid-area: dock; }
  .social-col  { grid-area: social; min-height: 0; }
  .players-col { grid-area: players; border-radius: var(--radius); overflow: hidden; }

  .game-stage { height: clamp(260px, 38vh, 420px); }

  .bet-dock { padding: 14px; }
  .players td:first-child { max-width: 160px; }
  .players th, .players td { padding: 9px 12px; }
}

/* ==========================================================================
   Layout — desktop (1024px+): bet + players | graph | chat
   ========================================================================== */
@media (min-width: 1024px) {
  :root { --gutter: 20px; }

  .header-account .me-name { display: inline-block; }

  .app-layout {
    grid-template-columns: 340px minmax(0, 1fr) 340px;
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
      "dock    stage social"
      "players stage social";
    gap: 14px;
    min-height: 560px;
  }

  .game-stage {
    flex: 1 1 0;
    height: auto;
    min-height: 320px;
  }

  .bet-grid { grid-template-columns: 1fr; gap: 12px; }
  .players th, .players td { padding: 9px 8px; }
  .players td:first-child { max-width: 110px; }
}

@media (min-width: 1280px) {
  .app-layout { grid-template-columns: 360px minmax(0, 1fr) 380px; }
  .bet-grid { grid-template-columns: 1fr 1fr; }
  .players td:first-child { max-width: 130px; }
}

/* ==========================================================================
   Auth & wallet pages
   ========================================================================== */
.auth-page, body:not(.game-page) {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  position: relative;
  z-index: 1;
}

.auth-page .app-header { position: relative; }

/* ==========================================================================
   Home page
   ========================================================================== */
/* App-shell home (2026-09-20): wallet strip, game tiles, phone tab bar. Almost no text. */
.home {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px var(--gutter) calc(24px + var(--safe-b));
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* room for the fixed tab bar on phones */
@media (max-width: 719.98px) {
  .home { padding-bottom: calc(84px + var(--safe-b)); }
}

.wallet-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-lg);
}

.ws-balance {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.ws-balance.when-in, .ws-balance.when-out { display: flex; }
html:not(.signed-in) .ws-balance.when-in { display: none; }
html.signed-in .ws-balance.when-out { display: none; }

.ws-coin { width: 40px; height: 40px; flex-shrink: 0; filter: drop-shadow(0 0 10px rgba(247, 183, 51, 0.45)); }
.ws-amt { display: flex; flex-direction: column; min-width: 0; line-height: 1.1; }
.ws-amt small { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.ws-amt b { font-family: var(--mono); font-size: 18px; font-weight: 800; color: var(--gold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-balance.when-out .ws-amt b { font-family: var(--font); color: var(--accent); }
.ws-arrow { font-size: 22px; color: var(--muted); line-height: 1; }

.ws-actions { display: flex; gap: 4px; flex-shrink: 0; }
.ws-actions a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 58px;
  padding: 4px 2px;
  text-decoration: none;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  border-radius: var(--radius-sm);
}
.ws-actions a:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.ws-ico { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; background: rgba(255, 255, 255, 0.06); color: var(--text); }
.ws-ico svg { width: 20px; height: 20px; }

.shelf { display: flex; flex-direction: column; gap: 10px; }
.shelf-head { display: flex; align-items: center; justify-content: space-between; padding: 0 2px; }
.shelf-head h2 { margin: 0; font-size: 17px; font-weight: 800; display: flex; align-items: center; gap: 6px; }
.shelf-emoji { font-size: 16px; }
.shelf-note { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--accent); }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.gtile {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1.12;
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--border-bright);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.4);
  transition: transform 0.12s, box-shadow 0.12s;
}
.gtile:active { transform: scale(0.98); }
a.gtile:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5); }

.gtile.rocket { background: radial-gradient(ellipse 90% 60% at 50% 100%, rgba(0, 230, 118, 0.28), transparent 60%), linear-gradient(160deg, #0d2a1c, #07070c 70%); }
.gtile.ab { background: radial-gradient(ellipse 90% 60% at 50% 0%, rgba(255, 201, 71, 0.3), transparent 60%), linear-gradient(160deg, #3a1210, #12060a 75%); }
.gtile.teenpatti { background: radial-gradient(ellipse 90% 60% at 50% 0%, rgba(168, 85, 247, 0.32), transparent 60%), linear-gradient(160deg, #23113f, #0b0714 75%); }
.gtile.ludo { background: radial-gradient(ellipse 90% 60% at 50% 100%, rgba(0, 212, 255, 0.28), transparent 60%), linear-gradient(160deg, #0b2440, #07070c 75%); }

.gtile-art { position: absolute; inset: 0; width: 100%; height: 100%; }

.gtile-cards { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.gtile-cards .card { --card-w: 48px; --card-h: 68px; position: absolute; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45); }
.gtile-cards .card .card-suit { font-size: 24px; }
.gtile-cards .card .card-rank { font-size: 12px; }
.gtile-cards .card:nth-child(1) { transform: translate(-44px, -6px) rotate(-14deg); }
.gtile-cards .card:nth-child(2) { transform: translate(0, -14px); z-index: 1; }
.gtile-cards .card:nth-child(3) { transform: translate(44px, -6px) rotate(14deg); }
.gtile-cards.fan .card:nth-child(1) { transform: translate(-30px, 0) rotate(-18deg); }
.gtile-cards.fan .card:nth-child(2) { transform: translate(0, -10px); }
.gtile-cards.fan .card:nth-child(3) { transform: translate(30px, 0) rotate(18deg); }

.gtile-name {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 26px 12px 10px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.01em;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.7));
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}

.gtile-badge {
  position: absolute;
  top: 8px; right: 8px;
  z-index: 2;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}
.gtile-badge.live { color: #041208; background: var(--accent); box-shadow: 0 0 12px var(--accent-glow); }
.gtile-badge.soon { color: var(--text); background: rgba(255, 255, 255, 0.14); }

.gtile.soon { cursor: default; }
.gtile.soon .gtile-cards, .gtile.soon .gtile-art { opacity: 0.55; filter: saturate(0.6); }

/* Phone tab bar (ui-rules.md "One bar"): Home / Rocket / Andar Bahar / Money (Sign up when signed out).
   Injected on every player page by server/index.js page(). Fixed on scrolling pages; on the fixed-height
   game and account shells it is the last flex row instead, so nothing needs bottom padding there. */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 6px 4px calc(6px + var(--safe-b));
  background: rgba(7, 7, 12, 0.92);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  border-top: 1px solid var(--border);
}
.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-height: 48px;
  justify-content: center;
  text-decoration: none;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}
.tabbar svg { width: 22px; height: 22px; }
.tabbar a.active, .tabbar a.cta { color: var(--gold); }
.game-page .tabbar, .account-page .tabbar { position: static; flex-shrink: 0; }
@media (max-width: 719.98px) {
  .game-page .app-layout { padding-bottom: 8px; }
  .wallet-wrap, .doc { padding-bottom: calc(84px + var(--safe-b)); }
}
.ws-actions a.when-in { display: flex; }
html:not(.signed-in) .ws-actions a.when-in { display: none; }

@media (min-width: 720px) {
  .tabbar { display: none; }
  /* A launcher, not a brochure: two big tiles per row in a centred shell. */
  .home { max-width: 820px; padding-top: 28px; gap: 26px; }
  .wallet-strip { padding: 14px 18px; }
  .ws-actions { gap: 10px; }
  .ws-actions a { flex-direction: row; gap: 8px; font-size: 13px; padding: 8px 12px; }
  .tiles { gap: 16px; }
  .gtile { aspect-ratio: 1.45 / 1; }
  .gtile-name { font-size: 20px; padding: 30px 16px 14px; }
  .gtile-cards .card { --card-w: 60px; --card-h: 84px; }
  .gtile-cards .card .card-suit { font-size: 30px; }
  .shelf-head h2 { font-size: 20px; }
}

.cta-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  padding: 0 28px;
  text-decoration: none;
}

.btn-ghost.lg {
  min-height: 54px;
  padding: 0 22px;
  border-radius: var(--radius);
  font-size: 15px;
}

.section-title {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

/* Docs (Help / Terms / Privacy) end with one dim 18+ line that links the other two; no footer bar. */
.doc-note { margin-top: 32px; font-size: 12px; color: var(--dim); }
.doc-note a { color: var(--muted); text-decoration: none; font-weight: 600; }

/* ---- simple document pages (help, terms, privacy) ---- */
.doc {
  flex: 1;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 28px var(--gutter) 48px;
}

.doc h1 { margin: 0 0 6px; font-size: 32px; font-weight: 800; }
.doc-updated { margin: 0 0 18px; font-size: 13px; color: var(--dim); }
.doc h2 { margin: 30px 0 10px; font-size: 18px; font-weight: 700; }
.doc p, .doc li { font-size: 15px; line-height: 1.6; color: #c9c9d8; }
.doc p { margin: 0 0 12px; }
.doc ul, .doc ol { margin: 0 0 12px; padding-left: 22px; }
.doc li { margin-bottom: 6px; }
.doc a { color: var(--cyan); }


.auth-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px calc(24px + var(--safe-b));
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 28px 22px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-card h1 {
  margin: 0 0 4px;
  font-size: 26px;
  font-weight: 800;
  background: linear-gradient(90deg, var(--text), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-card label, .wallet-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.auth-card label small, .wallet-card label small {
  text-transform: none;
  font-weight: 400;
  letter-spacing: 0;
}

.auth-card input, .wallet-card input {
  min-height: 48px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 12px 14px;
  font: 16px var(--font);
}

.auth-card input:focus, .wallet-card input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 230, 118, 0.12);
}

.form-error { color: var(--danger); font-size: 13px; min-height: 18px; line-height: 1.4; }
.form-error:empty { min-height: 0; }

.auth-alt {
  margin: 0;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}

.auth-sub {
  margin: -8px 0 8px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.auth-alt a { color: var(--cyan); font-weight: 600; }

/* ---- wallet ---- */
.wallet-wrap {
  flex: 1;
  padding: 16px 16px calc(24px + var(--safe-b));
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

.wallet-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 18px 20px;
  border-radius: var(--radius);
}

.wallet-hero .who { margin: 0; font-size: 14px; color: var(--muted); }
.wallet-hero .who strong { color: var(--text); font-size: 16px; }

.wallet-hero .big-balance {
  margin: 0;
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
  white-space: nowrap;
}

.wallet-hero .big-balance small {
  display: block;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.wallet-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }

.wallet-card {
  padding: 18px;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.wallet-card h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.card-sub {
  margin: -6px 0 4px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.45;
}

.quick-amounts { display: flex; gap: 6px; flex-wrap: wrap; }
.quick-amounts .chip-btn { flex: 1 1 auto; min-height: 36px; font-size: 12px; }

.withdraw-btn {
  background: linear-gradient(135deg, #ffc947, #ff9800) !important;
  color: #1a1000 !important;
  box-shadow: 0 4px 20px var(--gold-glow) !important;
}

.wallet-card .hint { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.45; }
.wallet-card form { display: flex; flex-direction: column; gap: 14px; }

/* ---- pay panel (waiting for a UPI payment) ---- */
.pay-panel { display: flex; flex-direction: column; gap: 14px; }
.pay-title { margin: 0; font-size: 16px; color: var(--muted); }
.pay-title strong { font-family: var(--mono); font-size: 26px; color: var(--accent); display: block; margin-top: 4px; }
.pay-buttons { display: flex; flex-direction: column; gap: 8px; }
.pay-open { min-height: 50px; font-size: 15px; border-radius: var(--radius-sm); }
.pay-upi { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 13px; color: var(--muted); }
.pay-upi code {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  user-select: all;
}
.pay-upi .chip-btn { flex: 0 0 auto; min-height: 32px; padding: 0 12px; }
.pay-qr { display: none; align-self: center; padding: 10px; background: #fff; border-radius: 12px; }
.pay-qr img, .pay-qr canvas { display: block; }
.pay-wait { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
/* The UTR box stays hidden until a payment attempt has had time to land (js/wallet.js, PAYMENTS.md). */
.utr-offer { align-self: center; font-size: 13px; padding: 8px 12px; }
.utr-form { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; border-top: 1px solid var(--border); }
.utr-form input { font-family: var(--mono); letter-spacing: 0.05em; }
.pay-panel .nav-text { align-self: center; }

/* ---- withdraw: UPI / bank toggle ---- */
.method-toggle { display: flex; gap: 6px; }
.method-btn {
  flex: 1;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-hover);
  color: var(--muted);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.method-btn.active { color: var(--text); border-color: var(--gold); background: rgba(255, 201, 71, 0.1); }
#method-bank { display: flex; flex-direction: column; gap: 14px; }
#method-bank[hidden], #method-upi[hidden] { display: none; }

@media (min-width: 720px) {
  .pay-qr { display: block; }
  .pay-buttons { flex-direction: row; flex-wrap: wrap; }
  .pay-buttons .pay-open { flex: 1 1 160px; }
}

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -18px; padding: 0 18px; }

.status-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.06);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-pill.ok { color: var(--accent); }
.status-pill.warn { color: var(--gold); }
.status-pill.bad { color: var(--danger); }
.status-pill.muted { color: var(--muted); }

td.pos { color: var(--accent); }
td.neg { color: var(--danger); }
td.muted, .muted { color: var(--muted); }

/* Phone: wallet tables become stacked cards so nothing scrolls sideways. */
@media (max-width: 599.98px) {
  .stack-table thead { display: none; }
  .stack-table tr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
    padding: 10px 0;
    border-top: 1px solid var(--border);
  }
  .stack-table td {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0;
    border: none;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .stack-table td.num { text-align: left; }
  .stack-table td:empty { display: none; }
  .stack-table td[data-label]::before {
    content: attr(data-label);
    font-family: var(--font);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--dim);
  }
  .stack-table td.grow { flex: 1 1 100%; }
  .stack-table td.empty { width: 100%; text-align: center; padding: 20px 0; }
}

@media (min-width: 720px) {
  .wallet-wrap { padding: 20px var(--gutter) 32px; }
  .wallet-grid { grid-template-columns: 1fr 1fr; }
  .wallet-card { padding: 22px; }
  .table-scroll { margin: 0 -22px; padding: 0 22px; }
  .wallet-hero .big-balance { font-size: 32px; }
}

/* ==========================================================================
   Game switcher — a pill row at the top of the layout on phones, a small link
   next to the connection pill on tablet/desktop.
   ========================================================================== */
.header-status { display: flex; align-items: center; gap: 8px; }

.game-switch {
  display: none;
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.game-switch:hover { color: var(--text); border-color: var(--border-bright); }

@media (min-width: 720px) {
  .game-switch { display: inline-flex; }
}

/* ==========================================================================
   Andar Bahar — the table
   Phone: joker + status on top, then two full-width rows (Andar / Bahar) of cards.
   ========================================================================== */
:root {
  --andar: #00d4ff;
  --andar-glow: rgba(0, 212, 255, 0.4);
  --bahar: #ffc947;
  --bahar-glow: rgba(255, 201, 71, 0.4);
  --card-w: 40px;
  --card-h: 56px;
}

.ab-stage {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  /* Phone: joker row + two card rows, sized so the bet card and chat still fit (mobile rule 9). */
  height: clamp(244px, 33vh, 300px);
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(255, 201, 71, 0.07), transparent 60%),
    radial-gradient(ellipse 70% 50% at 50% 100%, rgba(0, 212, 255, 0.07), transparent 60%),
    linear-gradient(180deg, rgba(14, 14, 22, 0.95) 0%, rgba(7, 7, 12, 0.98) 100%);
}

@supports (height: 1dvh) {
  .ab-stage { height: clamp(244px, 33dvh, 300px); }
}

/* Phone card size + table height: see "Phone compaction" at the END of this file. Tablet/desktop set their own
   sizes further down. */

.ab-stage > * { position: relative; z-index: 3; }
.ab-stage .stage-grid { z-index: 1; }

.ab-top {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.ab-joker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.ab-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.ab-status {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
}

.ab-kicker {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.ab-main {
  font-family: var(--mono);
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}

.ab-sub {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.ab-status.winner .ab-main { text-transform: uppercase; letter-spacing: 0.04em; }
.ab-status.winner.andar .ab-main { color: var(--andar); text-shadow: 0 0 18px var(--andar-glow); }
.ab-status.winner.bahar .ab-main { color: var(--bahar); text-shadow: 0 0 18px var(--bahar-glow); }
.ab-status.me-won .ab-sub { color: var(--accent); font-weight: 800; }
.ab-status.me-lost .ab-sub { color: var(--danger); font-weight: 800; }

.ab-bar {
  width: min(220px, 100%);
  height: 4px;
  margin-top: 6px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.ab-bar-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.1s linear;
}

/* ---- the two piles ---- */
.ab-piles {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  gap: 6px;
}

.ab-pile {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: calc(var(--card-h) + 14px);
  padding: 6px 8px 6px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.025);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s, opacity 0.3s;
}

.ab-pile-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 62px;
  flex-shrink: 0;
}

.ab-side-name {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.ab-pile[data-side="andar"] .ab-side-name { color: var(--andar); }
.ab-pile[data-side="bahar"] .ab-side-name { color: var(--bahar); }

.ab-side-meta {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ab-pile.turn { background: rgba(255, 255, 255, 0.05); border-color: var(--border-bright); }
.ab-pile[data-side="andar"].won { border-color: var(--andar); box-shadow: 0 0 22px var(--andar-glow), inset 0 0 30px rgba(0, 212, 255, 0.08); }
.ab-pile[data-side="bahar"].won { border-color: var(--bahar); box-shadow: 0 0 22px var(--bahar-glow), inset 0 0 30px rgba(255, 201, 71, 0.08); }
.ab-pile.lost { opacity: 0.55; }

.ab-cards {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.ab-cards .card + .card { margin-left: 5px; }
.ab-cards.dense .card + .card { margin-left: -12px; }

/* ---- a playing card ---- */
.card {
  position: relative;
  flex-shrink: 0;
  width: var(--card-w);
  height: var(--card-h);
  border-radius: 6px;
  background: linear-gradient(160deg, #fbfbff 0%, #e9e9f2 100%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  color: #15151f;
  font-family: var(--mono);
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-style: preserve-3d;
}

.card.red { color: #d61f2c; }
.card.black { color: #15151f; }

.card .card-rank {
  position: absolute;
  top: 3px;
  left: 4px;
  font-size: 11px;
  line-height: 1;
}

.card .card-rank.flip-corner {
  top: auto;
  left: auto;
  right: 4px;
  bottom: 3px;
  transform: rotate(180deg);
}

.card .card-suit {
  font-size: 20px;
  line-height: 1;
  font-family: "Segoe UI Symbol", "Apple Symbols", "Noto Sans Symbols2", var(--font);
}

.card.back {
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.06) 0 4px, transparent 4px 8px),
    linear-gradient(160deg, #2a2a48 0%, #14142a 100%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45), inset 0 0 0 2px rgba(255, 255, 255, 0.08);
}

.card.joker {
  width: calc(var(--card-w) + 12px);
  height: calc(var(--card-h) + 16px);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5), 0 0 0 2px var(--gold), 0 0 18px var(--gold-glow);
}

.card.joker .card-rank { font-size: 13px; }
.card.joker .card-suit { font-size: 26px; }
.ab-joker .card.back { width: calc(var(--card-w) + 12px); height: calc(var(--card-h) + 16px); border-radius: 8px; }

.card.match {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45), 0 0 0 2px var(--accent), 0 0 18px var(--accent-glow);
  animation: match-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.card.flip { animation: card-flip 0.38s ease-out; }
.card.joker.flip { animation: card-flip 0.5s ease-out; }
.card.match.flip { animation: card-flip 0.38s ease-out, match-pop 0.6s 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }

@keyframes card-flip {
  from { transform: rotateY(90deg) translateY(-6px); opacity: 0; }
  60% { opacity: 1; }
  to { transform: none; }
}

@keyframes match-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.16); }
  100% { transform: scale(1); }
}

/* ---- past rounds strip: A / B chips ---- */
.chip.andar { background: rgba(0, 212, 255, 0.12); color: var(--andar); border-color: rgba(0, 212, 255, 0.3); min-width: 30px; text-align: center; }
.chip.bahar { background: rgba(255, 201, 71, 0.12); color: var(--bahar); border-color: rgba(255, 201, 71, 0.3); min-width: 30px; text-align: center; }

/* ---- side tags in tables ---- */
.side-tag {
  display: inline-block;
  font-family: var(--font);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 7px;
  border-radius: var(--radius-full);
}

.side-tag.andar { color: var(--andar); background: rgba(0, 212, 255, 0.1); }
.side-tag.bahar { color: var(--bahar); background: rgba(255, 201, 71, 0.1); }
tr.won .side-tag, tr.lost .side-tag { opacity: 0.9; }

.ab-players td:first-child { max-width: 88px; }

/* ---- bet card: pick a side ---- */
.bet-dock.signed-out .ab-side-pick { display: none; }

.ab-side-pick {
  display: grid;
  /* minmax(0, …) so a long "8 bets · ₹3,148" ellipsizes instead of pushing the button off the card */
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}

.side-btn { min-width: 0; overflow: hidden; }

.side-btn {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-hover);
  color: var(--muted);
  font-family: var(--font);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.12s, background 0.12s, box-shadow 0.12s;
}

.side-btn .side-title {
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text);
}

.side-btn .side-count {
  flex: 1 1 auto;
  min-width: 0;
  text-align: right;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-btn.andar .side-title { color: var(--andar); }
.side-btn.bahar .side-title { color: var(--bahar); }
.side-btn.andar.active { border-color: var(--andar); background: rgba(0, 212, 255, 0.1); box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.12); }
.side-btn.bahar.active { border-color: var(--bahar); background: rgba(255, 201, 71, 0.1); box-shadow: 0 0 0 3px rgba(255, 201, 71, 0.12); }
.side-btn:active { transform: scale(0.98); }

.ab-payout-box {
  min-height: 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-bright);
  background: rgba(255, 255, 255, 0.02);
}

.ab-payout-x { font-family: var(--mono); font-weight: 800; font-size: 16px; color: var(--text); line-height: 1; }
.ab-payout-note { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.bet-cta.andar {
  color: #04202a;
  background: linear-gradient(135deg, #00d4ff 0%, #00a8d6 50%, #7ee8ff 100%);
  box-shadow: 0 4px 20px var(--andar-glow), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.bet-cta.bahar {
  color: #1a1000;
  background: linear-gradient(135deg, #ffc947 0%, #ff9800 50%, #ffe082 100%);
  box-shadow: 0 4px 20px var(--bahar-glow), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

@media (min-width: 720px) {
  :root { --card-w: 48px; --card-h: 68px; }
  .ab-stage { height: clamp(300px, 42vh, 440px); padding: 16px; gap: 12px; }
  .ab-main { font-size: 42px; }
  .ab-pile-head { width: 84px; }
  .ab-side-name { font-size: 14px; }
  .ab-side-meta { font-size: 11px; }
  .card .card-rank { font-size: 12px; }
  .card .card-suit { font-size: 24px; }
  .ab-cards .card + .card { margin-left: 6px; }
  .ab-cards.dense .card + .card { margin-left: -8px; }
  .ab-players td:first-child { max-width: 140px; }
}

@media (min-width: 1024px) {
  :root { --card-w: 56px; --card-h: 80px; }
  .ab-stage { height: auto; min-height: 340px; flex: 1 1 0; padding: 20px; }
  .ab-piles { justify-content: center; gap: 14px; }
  .ab-pile { min-height: calc(var(--card-h) + 22px); padding: 10px 12px 10px 14px; }
  .ab-pile-head { width: 96px; }
  .ab-main { font-size: 48px; }
  .card .card-rank { font-size: 13px; }
  .card .card-suit { font-size: 28px; }
  .ab-cards .card + .card { margin-left: 8px; }
  .ab-cards.dense .card + .card { margin-left: 2px; }
  .ab-bet-grid { grid-template-columns: 1fr 1fr; }
  .ab-players td:first-child { max-width: 100px; }
}

/* ==========================================================================
   Admin dashboard (/admin) — internal, desktop-first but usable on a phone.
   ========================================================================== */
.admin-tag { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em; color: var(--gold); padding: 4px 10px; border: 1px solid rgba(255, 201, 71, 0.4); border-radius: var(--radius-full); }
.admin-wrap { flex: 1; width: 100%; max-width: 1400px; margin: 0 auto; padding: 14px var(--gutter) calc(30px + var(--safe-b)); display: flex; flex-direction: column; gap: 14px; }
.admin-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.admin-top h1 { margin: 0; font-size: 24px; font-weight: 800; }
.admin-updated { font-size: 12px; color: var(--dim); }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat { padding: 12px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat small { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.stat b { font-family: var(--mono); font-size: 26px; font-weight: 800; line-height: 1.1; }
.stat span { font-size: 11px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat.hot b { color: var(--accent); }

.admin-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.admin-card { padding: 14px; border-radius: var(--radius); display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.admin-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.admin-card-head h2 { margin: 0; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.admin-card-head .count { color: var(--dim); font-weight: 600; text-transform: none; letter-spacing: 0; }
.legend { font-size: 11px; color: var(--dim); display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.legend .lg-vis { background: var(--accent); }
.legend .lg-view { background: rgba(255, 255, 255, 0.18); }

.bars { display: grid; grid-template-columns: repeat(30, 1fr); gap: 3px; height: 150px; align-items: end; padding-bottom: 16px; position: relative; }
.bar-col { position: relative; height: 100%; display: flex; align-items: flex-end; min-width: 0; }
.bar { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 3px 3px 0 0; min-height: 1px; }
.bar.view { background: rgba(255, 255, 255, 0.14); }
.bar.vis { background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }
.bar-label { position: absolute; left: 0; right: 0; bottom: -16px; text-align: center; font-family: var(--mono); font-size: 9px; color: var(--dim); }
.bar-col:nth-child(odd) .bar-label { display: none; }

.split { display: flex; flex-direction: column; gap: 6px; }
.split-row { display: grid; grid-template-columns: minmax(80px, 1fr) 2fr auto; align-items: center; gap: 8px; font-size: 13px; }
.split-k { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.split-bar { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.06); overflow: hidden; }
.split-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--cyan), var(--accent)); border-radius: 4px; }
.split-n { font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.split-n small { color: var(--dim); }
.admin-empty { margin: 0; font-size: 13px; color: var(--dim); }

.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th { text-align: left; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 6px 8px; white-space: nowrap; }
.admin-table td { padding: 7px 8px; border-top: 1px solid var(--border); vertical-align: top; white-space: nowrap; }
.admin-table td.num, .admin-table th.num { text-align: right; font-family: var(--mono); font-size: 12px; }
.admin-table td small { color: var(--dim); font-size: 11px; }
.admin-table .mono { font-family: var(--mono); font-size: 12px; }
.admin-table .pos { color: var(--accent); }
.admin-table .neg { color: var(--danger); }
.admin-table tr.is-admin td { background: rgba(255, 201, 71, 0.05); }
.admin-table td.empty { text-align: center; color: var(--muted); padding: 20px; }
.admin-table.mini td:first-child { color: var(--muted); }
/* Player timeline drawer (admin.html, js/admin.js): click a row in the users table. */
.admin-table tr[data-id] { cursor: pointer; }
.admin-table tr[data-id]:hover td { background: rgba(255, 255, 255, 0.035); }
.admin-drawer { position: fixed; inset: 0; z-index: 200; display: flex; justify-content: flex-end; }
.admin-drawer-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); }
.admin-drawer-panel {
  position: relative;
  width: min(580px, 100%);
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface-solid);
  border-left: 1px solid var(--border);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.5);
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.drawer-head h2 { margin: 0; font-size: 16px; font-weight: 800; }
.drawer-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; font-size: 13px; line-height: 1.45; }
.tl-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.tl-landing { font-size: 12px; word-break: break-all; }
.tl-session { margin-bottom: 16px; }
.tl-session h3 { margin: 0 0 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.tl-row { display: grid; grid-template-columns: 64px 22px 1fr; gap: 6px; align-items: baseline; padding: 5px 0; border-top: 1px solid var(--border); }
.tl-time { font-family: var(--mono); font-size: 11px; color: var(--dim); }
.tl-text { min-width: 0; overflow-wrap: anywhere; }
.tl-text small { color: var(--dim); }
.tl-row.anon { opacity: 0.7; }
.tl-row.signup .tl-text, .tl-row.deposit .tl-text { color: var(--accent); }
.tl-row.withdraw .tl-text { color: var(--gold); }
.tl-row.chat .tl-text { font-style: italic; }
.tl-row.chat.ghost .tl-text { color: var(--muted); }
body.drawer-open { overflow: hidden; }

.scope-note { margin: -8px 0 12px; text-align: left; }

/* Admin → Player chat (/admin/chat, admin-chat.html): one card per player, their private thread oldest first. */
.chat-note { margin: -6px 0 14px; font-size: 13px; }
.chat-card { margin-bottom: 14px; }
.chat-card .admin-card-head h2 small { font-weight: 500; font-size: 12px; }
.chat-thread { display: flex; flex-direction: column; }
.ct-row { display: grid; grid-template-columns: 64px 130px 1fr; gap: 8px; align-items: baseline; padding: 5px 0; border-top: 1px solid var(--border); font-size: 13px; }
.ct-time { font-family: var(--mono); font-size: 11px; color: var(--dim); }
.ct-who { font-weight: 700; color: var(--cyan); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-row.ghost .ct-who { color: var(--muted); font-weight: 600; }
.ct-row.ghost .ct-text { color: var(--muted); }
.ct-text { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 719.98px) {
  .ct-row { grid-template-columns: 56px 1fr; }
  .ct-text { grid-column: 1 / -1; padding-left: 64px; }
}

/* Retention funnel (admin.html, retention.md): sits between the grid and the users table; labels may wrap on phones. */
.funnel-table td:first-child { white-space: normal; min-width: 150px; }
.funnel-table td.num { white-space: nowrap; }
.pill-admin { font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--gold); border: 1px solid rgba(255, 201, 71, 0.4); border-radius: var(--radius-full); padding: 1px 6px; vertical-align: middle; }
.dev { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; padding: 2px 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.08); }
.dev.phone { color: var(--accent); background: rgba(0, 230, 118, 0.12); }
.dev.tablet { color: var(--cyan); background: rgba(0, 212, 255, 0.12); }
.dev.desktop { color: var(--gold); background: rgba(255, 201, 71, 0.12); }
.dim { color: var(--dim); }

.admin-search { display: flex; gap: 6px; }
.admin-search input { min-height: 36px; min-width: 200px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); padding: 6px 12px; font: 14px var(--font); }
.admin-search .btn-ghost.sm { min-height: 36px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 12px; color: var(--muted); }
.pager button:disabled { opacity: 0.4; cursor: default; }

@media (min-width: 720px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .admin-grid { grid-template-columns: 1fr 1fr; }
  .admin-card.wide { grid-column: 1 / -1; }
}
@media (min-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(6, 1fr); }
  .admin-grid { grid-template-columns: 2fr 1fr 1fr; }
  .admin-card.wide { grid-column: 1 / -1; }
  .bar-col:nth-child(odd) .bar-label { display: block; }
}

/* ==========================================================================
   Account page (/account) — where a signed-in player lands. Three big tiles and the
   only Sign out button on the site. One screen tall on phones (mobile rule 9).
   ========================================================================== */
.account-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 12px var(--gutter) calc(12px + var(--safe-b));
}

.account-hero {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 4px 0;
}

.account-hero .who { margin: 0; font-size: 18px; color: var(--muted); min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.who-greet { display: inline; color: var(--muted); }
.who-greet strong { display: inline; color: var(--text); font-size: 20px; font-weight: 800; }
.home-who { margin: 0 0 12px; font-size: 18px; color: var(--muted); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.home-hero { margin: 0 0 14px; padding: 14px 16px; }
.home-add-cta { margin-top: 4px; width: 100%; text-align: center; text-decoration: none; }
#sp-home-wrap { margin-bottom: 14px; }

.account-hero .big-balance {
  margin: 0;
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 800;
  color: var(--accent);
  white-space: nowrap;
  text-align: right;
}

.account-hero .big-balance small {
  display: block;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.account-tiles {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tile {
  flex: 1 1 0;
  min-height: 84px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 16px 48px 16px 20px;
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--text);
  overflow: hidden;
  transition: transform 0.12s, border-color 0.12s;
}

.tile:active { transform: scale(0.99); }
.tile::after {
  content: "›";
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 30px;
  line-height: 1;
  color: var(--muted);
}

.tile-tag { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em; }
.tile-title { font-size: 24px; font-weight: 800; line-height: 1.1; }
.tile-sub { font-size: 13px; color: var(--muted); }

.tile-rocket { border-color: rgba(0, 230, 118, 0.35); background: linear-gradient(135deg, rgba(0, 230, 118, 0.16), rgba(0, 230, 118, 0.03)); }
.tile-rocket .tile-tag { color: var(--accent); }
.tile-ab { border-color: rgba(255, 201, 71, 0.35); background: linear-gradient(135deg, rgba(255, 201, 71, 0.16), rgba(255, 201, 71, 0.03)); }
.tile-ab .tile-tag { color: var(--bahar); }
.tile-money { border-color: rgba(0, 212, 255, 0.35); background: linear-gradient(135deg, rgba(0, 212, 255, 0.16), rgba(0, 212, 255, 0.03)); }
.tile-money .tile-tag { color: var(--cyan); }

/* One dim line under the tiles: Help · Terms · Privacy · Sign out. Each word is its own tap target. */
.account-links { flex-shrink: 0; margin: 0; text-align: center; font-size: 12px; color: var(--dim); }
.account-links a, .account-links .link-btn { display: inline-block; padding: 10px 4px; color: var(--muted); text-decoration: none; font: inherit; font-weight: 600; }
.account-links .link-btn { background: none; border: 0; cursor: pointer; }

@media (max-width: 719.98px) {
  .account-page { height: 100dvh; overflow: hidden; }
}

@media (min-width: 720px) {
  .account-wrap { padding-top: 36px; gap: 22px; }
  .account-hero .who strong { font-size: 24px; }
  .account-hero .big-balance { font-size: 32px; }
  .account-tiles { flex: 0 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .tile { min-height: 160px; padding: 24px 56px 24px 24px; }
  .tile-title { font-size: 28px; }
  .tile-money { grid-column: 1 / -1; min-height: 120px; }
  .account-links { padding-top: 12px; }
}

/* ---- webview escape page (escape.html + js/escape.js, served only to the Android FB/IG in-app browser; retention.md) ---- */
.escape-page { display: flex; flex-direction: column; }
.escape-wrap {
  flex: 1;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 40px 24px calc(32px + var(--safe-b));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
}
.escape-logo { width: 84px; height: 84px; filter: drop-shadow(0 8px 28px var(--gold-glow)); }
.escape-brand { margin: 0; font-size: 30px; }
.escape-wrap h1 { margin: 10px 0 0; font-size: 23px; line-height: 1.25; }
.escape-sub { margin: 0; font-size: 15px; line-height: 1.45; color: var(--muted); }
.escape-btn { margin-top: 16px; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.escape-hint { margin: 0; min-height: 18px; font-size: 13px; color: var(--muted); }
.escape-fallback {
  margin-top: 6px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 14px;
  line-height: 1.5;
}
.escape-fallback p { margin: 0 0 10px; }
.escape-arrow { font-size: 28px; line-height: 1; color: var(--gold); }
.escape-continue { font-size: 13px; }
/* Two buttons on the interstitial since 2026-10-05: the APK first (gold), Chrome second (ghost). */
.escape-btn.escape-app { background: linear-gradient(135deg, #ffc947, #ff9800); color: #1a1000; box-shadow: 0 6px 24px var(--gold-glow); width: 100%; max-width: 360px; }
.escape-btn.escape-browser { margin-top: 10px; min-height: 48px; width: 100%; max-width: 360px; font-size: 15px; }

/* ---- APK download splash (app.html, served at /app and at / outside the app): one picture is the page. The painted
   DOWNLOAD buttons get invisible real links positioned in percentages of the 1024×1536 creative. accounts/app.js ---- */
.app-landing-page { display: block; min-height: 100vh; min-height: 100dvh; background: #0b0603; }
.app-landing-page .bg-mesh { display: none; }
/* Phones: the tall picture (1024×2436: the 2:3 creative at the very top, a coin heap continuing below it) covers the
   whole viewport anchored to the TOP, so cover-cropping only ever removes coins at the bottom, never the top of the
   art (owner: "we can not compromise top"). One invisible link covers the viewport (a tap anywhere downloads).
   Nothing else is visible unless the player is on iPhone. */
.app-splash { position: relative; z-index: 1; height: 100vh; height: 100dvh; overflow: hidden; }
.splash-frame { position: relative; width: 100%; height: 100%; cursor: pointer; }
.splash-img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.splash-hit { position: fixed; inset: 0; display: block; z-index: 2; }
.splash-hint, .app-ios {
  position: fixed; left: 0; right: 0; bottom: calc(14px + var(--safe-b)); z-index: 3; margin: 0; padding: 0 var(--gutter);
  font-size: 15px; color: var(--text); text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9); text-align: center;
}
.app-ios a { color: var(--cyan); font-weight: 600; text-decoration: none; }
/* Tablet / desktop: the tall picture centred at a phone-like width, scrolling if the window is short. */
@media (min-width: 720px) {
  .app-splash { height: auto; min-height: 100dvh; overflow: visible; display: flex; align-items: flex-start; justify-content: center; padding: 16px 0; }
  .splash-frame { max-width: 560px; height: auto; border-radius: 16px; overflow: hidden; box-shadow: 0 0 60px rgba(0, 0, 0, 0.6); }
  .splash-img { height: auto; object-fit: contain; }
}
/* Social-proof download page (app-proof.html): Play Store–style listing. */
.proof-page {
  background: #fff;
  color: #202124;
  min-height: 100vh;
  min-height: 100dvh;
  cursor: pointer;
  font-family: var(--font);
}
.proof-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  background: #fff;
  border-bottom: 1px solid #e8eaed;
}
.proof-topbar-title { font-size: 20px; font-weight: 600; color: #5f6368; letter-spacing: -0.01em; }
.proof {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 20px calc(80px + var(--safe-b));
  display: flex;
  flex-direction: column;
  gap: 0;
  text-align: left;
}
.proof-hero {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 8px 0 4px;
}
.proof-icon {
  flex: 0 0 80px;
  width: 80px;
  height: 80px;
  border-radius: 20%;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
  display: block;
}
.proof-hero-text { flex: 1; min-width: 0; padding-top: 4px; }
.proof-hero h1 { margin: 0; font-size: 24px; font-weight: 500; letter-spacing: 0; color: #202124; line-height: 1.25; }
.proof .brand-777 { color: #01875f; font-weight: 600; }
.proof-cat { margin: 6px 0 0; font-size: 12px; font-weight: 500; color: #5f6368; }
.proof-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.proof-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px 4px 6px;
  border-radius: 6px;
  background: #e6f4ea;
  color: #137333;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.proof-badge-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #137333;
  color: #fff;
  font-size: 10px;
  line-height: 1;
  font-weight: 700;
}
.proof-stats-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 16px -20px 0;
  padding: 0;
  min-height: 72px;
  align-items: stretch;
  border-top: 1px solid #e8eaed;
  border-bottom: 1px solid #e8eaed;
}
.proof-stat-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 14px 6px;
  min-height: 72px;
  border-right: 1px solid #e8eaed;
}
.proof-stat-cell:last-child { border-right: none; }
.proof-stat-num {
  display: block;
  font-size: 15px;
  font-weight: 500;
  color: #202124;
  line-height: 1.25;
  white-space: nowrap;
}
.proof-star-ic { color: #e8a317; font-size: 12px; margin-left: 1px; }
.proof-stat-label {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 400;
  color: #5f6368;
  line-height: 1.2;
}
.proof-chips {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.proof-chips li {
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid #dadce0;
  background: #fff;
  font-size: 12px;
  font-weight: 500;
  color: #3c4043;
}
.proof-chips li:first-child,
.proof-chips li:nth-child(2) {
  border-color: #c4e7d4;
  background: #f6fbf8;
  color: #137333;
}
.proof-actions {
  margin-top: 18px;
}
.proof-cta {
  min-height: 48px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #01875f;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  letter-spacing: 0.01em;
}
.proof-live {
  margin-top: 16px;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e8eaed;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.06);
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}
.proof-live-dot {
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34a853;
  animation: proof-pulse 1.4s ease-in-out infinite;
}
@keyframes proof-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}
.proof-live-text {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: #3c4043;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.proof-live-in { opacity: 1; transform: translateY(0); }
.proof-live-out { opacity: 0; transform: translateY(6px); }
.proof-hint { margin: 10px 0 0; font-size: 13px; color: #5f6368; }
.proof-tagline {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  font-weight: 400;
  color: #3c4043;
}
.proof-updated { margin: 10px 0 0; font-size: 12px; color: #5f6368; }
.proof-rev-summary {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e8eaed;
}
.proof-rev-big {
  font-size: 56px;
  font-weight: 400;
  line-height: 1;
  color: #202124;
  letter-spacing: -0.02em;
}
.proof-rev-stars {
  display: block;
  font-size: 14px;
  letter-spacing: 0.06em;
  color: #e8a317;
}
.proof-rated-note { margin: 6px 0 0; font-size: 12px; color: #5f6368; }
.proof-panel {
  margin-top: 24px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
}
.proof-about { padding-top: 8px; border-top: 1px solid #e8eaed; }
.proof-h { margin: 0 0 12px; font-size: 18px; font-weight: 500; color: #202124; }
.proof-reviews { list-style: none; margin: 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 0; }
.proof-reviews li {
  padding: 16px 0;
  border-top: 1px solid #e8eaed;
  text-align: left;
}
.proof-reviews li:first-child { border-top: none; padding-top: 0; }
.rev-top { display: flex; align-items: center; gap: 10px; }
.rev-ava {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: block;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.rev-top strong { display: block; font-size: 14px; color: #16161e; }
.rev-stars { display: block; font-size: 12px; letter-spacing: 0.08em; color: #e0a020; }
.proof-reviews p { margin: 10px 0 0; font-size: 13.5px; line-height: 1.5; color: #3a3a48; }
.proof-ios { margin: 10px 0 0; font-size: 14px; color: #3a3a48; text-align: center; }
.proof-ios a { color: #01875f; font-weight: 700; text-decoration: none; }
.proof-features { list-style: none; margin: 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 0; }
.proof-features li {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 12px 0;
  border-top: 1px solid #eceef2;
}
.proof-features li:first-child { border-top: none; padding-top: 0; }
.proof-sticky {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  padding: 12px 20px calc(12px + var(--safe-b));
  background: #fff;
  border-top: 1px solid #e8eaed;
  box-shadow: 0 -2px 8px rgba(60, 64, 67, 0.08);
  pointer-events: none;
}
.proof-sticky .proof-cta { pointer-events: auto; max-width: 480px; margin: 0 auto; }
.proof-cta-sticky { min-height: 48px; }
.proof-feat {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.proof-feat svg { width: 26px; height: 26px; display: block; flex: 0 0 auto; }
.proof-feat-in { background: #128a42; color: #fff; }
.proof-feat-out { background: #e06a00; color: #fff; }
.proof-feat-safe { background: #2157e6; color: #fff; }
.proof-features .proof-feat { color: #fff; }
.proof-features li > div strong { display: block; font-size: 16px; font-weight: 800; color: #16161e; }
.proof-features li > div span { display: block; margin-top: 2px; font-size: 13px; color: #5c5c6a; }

/* Member social proof (GET /api/social-proof; js/social-proof.js) */
.sp-proof { margin: 0 0 16px; text-align: left; }
.sp-proof-compact { margin: 0 0 14px; }
.sp-proof-shelf { padding: 14px 16px; margin: 0; }
.sp-stat {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  color: #00e676;
}
.sp-live {
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}
.sp-live-dot {
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34a853;
  animation: proof-pulse 1.4s ease-in-out infinite;
}
.sp-ticker-text, .sp-proof .sp-live span:last-child {
  flex: 1;
  font-size: 12.5px;
  font-weight: 500;
  color: #c8cad4;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.sp-live-in { opacity: 1; transform: translateY(0); }
.sp-live-out { opacity: 0; transform: translateY(6px); }
.sp-leaders-head {
  margin: 12px 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8888a0;
}
.sp-leaders {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.sp-leaders li {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  grid-template-rows: auto auto;
  gap: 2px 8px;
  padding: 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 12px;
  align-items: center;
}
.sp-leaders li:first-child { border-top: none; padding-top: 0; }
.sp-rank {
  grid-row: 1 / span 2;
  font-weight: 800;
  font-size: 13px;
  color: #ffc947;
}
.sp-who { grid-column: 2; color: #b0b0bc; }
.sp-who strong { color: #f4f4f8; font-weight: 600; }
.sp-amt {
  grid-column: 3;
  grid-row: 1 / span 2;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-weight: 700;
  font-size: 12px;
  color: #00e676;
  text-align: right;
}
.sp-game {
  grid-column: 2;
  font-size: 11px;
  color: #707080;
}
.sp-shelf .sp-stat { font-size: 14px; }
.proof-live-text.sp-live-in,
.proof-live-text.sp-live-out { transition: opacity 0.22s ease, transform 0.22s ease; }

.app-steps li { margin: 0 0 10px; }
.app-help-cta { margin: 22px 0 0; }
.app-help-cta .escape-btn { max-width: 360px; }

/* ---- password show/hide (login.html, signup.html; ui-rules.md) ---- */
.pw-wrap { position: relative; display: flex; }
.pw-wrap input { flex: 1; min-width: 0; padding-right: 50px; }
.pw-eye {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 40px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.pw-eye svg { width: 22px; height: 22px; }
.pw-eye[aria-pressed="true"] { color: var(--accent); }

/* ---- wallet tabs: Add money | Take out | History (wallet.html; ui-rules.md) ---- */
.wallet-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}
.wallet-tab {
  flex: 1;
  min-height: 44px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.wallet-tab.active { background: var(--surface-hover); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-bright); }
.wallet-tab[data-wtab="deposit"].active { color: var(--accent); }
.wallet-tab[data-wtab="withdraw"].active { color: var(--gold); }

/* amount chips: tap a number instead of typing one */
.amount-chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.amt-chip {
  min-height: 48px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.12s;
}
.amt-chip.other { font-family: var(--font); font-size: 14px; }
.amt-chip:active { transform: scale(0.97); }
.amt-chip.active { border-color: var(--accent); background: rgba(0, 230, 118, 0.1); color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 230, 118, 0.12); }
.upi-note { display: flex; align-items: center; justify-content: center; gap: 6px; }

/* ---- change name (account.html) ---- */
.name-edit {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--cyan);
  cursor: pointer;
  text-decoration: none;
}
.name-edit svg { display: block; }
.sp-proof-wallet { margin-top: 18px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
#sp-account { margin-bottom: 14px; padding: 14px 16px; }
.name-form { display: flex; gap: 6px; align-items: center; }
.name-form input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 0 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
}
.name-form input:focus { outline: none; border-color: var(--accent); }

/* ---- "add to home screen" / save-the-link card (wallet.html, js/header.js; retention.md) ---- */
.home-card { display: flex; gap: 14px; align-items: flex-start; padding: 14px; border-radius: var(--radius); }
.home-card-icon {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.home-card-body { flex: 1; min-width: 0; }
.home-card h2 { margin: 0 0 4px; font-size: 16px; font-weight: 700; }
.home-card p { margin: 0 0 10px; font-size: 13px; line-height: 1.45; color: var(--muted); }
.home-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.home-card-actions .btn-primary, .home-card-actions .btn-ghost { min-height: 44px; font-size: 14px; }

/* ==========================================================================
   Phone compaction (2026-09-23). KEEP THIS SECTION LAST: same-specificity rules win by order, and everything
   here overrides base rules defined above it. Owner: "rocket on mobile takes too much space the graph, make it
   small and reduce the chat messages font size so that more chat messages fit, make the X green boxes
   smaller ... same for andar bahar, chat only one message is visible". The room goes to the chat panel.
   Tablet/desktop (720px+) keep their own sizes.
   ========================================================================== */
@media (max-width: 719.98px) {
  /* Rocket: the graph is a strip. app.js scales the centre text with the plot height.
     vh first, dvh behind @supports: the headless Edge on the dev PC has no dvh and drops the declaration. */
  .game-stage { height: clamp(112px, 17vh, 150px); }
  @supports (height: 1dvh) { .game-stage { height: clamp(112px, 17dvh, 150px); } }
  .history-rail { padding-top: 6px; }
  .history-strip { gap: 5px; }
  .chip { font-size: 11px; padding: 3px 8px; border-radius: 7px; }
  /* Chat: smaller lines, tighter gaps. */
  .chat-log { padding: 6px 8px; gap: 4px; }
  .chat-msg { font-size: 12.5px; line-height: 1.3; padding: 5px 8px; }
  .chat-msg .time { font-size: 10px; }
  /* Bet card: tighter, tap targets kept. */
  .bet-dock { padding: 8px; }
  .bet-grid { gap: 8px; margin-bottom: 6px; }
  .field { gap: 4px; }
  .chip-btn { min-height: 28px; }
  /* Andar Bahar table: small cards, fixed 200px = 8 + top row (kicker 13 + main 24 + sub 15 + bar 8 ≈ 62)
     + 6 + two piles (2 × 50 + 6) + 8 with slack. */
  :root { --card-w: 30px; --card-h: 40px; }
  .ab-stage { height: 200px; padding: 8px; gap: 6px; }
  .ab-top { gap: 10px; }
  .ab-status { gap: 1px; }
  .ab-main { font-size: 24px; }
  .ab-sub { font-size: 12px; line-height: 1.2; }
  .ab-bar { margin-top: 3px; }
  .ab-piles { gap: 6px; }
  .ab-pile { min-height: calc(var(--card-h) + 10px); padding: 3px 8px; gap: 8px; }
  .ab-pile-head { width: 56px; }
  /* Andar Bahar bet card: no ½ / 2× / All in row (the side picker already sits above the amount); the side
     buttons stack the bets line UNDER the word (owner: "hardly readable, it gets truncated"). */
  .ab-bet-grid .chip-row { display: none; }
  .ab-side-pick { gap: 6px; margin-bottom: 6px; }
  .ab-payout-box { min-height: 40px; }
  .side-btn { flex-direction: column; align-items: flex-start; justify-content: center; gap: 1px; min-height: 44px; padding: 5px 10px; }
  .side-btn .side-title { font-size: 14px; }
  .side-btn .side-count { flex: none; width: 100%; text-align: left; font-size: 10.5px; }
}

/* Short phones (≤720px tall): one notch smaller again. */
@media (max-width: 719.98px) and (max-height: 720px) {
  .game-stage { height: 104px; }
  :root { --card-w: 27px; --card-h: 36px; }
  .ab-stage { height: 188px; }
}

