:root {
  --rouge: #ff0033;
  --rouge-fonce: #cc0029;
  --noir: #0a0a0a;
  --gris-fonce: #2b2b2b;
  --gris: #6b6b6b;
  --gris-clair: #e6e6e6;
  --gris-bg: #f5f5f5;
  --blanc: #ffffff;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  color: var(--noir);
  background: var(--gris-bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Header */
.site-header {
  background: var(--blanc);
  border-bottom: 3px solid var(--rouge);
  padding: 20px 16px 16px;
}
.header-inner { max-width: 760px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.logo { height: 30px; width: auto; }
.brand-divider { width: 1px; height: 24px; background: var(--gris-clair); }
.brand-title { font-size: 0.95rem; color: var(--gris-fonce); font-weight: 500; }
.brand-title strong { color: var(--rouge); font-weight: 700; }
.header-sub {
  max-width: 760px;
  margin: 12px auto 0;
  font-size: 0.85rem;
  color: var(--gris);
  font-style: italic;
}

/* Tabs */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 760px;
  margin: 16px auto 0;
  padding: 0 16px;
}
.tab {
  appearance: none;
  border: 1px solid var(--gris-clair);
  background: var(--blanc);
  color: var(--gris-fonce);
  padding: 9px 16px;
  border-radius: 999px;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.tab:hover { border-color: var(--noir); }
.tab.active {
  background: var(--noir);
  color: var(--blanc);
  border-color: var(--noir);
  box-shadow: inset 0 -3px 0 var(--rouge);
}

/* Container */
.container { max-width: 760px; margin: 20px auto 60px; padding: 0 16px; }
.card {
  background: var(--blanc);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.form-intro {
  font-size: 0.9rem;
  color: var(--gris-fonce);
  font-style: italic;
  margin: 0 0 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--gris-clair);
}

/* Gate (ecran d'accueil email) */
.gate { text-align: center; padding: 40px 24px; }
.gate-title { margin: 0 0 8px; font-size: 1.25rem; }
.gate-sub { color: var(--gris-fonce); font-size: 0.9rem; margin: 0 auto 22px; max-width: 420px; }
.gate input[type="email"] {
  max-width: 360px; margin: 0 auto 12px; text-align: center; font-size: 1rem;
}
.gate .btn-primary { max-width: 360px; margin: 0 auto; display: block; width: 100%; }
.gate .form-error { text-align: center; margin-bottom: 12px; }
.gate .form-error a { color: var(--rouge); }
.gate input#code-input {
  max-width: 220px; margin: 0 auto 12px; text-align: center;
  font-size: 1.8rem; letter-spacing: 0.4em; font-weight: 700;
  padding-left: 0.4em;
}
.gate-links {
  display: flex; justify-content: center; gap: 20px;
  margin-top: 16px;
}

/* Identity bar */
.idbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
  font-size: 0.82rem; color: var(--gris);
  padding-bottom: 14px; margin-bottom: 16px;
  border-bottom: 1px solid var(--gris-clair);
}
.idbar strong { color: var(--noir); }
.link-btn {
  appearance: none; background: none; border: none;
  color: var(--rouge); font-family: var(--font); font-size: 0.82rem;
  font-weight: 600; cursor: pointer; padding: 0; text-decoration: underline;
}

/* Progress */
.progress-wrap { margin-bottom: 22px; }
.progress-label { font-size: 0.78rem; color: var(--gris); margin-bottom: 6px; }
.progress-bar {
  height: 6px; background: var(--gris-clair);
  border-radius: 999px; overflow: hidden;
}
.progress-fill {
  height: 100%; width: 0%;
  background: var(--rouge);
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* Fields */
.field { margin-bottom: 22px; }
.field-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 8px;
}
.field-label .req { color: var(--rouge); }
.help-icon {
  flex: 0 0 auto;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--gris);
  color: var(--gris);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
  cursor: pointer;
  background: var(--blanc);
  user-select: none;
  margin-top: 1px;
}
.help-icon:hover { border-color: var(--rouge); color: var(--rouge); }

