:root {
  --felt: #0b5c3a;
  --felt-dark: #08472d;
  --wood: #3d2817;
  --wood-light: #5c3d22;
  --gold: #d4a017;
  --gold-light: #f0c14b;
  --ink: #0a0f0d;
  --panel: #1a120c;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #050a08;
  color: #f5f7f6;
  font-family: "Inter", system-ui, sans-serif;
  overflow: hidden;
}

.play-app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 1100px;
  margin: 0 auto;
  background: #0a0a0a;
}

/* Top bar */
.play-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  background: linear-gradient(180deg, #2a1c10, #1a120c);
  border-bottom: 2px solid var(--gold);
  flex-shrink: 0;
  z-index: 5;
}

.play-back {
  color: var(--gold-light);
  font-size: 1.25rem;
  text-decoration: none;
  padding: 0.25rem 0.4rem;
}

.play-stats {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  min-width: 0;
}

.stat-pill {
  background: #2a2118;
  border: 1px solid rgba(212, 160, 23, 0.35);
  border-radius: 0.35rem;
  padding: 0.2rem 0.45rem;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.stat-pill.bal { color: var(--gold-light); }
.stat-pill.rc { color: #9fe0b8; }

.menu-btn {
  background: #3d2a18;
  border: 1px solid var(--gold);
  color: var(--gold-light);
  border-radius: 0.35rem;
  padding: 0.35rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.music-btn {
  min-width: 2.2rem;
  opacity: 1;
}

.music-btn.off {
  opacity: 1;
}

.music-btn.on {
  background: #c9a227;
  color: #1a1200;
  border-color: #ffe58a;
}

.music-panel {
  margin: 1rem 0 0.75rem;
  padding: 0.75rem;
  border: 1px solid rgba(212, 160, 23, 0.28);
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.25);
}

.music-panel h3 {
  margin: 0 0 0.35rem;
  color: var(--gold-light);
  font-size: 0.9rem;
}

.music-tracks {
  display: grid;
  gap: 0.35rem;
}

.music-track {
  width: 100%;
  text-align: left;
  background: #2a322c;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #dce6e0;
  border-radius: 0.35rem;
  padding: 0.5rem 0.65rem;
  font-weight: 700;
  cursor: pointer;
}

.music-track.on {
  background: #1c6b3a;
  border-color: var(--gold);
  color: #fff;
}

/* Body: table + odds */
.play-body {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

.table-wrap {
  flex: 1;
  min-width: 0;
  overflow: auto;
  padding: 0.5rem;
}

.felt {
  position: relative;
  min-height: 100%;
  background:
    radial-gradient(ellipse at 50% 40%, #0e6b44 0%, var(--felt) 45%, var(--felt-dark) 100%);
  border: 10px solid var(--wood);
  border-radius: 1rem;
  box-shadow: inset 0 0 0 3px #c9a227, 0 8px 24px rgba(0,0,0,0.5);
  padding: 0.75rem 0.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.hand-label {
  text-align: center;
  color: var(--gold-light);
  font-weight: 700;
  letter-spacing: 0.12em;
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}

.hand-val {
  color: #fff;
  font-weight: 600;
  letter-spacing: 0;
  margin-left: 0.35rem;
}

.cards-row, .player-hand-cards {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.25rem;
  min-height: 5.5rem;
}

.card-img {
  width: 4.4rem;
  height: auto;
  border-radius: 0.3rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.45);
  background: #fff;
}

.card-img.back {
  background: #1a3a2a;
}

.table-logo {
  text-align: center;
  font-family: "Playfair Display", Georgia, serif;
  color: rgba(212, 175, 55, 0.55);
  font-weight: 700;
  font-size: clamp(1.1rem, 4vw, 1.75rem);
  line-height: 1.15;
  letter-spacing: 0.04em;
  padding: 0.5rem 0;
  user-select: none;
  text-shadow: 0 2px 8px rgba(0,0,0,0.35);
}

.player-hand {
  margin-bottom: 0.35rem;
}

.player-hand.active .player-hand-cards {
  outline: 2px solid var(--gold-light);
  outline-offset: 4px;
  border-radius: 0.5rem;
}

.hand-meta {
  text-align: center;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.75);
  margin-top: 0.2rem;
}

.result-banner {
  text-align: center;
  font-weight: 800;
  font-size: 1.35rem;
  color: #5dcea0;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
  margin: 0.35rem 0;
}

.result-banner.lose { color: #e87a7a; }
.result-banner.push { color: var(--gold-light); }

.bet-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 0.5rem;
}

.your-bet {
  font-size: 0.7rem;
  color: var(--gold-light);
  text-align: center;
  line-height: 1.3;
}

.your-bet strong {
  font-size: 1.1rem;
  color: #fff;
}

.chips {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: center;
}

.chip {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  border: 3px dashed rgba(255,255,255,0.45);
  font-weight: 800;
  font-size: 0.75rem;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(0,0,0,0.35);
}

.chip:active { transform: translateY(2px); box-shadow: none; }
.chip:disabled { opacity: 0.35; cursor: not-allowed; }

.c5 { background: radial-gradient(circle at 30% 30%, #f55, #b00); }
.c10 { background: radial-gradient(circle at 30% 30%, #5af, #06c); }
.c25 { background: radial-gradient(circle at 30% 30%, #5d5, #080); }
.c50 { background: radial-gradient(circle at 30% 30%, #fc5, #a70); color: #222; }
.chip-clear {
  border-radius: 0.4rem;
  width: auto;
  padding: 0 0.5rem;
  height: 2.4rem;
  background: #4a3020;
  border: 1px solid var(--gold);
  color: var(--gold-light);
  font-size: 0.65rem;
}

/* Odds panel */
.odds-panel {
  width: 9.5rem;
  flex-shrink: 0;
  background: #0e2a1c;
  border-left: 2px solid rgba(212, 160, 23, 0.35);
  padding: 0.55rem 0.45rem;
  overflow-y: auto;
  font-size: 0.72rem;
}

.odds-panel h2 {
  margin: 0 0 0.4rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--gold-light);
}

.odds-msg { margin: 0 0 0.25rem; color: #9fe0b8; line-height: 1.3; }
.odds-meta { margin: 0 0 0.2rem; color: rgba(255,255,255,0.65); }

.odds-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.5rem;
}

.odds-tile {
  background: #f4f0e6;
  color: #111;
  border-radius: 0.3rem;
  padding: 0.3rem 0.35rem;
  text-align: center;
  font-weight: 700;
  line-height: 1.2;
}

.odds-tile .rank { font-size: 0.95rem; }
.odds-tile .rank.red { color: #c0392b; }
.odds-tile .pct { font-size: 0.7rem; color: #444; font-weight: 600; }

.status-line {
  margin: 0;
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
  text-align: center;
  background: #12100c;
  color: rgba(255,255,255,0.8);
  border-top: 1px solid rgba(212,160,23,0.2);
  flex-shrink: 0;
}

.music-unlock {
  display: block;
  width: 100%;
  border: none;
  background: linear-gradient(180deg, #ffe58a, #d4a017);
  color: #1a1200;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.55rem 0.75rem;
  cursor: pointer;
  flex-shrink: 0;
}

.music-unlock[hidden] { display: none !important; }

/* Actions */
.play-actions {
  background: #100e0c;
  border-top: 2px solid var(--wood-light);
  padding: 0.45rem 0.5rem 0.65rem;
  flex-shrink: 0;
}

.action-row {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}

.action-row:last-child { margin-bottom: 0; }

.act {
  flex: 1;
  border: none;
  border-radius: 0.4rem;
  padding: 0.65rem 0.35rem;
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  color: #fff;
}

.act:disabled { opacity: 0.35; cursor: not-allowed; }
.act.hit { background: #6b1c1c; }
.act.stand { background: #1c4a2a; }
.act.double { background: #1c3a4a; }
.act.split { background: #2a1c4a; }
.act.deal { background: #1565c0; flex: 2; }
.act.secondary { background: #333; font-size: 0.68rem; flex: 1; }
.act.full { width: 100%; margin-top: 0.75rem; }

.bet-stepper {
  display: flex;
  align-items: center;
  background: #222;
  border-radius: 0.4rem;
  overflow: hidden;
  min-width: 5.5rem;
}

.bet-stepper button {
  background: #3a3a3a;
  border: none;
  color: #fff;
  width: 1.75rem;
  height: 100%;
  min-height: 2.4rem;
  font-size: 1.1rem;
  cursor: pointer;
}

.bet-stepper span {
  flex: 1;
  text-align: center;
  font-weight: 700;
  font-size: 0.85rem;
}

/* Drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 40;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(20rem, 92vw);
  height: 100%;
  background: #0f1a16;
  z-index: 50;
  padding: 1rem;
  overflow-y: auto;
  border-left: 1px solid rgba(212,160,23,0.3);
  box-shadow: -8px 0 32px rgba(0,0,0,0.5);
}

.drawer-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.drawer-head .rounded { border-radius: 0.5rem; }
.drawer-close {
  margin-left: auto;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
}

.drawer-nav a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #e8ecea;
  text-decoration: none;
  padding: 0.65rem 0.4rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-weight: 500;
}

.drawer-nav a:hover { color: var(--gold-light); }

.drawer-help {
  margin-top: 1rem;
  padding: 0.85rem;
  background: rgba(212,160,23,0.08);
  border-radius: 0.65rem;
  border: 1px solid rgba(212,160,23,0.2);
}

.drawer-help h3 {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: var(--gold-light);
}

.drawer-help p { margin: 0 0 0.5rem; font-size: 0.85rem; line-height: 1.45; }
.muted { color: #8fa89c; }
.small { font-size: 0.8rem; }

[hidden] { display: none !important; }

@media (max-width: 640px) {
  .hide-xs { display: none !important; }
  .odds-panel { width: 7.2rem; padding: 0.4rem 0.3rem; }
  .card-img { width: 3.5rem; }
  .felt { border-width: 7px; }
  .act { padding: 0.55rem 0.2rem; font-size: 0.7rem; }
}

@media (min-width: 900px) {
  .card-img { width: 5.2rem; }
  .odds-panel { width: 11rem; }
}
