﻿:root {
  --bg: #06110d;
  --bg-2: #0b1f18;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-strong: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #f5efe1;
  --muted: #a3b4a9;
  --faint: #6f8378;
  --gold: #ecc66f;
  --gold-2: #c9973a;
  --red: #e5484d;
  --green: #35c27a;
  --felt-1: #1f8257;
  --felt-2: #13603f;
  --felt-3: #0b3a27;
  --wood-1: #6b4426;
  --wood-2: #3e2614;
  --card-red: #c8102e;
  --card-black: #16161a;
  --radius: 18px;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  --cw: 84px;
  --tcw: 70px;
  font-family: "Outfit", system-ui, sans-serif;
  color: var(--text);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(1200px 700px at 10% -10%, rgba(53, 194, 122, 0.16), transparent 60%),
    radial-gradient(900px 600px at 110% 110%, rgba(200, 16, 46, 0.14), transparent 60%),
    radial-gradient(700px 500px at 80% 0%, rgba(236, 198, 111, 0.08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--gold); text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }
.serif { font-family: "Playfair Display", Georgia, serif; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 24px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: linear-gradient(180deg, rgba(6, 17, 13, 0.92), rgba(6, 17, 13, 0.7));
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand-mark {
  display: inline-flex; gap: 1px; padding: 6px 8px; border-radius: 10px;
  background: linear-gradient(160deg, #fffdf6, #efe7d4); color: #111; font-size: 18px; line-height: 1;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4); transform: rotate(-6deg);
}
.brand-mark .r { color: var(--card-red); }
.brand-name { font-family: "Playfair Display", serif; font-size: 22px; font-weight: 700; letter-spacing: 0.2px; white-space: nowrap; }
.brand-name em { color: var(--gold); font-style: italic; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a { color: var(--muted); padding: 8px 14px; border-radius: 999px; font-weight: 500; transition: 0.2s; }
.nav a:hover { color: var(--text); background: var(--panel); }
.nav a.active { color: var(--text); background: var(--panel-strong); }
.conn { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.conn .dot { width: 8px; height: 8px; border-radius: 50%; background: #d29b2c; box-shadow: 0 0 10px #d29b2c; }
.conn.ok .dot { background: var(--green); box-shadow: 0 0 10px var(--green); }
.conn.ok .label { display: none; }
.conn.bad .dot { background: var(--red); box-shadow: 0 0 10px var(--red); }

.app { padding: clamp(16px, 3vw, 36px) clamp(16px, 4vw, 40px) 60px; max-width: 1380px; margin: 0 auto; }

/* ---------- primitives ---------- */
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; backdrop-filter: blur(10px);
}
.panel h2 { font-size: 18px; font-weight: 600; margin-bottom: 14px; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.16em; font-size: 12px; color: var(--gold); font-weight: 600; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--panel-strong); color: var(--text); font-weight: 600; cursor: pointer;
  transition: transform 0.15s, background 0.2s, box-shadow 0.2s, opacity 0.2s; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.13); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(180deg, #f6d68a, var(--gold) 45%, var(--gold-2));
  color: #2a1b05; border-color: rgba(255, 230, 170, 0.6);
  box-shadow: 0 10px 24px rgba(201, 151, 58, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #fbe1a0, #f0cd7c 45%, #d6a548); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover:not(:disabled) { color: var(--text); background: var(--panel); }
.btn.danger { color: #ffb3b5; border-color: rgba(229, 72, 77, 0.4); background: rgba(229, 72, 77, 0.1); }
.btn.small { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn.big { padding: 15px 26px; font-size: 17px; border-radius: 14px; }
.btn.block { width: 100%; }

.input {
  width: 100%; padding: 13px 15px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: rgba(0, 0, 0, 0.25); color: var(--text); font: inherit; font-size: 16px; outline: none; transition: 0.2s;
}
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(236, 198, 111, 0.18); }
.input.code { text-transform: uppercase; letter-spacing: 0.35em; font-weight: 700; text-align: center; font-size: 20px; }
label.field { display: flex; flex-direction: column; gap: 7px; font-size: 13px; color: var(--muted); font-weight: 500; }

.tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--panel-strong); border: 1px solid var(--line); color: var(--muted);
}
.tag.gold { color: var(--gold); border-color: rgba(236, 198, 111, 0.35); background: rgba(236, 198, 111, 0.08); }
.tag.green { color: #8fe8b6; border-color: rgba(53, 194, 122, 0.35); background: rgba(53, 194, 122, 0.1); }
.tag.red { color: #ffb3b5; border-color: rgba(229, 72, 77, 0.35); background: rgba(229, 72, 77, 0.1); }

/* segmented control */
.seg { display: inline-flex; padding: 4px; border-radius: 12px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 9px; color: var(--muted); font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--panel-strong); color: var(--text); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3); }
.seg button:disabled { cursor: default; }

/* toggle switch */
.toggle { display: flex; align-items: center; gap: 12px; cursor: pointer; padding: 10px 0; }
.toggle input { display: none; }
.toggle .sw { width: 42px; height: 24px; border-radius: 999px; background: rgba(255, 255, 255, 0.15); position: relative; transition: 0.2s; flex: none; }
.toggle .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: 0.2s; }
.toggle input:checked + .sw { background: var(--green); }
.toggle input:checked + .sw::after { left: 21px; }
.toggle input:disabled + .sw { opacity: 0.55; }
.toggle .t { display: flex; flex-direction: column; }
.toggle .t b { font-weight: 600; font-size: 15px; }
.toggle .t small { color: var(--muted); font-size: 13px; }
.toggle.locked { cursor: default; }

/* ---------- home ---------- */
.hero { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 40px; align-items: center; padding: 20px 0 40px; }
.hero h1 { font-family: "Playfair Display", serif; font-size: clamp(40px, 6vw, 74px); line-height: 1.02; font-weight: 700; letter-spacing: -0.5px; }
.hero h1 em { color: var(--gold); }
.hero p.lead { font-size: clamp(17px, 1.6vw, 20px); color: var(--muted); max-width: 540px; line-height: 1.55; margin: 20px 0 26px; }
.hero .pills { display: flex; gap: 10px; flex-wrap: wrap; }
.fan { position: relative; height: 340px; }
.fan .card { position: absolute; left: 50%; top: 50%; --cw: 130px; transition: transform 0.6s cubic-bezier(.2, .8, .2, 1); }
.fan:hover .card { transition-duration: 0.4s; }

.play-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 22px; }
.games { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.game-tile {
  position: relative; text-align: left; padding: 18px; border-radius: 16px; cursor: pointer;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--line); transition: 0.2s; overflow: hidden; min-height: 168px;
  display: flex; flex-direction: column; gap: 6px;
}
.game-tile:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.game-tile.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 14px 30px rgba(0, 0, 0, 0.35); background: linear-gradient(160deg, rgba(236, 198, 111, 0.14), rgba(255, 255, 255, 0.02)); }
.game-tile .icon { font-size: 30px; line-height: 1; margin-bottom: 6px; }
.game-tile h3 { font-size: 19px; font-weight: 700; }
.game-tile p { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.game-tile .meta { margin-top: auto; padding-top: 8px; font-size: 12px; color: var(--faint); font-weight: 600; }
.game-tile .check { position: absolute; top: 14px; right: 14px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; font-size: 12px; color: #2a1b05; }
.game-tile.on .check { background: var(--gold); border-color: var(--gold); }

.features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 30px; }
.feature { padding: 18px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); }
.feature b { display: block; font-size: 15px; margin: 8px 0 4px; }
.feature span { color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.feature .ico { font-size: 22px; }

.divider { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 12px; text-transform: uppercase; letter-spacing: 0.14em; margin: 6px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- cards ---------- */
.card {
  width: var(--cw); height: calc(var(--cw) * 1.4); flex: none; position: relative; border-radius: calc(var(--cw) * 0.1);
  background: linear-gradient(165deg, #fffefa 0%, #f6f1e4 100%); color: var(--card-black);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15), 0 8px 18px rgba(0, 0, 0, 0.38);
  user-select: none; -webkit-user-select: none; overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.12);
}
.card.red { color: var(--card-red); }
.card .ix { position: absolute; display: flex; flex-direction: column; align-items: center; line-height: 0.92; font-weight: 700; }
.card .ix .r { font-size: calc(var(--cw) * 0.24); letter-spacing: -0.04em; }
.card .ix .s { font-size: calc(var(--cw) * 0.2); }
.card .ix.tl { top: calc(var(--cw) * 0.06); left: calc(var(--cw) * 0.07); }
.card .ix.br { bottom: calc(var(--cw) * 0.06); right: calc(var(--cw) * 0.07); transform: rotate(180deg); }
.card .pip { position: absolute; inset: 0; display: grid; place-items: center; font-size: calc(var(--cw) * 0.52); }
.card.face .pip {
  inset: calc(var(--cw) * 0.2) calc(var(--cw) * 0.24); border-radius: calc(var(--cw) * 0.05);
  border: 1.5px solid currentColor; opacity: 0.9;
  background: linear-gradient(160deg, rgba(236, 198, 111, 0.28), rgba(236, 198, 111, 0.06));
  font-family: "Playfair Display", serif; font-weight: 700; font-size: calc(var(--cw) * 0.4);
}
.card.face .pip small { position: absolute; bottom: 6%; font-size: 0.42em; font-family: "Outfit"; }
.card.joker { background: linear-gradient(160deg, #fffaf0, #f3e2b8); }
.card.joker .pip { flex-direction: column; font-size: calc(var(--cw) * 0.38); color: #7b2cbf; }
.card.joker .pip span { display: block; text-align: center; }
.card.joker .jk { font-size: calc(var(--cw) * 0.13); letter-spacing: 0.18em; font-weight: 800; color: #7b2cbf; margin-top: 4px; }
.card .wild {
  position: absolute; top: calc(var(--cw) * 0.56); left: calc(var(--cw) * 0.08); font-size: calc(var(--cw) * 0.17);
  color: #b07a12; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.2));
}
.card.back {
  background:
    radial-gradient(circle at 50% 50%, rgba(236, 198, 111, 0.35) 0 12%, transparent 13%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.08) 0 4px, transparent 4px 9px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.08) 0 4px, transparent 4px 9px),
    linear-gradient(160deg, #8c1c2c, #5a0f1b);
  border: calc(var(--cw) * 0.05) solid #fbf6ea;
}
.card.slot { background: rgba(0, 0, 0, 0.18); border: 2px dashed rgba(255, 255, 255, 0.22); box-shadow: none; }

/* ---------- hand ---------- */
.hand-wrap { position: relative; padding: 26px 0 6px; }
.hand { display: flex; justify-content: center; align-items: flex-end; min-height: calc(calc(var(--cw) * 1.4) + 26px); padding: 0 8px; }
.hand .card { transition: transform 0.18s ease, box-shadow 0.18s, filter 0.2s, margin 0.2s; cursor: default; }
.hand .card + .card { margin-left: calc(var(--step, 46px) - var(--cw)); }
.hand .card.playable { cursor: pointer; }
.hand .card.playable:hover { transform: translateY(-18px); box-shadow: 0 18px 30px rgba(0, 0, 0, 0.5); z-index: 5; }
.hand.dim-unplayable .card:not(.playable) { filter: brightness(0.62) saturate(0.7); }
.hand .card.selected { transform: translateY(-24px); box-shadow: 0 0 0 3px var(--gold), 0 18px 30px rgba(0, 0, 0, 0.5); }
.hand .card.fresh { box-shadow: 0 0 0 3px #7fd6ff, 0 8px 18px rgba(0, 0, 0, 0.38); }
.hand .card.fresh.selected { box-shadow: 0 0 0 3px var(--gold), 0 18px 30px rgba(0, 0, 0, 0.5); }
.hand .card.received::after { content: "new"; position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); background: #7fd6ff; color: #04202e; font-size: 10px; font-weight: 800; padding: 1px 6px; border-radius: 6px; }
.hand .card.dragging { opacity: 0.35; }
.hand .card.drop-before { box-shadow: -4px 0 0 var(--gold), 0 8px 18px rgba(0, 0, 0, 0.38); }

/* ---------- game layout ---------- */
.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.game-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.game-head h2 { font-family: "Playfair Display", serif; font-size: 26px; }
.game-head .spacer { flex: 1; }
.status-bar {
  display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 46px;
  padding: 10px 18px; border-radius: 14px; background: rgba(0, 0, 0, 0.28); border: 1px solid var(--line);
  font-weight: 500; text-align: center; margin-top: 10px;
}
.status-bar.mine { border-color: rgba(236, 198, 111, 0.6); background: linear-gradient(90deg, rgba(236, 198, 111, 0.16), rgba(236, 198, 111, 0.05)); color: #fff3d2; }
.status-bar .pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 0 rgba(236, 198, 111, 0.6); animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(236, 198, 111, 0.6); } 70% { box-shadow: 0 0 0 12px rgba(236, 198, 111, 0); } 100% { box-shadow: 0 0 0 0 rgba(236, 198, 111, 0); } }

.actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }

.table-wrap { position: relative; width: 100%; aspect-ratio: 16 / 9.4; max-height: 560px; min-height: 340px; }
.felt {
  position: absolute; inset: 9% 7%; border-radius: 50% / 46%;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(255, 255, 255, 0.1), transparent 60%),
    radial-gradient(ellipse at center, var(--felt-1) 0%, var(--felt-2) 55%, var(--felt-3) 100%);
  box-shadow:
    inset 0 0 0 10px var(--wood-1), inset 0 0 0 14px var(--wood-2), inset 0 0 0 15px rgba(236, 198, 111, 0.35),
    inset 0 0 80px rgba(0, 0, 0, 0.55), 0 40px 80px rgba(0, 0, 0, 0.55);
}
.felt::after {
  content: ""; position: absolute; inset: 15px; border-radius: inherit; pointer-events: none; opacity: 0.18;
  background-image: radial-gradient(rgba(0, 0, 0, 0.6) 1px, transparent 1px); background-size: 4px 4px;
}
.felt-logo { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-family: "Playfair Display", serif; font-size: clamp(18px, 2.6vw, 30px); color: rgba(255, 255, 255, 0.08); font-style: italic; pointer-events: none; white-space: nowrap; }

.seat {
  position: absolute; transform: translate(-50%, -50%); z-index: 4;
  display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 96px;
}
.seat .badge {
  display: flex; align-items: center; gap: 9px; padding: 6px 12px 6px 6px; border-radius: 999px;
  background: rgba(8, 20, 15, 0.86); border: 1px solid var(--line-strong); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  transition: 0.25s; white-space: nowrap;
}
.seat .avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 15px;
  color: #10241b; background: var(--av, #8fd3b0); flex: none;
}
.seat .who { display: flex; flex-direction: column; line-height: 1.15; }
.seat .who b { font-size: 14px; font-weight: 600; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.seat .who small { font-size: 12px; color: var(--muted); }
.seat.turn .badge { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(236, 198, 111, 0.3), 0 0 30px rgba(236, 198, 111, 0.35); }
.seat.me .badge { background: rgba(236, 198, 111, 0.16); }
.seat.away .avatar { filter: grayscale(1); opacity: 0.6; }
.seat.out .badge { opacity: 0.6; }
.seat .mini { display: flex; height: 30px; }
.seat .mini .card { --cw: 22px; border-width: 2px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4); }
.seat .mini .card + .card { margin-left: -16px; }
.seat .flag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.seat .flag.safe { background: rgba(53, 194, 122, 0.2); color: #8fe8b6; }
.seat .flag.bhabhi { background: rgba(229, 72, 77, 0.25); color: #ffc1c3; }
.seat .flag.gold { background: rgba(236, 198, 111, 0.2); color: var(--gold); }

.trick-card { position: absolute; transform: translate(-50%, -50%) rotate(var(--rot, 0deg)); z-index: 3; --cw: var(--tcw); transition: transform 0.3s; }
.trick-card.fly { animation: fly-in 0.38s cubic-bezier(.2, .8, .2, 1); }
@keyframes fly-in {
  from { transform: translate(calc(-50% + var(--fx, 0px)), calc(-50% + var(--fy, 0px))) rotate(0deg) scale(0.85); opacity: 0.2; }
  to { transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scale(1); opacity: 1; }
}
.trick-card.win .card { box-shadow: 0 0 0 3px var(--gold), 0 0 26px rgba(236, 198, 111, 0.6); }
.trick-card.gone { animation: sweep 0.5s ease forwards; animation-delay: 1s; }
@keyframes sweep { to { opacity: 0; transform: translate(-50%, -50%) scale(0.7); } }

.center-info { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 2; text-align: center; pointer-events: none; }
.center-banner {
  position: absolute; left: 50%; top: 16%; transform: translateX(-50%); z-index: 6; padding: 8px 16px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.55); border: 1px solid var(--line-strong); font-size: 13px; font-weight: 600; white-space: nowrap;
  animation: pop 0.3s ease;
}
.center-banner.thulla { background: linear-gradient(90deg, #8c1c2c, #c8102e); border-color: #ff8a8f; font-size: 15px; }
@keyframes pop { from { transform: translateX(-50%) scale(0.8); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }

/* rummy piles */
.piles { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; gap: clamp(14px, 3vw, 34px); align-items: flex-end; z-index: 3; }
.pile { display: flex; flex-direction: column; align-items: center; gap: 8px; --cw: var(--tcw); }
.pile .stackcards { position: relative; width: var(--cw); height: calc(var(--cw) * 1.4); }
.pile .stackcards .card { position: absolute; left: 0; top: 0; }
.pile .stackcards .card:nth-child(2) { transform: translate(2px, -2px); }
.pile .stackcards .card:nth-child(3) { transform: translate(4px, -4px); }
.pile.clickable .stackcards { cursor: pointer; }
.pile.clickable .stackcards::after {
  content: ""; position: absolute; inset: -6px; border-radius: 12px; border: 2px solid var(--gold);
  box-shadow: 0 0 20px rgba(236, 198, 111, 0.6); animation: glow 1.4s ease-in-out infinite alternate; pointer-events: none;
}
@keyframes glow { from { opacity: 0.4; } to { opacity: 1; } }
.pile label { font-size: 12px; color: rgba(255, 255, 255, 0.75); font-weight: 600; letter-spacing: 0.04em; }
.pile.cut .card { transform: rotate(90deg) translateX(10%); }

/* ---------- side panel ---------- */
.side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 86px; }
.scores { width: 100%; border-collapse: collapse; font-size: 14px; }
.scores th { text-align: left; color: var(--faint); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; padding: 6px 4px; }
.scores td { padding: 8px 4px; border-top: 1px solid var(--line); }
.scores td.num, .scores th.num { text-align: right; font-variant-numeric: tabular-nums; }
.scores tr.me td { color: var(--gold); }
.scores tr.lead td:first-child::after { content: " \2605"; color: var(--gold); }

.chat { display: flex; flex-direction: column; height: 330px; }
.chat .log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 4px; margin-bottom: 10px; }
.chat .msg { font-size: 14px; line-height: 1.4; word-wrap: break-word; }
.chat .msg b { color: var(--gold); font-weight: 600; }
.chat .msg.sys { color: var(--faint); font-size: 12.5px; font-style: italic; }
.chat form { display: flex; gap: 8px; }
.chat .input { padding: 10px 12px; font-size: 14px; }

/* ---------- lobby ---------- */
.lobby { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 22px; align-items: start; }
.code-box { text-align: center; }
.code-tiles { display: flex; justify-content: center; gap: 7px; margin: 12px 0 16px; }
.code-tiles span {
  width: 44px; height: 56px; display: grid; place-items: center; border-radius: 10px; font-size: 28px; font-weight: 800;
  background: linear-gradient(165deg, #fffefa, #efe7d3); color: #1b1b1f; box-shadow: 0 8px 18px rgba(0, 0, 0, 0.4);
}
.code-tiles span:nth-child(odd) { color: var(--card-red); }
.players { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.players li { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 12px; background: rgba(0, 0, 0, 0.18); border: 1px solid var(--line); }
.players li.empty { border-style: dashed; background: transparent; color: var(--faint); font-size: 14px; }
.players .avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #10241b; background: var(--av, #8fd3b0); flex: none; }
.players li.empty .avatar { background: transparent; border: 1px dashed var(--line-strong); color: var(--faint); }
.players .name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.players .off { opacity: 0.5; }
.option-group { padding: 14px 0; border-top: 1px solid var(--line); }
.option-group:first-of-type { border-top: 0; padding-top: 4px; }
.option-group > h4 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--faint); font-weight: 600; }
.rules-mini { margin: 0; padding-left: 18px; color: var(--muted); line-height: 1.6; font-size: 14.5px; }
.start-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }

/* ---------- results / modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 60; background: rgba(2, 8, 6, 0.7); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 16px; animation: fade 0.2s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: min(760px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 26px;
  border-radius: 22px; background: linear-gradient(170deg, #12302a, #0a1b15); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow); animation: rise 0.25s cubic-bezier(.2, .8, .2, 1);
}
@keyframes rise { from { transform: translateY(16px); opacity: 0; } }
.modal h2 { font-family: "Playfair Display", serif; font-size: 30px; margin-bottom: 6px; }
.modal .close { float: right; }
.result-list { display: flex; flex-direction: column; gap: 12px; margin: 18px 0; }
.result { padding: 14px; border-radius: 14px; background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line); }
.result.win { border-color: rgba(236, 198, 111, 0.6); background: rgba(236, 198, 111, 0.08); }
.result .head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.result .head b { flex: 1; }
.result .melds { display: flex; gap: 14px; flex-wrap: wrap; }
.result .meld { display: flex; flex-direction: column; gap: 4px; }
.result .meld .cards { display: flex; }
.result .meld .card { --cw: 40px; }
.result .meld .card + .card { margin-left: -18px; }
.result .meld small { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.result .meld.dead small { color: #ffb3b5; }

/* ---------- pricing / rules ---------- */
.page-head { text-align: center; max-width: 720px; margin: 10px auto 34px; }
.page-head h1 { font-family: "Playfair Display", serif; font-size: clamp(34px, 5vw, 54px); margin: 10px 0 12px; }
.page-head p { color: var(--muted); font-size: 18px; line-height: 1.55; margin: 0; }
.plans { display: grid; grid-template-columns: repeat(2, minmax(0, 380px)); gap: 22px; justify-content: center; }
.plans.single { grid-template-columns: minmax(0, 420px); }
.plan { position: relative; padding: 30px; border-radius: 22px; border: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; gap: 16px; }
.plan.pro { border-color: rgba(236, 198, 111, 0.55); background: linear-gradient(170deg, rgba(236, 198, 111, 0.12), rgba(255, 255, 255, 0.02)); box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4); }
.plan .price { font-size: 46px; font-weight: 800; letter-spacing: -1px; }
.plan .price small { font-size: 16px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.plan ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.plan li { display: flex; gap: 10px; color: #dfe7e1; line-height: 1.4; }
.plan li::before { content: "\2713"; color: var(--green); font-weight: 800; }
.plan.pro li::before { color: var(--gold); }
.plan .ribbon { position: absolute; top: -12px; right: 22px; }
.free-banner {
  max-width: 780px; margin: 30px auto 0; text-align: center; padding: 16px 20px; border-radius: 16px;
  background: rgba(53, 194, 122, 0.1); border: 1px solid rgba(53, 194, 122, 0.3); color: #c9f5dc;
}
.rules-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.rules-card h2 { font-family: "Playfair Display", serif; font-size: 28px; margin-bottom: 4px; }
.rules-card h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--gold); margin: 18px 0 8px; }
.rules-card ol, .rules-card ul { margin: 0; padding-left: 20px; color: #d7e0da; line-height: 1.6; font-size: 15px; }
.rules-card p { color: var(--muted); line-height: 1.55; }

/* ---------- toasts ---------- */
.toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  padding: 11px 18px; border-radius: 12px; background: #1b2c25; border: 1px solid var(--line-strong); box-shadow: var(--shadow);
  font-weight: 500; animation: rise 0.25s ease; max-width: min(520px, calc(100vw - 32px)); text-align: center;
}
.toast.error { background: #3a1416; border-color: rgba(229, 72, 77, 0.5); color: #ffd3d4; }

.join-card { max-width: 440px; margin: 40px auto; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .game-layout { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; display: grid; grid-template-columns: 1fr 1fr; }
  .lobby { grid-template-columns: minmax(0, 1fr); }
  .rules-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 0; }
  .fan { height: 240px; order: -1; }
  .fan .card { --cw: 96px; }
  .play-grid { grid-template-columns: 1fr; }
  .features { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 680px) {
  :root { --cw: 60px; --tcw: 48px; }
  .topbar { gap: 10px; padding: 10px 16px; }
  .brand-name { font-size: 19px; }
  .nav { gap: 0; }
  .nav a { padding: 7px 8px; font-size: 14px; }
  .brand-mark { padding: 5px 6px; font-size: 15px; }
  .game-head h2 { font-size: 22px; }
  .conn .label { display: none; }
  .games { grid-template-columns: 1fr; }
  .game-tile { min-height: 0; }
  .side { grid-template-columns: 1fr; }
  .plans { grid-template-columns: 1fr; }
  .table-wrap { aspect-ratio: auto; height: 380px; min-height: 0; }
  .felt { inset: 13% 4%; }
  .seat { min-width: 0; }
  .seat .badge { padding: 4px 9px 4px 4px; gap: 6px; }
  .seat .avatar { width: 26px; height: 26px; font-size: 12px; }
  .seat .who b { font-size: 12px; max-width: 72px; }
  .seat .who small { font-size: 10.5px; }
  .seat .mini { display: none; }
  .code-tiles span { width: 38px; height: 50px; font-size: 24px; }
  .features { grid-template-columns: 1fr; }
  .modal { padding: 20px; }
  .hand .card.playable:hover { transform: none; }
}