textarea, input[type="text"], input[type="email"] {
  width: 100%;
  font-family: var(--font);
  font-size: 0.92rem;
  color: var(--noir);
  border: 1px solid var(--gris-clair);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--blanc);
  transition: border-color 0.15s ease;
}
textarea { resize: vertical; min-height: 110px; }
textarea:focus, input:focus {
  outline: none;
  border-color: var(--rouge);
  box-shadow: 0 0 0 3px rgba(255, 0, 51, 0.12);
}

/* Options (radio / checkbox) */
.options { display: flex; flex-direction: column; gap: 8px; }
.option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--gris-clair);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.option:hover { border-color: var(--noir); }
.option input { accent-color: var(--rouge); margin-top: 2px; }
.option.checked { border-color: var(--rouge); background: rgba(255, 0, 51, 0.04); }

/* Scale 1-5 */
.scale { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.scale-options { display: flex; gap: 8px; }
.scale-opt {
  display: flex; flex-direction: column; align-items: center;
  cursor: pointer; font-size: 0.85rem; font-weight: 600;
}
.scale-opt input { display: none; }
.scale-dot {
  width: 40px; height: 40px;
  border: 1.5px solid var(--gris-clair);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s ease;
}
.scale-opt:hover .scale-dot { border-color: var(--noir); }
.scale-opt.checked .scale-dot {
  background: var(--rouge); color: var(--blanc); border-color: var(--rouge);
}
.scale-end { font-size: 0.78rem; color: var(--gris); }

.followup { margin-top: 10px; }
.followup-label { font-size: 0.82rem; color: var(--gris-fonce); margin-bottom: 6px; }

/* Buttons */
.actions { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.btn {
  appearance: none;
  font-family: var(--font);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-primary { background: var(--rouge); color: var(--blanc); }
.btn-primary:hover { background: var(--rouge-fonce); }
.btn-secondary { background: var(--noir); color: var(--blanc); }
.btn-secondary:hover { background: var(--gris-fonce); }
.btn-ghost { background: var(--blanc); color: var(--noir); border-color: var(--gris-clair); }
.btn-ghost:hover { border-color: var(--noir); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.form-error {
  color: var(--rouge);
  font-size: 0.85rem;
  margin-top: 4px;
  min-height: 1em;
}

/* Tooltip bubble */
.tooltip-bubble {
  position: absolute;
  z-index: 1000;
  max-width: 320px;
  background: var(--noir);
  color: var(--blanc);
  font-size: 0.82rem;
  font-style: italic;
  line-height: 1.45;
  padding: 12px 14px;
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}
.tooltip-bubble::after {
  content: '';
  position: absolute;
  top: -6px; left: 16px;
  border-width: 0 6px 6px 6px;
  border-style: solid;
  border-color: transparent transparent var(--noir) transparent;
}

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 16px; z-index: 1100;
}
.modal {
  background: var(--blanc);
  border-radius: var(--radius);
  max-width: 600px; width: 100%;
  max-height: 85vh; overflow-y: auto;
  padding: 24px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.3);
}
.modal h2 { margin: 0 0 16px; font-size: 1.15rem; }
.modal-body {
  background: var(--gris-bg);
  border-radius: 8px;
  padding: 16px;
  font-size: 0.88rem;
  white-space: pre-wrap;
  border-left: 3px solid var(--rouge);
}
.modal-actions {
  display: flex; gap: 10px; margin-top: 18px;
  justify-content: flex-end; flex-wrap: wrap;
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: var(--blanc);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Confirmation */
.confirmation {
  text-align: center;
  padding: 40px 20px;
}
.confirmation .check {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--rouge);
  color: var(--blanc);
  font-size: 1.8rem;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 18px;
}
.confirmation h2 { margin: 0 0 12px; }
.confirmation p { color: var(--gris-fonce); margin: 6px 0; }
.confirmation .sign { margin-top: 20px; font-weight: 600; color: var(--rouge); }

@media (max-width: 520px) {
  .scale-dot { width: 34px; height: 34px; }
  .brand-title { font-size: 0.82rem; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
}
