:root {
  --navy: #071b33;
  --navy-2: #0e2a4a;
  --teal: #0d6672;
  --teal-2: #168a96;
  --gold: #c89a45;
  --cream: #f8f3ea;
  --paper: #fffdf9;
  --line: #e6dccb;
  --ink: #071b33;
  --muted: #5b6b7c;
  --track: #e9e0d0;
  --locked: #f1eadc;
  --tabs: rgba(255, 253, 249, 0.96);
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--cream); color: var(--ink); font: 15px/1.5 var(--sans); }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
small, em { font-style: normal; }

.page { max-width: 880px; margin: 0 auto; padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }
h2 { font: 700 24px/1.2 var(--serif); margin: 32px 0 12px; }
.note, .muted { color: var(--muted); font-size: 13px; }
.note { margin: 28px 0 0; text-align: center; }

/* accueil */
.hero { display: flex; align-items: center; gap: 16px; justify-content: space-between; margin: 0 -16px; padding: calc(28px + env(safe-area-inset-top)) 20px 28px; background: var(--navy); color: #fff; border-radius: 0 0 24px 24px; }
.hero h1 { font: 700 27px/1.12 var(--serif); margin: 4px 0 8px; text-wrap: balance; }
.eyebrow { margin: 0; color: var(--gold); font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; }
.sub { margin: 0; color: #b9c6d6; font-size: 13px; }
.ring { --p: 0; flex: none; width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(closest-side, var(--navy) 80%, transparent 81%), conic-gradient(var(--gold) calc(var(--p) * 1%), rgba(255, 255, 255, 0.16) 0); }
.ring b { font-size: 20px; font-variant-numeric: tabular-nums; }
.ring i { font-style: normal; font-size: 11px; color: #b9c6d6; margin-left: 1px; }

.resume, .plan { display: flex; align-items: center; gap: 14px; margin-top: 14px; padding: 12px 14px; border-radius: 16px; background: var(--paper); border: 1px solid var(--line); }
.resume img { width: 46px; border-radius: 6px; border: 1px solid var(--line); }
.resume span, .plan span { flex: 1; min-width: 0; display: grid; }
.resume small, .plan small { color: var(--teal); font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.resume b, .plan b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.resume em, .plan em { color: var(--muted); font-size: 13px; }
.plan { background: var(--teal); border-color: var(--teal); color: #fff; }
.plan small { color: #ffe2a8; }
.plan em { color: #cfe6e9; }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 620px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 860px) { .grid { grid-template-columns: repeat(4, 1fr); } }
.card { display: grid; gap: 8px; padding: 10px 10px 12px; border-radius: 16px; background: var(--paper); border: 1px solid var(--line); align-content: start; }
.thumb { position: relative; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 10px; background: var(--navy); }
.thumb img { width: 100%; }
.thumb i { position: absolute; left: 8px; top: 8px; font: 700 12px/1 var(--sans); font-style: normal; color: var(--navy); background: var(--gold); padding: 5px 7px; border-radius: 6px; }
.card b { font-size: 14px; line-height: 1.3; }
.card em { color: var(--muted); font-size: 12px; }
.bar { display: block; height: 5px; border-radius: 9px; background: var(--track); overflow: hidden; flex: 1; }
.bar u { display: block; height: 100%; background: var(--teal-2); border-radius: 9px; }

.list { display: grid; gap: 10px; }
.row { display: flex; gap: 14px; align-items: center; padding: 12px; border-radius: 16px; background: var(--paper); border: 1px solid var(--line); }
.row > img { width: 64px; height: 84px; object-fit: cover; object-position: top; border-radius: 8px; border: 1px solid var(--line); flex: none; }
.row > span { flex: 1; min-width: 0; display: grid; gap: 2px; }
.row b { line-height: 1.3; display: flex; gap: 6px; align-items: center; }
.row b svg { width: 16px; height: 16px; color: var(--gold); }
.row em { color: var(--muted); font-size: 13px; }
.row small { color: var(--teal); font-size: 12px; font-weight: 600; }
.row > svg { color: var(--muted); }
.row.is-locked { background: var(--locked); }
.row.is-locked > img { filter: grayscale(0.5); opacity: 0.8; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px; border-radius: 12px; background: var(--teal); color: #fff; font-weight: 600; }
.btn.ghost { background: transparent; color: var(--teal); border: 1.5px solid var(--teal); }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 13px; justify-self: start; margin-top: 6px; background: var(--navy); }

/* module */
.top { display: flex; align-items: center; gap: 8px; padding: calc(14px + env(safe-area-inset-top)) 0 10px; }
.top > span { flex: 1; min-width: 0; display: grid; }
.top small { color: var(--teal); font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.top b { font: 700 24px/1.15 var(--serif); text-wrap: balance; }
.ib { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; flex: none; }
.ib.off { opacity: 0.25; pointer-events: none; }
.lead { margin: 0 0 14px; color: var(--muted); }
.meta { display: flex; align-items: center; gap: 12px; }
.meta em { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.actions { display: flex; gap: 10px; margin: 16px 0 22px; }
.actions .btn:first-child { flex: 1; }
.fiches { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 560px) { .fiches { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 820px) { .fiches { grid-template-columns: repeat(5, 1fr); } }
.fiche { position: relative; display: grid; gap: 6px; }
.fiche img { width: 100%; aspect-ratio: 595 / 842; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.fiche span { font-size: 13px; font-weight: 600; }
.fiche i { position: absolute; top: 8px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.fiche i svg { width: 15px; height: 15px; stroke-width: 2.6; }
.fiche .ok { right: 8px; background: var(--teal-2); }
.fiche .fv { left: 8px; background: var(--gold); }
.fiche .fv svg { fill: #fff; stroke: none; }
.empty { margin-top: 28px; padding: 28px 20px; text-align: center; color: var(--muted); border: 1.5px dashed var(--line); border-radius: 16px; }

/* visionneuse */
.viewer { position: fixed; inset: 0; display: flex; flex-direction: column; background: #04101f; color: #fff; }
.top.dark { padding: calc(8px + env(safe-area-inset-top)) 6px 8px; background: var(--navy); }
.top.dark small { color: #9fb2c7; text-transform: none; letter-spacing: 0; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top.dark b { font: 600 15px/1.3 var(--sans); }
.stage { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; display: flex; }
.stage img { margin: auto; width: auto; max-width: 100%; max-height: 100%; }
.stage.zoomed { display: block; }
.stage.zoomed img { width: 220%; max-width: none; max-height: none; }
@media (min-width: 900px) { .stage.zoomed img { width: 130%; } }
.vbar { display: flex; align-items: center; gap: 8px; padding: 10px 8px calc(10px + env(safe-area-inset-bottom)); background: var(--navy); }
.pill { height: 46px; padding: 0 14px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: rgba(255, 255, 255, 0.1); font-weight: 600; font-size: 14px; }
.pill.main { flex: 1; background: var(--teal-2); }
.pill.main.on { background: transparent; border: 1.5px solid var(--teal-2); color: #8fdbe3; }
.pill.on svg { color: var(--gold); }
#fav.on svg { fill: var(--gold); }
@media (max-width: 420px) { #fav span { display: none; } }

/* parcours */
.day { margin-top: 14px; padding: 14px; border-radius: 16px; background: var(--paper); border: 1px solid var(--line); }
.day.is-done { border-color: var(--teal-2); }
.dayh { display: flex; gap: 12px; align-items: center; margin-bottom: 6px; }
.dayh i { font: 700 13px/1 var(--sans); font-style: normal; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--navy); color: var(--gold); flex: none; }
.day.is-done .dayh i { background: var(--teal-2); color: #fff; }
.dayh span { flex: 1; display: grid; }
.dayh b { font: 700 20px/1.2 var(--serif); }
.dayh em, .step em { color: var(--muted); font-size: 13px; }
.dayh small { color: var(--muted); font-variant-numeric: tabular-nums; }
.step { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.step a { flex: 1; display: grid; }
.step b { font-weight: 500; line-height: 1.35; }
.box { width: 28px; height: 28px; border-radius: 8px; border: 1.8px solid #b9ad97; display: grid; place-items: center; color: transparent; flex: none; }
.box svg { width: 16px; height: 16px; stroke-width: 3; }
.box.on { background: var(--teal-2); border-color: var(--teal-2); color: #fff; }
.box.on + a b { text-decoration: line-through; color: var(--muted); }

/* onglets */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; background: var(--tabs); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.tabs[hidden] { display: none; }
.tabs a { flex: 1; max-width: 180px; display: grid; justify-items: center; gap: 2px; padding: 9px 0 8px; color: var(--muted); font-size: 11px; font-weight: 600; }
.tabs a.on { color: var(--teal); }

/* porte d’entrée */
.gate { min-height: 100vh; min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 14px; padding: 32px 24px; text-align: center; background: var(--navy); color: #fff; }
.gate img { border-radius: 20px; }
.gate h1 { font: 700 28px/1.15 var(--serif); margin: 6px 0 0; max-width: 16em; text-wrap: balance; }
.gate p { margin: 0; max-width: 30em; color: #b9c6d6; }
.gate .btn { margin-top: 8px; background: var(--gold); color: var(--navy); }
.gate a:not(.btn) { color: #fff; text-decoration: underline; }

/* devis : matériel personnalisé */
.devis-card { display: flex; align-items: center; gap: 14px; margin-top: 28px; padding: 16px; border-radius: 16px; background: var(--navy); color: #fff; }
.devis-card > svg:first-child { width: 44px; height: 44px; padding: 11px; border-radius: 12px; background: var(--gold); color: var(--navy); }
.devis-card span { flex: 1; min-width: 0; display: grid; }
.devis-card small { color: var(--gold); font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.devis-card b { font: 700 21px/1.2 var(--serif); }
.devis-card em { color: #b9c6d6; font-size: 13px; }
.form { display: grid; gap: 14px; max-width: 560px; }
.field { display: grid; gap: 6px; }
.field span { font-size: 13px; font-weight: 600; }
.field input, .field select, .field textarea { width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--paper); color: var(--ink); font: 16px/1.4 var(--sans); }
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--teal-2); outline-offset: 1px; border-color: var(--teal-2); }
.form .btn { border: 0; font-size: 15px; }
.form .btn:disabled { background: #b9ad97; cursor: not-allowed; }
.formmsg { margin: 0; font-size: 13px; color: var(--muted); min-height: 1.5em; }

/* ---------- mode sombre ---------- */
html.dark { --cream: #0a1626; --paper: #12233a; --line: #24384f; --ink: #eef3f8; --muted: #9db0c4; --track: #24384f; --locked: #0e1d31; --tabs: rgba(10, 22, 38, 0.96); --teal: #2aa7b4; color-scheme: dark; }
html.dark .btn { color: #04101f; }
html.dark .btn.ghost { color: var(--teal); }
html.dark .btn.small { background: var(--gold); color: #04101f; }
html.dark .fiche img { border-color: var(--line); }
html.dark .hero, html.dark .devis-card { background: #0e2a4a; }
html.dark .dayh i { background: #0e2a4a; }

/* ---------- titres de fiche, aperçu verrouillé ---------- */
.fiche em { font-size: 12px; line-height: 1.35; color: var(--muted); }
.fiche.is-lock img { filter: grayscale(0.6) blur(1.5px); opacity: 0.55; }
.fiche .lk { left: calc(50% - 20px); top: 32%; width: 40px; height: 40px; background: var(--navy); color: var(--gold); }
.fiche .lk svg { width: 20px; height: 20px; stroke-width: 2; }
.cta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 6px; }
.cta .btn.small { margin-top: 0; }
.link { font-size: 13px; font-weight: 600; color: var(--teal); text-decoration: underline; text-underline-offset: 3px; }
.top.dark b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ib.has { color: var(--gold); }

/* ---------- recherche ---------- */
.searchbox { display: flex; align-items: center; gap: 10px; min-height: 48px; margin-top: 14px; padding: 0 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--paper); color: var(--muted); }
.searchbox input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--ink); font: 16px/1.4 var(--sans); padding: 12px 0; }
.searchbox:focus-within { border-color: var(--teal-2); }
.searchbox span { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row.compact > img { width: 44px; height: 58px; }
.row.compact b svg { color: var(--gold); }
.num { font: 700 13px/1 var(--sans); font-style: normal; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--navy); color: var(--gold); flex: none; }

/* ---------- outils ---------- */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 6px; }
@media (min-width: 620px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
.tile { display: grid; gap: 4px; padding: 16px 14px; border-radius: 16px; background: var(--paper); border: 1px solid var(--line); align-content: start; }
.tile svg { width: 38px; height: 38px; padding: 8px; border-radius: 11px; background: var(--teal); color: #fff; margin-bottom: 6px; }
.tile b { line-height: 1.25; }
.tile em { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.settings { margin-top: 22px; }
.settings .row { text-align: left; width: 100%; }
.settings .row > svg { color: var(--teal); width: 26px; height: 26px; }
.switch { width: 46px; height: 28px; border-radius: 99px; background: var(--track); position: relative; flex: none; transition: background 0.2s; }
.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform 0.2s; }
.switch.on { background: var(--teal-2); }
.switch.on::after { transform: translateX(18px); }
.quizlink { display: flex; align-items: center; gap: 12px; margin: -8px 0 22px; padding: 12px 14px; border-radius: 14px; border: 1.5px dashed var(--teal-2); color: var(--ink); }
.quizlink > svg:first-child { color: var(--teal); width: 26px; height: 26px; }
.quizlink span { flex: 1; display: grid; }
.quizlink em { font-size: 13px; color: var(--muted); }

/* ---------- quiz ---------- */
.qtext { font: 700 23px/1.3 var(--serif); margin: 22px 0 16px; text-wrap: pretty; }
.opts { display: grid; gap: 10px; }
.opt { text-align: left; padding: 14px 16px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--paper); line-height: 1.4; min-height: 52px; }
.opt.good { border-color: var(--teal-2); background: rgba(22, 138, 150, 0.14); font-weight: 600; }
.opt.bad { border-color: #c2553f; background: rgba(194, 85, 63, 0.12); }
.explain { margin: 16px 0; padding: 12px 14px; border-radius: 12px; background: var(--locked); color: var(--ink); font-size: 14px; }
#fb .btn { width: 100%; }
.score { text-align: center; padding: 28px 16px; margin-top: 12px; border-radius: 20px; background: var(--navy); color: #fff; }
.score b { font: 700 76px/1 var(--serif); color: var(--gold); }
.score b i { font-style: normal; font-size: 32px; color: #b9c6d6; }
.score p { margin: 10px 0 4px; font-weight: 600; }
.score em { color: #b9c6d6; font-size: 14px; }

/* ---------- flashcards ---------- */
.flash { width: 100%; min-height: 260px; display: grid; align-content: center; justify-items: center; gap: 14px; padding: 24px; border-radius: 22px; background: var(--navy); color: #fff; text-align: center; }
.flash small { color: #9fb2c7; font-size: 12px; letter-spacing: 0.1em; }
.flash b { font: 700 40px/1.15 var(--serif); text-wrap: balance; }
.flash em { color: #9fb2c7; font-size: 13px; }
.flash.flip { background: var(--teal); }
.flash.flip b { font-size: 28px; }
.flash.flip em { color: #d6eef1; font-weight: 600; }
.actions.three .btn { flex: 1; }
.actions.three .btn:first-child { flex: 1; }
.actions.col { flex-direction: column; }
.btn { border: 0; cursor: pointer; }
.btn.ghost { border: 1.5px solid var(--teal); }
.btn:disabled { opacity: 0.5; cursor: default; }

/* ---------- calculateur ---------- */
.cols { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.reading { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 10px; }
.reading li { display: grid; gap: 2px; padding: 12px 14px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); border-left: 5px solid var(--teal-2); }
.reading li.low, .reading li.high { border-left-color: var(--gold); }
.reading li.warn { border-left-color: #c2553f; font-size: 14px; }
.reading em { font-size: 12px; color: var(--muted); }
.note.left { text-align: left; margin-top: 16px; }
.mt { margin-top: 20px; }

/* ---------- glossaire ---------- */
.gloss { margin: 16px 0 0; }
.gloss dt { font-weight: 700; margin-top: 14px; }
.gloss dd { margin: 2px 0 0; color: var(--muted); font-size: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.notetext { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.certimg { width: 100%; height: auto; margin: 20px 0 14px; border-radius: 12px; border: 1px solid var(--line); }

/* ---------- fenêtres (fin de module, notes, accueil guidé) ---------- */
.modal { position: fixed; inset: 0; z-index: 20; display: grid; align-items: end; justify-items: center; background: rgba(4, 16, 31, 0.6); }
@media (min-width: 620px) { .modal { align-items: center; } }
.sheet { width: 100%; max-width: 480px; max-height: 92vh; overflow: auto; padding: 24px 20px calc(22px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; background: var(--cream); color: var(--ink); }
@media (min-width: 620px) { .sheet { border-radius: 22px; } }
.sheet h3 { font: 700 27px/1.15 var(--serif); margin: 0 0 8px; text-wrap: balance; }
.sheet p { margin: 0 0 4px; color: var(--muted); }
.sheet textarea { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--paper); color: var(--ink); font: 16px/1.45 var(--sans); resize: vertical; }
.sheet .actions { margin: 18px 0 0; }
.sheet .actions.col .btn { flex: none; width: 100%; }
.party { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--teal-2); color: #fff; margin-bottom: 14px; }
.party svg { width: 30px; height: 30px; stroke-width: 2.6; }
.offer { display: flex; gap: 14px; margin-top: 18px; padding: 14px; border-radius: 16px; background: var(--paper); border: 1px solid var(--line); }
.offer img { width: 72px; height: 72px; border-radius: 10px; flex: none; object-fit: cover; }
.offer > span { display: grid; gap: 2px; min-width: 0; }
.offer small { color: var(--teal); font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.offer em { font-size: 13px; color: var(--muted); }
.dots { display: flex; gap: 6px; margin-bottom: 16px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--track); }
.dots i.on { width: 24px; border-radius: 9px; background: var(--teal-2); }
@media (prefers-reduced-motion: reduce) { .switch, .switch::after { transition: none; } }
