:root {
  --bg: #1d0b24; --bg2: #2a1034; --card: #36173f; --card2: #43204d; --line: #5a3166;
  --text: #fff4f8; --muted: #c9a9d1; --pink: #ff3d8b; --pink2: #d81b6e; --gold: #ffc857; --gold2: #e9a823;
  --teal: #1fd1b2; --purple: #8a5cff; --orange: #ff8a3d; --green: #3ddc84; --red: #ff6b6b;
  --radius: 20px; --shadow: 0 6px 0 rgba(0,0,0,.28);
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif; --display: "Baloo 2", "Nunito", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.35; }
body { min-height: 100vh; min-height: 100dvh; background:
  radial-gradient(900px 500px at 85% -10%, rgba(255,61,139,.22), transparent 60%),
  radial-gradient(700px 500px at -10% 30%, rgba(138,92,255,.20), transparent 60%), var(--bg); background-attachment: fixed; }
#app { max-width: 520px; margin: 0 auto; padding: 14px 16px calc(24px + env(safe-area-inset-bottom)); min-height: 100dvh; }
h1, h2, h3 { font-family: var(--display); margin: 0; line-height: 1.1; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; }
input { font: inherit; color: var(--text); }
a { color: var(--gold); }
.muted { color: var(--muted); }
.row { display: flex; align-items: center; gap: 10px; }
.sp { flex: 1; }
.center { text-align: center; }
.mt { margin-top: 16px; } .mt2 { margin-top: 28px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 20px; border-radius: 16px; font-weight: 800; font-family: var(--display); font-size: 18px; background: var(--card2); box-shadow: var(--shadow); transition: transform .08s, box-shadow .08s; min-height: 52px; }
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0,0,0,.28); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, var(--pink), var(--pink2)); }
.btn.gold { background: linear-gradient(180deg, var(--gold), var(--gold2)); color: #3a1c00; }
.btn.teal { background: linear-gradient(180deg, var(--teal), #12a58c); color: #02312a; }
.btn.ghost { background: transparent; box-shadow: none; border: 2px solid var(--line); }
.btn.block { width: 100%; }
.btn.sm { padding: 8px 14px; font-size: 15px; min-height: 40px; border-radius: 12px; }
.icon-btn { width: 44px; height: 44px; border-radius: 14px; background: var(--card); display: grid; place-items: center; font-size: 20px; }
.input { width: 100%; padding: 14px 16px; border-radius: 14px; background: var(--bg2); border: 2px solid var(--line); outline: none; font-weight: 700; font-size: 18px; }
.input:focus { border-color: var(--pink); }
.input.code { text-transform: uppercase; letter-spacing: .3em; text-align: center; font-family: var(--display); font-size: 24px; }
label.field { display: block; font-weight: 800; font-size: 14px; color: var(--muted); margin: 14px 0 6px; }

/* cards */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; background: var(--card2); letter-spacing: .02em; }
.pill.pink { background: var(--pink); } .pill.gold { background: var(--gold); color: #3a1c00; } .pill.teal { background: var(--teal); color: #02312a; } .pill.dim { background: transparent; border: 1.5px solid var(--line); color: var(--muted); }
.pos { color: var(--green); } .neg { color: var(--red); }

/* home */
.logo { font-family: var(--display); font-weight: 800; font-size: 54px; letter-spacing: -1px; line-height: 1; }
.logo .k { color: var(--pink); }
.hero { padding: 26px 4px 8px; }
.hero p { font-size: 19px; color: var(--muted); margin: 8px 0 0; }
.hero .spin { display: inline-block; width: 22px; height: 22px; border-radius: 50%; background: var(--gold); border: 3px dashed #fff8; vertical-align: -3px; margin-left: 6px; animation: spin 6s linear infinite; }
.fine { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.group-chip { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--card); border-radius: 16px; width: 100%; text-align: left; margin-top: 8px; }

/* avatars */
.av { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 20px; color: #fff; flex: none; box-shadow: inset 0 -4px 0 rgba(0,0,0,.18); }
.av.sm { width: 30px; height: 30px; font-size: 14px; }

/* variant picker */
.tabs { display: flex; gap: 8px; margin: 14px 0 10px; overflow-x: auto; scrollbar-width: none; }
.tab { padding: 10px 16px; border-radius: 999px; background: var(--card); font-weight: 800; font-family: var(--display); white-space: nowrap; }
.tab[aria-selected="true"] { background: var(--pink); }
.vgrid { display: grid; gap: 10px; }
.vcard { text-align: left; width: 100%; padding: 14px 16px; border-radius: 18px; background: var(--card); border: 2.5px solid transparent; display: flex; gap: 12px; align-items: center; }
.vcard[aria-pressed="true"] { border-color: var(--gold); background: var(--card2); }
.vcard .badge { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 24px; background: var(--bg2); flex: none; }
.vcard b { font-family: var(--display); font-size: 18px; display: block; }
.rules li { margin: 6px 0; }
.rules { padding-left: 20px; margin: 8px 0 0; color: var(--text); }

/* table screen */
.topbar { display: flex; align-items: center; gap: 8px; }
.topbar .title { min-width: 0; flex: 1; }
.topbar .title b { font-family: var(--display); font-size: 19px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.codepill { font-family: var(--display); letter-spacing: .18em; font-weight: 800; background: var(--bg2); border: 2px dashed var(--line); padding: 2px 10px; border-radius: 10px; font-size: 14px; }
.handi-wrap { position: relative; text-align: center; margin: 4px 0 2px; }
.handi { display: block; margin: 0 auto; width: 200px; max-width: 58vw; height: auto; filter: drop-shadow(0 10px 0 rgba(0,0,0,.25)); }
.handi .lid { transform-origin: 100px 62px; }
.handi.rattle .lid { animation: rattle .5s ease; }
.handi.rattle { animation: hop .5s ease; }
.pot-plaque { margin: -34px auto 0; position: relative; display: table; background: linear-gradient(180deg, var(--gold), var(--gold2)); color: #3a1c00; padding: 4px 22px 6px; border-radius: 16px; box-shadow: var(--shadow); }
.pot-plaque b { font-family: var(--display); font-size: 34px; display: block; line-height: 1; }
.pot-plaque small { font-weight: 800; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; opacity: .75; }
.round-tag { margin-top: 10px; font-size: 13px; color: var(--muted); font-weight: 800; }

.players { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.pl { background: var(--card); border-radius: 18px; padding: 12px; display: grid; gap: 8px; position: relative; border: 2.5px solid transparent; text-align: left; width: 100%; }
.pl.you { border-color: var(--pink); }
.pl.folded { opacity: .55; }
.pl.left { opacity: .4; }
.pl .nm { font-weight: 800; font-family: var(--display); font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl .bal { font-family: var(--display); font-weight: 800; font-size: 24px; line-height: 1; }
.pl .bal small { font-size: 12px; color: var(--muted); font-weight: 700; margin-left: 4px; }
.pl .tags { display: flex; gap: 4px; flex-wrap: wrap; min-height: 20px; }
.pl .delta { font-size: 13px; font-weight: 800; }
.pl .in { position: absolute; top: 10px; right: 10px; font-size: 12px; font-weight: 800; background: var(--bg2); border-radius: 999px; padding: 2px 8px; color: var(--gold); }

.banker-bar { display: flex; gap: 8px; overflow-x: auto; margin: 16px -16px 0; padding: 4px 16px 8px; scrollbar-width: none; }
.banker-bar .btn { flex: none; }
.dock { position: sticky; bottom: 0; margin: 16px -16px calc(-24px - env(safe-area-inset-bottom)); padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(29,11,36,0), var(--bg) 22%); }
.dock-inner { background: var(--card); border-radius: 24px; padding: 12px; box-shadow: 0 -4px 30px rgba(0,0,0,.35); display: grid; gap: 10px; }
.btnrow { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.stakeinfo { display: flex; align-items: center; gap: 8px; font-weight: 800; }

/* chips */
.tray { display: flex; gap: 10px; justify-content: space-between; }
.chip { width: 58px; height: 58px; border-radius: 50%; position: relative; font-family: var(--display); font-weight: 800; font-size: 16px; color: #fff; display: grid; place-items: center; background: var(--c); box-shadow: 0 5px 0 rgba(0,0,0,.3), inset 0 0 0 4px var(--c), inset 0 0 0 6px rgba(255,255,255,.85); transition: transform .08s; flex: none; }
.chip::after { content: ""; position: absolute; inset: 9px; border-radius: 50%; border: 2px dashed rgba(255,255,255,.55); }
.chip span { position: relative; z-index: 1; text-shadow: 0 1px 0 rgba(0,0,0,.3); }
.chip:active { transform: translateY(4px) scale(.96); box-shadow: 0 1px 0 rgba(0,0,0,.3), inset 0 0 0 4px var(--c), inset 0 0 0 6px rgba(255,255,255,.85); }
.chip.flying { position: fixed; z-index: 90; pointer-events: none; transition: transform .45s cubic-bezier(.3,.7,.4,1), opacity .45s; }
.pending { display: flex; align-items: center; gap: 10px; }
.pending b { font-family: var(--display); font-size: 28px; }

/* sheet */
.sheet-bg { position: fixed; inset: 0; background: rgba(10,2,14,.65); z-index: 40; animation: fade .15s; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 520px; z-index: 41; background: var(--bg2); border-radius: 28px 28px 0 0; padding: 10px 18px calc(20px + env(safe-area-inset-bottom)); max-height: 88dvh; overflow-y: auto; animation: rise .22s ease-out; border-top: 2px solid var(--line); }
.sheet .grab { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
.sheet h3 { font-size: 24px; margin-bottom: 4px; }
.pick { display: grid; gap: 8px; margin: 12px 0; }
.pick button { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; background: var(--card); border: 2.5px solid transparent; text-align: left; width: 100%; }
.pick button[aria-pressed="true"] { border-color: var(--gold); background: var(--card2); }
.pick button:disabled { opacity: .35; }
.pick .grow { flex: 1; min-width: 0; font-weight: 800; }
.potcard { background: var(--card); border-radius: 18px; padding: 12px; margin: 10px 0; }
.potcard h4 { margin: 0 0 6px; font-family: var(--display); font-size: 18px; }
.sel-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.sel-row button { padding: 6px 12px; border-radius: 999px; background: var(--bg2); font-weight: 800; border: 2px solid transparent; }
.sel-row button[aria-pressed="true"] { border-color: var(--gold); background: var(--card2); }
.qr { background: #fff; border-radius: 20px; padding: 10px; width: 220px; height: 220px; margin: 14px auto; display: block; }
.feed { display: grid; gap: 4px; margin-top: 8px; font-size: 14px; }
.feed div { padding: 6px 10px; border-radius: 10px; background: var(--card); }
.feed .undone { text-decoration: line-through; opacity: .5; }
.codebig { font-family: var(--display); font-size: 40px; letter-spacing: .25em; font-weight: 800; text-align: center; }

/* settlement / hisaab */
.stand { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--card); border-radius: 16px; margin-top: 8px; }
.stand .amt { font-family: var(--display); font-weight: 800; font-size: 22px; }
.xfer { display: flex; align-items: center; gap: 8px; padding: 12px; background: var(--card2); border-radius: 16px; margin-top: 8px; font-weight: 800; }
.xfer .arrow { color: var(--gold); font-size: 20px; }
.xfer .amt { margin-left: auto; font-family: var(--display); font-size: 22px; color: var(--gold); }

/* group */
.lb { display: grid; grid-template-columns: 30px 44px 1fr auto; gap: 10px; align-items: center; padding: 12px; background: var(--card); border-radius: 16px; margin-top: 8px; }
.lb .rank { font-family: var(--display); font-weight: 800; font-size: 20px; color: var(--muted); text-align: center; }
.lb .sub { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.lb .net { font-family: var(--display); font-weight: 800; font-size: 22px; text-align: right; }
.game { padding: 12px; background: var(--card); border-radius: 16px; margin-top: 8px; }
.game .res { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* fx */
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--red); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 800; z-index: 99; max-width: 88vw; box-shadow: var(--shadow); animation: rise .2s; text-align: center; }
.toast.ok { background: var(--teal); color: #02312a; }
.winner-pop { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: rgba(20,4,26,.78); animation: fade .2s; padding: 20px; }
.winner-pop .box { background: linear-gradient(180deg, var(--card2), var(--card)); border: 3px solid var(--gold); border-radius: 28px; padding: 26px 30px; text-align: center; animation: pop .35s cubic-bezier(.3,1.6,.5,1); max-width: 360px; }
.winner-pop .big { font-family: var(--display); font-size: 44px; font-weight: 800; color: var(--gold); }
.spark { position: fixed; top: -20px; font-size: 26px; z-index: 85; pointer-events: none; animation: fall linear forwards; }
.empty { text-align: center; color: var(--muted); padding: 22px 8px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 5px dashed var(--pink); animation: spin 1.4s linear infinite; margin: 40px auto; }
.hide-sm { display: none; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { transform: translate(var(--tx, 0), 24px); opacity: 0; } to { transform: translate(var(--tx, 0), 0); opacity: 1; } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
@keyframes rattle { 0%,100% { transform: rotate(0); } 20% { transform: rotate(-9deg) translateY(-3px); } 40% { transform: rotate(8deg); } 60% { transform: rotate(-5deg); } 80% { transform: rotate(3deg); } }
@keyframes hop { 40% { transform: translateY(-8px); } }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }
.toast { --tx: -50%; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .spark { display: none; }
}

.sticky-cta { position: sticky; bottom: 0; margin: 16px -16px 0; padding: 14px 16px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(29,11,36,0), var(--bg) 35%); z-index: 5; }
