:root {
  --bg: #f7faff;
  --bg-soft: #eef5ff;
  --card: rgba(255, 255, 255, 0.88);
  --card-solid: #ffffff;
  --text: #071b4d;
  --muted: #536581;
  --line: #d8e4f7;
  --line-strong: #b7c9e7;
  --accent: #6554e8;
  --accent-soft: #eceaff;
  --accent-cyan: #73d1ef;
  --success: #0f6f64;
  --warning: #9a6612;
  --danger: #9d2537;
  --shadow: 0 24px 70px rgba(11, 33, 80, 0.12);
  --shadow-soft: 0 14px 40px rgba(11, 33, 80, 0.08);
  --radius: 28px;
  --radius-sm: 16px;
  --serif: Georgia, "Times New Roman", serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  --bg: #071225;
  --bg-soft: #0c1b35;
  --card: rgba(13, 29, 56, 0.88);
  --card-solid: #0e1d37;
  --text: #f4f8ff;
  --muted: #a8b7d4;
  --line: #24395d;
  --line-strong: #365585;
  --accent: #a399ff;
  --accent-soft: #1b2450;
  --accent-cyan: #7dd3fc;
  --success: #83d9c8;
  --warning: #f1c174;
  --danger: #ff9eb0;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  --shadow-soft: 0 14px 42px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(circle at 16% 8%, rgba(125, 211, 252, 0.22), transparent 24rem),
    radial-gradient(circle at 86% 16%, rgba(101, 84, 232, 0.12), transparent 22rem),
    linear-gradient(135deg, var(--bg), var(--bg-soft));
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(255,255,255,0.55), transparent 42%, rgba(255,255,255,0.18));
  mix-blend-mode: soft-light;
  z-index: -1;
}

body[data-theme="dark"]::before,
[data-theme="dark"] body::before {
  background: linear-gradient(90deg, rgba(125,211,252,0.03), transparent 42%, rgba(163,153,255,0.04));
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font: inherit;
}

button { cursor: pointer; }

textarea, select, input[type="text"] {
  color: var(--text);
  background: color-mix(in srgb, var(--card-solid) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: 16px;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

textarea:focus, select:focus, input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}

textarea {
  width: 100%;
  resize: vertical;
  padding: 14px 15px;
  min-height: 92px;
  line-height: 1.55;
}

select {
  width: 100%;
  padding: 12px 14px;
}

.skip-link {
  position: absolute;
  top: -42px;
  left: 20px;
  z-index: 20;
  background: var(--text);
  color: var(--bg);
  padding: 10px 14px;
  border-radius: 12px;
}

.skip-link:focus { top: 14px; }

.container {
  width: min(1180px, calc(100% - 42px));
  margin: 0 auto;
}

.narrow {
  max-width: 820px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(18px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
}

.header-inner {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-weight: 800;
  letter-spacing: .05em;
}

.brand-mark {
  width: 36px;
  height: 36px;
}

.brand-name {
  font-family: var(--serif);
  font-size: 1.05rem;
}

.top-nav {
  display: flex;
  gap: 24px;
  color: var(--muted);
  font-size: .95rem;
}

.top-nav a:hover { color: var(--text); }

.theme-toggle {
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--card);
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
}

.theme-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-cyan));
  display: inline-block;
}

.hero {
  padding: 70px 0 54px;
  min-height: 660px;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(420px, 1.08fr);
  gap: 46px;
  align-items: center;
}

.eyebrow, .section-kicker {
  margin: 0 0 14px;
  color: var(--accent);
  font-weight: 750;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-size: .78rem;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  font-family: var(--serif);
  font-size: clamp(3.1rem, 7vw, 6.8rem);
  line-height: .96;
  letter-spacing: -.055em;
  margin-bottom: 20px;
  color: var(--text);
}

h2 {
  font-family: var(--serif);
  font-size: clamp(2.1rem, 4vw, 3.7rem);
  letter-spacing: -.035em;
  line-height: 1.05;
  margin-bottom: 18px;
}

h3 {
  font-size: 1.05rem;
  margin-bottom: 10px;
}

.accent-line {
  width: 82px;
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-cyan));
  margin: 0 0 24px;
}

