/* ============================================================
   SYNAPSE — feuille de style
   Même ADN que Prisme : papier clair, serif éditorial, mode sombre
   ============================================================ */

:root {
  color-scheme: light;
  --bg: #f4f1ea;
  --bg-2: #fffdf8;
  --bg-3: #e9e4d8;
  --ink: #17161f;
  --ink-2: #3b3946;
  --ink-3: #686472;
  --line: rgba(23, 22, 31, 0.11);
  --line-2: rgba(23, 22, 31, 0.22);
  --accent: #5b3df5;
  --accent-soft: rgba(91, 61, 245, 0.1);
  --good: #1f8a57;
  --bad: #d23a4f;
  --grad-text: linear-gradient(90deg, #5b3df5, #c43dd6 50%, #0f9fb5);
  --paper: #ffffff;
  --paper-line: #d9d3c6;
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Manrope', 'Segoe UI', system-ui, sans-serif;
  --radius: 22px;
  --radius-sm: 12px;
  --shadow: 0 24px 60px -30px rgba(60, 40, 110, 0.35);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0b13;
  --bg-2: #12121e;
  --bg-3: #1a1a2a;
  --ink: #f2f0ea;
  --ink-2: #cac6c0;
  --ink-3: #928e89;
  --line: rgba(242, 240, 234, 0.09);
  --line-2: rgba(242, 240, 234, 0.18);
  --accent: #a08cff;
  --accent-soft: rgba(160, 140, 255, 0.14);
  --good: #4cc38a;
  --bad: #ff5d73;
  --grad-text: linear-gradient(90deg, #a08cff, #f07ce0 50%, #4dd6e8);
  --paper: #f7f5f0;
  --paper-line: #3a3950;
  --shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.8);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: 500;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0; }
a { color: var(--accent); }
button { font: inherit; color: inherit; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* ---------- en-tête ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 0;
}
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; color: inherit; }
.brand-name {
  font-family: var(--font-display); font-size: 26px; font-weight: 700; letter-spacing: -0.01em;
  background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-tag { font-size: 13px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.12em; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border: 1px solid var(--line-2); border-radius: 999px;
  background: var(--bg-2); cursor: pointer;
  font-weight: 700; font-size: 15px;
  transition: transform 0.2s var(--ease), background 0.2s, border-color 0.2s;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
:root[data-theme="dark"] .btn-primary { color: #0b0b13; }
.btn-icon { width: 44px; padding: 0; }

/* ---------- labo ---------- */
.lab-head { padding: 12px 0 28px; }
.lab-head h1 { font-size: clamp(30px, 5vw, 46px); }
.lab-head p { color: var(--ink-2); max-width: 680px; margin: 10px 0 0; }

.controls {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px;
  padding: 16px 20px; margin-bottom: 22px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
}
.control { display: flex; align-items: center; gap: 12px; flex: 1 1 280px; }
.control label { font-weight: 700; white-space: nowrap; }
.control input[type="range"] { flex: 1; accent-color: var(--accent); min-width: 120px; }
.control output { font-family: var(--font-display); font-size: 20px; font-weight: 700; min-width: 72px; text-align: right; }
.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; }
.toggle input { width: 18px; height: 18px; accent-color: var(--accent); }

.item {
  display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px;
  align-items: start;
}
@media (max-width: 900px) { .item { grid-template-columns: 1fr; } }

.board {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}

.matrix {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  max-width: 420px; margin: 0 auto;
}
.cell {
  aspect-ratio: 1; background: var(--paper); border: 1.5px solid var(--paper-line); border-radius: 10px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.cell svg { width: 100%; height: 100%; display: block; }
.cell-missing {
  border-style: dashed; border-color: var(--accent);
  font-family: var(--font-display); font-size: 44px; font-weight: 700; color: var(--accent);
  background: var(--accent-soft);
}
.cell-missing.filled { border-style: solid; background: var(--paper); }

.options-title { text-align: center; color: var(--ink-3); font-size: 14px; margin: 20px 0 10px; }
.options {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  max-width: 560px; margin: 0 auto;
}
.option {
  position: relative; aspect-ratio: 1; padding: 0;
  background: var(--paper); border: 2px solid var(--paper-line); border-radius: 12px;
  cursor: pointer; overflow: hidden;
  transition: transform 0.18s var(--ease), border-color 0.18s, box-shadow 0.18s;
}
.option svg { width: 100%; height: 100%; display: block; }
.option:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-2px); }
.option:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.option:disabled { cursor: default; }
.option .num {
  position: absolute; top: 4px; left: 7px;
  font-size: 12px; font-weight: 800; color: #9a958b;
}
.option.is-right { border-color: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 30%, transparent); }
.option.is-wrong { border-color: var(--bad); opacity: 0.75; }

.feedback { text-align: center; font-weight: 700; min-height: 28px; margin-top: 16px; }
.feedback.good { color: var(--good); }
.feedback.bad { color: var(--bad); }

.info {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px;
}
.info h2 { font-size: 21px; margin-bottom: 14px; }
.stat { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.stat:last-of-type { border-bottom: 0; }
.stat span { color: var(--ink-3); font-size: 14px; }
.stat strong { font-family: var(--font-display); font-size: 22px; }
.meter { height: 8px; border-radius: 99px; background: var(--bg-3); overflow: hidden; margin: 4px 0 12px; }
.meter i { display: block; height: 100%; background: var(--grad-text); border-radius: 99px; transition: width 0.4s var(--ease); }
.rules { margin: 16px 0 0; padding: 0; list-style: none; }
.rules li { padding: 10px 12px; margin-top: 8px; background: var(--bg-3); border-radius: var(--radius-sm); font-size: 15px; line-height: 1.45; }
.rules-hidden { color: var(--ink-3); font-size: 14px; margin-top: 16px; }
.seed { margin-top: 16px; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ---------- l'échelle ---------- */
.ladder { margin: 44px 0 60px; }
.ladder h2 { font-size: 28px; }
.ladder > p { color: var(--ink-2); margin: 8px 0 18px; }
.ladder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.rung {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px; cursor: pointer; text-align: left;
  transition: border-color 0.2s, transform 0.2s var(--ease);
}
.rung:hover { border-color: var(--accent); transform: translateY(-2px); }
.rung .matrix { gap: 3px; }
.rung .cell { border-radius: 4px; border-width: 1px; }
.rung .cell-missing { font-size: 18px; }
.rung-label { display: flex; justify-content: space-between; margin-top: 10px; font-size: 14px; }
.rung-label strong { font-family: var(--font-display); font-size: 17px; }
.rung-label span { color: var(--ink-3); }

.foot { padding: 30px 0 40px; color: var(--ink-3); font-size: 14px; border-top: 1px solid var(--line); }

@media (max-width: 520px) {
  .board { padding: 14px; }
  .options { gap: 7px; }
  .option .num { font-size: 10px; top: 2px; left: 5px; }
}
