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

body {
  background: #202124;
  color: #e8eaed;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

#back-btn {
  position: fixed;
  top: 18px;
  right: 24px;
  font-size: 2rem;
  color: #9aa0a6;
  text-decoration: none;
  z-index: 100;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s, color 0.2s;
}

#back-btn:hover {
  background: rgba(255,255,255,0.1);
  color: #e8eaed;
}

#game-container {
  width: 100%;
  max-width: 700px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

#info-bar {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 1.2rem;
  font-weight: 600;
  color: #8ab4f8;
}

.hand-label {
  font-size: 0.95rem;
  color: #9aa0a6;
  margin-bottom: 8px;
  text-align: center;
}

.hand-label span {
  color: #e8eaed;
  font-weight: 700;
}

.hand {
  display: flex;
  justify-content: center;
  gap: 10px;
  min-height: 200px;
  align-items: center;
  flex-wrap: wrap;
}

.hand .card {
  width: 150px;
  height: 210px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.hand .card img {
  width: 100%;
  height: 100%;
  display: block;
}

.hand .card.card-back {
  background: #1a73e8;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hand .card.card-back::after {
  content: '';
  width: 110px;
  height: 170px;
  border: 3px solid rgba(255,255,255,0.3);
  border-radius: 6px;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 5px,
    rgba(255,255,255,0.08) 5px,
    rgba(255,255,255,0.08) 10px
  );
}

.card.deal-anim {
  animation: dealCard 0.3s ease-out;
}

@keyframes dealCard {
  from { transform: translateY(-60px) scale(0.8); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

#dealer-area, #player-area {
  width: 100%;
  text-align: center;
}

#message {
  font-size: 1.4rem;
  font-weight: 700;
  min-height: 2rem;
  text-align: center;
  color: #fdd835;
}

#bet-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

button {
  background: #3c4043;
  color: #e8eaed;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  font-family: inherit;
}

button:hover:not(:disabled) {
  background: #5f6368;
}

button:active:not(:disabled) {
  transform: scale(0.96);
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.bet-btn {
  background: #1a73e8;
}

.bet-btn:hover:not(:disabled) {
  background: #4285f4;
}

#deal-btn {
  background: #34a853;
}

#deal-btn:hover:not(:disabled) {
  background: #43b864;
}

#hit-btn {
  background: #1a73e8;
  min-width: 90px;
}

#hit-btn:hover {
  background: #4285f4;
}

#stand-btn {
  background: #ea4335;
  min-width: 90px;
}

#stand-btn:hover {
  background: #f55347;
}

#double-btn {
  background: #f9ab00;
  color: #202124;
  min-width: 90px;
}

#double-btn:hover {
  background: #fbc02d;
}

#surrender-btn {
  background: #5f6368;
  min-width: 90px;
}

#surrender-btn:hover:not(:disabled) {
  background: #80868b;
}

#new-round-btn {
  background: #34a853;
  padding: 14px 32px;
  font-size: 1.1rem;
}

#new-round-btn:hover {
  background: #43b864;
}

#action-controls {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.hidden {
  display: none !important;
}

@media (max-width: 500px) {
  .hand .card {
    width: 100px;
    height: 140px;
  }

  .hand .card.card-back::after {
    width: 70px;
    height: 110px;
  }

  .hand {
    gap: 6px;
    min-height: 150px;
  }

  #message {
    font-size: 1.1rem;
  }

  button {
    padding: 10px 16px;
    font-size: 0.9rem;
  }

  #info-bar {
    font-size: 1rem;
  }
}
