@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700&family=Roboto:wght@400;500;700&display=swap');

:root {
  --primary-green: #0a2e1f;
  --table-green: #1a5f3c;
  --table-light: #2a7a52;
  --gold: #d4af37;
  --gold-light: #f4cf57;
  --white: #ffffff;
  --red: #dc3545;
  --shadow: rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  font-family: 'Roboto', sans-serif;
  background: linear-gradient(135deg, var(--primary-green) 0%, #0d3d28 50%, var(--primary-green) 100%);
  background-attachment: fixed;
  color: var(--white);
  min-height: 100vh;
  width: 100%;
  margin: 0;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.02'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

.game-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 700px;
  min-width: 320px;
  text-align: center;
  padding: 40px;
  border-radius: 20px;
  background: linear-gradient(145deg, var(--table-green) 0%, var(--table-light) 50%, var(--table-green) 100%);
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.5),
    inset 0 2px 10px rgba(255, 255, 255, 0.1),
    inset 0 -2px 10px rgba(0, 0, 0, 0.2);
  border: 4px solid var(--gold);
}

.player {
  margin-bottom: 30px;
}

.logo {
  max-width: 450px;
  width: 80%;
  height: auto;
  margin-bottom: 20px;
  filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.4));
}

.hand {
  background: rgba(0, 0, 0, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 15px;
  margin: 20px auto;
  padding: 20px;
  height: 180px;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  box-shadow: inset 0 4px 20px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  box-sizing: border-box;
}

.card {
  width: 90px;
  height: 130px;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 
    0 4px 15px rgba(0, 0, 0, 0.4),
    0 2px 5px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  animation: dealCard 0.4s ease-out;
}

.card:hover {
  transform: translateY(-10px) rotate(2deg);
  box-shadow: 
    0 15px 30px rgba(0, 0, 0, 0.5),
    0 5px 10px rgba(0, 0, 0, 0.3);
}

@keyframes dealCard {
  0% {
    opacity: 0;
    transform: translateY(-50px) rotate(-10deg) scale(0.8);
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotate(0) scale(1);
  }
}

.score {
  margin-top: 15px;
  font-size: 1.5rem;
  font-weight: 700;
  padding: 10px 30px;
  display: inline-block;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 25px;
  border: 2px solid var(--gold);
  color: var(--gold-light);
  letter-spacing: 2px;
}

.score:empty {
  display: none;
}

.controls {
  margin: 25px 0;
  display: flex;
  justify-content: center;
  gap: 15px;
}

button {
  padding: 15px 40px;
  font-family: 'Roboto', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transition: left 0.5s ease;
}

button:hover::before {
  left: 100%;
}

#hit-button {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
}

#hit-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(40, 167, 69, 0.5);
}

#stand-button {
  background: linear-gradient(135deg, #dc3545 0%, #fd7e14 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(220, 53, 69, 0.4);
}

#stand-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(220, 53, 69, 0.5);
}

#bet-button {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
  color: #1a1a1a;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
}

#bet-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(212, 175, 55, 0.5);
}

button:active {
  transform: translateY(0);
}

.betting {
  margin: 25px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
}

.bet-input-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.bet-adjust {
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 1.5rem;
  font-weight: 700;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
  color: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(212, 175, 55, 0.3);
}

.bet-adjust:hover {
  transform: scale(1.1);
}

.bet-adjust:active {
  transform: scale(0.95);
}

.currency-symbol {
  position: absolute;
  left: 60px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold-light);
  pointer-events: none;
  z-index: 1;
}

.betting input[type="number"] {
  width: 100px;
  padding: 15px 15px 15px 30px;
  font-size: 1.2rem;
  font-weight: 700;
  text-align: center;
  border: 2px solid var(--gold);
  border-radius: 50px;
  background: rgba(0, 0, 0, 0.3);
  color: var(--gold-light);
  outline: none;
  transition: all 0.3s ease;
}

.betting input[type="number"]:focus {
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
  border-color: var(--gold-light);
}

.betting input[type="number"]::-webkit-inner-spin-button,
.betting input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

#balance {
  margin-top: 25px;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--gold-light);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  letter-spacing: 1px;
  transition: all 0.3s ease;
}

#balance.pulse {
  animation: balancePulse 0.5s ease;
}

@keyframes balancePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

