:root {
  --brand: #275a8d;
  --brand-dark: #12416a;
  --brand-deep: #0d3151;
  --brand-soft: #eaf1f8;
  --brand-pale: #f4f8fc;
  --ink: #142033;
  --ink-soft: #3f4d61;
  --muted: #69778a;
  --line: #dbe4ed;
  --surface: #ffffff;
  --page: #f4f7fa;
  --success: #19734b;
  --danger: #a52a2a;
  --warning: #9a6200;
  --shadow-sm: 0 1px 3px rgba(13, 49, 81, .08);
  --shadow-md: 0 16px 48px rgba(13, 49, 81, .12);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 28px;
}

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

html { min-height: 100%; background: var(--page); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% -10%, rgba(39, 90, 141, .13), transparent 28rem),
    linear-gradient(180deg, #f8fafc 0%, var(--page) 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.page-shell {
  width: min(980px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
}

.app-header {
  padding: 24px 4px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: var(--ink-soft);
  font-size: .92rem;
}

.brand-line { display: flex; align-items: center; gap: 10px; }
.brand-name { color: var(--brand-dark); font-weight: 800; letter-spacing: .01em; }
.brand-separator { width: 1px; height: 18px; background: var(--line); }
.question-meta { color: var(--muted); }

.progress-shell {
  padding: 0 4px 22px;
}

.progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: .84rem;
}

.progress-copy strong { color: var(--ink-soft); font-weight: 700; }
.progress-track { height: 7px; overflow: hidden; border-radius: 999px; background: #dfe8f0; }
.progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), #4f82b2);
  transition: width .35s ease;
}

#screenRoot {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 0 28px;
  outline: none;
}

.screen {
  width: 100%;
  animation: screen-in .28s ease both;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-card,
.content-card {
  width: min(820px, 100%);
  margin: 0 auto;
  background: rgba(255, 255, 255, .98);
  border: 1px solid rgba(219, 228, 237, .95);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.hero-card {
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(220px, .8fr) minmax(360px, 1.35fr);
}

.hero-brand {
  min-height: 480px;
  padding: 42px 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand);
}

.hero-logo {
  display: block;
  width: min(230px, 100%);
  height: auto;
  filter: drop-shadow(0 14px 28px rgba(0, 0, 0, .14));
}

.hero-content {
  padding: 58px 52px 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--brand);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 18px; font-size: clamp(2rem, 4vw, 3.25rem); line-height: 1.05; letter-spacing: -.035em; }
h2 { margin-bottom: 14px; font-size: clamp(1.65rem, 3vw, 2.35rem); line-height: 1.15; letter-spacing: -.025em; }
h3 { margin-bottom: 8px; font-size: 1rem; }

.lead {
  margin-bottom: 28px;
  color: var(--ink-soft);
  font-size: 1.08rem;
  line-height: 1.65;
}

.trust-list {
  display: grid;
  gap: 12px;
  margin: 0 0 32px;
  padding: 0;
  list-style: none;
  color: var(--ink-soft);
  font-size: .94rem;
}

.trust-list li { display: flex; gap: 11px; align-items: flex-start; }
.trust-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: .78rem;
  font-weight: 900;
}

.content-card { padding: clamp(28px, 5vw, 58px); }
.content-card.narrow { width: min(720px, 100%); }
.content-card.wide { width: min(900px, 100%); }

.section-intro {
  min-height: 390px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}
