/* ==========================================================================
   Cap Côtier — feuille de styles
   Direction : « carte marine » — papier de carte, encre marine, lagon, corail.
   Mode nuit : « quart de nuit » — fond abyssal, encre claire, lagon lumineux.
   ========================================================================== */

:root {
  --f-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --f-body: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --f-mono: "DM Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --paper: #f4efe4;
  --paper-2: #ebe3d3;
  --card: #fffdf8;
  --card-2: #f9f5ec;
  --ink: #10233b;
  --ink-2: #33475e;
  --muted: #59687b;
  --line: #ddd3c1;
  --line-strong: #c3b7a1;
  --lagoon: #0b7f86;
  --lagoon-ink: #075e66;
  --lagoon-soft: #d5ece9;
  --coral: #c73d25;
  --coral-ink: #ac311b;
  --coral-soft: #f9ddd5;
  --gold: #b7810f;
  --gold-ink: #7f5a00;
  --gold-soft: #f6e7c4;
  --port: #c9312f;
  --stbd: #11834f;
  --ok: #0c7344;
  --ok-soft: #dcefe3;
  --bad: #b3261f;
  --bad-soft: #f7dcda;
  --night-fig: #0a1628;
  --contour: rgba(16, 35, 59, 0.07);
  --shadow-1: 0 1px 0 rgba(16, 35, 59, 0.06), 0 1px 3px rgba(16, 35, 59, 0.06);
  --shadow-2: 0 2px 0 rgba(16, 35, 59, 0.05), 0 10px 30px -12px rgba(16, 35, 59, 0.25);
  --radius: 14px;
  --radius-sm: 9px;
  --focus: 0 0 0 3px var(--paper), 0 0 0 5.5px var(--lagoon);
  --on-state: #ffffff;
  --header-h: 64px;
  color-scheme: light;
}

:root[data-theme="night"] {
  --paper: #071220;
  --paper-2: #0b1a2c;
  --card: #0e1f33;
  --card-2: #11253c;
  --ink: #e9eff7;
  --ink-2: #c3cfdd;
  --muted: #8ea0b6;
  --line: #1e3550;
  --line-strong: #2c4a6c;
  --lagoon: #45d1c8;
  --lagoon-ink: #7fe3dc;
  --lagoon-soft: rgba(69, 209, 200, 0.13);
  --coral: #ff7f63;
  --coral-soft: rgba(255, 127, 99, 0.14);
  --gold: #f2bf4b;
  --gold-ink: #f2bf4b;
  --coral-ink: #ff8c72;
  --on-state: #06140d;
  --gold-soft: rgba(242, 191, 75, 0.13);
  --port: #ff6b67;
  --stbd: #3fd68a;
  --ok: #46d98f;
  --ok-soft: rgba(70, 217, 143, 0.13);
  --bad: #ff6b67;
  --bad-soft: rgba(255, 107, 103, 0.13);
  --night-fig: #050c18;
  --contour: rgba(120, 190, 230, 0.06);
  --shadow-1: 0 1px 0 rgba(0, 0, 0, 0.3);
  --shadow-2: 0 14px 40px -16px rgba(0, 0, 0, 0.7);
  --focus: 0 0 0 3px var(--paper), 0 0 0 5.5px var(--lagoon);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--paper);
  background-image: url("../assets/contours.svg");
  background-size: 900px auto;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
:root[data-theme="night"] body { background-image: url("../assets/contours-night.svg"); }
img, svg { max-width: 100%; }
a { color: var(--lagoon-ink); text-underline-offset: 3px; }
button { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
main#view:focus, main#view:focus-visible { box-shadow: none; outline: none; }
::selection { background: var(--lagoon); color: #fff; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 10px; font-weight: 700; text-decoration: none; transition: top .2s; }
.skip-link:focus { top: 10px; }
.hidden { display: none !important; }

h1, h2, h3, h4 { font-family: var(--f-display); font-weight: 600; line-height: 1.12; letter-spacing: -0.01em; margin: 0; color: var(--ink); font-variation-settings: "SOFT" 50, "opsz" 72; }
.eyebrow {
  font-family: var(--f-mono); font-size: 0.74rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--lagoon-ink); display: inline-flex; align-items: center; gap: 0.55em;
}
.eyebrow::before { content: ""; width: 22px; height: 1.5px; background: currentColor; display: inline-block; }
.mono { font-family: var(--f-mono); }
.muted { color: var(--muted); }

/* ---------- Header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--header-h);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { max-width: 1180px; margin: 0 auto; height: 100%; padding: 0 20px; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.brand-mark { width: 38px; height: 38px; flex-shrink: 0; }
.brand-name { font-family: var(--f-display); font-size: 1.32rem; font-weight: 650; letter-spacing: -0.02em; line-height: 1; }
.brand-name em { font-style: italic; font-weight: 500; color: var(--lagoon); }
.brand-sub { display: block; font-family: var(--f-mono); font-size: 0.62rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a {
  position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px;
  text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: 0.95rem; transition: background .2s, color .2s;
}
.nav a svg { width: 18px; height: 18px; opacity: .8; }
.nav a:hover { background: var(--paper-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--ink); color: var(--paper); }
.nav a[aria-current="page"] svg { opacity: 1; }
.top-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--line); background: var(--card);
  display: inline-grid; place-items: center; cursor: pointer; color: var(--ink-2); transition: border-color .2s, transform .15s;
}
.icon-btn:hover { border-color: var(--line-strong); color: var(--ink); }
.icon-btn:active { transform: scale(.95); }
.icon-btn svg { width: 19px; height: 19px; }
.theme-btn .t-ico { display: none; }
:root[data-theme-setting="auto"] .theme-btn .t-auto,
:root[data-theme-setting="light"] .theme-btn .t-light,
:root[data-theme-setting="night"] .theme-btn .t-night { display: block; }

/* Bottom nav (mobile) */
.tabbar { display: none; }

/* ---------- Layout ---------- */
main#view { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 32px 20px 72px; }
.view-enter > * { animation: rise .5s cubic-bezier(.2, .7, .2, 1) both; }
.view-enter > *:nth-child(2) { animation-delay: .06s; }
.view-enter > *:nth-child(3) { animation-delay: .12s; }
.view-enter > *:nth-child(4) { animation-delay: .18s; }
.view-enter > *:nth-child(5) { animation-delay: .24s; }
.view-enter > *:nth-child(n+6) { animation-delay: .3s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0ms !important; transition-duration: .001ms !important; } }