.hero-lead {
  font-size: clamp(1.17rem, 2vw, 1.55rem);
  line-height: 1.45;
  color: var(--text);
  max-width: 680px;
  margin-bottom: 26px;
}

.hero-actions, .form-actions, .result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn {
  border: 1px solid transparent;
  padding: 12px 16px;
  border-radius: 999px;
  font-weight: 760;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--text), color-mix(in srgb, var(--text) 76%, var(--accent)));
  color: var(--bg);
  box-shadow: var(--shadow-soft);
}

.btn-secondary {
  background: var(--card);
  color: var(--text);
  border-color: var(--line);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

.trust-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 44px 0 42px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.trust-item {
  display: grid;
  place-items: center;
  gap: 10px;
  text-align: center;
  padding: 22px 12px;
  min-height: 130px;
  border-right: 1px solid var(--line);
}

.trust-item:last-child { border-right: 0; }

.trust-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 1.8rem;
  font-weight: 300;
}

.signature {
  font-family: var(--serif);
  font-size: 1.06rem;
  color: var(--text);
}

.hero-visual {
  position: relative;
  min-height: 565px;
  border-radius: 44px;
  background:
    linear-gradient(110deg, color-mix(in srgb, var(--card-solid) 80%, transparent), transparent 44%),
    radial-gradient(circle at 30% 6%, rgba(125, 211, 252, .32), transparent 17rem),
    linear-gradient(145deg, rgba(255,255,255,.80), rgba(255,255,255,.32));
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  box-shadow: var(--shadow);
  overflow: hidden;
}

[data-theme="dark"] .hero-visual {
  background:
    linear-gradient(110deg, color-mix(in srgb, var(--card-solid) 74%, transparent), transparent 44%),
    radial-gradient(circle at 30% 6%, rgba(125, 211, 252, .15), transparent 17rem),
    linear-gradient(145deg, rgba(16,33,62,.90), rgba(14,29,55,.50));
}

.glass-dome {
  position: absolute;
  top: -120px;
  left: 18%;
  width: 500px;
  height: 280px;
  border-radius: 0 0 50% 50%;
  border: 1px solid color-mix(in srgb, var(--line-strong) 58%, transparent);
  background: linear-gradient(180deg, rgba(255,255,255,.78), rgba(125,211,252,.17));
  transform: rotate(-8deg);
}

.knowledge-wall {
  position: absolute;
  right: -4px;
  top: 86px;
  width: 300px;
  height: 350px;
  padding: 22px;
  background: color-mix(in srgb, var(--card-solid) 82%, transparent);
  border-left: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: 76px;
  gap: 10px;
}

.knowledge-wall span {
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, #ffffff, #e5eefb);
  border: 1px solid #d8e5f5;
  box-shadow: inset -8px 0 0 rgba(7,27,77,.07);
}

