:root {
  color-scheme: dark;
  --felt: #0a5d3c;
  --gold: #ffc44d;
  --text: #ffffff;
  --muted: rgba(255,255,255,0.8);
}

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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: Inter, system-ui, sans-serif;
  color: var(--text);
  background: #04110b;
}

.app-shell {
  height: 100vh;
  height: 100dvh;
  display: flex;
  padding: 8px;
}

.table-surface {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-radius: 24px;
  padding: 10px 14px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 30%, rgba(255,255,255,0.04), transparent 30%),
    radial-gradient(circle at center, rgba(21,128,84,0.38), rgba(5,47,30,0.98) 72%);
  border: 1px solid rgba(255,215,148,0.2);
  box-shadow: inset 0 0 0 2px rgba(255,223,160,0.06), 0 24px 60px rgba(0,0,0,0.4);
}

/* ── Top strip ── */
.top-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  margin-bottom: 6px;
  border-radius: 14px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,215,148,0.15);
  flex-shrink: 0;
}

.top-left-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.title-text {
  font-weight: 800;
  font-size: 1rem;
  color: var(--gold);
  letter-spacing: 0.04em;
}

.bankroll-badge strong {
  color: var(--gold);
  font-size: 1.1rem;
}

.stats-strip {
  display: flex;
  gap: 14px;
}

.stat {
  font-weight: 700;
  font-size: 0.95rem;
}

