/* Andar Bahar Mela. A fairground: cream, marigold, magenta and teal on a
   deep plum night, bunting across the top, a hostess at the table. The
   table's geometry is in --u (portrait design 400x760; landscape 880x520). */

:root {
  --plum: #3B1240; --plum2: #2A0B2E; --night: #1C0720; --cream: #FFF4DF; --cream2: #FFE8BF; --paper: #FFFBF3;
  --gold: #F2A93B; --gold-light: #FFD27A; --gold-dark: #C77C0F; --magenta: #D81B74; --pink: #FF7AB6; --teal: #1A8C8C; --teal-light: #4FD1C5;
  --andar: #2A6FD6; --andar-dark: #17408A; --bahar: #F26A21; --bahar-dark: #A33A07; --green: #2DB36B; --red: #E53E5B;
  --text: #2A0B2E; --muted: #6E5A72; --dim: #9C8AA0; --line: rgba(59,18,64,0.14);
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif; --display: 'Baloo 2', var(--font);
  --u: min(100vw / 400, 100dvh / 760);
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { position: fixed; inset: 0; overflow: hidden; background: var(--plum); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.4; -webkit-font-smoothing: antialiased; user-select: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--magenta); }
b { font-weight: 800; }
[hidden] { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12px; }

.screen { position: absolute; inset: 0; display: none; flex-direction: column; overflow: hidden; background: var(--cream); }
.screen.active { display: flex; }
.page { overflow-y: auto; }

