:root,
[data-theme="dark"] {
  --bg: #0f172a;
  --card: #111827;
  --surface: #1e293b;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --accent: #22d3ee;
  --accent-deep: #06b6d4;
  --accent-soft: rgba(34, 211, 238, 0.14);
  --accent-soft-strong: rgba(34, 211, 238, 0.3);
  --accent-gradient: linear-gradient(90deg, var(--accent-deep), var(--accent));
  --bg-gradient: radial-gradient(1000px 600px at 10% 0%, #0b1220, var(--bg));
  --layer-1: rgba(255, 255, 255, 0.04);
  --layer-2: rgba(255, 255, 255, 0.025);
  --layer-3: rgba(255, 255, 255, 0.06);
  --border-soft: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.12);
  --input-bg: #0b1020;
  --safe-top: env(safe-area-inset-top, 0);
  --safe-bottom: env(safe-area-inset-bottom, 0);
}

[data-theme="light"] {
  --bg: #f8fafc;
  --card: #ffffff;
  --surface: #f1f5f9;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #0891b2;
  --accent-deep: #0e7490;
  --accent-soft: rgba(8, 145, 178, 0.12);
  --accent-soft-strong: rgba(8, 145, 178, 0.24);
  --bg-gradient: radial-gradient(1000px 600px at 10% 0%, #e0f2fe, var(--bg));
  --layer-1: rgba(15, 23, 42, 0.035);
  --layer-2: rgba(15, 23, 42, 0.02);
  --layer-3: rgba(15, 23, 42, 0.05);
  --border-soft: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.14);
  --input-bg: #ffffff;
  color-scheme: light;
}

* { box-sizing: border-box; }

/* Désactive le zoom au double-tap iOS (sans bloquer le pinch d'accessibilité) */
html, body { touch-action: manipulation; }

/* L'attribut [hidden] doit toujours l'emporter sur display:flex/grid/etc. */
[hidden] { display: none !important; }

/* Mode "app" : on est dans le flux défis, plus sur la page marketing du quiz */
body.is-app-view > main > header,
body.is-app-view > main > #restart-wrapper {
  display: none !important;
}
body.is-app-view {
  background-image: none;
}

/* ---------- Écran de connexion (gate avant l'app) ---------- */

.view-signin {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(2rem + var(--safe-top)) 1.25rem calc(2rem + var(--safe-bottom));
  background-color: var(--bg);
  background-image: radial-gradient(800px 500px at 50% 20%, rgba(34, 211, 238, 0.12), transparent),
                    radial-gradient(1000px 600px at 10% 0%, #0b1220, var(--bg));
}

.signin-card {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
  text-align: center;
}

.signin-logo {
  width: 84px;
  height: 84px;
  border-radius: 22px;
  border: 2px solid rgba(255,255,255,0.14);
  box-shadow: 0 12px 30px rgba(9, 9, 11, 0.45);
  object-fit: cover;
  background: rgba(15, 23, 42, 0.6);
}

.signin-title {
  margin: 0;
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.signin-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 340px;
}

.signin-google-btn {
  margin-top: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  max-width: 320px;
  padding: 0.95rem 1.25rem;
  min-height: 52px;
  border-radius: 12px;
  background: #fff;
  color: #1f2937;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease, opacity 0.2s ease;
}
.signin-google-btn:hover { opacity: 0.92; }
.signin-google-btn:active { transform: scale(0.98); }

.signin-google-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4285F4, #34A853 50%, #FBBC05 75%, #EA4335);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
}

.signin-error {
  margin: 0;
  padding: 0.6rem 0.85rem;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fecaca;
  font-size: 0.85rem;
  font-weight: 600;
}

