:root {
  --slot: 60px;
  --bg: #0d1f17;
  --felt: #1d6b45;
  --felt-dark: #145236;
  --rim: #4a2f1c;
  --gold: #e8c264;
  --text: #f1f5f2;
  --muted: #9fb8aa;
  --red: #d33b3b;
  --panel: #13291f;
  --line: rgba(255,255,255,.1);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: radial-gradient(ellipse at top, #16352a, var(--bg) 70%); }
body { overflow: hidden; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }

.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 32px; width: min(440px, 92vw); box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.logo { margin: 0 0 6px; font-size: 34px; letter-spacing: .5px; text-align: center; }
.logo .suit { color: var(--gold); }
.logo.small { font-size: 17px; font-weight: 700; text-align: left; margin: 0; }
.tagline { color: var(--muted); text-align: center; margin: 0 0 24px; }
.field { display: block; color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.field input { display: block; width: 100%; margin-top: 6px; }
input, select { background: #0b1a13; border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; outline: none; }
input:focus, select:focus { border-color: var(--gold); }
.home-actions { display: flex; flex-direction: column; gap: 12px; }
.or { text-align: center; color: var(--muted); font-size: 13px; }
.join-row { display: flex; gap: 8px; }
.join-row input { flex: 1; text-transform: uppercase; letter-spacing: 6px; text-align: center; font-weight: 700; }
.error { color: #ff8f8f; text-align: center; margin: 16px 0 0; font-size: 14px; }

.btn { background: #24453a; border: 1px solid var(--line); border-radius: 10px; padding: 9px 16px; cursor: pointer; transition: background .15s, transform .05s; }
.btn:hover { background: #2c5547; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--gold); color: #1c1606; border-color: transparent; font-weight: 700; }
.btn.primary:hover { background: #f1d07e; }
.btn.big { padding: 13px 18px; font-size: 16px; }
.btn.link { background: none; border: none; color: var(--muted); display: block; margin: 14px auto 0; }
.btn.icon { padding: 6px 10px; }
.btn.danger { background: #6b2323; }
.btn.danger:hover { background: #823030; }

.lobby-panel h2 { margin: 0 0 14px; text-align: center; }
.lobby-panel h3 { margin: 22px 0 8px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.code { color: var(--gold); letter-spacing: 4px; }
.code-box { text-align: center; background: #0b1a13; border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 8px; }
.code-label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 1px; }
.big-code { font-size: 52px; font-weight: 800; letter-spacing: 12px; margin: 4px 0 10px; padding-left: 12px; user-select: all; }
.share { display: flex; gap: 8px; margin-top: 14px; }
.share input { flex: 1; font-size: 13px; color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
#lobby-players { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
#lobby-players li { background: #0b1a13; border-radius: 8px; padding: 8px 12px; font-size: 14px; display: flex; justify-content: space-between; }
#lobby-players .tag { color: var(--gold); font-size: 12px; }
.row { display: flex; justify-content: space-between; align-items: center; margin: 8px 0; font-size: 15px; }
.row.check { justify-content: flex-start; gap: 10px; cursor: pointer; }
.row.check input { width: 18px; height: 18px; accent-color: var(--gold); }
.muted { color: var(--muted); }
.center { text-align: center; }
#btn-start { width: 100%; margin-top: 16px; }

/* ---------- game ---------- */
#game { flex-direction: column; justify-content: flex-start; }
.topbar { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 10px 18px; }
.topbar .info { display: flex; gap: 18px; color: var(--muted); font-size: 14px; }
.top-actions { display: flex; gap: 8px; }
.topbar { position: relative; z-index: 5; }
/* Room above/below the oval is reserved for the top & bottom seats so nothing spills into the header or the buttons. */
.table-wrap { flex: 1; width: 100%; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 78px 120px 84px; }
.table { position: relative; width: min(100%, calc((100vh - 330px) * 2)); min-width: 520px; aspect-ratio: 2 / 1; max-width: 1000px; }
.felt { position: absolute; inset: 0; border-radius: 999px; background: radial-gradient(ellipse at center, var(--felt) 40%, var(--felt-dark) 100%);
  border: 14px solid var(--rim); box-shadow: inset 0 0 40px rgba(0,0,0,.45), 0 12px 40px rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; }
.felt .center { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.pot { font-weight: 700; color: var(--gold); min-height: 22px; font-size: 17px; }
.board { display: flex; gap: 8px; min-height: 76px; }
.banner { min-height: 22px; font-size: 15px; text-align: center; font-weight: 600; text-shadow: 0 1px 3px rgba(0,0,0,.6); }

.card { width: 52px; height: 74px; border-radius: 6px; background: #fdfdfb; color: #1b1b1b; display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.4); font-weight: 700; line-height: 1; user-select: none; }
.card.new { animation: pop .25s ease-out; }
.card .r { font-size: 22px; }
.card .s { font-size: 22px; margin-top: 2px; }
.card.red { color: var(--red); }
.card.back { background: repeating-linear-gradient(45deg, #8c2a2a 0 6px, #a33636 6px 12px); border: 3px solid #fff; }
.card.slot { background: rgba(0,0,0,.15); box-shadow: none; border: 1px dashed rgba(255,255,255,.12); animation: none; }
.card.ghost { opacity: .3; animation: none; }
.card.peek { outline: 1px dashed rgba(232,194,100,.5); }
.card.dim { filter: brightness(.55); }
.card.win { box-shadow: 0 0 0 3px var(--gold), 0 2px 6px rgba(0,0,0,.4); }
/* dealer-style board animation */
.card.deal { position: relative; animation-fill-mode: both; }
.card.flop { --fd: calc(var(--e) + .6s + var(--i) * .22s); z-index: calc(3 - var(--i));
  animation: flop-spread .5s cubic-bezier(.2,.75,.25,1) both, flip .34s ease-in-out both;
  animation-delay: calc(var(--e) + .12s), var(--fd); }
.card.single { --fd: calc(var(--e) + .38s);
  animation: drop .32s ease-out both, flip .34s ease-in-out both;
  animation-delay: var(--e), var(--fd); }
.card.deal::after { content: ''; position: absolute; inset: 0; border-radius: 6px;
  background: repeating-linear-gradient(45deg, #8c2a2a 0 6px, #a33636 6px 12px); border: 3px solid #fff;
  animation: show-back .34s step-end both; animation-delay: var(--fd); }
@keyframes flop-spread { 0% { translate: calc(var(--i) * -1 * var(--slot)) -18px; opacity: 0; }
                         15% { translate: calc(var(--i) * -1 * var(--slot)) 0; opacity: 1; }
                         100% { translate: 0 0; opacity: 1; } }
@keyframes drop { from { translate: 0 -26px; opacity: 0; } to { translate: 0 0; opacity: 1; } }
@keyframes flip { 0% { scale: 1 1; } 50% { scale: 0 1; } 100% { scale: 1 1; } }
@keyframes show-back { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 0; } }
/* new hand: hole cards fly from the middle of the table, round-robin; yours flip face-up after landing */
.card.dealt { animation: deal-in .38s cubic-bezier(.2,.75,.3,1) both; animation-delay: var(--dd); }
.card.dealt.mine { position: relative; animation: deal-in .38s cubic-bezier(.2,.75,.3,1) both, flip .3s ease-in-out both;
  animation-delay: var(--dd), var(--fd); }
.card.dealt.mine::after { content: ''; position: absolute; inset: 0; border-radius: 6px;
  background: repeating-linear-gradient(45deg, #8c2a2a 0 6px, #a33636 6px 12px); border: 3px solid #fff;
  animation: show-back .3s step-end both; animation-delay: var(--fd); }
@keyframes deal-in { 0% { translate: var(--dx) var(--dy); rotate: -30deg; opacity: 0; }
                     15% { opacity: 1; }
                     100% { translate: 0 0; rotate: 0deg; opacity: 1; } }
/* end of hand: sweep everything into the middle */
.table.wipe .seat .card { animation: sweep-seat .38s ease-in forwards !important; }
.table.wipe .board .card:not(.slot) { animation: sweep-board .38s ease-in forwards !important; }
.table.wipe .bet, .table.wipe .pot, .table.wipe .banner { opacity: 0; transition: opacity .25s; }
@keyframes sweep-seat { to { translate: var(--dx) var(--dy); rotate: 20deg; opacity: 0; scale: .7; } }
@keyframes sweep-board { to { translate: calc((2 - var(--i)) * var(--slot)) 0; opacity: 0; scale: .8; } }
.newhand { display: inline-block; color: var(--gold); font-size: 18px; letter-spacing: 1px; animation: newhand 1.6s ease-out both; }
@keyframes newhand { 0% { opacity: 0; scale: .8; } 15% { opacity: 1; scale: 1.05; } 25% { scale: 1; } 75% { opacity: 1; } 100% { opacity: 0; } }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }

.seat { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; width: 130px; }
.seat .cards { display: flex; gap: 3px; height: 60px; margin-bottom: -10px; z-index: 1; }
.seat .cards .card { width: 42px; height: 60px; }
.seat .cards .card .r, .seat .cards .card .s { font-size: 17px; }
.seat.me .cards { height: 74px; }
.seat.me .cards .card { width: 52px; height: 74px; }
.seat.me .cards .card .r, .seat.me .cards .card .s { font-size: 22px; }
.plate { position: relative; z-index: 2; background: #0e1d16; border: 2px solid #2b4a3d; border-radius: 12px; padding: 6px 10px; min-width: 116px; text-align: center; box-shadow: 0 4px 12px rgba(0,0,0,.45); }
.plate .name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plate .chips { font-size: 13px; color: var(--gold); }
.seat.turn .plate { border-color: var(--gold); box-shadow: 0 0 18px rgba(232,194,100,.45); }
.seat.folded { opacity: .55; }
.seat.out { opacity: .3; }
.seat.offline .name::after { content: " (away)"; color: var(--muted); font-weight: 400; }
.seat.winner .plate { border-color: var(--gold); background: #2d2610; }
.tag-action { margin-top: 4px; font-size: 12px; color: var(--muted); min-height: 15px; white-space: nowrap; }
.tag-action.hand { color: var(--gold); }
.timer { position: absolute; left: 8px; right: 8px; bottom: 3px; height: 3px; border-radius: 2px; background: rgba(255,255,255,.08); overflow: hidden; }
.timer i { display: block; height: 100%; background: var(--gold); }
.dealer { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 50%; background: #fff; color: #111; font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 4px rgba(0,0,0,.5); }
.bet { position: absolute; transform: translate(-50%, -50%); background: rgba(0,0,0,.35); border-radius: 999px; padding: 3px 10px 3px 6px; font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.chip { width: 14px; height: 14px; border-radius: 50%; background: var(--gold); border: 3px dashed #fff8; }

.actions { width: 100%; min-height: 86px; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 12px 18px 20px; flex-wrap: wrap; }
.actions .btn { min-width: 110px; padding: 12px 16px; font-size: 15px; font-weight: 600; }
.actions .waiting { color: var(--muted); }
.raise-box { display: flex; align-items: center; gap: 8px; background: rgba(0,0,0,.25); padding: 6px 10px; border-radius: 12px; }
.raise-box input[type=range] { width: 160px; accent-color: var(--gold); padding: 0; }
.raise-box input[type=number] { width: 90px; padding: 8px; }
.raise-box .btn { min-width: 0; padding: 7px 10px; font-size: 13px; font-weight: 500; }

.overlay { position: absolute; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 20; }
.overlay .panel { text-align: center; }
.overlay h2 { font-size: 30px; margin: 0 0 10px; }

/* secret */
.palm { position: fixed; left: 0; bottom: 0; width: 14px; height: 14px; z-index: 40; cursor: default; background: transparent; }
.vip { position: fixed; left: 14px; bottom: 14px; z-index: 50; background: rgba(8,12,10,.94); border: 1px solid #333; border-radius: 12px; padding: 12px; width: 220px; font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,.6); }
.vip .title { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; display: flex; justify-content: space-between; }
.vip .btn { width: 100%; margin: 3px 0; padding: 7px 10px; font-size: 13px; text-align: left; }
.vip .btn.on { background: #4b3d12; border-color: var(--gold); }
.vip .msg { color: var(--gold); min-height: 16px; margin-top: 6px; }
.vip .row2 { display: flex; gap: 6px; }
.vip .row2 .btn { text-align: center; }

/* shorter screens (laptops): shrink cards a bit */
@media (max-height: 780px) {
  .card { width: 44px; height: 62px; }
  .card .r, .card .s { font-size: 18px; }
  .board { min-height: 62px; gap: 6px; }
  :root { --slot: 50px; }
  .seat .cards { height: 52px; }
  .seat .cards .card { width: 36px; height: 52px; }
  .seat .cards .card .r, .seat .cards .card .s { font-size: 15px; }
  .seat.me .cards { height: 62px; }
  .seat.me .cards .card { width: 44px; height: 62px; }
  .seat.me .cards .card .r, .seat.me .cards .card .s { font-size: 18px; }
  .plate { padding: 4px 10px; }
  .table-wrap { padding: 66px 110px 74px; }
  .table { width: min(100%, calc((100vh - 300px) * 2)); }
  .actions { min-height: 76px; padding: 8px 18px 14px; }
}

.reconnect { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 60; background: #5a3d0c; border: 1px solid var(--gold);
  color: #fff; padding: 9px 16px; border-radius: 999px; font-size: 14px; display: flex; align-items: center; gap: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.5); }
.spin { width: 14px; height: 14px; border: 2px solid #fff4; border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { rotate: 360deg; } }
