:root {
  --bg:#0b1620; 
  --bg2:#071018;
  --felt:#0f4c2b; 
  --felt2:#0b3b21;
  --gold:#f6c85f; 
  --ink:#eaeaea; 
  --muted:#9ab;
  --glow: 0 0 18px rgba(246,200,95,.7), 0 0 3px rgba(246,200,95,.9);
}

* { box-sizing:border-box }
html, body { height:100% }
body {
  margin:0; 
  background: radial-gradient(1200px 600px at 50% -10%, var(--bg), var(--bg2));
  color:var(--ink); 
  font-family:system-ui,Segoe UI,Roboto,Arial,sans-serif;
}

/* tiny debug bar */
#debug {
  position:fixed; 
  top:10px; 
  left:10px;
  background:#04121c; 
  color:#a6e3ff;
  padding:6px 10px; 
  border-radius:8px; 
  font:12px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  opacity:.85; 
  z-index:20;
}

/* helpers */
.hidden { display:none !important; }

/* Table wrapper */
.table { 
  position:relative; 
  max-width:1100px; 
  margin:70px auto 40px; 
  padding:0 24px 80px; 
}

.felt {
  position:absolute; 
  inset:0 20px 140px;
  background: radial-gradient(800px 420px at 50% 20%, var(--felt), var(--felt2));
  border-radius:42px/28px;
  border:1px solid #173b2a;
  box-shadow: 
    inset 0 40px 120px rgba(0,0,0,.35), 
    inset 0 -40px 120px rgba(0,0,0,.45);
}

/* SIT-only first screen */
body.pre-seat .bottom-bar,
body.pre-seat .player-info,
body.pre-seat .bet-spot,
body.pre-seat .dealer-row,
body.pre-seat #dealerHand,
body.pre-seat .hand-cards {
  display: none !important;
}
/* keep SIT buttons visible in pre-seat */
body.pre-seat .sit-btn { display: inline-block !important; }
/* gentle glow */
body.pre-seat .sit-btn {
  animation: preSeatGlow 1.7s ease-in-out infinite;
}
@keyframes preSeatGlow {
  0% { box-shadow: 0 0 6px rgba(246,200,95,.6); }
  50%{ box-shadow: 0 0 22px rgba(246,200,95,.9); }
  100%{ box-shadow: 0 0 6px rgba(246,200,95,.6); }
}

/* Seats row */
.seats {
  position:relative; 
  display:flex; 
  justify-content:space-between; 
  gap:40px;
  padding:180px 40px 0;
}
.seat {
  position:relative; 
  width:30%; 
  min-width:260px; 
  height:250px;
  display:flex; 
  align-items:flex-start; 
  justify-content:center;
}

/* SIT button */
.sit-btn {
  position:absolute; 
  bottom:12px; 
  left:50%; 
  transform:translateX(-50%);
  width:90px; 
  height:60px; 
  border-radius:14px;
  background:#111; 
  color:var(--gold); 
  font-weight:700; 
  letter-spacing:.5px;
  border:2px solid var(--gold); 
  box-shadow:var(--glow); 
  cursor:pointer;
}
.sit-btn:hover { filter:brightness(1.15); }

