:root {
  --felt: #0d5c2e;
  --felt-dark: #084422;
  --gold: #d4af37;
  --gold-light: #f0d878;
  --chip: #e8e8e8;
  --text: #f5f5f5;
  --danger: #c0392b;
  --success: #27ae60;
  --panel: rgba(0, 0, 0, 0.75);
}

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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #1a1a1a;
  color: var(--text);
}

#app {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ===== START SCREEN ===== */
#start-screen {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #0a2f1a 0%, #1a1a1a 50%, #2c1810 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  gap: 1.5rem;
  padding: 2rem;
}

#start-screen h1 {
  font-size: 2.4rem;
  color: var(--gold-light);
  text-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
  letter-spacing: 2px;
}

#start-screen .subtitle {
  color: #aaa;
  margin-bottom: 1rem;
}

.start-form {
  background: var(--panel);
  padding: 2rem;
  border-radius: 16px;
  border: 1px solid var(--gold);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 320px;
  max-width: 400px;
}

.start-form label {
  font-size: 0.9rem;
  color: #ccc;
}

.start-form input[type="text"] {
  padding: 0.7rem 1rem;
  border-radius: 8px;
  border: 1px solid #555;
  background: #222;
  color: white;
  font-size: 1rem;
}

.start-form input[type="file"] {
  color: #ccc;
  font-size: 0.85rem;
}

.opp-picker {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 10px;
  width: 100%;
}

.opp-btn {
  flex: 1 1 0;
  min-width: 0;
  height: 48px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid #555;
  background: #222;
  color: #ddd;
  font-weight: 700;
  font-size: 1.15rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.opp-btn:hover {
  border-color: var(--gold);
  color: #fff;
}

.opp-btn.selected {
  background: var(--gold);
  border-color: var(--gold-light);
  color: #111;
}

.opp-hint {
  font-size: 0.78rem;
  color: #888;
  margin-top: -0.35rem;
}

.avatar-preview {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid var(--gold);
  object-fit: cover;
  background: #333;
  align-self: center;
}

.btn {
  padding: 0.85rem 1.5rem;
  border: none;
  border-radius: 10px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
  color: #1a1a1a;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.6);
}

.btn-secondary {
  background: #333;
  color: white;
  border: 1px solid #555;
}


/* ===== TOP BAR ===== */
#top-bar {
  height: 42px;
  background: rgba(0,0,0,0.9);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  font-size: 0.85rem;
  border-bottom: 1px solid #333;
  flex-shrink: 0;
  z-index: 20;
}

#top-bar .blinds { color: var(--gold); }
#top-bar .hand-num { color: #aaa; }

.btn-fs {
  background: transparent;
  border: 1px solid #555;
  color: #ccc;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
}
.btn-fs:hover { border-color: var(--gold); color: var(--gold); }

/* ===== TABLE ===== */
#table-area {
  flex: 1;
  position: relative;
  background: radial-gradient(ellipse at center, #0f6b36 0%, #084422 70%);
  overflow: hidden;
  min-height: 0;
}