.section-intro .section-number {
  width: 52px;
  height: 52px;
  margin: 0 auto 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 1.1rem;
  font-weight: 850;
}
.section-intro > p:not(.eyebrow) { max-width: 590px; margin: 0 auto 24px; color: var(--ink-soft); font-size: 1.05rem; }
.rank-scale-card {
  width: min(640px, 100%);
  margin: 0 auto 32px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px minmax(0, 1fr);
  column-gap: 0;
  align-items: center;
  border: 1px solid #cbd9e6;
  border-radius: 15px;
  background: var(--brand-pale);
  color: var(--ink-soft);
  text-align: left;
  font-size: .93rem;
}
.rank-scale-endpoint {
  min-width: 0;
  width: fit-content;
  max-width: 100%;
  display: grid;
  grid-template-columns: 32px minmax(0, 190px);
  gap: 10px;
  align-items: center;
}
.rank-scale-endpoint:first-child { justify-self: start; }
.rank-scale-endpoint:last-child { justify-self: end; }
.rank-scale-card strong {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: white;
  background: var(--brand);
}
.rank-scale-copy { min-width: 0; line-height: 1.35; text-align: left; }
.rank-scale-arrow { width: 78px; justify-self: center; color: #7e94a8; font-size: 1.15rem; text-align: center; }

.question-heading { margin-bottom: 20px; }
.question-heading .eyebrow { margin-bottom: 10px; }
.question-heading h2 {
  margin-bottom: 12px;
  font-size: clamp(1.35rem, 2.15vw, 1.7rem);
  line-height: 1.25;
  letter-spacing: -.015em;
  font-weight: 700;
}
.question-heading > p:not(.eyebrow) { margin-bottom: 0; color: var(--muted); font-size: .84rem; line-height: 1.45; }
.ranking-guidance {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 12px;
  border-radius: 10px;
  background: #f3f7fb;
  color: var(--muted);
  font-size: .79rem;
  line-height: 1.35;
}
.ranking-rule { color: var(--brand-dark); font-size: .82rem; font-weight: 780; }
.ranking-action { text-align: right; }

.ranking-list { display: grid; gap: 11px; }
.ranking-item {
  position: relative;
  min-height: 78px;
  display: grid;
  grid-template-columns: 44px 30px 1fr auto;
  gap: 13px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: grab;
  user-select: none;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease, opacity .16s ease;
}
.ranking-item:hover { border-color: #a9bed1; box-shadow: 0 8px 22px rgba(13,49,81,.08); transform: translateY(-1px); }
.ranking-item:active { cursor: grabbing; }
.ranking-item.dragging {
  position: fixed;
  left: -10000px;
  top: -10000px;
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}
.ranking-placeholder {
  position: relative;
  min-height: 78px;
  border: 2px dashed #76a0c4;
  border-radius: var(--radius-sm);
  background: rgba(234, 241, 248, .72);
  box-shadow: inset 0 0 0 3px rgba(39,90,141,.05);
}
.ranking-placeholder::after {
  content: "Déposer ici";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
  font-size: .79rem;
  font-weight: 760;
  letter-spacing: .02em;
}
.drag-ghost {
  position: fixed;
  left: -10000px;
  top: -10000px;
  z-index: 100;
  width: min(700px, calc(100vw - 40px));
  opacity: .96;
  transform: rotate(.4deg) scale(1.01);
  border-color: var(--brand);
  box-shadow: 0 18px 44px rgba(13,49,81,.22);
  pointer-events: none;
}
.rank-number {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 850;
}
.drag-handle { color: #8ca0b3; font-size: 1.15rem; letter-spacing: -2px; }
.ranking-copy,
.choice-copy { color: var(--ink); font-size: 1.03rem; font-weight: 670; line-height: 1.45; }
.move-buttons { display: flex; gap: 5px; }
.icon-button {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink-soft);
  background: #f8fafc;
  cursor: pointer;
}
.icon-button:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.icon-button:disabled { opacity: .3; cursor: default; }

.choice-grid { display: grid; gap: 14px; }
.choice-card {
  position: relative;
  min-height: 92px;
  display: flex;
  align-items: center;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease, background .18s ease;
}
.choice-card:hover { transform: translateY(-2px); border-color: #9cb5ca; box-shadow: 0 10px 28px rgba(13,49,81,.09); }
.choice-card.selected { border-color: var(--brand); background: var(--brand-pale); box-shadow: 0 0 0 3px rgba(39,90,141,.11); }
.choice-card input { position: absolute; opacity: 0; pointer-events: none; }
.choice-marker {
  width: 24px;
  height: 24px;
  margin-right: 15px;
  flex: 0 0 24px;
  border: 2px solid #a9b9c8;
  border-radius: 50%;
  background: #fff;
  transition: all .18s ease;
}
.choice-card.selected .choice-marker { border: 7px solid var(--brand); }
.auto-hint { margin: 16px 0 0; color: var(--muted); font-size: .84rem; text-align: center; }

.selection-toolbar {
  position: sticky;
  top: 8px;
  z-index: 2;
  margin: -8px -8px 18px;
  padding: 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-radius: 14px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
}
.selection-count { color: var(--ink-soft); font-weight: 760; }
.selection-count strong { color: var(--brand-dark); font-size: 1.1rem; }
.selection-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.selection-card {
  position: relative;
  min-height: 62px;
  display: flex;
  align-items: center;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.selection-card:hover { border-color: #a2b7ca; transform: translateY(-1px); }
.selection-card.selected { border-color: var(--brand); background: var(--brand-pale); }
.selection-card.disabled { opacity: .48; cursor: not-allowed; }
.selection-card input { position: absolute; opacity: 0; pointer-events: none; }
.check-marker {
  width: 22px;
  height: 22px;
  margin-right: 11px;
  flex: 0 0 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #aab9c8;
  border-radius: 7px;
  color: white;
  background: white;
  font-size: .78rem;
  font-weight: 900;
}
.selection-card.selected .check-marker { border-color: var(--brand); background: var(--brand); }
.selection-copy { font-weight: 620; }
.inline-message { min-height: 24px; margin: 14px 0 0; color: var(--danger); font-size: .9rem; }

.review-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 24px 0 30px; }
.review-card { padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fbfcfe; }
.review-card strong { display: block; margin-bottom: 4px; color: var(--brand-dark); }
.review-card span { color: var(--muted); font-size: .9rem; }
.review-notice { padding: 16px 18px; border-left: 4px solid var(--brand); border-radius: 10px; background: var(--brand-pale); color: var(--ink-soft); }

.success-screen { text-align: center; }
.success-screen .eyebrow { margin-bottom: 28px; }
.success-screen h1 { margin-bottom: 32px; }
.success-mark {
  width: 72px;
  height: 72px;
  margin: 0 auto 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: white;
  background: var(--success);
  font-size: 2rem;
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(25,115,75,.22);
}
.success-screen p { max-width: 590px; margin: 0 auto; color: var(--ink-soft); font-size: 1.04rem; }
.success-note {
  margin-top: 22px !important;
  padding: 12px 15px;
  border-radius: 11px;
  background: var(--brand-pale);
  color: var(--brand-dark) !important;
  font-size: .88rem !important;
}

.app-footer {
  min-height: 92px;
  padding: 18px 4px 24px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 18px;
  align-items: center;
}
.footer-action { display: flex; justify-content: flex-end; }
.save-status { margin: 0; color: var(--muted); font-size: .78rem; text-align: center; }

.button {
  min-height: 46px;
  padding: 11px 20px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-weight: 760;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, opacity .15s ease;
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:focus-visible, .choice-card:focus-within, .selection-card:focus-within, .ranking-item:focus-visible { outline: 3px solid rgba(39,90,141,.22); outline-offset: 2px; }
.button-primary { color: white; background: var(--brand); box-shadow: 0 8px 20px rgba(39,90,141,.2); }
.button-primary:hover:not(:disabled) { background: var(--brand-dark); }
.button-secondary { color: var(--brand-dark); border-color: #b9cad9; background: var(--brand-soft); }
.button-ghost { color: var(--ink-soft); border-color: var(--line); background: rgba(255,255,255,.8); }
.button:disabled { opacity: .42; cursor: not-allowed; transform: none; box-shadow: none; }
.button-large { min-height: 52px; padding: 13px 26px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 20;
  max-width: min(520px, calc(100% - 32px));
  padding: 12px 16px;
  border-radius: 11px;
  color: white;
  background: var(--brand-deep);
  box-shadow: 0 14px 36px rgba(13,49,81,.26);
  transform: translateX(-50%);
}
.toast.error { background: var(--danger); }

.confirm-dialog {
  width: min(540px, calc(100% - 32px));
  padding: 34px;
  border: 0;
  border-radius: 22px;
  color: var(--ink);
  box-shadow: 0 28px 80px rgba(8,31,52,.32);
}
.confirm-dialog::backdrop { background: rgba(9, 28, 47, .58); backdrop-filter: blur(3px); }
.confirm-dialog h2 { font-size: 1.55rem; }
.confirm-dialog p { color: var(--ink-soft); }
.dialog-icon {
  width: 44px;
  height: 44px;
  margin-bottom: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--brand-dark);
  background: var(--brand-soft);
  font-weight: 900;
}
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 26px; }

.noscript { margin: 30px auto; padding: 18px; max-width: 720px; color: white; background: var(--danger); }

@media (max-width: 760px) {
  .page-shell { width: min(100% - 20px, 980px); }
  .hero-card { grid-template-columns: 1fr; }
  .hero-brand { min-height: 230px; padding: 28px; }
  .hero-logo { width: 170px; }
  .hero-content { padding: 36px 26px 32px; }
  .content-card { padding: 28px 20px; border-radius: 22px; }
  .rank-scale-card { grid-template-columns: 1fr; gap: 12px; text-align: left; }
  .rank-scale-endpoint,
  .rank-scale-endpoint:first-child,
  .rank-scale-endpoint:last-child { width: 100%; justify-self: stretch; grid-template-columns: 32px minmax(0, 1fr); }
  .rank-scale-arrow { display: none; }
  .ranking-guidance { align-items: flex-start; flex-direction: column; gap: 4px; }
  .ranking-action { text-align: left; }
  .selection-grid, .review-grid { grid-template-columns: 1fr; }
  .ranking-item { grid-template-columns: 40px 22px 1fr; }
  .move-buttons { grid-column: 3; justify-content: flex-end; }
  .app-footer { grid-template-columns: 1fr 1fr; }
  .save-status { grid-column: 1 / -1; grid-row: 2; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .button { width: 100%; }
}

@media (max-width: 460px) {
  .app-header { align-items: flex-start; }
  .question-meta { display: none; }
  .progress-copy { display: block; }
  .progress-copy strong { display: block; margin-top: 3px; }
  .choice-card { min-height: 80px; padding: 17px; }
  .ranking-item { padding: 10px; gap: 9px; }
  .rank-number { width: 34px; height: 34px; }
  .app-footer .button { padding-inline: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