/* Seat HUD (below bet circle) */
.player-info{
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background: rgba(0,0,0,.45);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  box-shadow: 0 6px 14px rgba(0,0,0,.35);
  z-index: 2;
}
.player-info .avatar { width:34px; height:34px; border-radius:8px; background:linear-gradient(180deg,#2b2b2b,#141414); outline:2px solid #ffd95e; }
.player-info .avatar.you { outline-color:#9bf5ff; }
.player-info .name { font-weight:700; color:#fff; text-shadow:0 1px 0 #000; }
.player-info .balance { margin-left:6px; padding:2px 8px; border-radius:999px; background:#281c06; color:#ffd95e; font-weight:800; border:1px solid #7e6120; }
.player-info .balance-value { display:inline-block; min-width:54px; text-align:right; }

/* Bet spot & amount */
.bet-spot {
  position:absolute; 
  bottom:88px; 
  left:50%; 
  transform:translateX(-50%);
  width:84px; 
  height:84px; 
  border:2px dashed #ffd95e77; 
  border-radius:50%;
  display:grid; 
  place-items:center;
  box-shadow:0 0 0 2px rgba(0,0,0,.25) inset;
}
.bet-amount { color:#ffd95e; font-weight:800; }

/* Cards areas */
.hand-cards, .dealer-cards { display:flex; gap:8px; min-height:64px; }
.hand-cards { position:absolute; bottom:140px; left:50%; transform:translateX(-50%); }

/* Dealer row */
.dealer-row{
  position: absolute;
  top: 48px;
  left: 50%;
  transform: translateX(-50%);
  width: min(760px, 90%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  z-index: 3;
}
.dealer-label{ font-weight:700; opacity:.9; margin:0; }
.dealer-cards{ display:flex; gap:8px; }

/* simple card look (text only) */
.card {
  width:54px; height:74px; border-radius:8px;
  background:linear-gradient(180deg,#fff,#f3f3f3);
  color:#111; display:grid; place-items:center; font-weight:800;
  box-shadow:0 4px 10px rgba(0,0,0,.35);
}

/* --- Chips --- */
.chip {
  width:70px; height:70px; border-radius:50%; border:2px solid #ffe29a;
  background:#221a08; color:#ffd95e; font-weight:900; font-size:18px;
  box-shadow:var(--glow); cursor:pointer;
}
.chip:active { transform:translateY(1px); }

/* --- Bottom Bar: chips left, buttons right --- */
.bottom-bar{
  max-width:1100px;
  margin:14px auto 28px;
  padding:8px 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;   /* chips left, controls right */
  gap:16px;
}

.chip-tray{
  display:flex;
  align-items:center;
  gap:14px;
  position:static !important;     /* ensure not absolute */
  transform:none !important;
}

/* Controls (inside bottom bar, right side) */
.controls {
  display:flex;
  flex-direction:row;
  gap:12px;
}
.controls button {
  min-width:110px;
  padding:10px 14px;
  border-radius:10px;
  border:none;
  font-weight:700;
  background:#2b2b2b;
  color:#fff;
  box-shadow:0 4px 10px rgba(0,0,0,.25);
  cursor:pointer;
}
.controls button:disabled { opacity:.5; cursor:not-allowed; }
.controls .ghost { background:#444; }
#btnDeal      { background:#006ce3; }
#btnHit       { background:#169c35; }
#btnStand     { background:#9c1f1f; }
#btnDouble    { background:#b17900; }   /* in-round double down */

/* Hide chips on the sit page */
.pre-seat .chip-tray{ display:none; }

@media (max-width:900px) {
  .bottom-bar { flex-wrap:wrap; gap:12px; }
}

/* --- stop the table from clipping the bottom bar --- */
.table{
  position: relative;
  /* it was likely overflow:hidden; */
  overflow: visible;              /* allow chips/buttons to extend past felt */
  padding-bottom: 120px;          /* reserve space so nothing overlaps */
}

/* felt stays behind everything */
.felt{
  position: absolute;
  inset: 0;
  border-radius: 28px;
  z-index: 0;
  pointer-events: none;
}

/* seats layer (cards, circles, sit buttons) above felt, below toolbar */
.seats{ position: relative; z-index: 1; }

/* bottom bar floats on top at the bottom edge of the table */
.bottom-bar{
  position: absolute;
  left: 0; right: 0; bottom: -10px; /* slight drop below felt edge */
  z-index: 5;                        /* ensure it’s above the felt */
  pointer-events: auto;
}

/* (optional) if anything still tucks under, raise chips/buttons */
.bottom-bar .chip, .bottom-bar .controls{ position: relative; z-index: 6; }
/* Home button on Blackjack page */
.home-btn {
  position: fixed;
  left: 16px;
  top: 12px;
  z-index: 9999;
  padding: 0.5rem 1rem; /* slightly smaller than big CTA */
  font-size: 0.9rem;
}

/* Shared gold button style */
.btn {
  display: inline-block;
  background: #ffd700;
  color: #111;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.2s ease-in-out;
}
.btn:hover {
  background: #e6c200;
}

/* Shared gold button style (clean) */
.btn {
  display: inline-block;
  background: #ffd700;
  color: #111;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.2s ease-in-out;
}
.btn:hover { background: #e6c200; }
/* --- NEW TABLE modal --- */
.modal { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(0,0,0,.6); z-index: 999; }
.modal.show { display: flex; }
.modal-card { background: #0f151b; border: 1px solid #1e2a33; padding: 1.5rem; border-radius: 16px; width: 320px; text-align: center; }
.modal-card h2 { margin: 0 0 .5rem; color: #ffd700; }
.modal-actions { display: grid; gap: .75rem; margin-top: 1rem; }
.modal-actions button { padding: .6rem 1rem; border-radius: 999px; border: 1px solid #2a3a46; background: #0b1116; color: #e7f2ee; cursor: pointer; }
.modal-actions button:hover { filter: brightness(1.2); }

/* --- Card sizing (consistent, responsive) --- */
.card { width: 12vmin; height: auto; display: inline-block; user-select: none; -webkit-user-drag: none; aspect-ratio: 2.5 / 3.5; object-fit: contain; }
.hand { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }

@media (max-width: 680px) {
  .card { width: 16vmin; }
}