.page-head { margin-bottom: 30px; max-width: 760px; }
.page-head h1 { font-size: clamp(2rem, 4.4vw, 3.1rem); margin: 10px 0 12px; }
.page-head p { color: var(--ink-2); font-size: 1.08rem; margin: 0; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 16px; margin: 44px 0 16px; flex-wrap: wrap; }
.section-title > div { display: grid; gap: 4px; }
.section-title h2 { font-size: 1.55rem; }
.section-title p { margin: 0; color: var(--muted); font-size: .95rem; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ---------- Buttons ---------- */
.btn {
  --b-bg: var(--card); --b-fg: var(--ink); --b-bd: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 44px; padding: 10px 20px;
  border-radius: 999px; border: 1.5px solid var(--b-bd); background: var(--b-bg); color: var(--b-fg);
  font-weight: 700; font-size: .96rem; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .15s, box-shadow .2s, background .2s, border-color .2s;
}
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); }
.btn:active { transform: translateY(0) scale(.98); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary { --b-bg: var(--ink); --b-fg: var(--paper); --b-bd: var(--ink); }
.btn-accent { --b-bg: var(--coral); --b-fg: #fff; --b-bd: var(--coral); }
:root[data-theme="night"] .btn-accent { --b-fg: #1a0a06; }
.btn-lagoon { --b-bg: var(--lagoon); --b-fg: #fff; --b-bd: var(--lagoon); }
:root[data-theme="night"] .btn-lagoon { --b-fg: #04201f; }
.btn-ghost { --b-bg: transparent; --b-bd: var(--line-strong); }
.btn-quiet { --b-bg: transparent; --b-bd: transparent; padding-inline: 12px; }
.btn-quiet:hover { box-shadow: none; background: var(--paper-2); }
.btn-danger { --b-bg: transparent; --b-fg: var(--bad); --b-bd: color-mix(in srgb, var(--bad) 45%, transparent); }
.btn-sm { min-height: 36px; padding: 6px 14px; font-size: .88rem; }
.btn-lg { min-height: 52px; padding: 12px 26px; font-size: 1.02rem; }
.btn-block { width: 100%; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-family: var(--f-mono); font-size: .72rem; letter-spacing: .04em; border: 1px solid var(--line); color: var(--ink-2); background: var(--card-2);
  white-space: nowrap;
}
.chip.is-ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: var(--ok-soft); }
.chip.is-warn { color: var(--gold-ink); border-color: color-mix(in srgb, var(--gold) 35%, transparent); background: var(--gold-soft); }
.chip.is-bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); background: var(--bad-soft); }
.chip.is-lagoon { color: var(--lagoon-ink); border-color: color-mix(in srgb, var(--lagoon) 35%, transparent); background: var(--lagoon-soft); }

/* ---------- Chart frame (bordure graduée de carte marine) ---------- */
.chart-frame {
  position: relative; border-radius: 4px; padding: 10px;
  background:
    repeating-linear-gradient(90deg, var(--ink) 0 28px, var(--card) 28px 56px) top / 100% 5px no-repeat,
    repeating-linear-gradient(90deg, var(--ink) 0 28px, var(--card) 28px 56px) bottom / 100% 5px no-repeat,
    repeating-linear-gradient(180deg, var(--ink) 0 28px, var(--card) 28px 56px) left / 5px 100% no-repeat,
    repeating-linear-gradient(180deg, var(--ink) 0 28px, var(--card) 28px 56px) right / 5px 100% no-repeat,
    var(--card);
  border: 1.5px solid var(--ink);
}
.chart-frame > .chart-inner { border: 1px solid var(--ink); border-radius: 2px; overflow: hidden; position: relative; }

/* ---------- Home ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 36px; align-items: center; margin-bottom: 14px; }
.hero h1 { font-size: clamp(2.3rem, 5.6vw, 4.1rem); line-height: 1.02; margin: 16px 0 18px; font-variation-settings: "SOFT" 100, "opsz" 144; }
.hero h1 em { font-style: italic; color: var(--lagoon); font-weight: 500; }
.hero-lede { font-size: 1.12rem; color: var(--ink-2); max-width: 34em; margin: 0 0 24px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-facts { display: flex; gap: 22px; margin-top: 26px; flex-wrap: wrap; }
.fact { display: flex; flex-direction: column; }
.fact b { font-family: var(--f-display); font-size: 1.9rem; font-weight: 600; line-height: 1; }
.fact span { font-family: var(--f-mono); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.route-map svg { display: block; width: 100%; height: auto; }
.map-label { font-family: var(--f-body); font-weight: 700; font-size: 14px; fill: var(--ink); paint-order: stroke; stroke: color-mix(in srgb, var(--lagoon) 9%, var(--card)); stroke-width: 5px; stroke-linejoin: round; }
.map-sub { font-family: var(--f-mono); font-size: 10.5px; fill: var(--muted); paint-order: stroke; stroke: color-mix(in srgb, var(--lagoon) 9%, var(--card)); stroke-width: 4px; }
.route-done { transition: stroke-dasharray 1.2s ease; }
.route-caption { display: flex; justify-content: space-between; padding: 8px 4px 0; font-family: var(--f-mono); font-size: .68rem; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }

.next-step {
  display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; padding: 18px 20px; margin-top: 30px;
  border-left: 4px solid var(--coral);
}
.next-step .ns-icon { width: 46px; height: 46px; border-radius: 12px; background: var(--coral-soft); color: var(--coral); display: grid; place-items: center; }
.next-step .ns-icon svg { width: 24px; height: 24px; }
.next-step h3 { font-size: 1.15rem; margin: 2px 0 2px; }
.next-step p { margin: 0; color: var(--muted); font-size: .92rem; }

.tile {
  position: relative; padding: 22px; display: flex; flex-direction: column; gap: 10px; min-height: 100%;
  text-decoration: none; color: inherit; transition: transform .2s, box-shadow .2s, border-color .2s; overflow: hidden;
}
a.tile:hover, button.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--line-strong); }
.tile h3 { font-size: 1.22rem; }
.tile p { margin: 0; color: var(--ink-2); font-size: .94rem; }
.tile .tile-meta { margin-top: auto; padding-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tile-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--lagoon-soft); color: var(--lagoon-ink); }
.tile-icon svg { width: 24px; height: 24px; }
.tile.is-feature { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.tile.is-feature h3, .tile.is-feature p { color: var(--paper); }
.tile.is-feature p { opacity: .82; }
.tile.is-feature .tile-icon { background: rgba(255,255,255,.1); color: #ffd9a8; }
:root[data-theme="night"] .tile.is-feature { background: linear-gradient(150deg, #123150, #0b2038); border-color: #23466e; color: var(--ink); }
:root[data-theme="night"] .tile.is-feature h3, :root[data-theme="night"] .tile.is-feature p { color: var(--ink); }
.tile.is-feature .chip { background: rgba(255,255,255,.08); color: inherit; border-color: rgba(255,255,255,.2); }
.tile-deco { position: absolute; right: -24px; bottom: -30px; width: 150px; opacity: .14; pointer-events: none; }

.stat-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { padding: 18px 20px; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat b { display: block; font-family: var(--f-display); font-size: 2rem; font-weight: 600; line-height: 1.05; }
.stat span { font-family: var(--f-mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

/* ---------- Course index ---------- */
.module { margin-bottom: 36px; }
.module-head { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: end; padding-bottom: 14px; border-bottom: 2px solid var(--ink); margin-bottom: 4px; }
.module-num { font-family: var(--f-display); font-size: 3.2rem; line-height: .8; font-weight: 500; font-style: italic; color: var(--lagoon); font-variation-settings: "SOFT" 100, "opsz" 144; }
.module-head h2 { font-size: 1.6rem; }
.module-head p { margin: 4px 0 0; color: var(--muted); font-size: .94rem; }
.chapter-list { list-style: none; margin: 0; padding: 0; }
.chapter-row {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 16px; align-items: center; padding: 16px 8px; border-bottom: 1px dashed var(--line-strong);
  text-decoration: none; color: inherit; transition: background .2s, padding .2s;
}
.chapter-row:hover { background: color-mix(in srgb, var(--card) 70%, transparent); padding-left: 14px; }
.chapter-no { font-family: var(--f-mono); font-size: .8rem; color: var(--muted); letter-spacing: .08em; }
.chapter-no b { display: block; font-family: var(--f-display); font-size: 1.5rem; color: var(--ink); letter-spacing: 0; font-weight: 500; }
.chapter-row h3 { font-size: 1.16rem; font-family: var(--f-body); font-weight: 700; letter-spacing: 0; }
.chapter-row p { margin: 3px 0 0; color: var(--muted); font-size: .9rem; }
.chapter-side { display: flex; align-items: center; gap: 12px; }
.ring { --p: 0; --c: var(--lagoon); width: 42px; height: 42px; border-radius: 50%; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--line) 0); display: grid; place-items: center; flex-shrink: 0; }
.ring::before { content: ""; width: 32px; height: 32px; border-radius: 50%; background: var(--paper); grid-area: 1 / 1; }
.ring span { grid-area: 1 / 1; font-family: var(--f-mono); font-size: .64rem; z-index: 1; }
.read-badge { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: grid; place-items: center; color: transparent; }
.read-badge.is-read { background: var(--ok); border-color: var(--ok); color: var(--on-state); }
.read-badge svg { width: 14px; height: 14px; }