[data-theme="dark"] .knowledge-wall span {
  background: linear-gradient(180deg, #20365f, #132540);
  border-color: #334e79;
  box-shadow: inset -8px 0 0 rgba(125,211,252,.08);
}

.knowledge-wall span:nth-child(3n) { height: 62px; align-self: end; }
.knowledge-wall span:nth-child(4n) { background: linear-gradient(180deg, #183263, #f0f5fe); }
[data-theme="dark"] .knowledge-wall span:nth-child(4n) { background: linear-gradient(180deg, #365585, #182d50); }

.framed-values {
  position: absolute;
  top: 180px;
  left: 47%;
  width: 155px;
  background: color-mix(in srgb, var(--card-solid) 86%, transparent);
  border: 1px solid var(--line);
  box-shadow: 0 18px 40px rgba(11,33,80,.10);
  padding: 25px 20px;
  font-family: var(--serif);
  color: var(--text);
  font-size: .84rem;
  line-height: 1.65;
}

.framed-values span { display: block; }

.framed-values::after {
  content: "";
  width: 44px;
  height: 3px;
  background: var(--accent);
  display: block;
  margin-top: 12px;
  border-radius: 999px;
}

.desk {
  position: absolute;
  left: 36%;
  bottom: 0;
  width: 400px;
  height: 210px;
  border-radius: 50% 50% 0 0;
  background: linear-gradient(145deg, rgba(255,255,255,.7), rgba(229,239,254,.8));
  border-top: 1px solid var(--line);
  transform: rotate(-2deg);
}

[data-theme="dark"] .desk {
  background: linear-gradient(145deg, rgba(25,45,80,.88), rgba(14,29,55,.82));
}

.book {
  position: absolute;
  left: 72px;
  height: 28px;
  width: 165px;
  border-radius: 4px;
  color: #f5f8ff;
  font-family: var(--serif);
  font-size: .72rem;
  letter-spacing: .05em;
  padding: 7px 12px;
  box-shadow: 0 12px 22px rgba(7,27,77,.17);
}

.book-one { bottom: 114px; background: #0a214f; }
.book-two { bottom: 86px; left: 80px; background: #1b3b70; }
.book-three { bottom: 58px; left: 88px; background: #e7eef8; color: #071b4d; }

.paper {
  position: absolute;
  right: 34px;
  bottom: 42px;
  width: 128px;
  height: 152px;
  padding: 30px 18px;
  background: rgba(255,255,255,.86);
  color: #071b4d;
  font-family: var(--serif);
  font-size: .96rem;
  line-height: 1.2;
  transform: rotate(8deg);
  box-shadow: 0 16px 28px rgba(7,27,77,.12);
  border: 1px solid #dfe8f8;
}

.section {
  padding: 78px 0;
}

.section p {
  color: var(--muted);
  line-height: 1.75;
  font-size: 1.06rem;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 36px;
}

.feature-card, .panel-card, .result-section, .prompt-form, .privacy-card {
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  border-radius: var(--radius-sm);
}

.feature-card {
  padding: 28px;
}

.feature-card h3 {
  font-family: var(--serif);
  font-size: 1.55rem;
}

.simulator-section {
  background: linear-gradient(180deg, color-mix(in srgb, var(--card-solid) 35%, transparent), transparent);
}

.section-heading, .split-heading, .result-header, .privacy-grid {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
}

.offline-badge {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--muted);
  font-weight: 730;
  white-space: nowrap;
}

.simulator-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, .75fr);
  gap: 20px;
  align-items: start;
}

.prompt-form {
  padding: 24px;
}

.form-toolbar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding: 16px;
  border-radius: 20px;
  background: color-mix(in srgb, var(--bg-soft) 80%, transparent);
  border: 1px solid var(--line);
  margin-bottom: 16px;
}

.form-toolbar label,
.field-block label {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-weight: 770;
  font-size: .92rem;
}

.field-block label span {
  color: var(--muted);
  font-weight: 650;
  font-size: .78rem;
}

.notice-box {
  color: var(--muted);
  background: color-mix(in srgb, var(--accent-soft) 70%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line));
  border-radius: 18px;
  padding: 14px 16px;
  margin-bottom: 18px;
  line-height: 1.6;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field-block {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: color-mix(in srgb, var(--card-solid) 74%, transparent);
}

.field-block.essential {
  border-color: color-mix(in srgb, var(--accent) 26%, var(--line));
}

.help-text {
  margin: 9px 0 0;
  font-size: .9rem !important;
  line-height: 1.5 !important;
  color: var(--muted);
}

body.view-simple .advanced {
  display: none;
}

body.view-simple .form-grid {
  grid-template-columns: 1fr;
}

body.view-expert .help-text {
  display: none;
}

body.view-pedagogique .help-text {
  display: block;
}

.safety-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 18px 0;
}

.check-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-soft) 62%, transparent);
  color: var(--muted);
  line-height: 1.5;
}

.check-card strong {
  display: block;
  color: var(--text);
  margin-bottom: 2px;
}

.check-card input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  margin-top: 2px;
}

.analysis-panel {
  display: grid;
  gap: 16px;
  position: sticky;
  top: 96px;
}

.panel-card {
  padding: 20px;
}

.panel-card h3 {
  font-family: var(--serif);
  font-size: 1.35rem;
  margin-bottom: 16px;
}

.metrics-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 0 0 12px;
}

.metrics-list div {
  background: color-mix(in srgb, var(--bg-soft) 70%, transparent);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}

.metrics-list dt {
  color: var(--muted);
  font-size: .8rem;
  margin-bottom: 5px;
}