#balance.win {
  color: #4ade80;
}

#balance.lose {
  color: var(--red);
}

#result {
  font-size: 1.6rem;
  font-weight: 700;
  margin-top: 25px;
  padding: 15px 30px;
  border-radius: 10px;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

#result:empty {
  display: none;
}

#result.win {
  background: linear-gradient(135deg, rgba(40, 167, 69, 0.3) 0%, rgba(32, 201, 151, 0.3) 100%);
  border: 2px solid #28a745;
  color: #4ade80;
  animation: resultPop 0.5s ease;
}

#result.lose {
  background: linear-gradient(135deg, rgba(220, 53, 69, 0.3) 0%, rgba(253, 126, 20, 0.3) 100%);
  border: 2px solid var(--red);
  color: #f87171;
  animation: resultPop 0.5s ease;
}

#result.neutral {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: var(--white);
}

@keyframes resultPop {
  0% { transform: scale(0.8); opacity: 0; }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

.payout-table-container {
  margin-top: 30px;
  padding: 20px 30px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 15px;
  border: 1px solid rgba(212, 175, 55, 0.3);
  display: inline-block;
}

.payout-table-container h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  margin: 0 0 15px 0;
  color: var(--gold-light);
  text-align: center;
  letter-spacing: 2px;
}

#payout-table {
  border-collapse: collapse;
  width: 100%;
}

#payout-table th,
#payout-table td {
  padding: 10px 15px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#payout-table th {
  color: var(--gold);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

#payout-table td {
  font-size: 0.9rem;
}

#payout-table td:last-child {
  color: var(--gold-light);
  font-weight: 700;
  text-align: right;
}

#payout-table tr:last-child td {
  border-bottom: none;
}

#payout-table tr:hover td {
  background: rgba(255, 255, 255, 0.05);
}

.site-footer {
  text-align: center;
  padding: 20px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.9rem;
}

.site-footer a {
  color: var(--gold-light);
  text-decoration: none;
  transition: color 0.3s ease;
}

.site-footer a:hover {
  color: var(--gold);
  text-decoration: underline;
}

.help-button {
  position: absolute;
  top: 15px;
  right: 15px;
  padding: 8px 16px;
  font-size: 0.85rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--gold);
  color: var(--gold-light);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.help-button:hover {
  background: var(--gold);
  color: #1a1a1a;
  transform: none;
}

.popup-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 20px;
  box-sizing: border-box;
}

.popup-overlay.active {
  display: flex;
}

.popup {
  background: linear-gradient(145deg, var(--table-green) 0%, var(--table-light) 100%);
  border: 3px solid var(--gold);
  border-radius: 20px;
  padding: 30px;
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.popup h2 {
  font-family: 'Playfair Display', serif;
  color: var(--gold-light);
  margin: 0 0 20px 0;
  font-size: 1.8rem;
  text-align: center;
}

.popup h3 {
  color: var(--gold);
  margin: 20px 0 10px 0;
  font-size: 1.1rem;
}

.popup-content {
  color: var(--white);
  line-height: 1.6;
}

.popup-content p {
  margin: 10px 0;
}

.popup-content ol,
.popup-content ul {
  margin: 10px 0;
  padding-left: 25px;
}

.popup-content li {
  margin: 8px 0;
}

.popup-close {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 35px;
  height: 35px;
  padding: 0;
  font-size: 1.5rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--gold);
  color: var(--gold-light);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.popup-close:hover {
  background: var(--red);
  border-color: var(--red);
  color: white;
  transform: none;
}

@media (max-width: 600px) {
  .logo {
    max-width: 200px;
  }
  
  .help-button {
    padding: 6px 12px;
    font-size: 0.75rem;
  }
  
  .hand {
    height: 130px;
  }
  
  .game-container {
    padding: 20px;
    margin: 10px;
  }
  
  .card {
    width: 70px;
    height: 100px;
  }
  
  .hand {
    min-height: 120px;
    padding: 15px;
  }
  
  button {
    padding: 12px 25px;
    font-size: 0.9rem;
  }
  
  .controls {
    flex-direction: column;
    gap: 10px;
  }
  
  .betting {
    flex-direction: column;
  }
  
  #balance {
    font-size: 1.4rem;
  }
  
  #result {
    font-size: 1.2rem;
    padding: 10px 20px;
  }
}
