:root {
  --felt-dark: #063c2d;
  --felt: #08734f;
  --felt-light: #0c9166;
  --gold: #e5ba54;
  --cream: #fff8e6;
  --ink: #17201d;
  --red: #c62828;
  --shadow: rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: white;
  background:
    radial-gradient(circle at 50% 10%, #333 0, #161616 48%, #080808 100%);
}

button { font: inherit; }

.casino-shell {
  width: min(1400px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 12px 18px;
}

.top-bar h1 {
  margin: 0;
  letter-spacing: .12em;
  font-size: clamp(1.4rem, 3vw, 2.3rem);
}

.top-bar p {
  margin: 5px 0 0;
  color: #d6d6d6;
  font-size: .9rem;
}

.icon-button,
.text-button {
  border: 0;
  background: transparent;
  color: white;
  cursor: pointer;
}

.icon-button { font-size: 1.4rem; }

.table {
  position: relative;
  min-height: 790px;
  overflow: hidden;
  border: 10px solid #5c331f;
  border-radius: 46% 46% 10% 10% / 14% 14% 6% 6%;
  padding: 34px 32px 24px;
  background:
    radial-gradient(ellipse at center, rgba(255,255,255,.07), transparent 60%),
    repeating-radial-gradient(circle at 20% 10%, rgba(255,255,255,.018) 0 1px, transparent 1px 4px),
    linear-gradient(145deg, var(--felt-light), var(--felt) 50%, var(--felt-dark));
  box-shadow:
    inset 0 0 80px rgba(0,0,0,.45),
    0 22px 60px rgba(0,0,0,.55);
}

.table::after {
  content: "";
  position: absolute;
  inset: 18px;
  pointer-events: none;
  border: 2px solid rgba(229,186,84,.5);
  border-radius: inherit;
}

.shoe-panel {
  position: absolute;
  right: 42px;
  top: 74px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 14px;
}

.shoe {
  position: relative;
  width: 118px;
  height: 102px;
  border: 4px solid #1d1d1d;
  border-radius: 12px 12px 22px 22px;
  background: linear-gradient(#4a4a4a, #1a1a1a);
  box-shadow: 0 8px 16px var(--shadow);
}

.shoe::before {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  top: 10px;
  height: 54px;
  border-radius: 6px;
  background: #090909;
  transform: skewX(-7deg);
}

.shoe-stack {
  position: absolute;
  left: 25px;
  top: 5px;
  width: 65px;
  height: 57px;
}

.shoe-stack::before,
.shoe-stack::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 5px;
  border: 2px solid #e7e7e7;
  background:
    repeating-linear-gradient(45deg, #b71c1c 0 4px, #fff 4px 7px, #0d47a1 7px 11px);
}

.shoe-stack::after {
  transform: translate(-7px, 4px);
  opacity: .85;
}

.shoe-label {
  position: absolute;
  bottom: 8px;
  width: 100%;
  text-align: center;
  font-size: .68rem;
  letter-spacing: .08em;
  color: #ddd;
}

.shoe-info {
  min-width: 88px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 10px;
  background: rgba(0,0,0,.28);
}

.shoe-info div + div { margin-top: 8px; }
.shoe-info span { display: block; color: #cdded6; font-size: .68rem; }
.shoe-info strong { font-size: 1rem; }

.hand-zone {
  position: relative;
  z-index: 1;
  text-align: center;
}

.dealer-zone {
  min-height: 205px;
  margin-top: 4px;
}

.player-zone {
  min-height: 240px;
}

.hand-heading {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

.hand-heading h2 {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 1rem;
}

.score-badge {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 28px;
  margin-top: -10px;
  padding: 0 8px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 999px;
  background: rgba(0,0,0,.25);
  font-weight: 800;
}

.cards {
  display: flex;
  justify-content: center;
  min-height: 146px;
  padding: 4px 16px 12px;
}

.card {
  position: relative;
  width: 96px;
  height: 136px;
  flex: 0 0 auto;
  margin-left: -24px;
  border: 1px solid #d7d7d7;
  border-radius: 9px;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255,255,255,.9), rgba(238,238,238,.8)),
    white;
  box-shadow: 0 7px 13px var(--shadow);
  transform-origin: 50% 100%;
}

.card.new-card {
  animation: dealCard .28s ease-out both;
}

.card:first-child { margin-left: 0; }
.card:nth-child(2n) { transform: rotate(1.5deg); }
.card:nth-child(3n) { transform: rotate(-1.3deg); }
.card.red { color: var(--red); }

.card-back {
  border: 5px solid white;
  background:
    repeating-linear-gradient(45deg, transparent 0 5px, rgba(255,255,255,.25) 5px 7px),
    repeating-linear-gradient(-45deg, #193c8a 0 6px, #9e1717 6px 12px);
}

.card-back::after {
  content: "";
  position: absolute;
  inset: 7px;
  border: 2px solid white;
  border-radius: 5px;
}

.corner {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: .87;
  font-weight: 900;
  font-size: 1.25rem;
}

.corner.top { left: 7px; top: 7px; }
.corner.bottom { right: 7px; bottom: 7px; transform: rotate(180deg); }
.corner .suit-small { font-size: 1rem; margin-top: 4px; }

.center-suit {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 3.8rem;
}

.face-symbol {
  position: absolute;
  inset: 28px 18px;
  display: grid;
  place-items: center;
  border: 3px double currentColor;
  font-family: Georgia, serif;
  font-size: 2.4rem;
  font-weight: 900;
}

@keyframes dealCard {
  from { opacity: 0; transform: translate(150px, -100px) rotate(12deg) scale(.78); }
  to { opacity: 1; }
}

.message-area {
  position: relative;
  z-index: 2;
  min-height: 62px;
  margin: 0 auto 8px;
  text-align: center;
}

.game-message {
  color: var(--cream);
  font-family: Georgia, serif;
  font-weight: 800;
  font-size: clamp(1.2rem, 2.6vw, 1.8rem);
  text-shadow: 0 2px 4px #000;
}

.sub-message {
  margin-top: 5px;
  color: #d9eee4;
  font-size: .86rem;
}

.player-hands {
  display: flex;
  justify-content: center;
  gap: 36px;
  min-height: 210px;
}

.player-hand {
  min-width: 230px;
  padding: 7px 10px 12px;
  border-radius: 16px;
  transition: .2s ease;
}

.player-hand.active {
  background: rgba(255,255,255,.08);
  box-shadow: 0 0 0 2px rgba(229,186,84,.78), 0 0 24px rgba(229,186,84,.26);
}

.player-hand .hand-label {
  min-height: 26px;
  margin-bottom: 2px;
  color: #e7f3ed;
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.player-hand .cards { padding-bottom: 4px; }

.betting-area {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto minmax(240px, 1fr);
  align-items: center;
  gap: 20px;
  margin-top: 8px;
}

.bankroll-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 12px;
  background: rgba(0,0,0,.28);
}

.bankroll-panel div {
  padding: 10px;
  text-align: center;
}

.bankroll-panel div + div { border-left: 1px solid rgba(255,255,255,.12); }

.bankroll-panel span {
  display: block;
  margin-bottom: 2px;
  color: #c9ddd4;
  font-size: .67rem;
  text-transform: uppercase;
}

.bankroll-panel strong { font-size: 1rem; }

.betting-spot {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.betting-spot.selected {
  background: rgba(255,255,255,.08);
  box-shadow: 0 0 0 2px rgba(229,186,84,.78), 0 0 24px rgba(229,186,84,.26);
}

.spot-slot {
  align-items: center;
}

.spot-circle {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin: 0 auto;
  border: 2px solid var(--gold);
  border-radius: 50%;
  font-size: .72rem;
  font-weight: 800;
}

.betting-spot.selected .spot-circle {
  box-shadow: 0 0 0 3px rgba(229,186,84,.3);
}

.hand-label-bottom {
  margin-top: 6px;
  margin-bottom: 0;
}

.out-of-money-prompt {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 10px;
}

.out-of-money-prompt p {
  margin: 0;
  color: var(--cream);
  font-family: Georgia, serif;
  font-weight: 800;
  font-size: 1.1rem;
}

.prompt-buttons {
  display: flex;
  gap: 10px;
}

.chip-rack {
  display: flex;
  justify-content: center;
  gap: 7px;
}

.chip {
  width: 58px;
  height: 58px;
  padding: 0;
  border: 5px dashed rgba(255,255,255,.88);
  border-radius: 50%;
  color: white;
  cursor: pointer;
  font-weight: 900;
  text-shadow: 0 1px 2px #000;
  box-shadow: inset 0 0 0 4px rgba(255,255,255,.16), 0 5px 9px var(--shadow);
  transition: transform .12s ease, filter .12s ease;
}

.chip:hover { transform: translateY(-5px) rotate(-4deg); filter: brightness(1.12); }
.chip:active { transform: translateY(-1px) scale(.96); }
.chip:disabled { opacity: .35; cursor: not-allowed; transform: none; }

.chip-5 { background: #b71c1c; }
.chip-10 { background: #1565c0; }
.chip-25 { background: #2e7d32; }
.chip-50 { background: #6a1b9a; }
.chip-100 { background: #202020; }
.chip-500 { background: #a66b00; }

.bet-controls,
.play-controls {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.primary-button,
.secondary-button {
  min-width: 88px;
  min-height: 42px;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.primary-button {
  border: 1px solid #f7d984;
  color: #222;
  background: linear-gradient(#f7d984, #c89427);
}

.secondary-button {
  border: 1px solid rgba(255,255,255,.28);
  color: white;
  background: linear-gradient(#3e4d48, #1e2925);
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.hidden { display: none !important; }

.table-rules {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: 34px;
  margin-top: 17px;
  color: rgba(255,239,189,.8);
  font-family: Georgia, serif;
  font-size: .72rem;
  letter-spacing: .08em;
}

footer {
  display: flex;
  justify-content: space-between;
  padding: 14px 12px 0;
  color: #aaa;
  font-size: .78rem;
}

footer .text-button {
  padding: 0;
  color: #ddd;
  text-decoration: underline;
}

@media (max-width: 960px) {
  .table { border-radius: 100px 100px 18px 18px; padding-inline: 18px; }
  .shoe-panel { position: static; justify-content: flex-end; margin-bottom: -70px; }
  .betting-area { grid-template-columns: 1fr; }
  .bet-controls, .play-controls { justify-content: center; }
  .bankroll-panel { order: 3; }
  .table-rules { flex-wrap: wrap; gap: 8px 20px; }
}

@media (max-width: 650px) {
  .casino-shell { padding: 5px; }
  .top-bar { padding: 10px 8px 12px; }
  .top-bar p { display: none; }
  .table {
    min-height: 850px;
    border-width: 6px;
    border-radius: 54px 54px 14px 14px;
    padding: 22px 8px 18px;
  }
  .shoe-panel { display: none; }
  .dealer-zone { min-height: 180px; }
  .card { width: 72px; height: 104px; margin-left: -22px; border-radius: 7px; }
  .corner { font-size: .95rem; }
  .corner .suit-small { font-size: .8rem; }
  .center-suit { font-size: 2.8rem; }
  .face-symbol { inset: 23px 13px; font-size: 1.75rem; }
  .cards { min-height: 112px; }
  .player-hands { gap: 5px; overflow-x: auto; justify-content: flex-start; }
  .player-hand { min-width: 180px; }
  .chip-rack { flex-wrap: wrap; }
  .chip { width: 51px; height: 51px; }
  .bankroll-panel { font-size: .8rem; }
  .table-rules { display: none; }
}