.signin-hint {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

/* Quand on est sur l'écran signin : on cache tout le reste */
body.is-signed-out > main.container,
body.is-signed-out > .bottom-nav,
body.is-signed-out > .account-btn,
body.is-signed-out > .account-panel {
  display: none !important;
}

/* ---------- États vides : Défis et Moi avant le quiz ---------- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  flex: 1;
  padding: 1.5rem 0.5rem;
}
.empty-state-emoji {
  font-size: 2.6rem;
  line-height: 1;
}
.empty-state-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
}
.empty-state-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
  max-width: 320px;
}
.empty-state .cta-link {
  margin-top: 4px;
  width: 100%;
  max-width: 260px;
}

/* ---------- Avatar compte top-right + panel ---------- */

.account-btn {
  position: fixed;
  top: calc(8px + var(--safe-top));
  right: 12px;
  width: 40px;
  height: 40px;
  padding: 0;
  margin: 0;
  min-height: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.14);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease, background 0.15s ease;
}
.account-btn:hover { background: var(--accent-soft-strong); }
.account-btn:active { transform: scale(0.95); }
.account-btn-initial {
  line-height: 1;
}

.account-panel {
  position: fixed;
  inset: 0;
  z-index: 100;
}
.account-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 0.18s ease-out;
}
.account-panel.is-open .account-overlay { opacity: 1; }

.account-menu {
  position: absolute;
  top: calc(56px + var(--safe-top));
  right: 12px;
  width: min(calc(100% - 24px), 340px);
  background: rgba(17, 24, 39, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  transform: translateY(-6px) scale(0.98);
  opacity: 0;
  transition: transform 0.18s ease-out, opacity 0.18s ease-out;
  max-height: calc(100vh - 80px - var(--safe-top));
  max-height: calc(100dvh - 80px - var(--safe-top));
  overflow-y: auto;
}
.account-panel.is-open .account-menu {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.account-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.account-menu-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}
.account-close-btn {
  margin: 0;
  padding: 0;
  width: 28px;
  height: 28px;
  min-height: 0;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.account-close-btn:hover { color: var(--text); }

.account-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.account-field-label {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.account-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.account-field input[type="text"] {
  margin: 0;
}

.theme-modes {
  display: flex;
  gap: 8px;
}
.theme-mode {
  flex: 1;
  margin: 0;
  padding: 0.6rem 0.5rem;
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  background: var(--layer-1);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.theme-mode:hover { color: var(--text); }
.theme-mode.is-active {
  background: var(--accent-soft);
  border-color: var(--accent-soft-strong);
  color: var(--accent);
}

.account-section-google {
  border-top: 1px solid var(--layer-3);
  padding-top: 0.75rem;
}
.account-google-btn {
  margin: 0;
  padding: 0.65rem 0.9rem;
  min-height: 44px;
  background: #fff;
  color: #1f2937;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  -webkit-tap-highlight-color: transparent;
}
.account-google-btn span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4285F4, #34A853 50%, #FBBC05 75%, #EA4335);
  color: #fff;
  font-weight: 800;
  font-size: 0.75rem;
}
.account-google-btn:hover { background: #f3f4f6; }

.account-google-signed {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 12px;
}
.account-google-signed img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}
.account-google-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.account-google-meta strong {
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-google-meta span {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-section-danger {
  border-top: 1px solid var(--layer-3);
  padding-top: 0.5rem;
  text-align: right;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  /* force un layer GPU : fixe le bug iOS PWA où fixed bouge au scroll */
  transform: translateZ(0);
  -webkit-transform: translate3d(0, 0, 0);
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  background: rgba(17, 24, 39, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  z-index: 50;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 4px;
  min-height: 52px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 10px;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s ease, background 0.15s ease;
}

.bottom-nav-item.is-active {
  color: var(--accent);
  background: rgba(34, 211, 238, 0.08);
}

.bottom-nav-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.bottom-nav-label {
  font-size: 0.7rem;
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  background-color: var(--bg);
}

body {
  margin: 0;
  min-height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial, sans-serif;
  background-color: var(--bg);
  background-image: var(--bg-gradient);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
/* Quand la bottom nav est visible, on réserve la place en bas pour qu'elle
   ne recouvre pas le contenu. */
body.has-nav {
  padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}

.container {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: calc(1rem + var(--safe-top)) 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100vh;
  min-height: 100dvh;
}

body.has-nav main.container {
  min-height: calc(100vh - 72px - env(safe-area-inset-bottom, 0px));
  min-height: calc(100dvh - 72px - env(safe-area-inset-bottom, 0px));
}

/* Sur un écran "app", la vue active remplit la place entre le haut et la bottom nav. */
body.is-app-view main.container > .card.view:not([hidden]) {
  flex: 1;
}
header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
h1 { margin: 0; font-weight: 700; }
.subtitle { margin: 0; color: var(--muted); }

.logo {
  width: 80px;
  height: 80px;
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(9, 9, 11, 0.35);
  border: 2px solid rgba(255,255,255,0.15);
  object-fit: cover;
  background: rgba(15, 23, 42, 0.6);
}

@media (min-width: 480px) {
  .logo {
    width: 96px;
    height: 96px;
    border-radius: 20px;
  }
}

.card {
  background: linear-gradient(180deg, var(--layer-1), var(--layer-2));
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 1.25rem 1rem;
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  box-shadow: 0 24px 60px rgba(8, 15, 31, 0.35);
}

@media (min-width: 480px) {
  .card {
    padding: 28px;
    border-radius: 20px;
    gap: 24px;
  }
}

.card.is-final {
  text-align: center;
}


.card.is-final .question-fieldset,
.card.is-final #answer-form button[type="submit"] {
  display: none !important;
}

.final-message {
  margin: 16px 0 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #22d3ee;
}

/* Résultat : camembert + légende (couleurs du logo) */
.result-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  margin-top: 0.5rem;
  text-align: center;
}

.result-chart {
  width: 200px;
  height: 200px;
  position: relative;
  flex-shrink: 0;
  touch-action: none;
}

.result-chart svg {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.result-chart path.segment {
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.result-chart path.segment:hover {
  opacity: 0.9;
}

.result-chart path.segment:active {
  opacity: 1;
}

.result-chart-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translate(-50%, -8px);
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.1);
  pointer-events: none;
  z-index: 10;
}


.result-legend {
  list-style: none;
  padding: 0;
  margin: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.result-legend li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--layer-3);
  text-align: left;
}

.result-legend li.dominant {
  background: var(--layer-3);
  border-color: var(--border-strong);
  font-weight: 600;
}

.result-legend .legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.2);
}

.result-legend .legend-content {
  flex: 1;
  min-width: 0;
}

.result-legend .legend-label {
  font-weight: 500;
  color: var(--text);
}

.result-legend .legend-pct {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--muted);
  font-size: 0.95rem;
}

.result-legend .legend-desc {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 400;
  margin-top: 0.2rem;
}

.result-dominant {
  margin: 0;
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.4;
  max-width: 100%;
}

#question-label {
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: var(--muted);
}

