:root {
  --bg: #f6f1e9;
  --card: #ffffff;
  --text: #2b2622;
  --muted: #6d645b;
  --accent: #c8702f;
  --accent-dark: #a85a20;
  --border: #e3d9cc;
  --option-bg: #fbf8f3;
  --option-checked: #fbeadb;
  --info-bg: #fff7d6;
  --error: #b3261e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.55;
  padding: 24px 16px;
}

.card {
  max-width: 720px;
  margin: 0 auto;
  background: var(--card);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 2px 16px rgba(60, 40, 20, 0.08);
}

h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 16px; }
h2 { font-size: 1.25rem; line-height: 1.35; margin: 0 0 8px; }

.badge {
  display: inline-block;
  background: var(--option-checked);
  color: var(--accent-dark);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
  margin: 0 0 16px;
}

.progress { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin-bottom: 20px; }
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width 0.3s; }

.section-name {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-dark);
  margin: 0 0 8px;
}

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; width: 100%; }

.hint { color: var(--muted); margin: 0 0 16px; }
.type-hint { color: var(--muted); font-size: 0.9rem; font-style: italic; margin: 0 0 12px; }

.info {
  background: var(--info-bg);
  border-left: 4px solid #e8c14a;
  padding: 12px 16px;
  border-radius: 8px;
  margin: 0 0 16px;
}

.options { display: flex; flex-direction: column; gap: 10px; }

.option {
  display: block;
  background: var(--option-bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.option:hover { border-color: var(--accent); }
.option:has(input:checked) { border-color: var(--accent); background: var(--option-checked); }
.option-row { display: flex; gap: 10px; align-items: flex-start; }
.option input[type="radio"], .option input[type="checkbox"] {
  margin-top: 4px; accent-color: var(--accent); width: 18px; height: 18px; flex-shrink: 0;
}
.option-detail { display: block; color: var(--muted); font-size: 0.9rem; margin-top: 2px; }

.option-text, .free-text {
  width: 100%;
  margin-top: 10px;
  padding: 10px 12px;
  font: inherit;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
.option-text:focus, .free-text:focus { outline: none; border-color: var(--accent); }

/* Question à points (0 à 3) */
.points-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--option-bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
}
.points-label { flex: 1 1 260px; }
.points-box { display: flex; flex-direction: column; gap: 4px; }
.points-legend {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 0.75rem; color: var(--muted); white-space: nowrap;
}
.points-scale { display: flex; gap: 6px; }
.points-scale label { position: relative; }
.points-scale input { position: absolute; opacity: 0; inset: 0; }
.points-scale span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1.5px solid var(--border); background: #fff; font-weight: 600; cursor: pointer;
}
.points-scale input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.points-scale input:focus-visible + span { outline: 2px solid var(--accent-dark); outline-offset: 2px; }

/* Champs de contact (question 23) */
.option-fields { margin-top: 10px; }
.option-fields .option-detail { margin: 0; }
.field { margin-top: 10px; }
.field-label { display: block; font-size: 0.9rem; font-weight: 600; }
.field .option-text { margin-top: 4px; }

/* Partage en fin de questionnaire */
.share {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.share-status { color: var(--muted); font-size: 0.9rem; margin: 12px 0 0; overflow-wrap: anywhere; }

.error { color: var(--error); font-weight: 600; margin: 16px 0 0; }

.actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; }
#screen-intro .actions { justify-content: flex-end; }
#screen-intro li + li { margin-top: 12px; }

.btn {
  font: inherit; font-weight: 600;
  padding: 12px 24px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); }
.btn:disabled { opacity: 0.6; cursor: wait; }

@media (max-width: 560px) {
  body { padding: 12px; }
  .card { padding: 20px 16px; border-radius: 12px; }
  h1 { font-size: 1.35rem; }
  h2 { font-size: 1.1rem; }
}

/* Indicateur de calcul ALTCHA (affiché en local uniquement, voir app.js) */
.altcha-spinner {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 22px;
  height: 22px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: altcha-spin 0.8s linear infinite;
}
.altcha-spinner[hidden] { display: none; }
@keyframes altcha-spin { to { transform: rotate(360deg); } }
