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

:root {
  /* Palette principale : Blanc, Vert (dominant), Violet (secondaire) */
  --primary-color: #0e4243; /* Vert principal - DOMINANT */
  --primary-hover: #0a3233; /* Vert plus foncé */
  --primary-light: #1a5f61; /* Vert clair */
  --secondary-color: #8b5cf6; /* Violet secondaire */
  --secondary-hover: #7c3aed; /* Violet foncé */
  --secondary-light: #a78bfa; /* Violet clair */
  --bg-white: #ffffff;
  --bg-light: #f8f9fa;
  --bg-card: #ffffff;
  --bg-card-hover: #f8f9fa;
  --text-primary: #1a1a1a;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --text-on-dark: #ffffff;
  --border-color: #e2e8f0;
  --border-focus: #0e4243; /* Vert pour focus */
  --success-color: #0e4243; /* Vert pour succès */
  --error-color: #e53e3e;
  --warning-color: #d69e2e;
  --shadow-sm: 0 1px 2px 0 rgba(14, 66, 67, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(14, 66, 67, 0.1), 0 2px 4px -1px rgba(14, 66, 67, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(14, 66, 67, 0.1), 0 4px 6px -2px rgba(14, 66, 67, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(14, 66, 67, 0.15), 0 10px 10px -5px rgba(14, 66, 67, 0.04);
  --shadow-green: 0 4px 14px 0 rgba(14, 66, 67, 0.2);
  --shadow-purple: 0 4px 14px 0 rgba(139, 92, 246, 0.1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #f5f5f5;
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  line-height: 1.6;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app-container {
  max-width: 480px;
  width: 100%;
  margin: auto;
  animation: fadeIn 0.5s ease-in;
  position: relative;
  z-index: 1;
  padding: 0 4px;
}

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

.app-header {
  text-align: center;
  margin-bottom: 20px;
  padding: 16px 0;
}

.logo {
  width: 120px;
  height: auto;
  object-fit: contain;
  margin: 0 auto 20px;
  display: block;
  background: var(--bg-white);
  padding: 12px;
  border: 2px solid var(--primary-color);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
}

.logo:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.logo:not([src]) {
  display: none;
}

.logo-placeholder {
  display: none;
}

.tagline {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--primary-color);
  margin-bottom: 8px;
  font-weight: 600;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.app-header h1 {
  font-size: 1.75rem;
  margin-bottom: 12px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.5;
}

.note {
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: linear-gradient(135deg, rgba(14, 66, 67, 0.15), rgba(14, 66, 67, 0.08));
  padding: 8px 12px;
  border-radius: 8px;
  display: inline-block;
  margin-top: 8px;
  border: 1px solid rgba(14, 66, 67, 0.3);
}

/* Indicateur d'étapes amélioré */
.steps-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  gap: 8px;
  position: relative;
}

.step-item {
  padding: 10px 16px;
  border-radius: 20px;
  border: 2px solid var(--border-color);
  color: var(--text-muted);
  min-width: 90px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 500;
  background: var(--bg-white);
  transition: all 0.3s ease;
  position: relative;
  z-index: 1;
}

.step-item.active {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background: rgba(14, 66, 67, 0.15);
  font-weight: 600;
  transform: scale(1.05);
  box-shadow: 0 0 0 4px rgba(14, 66, 67, 0.15);
}

.step-item.completed {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background: rgba(14, 66, 67, 0.1);
}

.step-separator {
  flex: 1;
  height: 2px;
  background: var(--border-color);
  max-width: 40px;
  transition: all 0.3s ease;
}

.step-separator.completed {
  background: var(--primary-color);
}

/* Carte avec animations */
.card {
  background: var(--bg-white);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-xl);
  display: none;
  border: 2px solid var(--border-color);
  animation: slideIn 0.4s ease-out;
  transition: all 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(-20px);
  }
}

.card.active {
  display: block;
}

.card:hover {
  box-shadow: var(--shadow-xl), var(--shadow-green);
  border-color: rgba(14, 66, 67, 0.3);
}

.card h2 {
  font-size: 1.25rem;
  margin-bottom: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.card p {
  font-size: 0.95rem;
  margin-bottom: 16px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Boutons améliorés */
.btn-primary,
.btn-secondary {
  border: none;
  border-radius: 12px;
  padding: 16px 24px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
  min-height: 48px; /* Zone de clic optimale pour mobile */
  touch-action: manipulation; /* Évite le double-tap sur mobile */
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  color: white;
  box-shadow: var(--shadow-md), var(--shadow-green);
  border: none;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), var(--shadow-green);
  background: linear-gradient(135deg, var(--primary-hover), var(--primary-color));
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--bg-white);
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), var(--shadow-green);
}

.full-width {
  width: 100%;
}

.large {
  font-size: 1.1rem;
  padding: 16px 24px;
}

/* Formulaire amélioré */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="password"],
.form-group input[type="number"] {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 2px solid var(--border-color);
  background: var(--bg-light);
  color: var(--text-primary);
  font-size: 16px; /* Évite le zoom automatique sur iOS */
  transition: all 0.3s ease;
  min-height: 48px; /* Zone de clic optimale pour mobile */
  -webkit-appearance: none; /* Retire le style par défaut iOS */
  appearance: none;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="tel"]:focus,
