/* ===========================
   L'ANGE-RIZ - Questionnaire
   Mobile-first design
   =========================== */

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Poppins', 'Noto Sans JP', sans-serif;
  background-color: #FAFAF8;
  color: #1A1A1A;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* --- Container --- */
.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
}

/* --- Header --- */
.header {
  text-align: center;
  padding: 1.5rem 0 1.25rem;
}

.logo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 0.5rem;
}

.header h1 {
  font-family: 'Noto Sans JP', serif;
  font-size: 1.75rem;
  color: #2D5016;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.subtitle {
  color: #666;
  font-size: 0.9rem;
}

/* --- Question Groups --- */
.question-group {
  border: none;
  margin-bottom: 1.5rem;
  padding: 0;
}

.question-group legend {
  font-weight: 600;
  font-size: 1rem;
  color: #2D5016;
  margin-bottom: 0.6rem;
  display: block;
  width: 100%;
}

.q-number {
  font-weight: 700;
  margin-right: 0.15em;
}

.q-hint {
  font-weight: 400;
  font-size: 0.78rem;
  color: #888;
}

/* --- Radio Cards --- */
.radio-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.radio-group.three-cols {
  grid-template-columns: 1fr 1fr 1fr;
}

.radio-card {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 0.4rem;
  background: #FFFFFF;
  border: 2px solid #E0E0E0;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  min-height: 48px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.radio-card input[type="radio"],
.radio-card input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.radio-card:has(input:checked),
.radio-card.checked {
  border-color: #2D5016;
  background-color: #EFF5EB;
  box-shadow: 0 0 0 1px #2D5016;
}

.radio-card:active {
  transform: scale(0.97);
}

.radio-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #333;
  pointer-events: none;
}

/* --- "Autre" Input --- */
.autre-input {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.75rem;
  border: 2px solid #E0E0E0;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.9rem;
  background: #FFFFFF;
  transition: border-color 0.2s;
}

.autre-input:focus {
  outline: none;
  border-color: #2D5016;
}

.autre-input.input-error {
  border-color: #C0392B;
}

/* --- Textarea --- */
textarea {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #E0E0E0;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.9rem;
  background: #FFFFFF;
  resize: vertical;
  min-height: 100px;
  transition: border-color 0.2s;
}

textarea:focus {
  outline: none;
  border-color: #2D5016;
}

/* --- Prenom input --- */
.prenom-input {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #E0E0E0;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.9rem;
  background: #FFFFFF;
  transition: border-color 0.2s;
}

.prenom-input:focus {
  outline: none;
  border-color: #2D5016;
}

.prenom-hint {
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: #999;
  font-style: italic;
}

/* --- Submit Button --- */
.submit-btn {
  display: block;
  width: 100%;
  padding: 1rem;
  margin-top: 0.5rem;
  background: #2D5016;
  color: #FFFFFF;
  border: none;
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.submit-btn:active:not(:disabled) {
  transform: scale(0.98);
  background: #224010;
}

.submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* --- Validation Error --- */
.question-group.error legend {
  color: #C0392B;
}

.question-group.error .radio-card {
  border-color: #F5C6CB;
}

/* --- Success / Error Messages --- */
.message {
  text-align: center;
  padding: 3rem 1.5rem;
  border-radius: 16px;
  margin-top: 2rem;
}

.message.success {
  background: #EFF5EB;
  color: #2D5016;
}

.message.error {
  background: #FDEDEC;
  color: #C0392B;
}

.message-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
}

.message h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.message p {
  font-size: 1rem;
}

.already-done-hint {
  margin-top: 1rem;
  font-size: 0.85rem !important;
  color: #666;
}

.already-done-hint a {
  color: #2D5016;
  font-weight: 600;
}

/* --- Page roue : ecran code --- */
.code-page-section {
  text-align: center;
  padding: 2rem 0;
}

