:root {
  --bg: #0f1720;
  --panel: #17222c;
  --felt: #14532d;
  --felt-edge: #0b3319;
  --accent: #e0a13d;
  --accent2: #3d8ee0;
  --text: #eef2f5;
  --muted: #93a3ad;
  --danger: #d9534f;
  --success: #4caf7d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; }

/* ---------- Lobby ---------- */
#screen-lobby, #screen-waiting {
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.lobby-card {
  background: var(--panel);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}

.lobby-card h1 { margin: 0 0 4px; font-size: 28px; text-align: center; }
.lobby-card h2 { margin: 0 0 8px; text-align: center; }
.subtitle { text-align: center; color: var(--muted); margin: 0 0 20px; font-size: 14px; }

.tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.tab-btn {
  flex: 1; padding: 10px; border-radius: 8px; border: none;
  background: #1e2b36; color: var(--muted); cursor: pointer; font-weight: 600;
}
.tab-btn.active { background: var(--accent); color: #1a1200; }

.tab-panel { display: none; flex-direction: column; gap: 12px; }
.tab-panel.active { display: flex; }

label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); flex: 1; }
input {
  background: #0f1720; border: 1px solid #2a3945; border-radius: 8px;
  padding: 10px; color: var(--text); font-size: 15px;
}
input:focus { outline: 2px solid var(--accent2); }

.row { display: flex; gap: 12px; }

.hint { color: var(--muted); font-size: 12.5px; line-height: 1.5; margin: 4px 0 0; }

.primary-btn {
  margin-top: 8px; padding: 13px; border: none; border-radius: 10px;
  background: var(--accent); color: #1a1200; font-weight: 700; font-size: 15px;
  cursor: pointer;
}
.primary-btn:hover { filter: brightness(1.08); }
.primary-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.error-msg { color: var(--danger); font-size: 13px; min-height: 18px; margin: 10px 0 0; text-align: center; }

.player-list { list-style: none; padding: 0; margin: 16px 0; }
.player-list li {
  padding: 10px 14px; background: #0f1720; border-radius: 8px; margin-bottom: 6px;
  display: flex; justify-content: space-between; font-size: 14px;
}
.player-list li .host-tag { color: var(--accent); font-size: 11px; margin-left: 6px; }

#waiting-code { color: var(--accent); letter-spacing: 3px; }

/* ---------- Table ---------- */
.table-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  display: flex; justify-content: space-between; padding: 10px 18px;
  background: var(--panel); font-size: 13px; color: var(--muted);
}
.topbar b { color: var(--text); letter-spacing: 2px; }

.poker-table {
  position: relative;
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  min-height: 420px;
}

.felt {
  position: absolute;
  width: min(720px, 92vw);
  height: min(380px, 58vw);
  background: radial-gradient(ellipse at center, var(--felt) 0%, var(--felt-edge) 100%);
  border-radius: 50%;
  border: 10px solid #1a1008;
  box-shadow: inset 0 0 60px rgba(0,0,0,0.5), 0 10px 30px rgba(0,0,0,0.5);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px;
}

.pot-display {
  background: rgba(0,0,0,0.35); padding: 6px 16px; border-radius: 20px;
  font-weight: 700; font-size: 14px; color: var(--accent);
}

.community-cards { display: flex; gap: 6px; min-height: 60px; align-items: center; }

.seats {
  position: absolute;
  width: min(760px, 96vw);
  height: min(440px, 64vw);
}

.seat {
  position: absolute;
  width: 118px;
  transform: translate(-50%, -50%);
  text-align: center;
}

.seat-box {
  background: #0f1720; border: 2px solid #263442; border-radius: 12px;
  padding: 8px 6px; font-size: 12px;
}
.seat-box.acting { border-color: var(--accent); box-shadow: 0 0 12px rgba(224,161,61,0.6); }
.seat-box.folded { opacity: 0.4; }
.seat-box.winner { border-color: var(--success); box-shadow: 0 0 14px rgba(76,175,125,0.7); }

.seat-name { font-weight: 700; font-size: 13px; }
.seat-chips { color: var(--accent); font-size: 12px; margin-top: 2px; }
.seat-bet { color: var(--accent2); font-size: 11px; margin-top: 2px; }
.seat-status { color: var(--muted); font-size: 10px; margin-top: 2px; }
.seat-cards { display: flex; gap: 3px; justify-content: center; margin-top: 6px; }
.dealer-btn {
  position: absolute; top: -8px; right: -6px; background: #fff; color: #000;
  width: 20px; height: 20px; border-radius: 50%; font-size: 10px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.card {
  width: 34px; height: 48px; border-radius: 5px; background: #fff; color: #111;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4); border: 1px solid #ccc;
}
.card.large { width: 46px; height: 64px; font-size: 18px; }
.card.red { color: #d32f2f; }
.card.hidden { background: repeating-linear-gradient(45deg, #2b4a72, #2b4a72 4px, #23405f 4px, #23405f 8px); color: transparent; border-color: #17304d; }

.result-banner {
  text-align: center; padding: 10px; background: rgba(76,175,125,0.15);
  color: var(--success); font-weight: 700; font-size: 14px;
}

.action-bar {
  background: var(--panel); padding: 12px 16px; display: flex; flex-direction: column; gap: 10px;
}
.action-info { font-size: 13px; color: var(--muted); text-align: center; }
.action-buttons { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.act-btn {
  padding: 12px 18px; border: none; border-radius: 10px; font-weight: 700; cursor: pointer; font-size: 14px;
  min-width: 84px;
}
.act-btn.fold { background: #3a3a3a; color: #eee; }
.act-btn.check { background: #2f5a80; color: #fff; }
.act-btn.call { background: var(--accent2); color: #fff; }
.act-btn.raise { background: var(--accent); color: #1a1200; }
.act-btn.allin { background: var(--danger); color: #fff; }
.act-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.raise-controls { display: flex; gap: 8px; align-items: center; justify-content: center; }
.raise-controls input[type=range] { flex: 1; max-width: 300px; }
.raise-controls input[type=number] { width: 100px; }

.log-panel {
  max-height: 110px; overflow-y: auto; background: #0d151b; padding: 8px 16px;
  font-size: 11.5px; color: var(--muted); line-height: 1.6;
}

@media (max-width: 640px) {
  .seat { width: 88px; }
  .card { width: 26px; height: 38px; font-size: 11px; }
  .card.large { width: 34px; height: 48px; font-size: 14px; }
}
