*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #1a1d24;
  --panel: #0f1419;
  --border: #2a3038;
  --gold: #ffd700;
  --felt-1: #1e5a3a;
  --felt-2: #0f3a22;
  --wood: #5c3a21;
  --text: #e0e0e0;
  --muted: #8892a0;
}

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 15px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

h1 { font-size: 1.35rem; color: var(--gold); letter-spacing: 0.02em; }

#reset-btn {
  padding: 0.55rem 1.1rem;
  background: #c62828;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s;
}
#reset-btn:hover { background: #e53935; }

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  padding: 1rem;
  gap: 1rem;
}

#table {
  background: radial-gradient(ellipse at center, var(--felt-1) 0%, var(--felt-2) 100%);
  border: 6px solid var(--wood);
  border-radius: 20px;
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: inset 0 0 40px rgba(0,0,0,0.5), 0 8px 24px rgba(0,0,0,0.4);
}

#bots {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

#board {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0;
}

#pot {
  background: rgba(0,0,0,0.55);
  padding: 0.35rem 1.1rem;
  border-radius: 20px;
  color: var(--gold);
  font-weight: 700;
  font-size: 0.95rem;
  border: 1px solid rgba(255,215,0,0.2);
}

#community-cards, .seat-cards {
  display: flex;
  gap: 0.3rem;
  justify-content: center;
  flex-wrap: wrap;
}

.seat {
  background: rgba(0,0,0,0.5);
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 0.45rem 0.4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  min-width: 0;
  transition: border-color 0.2s, box-shadow 0.2s, opacity 0.2s;
  position: relative;
}

.seat.active {
  border-color: var(--gold);
  box-shadow: 0 0 14px rgba(255,215,0,0.45);
}

.seat.folded { opacity: 0.38; }
.seat.eliminated { opacity: 0.18; }

.seat.winner {
  border-color: #4caf50;
  box-shadow: 0 0 20px rgba(76,175,80,0.6);
}

.seat.dealer::after {
  content: "D";
  position: absolute;
  top: -8px;
  right: -8px;
  width: 20px;
  height: 20px;
  background: #fff;
  color: #000;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ccc;
}

.seat-name {
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.seat-stack { font-size: 0.85rem; color: var(--gold); font-weight: 700; }
.seat-action { font-size: 0.7rem; color: var(--muted); min-height: 1em; }
.seat-bet {
  font-size: 0.75rem;
  color: #4fc3f7;
  font-weight: 600;
  min-height: 1em;
}

#human-seat { display: flex; flex-direction: column; align-items: center; }
#human-seat .seat { min-width: 200px; }
#human-seat .seat .seat-name { font-size: 0.9rem; }
#human-seat .seat .seat-stack { font-size: 1rem; }

.card-svg {
  display: block;
  width: 44px;
  height: 62px;
  border-radius: 5px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

#human-seat .card-svg { width: 60px; height: 84px; }

#controls {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
  min-height: 60px;
  align-items: center;
}

#controls .message { color: var(--muted); font-style: italic; }

button {
  padding: 0.7rem 1.4rem;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s;
  font-family: inherit;
}
button:hover:not(:disabled) { transform: translateY(-1px); }
button:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-fold  { background: #c62828; color: #fff; }
.btn-fold:hover  { background: #e53935; }
.btn-call  { background: #1565c0; color: #fff; }
.btn-call:hover  { background: #1976d2; }
.btn-check { background: #455a64; color: #fff; }
.btn-check:hover { background: #546e7a; }
.btn-raise { background: #f9a825; color: #000; }
.btn-raise:hover { background: #fbc02d; }
.btn-cancel { background: #455a64; color: #fff; }

#raise-panel {
  background: #1e232c;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: 100%;
  max-width: 420px;
}

.raise-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  color: var(--muted);
}
.raise-header strong { color: var(--gold); font-size: 1.1rem; }

.chip-row {
  display: grid;
  grid-template-columns: 70px 34px 34px 34px 1fr;
  align-items: center;
  gap: 0.4rem;
}

.chip-denom {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  font-size: 0.85rem;
}

.chip-vis {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px dashed rgba(255,255,255,0.6);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
  flex-shrink: 0;
}
.chip-10  { background: #1976d2; }
.chip-20  { background: #388e3c; }
.chip-50  { background: #7b1fa2; }
.chip-100 { background: #c62828; }
.chip-500 { background: #f57f17; }

.chip-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  background: #37474f;
  color: #fff;
  border: 1px solid #546e7a;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
}
.chip-btn:hover:not(:disabled) { background: #546e7a; }

.chip-count {
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}
.chip-subtotal {
  text-align: right;
  color: var(--gold);
  font-weight: 600;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.quick-buttons {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: center;
}
.quick-buttons button {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  background: #37474f;
  color: #fff;
}
.quick-buttons button:hover { background: #546e7a; }

.raise-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.3rem;
}
.raise-actions button { flex: 1; }

#log {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem;
  max-height: 180px;
  overflow-y: auto;
  font-size: 0.83rem;
  line-height: 1.5;
  scroll-behavior: smooth;
}

.log-entry { padding: 0.1rem 0; border-bottom: 1px solid #1a2028; }
.log-entry:last-child { border-bottom: none; }
.log-human  { color: #64b5f6; }
.log-bot    { color: #ce93d8; }
.log-system { color: var(--gold); font-weight: 600; }
.log-win    { color: #81c784; font-weight: 700; }
.log-loss   { color: #ef9a9a; font-weight: 600; }

@media (max-width: 768px) {
  main { padding: 0.5rem; gap: 0.6rem; }
  h1 { font-size: 1.05rem; }
  #reset-btn { padding: 0.45rem 0.8rem; font-size: 0.8rem; }
  #table { padding: 0.9rem 0.5rem; border-width: 4px; }
  #bots { grid-template-columns: repeat(2, 1fr); gap: 0.35rem; }
  .card-svg { width: 34px; height: 48px; }
  #human-seat .card-svg { width: 48px; height: 67px; }
  .seat-name { font-size: 0.68rem; }
  .seat-stack { font-size: 0.78rem; }
  #human-seat .seat { min-width: 160px; }
  .chip-row { grid-template-columns: 56px 30px 30px 30px 1fr; font-size: 0.82rem; }
  .chip-btn { width: 30px; height: 30px; font-size: 1rem; }
  #raise-panel { padding: 0.7rem; }
  button { padding: 0.6rem 1.1rem; font-size: 0.88rem; }
}

@media (max-width: 420px) {
  .card-svg { width: 28px; height: 40px; }
  #human-seat .card-svg { width: 42px; height: 58px; }
  .seat-name { font-size: 0.62rem; }
  .seat-stack { font-size: 0.72rem; }
  .seat-bet, .seat-action { font-size: 0.65rem; }
}