:root {
  --felt-1: #0b4d3a;
  --felt-2: #073826;
  --gold: #d4af37;
  --cream: #f4ead0;
  --red: #c0392b;
  --black: #1a1a1a;
  --panel-bg: rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: radial-gradient(circle at top, var(--felt-1), var(--felt-2) 75%);
  color: var(--cream);
  display: flex;
  justify-content: center;
  padding: 16px;
}

.table {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: var(--panel-bg);
  border-radius: 12px;
  border: 1px solid rgba(212, 175, 55, 0.4);
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--gold);
}
.logo span {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--cream);
  margin: 0 4px;
  opacity: 0.8;
}

.bankroll { display: flex; align-items: center; gap: 8px; }
.bankroll .label { font-size: 0.75rem; opacity: 0.7; text-transform: uppercase; letter-spacing: 1px; }
.bankroll .value { font-size: 1.3rem; font-weight: 700; color: var(--gold); }

.link-btn {
  background: none;
  border: none;
  color: var(--cream);
  opacity: 0.6;
  font-size: 0.75rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}
.link-btn:hover { opacity: 1; }

.dealer-area {
  display: flex;
  gap: 12px;
}

.hand-block {
  flex: 1;
  background: var(--panel-bg);
  border-radius: 12px;
  padding: 12px;
  min-height: 130px;
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 1px solid rgba(255,255,255,0.08);
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.hand-block.active-side {
  border-color: var(--gold);
  box-shadow: 0 0 14px rgba(212, 175, 55, 0.35);
}

.hand-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.75;
  margin-bottom: 8px;
}

.cards {
  display: flex;
  gap: 6px;
  min-height: 84px;
  flex-wrap: wrap;
  justify-content: center;
}

.card {
  width: 56px;
  height: 80px;
  border-radius: 6px;
  background: var(--cream);
  color: var(--black);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 4px 5px;
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 0 2px 5px rgba(0,0,0,0.4);
  position: relative;
  animation: deal-in 0.25s ease-out;
  flex-shrink: 0;
}

.card.red { color: var(--red); }
.card.black { color: var(--black); }

.card .suit-center {
  font-size: 1.6rem;
  text-align: center;
}

.card.back {
  background: repeating-linear-gradient(
    45deg,
    #1c5f45,
    #1c5f45 6px,
    #16513a 6px,
    #16513a 12px
  );
  border: 2px solid var(--gold);
}

@keyframes deal-in {
  from { transform: translateY(-14px) scale(0.9); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.hand-total {
  margin-top: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  min-height: 1.1em;
  color: var(--gold);
}

.message-bar {
  text-align: center;
  padding: 10px;
  font-size: 1rem;
  font-weight: 600;
  min-height: 1.2em;
}

.player-area {
  display: flex;
  justify-content: center;
}

.player-block {
  width: 100%;
  max-width: 340px;
}

.controls {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.panel {
  width: 100%;
  background: var(--panel-bg);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255,255,255,0.08);
}

.panel.hidden { display: none; }

.bet-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.bet-row .label { font-size: 0.8rem; opacity: 0.7; text-transform: uppercase; }
.bet-amount { font-size: 1.4rem; font-weight: 700; color: var(--gold); }

.chip-row { display: flex; gap: 10px; }

.chip {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 3px dashed rgba(255,255,255,0.6);
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  color: white;
  box-shadow: 0 3px 6px rgba(0,0,0,0.4);
  transition: transform 0.1s ease;
}
.chip:hover { transform: translateY(-2px); }
.chip:active { transform: translateY(0); }
.chip-5 { background: #4a7fb5; }
.chip-25 { background: #3d8f5c; }
.chip-100 { background: #b5433d; }
.chip-500 { background: #2b2b2b; }

.primary-btn, .secondary-btn, .choice-btn {
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
}
.primary-btn:active, .secondary-btn:active, .choice-btn:active { transform: scale(0.97); }

.primary-btn {
  background: var(--gold);
  color: #2b2200;
  width: 100%;
}
.primary-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.secondary-btn {
  background: transparent;
  color: var(--cream);
  border: 2px solid var(--cream);
  width: 100%;
}

.choice-row {
  display: flex;
  gap: 12px;
  width: 100%;
}
.choice-btn { flex: 1; color: white; }
.choice-4 { background: #4a7fb5; }
.choice-20 { background: #b5433d; }

.prompt { margin: 0; font-weight: 600; }

#playPanel20 {
  flex-direction: row;
  justify-content: center;
}
#playPanel20 button { width: auto; flex: 1; }

@media (max-width: 480px) {
  .dealer-area { flex-direction: column; }
  .card { width: 48px; height: 68px; font-size: 0.8rem; }
  .card .suit-center { font-size: 1.3rem; }
}