/* ---------- Reader ---------- */
.reader { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 48px; align-items: start; }
.reader > article { min-width: 0; }
.reader-aside { position: sticky; top: calc(var(--header-h) + 24px); font-size: .9rem; }
.reader-aside .toc-title { font-family: var(--f-mono); font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.toc { list-style: none; margin: 0 0 22px; padding: 0; border-left: 1.5px solid var(--line); }
.toc a { display: block; padding: 5px 0 5px 14px; margin-left: -1.5px; border-left: 1.5px solid transparent; color: var(--ink-2); text-decoration: none; line-height: 1.35; }
.toc a:hover { color: var(--ink); }
.toc a.is-active { border-left-color: var(--coral); color: var(--ink); font-weight: 700; }
.reader-progress { position: fixed; top: var(--header-h); left: 0; height: 3px; background: var(--coral); width: 0; z-index: 41; transition: width .1s linear; }
.lesson-head { margin-bottom: 26px; }
.lesson-head .crumbs { font-family: var(--f-mono); font-size: .74rem; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; display: flex; gap: 8px; flex-wrap: wrap; }
.lesson-head .crumbs a { color: var(--muted); }
.lesson-head h1 { font-size: clamp(2rem, 4.5vw, 3rem); margin: 12px 0 10px; }
.lesson-head .subtitle { font-size: 1.12rem; color: var(--ink-2); margin: 0 0 16px; }
.lesson-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.keyrules { margin: 0 0 34px; padding: 22px 24px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); position: relative; }
.keyrules h2 { font-size: 1.05rem; font-family: var(--f-mono); font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--coral-ink); margin-bottom: 12px; }
.keyrules ol { margin: 0; padding: 0; list-style: none; counter-reset: k; display: grid; gap: 8px; }
.keyrules li { counter-increment: k; display: grid; grid-template-columns: 30px 1fr; gap: 8px; }
.keyrules li::before { content: counter(k, decimal-leading-zero); font-family: var(--f-mono); font-size: .78rem; color: var(--muted); padding-top: 3px; }

.lesson { max-width: 760px; }
.lesson > * + * { margin-top: 1.05em; }
.lesson .lead { font-size: 1.17rem; color: var(--ink-2); font-family: var(--f-display); font-weight: 400; line-height: 1.5; font-variation-settings: "SOFT" 100, "opsz" 24; }
.lesson h3 { font-size: 1.6rem; margin-top: 2.1em; padding-top: .2em; scroll-margin-top: calc(var(--header-h) + 20px); }
.lesson h3::before { content: ""; display: block; width: 36px; height: 3px; background: var(--coral); margin-bottom: 14px; border-radius: 2px; }
.lesson h4 { font-family: var(--f-body); font-size: 1.04rem; font-weight: 700; letter-spacing: 0; }
.lesson p { margin-bottom: 0; }
.lesson ul, .lesson ol { padding-left: 1.3em; }
.lesson li + li { margin-top: .35em; }
.lesson strong { font-weight: 700; color: var(--ink); }