.question-index {
  display: inline-flex;
  align-items: center;
  font-size: 1.05rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 800;
  color: rgba(148, 163, 184, 0.95);
}

.question-text {
  font-size: 1.2rem;
  color: var(--text);
}

.question-fieldset {
  border: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

#answer-form button[type="submit"] {
  display: none;
}

.options-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 18px;
}

.option-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 1rem 1rem;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: rgba(15, 23, 42, 0.5);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.option-card:hover {
  border-color: rgba(34, 211, 238, 0.35);
}

.option-card input[type="radio"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.option-card .option-label {
  flex: 1;
  color: var(--text);
}

.option-card input[type="radio"]:checked + .option-label {
  color: var(--accent);
  font-weight: 600;
}





input[type="text"],
input[type="number"],
input[type="search"],
textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 16px; /* >= 16px pour empêcher iOS de zoomer au focus */
  resize: vertical;
  -webkit-tap-highlight-color: transparent;
}
textarea {
  min-height: 88px;
}
button {
  margin-top: 12px;
  padding: 0.75rem 1.25rem;
  min-height: 44px;
  border-radius: 10px;
  border: none;
  background: var(--accent-gradient);
  color: #06101a;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.status { margin-top: 12px; color: var(--accent); min-height: 20px; }
.status[data-type="error"] { color: #fca5a5; }
.status[data-type="info"] { color: var(--accent); }


.admin-link {
  text-align: center;
  margin-top: 16px;
}
.admin-link a {
  color: var(--accent);
  padding: 0.5rem 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.admin-link a:hover {
  text-decoration: underline;
}
.admin-link .link-button {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.5rem 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.admin-link .link-button:hover {
  text-decoration: underline;
}

.stack { display: flex; flex-direction: column; gap: 8px; }
.inline { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.muted { color: var(--muted); }
.small-note { margin: 0 0 12px; font-size: 0.85rem; }

.admin-section h2 { margin-top: 0; margin-bottom: 12px; }

.question-list { display: flex; flex-direction: column; gap: 20px; }
.question-item { border: 1px solid var(--border-soft); padding: 16px; border-radius: 12px; background: rgba(15, 23, 42, 0.6); }
.question-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.question-actions button {
  margin-top: 0;
  min-height: 44px;
  padding: 0.5rem 1rem;
}
.question-actions .secondary {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.24);
  color: var(--text);
}
.question-header { display: flex; align-items: center; gap: 12px; font-size: 0.9rem; }
.question-meta { color: var(--muted); }
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.25);
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.badge-active { background: rgba(34, 211, 238, 0.16); color: var(--accent); }

.options-builder {
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(11, 18, 32, 0.35);
}

.options-builder legend {
  font-weight: 600;
  color: var(--text);
}

.options-builder-list {
  display: grid;
  gap: 12px;
}

.option-row {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  padding: 12px;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-row-main {
  display: grid;
  gap: 12px;
}

@media (min-width: 640px) {
  .option-row-main {
    grid-template-columns: 1.4fr 1fr auto;
    align-items: end;
  }
}

.option-row input[type="text"],
.option-row input[type="number"] {
  margin: 0;
}

.weights-grid {
  display: grid;
  gap: 10px;
}

@media (min-width: 520px) {
  .weights-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.weights-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--muted);
}

.option-remove {
  border: 1px solid rgba(255,255,255,0.24);
  background: transparent;
  color: var(--muted);
  padding: 0.5rem 1rem;
  min-height: 44px;
  border-radius: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.option-remove:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.builder-actions {
  display: flex;
  justify-content: flex-end;
}

.options-builder {
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.options-builder legend {
  font-weight: 600;
  color: var(--text);
}

.options-builder-list {
  display: grid;
  gap: 12px;
}

.option-row {
  display: grid;
  gap: 8px;
}

@media (min-width: 640px) {
  .option-row {
    grid-template-columns: 1.2fr 1fr auto;
    align-items: center;
  }
}

.option-row input[type="text"],
.option-row input[type="search"] {
  margin: 0;
}

.option-remove {
  border: 1px solid rgba(255,255,255,0.24);
  background: transparent;
  color: var(--muted);
  padding: 0.5rem 1rem;
  min-height: 44px;
  border-radius: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.builder-actions {
  display: flex;
  justify-content: flex-end;
}

/* ---------- Défis hebdomadaires ---------- */

.reminder-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  background: rgba(250, 204, 21, 0.15);
  border: 1px solid rgba(250, 204, 21, 0.4);
  color: #fde68a;
}
.reminder-banner > span {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 600;
}
.reminder-banner .reminder-banner-cta {
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  background: rgba(250, 204, 21, 0.3);
  color: #78350f;
  font-weight: 700;
  text-decoration: none;
  font-size: 0.85rem;
  -webkit-tap-highlight-color: transparent;
}
.reminder-banner .reminder-banner-cta:hover { background: rgba(250, 204, 21, 0.5); }
.reminder-banner #reminder-banner-close {
  margin: 0;
  padding: 0;
  width: 28px;
  height: 28px;
  min-height: 0;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: #fde68a;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.reminder-banner #reminder-banner-close:hover { background: var(--border-soft); }


.cta-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.25rem;
  min-height: 48px;
  border-radius: 12px;
  background: var(--accent-gradient);
  color: #06101a;
  font-weight: 700;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s ease, opacity 0.2s ease;
}
.cta-link:hover { opacity: 0.92; }
.cta-link:active { transform: scale(0.98); }
.cta-link.is-disabled {
  opacity: 0.55;
  pointer-events: none;
  background: var(--border-soft);
  color: var(--muted);
}
.cta-link-ghost {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.18);
  color: var(--text);
}

.result-cta {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-top: 1rem;
}

.view .view-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}

/* Vue « Tempérament » : compact, tient sur une page sans scroll. */
#view-temperament {
  align-items: center;
  gap: 0.9rem;
}
.temperament-greeting {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  letter-spacing: -0.01em;
}
#view-temperament #temperament-chart {
  width: min(160px, 28vh);
  height: min(160px, 28vh);
  align-self: center;
  margin: 0 auto;
}
#view-temperament .result-legend {
  width: 100%;
  gap: 0.4rem;
}
#view-temperament .result-legend li {
  padding: 0.5rem 0.75rem;
  gap: 0.6rem;
}
#view-temperament .result-legend .legend-desc {
  font-size: 0.75rem;
  line-height: 1.35;
}
#view-temperament .hub-actions {
  width: 100%;
  margin-top: auto;
}

