:root {
  --bg: #0b1f17;
  --bg2: #10291f;
  --panel: #143427;
  --panel-2: #1a4031;
  --line: rgba(255,255,255,.09);
  --text: #eef5f0;
  --muted: #9db7a9;
  --gold: #f2c14e;
  --gold-2: #d99a1e;
  --red: #e5484d;
  --green: #3ecf8e;
  --felt: #0f6b45;
  --felt-edge: #5a3417;
  --card: #fbfaf6;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(ellipse at top, #16392b 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input { font: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.screen { min-height: 100%; }

/* ---------- buttons ---------- */
.btn {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 16px; font-weight: 600; transition: transform .08s, filter .15s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.gold { background: linear-gradient(180deg, var(--gold), var(--gold-2)); color: #2a1a00; border-color: transparent; }
.btn.red { background: #3a1719; border-color: rgba(229,72,77,.4); color: #ffb4b6; }
.btn.wide { width: 100%; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; background: rgba(255,255,255,.06); font-size: 18px; flex: none; }

/* ---------- auth ---------- */
#auth { display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 26px 22px; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.brand { text-align: center; margin-bottom: 18px; }
.brand h1 { margin: 10px 0 0; font-size: 28px; letter-spacing: .5px; color: var(--gold); }
.brand-cards { display: inline-flex; }
.brand-cards i { font-style: normal; width: 34px; height: 46px; background: var(--card); color: #b3161b; border-radius: 6px; display: grid; place-items: center; font-weight: 800; margin: 0 -5px; box-shadow: 0 3px 8px rgba(0,0,0,.35); }
.brand-cards i:nth-child(1) { transform: rotate(-12deg) translateY(4px); }
.brand-cards i:nth-child(2) { color: #111; z-index: 1; }
.brand-cards i:nth-child(3) { transform: rotate(12deg) translateY(4px); }
.tabs { display: flex; background: rgba(0,0,0,.25); border-radius: 12px; padding: 4px; margin-bottom: 16px; }
.tabs button { flex: 1; padding: 9px; border-radius: 9px; color: var(--muted); font-weight: 600; }
.tabs button.active { background: var(--panel-2); color: var(--text); }
form label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
form label input, .code-input {
  display: block; width: 100%; margin-top: 6px; padding: 12px 14px; border-radius: 11px;
  background: rgba(0,0,0,.28); border: 1px solid var(--line); color: var(--text); outline: none;
}
form label input:focus, .code-input:focus { border-color: var(--gold); }
.form-error { color: #ff9a9d; min-height: 1.2em; font-size: 13px; margin: 10px 0 0; }

/* ---------- lobby ---------- */
.topbar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; position: sticky; top: 0; background: rgba(11,31,23,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); z-index: 5; }
.me-info { display: flex; align-items: center; gap: 8px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: #2b5b47; flex: none; text-transform: uppercase; }
.wallet { display: flex; align-items: center; gap: 7px; background: rgba(0,0,0,.3); border: 1px solid rgba(242,193,78,.35); padding: 7px 12px; border-radius: 999px; }
.wallet b { color: var(--gold); font-variant-numeric: tabular-nums; }
.coin { width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffe08a, var(--gold-2)); box-shadow: inset 0 0 0 2px rgba(0,0,0,.15); flex: none; display: inline-block; }
.lobby-main { max-width: 900px; margin: 0 auto; padding: 8px 16px calc(28px + var(--safe-b)); }
.section-title { font-size: 17px; margin: 22px 0 12px; }
.levels { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.level {
  position: relative; text-align: left; padding: 14px; border-radius: var(--radius);
  background: linear-gradient(160deg, #1b4a37, #123325); border: 1px solid var(--line); overflow: hidden;
}
.level::after { content: ""; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; background: rgba(242,193,78,.08); }
.level .boot { font-size: 24px; font-weight: 800; color: var(--gold); display: flex; align-items: center; gap: 7px; }
.level .boot .coin { width: 20px; height: 20px; }
.level .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
.level .meta { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.55; }
.level .live { display: inline-flex; align-items: center; gap: 5px; margin-top: 8px; font-size: 12px; color: var(--green); }
.level .live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.level.locked { opacity: .5; }
.level:active { transform: scale(.98); }
.private-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; }
@media (max-width: 640px) { .private-grid { grid-template-columns: 1fr; } }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel h3 { margin: 0 0 12px; font-size: 15px; }
.field-label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 6px; text-transform: uppercase; letter-spacing: .6px; }
.stepper { display: inline-flex; align-items: center; background: rgba(0,0,0,.25); border-radius: 12px; border: 1px solid var(--line); }
.stepper button { width: 44px; height: 42px; font-size: 22px; }
.stepper output { min-width: 44px; text-align: center; font-weight: 700; font-size: 18px; }
.chips-select { display: flex; flex-wrap: wrap; gap: 8px; }
.chips-select button { padding: 8px 12px; border-radius: 999px; background: rgba(0,0,0,.25); border: 1px solid var(--line); font-weight: 600; font-variant-numeric: tabular-nums; }
.chips-select button.active { background: var(--gold); color: #2a1a00; border-color: var(--gold); }
#createHint { margin: 12px 0; }
.code-input { text-align: center; font-size: 24px; letter-spacing: 6px; font-weight: 700; text-transform: uppercase; margin: 0 0 12px; }

/* ---------- table ---------- */
#table { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
.table-top { display: flex; align-items: center; gap: 10px; padding: 10px 12px; flex: none; }
.table-info { flex: 1; min-width: 0; }
.table-info > div:first-child { font-weight: 700; }
.room-code { background: rgba(242,193,78,.12); border: 1px dashed var(--gold); color: var(--gold); padding: 6px 10px; border-radius: 10px; font-weight: 800; letter-spacing: 2px; font-size: 14px; }
.felt-wrap { flex: 1; min-height: 0; padding: 4px 14px 0; display: flex; }
.felt {
  position: relative; flex: 1; margin: 52px 34px 40px;
  border-radius: 28px;
  background: radial-gradient(ellipse at center, #16875a 0%, var(--felt) 70%, #0c5a3a 100%);
  box-shadow: 0 0 0 10px var(--felt-edge), 0 0 0 12px #3b200c, inset 0 0 50px rgba(0,0,0,.45), 0 18px 40px rgba(0,0,0,.5);
}
.felt::before { content: ""; position: absolute; inset: 14px; border-radius: 16px; border: 1.5px solid rgba(242,193,78,.28); pointer-events: none; }
.felt-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; pointer-events: none; padding: 0 20%; }
.pot { display: flex; align-items: center; gap: 8px; background: rgba(0,0,0,.35); padding: 6px 16px; border-radius: 999px; font-size: 20px; }
.pot b { color: var(--gold); font-variant-numeric: tabular-nums; }
.pot.bump { animation: bump .35s; }
@keyframes bump { 50% { transform: scale(1.12); } }
.stake { margin-top: 6px; }
.status-text { margin-top: 8px; font-weight: 600; font-size: 14px; text-shadow: 0 1px 3px rgba(0,0,0,.5); min-height: 1.4em; }

.seat {
  position: absolute; width: 78px; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.seat .bal { white-space: nowrap; }
.seat .ava-wrap { position: relative; width: 44px; height: 44px; }
.seat .ava { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 17px; background: #264f40; border: 2px solid rgba(255,255,255,.25); text-transform: uppercase; }
.seat.me .ava { border-color: var(--gold); }
.seat .ring { position: absolute; inset: -5px; width: 54px; height: 54px; transform: rotate(-90deg); }
.seat .ring circle { fill: none; stroke: var(--gold); stroke-width: 4; stroke-linecap: round; }
.seat .ring.low circle { stroke: var(--red); }
.seat .name { margin-top: 5px; font-size: 11.5px; font-weight: 600; max-width: 78px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: rgba(0,0,0,.6); padding: 1px 6px; border-radius: 6px; line-height: 1.35; }
.seat .bal { font-size: 11px; color: var(--gold); font-variant-numeric: tabular-nums; line-height: 1.3; }
.seat .badge { position: absolute; bottom: -7px; left: 50%; transform: translateX(-50%); font-size: 8.5px; font-weight: 800; padding: 0 4px; border-radius: 4px; text-transform: uppercase; letter-spacing: .3px; line-height: 1.5; }
.badge.blind { background: #394a75; }
.badge.seen { background: #2b7a57; }
.badge.packed { background: #5c2a2c; }
.dealer { position: absolute; top: -3px; left: -7px; width: 17px; height: 17px; border-radius: 50%; background: #fff; color: #111; font-size: 10px; font-weight: 900; display: grid; place-items: center; }
.seat.packed, .seat.waiting { opacity: .5; }
.seat.offline .ava { filter: grayscale(1); }
.seat.winner .ava { box-shadow: 0 0 0 3px var(--gold), 0 0 22px var(--gold); }
/* face-down / revealed cards sit beside the avatar */
.seat .mini-cards { position: absolute; top: 8px; left: 40px; display: flex; z-index: 1; }
.seat .mini-cards.left { left: auto; right: 40px; }
.seat .mini-cards.revealed { position: static; margin-top: 2px; }
.seat .action-bubble { position: absolute; top: -17px; z-index: 2; white-space: nowrap; font-size: 10.5px; font-weight: 700; background: #fff; color: #173; padding: 1px 6px; border-radius: 7px; box-shadow: 0 2px 6px rgba(0,0,0,.3); animation: pop .25s both; }
.seat .action-bubble.bad { color: #a11; }
.seat .hand-tag { font-size: 10.5px; color: #ffe08a; font-weight: 700; text-shadow: 0 1px 2px #000; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.empty-seat .ava { background: transparent; border: 2px dashed rgba(255,255,255,.18); color: rgba(255,255,255,.3); font-size: 12px; }
.seat.me .name { display: none; }

/* cards */
.card {
  width: 22px; height: 30px; border-radius: 4px; background: var(--card); color: #111; margin: 0 -4px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
  font-weight: 800; font-size: 11px; box-shadow: 0 2px 5px rgba(0,0,0,.35); border: 1px solid rgba(0,0,0,.15);
}
.card.red { color: #c1121f; }
.card .s { font-size: 11px; }
.card.back { background: repeating-linear-gradient(45deg, #8c1c24 0 4px, #a8262f 4px 8px); border: 2px solid #fff; }
.card:nth-child(1) { transform: rotate(-9deg); }
.card:nth-child(2) { z-index: 1; }
.card:nth-child(3) { transform: rotate(9deg); z-index: 2; }
.seat .mini-cards:not(.revealed) .card { width: 15px; height: 21px; margin: 0 -3px; border-width: 1.5px; }
.my-area { flex: none; padding: 0 12px calc(12px + var(--safe-b)); }
.my-cards { display: flex; justify-content: center; min-height: 84px; align-items: flex-end; }
.my-cards .card { width: 56px; height: 78px; font-size: 22px; border-radius: 8px; margin: 0 -6px; }
.my-cards .card .s { font-size: 22px; }
.my-cards .card.back { cursor: pointer; }
.my-cards .card.deal { animation: deal .35s both; }
.my-cards .card.deal:nth-child(2) { animation-delay: .08s; }
.my-cards .card.deal:nth-child(3) { animation-delay: .16s; }
@keyframes deal { from { transform: translateY(-60px) scale(.6); opacity: 0; } }
.my-hand-name { text-align: center; color: #ffe08a; font-weight: 700; min-height: 22px; margin: 4px 0; font-size: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; min-height: 48px; }
.actions .btn { flex: 1 1 0; min-width: 76px; max-width: 170px; padding: 10px 6px; display: flex; flex-direction: column; align-items: center; line-height: 1.15; }
.actions .btn small { font-weight: 600; font-size: 12px; opacity: .85; }
.actions .hint { width: 100%; text-align: center; color: var(--muted); font-size: 13px; padding: 12px; }

.log-panel { position: fixed; right: 10px; top: 60px; width: min(300px, calc(100% - 20px)); max-height: 50vh; overflow: auto; background: rgba(8,22,16,.96); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; z-index: 20; }
.log-panel h4 { margin: 0 0 8px; }
.log-panel ol { margin: 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.log-panel li { margin: 3px 0; }

/* result banner */
.result-banner { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: rgba(0,0,0,.72); border: 1px solid var(--gold); padding: 10px 18px; border-radius: 14px; text-align: center; z-index: 3; animation: pop .3s; max-width: 70%; }
.result-banner b { color: var(--gold); display: block; font-size: 17px; }

/* ---------- modals / toast ---------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal-card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 20px; width: 100%; max-width: 380px; }
.modal-card.tall { max-width: 520px; max-height: 85vh; display: flex; flex-direction: column; }
.modal-card h3 { margin: 0 0 10px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-card .row { display: flex; gap: 10px; margin-top: 14px; }
.modal-card .row .btn { flex: 1; }
.timer-bar { height: 5px; background: rgba(255,255,255,.1); border-radius: 3px; overflow: hidden; margin-top: 10px; }
.timer-bar i { display: block; height: 100%; background: var(--gold); width: 100%; transition: width .25s linear; }
.compare { display: flex; justify-content: space-around; margin: 10px 0 16px; text-align: center; gap: 10px; }
.compare .my-cards .card { width: 42px; height: 58px; font-size: 16px; }
.compare .my-cards .card .s { font-size: 16px; }
.compare .lost { opacity: .5; }
.history { overflow: auto; margin-top: 6px; }
.tx { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; gap: 10px; }
.tx .amt { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.tx .amt.pos { color: var(--green); }
.tx .amt.neg { color: #ff8f93; }
.toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); background: #22382e; border: 1px solid var(--line); padding: 11px 16px; border-radius: 12px; z-index: 60; max-width: calc(100% - 32px); box-shadow: 0 10px 30px rgba(0,0,0,.4); font-size: 14px; }
.toast.error { background: #3c1a1c; border-color: rgba(229,72,77,.5); }

/* small phones */
@media (max-width: 420px) {
  .felt { margin: 48px 32px 36px; }
  .my-cards { min-height: 74px; }
  .my-cards .card { width: 48px; height: 68px; font-size: 19px; }
  .my-cards .card .s { font-size: 19px; }
  .seat .mini-cards.revealed .card { width: 19px; height: 26px; font-size: 10px; }
}
/* 8–10 seat rooms: tighter seats */
#seats.dense .seat { width: 68px; }
#seats.dense .seat .ava-wrap, #seats.dense .seat .ava { width: 38px; height: 38px; font-size: 15px; }
#seats.dense .seat .ring { width: 48px; height: 48px; }
#seats.dense .seat .name { max-width: 68px; font-size: 10.5px; }
#seats.dense .seat .mini-cards { left: 34px; top: 6px; }
#seats.dense .seat .mini-cards.left { left: auto; right: 34px; }
.table-info > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat.me .bal { margin-top: 7px; }

/* ================= LANDSCAPE: horizontal table ================= */
@media (orientation: landscape) {
  #table {
    display: grid; grid-template-columns: 1fr clamp(150px, 19vw, 230px); grid-template-rows: auto 1fr;
    padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px);
  }
  .table-top { grid-column: 1 / -1; }
  .felt-wrap { padding: 0; display: grid; place-items: center; container-type: size; min-width: 0; }
  /* wide 2.4:1 table that fits whichever of width/height runs out first */
  .felt {
    flex: none; margin: 0;
    width: min(100cqw - 120px, (100cqh - 110px) * 2.4);
    aspect-ratio: 2.4 / 1;
  }
  .felt-center { padding: 0 24%; }
  .my-area {
    grid-column: 2; grid-row: 2; display: flex; flex-direction: column; justify-content: center;
    padding: 6px 12px calc(10px + var(--safe-b)) 4px; min-height: 0; overflow-y: auto;
  }
  .my-cards { min-height: 0; }
  .my-cards .card { width: 46px; height: 64px; font-size: 18px; }
  .my-cards .card .s { font-size: 18px; }
  .my-hand-name { font-size: 13px; min-height: 18px; margin: 4px 0 8px; }
  .actions { flex-direction: column; flex-wrap: nowrap; gap: 6px; }
  .actions .btn { max-width: none; flex: none; flex-direction: row; justify-content: space-between; padding: 9px 12px; }
  .actions .btn small { font-size: 13px; }
  .actions .hint { padding: 8px 4px; }
  .result-banner { max-width: 44%; }
}
/* short landscape screens (phones turned sideways) */
@media (orientation: landscape) and (max-height: 520px) {
  .table-top { padding: 4px 10px; }
  .table-top .icon-btn { width: 34px; height: 34px; }
  .felt { width: min(100cqw - 110px, (100cqh - 96px) * 2.4); }
  .actions .btn { padding: 7px 10px; }
  .my-cards .card { width: 40px; height: 56px; font-size: 16px; }
  .my-cards .card .s { font-size: 16px; }
  .pot { font-size: 17px; padding: 4px 12px; }
}
/* big screens: larger seats */
@media (orientation: landscape) and (min-height: 700px) {
  #seats:not(.dense) .seat { width: 92px; }
  #seats:not(.dense) .seat .ava-wrap, #seats:not(.dense) .seat .ava { width: 54px; height: 54px; font-size: 20px; }
  #seats:not(.dense) .seat .ring { width: 64px; height: 64px; }
  #seats:not(.dense) .seat .mini-cards { left: 50px; top: 12px; }
  #seats:not(.dense) .seat .mini-cards.left { left: auto; right: 50px; }
  #seats:not(.dense) .seat .name { max-width: 92px; font-size: 12.5px; }
}

.felt.has-result .felt-center { visibility: hidden; }
/* crowded rooms: tuck face-down cards closer to the avatar so neighbours never touch */
#seats.dense .seat .mini-cards { left: 32px; top: 10px; }
#seats.dense .seat .mini-cards.left { left: auto; right: 32px; }
#seats.dense .seat .mini-cards:not(.revealed) .card { width: 12px; height: 17px; margin: 0 -2px; }

/* ---------- fancy games ---------- */
.mode-select { display: inline-flex; background: rgba(0,0,0,.25); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.mode-select button { padding: 8px 16px; border-radius: 9px; font-weight: 700; color: var(--muted); }
.mode-select button.active { background: var(--panel-2); color: var(--text); }
.mode-select button.active[data-mode="fancy"] { background: linear-gradient(180deg, #7b4bd6, #5b2fb0); color: #fff; }
.mode-hint { margin: 8px 0 0; }
.variant { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 5px 12px 5px 8px; border-radius: 12px;
  background: rgba(40, 18, 80, .72); border: 1px solid rgba(190, 150, 255, .55); text-align: left; max-width: 100%; }
.variant b { display: block; font-size: 13px; letter-spacing: .6px; text-transform: uppercase; color: #e3d2ff; }
.variant small { display: block; font-size: 11.5px; color: #cdbdf0; }
.variant.next { opacity: .85; }
.variant.v-muflis { border-color: rgba(120, 200, 255, .55); background: rgba(10, 50, 80, .72); }
.variant.v-muflis b { color: #bfe6ff; } .variant.v-muflis small { color: #a9d3ee; }
.variant.v-ak47 { border-color: rgba(255, 140, 110, .55); background: rgba(80, 22, 14, .72); }
.variant.v-ak47 b { color: #ffd0c2; } .variant.v-ak47 small { color: #f2b9a8; }
.variant .joker-card { display: flex; }
.variant .joker-card .card { width: 22px; height: 30px; margin: 0; transform: none; }
.card.wild { position: relative; box-shadow: 0 0 0 2px var(--gold), 0 2px 8px rgba(242,193,78,.55); }
.card.wild::after { content: "★"; position: absolute; top: -7px; right: -6px; width: 15px; height: 15px; border-radius: 50%;
  background: var(--gold); color: #2a1a00; font-size: 9px; line-height: 15px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.my-cards .card.wild::after { width: 20px; height: 20px; line-height: 20px; font-size: 12px; top: -8px; right: -8px; }

/* fancy game picker (create room) */
.fancy-games { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin-top: 10px; }
.fancy-games .fg { display: flex; gap: 10px; align-items: flex-start; padding: 9px 11px; border-radius: 11px; cursor: pointer;
  background: rgba(0,0,0,.22); border: 1px solid var(--line); margin: 0; color: var(--text); font-size: 13px; }
.fancy-games .fg.on { border-color: rgba(190,150,255,.6); background: rgba(91,47,176,.22); }
.fancy-games .fg input { margin: 2px 0 0; accent-color: #7b4bd6; width: 16px; height: 16px; flex: none; }
.fancy-games .fg b { display: block; font-size: 13.5px; }
.fancy-games .fg small { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.35; margin-top: 1px; }
/* 4-card hands */
.card:nth-child(4) { transform: rotate(14deg); z-index: 3; }
.my-cards .card:nth-child(1):nth-last-child(4) { transform: rotate(-12deg) translateY(6px); }
.my-cards .card:nth-child(2):nth-last-child(3) { transform: rotate(-4deg); }
.my-cards .card:nth-child(3):nth-last-child(2) { transform: rotate(4deg); }
.my-cards .card:nth-child(4):nth-last-child(1) { transform: rotate(12deg) translateY(6px); }
/* 2-card hands */
.my-cards .card:nth-child(1):nth-last-child(2) { transform: rotate(-6deg); }
.my-cards .card:nth-child(2):nth-last-child(1) { transform: rotate(6deg); }
.variant.v-ulta { border-color: rgba(255, 210, 120, .6); background: rgba(80, 55, 10, .72); }
.variant.v-ulta b { color: #ffe3a8; } .variant.v-ulta small { color: #f0d49a; }
.variant.v-four, .variant.v-two { border-color: rgba(130, 230, 180, .55); background: rgba(10, 70, 50, .72); }
.variant.v-four b, .variant.v-two b { color: #c4f5dc; } .variant.v-four small, .variant.v-two small { color: #a9e6c8; }

/* keep the wild card (and its star) above its neighbours */
.my-cards .card.wild, .mini-cards .card.wild, .compare .card.wild { z-index: 5; }
.variant { max-width: min(92%, 320px); }
/* phones turned sideways: keep the middle of the table compact when a fancy badge is showing */
@media (orientation: landscape) and (max-height: 520px) {
  .felt-center.has-variant .stake { display: none; }
  .variant { margin-bottom: 5px; padding: 3px 10px 3px 6px; }
  .variant b { font-size: 12px; } .variant small { font-size: 11px; }
}

/* ---------- showdown: every revealed hand readable ---------- */
.result-banner.has-showdown {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 30;
  width: min(92vw, 440px); max-width: none; max-height: 86vh; overflow-y: auto;
  background: rgba(8, 24, 17, .97); padding: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.6); cursor: pointer;
}
.result-banner.closed { display: none; }
.showdown { display: grid; gap: 5px; margin-top: 10px; text-align: left; }
.sd-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name cards" "hand cards";
  align-items: center; column-gap: 10px; padding: 6px 8px; border-radius: 10px; background: rgba(255,255,255,.06); border: 1px solid transparent; }
.sd-row.win { background: rgba(242,193,78,.14); border-color: rgba(242,193,78,.6); }
.sd-name { grid-area: name; font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sd-crown { color: var(--gold); margin-right: 3px; }
.sd-hand { grid-area: hand; font-size: 12px; color: #ffe08a; font-weight: 700; white-space: nowrap; }
.sd-cards { grid-area: cards; display: flex; gap: 3px; }
.sd-cards .card { width: 30px; height: 42px; margin: 0; font-size: 14px; transform: none !important; border-radius: 5px; }
.sd-cards .card .s { font-size: 14px; }
.sd-cards .card.wild::after { width: 14px; height: 14px; line-height: 14px; font-size: 9px; top: -6px; right: -5px; }
.sd-tap { margin-top: 8px; font-size: 11.5px; color: var(--muted); }
#seats.showdown-open .mini-cards.revealed, #seats.showdown-open .hand-tag { display: none; }
/* revealed cards at the seats (after the panel is closed): side by side, never overlapping */
.seat .mini-cards.revealed { gap: 2px; }
.seat .mini-cards.revealed .card { margin: 0; transform: none !important; }
/* big showdowns: tighter rows on phones held upright */
.showdown.many .sd-row { padding: 4px 8px; }
.showdown.many .sd-cards .card { width: 26px; height: 36px; font-size: 12.5px; }
.showdown.many .sd-cards .card .s { font-size: 12.5px; }
/* sideways / wide screens: two columns for big showdowns */
@media (orientation: landscape) {
  .result-banner.has-showdown { width: min(88vw, 640px); }
  .showdown.many { grid-template-columns: 1fr 1fr; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .result-banner.has-showdown { padding: 8px 10px; max-height: 92vh; }
  .result-banner.has-showdown > b { font-size: 14px; }
  .showdown { gap: 4px; margin-top: 6px; }
  .sd-row { padding: 3px 7px; }
  .sd-cards .card, .showdown.many .sd-cards .card { width: 23px; height: 32px; font-size: 11px; }
  .sd-cards .card .s, .showdown.many .sd-cards .card .s { font-size: 11px; }
  .sd-name { font-size: 12px; } .sd-hand { font-size: 11px; }
  .sd-tap { margin-top: 4px; }
}