.callout { border-radius: var(--radius-sm); padding: 16px 18px 16px 52px; position: relative; border: 1px solid; }
.callout > strong:first-child { display: block; font-family: var(--f-mono); font-size: .76rem; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 4px; }
.callout p { margin: 0; }
.callout p + p { margin-top: .5em; }
.callout::before { content: ""; position: absolute; left: 16px; top: 17px; width: 22px; height: 22px; background: currentColor; -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat; }
.callout.tip { background: var(--lagoon-soft); border-color: color-mix(in srgb, var(--lagoon) 30%, transparent); }
.callout.tip::before, .callout.tip > strong:first-child { color: var(--lagoon-ink); }
.callout.tip { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 18h6M10 21h4M12 3a6 6 0 0 0-3.6 10.8c.6.5 1.1 1.3 1.1 2.2h5c0-.9.5-1.7 1.1-2.2A6 6 0 0 0 12 3z' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); }
.callout.warn { background: var(--coral-soft); border-color: color-mix(in srgb, var(--coral) 30%, transparent); }
.callout.warn::before, .callout.warn > strong:first-child { color: var(--coral-ink); }
.callout.warn { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3 2 21h20L12 3zm0 6v6m0 3v.5' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.callout.pf { background: var(--gold-soft); border-color: color-mix(in srgb, var(--gold) 35%, transparent); }
.callout.pf::before, .callout.pf > strong:first-child { color: var(--gold-ink); }
.callout.pf { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='10' r='4' fill='none' stroke='black' stroke-width='2'/%3E%3Cpath d='M2 17c2.5 0 2.5-1.5 5-1.5s2.5 1.5 5 1.5 2.5-1.5 5-1.5 2.5 1.5 5 1.5M2 21c2.5 0 2.5-1.5 5-1.5s2.5 1.5 5 1.5 2.5-1.5 5-1.5 2.5 1.5 5 1.5' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); }

.mnemo { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; padding: 14px 18px; border: 1.5px dashed var(--line-strong); border-radius: var(--radius-sm); background: var(--card); }
.mnemo-key { font-family: var(--f-display); font-style: italic; font-weight: 600; font-size: 1.7rem; line-height: 1; color: var(--coral-ink); min-width: 2.2em; text-align: center; font-variation-settings: "SOFT" 100, "opsz" 144; }
.mnemo p { margin: 0; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.card > * { margin: 0; }
.card h4 { font-size: 1.02rem; }
.card p { font-size: .94rem; color: var(--ink-2); }
.card figure.fig { margin: 0 0 4px; background: var(--card-2); border-radius: 10px; padding: 10px; }
.card dl { margin: 0; display: grid; gap: 2px; font-size: .9rem; line-height: 1.45; }
.card dt { font-family: var(--f-mono); font-size: .66rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.card dd { margin: 0; }
.card figure.fig figcaption { display: none; }
.card .fig-rhythm + figcaption, .card figure.fig:has(.fig-rhythm) figcaption, .card figure.fig:has(.fig-lights) figcaption { display: block; font-size: .76rem; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); }
.data-table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.data-table th { font-family: var(--f-mono); font-weight: 500; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); text-align: left; padding: 11px 14px; background: var(--card-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table td figure.fig { margin: 0; max-width: 140px; }
.checklist { list-style: none; padding: 0 !important; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px 18px; }
.checklist li { margin: 0 !important; padding-left: 30px; position: relative; }
.checklist li::before { content: ""; position: absolute; left: 0; top: 3px; width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--lagoon); background: var(--lagoon-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 12 4 4 8-8' fill='none' stroke='%230b7f86' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat; }
.steps { list-style: none; padding: 0 !important; counter-reset: s; display: grid; gap: 10px; }
.steps li { counter-increment: s; position: relative; padding: 10px 14px 10px 52px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); margin: 0 !important; }
.steps li::before { content: counter(s); position: absolute; left: 12px; top: 9px; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: var(--paper); font-family: var(--f-mono); font-size: .8rem; display: grid; place-items: center; }
.formula { font-family: var(--f-mono); font-size: 1.02rem; padding: 18px 20px; border-radius: var(--radius-sm); background: var(--ink); color: var(--paper); text-align: center; line-height: 1.9; }
:root[data-theme="night"] .formula { background: #050d19; color: var(--lagoon-ink); border: 1px solid var(--line); }
.formula .op { color: #ffb38a; padding: 0 .3em; }

/* ---------- Figures ---------- */
figure.fig { margin: 1.2em 0; display: flex; flex-direction: column; align-items: center; gap: 8px; }
figure.fig figcaption { font-size: .84rem; color: var(--muted); text-align: center; line-height: 1.4; }
.fig-art { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.fig-art svg { display: block; height: auto; }
.fig-mark svg { width: 110px; }
.card .fig-mark svg { width: 92px; }
.fig-rhythm svg { width: 100%; max-width: 420px; }
.fig-lights svg { width: 100%; max-width: 280px; }
.fig-shapes svg { width: 90px; }
.fig-flag svg { width: 130px; }
.fig-sound > svg { height: 42px; width: auto; }
.fig-port svg { width: 84px; }
.fig-encounter svg { width: 100%; max-width: 380px; }
.fig-sectors svg { width: 100%; max-width: 320px; }
.fig-cardinal-rose svg { width: 100%; max-width: 360px; }
.lesson .card-grid figure.fig, .lesson .data-table figure.fig { margin: 0; }
.photo-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin: 1.2em 0; }
figure.photo { margin: 0; display: flex; flex-direction: column; gap: 8px; }
figure.photo img { display: block; width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--line); }
figure.photo figcaption { font-size: .84rem; color: var(--muted); text-align: center; line-height: 1.4; }
.fig-water-shadow { fill: var(--ink); opacity: .08; }
.fig-wave { stroke: var(--lagoon); opacity: .55; }
.fig-night { fill: var(--night-fig); }
.fig-tick { stroke: var(--muted); stroke-width: 1; }
.fig-tick-label { font-family: var(--f-mono); font-size: 11px; fill: var(--muted); }
.fig-shape { fill: #141a24; stroke: #000; stroke-width: 1; }
:root[data-theme="night"] .fig-shape { fill: #05080d; stroke: #8ea0b6; }
.fig-halyard { stroke: var(--ink-2); stroke-width: 1.5; stroke-dasharray: 3 3; }
.fig-yard { stroke: var(--ink-2); stroke-width: 3; stroke-linecap: round; }
.fig-pole { stroke: var(--ink-2); stroke-width: 3.5; stroke-linecap: round; }
.fig-flag-edge { stroke: rgba(0,0,0,.35); stroke-width: 1; fill-rule: evenodd; }
.fig-sound-bar.is-short { fill: var(--coral); }
.fig-sound-bar.is-long { fill: var(--ink); }
:root[data-theme="night"] .fig-sound-bar.is-long { fill: var(--lagoon); }
.fig-play { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); background: var(--card); border-radius: 999px; padding: 4px 12px 4px 9px; font-size: .8rem; font-weight: 700; cursor: pointer; color: var(--ink-2); }
.fig-play:hover { border-color: var(--lagoon); color: var(--lagoon-ink); }
.fig-blink { animation: blink 1.2s steps(2, jump-none) infinite; }
@keyframes blink { 50% { opacity: .15; } }
.fig-sea { fill: color-mix(in srgb, var(--lagoon) 12%, var(--card)); }
.fig-land { fill: color-mix(in srgb, var(--gold) 28%, var(--card)); stroke: var(--line-strong); }
.fig-axis { stroke: var(--muted); stroke-dasharray: 6 6; stroke-width: 1; }
.fig-boat { stroke: #0d1420; stroke-width: 1.4; }
.fig-boat.is-me { fill: #fff8e8; }
.fig-boat.is-other { fill: #c9d6e6; }
.fig-boat-cabin { fill: #0d1420; opacity: .55; }
.fig-route { fill: none; stroke-width: 2.4; stroke-linecap: round; }
.fig-route.is-ghost { stroke: var(--muted); stroke-dasharray: 5 6; stroke-width: 1.6; }
.fig-route.is-accent { stroke: var(--coral); }
.fig-arrowhead { fill: var(--muted); }
.fig-arrowhead-accent { fill: var(--coral); }
.fig-label { font-family: var(--f-body); font-size: 12.5px; font-weight: 700; fill: var(--ink); paint-order: stroke; stroke: color-mix(in srgb, var(--lagoon) 12%, var(--card)); stroke-width: 4px; stroke-linejoin: round; }
.fig-label-sub { font-family: var(--f-mono); font-size: 10px; fill: var(--muted); paint-order: stroke; stroke: color-mix(in srgb, var(--lagoon) 12%, var(--card)); stroke-width: 3px; }
.fig-sector-white { fill: rgba(255, 247, 214, .16); stroke: rgba(255, 247, 214, .5); }
.fig-sector-green { fill: rgba(54, 224, 122, .33); stroke: #36e07a; }
.fig-sector-red { fill: rgba(255, 75, 75, .33); stroke: #ff4b4b; }
.fig-sector-stern { fill: rgba(255, 255, 255, .1); stroke: rgba(255, 255, 255, .45); stroke-dasharray: 4 4; }
.fig-sector-label { font-family: var(--f-mono); font-size: 11px; fill: #e6edf7; }
.fig-sector-label.is-green { fill: #5fe69a; }
.fig-sector-label.is-red { fill: #ff8a87; }
.fig-rose-lines line { stroke: var(--line-strong); stroke-dasharray: 3 5; }
.fig-danger-zone { fill: color-mix(in srgb, var(--coral) 14%, transparent); stroke: var(--coral); stroke-dasharray: 4 4; }
.fig-rock { fill: var(--ink-2); }

/* ---------- Training hub ---------- */
.exam-hero { display: grid; grid-template-columns: 1.3fr 1fr; overflow: hidden; }
.exam-hero .eh-body { padding: 30px; display: flex; flex-direction: column; gap: 14px; }
.exam-hero h2 { font-size: clamp(1.7rem, 3vw, 2.3rem); }
.exam-hero p { margin: 0; color: var(--ink-2); }
.exam-hero .eh-rules { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); margin-top: 6px; }
.exam-hero .eh-rules div { padding: 14px 0 0; }
.exam-hero .eh-rules b { font-family: var(--f-display); font-size: 1.9rem; display: block; line-height: 1; font-weight: 600; }
.exam-hero .eh-rules span { font-family: var(--f-mono); font-size: .66rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.exam-hero .eh-art { background: var(--ink); position: relative; min-height: 240px; }
:root[data-theme="night"] .exam-hero .eh-art { background: #050d19; }
.exam-hero .eh-art svg { position: absolute; inset: 0; width: 100%; height: 100%; }

.list-rows { display: grid; }
.list-row { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row h4 { font-family: var(--f-body); font-size: 1rem; letter-spacing: 0; }
.list-row p { margin: 2px 0 0; font-size: .86rem; color: var(--muted); }
.list-row .lr-side { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.bar { display: inline-block; vertical-align: middle; height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; width: 90px; }
.bar > i { display: block; height: 100%; background: var(--lagoon); border-radius: 99px; }

/* ---------- Quiz ---------- */
.quiz { max-width: 860px; margin: 0 auto; }
.quiz-top { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; margin-bottom: 18px; }
.quiz-title { font-family: var(--f-mono); font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quiz-progress { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.quiz-progress > i { display: block; height: 100%; background: var(--lagoon); transition: width .35s ease; }
.quiz-counter { font-family: var(--f-mono); font-size: .9rem; color: var(--ink-2); }
.timer { display: inline-flex; align-items: center; gap: 7px; font-family: var(--f-mono); font-size: .95rem; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); }
.timer svg { width: 16px; height: 16px; }
.timer.is-low { color: var(--bad); border-color: var(--bad); animation: blink 1s steps(2, jump-none) infinite; }
.q-card { padding: clamp(18px, 3.5vw, 32px); }
.q-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.q-text { font-family: var(--f-display); font-size: clamp(1.25rem, 2.6vw, 1.6rem); font-weight: 500; line-height: 1.3; margin: 0 0 20px; font-variation-settings: "SOFT" 60, "opsz" 36; }
.q-media { display: flex; justify-content: center; margin: 0 0 22px; }
.q-media .q-img { display: block; max-width: 100%; height: clamp(170px, 32vh, 300px); width: auto; object-fit: contain; border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: zoom-in; }
.q-media .zoom-btn { all: unset; position: relative; cursor: zoom-in; border-radius: 10px; }
.q-media .zoom-btn:focus-visible { box-shadow: var(--focus); }
.q-media .zoom-btn::after { content: ""; position: absolute; right: 8px; bottom: 8px; width: 30px; height: 30px; border-radius: 50%; background: rgba(16, 35, 59, .72) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='6' fill='none' stroke='white' stroke-width='2'/%3E%3Cpath d='m20 20-4.5-4.5M11 8v6M8 11h6' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / 18px no-repeat; }
.q-media figure.fig { margin: 0; background: var(--card-2); border-radius: 12px; padding: 14px 18px; border: 1px solid var(--line); }
.options { display: grid; gap: 10px; }
.opt {
  display: grid; grid-template-columns: 40px 1fr auto; gap: 14px; align-items: center; width: 100%; text-align: left; cursor: pointer;
  padding: 12px 16px 12px 12px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card-2);
  transition: border-color .15s, background .15s, transform .12s; font-size: 1.02rem; line-height: 1.4;
}
.opt:hover:not([disabled]) { border-color: var(--lagoon); background: var(--card); }
.opt:active:not([disabled]) { transform: scale(.995); }
.opt .key { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; font-family: var(--f-mono); font-weight: 500; border: 1.5px solid var(--line-strong); background: var(--card); color: var(--ink-2); }
.opt .mark { width: 22px; height: 22px; }
.opt.is-selected { border-color: var(--ink); background: var(--card); }
.opt.is-selected .key { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.opt.is-correct { border-color: var(--ok); background: var(--ok-soft); }
.opt.is-correct .key { background: var(--ok); border-color: var(--ok); color: var(--on-state); }
.opt.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.is-wrong .key { background: var(--bad); border-color: var(--bad); color: var(--on-state); }
.opt[disabled] { cursor: default; }
.opt.is-dim { opacity: .55; }
.feedback { margin-top: 18px; padding: 16px 18px; border-radius: 12px; border-left: 4px solid; animation: rise .35s ease both; }
.feedback.is-ok { background: var(--ok-soft); border-color: var(--ok); }
.feedback.is-bad { background: var(--bad-soft); border-color: var(--bad); }
.feedback h4 { font-family: var(--f-body); font-size: 1rem; letter-spacing: 0; margin-bottom: 4px; }
.feedback p { margin: 0; color: var(--ink-2); }
.quiz-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.quiz-actions .spacer { flex: 1; }
.kbd-hint { font-family: var(--f-mono); font-size: .72rem; color: var(--muted); text-align: center; margin-top: 16px; }
kbd { font-family: var(--f-mono); font-size: .72rem; padding: 1px 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; background: var(--card); }
.q-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; justify-content: center; }
.q-grid button { width: 40px; height: 40px; border-radius: 8px; border: 1.5px solid var(--line); background: var(--card); font-family: var(--f-mono); font-size: .8rem; cursor: pointer; }
.q-grid button.is-answered { background: var(--lagoon-soft); border-color: color-mix(in srgb, var(--lagoon) 50%, transparent); }
.q-grid button.is-current { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.q-grid button.is-flagged { box-shadow: inset 0 -3px 0 var(--gold); }

/* Results */
.result-hero { display: grid; grid-template-columns: auto 1fr; gap: 30px; align-items: center; padding: 30px; }
.dial { --p: 0; --c: var(--ok); width: 150px; height: 150px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--line) 0); }
.dial::before { content: ""; width: 122px; height: 122px; border-radius: 50%; background: var(--card); grid-area: 1/1; }
.dial div { grid-area: 1/1; z-index: 1; text-align: center; }
.dial b { font-family: var(--f-display); font-size: 2.4rem; line-height: 1; display: block; font-weight: 600; }
.dial span { font-family: var(--f-mono); font-size: .7rem; color: var(--muted); letter-spacing: .08em; }
.result-hero h1 { font-size: clamp(1.8rem, 3.5vw, 2.6rem); margin: 6px 0 10px; }
.result-hero p { margin: 0 0 16px; color: var(--ink-2); }
.review { display: grid; gap: 12px; }
.review-item { padding: 18px 20px; display: grid; grid-template-columns: 1fr; gap: 10px; border-left: 4px solid var(--ok); }
.review-item.is-bad { border-left-color: var(--bad); }
.review-item .ri-q { font-weight: 700; }
.review-item .ri-row { display: flex; gap: 14px; align-items: flex-start; }
.review-item .ri-row img { width: 110px; border-radius: 8px; border: 1px solid var(--line); background: #fff; flex-shrink: 0; }
.review-item .ri-row figure.fig { margin: 0; width: 120px; flex-shrink: 0; background: var(--card-2); border-radius: 8px; padding: 6px; }
.review-item .ri-row .fig-art svg { max-width: 100%; }
.review-item .ri-row .zoom-btn { all: unset; cursor: zoom-in; flex-shrink: 0; }
.review-item .ri-ans { font-size: .93rem; }
.review-item .ri-ans .ok { color: var(--ok); font-weight: 700; }
.review-item .ri-ans .bad { color: var(--bad); font-weight: 700; text-decoration: line-through; }
.review-item .ri-exp { font-size: .9rem; color: var(--ink-2); }

/* ---------- Progress page ---------- */
.readiness { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; padding: 26px; }
.readiness h2 { font-size: 1.5rem; margin-bottom: 6px; }
.readiness p { margin: 0; color: var(--ink-2); }
.mastery-table td:first-child { min-width: 220px; }
.mastery-table .bar { width: 120px; }
.history-row { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); align-items: center; }
.history-row:last-child { border-bottom: 0; }
.history-row small { display: block; color: var(--muted); font-family: var(--f-mono); font-size: .72rem; }
.profile-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.profile-row:last-child { border-bottom: 0; }
.profile-row .avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--lagoon-soft); color: var(--lagoon-ink); display: grid; place-items: center; font-weight: 700; font-family: var(--f-display); }
.profile-row .p-name { flex: 1; font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.setting { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.setting:last-child { border-bottom: 0; }
.setting small { display: block; color: var(--muted); font-size: .85rem; }
.switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--line-strong); transition: background .2s; }
.switch span::before { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + span { background: var(--lagoon); }
.switch input:checked + span::before { transform: translateX(20px); }
.switch input:focus-visible + span { box-shadow: var(--focus); }
.pad { padding: 22px 24px; }
.pad h3 { font-size: 1.2rem; margin-bottom: 4px; }
.pad > p { margin: 0 0 10px; color: var(--muted); font-size: .92rem; }

/* ---------- Credits / footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 28px 20px 36px; color: var(--muted); font-size: .9rem; }
.site-footer .inner { max-width: 1180px; margin: 0 auto; display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: center; }
.site-footer a { color: var(--ink-2); }
.credit-card { display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: center; padding: 24px 26px; }
.credit-card .cc-mark { width: 64px; height: 64px; border-radius: 16px; background: #10233b; color: #ffd9a8; display: grid; place-items: center; }
.credit-card .cc-mark svg { width: 38px; height: 38px; }
.credit-card h3 { font-size: 1.3rem; margin-bottom: 6px; }
.credit-card p { margin: 0; color: var(--ink-2); }
.prose { max-width: 720px; }
.prose p { color: var(--ink-2); }
.prose h2 { font-size: 1.45rem; margin: 34px 0 10px; }

/* ---------- Dialogs & toasts ---------- */
dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink); padding: 0; max-width: min(92vw, 460px); width: 100%; box-shadow: var(--shadow-2); }
dialog::backdrop { background: rgba(5, 12, 24, .55); backdrop-filter: blur(3px); }
.dlg-body { padding: 22px 24px 10px; }
.dlg-body h3 { font-size: 1.3rem; margin-bottom: 8px; }
.dlg-body p { margin: 0 0 12px; color: var(--ink-2); }
.dlg-body input[type="text"] { width: 100%; font: inherit; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--line-strong); background: var(--paper); color: var(--ink); }
.dlg-body input[type="text"]:focus { outline: none; border-color: var(--lagoon); box-shadow: var(--focus); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 24px 20px; }
dialog.zoom { max-width: min(96vw, 1000px); background: #fff; padding: 10px; }
dialog.zoom img { display: block; width: min(88vw, 900px); max-height: 82vh; object-fit: contain; margin: 0 auto; }
dialog.zoom .dlg-close { position: absolute; top: 10px; right: 10px; }
.toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 80; display: grid; gap: 8px; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 18px; overflow-wrap: anywhere; text-align: center; font-weight: 700; font-size: .92rem; box-shadow: var(--shadow-2); animation: rise .3s ease both; }

.empty { text-align: center; padding: 36px 20px; color: var(--muted); }
.empty svg { width: 54px; height: 54px; opacity: .5; margin-bottom: 8px; }

.reader-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 48px; }
.reader-nav a { padding: 16px 18px; text-decoration: none; color: inherit; display: block; }
.reader-nav a small { font-family: var(--f-mono); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); display: block; }
.reader-nav a b { font-size: 1.02rem; display: block; margin-top: 4px; }
.reader-nav a:hover { border-color: var(--line-strong); box-shadow: var(--shadow-2); }
.reader-nav .next { text-align: right; }
.lesson-end { margin-top: 44px; padding: 24px; display: flex; gap: 18px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.lesson-end h3 { font-size: 1.25rem; }
.lesson-end p { margin: 4px 0 0; color: var(--muted); }
.lesson-end .lesson-report { flex-basis: 100%; font-size: .9rem; }
.report-link { display: inline-flex; align-items: center; gap: 5px; font-size: .85rem; font-weight: 600; color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.report-link:hover { color: var(--ink); }
.report-link svg { width: 14px; height: 14px; flex: none; }
.feedback .feedback-report, .review-item .ri-report { margin-top: 8px; }
.credit-card p + p { margin-top: 10px; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .hero { grid-template-columns: 1fr; }
  .reader { grid-template-columns: minmax(0, 1fr); }
  .reader-aside { display: none; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .exam-hero { grid-template-columns: 1fr; }
  .exam-hero .eh-art { min-height: 160px; order: -1; }
}
@media (max-width: 760px) {
  :root { --header-h: 58px; }
  body { font-size: 16.5px; }
  .nav { display: none; }
  .top-actions { margin-left: auto; }
  .brand-sub { display: none; }
  main#view { padding: 22px 16px calc(96px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    background: color-mix(in srgb, var(--card) 94%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; text-decoration: none; color: var(--muted); font-size: .7rem; font-weight: 700; border-radius: 10px; }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a[aria-current="page"] { color: var(--ink); }
  .tabbar a[aria-current="page"] svg { color: var(--coral); }
  body.in-quiz .tabbar { display: none; }
  body.in-quiz main#view { padding-bottom: 40px; }
  body.in-quiz .site-footer { display: none; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .chapter-row { grid-template-columns: 44px 1fr auto; gap: 12px; padding: 14px 4px; }
  .chapter-row .ring { display: none; }
  .module-head { grid-template-columns: auto 1fr; }
  .module-head .chip { display: none; }
  .module-num { font-size: 2.6rem; }
  .next-step { grid-template-columns: auto 1fr; }
  .next-step .btn { grid-column: 1 / -1; }
  .result-hero, .readiness, .credit-card { grid-template-columns: 1fr; justify-items: start; }
  .quiz-top { grid-template-columns: 1fr auto; }
  .quiz-top .quiz-progress { grid-column: 1 / -1; grid-row: 2; }
  .opt { grid-template-columns: 34px 1fr auto; gap: 10px; padding: 10px 12px 10px 10px; font-size: .98rem; }
  .opt .key { width: 32px; height: 32px; }
  .kbd-hint { display: none; }
  .reader-nav { grid-template-columns: 1fr; }
  .exam-hero .eh-rules b { font-size: 1.5rem; }
  .history-row { grid-template-columns: 1fr auto; }
  .history-row .chip-mode { display: none; }
  .toast-wrap { bottom: calc(86px + env(safe-area-inset-bottom)); }
  .mastery-table .col-acc, .mastery-table .col-status { display: none; }
  .btn-lg { white-space: normal; text-align: center; }
  .quiz-actions .btn-primary, .quiz-actions .btn-accent { margin-left: auto; }
  .route-map .map-label { font-size: 21px; stroke-width: 6px; }
  .route-map .map-sub { display: none; }
  .list-row { grid-template-columns: minmax(0, 1fr); }
  .list-row .lr-side { justify-content: flex-start; }
  .list-row .lr-side .bar { display: none; }
  .list-row .lr-side .btn { flex: 1 1 auto; }
  .mastery-table .bar { width: 70px; }
  .review-item .ri-row { flex-direction: column; }
  .hero .hero-facts { display: grid; grid-template-columns: repeat(4, auto); gap: 10px; justify-content: space-between; }
  .hero .fact b { font-size: 1.45rem; }
  .hero .fact span { font-size: .6rem; letter-spacing: .06em; }
  .hero-actions .btn-lg { flex: 1 1 auto; }
}
@media (max-width: 380px) {
  .brand-name { font-size: 1.15rem; }
  .icon-btn { width: 36px; height: 36px; }
}

@media print {
  .topbar, .tabbar, .site-footer, .reader-aside, .lesson-end, .reader-nav { display: none !important; }
  body { background: #fff; }
}

/* ---------- Ajouts revue 1 ---------- */
input[type="range"] { accent-color: var(--lagoon); width: 160px; max-width: 45vw; }
.fig-flash-ring { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-dasharray: 3 3; opacity: .7; }
.svg-port { color: #e9eff7; }
.fig-rose-label { font-family: var(--f-body); font-size: 15px; font-weight: 700; fill: var(--ink); paint-order: stroke; stroke: color-mix(in srgb, var(--lagoon) 12%, var(--card)); stroke-width: 4px; }
.fig-rose-sub { font-family: var(--f-mono); font-size: 12px; fill: var(--muted); paint-order: stroke; stroke: color-mix(in srgb, var(--lagoon) 12%, var(--card)); stroke-width: 3px; }
.review-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.review-item .ri-ans b { font-family: var(--f-mono); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 500; margin-right: 6px; }
.review.only-errors .review-item:not(.is-bad) { display: none; }
.tile.is-disabled { opacity: .7; }
.danger-zone { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line-strong); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.danger-zone small { color: var(--muted); }
.ring span { font-size: .58rem; }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.cat-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-decoration: none; color: inherit; transition: transform .15s, box-shadow .2s, border-color .2s; }
.cat-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); border-color: var(--line-strong); }
.cat-card b { display: block; font-size: .98rem; line-height: 1.25; }
.cat-card small { display: block; color: var(--muted); font-size: .8rem; margin-top: 2px; }
.cat-card .ring::before { background: var(--card); }

/* ---------- Ajouts revue 2 ---------- */
.lr-grid { display: grid !important; grid-template-columns: 90px 11.5rem 9rem; align-items: center; gap: 8px; }
.lr-grid .btn { justify-content: center; }
.lr-gap { display: block; }
@media (max-width: 760px) {
  .lr-grid { grid-template-columns: 1fr 1fr; }
  .lr-grid .bar, .lr-grid .lr-gap { display: none; }
  .cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .cat-card { padding: 10px; gap: 8px; }
  .cat-card .ring { display: none; }
  .cat-card b { font-size: .9rem; }
  .cat-card small { font-size: .74rem; }
  /* Tableau des progrès en cartes */
  .mastery-table thead { display: none; }
  .mastery-table, .mastery-table tbody, .mastery-table tr, .mastery-table td { display: block; width: 100%; }
  .mastery-table tr { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .mastery-table tr:last-child { border-bottom: 0; }
  .mastery-table td { padding: 0; border: 0; min-width: 0 !important; }
  .mastery-table td:first-child { grid-column: 1 / -1; }
  .mastery-table .col-acc, .mastery-table .col-status { display: none; }
  .mastery-table td:nth-child(2) { display: flex; align-items: center; gap: 8px; }
  .mastery-table .bar { width: 100%; max-width: 180px; }
  .mastery-table td:last-child { justify-self: end; }
}

/* ---------- Ajouts revue 3 ---------- */
[tabindex="-1"]:focus, [tabindex="-1"]:focus-visible { box-shadow: none; outline: none; }
.quiz-title { white-space: normal; overflow: visible; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.q-grid { max-width: calc(10 * 46px); margin-left: auto; margin-right: auto; }
.mastery-table td { vertical-align: middle; }
.q-media .fig-lights svg { max-width: 400px; }
@media (max-width: 760px) {
  html { scroll-padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .profile-row { flex-wrap: wrap; }
  .profile-row .p-name { flex: 1 1 10rem; overflow-wrap: break-word; }
  .profile-row .btn { flex: 0 0 auto; }
  .route-map .map-label { font-size: 26px; stroke-width: 7px; }
}

.fig-occult { animation: occult 3s steps(1, end) infinite; }
@keyframes occult { 0%, 80% { opacity: 1; } 80.01%, 100% { opacity: .12; } }

/* ---------- Ajouts revue 4 ---------- */
.nw { white-space: nowrap; }
.fig-occ-ring { fill: none; stroke: currentColor; stroke-width: 2; opacity: .75; }
@media (max-width: 400px) {
  .hero .hero-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
}

/* ---------- Ajouts retours utilisateur ---------- */
.exam-note { margin: 14px 0 0; font-size: .9rem; color: var(--muted); }
.lesson-meta { align-items: center; }
.only-narrow { display: none; }
@media (max-width: 1000px) { .only-narrow { display: inline-flex; } }

.brand-text { display: flex; flex-direction: column; justify-content: center; gap: 5px; }
.brand-text .brand-name, .brand-text .brand-sub { display: block; margin: 0; line-height: 1; }
.footer-side { display: inline-flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.gh-link { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; color: var(--ink-2); font-weight: 700; }
.gh-link:hover { color: var(--ink); }

.q-media-both { gap: 14px; align-items: center; flex-wrap: wrap; }
.q-media-both .q-img { height: clamp(150px, 26vh, 240px); }

/* ---------- Accueil : atouts sous les boutons ---------- */
.hero-perks { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 22px 0 0; padding: 0; font-size: .92rem; color: var(--muted); }
.hero-perks li { display: inline-flex; align-items: center; gap: 7px; }
.hero-perks svg { width: 15px; height: 15px; color: var(--lagoon); flex: none; }