/* Vue Moi : plante + bien-être + badges */
#view-moi {
  gap: 1.25rem;
}

.moi-header {
  text-align: center;
}
.moi-eyebrow {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 4px;
}
.moi-title {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
}

.moi-plant {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 1rem 0 0.5rem;
}
.moi-plant-svg {
  width: min(190px, 36vh);
  height: min(190px, 36vh);
}
.moi-plant-svg svg { width: 100%; height: 100%; display: block; }
.moi-plant-stage {
  margin: 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.4;
}

.moi-block {
  padding: 1rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.moi-block-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}
.moi-block-subtitle {
  margin: 0 0 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.moi-block-help {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}

/* Bien-être : sliders */
.wellbeing-form {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.wellbeing-row {
  display: grid;
  grid-template-columns: 80px 1fr 28px;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
}
.wellbeing-label {
  color: var(--text);
  font-weight: 600;
}
.wellbeing-row input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: var(--border-soft);
  border-radius: 999px;
  outline: none;
}
.wellbeing-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--card);
}
.wellbeing-row input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--card);
}
.wellbeing-row input[type="range"]:disabled::-webkit-slider-thumb {
  background: var(--muted);
}
.wellbeing-row output {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  font-weight: 700;
}
.wellbeing-feedback {
  margin: 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
}

