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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #667eea 100%);
  min-height: 100vh;
  padding: 20px;
  color: #333;
  position: relative;
  overflow-x: hidden;
}

/* Animation de fond avec nuages */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 60%, rgba(255,255,255,0.08) 0%, transparent 50%),
    radial-gradient(circle at 40% 80%, rgba(255,255,255,0.06) 0%, transparent 50%);
  animation: cloudMove 20s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: -1;
}

@keyframes cloudMove {
  0% { transform: translateX(0) scale(1); }
  100% { transform: translateX(-20px) scale(1.05); }
}

.container {
  max-width: 800px;
  margin: 0 auto;
  animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

h1 {
  text-align: center;
  color: white;
  font-size: 3rem;
  margin-bottom: 30px;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
  background: linear-gradient(45deg, #fff, #f0f9ff, #e0f2fe);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  /* animation: titleGlow 2s ease-in-out infinite alternate; */
  font-weight: 800;
  letter-spacing: 2px;
}

/* @keyframes titleGlow {
  0% { filter: drop-shadow(0 0 5px rgba(255,255,255,0.5)); }
  100% { filter: drop-shadow(0 0 20px rgba(255,255,255,0.8)); }
} */

.balance-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(15px);
  border-radius: 20px;
  padding: 25px;
  margin-bottom: 30px;
  text-align: center;
  box-shadow: 0 15px 35px rgba(0,0,0,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  position: relative;
  overflow: hidden;
}

.balance-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  50% { left: -100%; }
  100% { left: 100%; }
}

.balance-label {
  font-size: 1.5rem;
  color: #6b7280;
  margin-bottom: 10px;
  font-weight: 500;
}

.balance-amount {
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(45deg, #059669, #10b981, #34d399);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 2px 4px rgba(0,0,0,0.1);
  animation: balancePulse 2s ease-in-out infinite;
}

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

.error {
  background: linear-gradient(135deg, #fef2f2, #fee2e2);
  border: 2px solid #fca5a5;
  color: #dc2626;
  padding: 15px 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  font-weight: 600;
  text-align: center;
  animation: errorShake 0.5s ease-in-out;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.15);
}

@keyframes errorShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.betting-form {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(15px);
  border-radius: 25px;
  padding: 40px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  margin-bottom: 30px;
  position: relative;
}

fieldset {
  border: 3px solid transparent;
  background: linear-gradient(white, white) padding-box,
              linear-gradient(135deg, #667eea, #764ba2) border-box;
  border-radius: 20px;
  padding: 30px;
  margin-bottom: 30px;
  position: relative;
}

legend {
  font-weight: 700;
  color: #4338ca;
  padding: 0 20px;
  font-size: 1.3rem;
  background: white;
  border-radius: 10px;
  padding: 10px 20px;
  box-shadow: 0 4px 12px rgba(67, 56, 202, 0.15);
}

.horse-option {
  display: flex;
  align-items: center;
  padding: 20px;
  margin: 15px 0;
  border: 2px solid #e5e7eb;
  border-radius: 15px;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  background: linear-gradient(135deg, #fff 0%, #f8fafc 100%);
  position: relative;
  overflow: hidden;
}

.horse-option::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.1), transparent);
  transition: left 0.6s ease;
}

.horse-option:hover::before {
  left: 100%;
}

.horse-option:hover {
  border-color: #667eea;
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 15px 30px rgba(102, 126, 234, 0.2);
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
}

.horse-option input[type="radio"] {
  margin-right: 40px;
  transform: scale(1.4);
  accent-color: #667eea;
  cursor: pointer;
}

.horse-option input[type="radio"]:checked + .horse-label {
  color: #4338ca;
  font-weight: 700;
  font-size: 1.1rem;
}

.horse-option:has(input:checked) {
  border-color: #4338ca;
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  box-shadow: 0 15px 30px rgba(67, 56, 202, 0.25);
  transform: translateY(-3px) scale(1.03);
}

.horse-label {
  font-size: 1.4rem;
  transition: all 0.3s ease;
  flex-grow: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.bet-section {
  margin-bottom: 35px;
}

.bet-label {
  display: block;
  font-weight: 700;
  color: #374151;
  margin-bottom: 15px;
  font-size: 1.3rem;
  text-align: center;
}

select {
  width: 100%;
  padding: 20px 25px;
  border: 3px solid #e5e7eb;
  border-radius: 15px;
  font-size: 1.2rem;
  font-weight: 600;
  background: linear-gradient(135deg, #fff 0%, #f8fafc 100%);
  cursor: pointer;
  transition: all 0.3s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 15px center;
  background-repeat: no-repeat;
  background-size: 20px;
  padding-right: 55px;
}

select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
  background: white;
}

select:hover {
  border-color: #9ca3af;
  transform: translateY(-1px);
}

button[type="submit"] {
  width: 100%;
  padding: 22px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 15px;
  color: white;
  font-size: 1.4rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

button[type="submit"]:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
  background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
}

button[type="submit"]:active {
  transform: translateY(-1px);
}

button[type="submit"]::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.6s;
}

button[type="submit"]:hover::before {
  left: 100%;
}

.stats-link {
  text-align: center;
  margin-top: 30px;
}

.stats-link a {
  display: inline-block;
  background: rgba(255, 255, 255, 0.9);
  color: #4338ca;
  padding: 15px 30px;
  border-radius: 50px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.1rem;
  transition: all 0.3s ease;
  box-shadow: 0 8px 20px rgba(0,0,0,0.1);
  border: 2px solid transparent;
  background-clip: padding-box;
}

.stats-link a:hover {
  background: white;
  transform: translateY(-2px);
  box-shadow: 0 12px 25px rgba(0,0,0,0.15);
  border-color: #667eea;
}

/* Responsive Design */
@media (max-width: 768px) {
  body {
    padding: 15px;
  }

  h1 {
    font-size: 2.2rem;
    margin-bottom: 20px;
  }

  .betting-form {
    padding: 25px;
  }

  fieldset {
    padding: 20px;
  }

  .balance-amount {
    font-size: 2rem;
  }

  .horse-option {
    padding: 15px;
  }

  button[type="submit"] {
    padding: 18px;
    font-size: 1.2rem;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.8rem;
    letter-spacing: 1px;
  }

  .balance-amount {
    font-size: 1.8rem;
  }

  .horse-option {
    padding: 12px;
  }

  .horse-label {
    font-size: 1rem;
  }

  select {
    padding: 15px 20px;
    font-size: 1rem;
  }
}
