:root {
  --felt: #0f5132; --felt2: #0b3d27; --gold: #e7c66b; --ink: #0b1220;
  --panel: #161b26; --panel2: #1e2431; --line: #2a3243; --text: #e7ecf3;
  --muted: #9aa6b8; --red: #e5484d; --green: #46c26b; --accent: #6ea8fe;
}
* { box-sizing: border-box; }
html, body { overflow-x: hidden; }
body { margin: 0; font: 14px/1.45 system-ui, sans-serif; background: var(--ink); color: var(--text); }
.hidden { display: none !important; }
button { cursor: pointer; border: 0; border-radius: 8px; font-weight: 600; padding: 10px 14px; }
code { background: #0003; padding: 1px 5px; border-radius: 4px; }

/* login */
.login { display: grid; place-items: center; min-height: 100vh; }
.login-card { background: var(--panel); padding: 32px; border-radius: 16px; width: min(92vw, 380px);
  text-align: center; border: 1px solid var(--line); }
.login-card h1 { margin: 0 0 4px; }
.login-card input { width: 100%; padding: 12px; margin: 14px 0 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--ink); color: var(--text); font-size: 16px; }
.login-card button { width: 100%; background: var(--gold); color: #221; font-size: 16px; }
.hint { color: var(--muted); font-size: 12px; }
.err { color: var(--red); min-height: 18px; }

/* lobby */
.lobby-body { max-width: 900px; margin: 0 auto; padding: 16px; display: grid;
  grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
.leaderboard { width: 100%; border-collapse: collapse; }
.leaderboard td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.leaderboard .rank { color: var(--muted); width: 32px; }
.leaderboard .bal { text-align: right; color: var(--gold); font-weight: 700; white-space: nowrap; }
.leaderboard .me-row { background: #2b2f1c; }
.leaderboard .me-row td { color: var(--text); }
.join-panel { display: flex; flex-direction: column; gap: 10px; }
button.primary { background: var(--green); color: #05230f; font-size: 15px; padding: 14px; }
button.gold { background: var(--gold); color: #221; font-size: 15px; padding: 14px; }
button:disabled { opacity: .5; cursor: not-allowed; }

/* layout */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; color: var(--gold); }
.me { color: var(--muted); }
.pill { background: var(--panel2); border: 1px solid var(--line); padding: 4px 10px; border-radius: 999px; font-size: 12px; }
.ghost { background: var(--panel2); color: var(--text); border: 1px solid var(--line); }
.rebuy { background: var(--gold); color: #221; padding: 4px 10px; margin-left: 8px; font-size: 12px; }
/* Centered single column: table on top (centered), hand log below. */
.layout { max-width: 900px; margin: 0 auto; padding: 14px; display: flex; flex-direction: column; gap: 14px; }

/* table */
.table-wrap { position: relative; }
.felt { position: relative; width: 100%; margin: 0 auto; aspect-ratio: 16/10; background:
  radial-gradient(ellipse at center, var(--felt) 0%, var(--felt2) 78%);
  border: 10px solid #23301f; border-radius: 46% / 44%; box-shadow: inset 0 0 60px #0007; }
.board { position: absolute; top: 42%; left: 50%; transform: translate(-50%, -50%);
  display: flex; gap: 6px; }
.pot { position: absolute; top: 58%; left: 50%; transform: translateX(-50%);
  background: #0006; padding: 4px 12px; border-radius: 999px; color: var(--gold); font-weight: 700; }

/* seats */
.seat { position: absolute; width: 140px; transform: translate(-50%, -50%); text-align: center; z-index: 1; }
.seat .plate { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; }
.seat.you .plate { border-color: var(--gold); }
.seat.turn .plate { box-shadow: 0 0 0 2px var(--accent), 0 0 18px var(--accent); }
.seat.folded { opacity: 0.42; }
.seat .name { font-weight: 700; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat .bot { color: var(--gold); }
.seat .stack { color: var(--muted); font-size: 12px; }
.seat .pos { font-size: 10px; color: var(--accent); }
.seat .hole { display: flex; gap: 4px; justify-content: center; margin: 4px 0; min-height: 42px; }
.seat .last { font-size: 11px; color: var(--muted); min-height: 14px; }
.seat .chips { position: absolute; left: 50%; transform: translateX(-50%); top: -20px;
  background: #000a; color: var(--gold); border-radius: 999px; padding: 1px 8px; font-size: 11px; }
.dealer { position: absolute; top: -6px; right: 6px; background: #fff; color: #111;
  border-radius: 50%; width: 20px; height: 20px; font-size: 11px; line-height: 20px; font-weight: 800; }
.timerbar { height: 3px; background: var(--accent); border-radius: 2px; margin-top: 4px; transition: width linear; }

/* cards */
.card { width: 30px; height: 42px; border-radius: 5px; background: #fff; color: #111;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; box-shadow: 0 1px 3px #0007; }
.card.red { color: var(--red); }
.card.back { background: repeating-linear-gradient(45deg, #34507a, #34507a 5px, #26406a 5px, #26406a 10px); }
.card.big { width: 40px; height: 56px; font-size: 16px; }

/* controls */
.controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 14px;
  min-height: 54px; justify-content: center; }
.controls .fold { background: var(--red); color: #fff; }
.controls .call { background: var(--green); color: #05230f; }
.controls .raise { background: var(--gold); color: #221; }
.controls input[type=range] { width: 200px; }
.controls .amt { min-width: 64px; text-align: center; background: var(--panel2);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.waiting { color: var(--muted); }

/* side */
.side { display: flex; flex-direction: column; gap: 14px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.panel h2 { margin: 0 0 8px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.log { max-height: 520px; overflow: auto; font-size: 12px; color: var(--muted); }
.log .win { color: var(--green); }
.toast { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 5;
  background: var(--red); color: #fff; padding: 8px 14px; border-radius: 8px; }

/* ---- mobile ---- */
@media (max-width: 640px) {
  .layout { padding: 8px; gap: 10px; }
  .topbar { flex-wrap: wrap; gap: 8px; padding: 8px 10px; }
  .topbar .brand { font-size: 15px; }
  .table-controls { width: 100%; display: flex; gap: 6px; justify-content: flex-start; }
  /* Taller oval so 6 seats have vertical room on a narrow screen. */
  .felt { aspect-ratio: 4 / 5; border-width: 6px; }
  .board { top: 39%; gap: 4px; }
  .pot { top: 55%; font-size: 12px; padding: 3px 9px; }
  .seat { width: 84px; }
  .seat .plate { padding: 4px 5px; border-radius: 8px; }
  .seat .name { font-size: 11px; }
  .seat .stack { font-size: 10px; }
  .seat .hole { gap: 3px; min-height: 34px; }
  .card { width: 22px; height: 31px; font-size: 10px; border-radius: 4px; }
  .card.big { width: 30px; height: 42px; font-size: 12px; }
  .controls { gap: 8px; margin-top: 10px; }
  .controls button { padding: 12px 14px; flex: 1 1 40%; min-width: 96px; }
  .controls input[type=range] { width: 100%; flex-basis: 100%; }
  .controls .amt { flex: 1 1 30%; }
  .log { max-height: 240px; }
  .lobby-body { grid-template-columns: 1fr; padding: 10px; gap: 10px; }
}
