:root {
  --felt: #0f6b42;
  --felt-light: #148753;
  --felt-dark: #063d26;
  --rail: #5a3a22;
  --rail-light: #7a5233;
  --card-bg: #fdfdfb;
  --card-red: #c0392b;
  --card-black: #1a1a1a;
  --gold: #e8c05a;
  --gold-dark: #b6892f;
  --text: #f2ede3;
  --panel: rgba(10, 20, 15, 0.55);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(ellipse at center, #1a1410 0%, #0a0806 70%, #050403 100%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 12px 20px;
  position: relative;
  overflow-x: hidden;
}

#bg-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.55) 100%);
  z-index: 0;
}

h1 {
  font-family: "Cinzel", serif;
  font-size: 1.3rem;
  margin: 2px 0 8px;
  color: var(--gold);
  text-shadow: 0 2px 6px rgba(0,0,0,0.6);
  letter-spacing: 1px;
  z-index: 1;
}

#lobby {
  background: var(--panel);
  backdrop-filter: blur(4px);
  padding: 28px;
  border-radius: 16px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  border: 1px solid rgba(232, 192, 90, 0.25);
  z-index: 1;
}

#lobby input {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.15);
  margin: 8px 0;
  font-size: 1rem;
  font-family: inherit;
}

button {
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-dark) 100%);
  color: #2a1e08;
  border: 1px solid rgba(0,0,0,0.25);
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  margin: 4px;
  box-shadow: 0 3px 0 var(--gold-dark), 0 4px 8px rgba(0,0,0,0.4);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
button:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--gold-dark), 0 2px 4px rgba(0,0,0,0.4); }
button:disabled { opacity: 0.4; cursor: default; }
button:hover:not(:disabled) { filter: brightness(1.08); }

#actions button:nth-child(1) {
  background: linear-gradient(180deg, #d15a4a 0%, #a53a2c 100%);
  color: #fff;
  box-shadow: 0 3px 0 #7a281d, 0 4px 8px rgba(0,0,0,0.4);
}
#actions button:nth-child(2) {
  background: linear-gradient(180deg, #4fae6e 0%, #2f8049 100%);
  color: #fff;
  box-shadow: 0 3px 0 #1f5c34, 0 4px 8px rgba(0,0,0,0.4);
}

#share-link {
  font-size: 0.78rem;
  word-break: break-all;
  background: rgba(0,0,0,0.35);
  padding: 10px;
  border-radius: 8px;
  margin-top: 10px;
}

#table-wrap {
  display: none;
  width: 100%;
  max-width: 560px;
  z-index: 1;
}

#status-line {
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.85;
  margin-bottom: 4px;
  font-weight: 600;
}

#table {
  position: relative;
  background:
    radial-gradient(ellipse at 50% 35%, var(--felt-light) 0%, var(--felt) 55%, var(--felt-dark) 100%);
  border-radius: 50% / 22%;
  border: 10px solid var(--rail);
  box-shadow:
    inset 0 0 40px rgba(0,0,0,0.55),
    0 0 0 3px var(--rail-light) inset,
    0 12px 30px rgba(0,0,0,0.6);
  padding: 10px 20px;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2px;
}

.seat {
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 2;
}
.seat.you { flex-direction: column; }
.seat.opponent { flex-direction: column; }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #3a3a3a, #161616);
  border: 2px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

.seat-info { text-align: center; }

.player-name {
  font-weight: 800;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.dealer-chip {
  display: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, var(--gold) 70%);
  color: #5a3a00;
  font-size: 0.65rem;
  font-weight: 900;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gold-dark);
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.dealer .dealer-chip { display: inline-flex; }

.player-stack {
  font-size: 0.85rem;
  opacity: 0.9;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 2px;
}

.chip-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: repeating-conic-gradient(var(--gold) 0deg 45deg, #b33 45deg 90deg);
  border: 1px solid rgba(0,0,0,0.4);
  display: inline-block;
}

.seat.folded { opacity: 0.35; filter: grayscale(0.6); }
.seat.active .avatar { border-color: #ff6b6b; box-shadow: 0 0 12px 2px rgba(255,107,107,0.7); }
.seat.active .player-name { color: #ffd580; }

.cards { display: flex; gap: 6px; min-height: 38px; align-items: center; justify-content: center; }

.card {
  background: var(--card-bg);
  color: var(--card-black);
  border-radius: 6px;
  width: 28px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  box-shadow: 0 3px 6px rgba(0,0,0,0.45), inset 0 0 0 1px rgba(0,0,0,0.06);
  border: 1px solid rgba(0,0,0,0.08);
}
.card.red { color: var(--card-red); }
.card.back {
  background:
    repeating-linear-gradient(45deg, #1d4f9e, #1d4f9e 5px, #16407f 5px, #16407f 10px);
  border: 2px solid #0d2c5c;
}

.player-bet-row {
  min-height: 16px;
  display: flex;
  justify-content: center;
}
.bet-chip {
  background: linear-gradient(180deg, #f4d67e, var(--gold-dark));
  color: #3a2a00;
  font-weight: 800;
  font-size: 0.78rem;
  padding: 3px 12px;
  border-radius: 999px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}
.bet-chip:empty { display: none; }

.felt-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  z-index: 2;
}

#community {
  display: flex;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
}

#pot {
  text-align: center;
  font-size: 1rem;
  color: var(--gold);
  font-weight: 800;
  background: rgba(0,0,0,0.3);
  padding: 4px 16px;
  border-radius: 999px;
  min-height: 1.2em;
}
#pot:empty { padding: 0; background: none; }

#showdown-banner {
  text-align: center;
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffe8a3;
  text-shadow: 0 2px 4px rgba(0,0,0,0.6);
  min-height: 1.4em;
}

#raise-controls {
  display: none;
  align-items: center;
  gap: 8px;
  justify-content: center;
  margin: 8px 0 4px;
}
#raise-controls input {
  width: 110px;
  padding: 10px;
  border-radius: 8px;
  border: none;
  text-align: center;
  font-weight: 700;
}

#actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 8px 0;
}

#log {
  background: var(--panel);
  border: 1px solid rgba(232, 192, 90, 0.15);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.72rem;
  max-height: 70px;
  overflow-y: auto;
  white-space: pre-line;
  line-height: 1.4;
}

@media (max-width: 480px) {
  #table { padding: 28px 14px; min-height: 380px; border-radius: 40px; border-width: 10px; }
  .card { width: 36px; height: 52px; font-size: 0.9rem; }
}