.form-group input[type="password"]:focus,
.form-group input[type="number"]:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(14, 66, 67, 0.15);
  background: var(--bg-white);
}

.form-group input[type="text"]:valid:not(:placeholder-shown),
.form-group input[type="email"]:valid:not(:placeholder-shown),
.form-group input[type="tel"]:valid:not(:placeholder-shown),
.form-group input[type="password"]:valid:not(:placeholder-shown),
.form-group input[type="number"]:valid:not(:placeholder-shown) {
  border-color: var(--primary-color);
}

.form-group input[type="text"].error,
.form-group input[type="email"].error,
.form-group input[type="tel"].error,
.form-group input[type="password"].error,
.form-group input[type="number"].error {
  border-color: var(--error-color);
  animation: shake 0.3s;
}

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

.form-group.checkbox {
  margin-top: 8px;
  padding: 8px 0;
}

.checkbox-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  width: 100%;
  margin: 0;
  padding: 0;
}

.checkbox-wrapper span {
  font-size: 0.85rem;
  line-height: 1.6;
  flex: 1;
  margin: 0;
  padding-top: 2px; /* Alignement avec la checkbox */
}

.checkbox-wrapper input[type="checkbox"] {
  width: 24px;
  height: 24px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--primary-color);
  border-radius: 4px;
  min-width: 24px; /* Zone de clic optimale pour mobile */
  flex-shrink: 0;
  flex-grow: 0;
}

.hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 8px;
  text-align: center;
}

.error-message {
  margin-top: 12px;
  padding: 12px;
  font-size: 0.9rem;
  color: var(--error-color);
  background: rgba(229, 62, 62, 0.1);
  border-radius: 8px;
  border-left: 3px solid var(--error-color);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideIn 0.3s ease;
}