.wellbeing-trend {
  border-top: 1px solid var(--layer-3);
  padding-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wellbeing-chart {
  width: 100%;
  height: 100px;
  background: rgba(0,0,0,0.18);
  border-radius: 8px;
}
.wellbeing-legend {
  display: flex;
  gap: 14px;
  font-size: 0.75rem;
  color: var(--muted);
  flex-wrap: wrap;
}
.wellbeing-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}

.moi-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.moi-reset {
  text-align: center;
  margin: 1rem 0 0;
}
.link-button-muted {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.8rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 0.5rem 0;
  -webkit-tap-highlight-color: transparent;
}
.link-button-muted:hover {
  color: #fca5a5;
}

.temperament-headline {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
}
.temperament-headline .tmp-headline-label {
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.temperament-headline .tmp-headline-name {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.1;
}
.temperament-headline .tmp-headline-desc {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text);
  opacity: 0.9;
  line-height: 1.4;
}

.view .view-sub {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}

/* Question du lundi */
.weekly-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.weekly-option {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 1rem;
  min-height: 64px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: rgba(15, 23, 42, 0.55);
  color: var(--text);
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
  margin: 0;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.weekly-option:hover { border-color: rgba(34, 211, 238, 0.35); }
.weekly-option:active { transform: scale(0.99); }

.weekly-option-emoji { font-size: 1.6rem; }
.weekly-option-label { font-weight: 600; }
.weekly-option-hint {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Hub — version visuelle */

#view-hub {
  align-items: stretch;
  gap: 1rem;
}

.hub-ring {
  position: relative;
  width: min(220px, 50vw);
  align-self: center;
  aspect-ratio: 1 / 1;
  margin: 0.25rem auto 0;
}
.hub-ring-svg {
  width: 100%;
  height: 100%;
  display: block;
}
.hub-ring-track {
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 14;
}
.hub-ring-fg {
  stroke: var(--accent);
  stroke-width: 14;
  transition: stroke-dashoffset 0.5s ease, stroke 0.3s ease;
}
.hub-ring-fg.is-complete {
  stroke: #22c55e;
}
.hub-ring-fg.pulse-ring {
  animation: pulse-ring 0.6s ease-out;
}
@keyframes pulse-ring {
  0%   { filter: drop-shadow(0 0 0 rgba(34, 197, 94, 0)); }
  50%  { filter: drop-shadow(0 0 14px rgba(34, 197, 94, 0.6)); }
  100% { filter: drop-shadow(0 0 0 rgba(34, 197, 94, 0)); }
}

.hub-ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  text-align: center;
}
.hub-ring-num {
  font-size: 3.2rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--text);
}
.hub-ring-suffix {
  font-size: 1rem;
  font-weight: 700;
  color: var(--muted);
  margin-top: 2px;
}
.hub-ring-label {
  margin-top: 6px;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

/* 7 dots de la semaine */
.hub-week-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}
.week-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid transparent;
  transition: transform 0.2s ease, background 0.2s ease;
}
.week-dot.is-yes { background: #22c55e; }
.week-dot.is-partial { background: #f97316; }
.week-dot.is-no { background: #ef4444; }
.week-dot.is-missed { background: var(--layer-1); }
.week-dot.is-today {
  width: 18px;
  height: 18px;
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.18);
  border-color: var(--accent);
}
.week-dot.pulse-in {
  animation: pulse-dot 0.55s ease-out;
}
@keyframes pulse-dot {
  0%   { transform: scale(1); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
  50%  { transform: scale(1.5); box-shadow: 0 0 0 8px rgba(34, 197, 94, 0.18); }
  100% { transform: scale(1); box-shadow: 0 0 0 12px rgba(34, 197, 94, 0); }
}

/* Méta : niveau + streak */
.hub-meta {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.hub-meta-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.14);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.hub-meta-streak {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.hub-meta-streak.is-on { color: #fde68a; }
.hub-meta-streak .streak-icon {
  font-size: 0.55rem;
  color: #f59e0b;
}

/* Action : titre + description + pourquoi repliable */
.hub-action {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 0.25rem;
}

.hub-title {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--text);
  letter-spacing: -0.01em;
}

.hub-description {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.hub-why-collapse {
  margin: 4px auto 0;
  font-size: 0.85rem;
}
.hub-why-collapse summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  -webkit-tap-highlight-color: transparent;
}
.hub-why-collapse summary::-webkit-details-marker { display: none; }
.hub-why-collapse summary::after {
  content: '▾';
  font-size: 0.7rem;
  transition: transform 0.2s;
}
.hub-why-collapse[open] summary::after { transform: rotate(180deg); }
.hub-why-collapse p {
  margin: 8px auto 0;
  max-width: 90%;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.85rem;
}

.hub-description {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.4;
}

.hub-why {
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  background: rgba(255,255,255,0.03);
}
.hub-why summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
}
.hub-why p {
  margin: 0.6rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.hub-progress {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.progress-day {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  background: rgba(255,255,255,0.03);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.progress-day.is-yes {
  background: rgba(34, 197, 94, 0.22);
  border-color: rgba(34, 197, 94, 0.55);
  color: #bbf7d0;
}
.progress-day.is-partial {
  background: rgba(249, 115, 22, 0.2);
  border-color: rgba(249, 115, 22, 0.55);
  color: #fed7aa;
}
.progress-day.is-no {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.5);
  color: #fecaca;
}
.progress-day.is-missed {
  background: var(--layer-2);
  color: rgba(148, 163, 184, 0.4);
}
.progress-day.is-today {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

@keyframes pulse-day {
  0%   { transform: scale(1);    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45); }
  45%  { transform: scale(1.15); box-shadow: 0 0 0 10px rgba(34, 197, 94, 0.18); }
  100% { transform: scale(1);    box-shadow: 0 0 0 14px rgba(34, 197, 94, 0); }
}
.progress-day.pulse-in {
  animation: pulse-day 0.55s ease-out;
}

.hub-progress-hint {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}
.hub-progress-hint strong { color: var(--text); font-weight: 700; }
.hub-progress-hint .hub-progress-legend {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.75rem;
  opacity: 0.75;
}

.hub-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Check-in inline : un geste, un bouton principal, deux alternatives sobres */
.hub-checkin {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
}
.hub-checkin.is-done .hub-checkin-feedback {
  display: block;
}
.checkin-primary {
  margin: 0;
  padding: 1.1rem 1rem;
  min-height: 60px;
  border: none;
  border-radius: 14px;
  background: var(--accent-gradient);
  color: #06101a;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s ease, opacity 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 6px 20px rgba(34, 211, 238, 0.25);
}
.checkin-primary:hover { opacity: 0.94; }
.checkin-primary:active { transform: scale(0.985); }
.checkin-primary:disabled {
  background: rgba(34, 197, 94, 0.18);
  color: #bbf7d0;
  opacity: 1;
  cursor: default;
  box-shadow: none;
}
.hub-checkin-alt {
  display: flex;
  gap: 8px;
}
.checkin-alt {
  flex: 1;
  margin: 0;
  padding: 0.55rem 0.5rem;
  min-height: 38px;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--border-strong);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.checkin-alt:hover { border-color: rgba(34, 211, 238, 0.35); color: var(--text); }
.checkin-alt:disabled {
  opacity: 0.4;
  cursor: default;
}
.hub-checkin.is-done .checkin-primary,
.hub-checkin.is-done .hub-checkin-alt {
  display: none;
}
.hub-checkin-feedback {
  margin: 0;
  text-align: center;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.4;
}
.hub-checkin.is-done .hub-checkin-feedback {
  color: #bbf7d0;
}

.hub-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 0.75rem;
  border-top: 1px solid var(--layer-3);
  margin-top: auto;
}

.hub-streak {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.hub-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}
.hub-link:hover { text-decoration: underline; }

/* Check-in */
.checkin-description {
  margin: 0;
  color: var(--text);
  text-align: center;
  font-size: 1rem;
  line-height: 1.4;
}
.checkin-question {
  margin: 0.5rem 0 0;
  text-align: center;
  color: var(--muted);
  font-weight: 600;
}

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

.checkin-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 1rem 1.1rem;
  min-height: 60px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: rgba(15, 23, 42, 0.55);
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  margin: 0;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.checkin-option:hover { border-color: rgba(34, 211, 238, 0.35); }
.checkin-option:active { transform: scale(0.98); }
.checkin-option:disabled { opacity: 0.5; cursor: not-allowed; }

.checkin-option.checkin-yes { border-left: 4px solid rgba(34, 197, 94, 0.8); }
.checkin-option.checkin-partial { border-left: 4px solid rgba(249, 115, 22, 0.8); }
.checkin-option.checkin-no { border-left: 4px solid rgba(239, 68, 68, 0.7); }

.checkin-emoji { font-size: 1.6rem; }

.checkin-feedback {
  margin: 0;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: rgba(34, 211, 238, 0.14);
  color: var(--accent);
  text-align: center;
  font-weight: 600;
}

/* Historique */
.history-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.history-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(250, 204, 21, 0.15);
  border: 1px solid rgba(250, 204, 21, 0.4);
  color: #fde68a;
  font-size: 0.85rem;
  font-weight: 600;
}
.history-badge-emoji { font-size: 1rem; }

.history-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--layer-3);
  border-left-width: 3px;
}
.history-item.is-passed { border-left-color: rgba(34, 197, 94, 0.6); }
.history-item.is-failed { border-left-color: rgba(239, 68, 68, 0.5); }

.history-item-title {
  font-weight: 600;
  color: var(--text);
}
.history-item-meta {
  color: var(--muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