.code-page-intro {
  font-size: 1.05rem;
  color: #333;
  margin-bottom: 1.25rem;
  font-weight: 500;
}

/* --- Code de deblocage --- */
.code-section {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid #D0DFC9;
}

.code-intro {
  font-size: 0.85rem !important;
  color: #666;
  margin-bottom: 0.75rem;
}

.code-form {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.code-input {
  width: 140px;
  padding: 0.6rem 0.75rem;
  border: 2px solid #E0E0E0;
  border-radius: 10px;
  font-family: monospace;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.code-input:focus {
  outline: none;
  border-color: #2D5016;
}

.code-btn {
  padding: 0.6rem 1.25rem;
  background: #2D5016;
  color: #FFFFFF;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.code-btn:active {
  transform: scale(0.97);
}

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

.code-error {
  margin-top: 0.5rem;
  font-size: 0.8rem !important;
  color: #C0392B !important;
}

.merci-confiance {
  margin-top: 1rem;
  font-size: 0.85rem !important;
  opacity: 0.7;
}

.retry-btn {
  margin-top: 1rem;
  padding: 0.75rem 2rem;
  background: #C0392B;
  color: #FFFFFF;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.retry-btn:active {
  transform: scale(0.98);
}

/* --- Roue de la chance --- */
.wheel-section {
  text-align: center;
  padding: 1.5rem 0;
}

.wheel-title {
  font-size: 1.5rem;
  color: #2D5016;
  margin-bottom: 0.25rem;
}

.wheel-subtitle {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.wheel-container {
  display: flex;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.wheel-container canvas {
  max-width: 100%;
  height: auto;
}

/* Legende sous la roue */
.wheel-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 1rem;
  margin-bottom: 1.25rem;
  padding: 0 0.5rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-text {
  font-size: 0.78rem;
  color: #333;
  white-space: nowrap;
}

.spin-btn {
  display: inline-block;
  padding: 0.9rem 2.5rem;
  background: #D4A843;
  color: #FFFFFF;
  border: none;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  letter-spacing: 0.02em;
}

.spin-btn:active:not(:disabled) {
  transform: scale(0.97);
  background: #B8912E;
}

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

/* Choix garder / retenter */
.prize-choice {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: #FFF9EE;
  border-radius: 16px;
  border: 2px solid #D4A843;
}

.choice-label {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 0.5rem;
}

.choice-prize {
  margin-bottom: 0.75rem;
}

.choice-prize-emoji {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 0.25rem;
}

.choice-prize-text {
  font-size: 1.2rem;
  font-weight: 700;
  color: #2D5016;
}

.choice-question {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 1rem;
  font-style: italic;
}

.choice-buttons {
  display: flex;
  gap: 0.5rem;
}

.choice-btn {
  flex: 1;
  padding: 0.75rem 0.5rem;
  border: none;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.1s;
}

.choice-btn:active {
  transform: scale(0.97);
}

.keep-btn {
  background: #2D5016;
  color: #FFFFFF;
}

.retry-btn-wheel {
  background: #D4A843;
  color: #FFFFFF;
}

/* Resultat du lot */
.prize-result {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: #EFF5EB;
  border-radius: 16px;
  border: 2px solid #2D5016;
}

.prize-emoji {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.prize-text {
  font-size: 1.3rem;
  font-weight: 700;
  color: #2D5016;
  margin-bottom: 0.5rem;
}

.prize-hint {
  font-size: 0.85rem;
  color: #666;
}

/* --- Utility --- */
.hidden {
  display: none !important;
}

/* --- Footer --- */
footer {
  text-align: center;
  padding: 2rem 0 1rem;
  color: #999;
  font-size: 0.8rem;
}

/* --- Desktop enhancement --- */
@media (min-width: 600px) {
  .container {
    padding: 2rem;
  }

  .radio-group {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  }

  .radio-group.three-cols {
    grid-template-columns: 1fr 1fr 1fr;
  }
}