.success-message {
  margin-top: 12px;
  padding: 12px;
  font-size: 0.9rem;
  color: var(--secondary-color);
  background: rgba(14, 66, 67, 0.1);
  border-radius: 8px;
  border-left: 3px solid var(--secondary-color);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Tirage & résultat améliorés */
.loading {
  text-align: center;
  padding: 60px 20px;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.spinner {
  width: 120px;
  height: 120px;
  margin: 0 auto 30px;
  display: block;
  border-radius: 12px;
  animation: pulse 2s ease-in-out infinite;
}

.spinner:not([src]) {
  display: none;
}

.spinner-placeholder {
  width: 120px;
  height: 120px;
  margin: 0 auto 30px;
  border: 5px solid rgba(14, 66, 67, 0.15);
  border-top-color: var(--primary-color);
  border-right-color: var(--primary-light);
  border-bottom-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1.2s linear infinite, pulse-ring 2s ease-out infinite;
  display: none; /* Masqué par défaut, affiché seulement si le GIF ne charge pas */
  position: relative;
}

.spinner-placeholder::before {
  content: '';
  position: absolute;
  top: -5px;
  left: -5px;
  right: -5px;
  bottom: -5px;
  border: 3px solid rgba(14, 66, 67, 0.1);
  border-top-color: var(--primary-light);
  border-radius: 50%;
  animation: spin 1.5s linear infinite reverse;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

@keyframes pulse-ring {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.loading p {
  font-size: 1.2rem;
  color: var(--text-primary);
  font-weight: 600;
  margin: 10px 0;
  animation: fadeInOut 2s ease-in-out infinite;
}

.loading p:last-of-type {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 8px;
  animation: none;
}

@keyframes fadeInOut {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

.result {
  text-align: center;
  padding: 20px;
  animation: scaleIn 0.5s ease;
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.result.hidden {
  display: none;
}

.result h2 {
  font-size: 2rem;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.result p {
  font-size: 1.1rem;
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.prize {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 20px 0;
  color: var(--primary-color);
  padding: 16px;
  background: linear-gradient(135deg, rgba(14, 66, 67, 0.15), rgba(14, 66, 67, 0.08));
  border-radius: 12px;
  border: 2px dashed var(--primary-color);
  animation: pulse 2s ease-in-out infinite;
  box-shadow: var(--shadow-green);
}

.prize-list {
  list-style: none;
  padding: 0;
  margin: 0 0 10px;
  color: var(--text-secondary);
  text-align: left;
}

.prize-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 0.95rem;
}

.prize-list li::before {
  content: '•';
  color: var(--primary-color);
}

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

.prize-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  display: block;
}

/* Footer */
.app-footer {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.footer-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
}

/* Badge de vérification */
.verification-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(14, 66, 67, 0.1);
  color: var(--secondary-color);
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  margin-top: 8px;
  border: 1px solid rgba(14, 66, 67, 0.2);
}

/* Responsive amélioré */
@media (max-width: 480px) {
  body {
    padding: 8px;
  }

  .app-container {
    padding: 0;
    max-width: 100%;
  }

  .app-header {
    margin-bottom: 16px;
    padding: 12px 0;
  }

  .logo {
    width: 100px;
    padding: 10px;
    margin-bottom: 16px;
  }

  .app-header h1 {
    font-size: 1.4rem;
    margin-bottom: 8px;
  }

  .card {
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 12px;
  }

  .card h2 {
    font-size: 1.1rem;
    margin-bottom: 12px;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .form-group {
    margin-bottom: 16px;
  }

  .form-group input {
    padding: 14px 14px;
    font-size: 16px;
  }

  .btn-primary,
  .btn-secondary {
    padding: 14px 20px;
    font-size: 0.95rem;
    width: 100%;
  }

  .step-item {
    min-width: 60px;
    padding: 8px 10px;
    font-size: 0.7rem;
  }

  .step-separator {
    max-width: 16px;
  }

  .steps-indicator {
    margin-bottom: 16px;
    gap: 6px;
  }

  .prize {
    font-size: 1.4rem;
    padding: 12px;
  }

  .hint {
    font-size: 0.8rem;
    margin-top: 6px;
  }

  .loading {
    padding: 40px 16px;
    min-height: 250px;
  }

  .spinner,
  .spinner-placeholder {
    width: 100px;
    height: 100px;
    margin-bottom: 24px;
  }

  .loading p {
    font-size: 1.1rem;
  }

  .loading p:last-of-type {
    font-size: 0.9rem;
  }
}

@media (max-width: 360px) {
  body {
    padding: 4px;
  }

  .logo {
    width: 90px;
    padding: 8px;
  }

  .app-header h1 {
    font-size: 1.2rem;
  }

  .card {
    padding: 14px;
  }

  .steps-indicator {
    flex-wrap: wrap;
    gap: 4px;
  }

  .step-separator {
    display: none;
  }

  .step-item {
    flex: 1;
    min-width: auto;
    padding: 6px 8px;
    font-size: 0.65rem;
  }

  .btn-primary,
  .btn-secondary {
    padding: 12px 16px;
    font-size: 0.9rem;
  }

  .prize {
    font-size: 1.2rem;
  }
}

/* Optimisations pour très petits écrans */
@media (max-width: 320px) {
  .logo {
    width: 80px;
  }

  .card {
    padding: 12px;
  }

  .form-group input {
    padding: 12px;
  }
}

/* Animation de confetti pour le résultat */
@keyframes confetti {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(-100vh) rotate(720deg);
    opacity: 0;
  }
}

.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  animation: confetti 3s linear forwards;
  pointer-events: none;
  z-index: 9999;
  border-radius: 50%;
}