/* bunting across the top of the dark screens */
.bunting { position: absolute; left: 0; right: 0; top: calc(6px + var(--safe-t)); height: 26px; pointer-events: none; z-index: 1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='26' viewBox='0 0 120 26'%3E%3Cpath d='M0 3 Q60 10 120 3' fill='none' stroke='%23F2A93B' stroke-width='2'/%3E%3Cpath d='M6 4 l14 0 l-7 18z' fill='%23D81B74'/%3E%3Cpath d='M28 6 l14 0 l-7 18z' fill='%23F2A93B'/%3E%3Cpath d='M50 7 l14 0 l-7 18z' fill='%234FD1C5'/%3E%3Cpath d='M72 6 l14 0 l-7 18z' fill='%23FF7AB6'/%3E%3Cpath d='M94 4 l14 0 l-7 18z' fill='%23F2A93B'/%3E%3C/svg%3E"); background-repeat: repeat-x; opacity: .9; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 14px; font-weight: 800; font-size: 15px; transition: transform .08s, filter .15s; white-space: nowrap; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn-main { background: linear-gradient(180deg, #FF9BC8, var(--magenta) 60%, #B0105B); color: #fff; box-shadow: 0 6px 0 #8A0C47, 0 10px 20px rgba(216,27,116,.3); text-shadow: 0 1px 0 rgba(0,0,0,.2); }
.btn-main:active { transform: translateY(3px); box-shadow: 0 3px 0 #8A0C47; }
.btn-main small { font-weight: 600; opacity: .9; font-size: 12px; }
.btn-ghost { background: var(--paper); border: 2px solid var(--line); color: var(--text); }
.btn-link { background: none; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; min-height: 36px; }
.btn-lg { min-height: 54px; font-size: 17px; border-radius: 18px; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 13px; border-radius: 10px; }
.btn-block { width: 100%; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 20px; color: var(--text); background: var(--paper); border: 2px solid var(--line); }

/* ---------- splash ---------- */
.splash { align-items: center; justify-content: center; background: radial-gradient(ellipse at 50% 30%, #5A1C62 0%, var(--plum) 55%, var(--night) 100%); color: var(--cream); z-index: 50; }
.splash-inner { text-align: center; padding: 24px; }
.splash-host { width: 220px; height: 260px; animation: bob 3s ease-in-out infinite; filter: drop-shadow(0 20px 30px rgba(0,0,0,.4)); }
.splash-word { font-family: var(--display); font-size: 40px; margin: 6px 0 0; letter-spacing: -.01em; font-weight: 800; line-height: 1; }
.splash-word b { color: var(--gold); display: block; font-size: 52px; }
.splash-sub { margin: 8px 0 22px; color: var(--cream2); font-weight: 700; }
.splash-bar { width: 200px; height: 6px; margin: 0 auto; background: rgba(255,244,223,.15); border-radius: 6px; overflow: hidden; }
.splash-bar i { display: block; height: 100%; width: 40%; background: linear-gradient(90deg, var(--magenta), var(--gold)); border-radius: 6px; animation: slide 1.2s ease-in-out infinite; }
.splash-note { color: var(--dim); font-size: 12px; margin-top: 12px; }
@keyframes bob { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(-8px) } }
@keyframes slide { 0% { transform: translateX(-100%) } 100% { transform: translateX(350%) } }

/* ---------- sign in ---------- */
.login { align-items: center; justify-content: center; padding: 20px; background: radial-gradient(ellipse at 50% 0%, #5A1C62 0%, var(--plum) 60%); overflow-y: auto; }
.login-card { width: min(420px, 100%); background: var(--paper); border-radius: 24px; padding: 0 20px 22px; box-shadow: 0 30px 80px rgba(0,0,0,.45); text-align: center; position: relative; margin-top: 70px; }
.login-host { width: 150px; height: 178px; margin-top: -78px; }
.login-brand b { display: block; font-family: var(--display); font-size: 30px; font-weight: 800; line-height: 1; margin-top: -8px; }
.login-brand b i { font-style: normal; color: var(--magenta); }
.login-brand small { display: block; color: var(--muted); font-weight: 700; margin: 4px 0 16px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--dim); font-size: 12px; margin: 18px 0 12px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.phone-row { display: flex; align-items: stretch; border: 2px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; margin-bottom: 10px; }
.phone-row .cc { display: flex; align-items: center; padding: 0 12px; color: var(--magenta); font-weight: 800; border-right: 2px solid var(--line); }
.phone-row input, .otp-input, textarea, .field input, .field select { flex: 1; background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 16px; outline: none; width: 100%; }
.phone-row input { border: 0; border-radius: 0; }
.otp-input { text-align: center; letter-spacing: .3em; font-weight: 800; font-size: 22px; margin-bottom: 10px; text-transform: uppercase; }
.login-error { color: var(--red); font-size: 13px; margin: 10px 0 0; font-weight: 700; }
.login-fine { color: var(--dim); font-size: 11px; margin: 14px 0 0; line-height: 1.5; }
/* a thumb-sized tap area around a small link, without moving the text */
.login-fine a { display: inline-block; padding: 9px 6px; margin: -9px -6px; }

/* ---------- shared top bar ---------- */
.topbar { display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--safe-t)) 14px 10px; background: var(--plum); color: var(--cream); flex: 0 0 auto; }
.topbar .icon-btn { background: rgba(255,244,223,.1); border-color: rgba(255,244,223,.2); color: var(--cream); }
.topbar-name { flex: 1; min-width: 0; line-height: 1.15; }
.topbar-name b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-name small { color: var(--pink); font-size: 11px; font-weight: 700; }
.avatar-btn { position: relative; width: 44px; height: 44px; border-radius: 50%; flex: 0 0 auto; }
.avatar-btn img { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--gold); background: #fff; display: block; }
.avatar-btn .lvl { position: absolute; right: -4px; bottom: -3px; background: var(--gold); color: var(--plum); font-size: 10px; font-weight: 900; padding: 1px 5px; border-radius: 8px; border: 2px solid var(--plum); }
.chips-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px 6px 6px; border-radius: 999px; background: rgba(242,169,59,.16); border: 2px solid rgba(242,169,59,.6); font-weight: 900; font-variant-numeric: tabular-nums; color: var(--gold-light); }
.chips-pill i { font-style: normal; width: 20px; height: 20px; border-radius: 50%; background: var(--gold); color: var(--plum); display: inline-flex; align-items: center; justify-content: center; font-weight: 900; }
.chips-pill.small { padding: 4px 8px 4px 4px; font-size: 13px; }
.chip-ico { width: 20px; height: 20px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #FFF3C9, var(--gold) 45%, var(--gold-dark) 90%); box-shadow: inset 0 0 0 3px rgba(255,255,255,.35), 0 1px 2px rgba(0,0,0,.4); border: 1px dashed rgba(0,0,0,.3); flex: 0 0 auto; }

/* ---------- lobby ---------- */
.lobby-main { flex: 1; overflow-y: auto; padding: 14px 14px calc(80px + var(--safe-b)); width: min(960px, 100%); margin: 0 auto; }
.lobby h2 { font-family: var(--display); font-size: 20px; font-weight: 800; margin: 18px 0 10px; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; padding: 16px 0 0 16px; border-radius: 22px; background: linear-gradient(135deg, #5A1C62, var(--plum) 60%, #4A1560); color: var(--cream); overflow: hidden; position: relative; min-height: 170px; }
.hero::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 20% 20%, rgba(255,210,122,.18), transparent 40%), radial-gradient(circle at 80% 90%, rgba(216,27,116,.3), transparent 45%); }
.hero-text { position: relative; padding-bottom: 16px; flex: 1; }
.hero-text small { display: block; color: var(--gold); font-weight: 800; letter-spacing: .15em; text-transform: uppercase; font-size: 11px; }
.hero-text b { display: block; font-family: var(--display); font-size: 24px; line-height: 1.05; margin: 4px 0 12px; }
.hero-text b span { color: var(--gold-light); }
.hero-text .btn { flex-direction: column; gap: 0; line-height: 1.1; padding: 6px 22px; }
.hero-host { width: 150px; height: 178px; flex: 0 0 auto; position: relative; margin-bottom: -6px; filter: drop-shadow(0 10px 16px rgba(0,0,0,.4)); }
.promo { margin-top: 12px; }
.promo-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 16px; background: linear-gradient(120deg, #FFE8BF, #FFF4DF); border: 2px solid var(--gold); }
.promo-card small { display: block; font-size: 11px; color: var(--gold-dark); text-transform: uppercase; letter-spacing: .15em; font-weight: 800; }
.promo-card b { display: block; font-size: 15px; }
.quick-row { display: flex; gap: 10px; margin-top: 12px; }
.quick-row .btn { flex: 1; }
.tier-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .tier-grid { grid-template-columns: repeat(4, 1fr); } }
.tier { display: flex; flex-direction: column; gap: 3px; padding: 14px; border-radius: 18px; background: var(--paper); border: 2px solid var(--line); text-align: left; position: relative; overflow: hidden; }
.tier::before { content: ''; position: absolute; right: -20px; top: -20px; width: 80px; height: 80px; border-radius: 50%; background: radial-gradient(circle, rgba(242,169,59,.35), transparent 70%); }
.tier b { font-family: var(--display); font-size: 26px; font-weight: 800; color: var(--magenta); line-height: 1; }
.tier small { color: var(--muted); font-size: 11px; font-weight: 700; }
.tier .tier-play { margin-top: 8px; align-self: flex-start; }
.tier.locked { opacity: .55; }
.tier .tier-live { position: absolute; top: 10px; right: 10px; font-size: 10px; color: var(--teal); font-weight: 800; }
.tier .tier-live::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--teal); margin-right: 5px; box-shadow: 0 0 8px var(--teal); }
.bottom-nav { position: absolute; left: 0; right: 0; bottom: 0; display: flex; background: var(--plum); padding-bottom: var(--safe-b); }
.bn { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; font-size: 11px; font-weight: 800; color: rgba(255,244,223,.55); position: relative; }
.bn.active { color: var(--gold); }
.bn-ico { font-size: 20px; }
.bn-dot { position: absolute; top: 6px; right: calc(50% - 18px); width: 9px; height: 9px; border-radius: 50%; background: var(--red); box-shadow: 0 0 8px var(--red); }

/* ---------- pages ---------- */
.tabs { display: flex; gap: 6px; padding: 10px 14px; }
.tab { flex: 1; padding: 10px; border-radius: 10px; background: var(--paper); border: 2px solid var(--line); font-weight: 800; font-size: 13px; color: var(--muted); }
.tab.active { color: #fff; background: var(--magenta); border-color: var(--magenta); }
.lb-list { list-style: none; margin: 0; padding: 0 14px 20px; width: min(720px, 100%); align-self: center; }
.lb-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; margin-bottom: 6px; background: var(--paper); border: 2px solid transparent; }
.lb-row.me { border-color: var(--gold); }
.lb-row .rank { width: 26px; text-align: center; font-weight: 900; color: var(--muted); }
.lb-row .rank.top { color: var(--magenta); }
.lb-row img { width: 36px; height: 36px; border-radius: 50%; background: #fff; }
.lb-row .who { flex: 1; min-width: 0; }
.lb-row .who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-row .who small { color: var(--dim); font-size: 11px; }
.lb-row .val { font-weight: 900; color: var(--gold-dark); font-variant-numeric: tabular-nums; }
.profile { padding: 16px 14px 30px; width: min(600px, 100%); align-self: center; }
.profile-hero { text-align: center; }
.avatar-big { position: relative; width: 96px; height: 96px; border-radius: 50%; }
.avatar-big img { width: 96px; height: 96px; border-radius: 50%; border: 3px solid var(--gold); background: #fff; display: block; }
.avatar-big span { position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); font-size: 10px; font-weight: 900; background: var(--magenta); color: #fff; padding: 2px 8px; border-radius: 8px; }
.profile-name-row { display: flex; gap: 8px; justify-content: center; margin: 16px auto 8px; max-width: 320px; }
.profile-name-row input { flex: 1; background: #fff; border: 2px solid var(--line); border-radius: 10px; padding: 8px 12px; font-weight: 800; text-align: center; }
.level-row { display: flex; align-items: center; gap: 10px; justify-content: center; margin: 6px 0; }
.xp { width: 140px; height: 8px; background: rgba(59,18,64,.12); border-radius: 8px; overflow: hidden; }
.xp i { display: block; height: 100%; background: linear-gradient(90deg, var(--magenta), var(--gold)); width: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0; }
.stat-grid div { background: var(--paper); border-radius: 14px; padding: 10px 6px; text-align: center; border: 2px solid var(--line); }
.stat-grid b { display: block; font-family: var(--display); font-size: 20px; color: var(--magenta); line-height: 1; }
.stat-grid small { color: var(--muted); font-size: 11px; font-weight: 700; }
.avatar-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0 16px; }
.avatar-picker button { border-radius: 50%; padding: 0; border: 3px solid transparent; }
.avatar-picker button.on { border-color: var(--magenta); }
.avatar-picker img { width: 100%; border-radius: 50%; background: #fff; display: block; }
.profile-actions { display: flex; flex-direction: column; gap: 8px; }
.history { margin-top: 16px; }
.h-row { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--paper); margin-bottom: 6px; font-size: 13px; border: 2px solid var(--line); }
.h-row small { color: var(--dim); display: block; }
.h-row .d { font-weight: 900; font-variant-numeric: tabular-nums; }
.h-row .d.up { color: var(--green); } .h-row .d.down { color: var(--red); }
.rules { padding: 16px 16px 40px; width: min(640px, 100%); align-self: center; line-height: 1.55; }
.rules h3 { font-family: var(--display); margin: 22px 0 8px; font-size: 20px; }
.rules p { margin: 0 0 10px; color: var(--muted); }
.rules p b { color: var(--text); }
.rank-list div { display: grid; grid-template-columns: 120px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.rank-list b { color: var(--magenta); }
.rank-list span { color: var(--muted); }
.steps { color: var(--muted); padding-left: 20px; }

/* ---------- modals ---------- */
.modal { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; background: rgba(28,7,32,.7); backdrop-filter: blur(4px); }
.modal-box { width: min(480px, 100%); background: var(--paper); border-radius: 24px 24px 0 0; padding: 16px 16px calc(20px + var(--safe-b)); animation: up .22s ease-out; max-height: 86dvh; overflow-y: auto; }
@media (min-width: 640px) { .modal { align-items: center; } .modal-box { border-radius: 24px; } }
@keyframes up { from { transform: translateY(30px); opacity: 0 } to { transform: none; opacity: 1 } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-head b { font-family: var(--display); font-size: 22px; }
.field { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.field > span { width: 70px; color: var(--muted); font-size: 13px; font-weight: 700; flex: 0 0 auto; }
.field select { appearance: none; -webkit-appearance: none; }
.field.check { cursor: pointer; }
.field.check input { width: 20px; height: 20px; accent-color: var(--magenta); flex: 0 0 auto; }
.field.check span { width: auto; color: var(--text); }
textarea { resize: vertical; margin-bottom: 10px; }
.menu-box { padding: 8px; }
.menu-item { display: block; width: 100%; text-align: left; padding: 14px 16px; border-radius: 12px; font-weight: 700; font-size: 15px; }
.menu-item:active { background: var(--cream2); }
.bonus-title { font-family: var(--display); font-size: 20px; display: flex; justify-content: space-between; align-items: baseline; }
.bonus-title small { color: var(--muted); font-family: var(--font); font-size: 12px; font-weight: 700; }
.streak { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin: 12px 0; }
.streak div { text-align: center; padding: 8px 2px; border-radius: 10px; background: var(--cream); border: 2px solid var(--line); font-size: 10px; color: var(--muted); font-weight: 700; }
.streak div b { display: block; font-size: 12px; color: var(--magenta); }
.streak div.done { background: rgba(45,179,107,.15); border-color: var(--green); }
.streak div.today { border-color: var(--gold); background: var(--cream2); box-shadow: 0 0 12px rgba(242,169,59,.5); }
.bonus-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); margin-top: 12px; }
.bonus-row small { display: block; color: var(--muted); font-size: 12px; }
.code-big { font-family: var(--display); font-size: 40px; font-weight: 800; letter-spacing: .25em; text-align: center; color: var(--magenta); margin: 6px 0 16px; }
.gift-amts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 12px; }
.gift-amts button { padding: 12px; border-radius: 12px; background: var(--cream); border: 2px solid var(--line); font-weight: 900; color: var(--magenta); }
.confirm-text { font-size: 17px; font-weight: 800; margin: 6px 4px 16px; text-align: center; }
.confirm-row { display: flex; gap: 10px; }
.confirm-row .btn { flex: 1; }
#modal-confirm { z-index: 45; }
.toasts { position: fixed; top: calc(12px + var(--safe-t)); left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; z-index: 60; }
.toast { padding: 9px 16px; border-radius: 999px; background: var(--plum); color: var(--cream); border: 2px solid rgba(255,244,223,.2); font-size: 13px; font-weight: 700; box-shadow: 0 8px 24px rgba(0,0,0,.35); animation: up .2s ease-out; max-width: 92vw; }
.toast.warn { border-color: var(--red); color: #FFC1CC; }
.toast.good { border-color: var(--green); color: #C7F7E2; }
.offline { position: fixed; bottom: calc(12px + var(--safe-b)); left: 50%; transform: translateX(-50%); padding: 8px 14px; border-radius: 999px; background: var(--red); color: #fff; font-weight: 800; font-size: 13px; z-index: 60; }

/* =====================================================================
   TABLE
   ===================================================================== */
.table { background: radial-gradient(ellipse at 50% 20%, #5A1C62 0%, var(--plum) 50%, var(--night) 100%); color: var(--cream); }
.tbar { display: flex; align-items: center; gap: 8px; padding: calc(8px + var(--safe-t)) 10px 6px; flex: 0 0 auto; }
.tbar .icon-btn { width: 36px; height: 36px; background: rgba(255,244,223,.1); border-color: rgba(255,244,223,.2); color: var(--cream); }
.tbar-title { flex: 1; min-width: 0; line-height: 1.15; }
.tbar-title b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbar-title small { color: var(--pink); font-size: 11px; font-weight: 700; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.stage { position: relative; flex: 1; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: 1fr; padding: 0 calc(6 * var(--u)); row-gap: calc(4 * var(--u)); }
.host-area { position: relative; height: calc(88 * var(--u)); z-index: 2; }
.host { width: calc(112 * var(--u)); height: calc(134 * var(--u)); position: absolute; left: 50%; bottom: calc(-10 * var(--u)); transform: translateX(-50%); filter: drop-shadow(0 8px 14px rgba(0,0,0,.45)); transform-origin: 50% 100%; animation: hostIdle 4s ease-in-out infinite; }
@keyframes hostIdle { 0%, 100% { transform: translateX(-50%) rotate(0deg) } 50% { transform: translateX(-50%) rotate(-1.5deg) translateY(-2px) } }
.host.cheer { animation: hostCheer .7s ease-in-out 2; }
@keyframes hostCheer { 0%, 100% { transform: translateX(-50%) } 50% { transform: translateX(-50%) translateY(-10px) scale(1.04) } }
.host-bubble { position: absolute; left: calc(50% + 52 * var(--u)); bottom: calc(30 * var(--u)); max-width: calc(150 * var(--u)); padding: calc(7 * var(--u)) calc(12 * var(--u)); border-radius: calc(16 * var(--u)) calc(16 * var(--u)) calc(16 * var(--u)) calc(3 * var(--u)); background: var(--paper); color: var(--text); font-weight: 800; font-size: calc(12 * var(--u)); line-height: 1.2; box-shadow: 0 6px 18px rgba(0,0,0,.35); animation: pop .3s cubic-bezier(.2,.9,.3,1.3) both; }
.host-bubble.hot { background: var(--gold); color: var(--plum); }

/* the table */
.felt { position: relative; border-radius: calc(34 * var(--u)) calc(34 * var(--u)) calc(26 * var(--u)) calc(26 * var(--u)); padding: calc(22 * var(--u)) calc(10 * var(--u)) calc(10 * var(--u)); background: radial-gradient(ellipse at 50% 0%, #1E9A86 0%, #0F6B5E 50%, #0A4A42 100%); box-shadow: inset 0 0 calc(40 * var(--u)) rgba(0,0,0,.35), 0 calc(14 * var(--u)) calc(34 * var(--u)) rgba(0,0,0,.5); display: flex; flex-direction: column; justify-content: space-evenly; gap: calc(8 * var(--u)); min-height: 0; }
.felt::before { content: ''; position: absolute; inset: 0; border-radius: inherit; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='.07'/%3E%3C/svg%3E"); mix-blend-mode: overlay; pointer-events: none; }
.felt-rim { position: absolute; inset: calc(-5 * var(--u)); border-radius: calc(38 * var(--u)) calc(38 * var(--u)) calc(30 * var(--u)) calc(30 * var(--u)); border: calc(5 * var(--u)) solid #7A4A1E; background: linear-gradient(180deg, #B07A3C, #6B3D15) border-box; -webkit-mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0); mask-composite: exclude; pointer-events: none; box-shadow: 0 0 0 calc(1.5 * var(--u)) rgba(242,169,59,.6); }
.felt-top { position: relative; }
.runway { display: grid; grid-template-columns: 1fr calc(74 * var(--u)) 1fr; align-items: center; gap: calc(6 * var(--u)); height: calc(118 * var(--u)); }
.run-side { position: relative; height: calc(104 * var(--u)); border-radius: calc(12 * var(--u)); border: calc(2 * var(--u)) dashed rgba(255,255,255,.25); }
.run-side.andar { border-color: rgba(143,184,255,.55); }
.run-side.bahar { border-color: rgba(255,178,122,.6); }
.run-label { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-family: var(--display); font-size: calc(16 * var(--u)); letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.28); pointer-events: none; }
.run-side .card { position: absolute; top: 50%; margin-top: calc(-38 * var(--u)); width: calc(54 * var(--u)); height: calc(76 * var(--u)); }
.run-side .card.land { animation: land .35s cubic-bezier(.2,.8,.2,1) both; }
@keyframes land { from { transform: translate(var(--dx, 0), -40px) rotate(-10deg) scale(.7); opacity: 0 } to { transform: none; opacity: 1 } }
.run-side .card.match { box-shadow: 0 0 0 calc(3 * var(--u)) var(--gold), 0 0 calc(24 * var(--u)) rgba(242,169,59,.9); z-index: 20; animation: matchPop .5s cubic-bezier(.2,.9,.3,1.4) both; }
@keyframes matchPop { 50% { transform: scale(1.25) rotate(4deg) } }
.run-side.win { border-style: solid; border-color: var(--gold); box-shadow: 0 0 calc(24 * var(--u)) rgba(242,169,59,.6) inset; }
.run-more { position: absolute; bottom: calc(2 * var(--u)); font-size: calc(8.5 * var(--u)); font-weight: 900; color: var(--cream); background: rgba(0,0,0,.4); padding: 0 calc(5 * var(--u)); border-radius: 999px; }
.run-side.andar .run-more { left: calc(3 * var(--u)); } .run-side.bahar .run-more { right: calc(3 * var(--u)); }
.joker-area { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.joker-label { font-size: calc(8.5 * var(--u)); font-weight: 900; letter-spacing: .25em; text-transform: uppercase; color: var(--gold-light); margin-bottom: calc(3 * var(--u)); }
.joker-card .card { width: calc(60 * var(--u)); height: calc(84 * var(--u)); box-shadow: 0 0 0 calc(3 * var(--u)) var(--gold), 0 8px 20px rgba(0,0,0,.5); }
.timer-ring { position: absolute; right: calc(-14 * var(--u)); top: calc(2 * var(--u)); width: calc(34 * var(--u)); height: calc(34 * var(--u)); border-radius: 50%; background: conic-gradient(var(--gold) var(--p, 100%), rgba(255,244,223,.2) 0); display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(0,0,0,.5); z-index: 3; }
.timer-ring::before { content: ''; position: absolute; inset: calc(4 * var(--u)); border-radius: 50%; background: var(--plum); }
.timer-ring b { position: relative; font-family: var(--display); font-size: calc(14 * var(--u)); color: var(--cream); }
.timer-ring.off { opacity: 0; }
.timer-ring.urgent b { color: var(--red); }
.count-pill { position: absolute; left: 50%; bottom: calc(-8 * var(--u)); transform: translateX(-50%); font-size: calc(9.5 * var(--u)); font-weight: 900; color: var(--plum); background: var(--cream); padding: calc(2 * var(--u)) calc(8 * var(--u)); border-radius: 999px; white-space: nowrap; z-index: 2; }

/* the betting pockets */
.pockets { display: grid; grid-template-columns: 1fr 1fr; gap: calc(8 * var(--u)); margin-top: calc(6 * var(--u)); }
.pocket { position: relative; display: flex; flex-direction: column; min-height: calc(104 * var(--u)); border-radius: calc(16 * var(--u)); padding: calc(6 * var(--u)) calc(8 * var(--u)); text-align: left; color: #fff; border: calc(3 * var(--u)) solid; background: rgba(0,0,0,.18); transition: transform .12s, box-shadow .2s, filter .2s; }
.pocket.andar { border-color: var(--andar); box-shadow: inset 0 0 calc(30 * var(--u)) rgba(42,111,214,.35); }
.pocket.bahar { border-color: var(--bahar); box-shadow: inset 0 0 calc(30 * var(--u)) rgba(242,106,33,.35); }
.pocket:active { transform: scale(.985); }
.pocket.open { cursor: pointer; }
.pocket.open.andar { box-shadow: inset 0 0 calc(30 * var(--u)) rgba(42,111,214,.45), 0 0 0 calc(2 * var(--u)) rgba(143,184,255,.35); }
.pocket.open.bahar { box-shadow: inset 0 0 calc(30 * var(--u)) rgba(242,106,33,.45), 0 0 0 calc(2 * var(--u)) rgba(255,178,122,.35); }
.pocket.closed { filter: saturate(.8); }
.pocket.win { border-color: var(--gold); box-shadow: 0 0 0 calc(3 * var(--u)) var(--gold), 0 0 calc(34 * var(--u)) rgba(242,169,59,.8), inset 0 0 calc(30 * var(--u)) rgba(242,169,59,.35); animation: winPulse .8s ease-in-out 3; }
@keyframes winPulse { 50% { transform: scale(1.03) } }
.pocket.lose { filter: grayscale(.5) brightness(.8); }
.pocket-head { display: flex; justify-content: space-between; align-items: baseline; }
.pocket-head b { font-family: var(--display); font-size: calc(17 * var(--u)); letter-spacing: .08em; }
.pocket.andar .pocket-head b { color: #BFD6FF; } .pocket.bahar .pocket-head b { color: #FFD9C2; }
.pocket-head small { font-size: max(9px, calc(9.5 * var(--u))); font-weight: 800; color: var(--gold-light); white-space: nowrap; }
.stack { --chip: calc(30 * var(--u)); flex: 1; position: relative; min-height: calc(44 * var(--u)); display: flex; align-items: flex-end; justify-content: center; gap: calc(14 * var(--u)); padding-bottom: calc(3 * var(--u)); }
.stack .pile { position: relative; display: flex; align-items: flex-end; gap: calc(3 * var(--u)); }
.stack .pile .cs { position: relative; width: var(--chip); height: calc(var(--chip) + (var(--n) - 1) * 3 * var(--u)); flex: 0 0 auto; }
.stack .pile i { position: absolute; left: 0; bottom: calc(var(--k) * 3 * var(--u)); width: var(--chip); height: var(--chip); border-radius: 50%; border: calc(2 * var(--u)) dashed rgba(255,255,255,.8); box-shadow: 0 calc(2 * var(--u)) 0 rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; font-style: normal; font-family: var(--display); font-weight: 800; font-size: max(8.5px, calc(9.5 * var(--u))); color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,.5); letter-spacing: -.02em; }
.stack .pile i.top::after { content: ''; position: absolute; inset: calc(2 * var(--u)); border-radius: 50%; border: 1px solid rgba(255,255,255,.45); }
.stack .pile i.c0 { background: radial-gradient(circle at 35% 30%, #4FD1C5, var(--teal) 60%, #0F5A5A); } .stack .pile i.c1 { background: radial-gradient(circle at 35% 30%, #FF9BC8, var(--magenta) 60%, #8A0C47); } .stack .pile i.c2 { background: radial-gradient(circle at 35% 30%, #FFD27A, var(--gold) 60%, #9A5A05); } .stack .pile i.c3 { background: radial-gradient(circle at 35% 30%, #B388FF, #7C3AED 60%, #3B1A80); }
.stack .pile em { position: absolute; right: calc(-4 * var(--u)); bottom: calc(-3 * var(--u)); font-style: normal; font-size: max(8px, calc(8 * var(--u))); font-weight: 900; line-height: 1; padding: calc(1.5 * var(--u)) calc(3 * var(--u)); border-radius: 999px; background: rgba(28,7,32,.85); color: var(--cream); z-index: 2; }
.stack .pile b { position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); font-size: max(9px, calc(10 * var(--u))); font-weight: 900; color: var(--plum); background: var(--gold-light); padding: 0 calc(6 * var(--u)); border-radius: 999px; white-space: nowrap; margin-bottom: calc(2 * var(--u)); box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.stack .pile.others b { color: var(--cream); background: rgba(0,0,0,.45); }
.stack .pile.others i { filter: saturate(.8) brightness(.92); }
.pocket-foot { display: flex; justify-content: space-between; align-items: center; margin-top: calc(4 * var(--u)); }
.side-total { font-size: max(9px, calc(9 * var(--u))); font-weight: 800; color: var(--cream2); }
.side-total::before { content: 'Table '; opacity: .7; }
.my-bet { font-size: max(9px, calc(10 * var(--u))); font-weight: 900; color: var(--gold-light); }
.my-bet::before { content: 'You '; opacity: .8; font-weight: 700; }

.sidebets { display: grid; grid-template-columns: repeat(5, 1fr); gap: calc(4 * var(--u)); margin-top: calc(2 * var(--u)); }
.sb { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: calc(4 * var(--u)) calc(2 * var(--u)); border-radius: calc(9 * var(--u)); background: rgba(0,0,0,.22); border: 1px solid rgba(255,244,223,.22); color: var(--cream); line-height: 1.05; position: relative; transition: transform .1s; }
.sb { min-height: 30px; }
.sb b { font-size: max(10px, calc(10 * var(--u))); } .sb small { font-size: max(9px, calc(8.5 * var(--u))); color: var(--gold-light); font-weight: 800; }
.sb.open:active { transform: scale(.95); }
.sb.has { background: rgba(242,169,59,.3); border-color: var(--gold); }
.sb .sb-amt { position: absolute; top: calc(-6 * var(--u)); right: calc(-3 * var(--u)); font-size: calc(9 * var(--u)); font-weight: 900; color: var(--plum); background: var(--gold-light); padding: 0 calc(5 * var(--u)); border-radius: 999px; }
.sb.win { background: var(--green); border-color: var(--green); color: #fff; }
.sb.win small { color: #fff; }

.crowd { display: flex; gap: calc(6 * var(--u)); overflow-x: auto; scrollbar-width: none; padding: calc(2 * var(--u)) 0; }
.crowd::-webkit-scrollbar { display: none; }
.pl { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; width: calc(48 * var(--u)); gap: 1px; position: relative; }
.pl img { width: calc(36 * var(--u)); height: calc(36 * var(--u)); border-radius: 50%; background: #fff; border: 2px solid rgba(255,244,223,.6); }
.pl.me img { border-color: var(--gold); }
.pl small { font-size: calc(8 * var(--u)); font-weight: 700; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl .pb { position: absolute; top: calc(26 * var(--u)); left: 50%; transform: translateX(-50%); font-size: calc(8 * var(--u)); font-weight: 900; padding: 0 calc(4 * var(--u)); border-radius: 999px; color: #fff; white-space: nowrap; display: none; }
.pl .pb.andar { background: var(--andar); display: block; } .pl .pb.bahar { background: var(--bahar); display: block; } .pl .pb.both { background: var(--magenta); display: block; }
.pl .delta { position: absolute; top: calc(-8 * var(--u)); left: 50%; transform: translateX(-50%); font-size: calc(10 * var(--u)); font-weight: 900; animation: rise 1.6s ease-out both; }
.pl .delta.up { color: var(--green); } .pl .delta.down { color: var(--red); }
@keyframes rise { 0% { opacity: 0; transform: translate(-50%, 6px) } 20% { opacity: 1 } 100% { opacity: 0; transform: translate(-50%, -16px) } }
.pl .emo { position: absolute; top: calc(-20 * var(--u)); font-size: calc(22 * var(--u)); animation: emo 1.8s ease-out both; }
@keyframes emo { 0% { transform: translateY(10px) scale(.4); opacity: 0 } 20% { transform: none; opacity: 1 } 80% { opacity: 1 } 100% { transform: translateY(-20px); opacity: 0 } }
.pl .bubble { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: #fff; color: var(--text); font-size: calc(10 * var(--u)); padding: calc(3 * var(--u)) calc(8 * var(--u)); border-radius: calc(8 * var(--u)); white-space: nowrap; max-width: calc(140 * var(--u)); overflow: hidden; text-overflow: ellipsis; z-index: 3; animation: up .2s ease-out; }

.history-strip { flex: 0 0 auto; display: flex; align-items: center; gap: calc(4 * var(--u)); padding: calc(4 * var(--u)) calc(10 * var(--u)); overflow-x: auto; scrollbar-width: none; }
.history-strip::-webkit-scrollbar { display: none; }
.hd { flex: 0 0 auto; width: calc(20 * var(--u)); height: calc(20 * var(--u)); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: calc(8.5 * var(--u)); font-weight: 900; color: #fff; }
.hd.andar { background: var(--andar); } .hd.bahar { background: var(--bahar); }
.hd.last { box-shadow: 0 0 0 2px var(--gold); }
.hs { flex: 0 0 auto; font-size: calc(9.5 * var(--u)); font-weight: 800; color: var(--cream2); margin-right: calc(4 * var(--u)); white-space: nowrap; }
.hs b.a { color: #8FB8FF; } .hs b.b { color: #FFB27A; }

.rack { flex: 0 0 auto; padding: calc(6 * var(--u)) calc(10 * var(--u)) calc(6px + var(--safe-b)); background: linear-gradient(180deg, rgba(28,7,32,0), rgba(28,7,32,.6)); }
.rack-controls { display: grid; grid-template-columns: repeat(4, 1fr); gap: calc(6 * var(--u)); margin-bottom: calc(6 * var(--u)); }
.rc { padding: calc(7 * var(--u)) 0; border-radius: calc(10 * var(--u)); background: rgba(255,244,223,.1); border: 1px solid rgba(255,244,223,.25); color: var(--cream); font-weight: 900; font-size: calc(11 * var(--u)); letter-spacing: .04em; }
.rc:disabled { opacity: .35; }
/* A tap target a thumb can hit on a phone held upright (UI audit, 13 Oct). */
@media (orientation: portrait) { .rc { min-height: 32px; } }
.chips { display: flex; justify-content: center; gap: calc(14 * var(--u)); padding-top: calc(4 * var(--u)); }
.chip { width: calc(42 * var(--u)); height: calc(42 * var(--u)); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 800; font-size: calc(11 * var(--u)); color: #fff; border: calc(3 * var(--u)) dashed rgba(255,255,255,.7); box-shadow: 0 4px 0 rgba(0,0,0,.45), 0 8px 16px rgba(0,0,0,.4); transition: transform .12s; position: relative; }
.chip::after { content: ''; position: absolute; inset: calc(4.5 * var(--u)); border-radius: 50%; border: 1px solid rgba(255,255,255,.5); }
.chip.c0 { background: radial-gradient(circle at 35% 30%, #4FD1C5, var(--teal) 60%, #0F5A5A); }
.chip.c1 { background: radial-gradient(circle at 35% 30%, #FF9BC8, var(--magenta) 60%, #8A0C47); }
.chip.c2 { background: radial-gradient(circle at 35% 30%, #FFD27A, var(--gold) 60%, #9A5A05); }
.chip.c3 { background: radial-gradient(circle at 35% 30%, #B388FF, #7C3AED 60%, #3B1A80); }
.chip.on { transform: translateY(calc(-5 * var(--u))) scale(1.12); box-shadow: 0 6px 0 rgba(0,0,0,.45), 0 0 0 calc(3 * var(--u)) var(--cream), 0 12px 24px rgba(0,0,0,.5); }
.rack-hint { text-align: center; font-size: max(10px, calc(11 * var(--u))); color: var(--cream2); font-weight: 700; min-height: calc(16 * var(--u)); margin-top: calc(5 * var(--u)); }

/* cards */
.card { position: relative; width: calc(46 * var(--u)); height: calc(64 * var(--u)); border-radius: calc(5 * var(--u)); background: #FFFBF3; box-shadow: 0 2px 6px rgba(0,0,0,.45); overflow: hidden; flex: 0 0 auto; }
.card img { width: 100%; height: 100%; display: block; object-fit: cover; }
.card.back { background: linear-gradient(135deg, var(--magenta), #8A0C47); border: calc(2 * var(--u)) solid #FFFBF3; }
.card.back::before { content: ''; position: absolute; inset: calc(3 * var(--u)); border-radius: calc(3 * var(--u)); border: 1px solid rgba(255,210,122,.8); background: repeating-linear-gradient(45deg, rgba(255,210,122,.25) 0 calc(2 * var(--u)), transparent calc(2 * var(--u)) calc(6 * var(--u))), repeating-linear-gradient(-45deg, rgba(255,210,122,.25) 0 calc(2 * var(--u)), transparent calc(2 * var(--u)) calc(6 * var(--u))); }
.card.flip { animation: flip .4s ease-out both; }
@keyframes flip { 0% { transform: rotateY(90deg) } 100% { transform: none } }

.result { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); z-index: 15; pointer-events: none; }
.result-card { text-align: center; padding: calc(12 * var(--u)) calc(26 * var(--u)); border-radius: calc(20 * var(--u)); background: var(--paper); color: var(--text); border: calc(3 * var(--u)) solid var(--gold); box-shadow: 0 20px 60px rgba(0,0,0,.5), 0 0 40px rgba(242,169,59,.45); animation: pop .4s cubic-bezier(.2,.9,.3,1.3) both; min-width: calc(200 * var(--u)); }
@keyframes pop { from { transform: scale(.6); opacity: 0 } to { transform: none; opacity: 1 } }
.result-card small { display: block; font-size: calc(11 * var(--u)); letter-spacing: .25em; text-transform: uppercase; font-weight: 900; }
.result-card small.andar { color: var(--andar); } .result-card small.bahar { color: var(--bahar); }
.result-card b { display: block; font-family: var(--display); font-size: calc(24 * var(--u)); margin: 2px 0; }
.result-amt { font-weight: 900; font-size: calc(20 * var(--u)); font-variant-numeric: tabular-nums; }
.result-amt.up { color: var(--green); } .result-amt.down { color: var(--red); } .result-amt.zero { color: var(--muted); font-size: calc(13 * var(--u)); }

.fx { position: absolute; inset: 0; pointer-events: none; z-index: 8; }
.fx .fchip { position: absolute; width: calc(16 * var(--u)); height: calc(16 * var(--u)); border-radius: 50%; background: radial-gradient(circle at 35% 35%, #FFF3C9, var(--gold) 45%, var(--gold-dark) 90%); box-shadow: inset 0 0 0 2px rgba(255,255,255,.35), 0 2px 4px rgba(0,0,0,.6); transform: translate(-50%, -50%); transition: left .5s cubic-bezier(.2,.7,.2,1), top .5s cubic-bezier(.2,.7,.2,1), opacity .2s; }
.fx .fchip { border: calc(1.5 * var(--u)) dashed rgba(255,255,255,.8); }
.fx .fchip.c0 { background: radial-gradient(circle at 35% 30%, #4FD1C5, var(--teal) 60%, #0F5A5A); } .fx .fchip.c1 { background: radial-gradient(circle at 35% 30%, #FF9BC8, var(--magenta) 60%, #8A0C47); } .fx .fchip.c2 { background: radial-gradient(circle at 35% 30%, #FFD27A, var(--gold) 60%, #9A5A05); } .fx .fchip.c3 { background: radial-gradient(circle at 35% 30%, #B388FF, #7C3AED 60%, #3B1A80); }
.fx .confetti { position: absolute; width: calc(8 * var(--u)); height: calc(12 * var(--u)); top: -20px; animation: fall 1.6s ease-in both; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); opacity: .2 } }

.table-tools { position: absolute; left: calc(10 * var(--u)); top: calc(58 * var(--u)); display: grid; grid-template-columns: repeat(2, auto); gap: calc(5 * var(--u)); z-index: 5; }
/* Never under 36 px: on a phone 30u alone is about 23 px, too small to hit. */
.tool { width: max(36px, calc(30 * var(--u))); height: max(36px, calc(30 * var(--u))); border-radius: 50%; background: rgba(255,251,243,.92); color: var(--plum); border: 1px solid rgba(0,0,0,.1); font-size: max(16px, calc(15 * var(--u))); display: flex; align-items: center; justify-content: center; font-weight: 900; }
.drawer { position: absolute; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--paper); color: var(--text); border-radius: 18px 18px 0 0; max-height: 55%; display: flex; flex-direction: column; animation: up .2s ease-out; padding-bottom: var(--safe-b); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.chat-list { flex: 1; overflow-y: auto; padding: 8px 14px; font-size: 13px; min-height: 120px; }
.chat-list div { margin-bottom: 4px; }
.chat-list b { color: var(--magenta); margin-right: 4px; }
.chat-form { display: flex; gap: 8px; padding: 8px 14px; }
.chat-form input { flex: 1; background: #fff; border: 2px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.emoji-tray { position: absolute; left: 50%; bottom: calc(150 * var(--u)); transform: translateX(-50%); z-index: 20; display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; padding: 8px; background: var(--paper); border-radius: 14px; animation: up .2s ease-out; }
.emoji-tray button { font-size: 24px; width: 40px; height: 40px; border-radius: 10px; }

/* ---------- landscape / desktop table ---------- */
@media (min-aspect-ratio: 1.15/1) {
  :root { --u: min(100vw / 880, 100dvh / 520); }
  .table.active { display: grid; grid-template-rows: auto 1fr; grid-template-columns: 1fr; }
  .stage { grid-template-columns: calc(160 * var(--u)) 1fr; grid-template-rows: 1fr auto; grid-template-areas: "host felt" "crowd crowd"; column-gap: calc(10 * var(--u)); padding: 0 calc(14 * var(--u)) calc(150 * var(--u)); }
  .felt { grid-area: felt; padding: calc(10 * var(--u)) calc(14 * var(--u)) calc(8 * var(--u)); align-self: start; }
  .runway { height: calc(88 * var(--u)); grid-template-columns: 1fr calc(70 * var(--u)) 1fr; }
  .joker-card .card { width: calc(50 * var(--u)); height: calc(70 * var(--u)); }
  .run-side { height: calc(76 * var(--u)); }
  .run-side .card { width: calc(46 * var(--u)); height: calc(64 * var(--u)); margin-top: calc(-32 * var(--u)); }
  .pockets { grid-template-columns: 1fr 1fr; }
  .pocket { min-height: calc(66 * var(--u)); }
  .pocket .stack { --chip: calc(26 * var(--u)); min-height: calc(34 * var(--u)); }
  .pocket-foot { position: absolute; left: calc(8 * var(--u)); right: calc(8 * var(--u)); bottom: calc(4 * var(--u)); margin: 0; pointer-events: none; }
  .sb { min-height: 26px; }
  .sidebets { grid-template-columns: repeat(10, 1fr); }
  .host-area { grid-area: host; height: auto; display: flex; align-items: flex-end; justify-content: flex-start; }
  .host { position: static; width: calc(150 * var(--u)); height: calc(178 * var(--u)); transform: none; animation: hostIdleL 4s ease-in-out infinite; }
  @keyframes hostIdleL { 0%, 100% { transform: none } 50% { transform: rotate(-1.5deg) translateY(-2px) } }
  .host.cheer { animation: hostCheerL .7s ease-in-out 2; }
  @keyframes hostCheerL { 50% { transform: translateY(-10px) scale(1.04) } }
  .host-bubble { left: calc(10 * var(--u)); bottom: calc(184 * var(--u)); transform: none; max-width: calc(150 * var(--u)); white-space: normal; }

  .crowd { grid-area: crowd; justify-content: center; }
  .history-strip { position: absolute; left: calc(170 * var(--u)); right: calc(170 * var(--u)); bottom: calc(118 * var(--u)); justify-content: center; }
  .rack { position: absolute; left: 50%; transform: translateX(-50%); bottom: 0; width: calc(520 * var(--u)); background: none; padding-bottom: calc(6 * var(--u)); }
  .crowd { align-self: end; }
  .rack-controls { grid-template-columns: repeat(4, 1fr); }
  .table-tools { left: auto; top: auto; bottom: calc(14 * var(--u)); right: calc(14 * var(--u)); display: flex; flex-direction: row; }
  .drawer { left: auto; right: 0; top: 60px; bottom: 0; width: 320px; max-height: none; border-radius: 18px 0 0 0; }
  .lobby-main { padding-bottom: 90px; }
}
/* ---------- a phone held sideways ----------
   300 to 430 px tall: scaling the 880x520 landscape design down to that made
   every control 17 to 26 px (UI audit, 13 Oct). Here the width does the work
   instead: hostess, history and tools in a left rail; the felt with the deal
   and the pockets in the middle; the side bets as a two-column rail on the
   felt; undo, clear, repeat, 2x and the chips in one row underneath. Every
   control is at least 32 px; the felt keeps --u for cards and pockets. */
@media (min-aspect-ratio: 1.15/1) and (max-height: 500px) {
  :root { --u: min(100vw / 760, 100dvh / 380); --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px); --rail: 104px; }
  .tbar { padding: calc(4px + var(--safe-t)) calc(10px + var(--safe-r)) 4px calc(10px + var(--safe-l)); }
  .stage { grid-template-columns: var(--rail) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; grid-template-areas: "host felt" "host crowd"; column-gap: 8px; row-gap: 4px; padding: 2px calc(8px + var(--safe-r)) 50px calc(8px + var(--safe-l)); }

  .host-area { grid-area: host; display: block; position: relative; height: auto; }
  .host { position: absolute; left: 50%; top: 0; bottom: auto; width: 92px; height: 109px; transform: translateX(-50%); animation: hostIdleP 4s ease-in-out infinite; }
  @keyframes hostIdleP { 0%, 100% { transform: translateX(-50%) } 50% { transform: translateX(-50%) rotate(-1.5deg) translateY(-2px) } }
  .host.cheer { animation: hostCheerP .7s ease-in-out 2; }
  @keyframes hostCheerP { 50% { transform: translateX(-50%) translateY(-6px) scale(1.04) } }
  .host-bubble { left: 0; right: 0; top: 112px; bottom: auto; max-width: none; transform: none; font-size: 11px; padding: 5px 8px; border-radius: 12px; white-space: normal; text-align: center; }

  .felt { grid-area: felt; align-self: stretch; display: grid; grid-template-columns: minmax(0, 1fr) clamp(150px, 24vw, 196px); grid-template-rows: auto minmax(0, 1fr); column-gap: 10px; row-gap: 6px; padding: 8px 10px; border-radius: 22px; }
  .felt-rim { border-radius: 26px; }
  .felt-top { grid-column: 1; grid-row: 1; }
  .runway { height: calc(84 * var(--u)); grid-template-columns: 1fr calc(64 * var(--u)) 1fr; }
  .run-side { height: calc(76 * var(--u)); }
  .run-side .card { width: calc(44 * var(--u)); height: calc(62 * var(--u)); margin-top: calc(-31 * var(--u)); }
  .joker-card .card { width: calc(48 * var(--u)); height: calc(67 * var(--u)); }
  .count-pill { bottom: -6px; font-size: 10px; }
  .pockets { grid-column: 1; grid-row: 2; margin-top: 4px; }
  .pocket { min-height: 64px; padding: 5px 8px; border-radius: 14px; }
  .pocket-head b { font-size: 15px; }
  .pocket .stack { --chip: 26px; min-height: 30px; }
  .pocket-foot { position: absolute; left: 8px; right: 8px; bottom: 4px; margin: 0; pointer-events: none; }

  .sidebets { grid-column: 2; grid-row: 1 / span 2; grid-template-columns: 1fr 1fr; grid-auto-rows: minmax(32px, 1fr); gap: 4px; margin: 0; align-content: stretch; }
  .sb { min-height: 32px; padding: 2px 4px; border-radius: 9px; }
  .sb b { font-size: 12px; } .sb small { font-size: 11px; }
  .sb .sb-amt { top: -6px; right: -3px; font-size: 10px; padding: 0 5px; }

  .crowd { grid-area: crowd; justify-content: flex-start; align-self: end; gap: 4px; padding: 0; }
  .pl { width: 44px; }
  .pl img { width: 28px; height: 28px; }
  .pl small { font-size: 9px; }
  .pl .pb { top: 20px; font-size: 9px; }

  /* left rail, under the hostess: the last results, then the tools */
  /* the last results as dots, newest first; the percentage line needs more width than the rail has */
  .history-strip { position: absolute; left: calc(8px + var(--safe-l)); width: var(--rail); bottom: 98px; right: auto; padding: 0; justify-content: flex-start; flex-wrap: nowrap; gap: 4px; overflow: hidden; }
  .hd { width: 20px; height: 20px; font-size: 9px; }
  .hs { display: none; }
  /* exactly the four newest (the newest is last): no half dot at the rail's edge */
  .history-strip .hd:not(:nth-last-child(-n+4)) { display: none; }
  .table-tools { left: calc(8px + var(--safe-l) + (var(--rail) - 88px - 6px) / 2); right: auto; top: auto; bottom: calc(6px + var(--safe-b)); display: grid; grid-template-columns: repeat(2, 44px); grid-auto-rows: 40px; gap: 6px; }
  .table-tools .tool { width: 44px; height: 40px; border-radius: 12px; font-size: 18px; }

  /* the rack: one row under the felt */
  .rack { position: absolute; left: calc(8px + var(--safe-l) + var(--rail) + 8px); right: calc(8px + var(--safe-r)); bottom: 0; transform: none; width: auto; display: flex; align-items: center; justify-content: center; gap: 14px; padding: 4px 0 calc(4px + var(--safe-b)); background: none; }
  .rack-controls { display: flex; gap: 6px; margin: 0; }
  .rc { min-width: 54px; min-height: 36px; padding: 0 10px; font-size: 12px; border-radius: 10px; }
  .chips { gap: 8px; padding: 0; }
  .chip { width: 40px; height: 40px; font-size: 11px; border-width: 3px; }
  .chip::after { inset: 4px; }
  .chip.on { transform: translateY(-3px) scale(1.08); }
  .rack-hint { display: none; }

  .result-card { padding: 8px 18px; }
  .result-card b { font-size: 20px; }
  .emoji-tray { bottom: 56px; }
}
/* the lobby on a phone held sideways: the welcome, bonus and private-table
   buttons on the left, the stakes on the right where they are seen at once,
   and a slimmer tab bar with the icon beside the label (UI audit, 13 Oct). */
@media (min-aspect-ratio: 1.15/1) and (max-height: 500px) {
  .topbar { padding: calc(6px + var(--safe-t)) calc(14px + var(--safe-r)) 6px calc(14px + var(--safe-l)); }
  /* max-content rows: the hero clips its overflow, so an auto row would let grid squeeze it under the bonus card */
  .lobby-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); grid-template-rows: max-content max-content 1fr; grid-template-areas: "hero tiers" "promo tiers" "quick tiers"; column-gap: 14px; row-gap: 10px; align-items: start; width: 100%; padding: 10px calc(14px + var(--safe-r)) calc(56px + var(--safe-b)) calc(14px + var(--safe-l)); }
  .hero { grid-area: hero; padding: 10px 0 0 14px; border-radius: 18px; min-height: 0; }
  .hero-text { padding-bottom: 10px; }
  .hero-text b { font-size: 18px; margin: 2px 0 8px; }
  .hero-text .btn { padding: 5px 18px; }
  .hero-host { width: 82px; height: 97px; }
  .promo { grid-area: promo; margin: 0; }
  .promo-card { padding: 8px 12px; }
  .quick-row { grid-area: quick; margin: 0; }
  .tiers { grid-area: tiers; }
  .lobby .tiers h2 { margin: 0 0 8px; font-size: 16px; }
  .tier-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .tier { padding: 10px 12px; }
  .tier b { font-size: 20px; }
  .bn { flex-direction: row; justify-content: center; gap: 6px; padding: 6px 0; min-height: 44px; font-size: 12px; }
  .bn-ico { font-size: 18px; }
  .bn-dot { top: 7px; right: calc(50% - 34px); }
}

/* short phones: a smaller hostess, so her bubble always clears the results and the tools */
@media (min-aspect-ratio: 1.15/1) and (max-height: 360px) {
  .host { width: 66px; height: 78px; }
  .host-bubble { top: 82px; font-size: 10.5px; padding: 4px 6px; }
  /* lobby: a tighter welcome, so the bonus card sits above the tab bar */
  .hero-text small { display: none; }
  .hero-text b { font-size: 16px; margin: 0 0 6px; }
  .hero-text .btn { padding: 4px 16px; }
  .hero-host { width: 62px; height: 74px; }
  .promo-card { padding: 6px 10px; }
}
/* the shortest phones: the player strip gives its row to the felt */
@media (min-aspect-ratio: 1.15/1) and (max-height: 330px) {
  .crowd { display: none; }
  .stage { grid-template-areas: "host felt" "host felt"; }
}

@media (prefers-reduced-motion: reduce) { .host, .host.cheer, .run-side .card.land, .pocket.win, .splash-host { animation: none; } }

/* Real-money players: rupees, the operator's cashier, nothing that hands out free chips. */
body.real-money .chip-ico, body.real-money #bn-bonus, body.real-money #promo-bonus, body.real-money .promo, body.real-money #menu-bonus,
body.real-money #btn-attach-phone, body.real-money #tool-gift, body.real-money [data-screen="leaderboard"], body.real-money #otp-test-note { display: none !important; }

/* Icons and reaction art (21 Oct 2026): Phosphor icons from /icons.svg, 3D reactions from /fx3d/. */
.ico { width: 1em; height: 1em; fill: currentColor; display: block; flex: none; }
.icon-btn .ico { width: 20px; height: 20px; }
.bn-ico { display: flex; } .bn-ico .ico { width: 24px; height: 24px; }
.bn.active .bn-ico .ico { filter: drop-shadow(0 2px 6px rgba(242,169,59,.35)); }
.tool { display: inline-flex; align-items: center; justify-content: center; }
.tool .ico { width: 55%; height: 55%; }
.emoji-tray button { display: flex; align-items: center; justify-content: center; transition: transform .12s, background .12s; }
.emoji-tray button:active { transform: scale(.9); background: rgba(0,0,0,.06); }
.emoji-tray .r3d { width: 32px; height: 32px; pointer-events: none; }
.pl .emo .r3d { width: calc(34 * var(--u)); height: calc(34 * var(--u)); min-width: 26px; min-height: 26px; display: block; filter: drop-shadow(0 3px 6px rgba(0,0,0,.35)); }
/* Centred without a transform: the slide-in animation animates transform and used to throw the tray off centre. */
.emoji-tray { left: 0; right: 0; margin-inline: auto; width: max-content; transform: none; }
/* Stake cards: a crisp coin from the 3D set in place of the blurred glow blob. */
.tier::before { right: 12px; top: 12px; width: 30px; height: 30px; border-radius: 0; background: url(/fx3d/coin.webp) center / contain no-repeat; }
.tier.locked::before { filter: grayscale(1); opacity: .45; }
/* Toasts sit under the header bar instead of on top of the player's name. */
.toasts { top: calc(72px + var(--safe-t)); }
.tier .tier-live { top: auto; bottom: 16px; right: 12px; }   /* the coin has the top-right corner */

/* Controls (21 Oct 2026). One radius for controls, one for cards, one for
   sheets; everything tappable answers a press; keyboard focus is visible.
   The press uses the scale property so it composes with a rule's own
   transform. The main magenta button keeps its pushed-down 3D press. */
:root { --r-ctl: 14px; --r-card: 18px; --r-sheet: 24px; }
.btn, .btn-sm, .btn-lg, .icon-btn, .tab, .menu-item, .gift-amts button, .emoji-tray button { border-radius: var(--r-ctl); }
.tier, .promo-card, .drawer { border-radius: var(--r-card); }
.hero { border-radius: var(--r-sheet); }
.btn, .icon-btn, .tier, .tab, .gift-amts button, .bn, .tool, .avatar-picker button, .chips-pill, .rc { transition: scale .09s ease-out, filter .15s, background-color .15s, border-color .15s, transform .08s, box-shadow .08s; }
.btn:not(.btn-main):active { transform: none; }
.btn:not(.btn-main):not(:disabled):active, .icon-btn:active, .tier:not(.locked):active, .tab:active, .gift-amts button:active,
.bn:active, .tool:active, .avatar-picker button:active, .chips-pill:active, .rc:not(:disabled):active { scale: .97; }
@media (hover: hover) {
  .btn-ghost:hover, .icon-btn:hover, .tier:not(.locked):hover, .tab:hover, .gift-amts button:hover { filter: brightness(.97); }
  .btn-main:hover, .tool:hover { filter: brightness(1.06); }
}
:where(button, a, [role="button"]):focus-visible { outline: 2px solid var(--magenta); outline-offset: 2px; }
.table :where(button, a, [role="button"]):focus-visible { outline-color: var(--gold-light); }
.tier.locked { cursor: not-allowed; }
