:root {
  --navy: #17173A;
  --navy-soft: #3a3a5c;
  --pink: #F0386B;
  --orange: #FB7B3B;
  --gradient: linear-gradient(120deg, #F0386B 0%, #FB7B3B 100%);
  --bg: #ffffff;
  --card: #ffffff;
  --line: #ececf2;
  --muted: #8a8aa0;
  --shadow: 0 10px 30px rgba(23, 23, 58, 0.08);
  --shadow-lg: 0 20px 50px rgba(23, 23, 58, 0.14);
  --radius: 20px;
  --radius-sm: 14px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--navy);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.logo { width: 220px; max-width: 70%; height: auto; }
.logo-sm { width: 130px; }

/* ---------- Login ---------- */
.login-body {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, #fff5f0 0%, #ffffff 60%);
}
.login-card {
  width: 100%; max-width: 420px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 40px 28px;
  text-align: center;
}
.login-tagline { color: var(--muted); margin: 14px 0 26px; }
.login-form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.login-form label { font-weight: 600; font-size: 0.9rem; }
.text-input, .login-form input[type="password"] {
  width: 100%;
  padding: 15px 16px;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  outline: none;
  transition: border-color .2s;
}
.text-input:focus, .login-form input:focus { border-color: var(--pink); }
.form-error { color: var(--pink); font-weight: 600; text-align: center; margin-top: 4px; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: rgba(255,255,255,.9);
  backdrop-filter: blur(8px); z-index: 10;
}
.logout-link { color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.logout-link:hover { color: var(--navy); }

/* ---------- App / screens ---------- */
.app { max-width: 600px; margin: 0 auto; padding: 28px 20px 60px; }
.screen { display: none; animation: fade .35s ease; }
.screen.is-active { display: block; }
.screen-center { text-align: center; padding-top: 60px; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.screen-title { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; }
.screen-sub { color: var(--muted); margin: 8px 0 24px; }

/* ---------- Buttons ---------- */
.btn {
  border: none; cursor: pointer; font-size: 1rem; font-weight: 700;
  padding: 15px 22px; border-radius: var(--radius-sm);
  transition: transform .12s ease, box-shadow .2s ease, background .2s;
}
.btn:active { transform: scale(.97); }
.btn-gradient { background: var(--gradient); color: #fff; box-shadow: 0 8px 20px rgba(240,56,107,.28); }
.btn-gradient:hover { box-shadow: 0 12px 26px rgba(240,56,107,.38); }
.btn-ghost { background: #f4f4f8; color: var(--navy); }
.actions { display: flex; gap: 12px; margin-top: 22px; }
.actions .btn { flex: 1; }

/* ---------- Mode cards ---------- */
.mode-grid { display: grid; gap: 16px; }
.mode-card {
  text-align: left; background: var(--card); border: 2px solid var(--line);
  border-radius: var(--radius); padding: 22px; cursor: pointer;
  display: flex; gap: 16px; align-items: center;
  transition: border-color .2s, transform .12s, box-shadow .2s;
}
.mode-card:hover { border-color: var(--orange); box-shadow: var(--shadow); transform: translateY(-2px); }
.mode-emoji { font-size: 2.2rem; line-height: 1; }
.mode-card h3 { font-size: 1.1rem; }
.mode-card p { color: var(--muted); font-size: 0.92rem; }

/* ---------- Questions ---------- */
.progress { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin-bottom: 24px; }
.progress-bar { height: 100%; width: 0; background: var(--gradient); border-radius: 99px; transition: width .35s ease; }
.q-label { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 6px; }
.q-hint { color: var(--muted); font-size: 0.9rem; margin-bottom: 18px; }
.options { display: grid; gap: 12px; }
.option {
  display: flex; align-items: center; gap: 14px; text-align: left;
  background: var(--card); border: 2px solid var(--line); border-radius: var(--radius-sm);
  padding: 15px 18px; cursor: pointer; font-size: 1rem; color: var(--navy);
  transition: border-color .2s, background .2s, transform .1s;
}
.option:hover { border-color: var(--orange); }
.option.selected { border-color: var(--pink); background: #fff4f7; }
.option .opt-emoji { font-size: 1.5rem; }
/* Case « Je ne sais pas » : neutre, grisée, détachée du reste */
.option-dunno { margin-top: 10px; background: #f4f4f8; color: var(--muted); border-style: dashed; }
.option-dunno:hover { border-color: var(--muted); color: var(--navy-soft); }
.q-foot { margin-top: 22px; display: flex; gap: 12px; }
.q-foot .btn { flex: 1; }

/* ---------- Loading ---------- */
.dna-spinner { font-size: 3.4rem; animation: spin 1.6s linear infinite, pulse 1.2s ease-in-out infinite; }
.loading-text { margin-top: 18px; font-weight: 700; color: var(--navy-soft); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { transform: scale(1.12); } }

/* ---------- Result / Carte du livre ---------- */
.result-hi { text-align: center; color: var(--muted); margin-bottom: 22px; }

.adn-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 24px; margin-bottom: 22px;
}
.block { margin-bottom: 18px; }
.block-label { font-size: 0.75rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--pink); margin-bottom: 6px; }
.block p { color: var(--navy); }

/* Couverture façon livre */
.cover-wrap { display: flex; justify-content: center; margin: 6px 0 20px; }
.book-cover {
  width: 200px; aspect-ratio: 2 / 3; border-radius: 6px 12px 12px 6px;
  background: var(--gradient); color: #fff; padding: 22px 18px;
  display: flex; flex-direction: column; justify-content: space-between;
  box-shadow: var(--shadow-lg), inset 6px 0 0 rgba(0,0,0,.12);
  position: relative; overflow: hidden;
}
.book-cover::after { content: ""; position: absolute; inset: 0; background: radial-gradient(120px 80px at 80% 0%, rgba(255,255,255,.25), transparent 70%); }
.cover-kicker { font-size: 0.7rem; letter-spacing: .15em; text-transform: uppercase; opacity: .85; }
.cover-title { font-size: 1.25rem; font-weight: 800; line-height: 1.2; }
.cover-author { font-size: 0.8rem; opacity: .9; }

/* Sommaire */
.chapters { display: grid; gap: 10px; }
.chapter { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.chapter .num { font-weight: 800; color: var(--orange); }

/* Barres de score (jauge potentiel des idées + faisabilité du plan) */
.score-track { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; }
.score-fill { height: 100%; width: 0; background: var(--gradient); border-radius: 99px; transition: width 1s cubic-bezier(.2,.8,.2,1); }

/* CTA Challenge Livreia */
.cta-card {
  background: var(--navy); color: #fff; border-radius: var(--radius);
  padding: 26px 22px; text-align: center; box-shadow: var(--shadow-lg); margin-bottom: 18px;
}
.cta-card h3 { font-size: 1.2rem; margin-bottom: 8px; }
.cta-card p { color: #c9c9da; margin-bottom: 18px; }
.cta-card .btn-gradient { display: inline-block; text-decoration: none; }

/* Boutons bas de résultat */
.result-actions { display: grid; gap: 10px; }

@media (min-width: 560px) {
  .result-actions { grid-template-columns: 1fr 1fr; }
}