.metrics-list dd {
  margin: 0;
  font-size: 1.25rem;
  color: var(--text);
  font-weight: 800;
}

.small-note {
  font-size: .85rem !important;
  color: var(--muted) !important;
  line-height: 1.55 !important;
  margin-bottom: 0;
}

.score-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
  margin-bottom: 14px;
}

.score-row span { color: var(--muted); }
.score-row strong { font-variant-numeric: tabular-nums; }

.score-bar {
  grid-column: 1 / -1;
  height: 8px;
  background: color-mix(in srgb, var(--bg-soft) 90%, transparent);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.score-bar i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-cyan));
  transition: width .25s ease;
}

.global-score {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 15px;
  border-radius: 18px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent-soft) 80%, transparent), color-mix(in srgb, var(--bg-soft) 82%, transparent));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line));
}

.global-score strong {
  font-size: 1.15rem;
}

.risk-card p {
  margin-bottom: 10px;
  font-size: .96rem;
  line-height: 1.55;
}

.diagnostic-text {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.result-section {
  margin-top: 20px;
  padding: 24px;
}

.result-header {
  margin-bottom: 16px;
}

.result-header h2 {
  font-size: 2.2rem;
  margin-bottom: 0;
}

.prompt-output {
  min-height: 420px;
  font-family: "Cascadia Mono", "Consolas", ui-monospace, SFMono-Regular, Menlo, monospace;
  background: color-mix(in srgb, var(--card-solid) 82%, transparent);
  white-space: pre-wrap;
}

.status-line {
  min-height: 1.2em;
  margin-top: 10px;
}

.privacy-grid {
  align-items: stretch;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
}

.privacy-card {
  padding: 24px;
}

.privacy-card h3 {
  font-family: var(--serif);
  font-size: 1.35rem;
}

.privacy-card ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.85;
}

.site-footer {
  padding: 34px 0;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
}

.footer-inner {
  display: grid;
  gap: 6px;
}

.site-footer p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: .94rem;
}

.site-footer strong { color: var(--text); }

@media (max-width: 1040px) {
  .hero-grid, .simulator-shell, .privacy-grid {
    grid-template-columns: 1fr;
  }
  .hero-visual {
    min-height: 500px;
  }
  .analysis-panel {
    position: static;
    grid-template-columns: repeat(3, 1fr);
  }
  .metrics-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .container {
    width: min(100% - 28px, 1180px);
  }
  .header-inner {
    flex-wrap: wrap;
    padding: 12px 0;
  }
  .top-nav {
    order: 3;
    width: 100%;
    justify-content: space-between;
    gap: 10px;
  }
  .hero {
    padding-top: 48px;
  }
  .hero-grid {
    gap: 28px;
  }
  .trust-row, .feature-grid, .form-toolbar, .form-grid, .safety-row, .analysis-panel {
    grid-template-columns: 1fr;
  }
  .trust-item {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    min-height: 100px;
  }
  .trust-item:last-child { border-bottom: 0; }
  .section-heading, .split-heading, .result-header {
    display: grid;
    align-items: start;
  }
  .offline-badge {
    width: fit-content;
  }
  .hero-visual {
    min-height: 420px;
    border-radius: 28px;
  }
  .knowledge-wall {
    width: 220px;
    height: 280px;
    grid-auto-rows: 58px;
  }
  .framed-values { left: 22px; top: 130px; }
  .desk { left: 16%; width: 330px; }
}

@media (max-width: 520px) {
  h1 {
    font-size: 3rem;
  }
  .hero-actions, .form-actions, .result-actions {
    display: grid;
  }
  .btn { text-align: center; }
  .knowledge-wall { right: -82px; }
  .desk { left: 4%; transform: scale(.9) rotate(-2deg); transform-origin: bottom left; }
}

@media print {
  .site-header, .hero, .section:not(.simulator-section), .prompt-form, .analysis-panel, .result-actions, .site-footer {
    display: none !important;
  }
  body {
    background: #fff;
    color: #000;
  }
  .container { width: 100%; }
  .result-section {
    border: 0;
    box-shadow: none;
    padding: 0;
  }
  .prompt-output {
    border: 0;
    min-height: auto;
    color: #000;
  }
}
