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

:root {
  --felt: #2d6a4f;
  --felt-dark: #1b4332;
  --felt-border: #081c15;
  --card-red: #c0392b;
  --card-dark: #1a1a2e;
  --gold: #f9c74f;
  --chip-text: #fff;
  --panel-bg: #0d1b2a;
  --btn-bg: #1b3a4b;
  --btn-hover: #2c5f7a;
  --btn-danger: #7b2d00;
  --btn-danger-hover: #a33c00;
}

body {
  background: #0a0a1a;
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: #e0e0e0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
}

#game-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 20px;
  background: #050510;
  font-size: 13px;
  color: #aaa;
  flex-shrink: 0;
}

#game-info span {
  margin: 0 8px;
}

#table-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 0;
}

#table {
  position: relative;
  width: min(780px, 92vw);
  height: min(420px, 52vw);
  background: radial-gradient(ellipse at center, #3a7a5a 0%, var(--felt) 60%, var(--felt-dark) 100%);
  border-radius: 50%;
  border: 12px solid var(--felt-border);
  box-shadow: 0 0 0 4px #2a5240, 0 8px 40px rgba(0, 0, 0, 0.8), inset 0 0 60px rgba(0, 0, 0, 0.3);
}

/* Community area */
#community-area {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

#board {
  display: flex;
  gap: 6px;
}

#pot-display {
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
  text-shadow: 0 0 8px rgba(249, 199, 79, 0.5);
  background: rgba(0, 0, 0, 0.4);
  padding: 3px 12px;
  border-radius: 12px;
}

#side-pots {
  font-size: 11px;
  color: #aad;
  text-align: center;
}

/* Player seats */
.seat {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transform: translate(-50%, -50%);
}

.seat-cards {
  display: flex;
  gap: 4px;
}

.seat-info {
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 4px 10px;
  text-align: center;
  min-width: 90px;
  font-size: 12px;
}

.seat-info .seat-name {
  font-weight: 700;
  font-size: 13px;
  color: #eee;
}

.seat-info .seat-chips {
  color: var(--gold);
  font-weight: 600;
}

.seat-info .seat-bet {
  color: #7ec8e3;
  font-size: 11px;
}

.seat.active .seat-info {
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(249, 199, 79, 0.6);
}

.seat.folded .seat-info {
  opacity: 0.4;
}

.seat.eliminated .seat-info {
  opacity: 0.2;
}

/* Badges */
.badges {
  display: flex;
  gap: 3px;
  justify-content: center;
  flex-wrap: wrap;
}

.badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  text-transform: uppercase;
}

.badge-dealer {
  background: #f9c74f;
  color: #000;
}

.badge-sb {
  background: #4cc9f0;
  color: #000;
}

.badge-bb {
  background: #7209b7;
  color: #fff;
}

.badge-fold {
  background: #444;
  color: #aaa;
}

.badge-allin {
  background: #c0392b;
  color: #fff;
}

.badge-winner {
  background: #27ae60;
  color: #fff;
}

/* Cards */
.card {
  width: 38px;
  height: 54px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  background: white;
  color: var(--card-dark);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  position: relative;
  perspective: 200px;
}

.card.suit-h,
.card.suit-d {
  color: var(--card-red);
}

.card .card-rank-top {
  font-size: 13px;
}

.card .card-suit-top {
  font-size: 11px;
}

.card .card-rank-bot {
  font-size: 13px;
  transform: rotate(180deg);
  align-self: flex-end;
}

.card .card-suit-center {
  font-size: 20px;
  text-align: center;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.card.face-down {
  background: repeating-linear-gradient(45deg,
      #1a237e,
      #1a237e 4px,
      #283593 4px,
      #283593 8px);
  color: transparent;
}

.card.face-down .card-rank-top,
.card.face-down .card-suit-top,
.card.face-down .card-rank-bot,
.card.face-down .card-suit-center {
  visibility: hidden;
}

.card.community {
  width: 44px;
  height: 62px;
  font-size: 16px;
}

.card.community .card-suit-center {
  font-size: 24px;
}

.card.community .card-rank-top {
  font-size: 15px;
}

/* Hole card highlight for human */
.seat[data-id="0"] .card:not(.face-down) {
  box-shadow: 0 0 8px rgba(249, 199, 79, 0.5), 0 2px 6px rgba(0, 0, 0, 0.5);
}

/* Action panel */
#action-panel {
  background: var(--panel-bg);
  border-top: 1px solid #1a3a4b;
  padding: 10px 20px;
  flex-shrink: 0;
}

#hand-label {
  text-align: center;
  font-size: 13px;
  color: var(--gold);
  font-weight: 600;
  min-height: 18px;
  margin-bottom: 6px;
}

#action-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.action-btn {
  padding: 8px 18px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  min-width: 80px;
  background: var(--btn-bg);
  color: #eee;
}

.action-btn:hover:not(:disabled) {
  background: var(--btn-hover);
  transform: translateY(-1px);
}

.action-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

#btn-fold {
  background: var(--btn-danger);
}

#btn-fold:hover:not(:disabled) {
  background: var(--btn-danger-hover);
}

#btn-allin {
  background: #6a0572;
}

#btn-allin:hover:not(:disabled) {
  background: #8b007a;
}

#raise-control {
  display: flex;
  align-items: center;
  gap: 6px;
}

#raise-slider {
  width: 100px;
  accent-color: var(--gold);
}

#raise-display {
  font-size: 13px;
  color: var(--gold);
  font-weight: 700;
  min-width: 50px;
}

/* Message overlay */
#message-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 60px;
  z-index: 100;
}

#message-overlay.hidden {
  display: none;
}

#message-box {
  background: #0d1b2a;
  border: 2px solid #2c5f7a;
  border-radius: 12px;
  padding: 24px 36px;
  text-align: center;
  max-width: 420px;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
}

#message-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--gold);
  margin-bottom: 12px;
}

#message-body {
  font-size: 14px;
  color: #ccc;
  line-height: 1.6;
  margin-bottom: 16px;
}

#btn-continue {
  padding: 10px 32px;
  background: #27ae60;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

#btn-continue:hover {
  background: #2ecc71;
}

/* Action log */
#action-log {
  position: fixed;
  bottom: 80px;
  right: 10px;
  width: 200px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 8px;
  padding: 8px;
  font-size: 11px;
  color: #aaa;
  max-height: 140px;
  overflow-y: auto;
  pointer-events: none;
}

.log-entry {
  margin-bottom: 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 2px;
}

.log-entry.log-win {
  color: #f9c74f;
}

.log-entry.log-fold {
  color: #888;
}

.log-entry.log-raise {
  color: #7ec8e3;
}