/* Gold Rush Card Club — midnight arcade, gold as the reward colour.
   Roles: plum-night base 60% · surfaces 30% · gold accent (coins + primary action) ·
   pink = celebration only · cyan = "your turn" / info. 8px spacing unit, 1.25 type scale. */
:root {
  --bg: #12081f;
  --bg-2: #1a0d2e;
  --surface: #241339;
  --surface-2: #2f1a4a;
  --line: #45306a;
  --text: #fff6e5;
  --muted: #c3b3df;
  --gold: #ffc83d;
  --gold-2: #ff9f1c;
  --gold-ink: #3a2300;
  --pink: #ff4fa3;
  --cyan: #3be8d0;
  --danger: #ff6b6b;
  --felt: #0f6b54;
  --felt-2: #08402f;
  --red-suit: #d7263d;
  --black-suit: #1b1530;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --display: 'Lilita One', 'Arial Rounded MT Bold', system-ui, sans-serif;
  --ui: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --card-w: 64px;
  --card-h: 90px;
  color-scheme: dark;
}
@media (max-width: 640px) { :root { --card-w: 50px; --card-h: 72px; } }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(255, 79, 163, .16), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(59, 232, 208, .12), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 500 16px/1.5 var(--ui);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--display); font-weight: 400; letter-spacing: .01em; line-height: 1.15; margin: 0 0 8px; }
h1 { font-size: clamp(32px, 6vw, 48px); }
h2 { font-size: clamp(24px, 4vw, 32px); }
h3 { font-size: 20px; }
a { color: var(--gold); }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--gold); color: var(--gold-ink); padding: 8px 16px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
main { padding: 16px 16px 48px; max-width: 1200px; margin: 0 auto; outline: none; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 8px 16px; background: rgba(18, 8, 31, .86); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); }
.brand-coin {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  font: 400 20px var(--display); color: var(--gold-ink);
  background: radial-gradient(circle at 35% 30%, #fff3b0, var(--gold) 45%, #c97a00);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .25), 0 0 18px rgba(255, 200, 61, .5);
  animation: coinSpin 6s var(--ease) infinite;
}
.brand-name { font: 400 20px/1 var(--display); }
.brand-name small { display: block; font: 800 11px var(--ui); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 800; padding: 8px 14px; border-radius: 999px; transition: background .2s var(--ease), color .2s; }
.nav a:hover { color: var(--text); background: var(--surface); }
.nav a.active { color: var(--gold-ink); background: var(--gold); }
.wallet-chip {
  margin-left: auto; display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 8px;
  background: linear-gradient(180deg, #3a2160, #251340); border: 1px solid #6a4a9a; border-radius: 999px;
  font: 800 18px var(--ui); font-variant-numeric: tabular-nums; box-shadow: 0 0 0 0 rgba(255, 200, 61, .0);
  transition: box-shadow .4s var(--ease), transform .2s var(--spring);
}
.wallet-chip.up { box-shadow: 0 0 0 6px rgba(255, 200, 61, .25), 0 0 30px rgba(255, 200, 61, .6); transform: scale(1.06); }
.wallet-chip.down { animation: shake .4s; }
.wallet-debt { font-size: 12px; font-weight: 800; color: #ffd0d0; background: rgba(255, 107, 107, .18); border-radius: 999px; padding: 2px 8px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface); color: var(--text); text-decoration: none; cursor: pointer; font: 800 16px var(--ui); }
.icon-btn:hover { background: var(--surface-2); }
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .brand-name { display: none; }
  .nav { order: 5; width: 100%; margin: 0; justify-content: space-around; }
  .nav a { flex: 1; text-align: center; }
}

/* ---------- coins ---------- */
.coin { display: inline-block; width: 22px; height: 22px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 30%, #fff3b0, var(--gold) 45%, #c97a00); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .25); }
.coin.sm { width: 22px; height: 22px; }
.coin.lg { width: 44px; height: 44px; }
.amt { font-variant-numeric: tabular-nums; font-weight: 900; }
.pos { color: #7dffb0; } .neg { color: #ff9a9a; }

/* ---------- buttons & forms ---------- */
.btn {
  --b: var(--surface-2); --c: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 20px;
  border: 0; border-radius: 14px; background: var(--b); color: var(--c); font: 900 16px var(--ui); letter-spacing: .01em;
  cursor: pointer; text-decoration: none; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .25);
  transition: transform .15s var(--spring), filter .15s, box-shadow .15s;
}
.btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn:active { transform: translateY(2px) scale(.98); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .25); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; filter: grayscale(.4); }
.btn.gold { --b: linear-gradient(180deg, #ffd96b, var(--gold) 50%, var(--gold-2)); --c: var(--gold-ink); box-shadow: inset 0 -4px 0 rgba(120, 60, 0, .45), 0 6px 20px rgba(255, 159, 28, .35); }
.btn.cyan { --b: linear-gradient(180deg, #7ff5e4, var(--cyan)); --c: #032b26; }
.btn.pink { --b: linear-gradient(180deg, #ff86c1, var(--pink)); --c: #2d0016; }
.btn.ghost { --b: transparent; box-shadow: inset 0 0 0 2px var(--line); }
.btn.danger { --b: #4a1d2c; --c: #ffc4c4; box-shadow: inset 0 0 0 2px #7a2a40; }
.btn.sm { min-height: 40px; padding: 6px 14px; font-size: 14px; border-radius: 12px; }
.btn.xl { min-height: 60px; padding: 14px 28px; font-size: 20px; border-radius: 18px; }
.btn.glow { animation: glow 1.4s ease-in-out infinite; }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 800; font-size: 14px; color: var(--muted); }
input[type=text], input[type=password], input[type=number] {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 12px; border: 2px solid var(--line);
  background: var(--bg-2); color: var(--text); font: 700 16px var(--ui);
}
input:focus { border-color: var(--cyan); outline: none; }
.error-msg { color: #ffb3b3; font-weight: 800; min-height: 1.5em; }
.chips-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.chips-pick input { position: absolute; opacity: 0; pointer-events: none; }
.chips-pick label {
  min-width: 64px; min-height: 48px; padding: 8px 14px; display: grid; place-items: center; border-radius: 999px; cursor: pointer;
  border: 2px dashed var(--line); font: 900 16px var(--ui); color: var(--text); background: var(--bg-2); transition: all .15s var(--ease);
}
.chips-pick input:checked + label { border: 2px solid var(--gold); background: radial-gradient(circle at 50% 40%, #4a2f12, #2c1a08); color: var(--gold); transform: scale(1.06); box-shadow: 0 0 16px rgba(255, 200, 61, .35); }
.chips-pick input:focus-visible + label { outline: 3px solid var(--cyan); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 800; cursor: pointer; min-height: 44px; }
.check input { width: 22px; height: 22px; accent-color: var(--gold); }

/* ---------- panels ---------- */
.panel { background: linear-gradient(180deg, var(--surface), #1d0f30); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.tag { display: inline-block; font: 900 11px var(--ui); letter-spacing: .1em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.tag.gold { background: rgba(255, 200, 61, .16); color: var(--gold); }
.tag.cyan { background: rgba(59, 232, 208, .15); color: var(--cyan); }
.tag.pink { background: rgba(255, 79, 163, .16); color: #ff9ccc; }

/* ---------- auth ---------- */
.auth { min-height: calc(100vh - 64px); display: grid; place-items: center; }
.auth-card { width: min(440px, 100%); }
.auth-hero { text-align: center; margin-bottom: 24px; }
.auth-hero .coin.lg { width: 84px; height: 84px; margin: 0 auto 12px; display: block; animation: coinSpin 3.5s var(--ease) infinite; box-shadow: 0 0 40px rgba(255, 200, 61, .55); }
.auth-hero h1 span { color: var(--gold); }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg-2); border-radius: 14px; padding: 4px; margin-bottom: 16px; }
.tabs button { min-height: 44px; border: 0; background: none; color: var(--muted); font: 900 15px var(--ui); border-radius: 10px; cursor: pointer; }
.tabs button[aria-selected=true] { background: var(--surface-2); color: var(--text); }
.fine { font-size: 13px; color: var(--muted); text-align: center; margin-top: 12px; }

/* ---------- lobby ---------- */
.hero { display: flex; gap: 16px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; margin: 8px 0 20px; }
.hero h1 em { font-style: normal; color: var(--gold); }
.joinbox { display: flex; gap: 8px; }
.joinbox input { width: 150px; text-transform: uppercase; letter-spacing: .2em; font-weight: 900; }
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.game-tile {
  position: relative; overflow: hidden; text-align: left; border: 0; cursor: pointer; color: #fff; padding: 20px; min-height: 190px;
  border-radius: 22px; background: var(--g); box-shadow: var(--shadow), inset 0 -6px 0 rgba(0, 0, 0, .2);
  display: flex; flex-direction: column; justify-content: flex-end; transition: transform .25s var(--spring), box-shadow .25s;
}
.game-tile:hover, .game-tile:focus-visible { transform: translateY(-6px) rotate(-.6deg); box-shadow: 0 18px 40px rgba(0, 0, 0, .45), 0 0 0 3px rgba(255, 255, 255, .25); }
.game-tile .glyph { position: absolute; right: -10px; top: -26px; font: 400 150px/1 var(--display); opacity: .22; transform: rotate(12deg); transition: transform .4s var(--spring); }
.game-tile:hover .glyph { transform: rotate(0) scale(1.08); }
.game-tile h3 { font-size: 28px; margin: 0; text-shadow: 0 2px 0 rgba(0, 0, 0, .25); }
.game-tile p { margin: 4px 0 12px; font-weight: 800; opacity: .92; }
.game-tile .play { align-self: flex-start; background: rgba(0, 0, 0, .28); padding: 8px 16px; border-radius: 999px; font-weight: 900; }
.g-rummy { --g: linear-gradient(135deg, #ff4fa3, #9b2cff); }
.g-seep { --g: linear-gradient(135deg, #00b4a0, #126bff); }
.g-eights { --g: linear-gradient(135deg, #ff7a00, #ff2e63); }
.g-teenpatti { --g: linear-gradient(135deg, #b10f6a, #ff9f1c); }
.g-poker { --g: linear-gradient(135deg, #0f6b54, #13315c); }
.g-blackjack { --g: linear-gradient(135deg, #1b1530, #6d28d9); }
.section-title { margin: 32px 0 12px; display: flex; align-items: center; gap: 12px; }
.open-tables { display: grid; gap: 8px; }
.open-table { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.open-table .code { font: 400 20px var(--display); letter-spacing: .1em; color: var(--gold); }
.empty { padding: 24px; text-align: center; color: var(--muted); border: 2px dashed var(--line); border-radius: 16px; }
.disclaimer { margin-top: 40px; font-size: 13px; color: var(--muted); text-align: center; }

/* ---------- dialog ---------- */
dialog { border: 0; padding: 0; background: transparent; color: var(--text); max-width: min(560px, calc(100vw - 32px)); width: 100%; }
dialog::backdrop { background: rgba(8, 3, 16, .75); backdrop-filter: blur(4px); }
dialog .panel { max-height: calc(100vh - 48px); overflow: auto; }
dialog[open] .panel { animation: pop .3s var(--spring); }
.rules { padding-left: 20px; margin: 0; }
.rules li { margin-bottom: 8px; }
details.rules-box { background: var(--bg-2); border-radius: 14px; padding: 12px 16px; border: 1px solid var(--line); }
details.rules-box summary { cursor: pointer; font-weight: 900; min-height: 32px; }
.mode-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 8px 0 16px; }
.mode-pick button { min-height: 96px; border-radius: 16px; border: 2px solid var(--line); background: var(--bg-2); color: var(--text); cursor: pointer; font: 800 14px var(--ui); padding: 12px; text-align: left; }
.mode-pick button b { display: block; font: 400 20px var(--display); margin-bottom: 4px; }
.mode-pick button[aria-pressed=true] { border-color: var(--gold); background: #2a1a0b; box-shadow: 0 0 20px rgba(255, 200, 61, .25); }

/* ---------- bank ---------- */
.bank { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; }
@media (max-width: 860px) { .bank { grid-template-columns: 1fr; } }
.vault { background: radial-gradient(500px 240px at 20% 0%, rgba(255, 200, 61, .22), transparent), linear-gradient(180deg, #2b1847, #1b0e2f); }
.big-bal { font: 400 clamp(44px, 9vw, 72px)/1 var(--display); color: var(--gold); display: flex; align-items: center; gap: 12px; text-shadow: 0 4px 0 rgba(0, 0, 0, .3); }
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.stat { background: rgba(0, 0, 0, .22); border-radius: 14px; padding: 12px; }
.stat b { display: block; font: 400 24px var(--display); }
.stat span { font-size: 13px; color: var(--muted); font-weight: 800; }
.meter { height: 14px; background: var(--bg-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--cyan), var(--gold), var(--danger)); border-radius: 999px; transition: width .6s var(--ease); }
.ledger { width: 100%; border-collapse: collapse; font-size: 14px; }
.ledger th, .ledger td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.ledger th { color: var(--muted); font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.ledger td.num, .ledger th.num { text-align: right; font-variant-numeric: tabular-nums; }
.loan-list { display: flex; flex-wrap: wrap; gap: 8px; }
.loan { padding: 8px 12px; border-radius: 12px; background: rgba(255, 107, 107, .12); border: 1px solid rgba(255, 107, 107, .35); font-weight: 800; font-size: 14px; }
.table-wrap { overflow-x: auto; }

/* ---------- leaderboard ---------- */
.lb tr:nth-child(1) td:first-child::before { content: '🥇 '; }
.lb tr:nth-child(2) td:first-child::before { content: '🥈 '; }
.lb tr:nth-child(3) td:first-child::before { content: '🥉 '; }

/* ---------- table screen ---------- */
.tbl-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.tbl-head h1 { font-size: clamp(26px, 5vw, 36px); margin: 0; }
.code-pill { font: 400 18px var(--display); letter-spacing: .14em; background: var(--surface); border: 2px dashed var(--gold); color: var(--gold); padding: 4px 12px; border-radius: 12px; }
.tbl-layout { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
@media (max-width: 980px) { .tbl-layout { grid-template-columns: 1fr; } }
.felt {
  position: relative; border-radius: 28px; padding: 16px; min-height: 520px;
  background: radial-gradient(ellipse at 50% 40%, #16846a, var(--felt) 45%, var(--felt-2));
  box-shadow: inset 0 0 0 10px #4a2a14, inset 0 0 0 13px #a0692f, inset 0 0 60px rgba(0, 0, 0, .55), var(--shadow);
  display: flex; flex-direction: column; gap: 12px;
}
@media (max-width: 640px) { .felt { padding: 14px 10px; border-radius: 20px; min-height: 420px; } }
.opps { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; padding-top: 8px; }
.seat {
  position: relative; min-width: 120px; max-width: 200px; padding: 8px 10px; border-radius: 16px; text-align: center;
  background: rgba(10, 4, 20, .55); border: 2px solid rgba(255, 255, 255, .08); transition: border-color .2s, box-shadow .2s, transform .2s var(--spring);
}
.seat.turn { border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(59, 232, 208, .25), 0 0 24px rgba(59, 232, 208, .45); transform: translateY(-2px); }
.seat.out { opacity: .5; filter: grayscale(.6); }
.seat.winner { border-color: var(--gold); box-shadow: 0 0 30px rgba(255, 200, 61, .7); animation: bounce .7s var(--spring) 2; }
.seat .who { display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 900; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font: 400 14px var(--display); color: #1b1530; background: var(--av, #ffc83d); flex: none; }
.seat .meta { font-size: 12px; color: var(--muted); font-weight: 800; }
.seat .mini { display: flex; justify-content: center; gap: 2px; margin-top: 6px; min-height: 20px; }
.timer { position: absolute; left: 10px; right: 10px; bottom: 3px; height: 3px; background: rgba(255, 255, 255, .15); border-radius: 3px; overflow: hidden; }
.timer i { display: block; height: 100%; background: var(--cyan); transform-origin: left; }
.center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
.pot { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px; background: rgba(0, 0, 0, .35); font: 400 22px var(--display); color: var(--gold); }
.pot.bump { animation: pop .35s var(--spring); }
.status-line { font-weight: 900; text-align: center; background: rgba(0, 0, 0, .3); padding: 6px 14px; border-radius: 999px; font-size: 14px; }
.status-line.you { background: var(--cyan); color: #03231f; animation: pulse 1.4s ease-in-out infinite; }
.me { background: rgba(5, 2, 12, .4); border-radius: 20px; padding: 12px; }
.me-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; font-weight: 900; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.side { display: flex; flex-direction: column; gap: 12px; }
.log { font-size: 13px; color: var(--muted); max-height: 220px; overflow: auto; display: flex; flex-direction: column; gap: 4px; }
.log div:last-child { color: var(--text); font-weight: 800; }
.chat-form { display: flex; gap: 6px; margin-top: 8px; }
.chat-form input { min-height: 40px; }
.seat-editor { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; width: 100%; max-width: 720px; }
.seat-slot { padding: 12px; border-radius: 16px; background: rgba(0, 0, 0, .3); border: 2px dashed rgba(255, 255, 255, .2); text-align: center; display: grid; gap: 8px; justify-items: center; min-height: 110px; align-content: center; }
.seat-slot.filled { border-style: solid; border-color: rgba(255, 255, 255, .15); }
.seat-slot.you { border-color: var(--gold); }
.invite { text-align: center; }
.invite .big-code { font: 400 44px var(--display); letter-spacing: .2em; color: var(--gold); text-shadow: 0 0 24px rgba(255, 200, 61, .5); }
.result-banner {
  position: relative; text-align: center; padding: 16px; border-radius: 20px; background: rgba(0, 0, 0, .45); border: 2px solid var(--gold);
  animation: pop .4s var(--spring);
}
.result-banner.win { background: radial-gradient(circle at 50% 0%, rgba(255, 79, 163, .45), rgba(0, 0, 0, .5)); border-color: var(--pink); }
.result-banner .delta { font: 400 44px var(--display); }
.result-banner .delta.pos { color: var(--gold); text-shadow: 0 0 20px rgba(255, 200, 61, .7); }
.result-banner .countdown { font-weight: 800; color: var(--muted); font-size: 14px; }

/* ---------- cards ---------- */
.hand { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.hand.fan .card { margin-left: calc(var(--card-w) * -0.32); }
.hand.fan .card:first-child { margin-left: 0; }
.card {
  position: relative; width: var(--card-w); height: var(--card-h); border-radius: 10px; flex: none; user-select: none;
  background: linear-gradient(160deg, #ffffff, #f3eee6); color: var(--black-suit); border: 0; padding: 0;
  box-shadow: 0 3px 0 #c9bfae, 0 6px 14px rgba(0, 0, 0, .35); font-family: var(--ui);
  transition: transform .18s var(--spring), box-shadow .18s, margin .2s;
}
.card.new { animation: dealIn .35s var(--ease) both; }
.card.red { color: var(--red-suit); }
.card .r { position: absolute; top: 4px; left: 6px; font: 900 calc(var(--card-w) * .3)/1 var(--ui); letter-spacing: -.04em; }
.card .s1 { position: absolute; top: calc(var(--card-w) * .32 + 4px); left: 6px; font-size: calc(var(--card-w) * .22); line-height: 1; }
.card .pip { position: absolute; right: 6px; bottom: 4px; font-size: calc(var(--card-w) * .55); line-height: 1; }
.card.joker { background: linear-gradient(160deg, #fff6d6, #ffe3f1); color: #9b2cff; }
.card.joker .r { font-size: calc(var(--card-w) * .18); letter-spacing: .02em; }
.card .wild { position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; border-radius: 50%; background: var(--pink); color: #fff; display: grid; place-items: center; font-size: 12px; box-shadow: 0 0 0 2px #fff; }
.card.back {
  background: repeating-linear-gradient(45deg, #ff4fa3 0 6px, #e0368a 6px 12px), #ff4fa3;
  box-shadow: inset 0 0 0 4px #fff, inset 0 0 0 7px #9b2cff, 0 3px 0 #7a1f53, 0 6px 14px rgba(0, 0, 0, .35);
}
.card.back::after { content: 'G'; position: absolute; inset: 0; display: grid; place-items: center; font: 400 calc(var(--card-w) * .45) var(--display); color: rgba(255, 255, 255, .85); }
.card.mini { --card-w: 24px; --card-h: 34px; border-radius: 4px; box-shadow: 0 1px 0 #7a1f53; animation: none; }
.card.mini::after { font-size: 12px; }
.card.mini.face .r { font-size: 10px; top: 2px; left: 3px; } .card.mini.face .pip { font-size: 12px; right: 2px; bottom: 1px; } .card.mini.face .s1 { display: none; }
.card.slot { background: rgba(0, 0, 0, .2); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .2); animation: none; }
button.card { cursor: pointer; }
button.card:hover:not([disabled]) { transform: translateY(-8px); }
.card.sel { transform: translateY(-16px) !important; box-shadow: 0 0 0 3px var(--gold), 0 0 24px rgba(255, 200, 61, .8), 0 10px 20px rgba(0, 0, 0, .4); z-index: 2; }
.card.playable { box-shadow: 0 0 0 3px var(--cyan), 0 0 18px rgba(59, 232, 208, .6), 0 6px 14px rgba(0, 0, 0, .35); }
.card.dim { filter: brightness(.6) saturate(.5); }
.card.hint::before { content: '↓'; position: absolute; left: 50%; top: -22px; transform: translateX(-50%); color: var(--gold); font-weight: 900; }
.card.big { --card-w: 84px; --card-h: 118px; }
@media (max-width: 640px) { .card.big { --card-w: 64px; --card-h: 90px; } }
.pile { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; font-weight: 900; color: rgba(255, 255, 255, .8); text-transform: uppercase; letter-spacing: .08em; }
.piles { display: flex; gap: 20px; align-items: flex-end; flex-wrap: wrap; justify-content: center; }
.groups { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.group { padding: 8px 8px 6px; border-radius: 14px; background: rgba(255, 255, 255, .06); border: 2px solid transparent; }
.group.pure { border-color: #7dffb0; background: rgba(125, 255, 176, .1); }
.group.seq { border-color: var(--cyan); background: rgba(59, 232, 208, .08); }
.group.set { border-color: #b18cff; background: rgba(177, 140, 255, .1); }
.group.loose { border-color: rgba(255, 107, 107, .5); border-style: dashed; }
.group .glabel { font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; text-align: center; margin-top: 4px; color: var(--muted); }
.group .hand { gap: 0; }
.group .hand .card { margin-left: calc(var(--card-w) * -0.38); }
.group .hand .card:first-child { margin-left: 0; }
.floor { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; min-height: var(--card-h); }
.house { position: relative; display: flex; padding: 6px; border-radius: 14px; background: rgba(255, 200, 61, .12); border: 2px solid var(--gold); cursor: pointer; }
.house.cemented { border-color: var(--pink); background: rgba(255, 79, 163, .14); }
.house .card { margin-left: calc(var(--card-w) * -0.7); animation: none; }
.house .card:first-child { margin-left: 0; }
.house .hv { position: absolute; top: -12px; right: -10px; background: var(--gold); color: var(--gold-ink); font: 400 16px var(--display); border-radius: 999px; padding: 2px 8px; }
.house.cemented .hv { background: var(--pink); color: #fff; }
.house.sel { box-shadow: 0 0 0 3px var(--cyan), 0 0 24px rgba(59, 232, 208, .7); transform: translateY(-6px); }
.suit-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; background: #fff; font: 900 18px var(--ui); color: var(--black-suit); }
.suit-badge.red { color: var(--red-suit); }
.suit-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.suit-pick button { min-height: 72px; font-size: 40px; border-radius: 16px; border: 0; background: #fff; color: var(--black-suit); cursor: pointer; }
.suit-pick button.red { color: var(--red-suit); }
.bj-seats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; width: 100%; }
.bj-seat { background: rgba(0, 0, 0, .28); border-radius: 16px; padding: 10px; text-align: center; border: 2px solid transparent; }
.bj-seat.turn { border-color: var(--cyan); box-shadow: 0 0 22px rgba(59, 232, 208, .4); }
.bj-seat.mine { background: rgba(255, 200, 61, .12); }
.total { display: inline-block; min-width: 36px; padding: 2px 10px; border-radius: 999px; background: #fff; color: var(--black-suit); font: 900 16px var(--ui); }
.outcome { font: 400 18px var(--display); text-transform: uppercase; }
.outcome.win, .outcome.blackjack { color: var(--gold); } .outcome.lose, .outcome.bust { color: #ff9a9a; } .outcome.push { color: var(--muted); }
.scoreboard { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.score { padding: 8px 14px; border-radius: 14px; background: rgba(0, 0, 0, .35); font-weight: 900; text-align: center; }
.score b { display: block; font: 400 26px var(--display); color: var(--gold); }
.sel-sum { font-weight: 900; color: var(--cyan); min-height: 1.5em; text-align: center; }

/* ---------- toasts & fx ---------- */
.toasts { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 60; width: min(440px, calc(100vw - 32px)); }
.toast { padding: 12px 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); font-weight: 800; box-shadow: var(--shadow); animation: toastIn .35s var(--spring); }
.toast.err { background: #4a1d2c; border-color: #8a2f48; }
.toast.win { background: linear-gradient(90deg, #6b1d4c, #7a4a00); border-color: var(--gold); }
#fx { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 50; }

@keyframes coinSpin { 0%, 70% { transform: rotateY(0); } 85% { transform: rotateY(180deg); } 100% { transform: rotateY(360deg); } }
@keyframes glow { 0%, 100% { box-shadow: inset 0 -4px 0 rgba(120, 60, 0, .45), 0 0 0 0 rgba(255, 200, 61, .6); } 50% { box-shadow: inset 0 -4px 0 rgba(120, 60, 0, .45), 0 0 0 10px rgba(255, 200, 61, 0), 0 0 30px rgba(255, 200, 61, .8); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes pop { 0% { transform: scale(.85); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes dealIn { from { transform: translateY(-24px) rotate(-6deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-10px); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes toastIn { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@keyframes shrink { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.felt-result { width: 100%; max-width: 420px; }
.felt-result .result-banner { padding: 12px; }
.felt-result .delta { font-size: 36px; }
.felt-result { margin: 0 auto; }
@media (max-width: 980px) { #resultBox { display: none !important; } }

/* Teen Patti: peek one card at a time, dealer's joker */
button.card.back { cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
button.card.back:hover, button.card.back:focus-visible { transform: translateY(-6px) rotate(-2deg); box-shadow: 0 0 0 3px var(--cyan, #3be8d0), 0 10px 24px rgba(0,0,0,.4); }
.peek-hint { text-align: center; margin: 6px 0 0; font-size: 14px; }
.linkish { background: none; border: 0; padding: 0; color: var(--cyan, #3be8d0); font: inherit; font-weight: 800; text-decoration: underline; cursor: pointer; }
.joker-pick { background: rgba(255,79,163,.1); border: 1px solid rgba(255,79,163,.45); border-radius: 16px; padding: 12px 14px; margin: 8px 0 12px; }
.joker-pick p { margin: 0 0 8px; }
.joker-pick .actions { flex-wrap: wrap; justify-content: flex-start; }
.joker-pick .btn { min-width: 0; padding-inline: 14px; }
.jk-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; }
.jk-lbl { width: 64px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted, #b9a8d6); }
.jk-chip { min-height: 36px; min-width: 36px; padding: 4px 10px; border-radius: 10px; border: 1px solid rgba(59,232,208,.45); background: rgba(59,232,208,.08); color: inherit; font: 800 14px var(--body, inherit); cursor: pointer; }
.jk-chip:hover { background: rgba(59,232,208,.18); }
.jk-chip.on { background: var(--cyan, #3be8d0); color: #0d1a1f; border-color: transparent; box-shadow: 0 3px 0 rgba(0,0,0,.25); }
.jk-chip.base.on { background: var(--gold, #ffc83d); }
.jk-chip.suit { font-size: 20px; padding: 0 12px; background: #fff; border-color: transparent; opacity: .55; }
.jk-chip.suit .red { color: #d11f4a; } .jk-chip.suit .blk { color: #14101c; }
.jk-chip.suit.on { opacity: 1; box-shadow: 0 0 0 3px var(--cyan, #3be8d0); }
.jk-chip.ghost { border-color: rgba(255,255,255,.25); background: none; }
.jk-foot { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 10px; font-weight: 800; }
.jk-foot > span { margin-right: auto; }
@media (max-width: 520px) { .jk-lbl { width: 100%; } }
.jk-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; }
.jk-lbl { width: 64px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted, #b9a8d6); }
.jk-chip { min-height: 36px; min-width: 36px; padding: 4px 10px; border-radius: 10px; border: 1px solid rgba(59,232,208,.45); background: rgba(59,232,208,.08); color: inherit; font: 800 14px var(--body, inherit); cursor: pointer; }
.jk-chip:hover { background: rgba(59,232,208,.18); }
.jk-chip.on { background: var(--cyan, #3be8d0); color: #0d1a1f; border-color: transparent; box-shadow: 0 3px 0 rgba(0,0,0,.25); }
.jk-chip.base.on { background: var(--gold, #ffc83d); }
.jk-chip.suit { font-size: 20px; padding: 0 12px; background: #fff; border-color: transparent; opacity: .55; }
.jk-chip.suit .red { color: #d11f4a; } .jk-chip.suit .blk { color: #14101c; }
.jk-chip.suit.on { opacity: 1; box-shadow: 0 0 0 3px var(--cyan, #3be8d0); }
.jk-chip.ghost { border-color: rgba(255,255,255,.25); background: none; }
.jk-foot { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 10px; font-weight: 800; }
.jk-foot > span { margin-right: auto; }
@media (max-width: 520px) { .jk-lbl { width: 100%; } }

/* Crazy Eights placings */
.prize-ladder { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 4px 0; }
.rung { font-size: 13px; font-weight: 800; padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15); }
.rung.won { background: rgba(255,200,61,.18); border-color: var(--gold, #ffc83d); }
.place-badge { font-weight: 900; font-size: 15px; padding: 10px 8px; text-align: center; border-radius: 12px; background: rgba(255,200,61,.14); color: var(--gold, #ffc83d); }
.place-badge.p2 { background: rgba(220,226,240,.14); color: #e4e8f2; }
.place-badge.p3 { background: rgba(230,150,90,.16); color: #ffb98a; }
.place-badge.p4, .place-badge.p5, .place-badge.p6 { background: rgba(255,255,255,.06); color: var(--muted, #b9a8d6); }
.place-banner { text-align: center; font-weight: 900; padding: 10px 14px; margin-bottom: 10px; border-radius: 14px; background: linear-gradient(90deg, rgba(255,200,61,.22), rgba(255,79,163,.18)); border: 1px solid rgba(255,200,61,.5); }
.jk-need { color: var(--pink, #ff4fa3); font-weight: 800; font-size: 13px; }

/* Bridge */
.g-bridge { --g: linear-gradient(135deg, #0b6e8f, #2b2f9e); }
.bridge-table { display: flex; flex-direction: column; gap: 10px; }
.bseat.top { display: flex; justify-content: center; }
.bmid { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(0, 2.4fr) minmax(120px, 1fr); gap: 10px; align-items: center; }
.bseat .seat { min-width: 0; }
.bridge-hand { flex-wrap: wrap; justify-content: center; gap: 4px; }
.bridge-hand.mini { gap: 2px; }
.bridge-hand.mini .card { width: 30px; }
.me .bridge-hand .card { margin-left: -10px; }
.me .bridge-hand .card:first-child { margin-left: 0; }
.trick { position: relative; display: grid; grid-template-areas: ". t2 ." "t1 . t3" ". t0 ."; grid-template-columns: repeat(3, auto); gap: 4px; justify-content: center; align-items: center; min-height: 230px; }
.trick .t2 { grid-area: t2; } .trick .t1 { grid-area: t1; } .trick .t3 { grid-area: t3; } .trick .t0 { grid-area: t0; }
.tslot { min-width: 64px; min-height: 70px; display: grid; place-items: center; }
.trick.faded .tslot { opacity: .55; }
.twon { position: absolute; inset: auto 0 -6px; text-align: center; font-weight: 900; font-size: 13px; color: var(--gold, #ffc83d); }
.auction { width: 100%; max-width: 360px; }
.agrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; text-align: center; font-weight: 900; }
.ahead { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding-bottom: 2px; }
.ahead.me { color: var(--cyan, #3be8d0); }
.acell { background: rgba(255,255,255,.06); border-radius: 8px; padding: 4px 0; min-height: 28px; }
.acell:empty { background: none; }
.acell.bid { background: rgba(255,255,255,.92); color: #14101c; }
.acell.double, .acell.redouble { background: rgba(255,79,163,.25); }
.acell.next { border: 2px dashed var(--cyan, #3be8d0); background: none; color: var(--cyan, #3be8d0); }
.acell[title] { cursor: help; }
.awhy { font-size: 13px; margin: 8px 0 0; color: var(--muted); line-height: 1.35; }
.awhy b { color: var(--text); }
.sred { color: #e3264f; } .sblk { color: #14101c; }
.acell:not(.bid) .sred { color: #ff8aa8; }
.bidbox { display: grid; gap: 4px; margin: 6px auto 10px; max-width: 420px; }
.bidrow { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.bidbtn { min-height: 36px; border-radius: 8px; border: 0; background: #fff; color: #14101c; font: 900 15px var(--ui); cursor: pointer; }
.bidbtn:hover:not(:disabled) { box-shadow: 0 0 0 3px var(--cyan, #3be8d0); }
.bidbtn:disabled { opacity: .18; cursor: default; }
.auction-recap { background: rgba(5,2,12,.35); border-radius: 14px; padding: 8px 12px; }
.auction-recap summary { cursor: pointer; font-weight: 900; }
@media (max-width: 640px) {
  .bmid { grid-template-columns: 1fr 1fr; }
  .bmid .center { grid-column: 1 / -1; order: 3; }
  .tslot { min-width: 54px; }
}
.bseat.left .who .tag, .bseat.right .who .tag { display: none; }
.bseat.left .who, .bseat.right .who { flex-wrap: wrap; white-space: normal; }
