@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700&family=DM+Sans:wght@400;500;600&display=swap');

:root {
  --gold: #c9a84c;
  --gold-light: #e8c96d;
  --felt: #0d3320;
  --felt-dark: #081f14;
  --felt-light: #154d2e;
  --white: #f5f0e8;
  --red: #c0392b;
  --text-muted: rgba(245, 240, 232, 0.5);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: var(--felt-dark);
  font-family: 'DM Sans', sans-serif;
  color: var(--white);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.table {
  width: 100%;
  max-width: 700px;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 50% 40%, #1a5c38 0%, #0d3320 60%, #081f14 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 24px;
  gap: 16px;
  position: relative;
  overflow: hidden;
}

.table::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 40px,
    rgba(255,255,255,0.01) 40px,
    rgba(255,255,255,0.01) 41px
  );
  pointer-events: none;
}

header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

h1 {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  color: var(--gold);
  letter-spacing: 0.3em;
  text-shadow: 0 0 30px rgba(201, 168, 76, 0.4);
}

.player-info {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gold-light);
  background: rgba(0,0,0,0.3);
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid rgba(201, 168, 76, 0.3);
}

.section-label {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-align: center;
}

.dealer-section, .player-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cards-area {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  min-height: 110px;
  align-items: center;
}

.sum-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 8px;
  letter-spacing: 0.05em;
}

.divider {
  width: 80%;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(201,168,76,0.4), transparent);
  margin: 4px 0;
}

.message {
  font-size: 1.1rem;
  font-weight: 500;
  font-style: italic;
  color: var(--white);
  text-align: center;
  min-height: 2rem;
  transition: all 0.3s ease;
  padding: 0 16px;
}

.message.win {
  color: #2ecc71;
  font-size: 1.5rem;
  text-shadow: 0 0 20px rgba(46, 204, 113, 0.6);
  animation: pulse 0.5s ease 2;
}

.message.lose {
  color: #e74c3c;
  font-size: 1.5rem;
  text-shadow: 0 0 20px rgba(231, 76, 60, 0.6);
  animation: shake 0.4s ease;
}

.controls {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.button-group {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-primary {
  background: transparent;
  color: var(--gold);
  border: 1.5px solid var(--gold);
  padding: 10px 28px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background: var(--gold);
  color: var(--felt-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(201,168,76,0.3);
}

.btn-bet {
  background: rgba(201,168,76,0.15);
  color: var(--gold-light);
  border: 1px solid rgba(201,168,76,0.3);
  padding: 8px 20px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-bet:hover {
  background: rgba(201,168,76,0.3);
  transform: translateY(-1px);
}

.card {
  background: var(--white);
  color: #1a1a1a;
  width: 65px;
  height: 95px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3em;
  font-weight: 700;
  font-family: 'DM Sans', sans-serif;
  box-shadow:
    0 4px 12px rgba(0,0,0,0.5),
    0 0 0 1px rgba(255,255,255,0.1);
  animation: cardFlip 0.35s ease forwards;
}

.card-hidden {
  background: linear-gradient(135deg, #0d3320 25%, #154d2e 50%, #0d3320 75%);
  color: var(--gold);
  font-size: 1.8em;
  border: 2px solid rgba(201,168,76,0.4);
  box-shadow:
    0 4px 12px rgba(0,0,0,0.5),
    inset 0 0 20px rgba(0,0,0,0.3);
}

.card[data-suit="♥"],
.card[data-suit="♦"] {
  color: var(--red);
}

.card-flip {
  animation: cardFlip 0.4s ease forwards;
}

@keyframes cardFlip {
  from {
    transform: rotateY(90deg) scale(0.8);
    opacity: 0;
  }
  to {
    transform: rotateY(0deg) scale(1);
    opacity: 1;
  }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}