.stat strong { font-size: 1.1rem; }
.win-stat strong { color: #6eff9e; }
.loss-stat strong { color: #ff7878; }
.push-stat strong { color: #9bd2ff; }

/* ── Dealer & Player areas ── */
.dealer-area,
.player-area {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 10px;
  min-height: 0;
}

.area-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  min-width: 70px;
}

.area-label span {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.big-score {
  font-size: 2.4rem;
  font-weight: 800;
  color: #ffffff;
  background: rgba(0,0,0,0.5);
  border: 2px solid var(--gold);
  border-radius: 16px;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 2px 10px rgba(0,0,0,0.6);
}

.cards-row,
.hand-cards {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  min-height: 0;
}

.player-hands {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.hand-panel {
  border-radius: 14px;
  border: 1px solid rgba(255,223,160,0.15);
  background: rgba(255,255,255,0.04);
  padding: 8px 10px;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.hand-panel.active {
  border-color: rgba(255,196,77,0.7);
  box-shadow: 0 0 0 2px rgba(255,196,77,0.15);
}

.hand-panel.won { border-color: rgba(108,255,169,0.5); }
.hand-panel.lost { border-color: rgba(255,120,120,0.45); }
.hand-panel.push { border-color: rgba(155,210,255,0.45); }

.hand-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 0.85rem;
}

.hand-label { font-weight: 700; }

.hand-meta {
  display: flex;
  gap: 10px;
  align-items: center;
}

.hand-meta strong {
  font-size: 1.1rem;
  color: #fff;
}

.score-pill {
  font-weight: 800;
  font-size: 0.9rem;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,0.4);
  color: var(--gold);
}

/* ── Status bar ── */
.status-bar {
  padding: 8px 14px;
  margin: 4px 0;
  border-radius: 12px;
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(255,215,148,0.15);
  font-weight: 700;
  font-size: 1rem;
  text-align: center;
  flex-shrink: 0;
}

/* ── Controls bar ── */
.controls-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border-radius: 16px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,215,148,0.15);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.bet-section {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1;
}

.bet-amount {
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
}

.bet-amount strong {
  color: var(--gold);
  font-size: 1.1rem;
}

.chips {
  display: flex;
  gap: 6px;
}

.chip {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  color: #fff;
  font-weight: 800;
  font-size: 0.8rem;
  border: none;
  cursor: pointer;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,0.2), inset 0 0 0 8px rgba(0,0,0,0.18), 0 6px 14px rgba(0,0,0,0.3);
  transition: transform 120ms ease;
}

.chip:hover:not(:disabled) { transform: translateY(-2px) scale(1.05); }
.chip:disabled { opacity: 0.35; cursor: not-allowed; }

.chip-5 { background: linear-gradient(145deg, #d64343, #8a1919); }
.chip-10 { background: linear-gradient(145deg, #3b7eff, #163993); }
.chip-25 { background: linear-gradient(145deg, #2fce74, #0d6b3a); }
.chip-50 { background: linear-gradient(145deg, #7b5cff, #4624bc); }
.chip-100 { background: linear-gradient(145deg, #11161c, #495869); }

.bet-buttons {
  display: flex;
  gap: 6px;
}

.primary-btn,
.secondary-btn,
.action-btn {
  min-height: 42px;
  border-radius: 12px;
  padding: 0 16px;
  color: var(--text);
  font-weight: 700;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease;
}

.primary-btn { background: linear-gradient(135deg, #f0bb42, #d28e1a); color: #1f1301; }
.secondary-btn { background: rgba(255,255,255,0.1); }
.action-btn { background: rgba(255,255,255,0.12); }

.play-actions {
  display: flex;
  gap: 6px;
}

button:hover:not(:disabled) { transform: translateY(-1px); }
button:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── Cards ── */
.card {
  position: relative;
  width: 72px;
  height: 100px;
  border-radius: 12px;
  transform-style: preserve-3d;
  transition: transform 400ms cubic-bezier(0.2,0.7,0.2,1), opacity 250ms ease;
  flex-shrink: 0;
}

.card.entering {
  opacity: 0;
  transform: translateY(-14px) scale(0.9) rotate(-5deg);
}

.card.visible {
  opacity: 1;
  transform: translateY(0) scale(1) rotate(0deg);
}

.card.is-hidden { transform: rotateY(180deg); }

.card-face,
.card-back {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  backface-visibility: hidden;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

.card-face {
  background: linear-gradient(160deg, #fffdf8, #ece7db);
  color: #111;
  border: 1px solid rgba(17,17,17,0.12);
}

.card-back {
  transform: rotateY(180deg);
  border: 1px solid rgba(255,255,255,0.14);
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.06) 0 6px, transparent 6px 12px),
    linear-gradient(160deg, #163c7f, #081b40);
  display: grid;
  place-items: center;
}

.card-back span {
  width: 58%;
  height: 58%;
  border-radius: 8px;
  border: 2px solid rgba(255,255,255,0.22);
}

.corner {
  position: absolute;
  display: flex;
  flex-direction: column;
  line-height: 1;
  font-weight: 800;
  font-size: 0.9rem;
}

.top-left { top: 7px; left: 7px; }
.bottom-right { right: 7px; bottom: 7px; transform: rotate(180deg); }

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

.card.red { color: #cc1f2f; }
.card.black { color: #111; }

/* ── Mobile ── */
@media (max-width: 700px) {
  .app-shell { padding: 4px; }
  .table-surface { padding: 8px 10px; border-radius: 18px; }

  .top-strip { flex-wrap: wrap; gap: 6px; padding: 6px 8px; }
  .title-text { font-size: 0.85rem; }

  .big-score { font-size: 2rem; width: 54px; height: 54px; }

  .chip { width: 42px; height: 42px; font-size: 0.72rem; }
  .card { width: 60px; height: 84px; }
  .corner { font-size: 0.75rem; }
  .suit-center { font-size: 1.6rem; }

  .controls-bar { flex-direction: column; align-items: stretch; }
  .play-actions { justify-content: stretch; }
  .action-btn { flex: 1; }
}

@media (max-height: 600px) {
  .big-score { font-size: 1.6rem; width: 44px; height: 44px; }
  .card { width: 54px; height: 76px; }
  .dealer-area, .player-area { padding: 4px 8px; }
  .status-bar { padding: 5px 10px; font-size: 0.88rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}