.table-felt {
  position: absolute;
  top: 48%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(90vw, 980px);
  height: min(68vh, 520px);
  background: radial-gradient(ellipse at center, #0e6b35 0%, #063d1f 70%, #042816 100%);
  border: 14px solid #6b4423;
  border-radius: 50% / 42%;
  box-shadow:
    inset 0 0 50px rgba(0,0,0,0.45),
    0 0 0 8px #2a1a0c,
    0 0 0 10px #8b6914,
    0 12px 40px rgba(0,0,0,0.6);
}

/* Dealer with ring – upper left of center */
.dealer {
  position: absolute;
  top: 2%;
  left: 38%;
  transform: none;
  text-align: center;
  z-index: 5;
}
.dealer .avatar-ring {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 3px solid var(--gold);
  margin: 0 auto 2px;
  overflow: hidden;
  background: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dealer .avatar-ring img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.dealer .label {
  font-size: 0.7rem;
  color: var(--gold);
  font-weight: 600;
}

/* Community cards – slightly smaller to clear top player names */
.community {
  position: absolute;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  gap: 7px;
  z-index: 4;
}
.community .card {
  width: 82px;
  height: 115px;
  border-radius: 6px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.55);
}

/* Pot – to the right of the dealer */
.pot-display {
  position: absolute;
  top: 4%;
  left: 48%;
  transform: none;
  background: rgba(0,0,0,0.8);
  padding: 6px 16px;
  border-radius: 18px;
  border: 1px solid var(--gold);
  font-size: 1rem;
  font-weight: 700;
  color: var(--gold-light);
  z-index: 5;
  white-space: nowrap;
}

/* ===== SEATS - better distribution, cards to the RIGHT ===== */
.seat {
  position: absolute;
  width: 175px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.seat .seat-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

.seat .avatar-ring {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: 3px solid var(--gold);
  overflow: hidden;
  background: #222;
  flex-shrink: 0;
}
.seat .avatar-ring img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.seat.active .avatar-ring {
  box-shadow: 0 0 0 3px #fff, 0 0 18px rgba(255,255,255,0.55);
  border-color: #fff;
}
.seat.folded { opacity: 0.4; }
.seat.folded .avatar-ring { filter: grayscale(0.85); }

.seat .cards {
  display: flex;
  gap: 3px;
  min-width: 70px;
}
.seat .cards .card {
  width: 62px;
  height: 87px;
  border-radius: 5px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
.seat.human .cards .card {
  width: 80px;
  height: 112px;
}

.seat .name {
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
  max-width: 165px;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 3px;
}
.seat .stack {
  font-size: 1.05rem;
  color: var(--gold-light);
  font-weight: 700;
}

.seat .bet-amount {
  display: inline-block;
  background: rgba(0,0,0,0.85);
  color: #f0d878;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  white-space: nowrap;
  margin-top: 4px;
  border: 1px solid rgba(240,216,120,0.4);
  z-index: 7;
}

/* 7-seat positions – bottom seats under top seats, no overlaps */
.seat[data-seat="0"] { /* Human - bottom center */
  bottom: 1%;
  left: 50%;
  transform: translateX(-50%);
}
.seat[data-seat="1"] { /* bottom-left – under top-left (PuppetKing) */
  bottom: 4%;
  left: 18%;
}
.seat[data-seat="2"] { /* mid-left */
  top: 36%;
  left: 4%;
}
.seat[data-seat="3"] { /* top-left – near dealer */
  top: 5%;
  left: 18%;
}
.seat[data-seat="4"] { /* top-right – near dealer */
  top: 5%;
  right: 18%;
}
.seat[data-seat="5"] { /* mid-right */
  top: 36%;
  right: 4%;
}
.seat[data-seat="6"] { /* bottom-right – under top-right (Mempool) */
  bottom: 4%;
  right: 18%;
}

/* ===== PERMANENT FOOTER ===== */
#footer {
  height: 130px;
  background: rgba(0, 0, 0, 0.92);
  border-top: 2px solid var(--gold);
  display: flex;
  flex-direction: row;
  align-items: stretch;
  flex-shrink: 0;
  z-index: 30;
}

#log {
  width: 280px;
  max-width: 32%;
  overflow-y: auto;
  padding: 8px 12px;
  font-size: 0.72rem;
  line-height: 1.4;
  color: #bbb;
  border-right: 1px solid #333;
  flex-shrink: 0;
}
#log div { margin-bottom: 2px; }

#action-bar {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 1.5rem;
  position: relative;
}

#action-bar .action-info {
  position: absolute;
  left: 1.2rem;
  font-size: 0.9rem;
  color: #bbb;
}

.btn-action {
  min-width: 90px;
  padding: 0.7rem 1.1rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  opacity: 0.35;
  pointer-events: none;
}
.btn-action.enabled {
  opacity: 1;
  pointer-events: auto;
}

.btn-fold { background: #5c1a1a; color: #ffcccc; }
.btn-fold.enabled:hover { background: var(--danger); color: white; }

.btn-check, .btn-call { background: #1a4a6e; color: #cce6ff; }
.btn-check.enabled:hover, .btn-call.enabled:hover { background: #2980b9; color: white; }

.btn-bet, .btn-raise { background: #1a5c2e; color: #ccffdd; }
.btn-bet.enabled:hover, .btn-raise.enabled:hover { background: var(--success); color: white; }

.btn-allin { background: #6b3a00; color: #ffe0b3; }
.btn-allin.enabled:hover { background: #e67e22; color: white; }

.bet-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.bet-controls input[type="range"] {
  width: 140px;
  accent-color: var(--gold);
}
.bet-controls .bet-value {
  min-width: 70px;
  text-align: center;
  font-weight: 700;
  color: var(--gold-light);
}

/* Card base */
.card {
  border-radius: 5px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.45);
  background: #fff;
  object-fit: cover;
}
.card.back { background: #f7f8fa; }

/* Modal */
.modal {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.modal.hidden { display: none; }
.modal-content {
  background: #1e1e1e;
  border: 2px solid var(--gold);
  border-radius: 16px;
  padding: 2.2rem 2.5rem;
  text-align: center;
  max-width: 480px;
  width: 92%;
}
.modal-content h2 {
  color: var(--gold-light);
  margin-bottom: 1.1rem;
  font-size: 1.75rem;
}
.modal-content p {
  margin-bottom: 1.3rem;
  color: #ddd;
  font-size: 1.2rem;
  line-height: 1.55;
}
.modal-content p strong {
  font-size: 1.3rem;
  color: #fff;
}
.modal-content p small {
  font-size: 1.05rem;
  color: #bbb;
}
.modal-content .btn-primary {
  font-size: 1.1rem;
  padding: 0.75rem 1.8rem;
}

@media (max-width: 900px) {
  .seat { width: 120px; }
  .seat .avatar-ring { width: 52px; height: 52px; }
  .seat .cards .card { width: 46px; height: 64px; }
  .seat.human .cards .card { width: 60px; height: 84px; }
  .community .card { width: 60px; height: 84px; }
  .dealer .avatar-ring { width: 56px; height: 56px; }
  #log { width: 200px; font-size: 0.65rem; }
}
