/* Académie Ubora — charte de uborardc.com (navy, vert AVEC, cuivre), police Ubuntu.
   Pensée pour les petits téléphones et la lecture en plein soleil : grands contrastes, grandes cibles tactiles. */
@font-face { font-family: Ubuntu; font-weight: 400; font-display: swap; src: url(/polices/ubuntu-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: Ubuntu; font-weight: 700; font-display: swap; src: url(/polices/ubuntu-latin-700-normal.woff2) format('woff2'); }

:root {
  --bg: #F6F8FB; --surface: #FFFFFF; --surface-2: #EEF2F7; --ink: #0B1A33; --muted: #4A566B; --line: #D5DDE8;
  --navy: #0F3170; --navy-2: #173F8C; --green: #23843A; --green-2: #3FA535; --lime: #8DCB4F; --copper: #B2622A;
  --ok: #1E7B34; --ok-soft: #E3F4E6; --bad: #B42318; --bad-soft: #FDECEA; --warn: #9A5B00; --warn-soft: #FFF4DB;
  --accent: #0F3170; --theme: var(--green); --paper: #FBF6E9; --stamp: var(--green);
  --r: 14px; --r-lg: 20px; --shadow: 0 1px 2px rgba(11,26,51,.06), 0 4px 16px rgba(11,26,51,.06);
  --f: Ubuntu, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #07183A; --surface: #0C2452; --surface-2: #10306A; --ink: #F2F5FA; --muted: #B6C2D6; --line: #23407A;
    --ok: #6FD28A; --ok-soft: #123D26; --bad: #FF8A80; --bad-soft: #4A1714; --warn: #FFC861; --warn-soft: #3D2E0A;
    --paper: #13295A; --accent: #9CC3FF; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #07183A; --surface: #0C2452; --surface-2: #10306A; --ink: #F2F5FA; --muted: #B6C2D6; --line: #23407A;
  --ok: #6FD28A; --ok-soft: #123D26; --bad: #FF8A80; --bad-soft: #4A1714; --warn: #FFC861; --warn-soft: #3D2E0A;
  --paper: #13295A; --accent: #9CC3FF; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 17px/1.5 var(--f); }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .75em; }
a { color: var(--accent); }
img { max-width: 100%; height: auto; border-radius: 10px; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); } .small { font-size: .88rem; } .center { text-align: center; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; } .between { justify-content: space-between; } .wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
[hidden] { display: none !important; }

/* ---------- coquille ---------- */
.top { position: sticky; top: 0; z-index: 10; background: var(--navy); color: #fff; padding: 10px 16px; display: flex; align-items: center; gap: 10px; min-height: 56px; }
.top .logo { width: 36px; height: 36px; border-radius: 50%; background: #fff; flex: none; }
.top .titre { font-weight: 700; font-size: 1.05rem; line-height: 1.1; }
.top .titre small { display: block; font-weight: 400; font-size: .75rem; opacity: .85; }
.top .btn-ico { color: #fff; }
.reseau { font-size: .75rem; padding: 3px 8px; border-radius: 99px; background: rgba(255,255,255,.15); white-space: nowrap; }
.reseau.hors { background: var(--copper); }
main { max-width: 760px; margin: 0 auto; padding: 16px 16px 96px; }
.nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: flex; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; text-decoration: none; color: var(--muted); font-size: .75rem; min-height: 56px; justify-content: center; }
.nav a.actif { color: var(--green); font-weight: 700; }
.nav svg, .ico { width: 24px; height: 24px; }

/* ---------- éléments ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 18px; border-radius: 12px; border: 2px solid var(--accent); background: transparent; color: var(--accent); font-weight: 700; cursor: pointer; text-decoration: none; }
.btn.primaire { background: var(--green); border-color: var(--green); color: #fff; }
.btn.bloc { display: flex; width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-ico { background: none; border: 0; padding: 8px; min-width: 44px; min-height: 44px; cursor: pointer; color: inherit; display: inline-flex; align-items: center; justify-content: center; }
.puce { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; background: var(--surface-2); font-size: .8rem; color: var(--muted); white-space: nowrap; }
.puce.ok { background: var(--ok-soft); color: var(--ok); } .puce.warn { background: var(--warn-soft); color: var(--warn); }
.alerte { padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); }
.alerte.bad { background: var(--bad-soft); color: var(--bad); } .alerte.ok { background: var(--ok-soft); color: var(--ok); }
.champ { display: block; } .champ label { display: block; font-weight: 700; margin-bottom: 6px; }
.input { width: 100%; min-height: 50px; padding: 10px 14px; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 1.05rem; }
.input:focus { outline: none; border-color: var(--green); }
select.input { appearance: auto; }
:focus-visible { outline: 3px solid var(--lime); outline-offset: 2px; }

/* ---------- catalogue ---------- */
.recherche { position: relative; } .recherche .input { padding-left: 44px; }
.recherche svg { position: absolute; left: 14px; top: 13px; width: 22px; height: 22px; color: var(--muted); }
.filtres { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; }
.filtres select { min-height: 40px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); padding: 6px 12px; font-size: .9rem; max-width: 60vw; }
.serie { margin-top: 24px; }
.serie-tete { border-left: 5px solid var(--theme); padding-left: 12px; margin-bottom: 12px; }
.serie-tete .niveau { font-size: .75rem; font-weight: 700; color: var(--theme); text-transform: uppercase; letter-spacing: .05em; }
.cours-carte { display: flex; gap: 14px; align-items: center; text-decoration: none; color: inherit; padding: 14px; margin-bottom: 10px; }
.cours-carte .num { width: 44px; height: 44px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; font-weight: 700; color: var(--theme); flex: none; }
.cours-carte h3 { margin: 0 0 4px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- fiche de cours ---------- */
.fiche-tete { background: var(--theme); color: #fff; border-radius: var(--r-lg); padding: 20px; }
.fiche-tete .muted { color: rgba(255,255,255,.85); }
.faits { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.fait { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.fait b { display: block; font-size: 1.05rem; } .fait span { font-size: .8rem; color: var(--muted); }
.plan { list-style: none; padding: 0; margin: 0; counter-reset: l; }
.plan li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.plan li::before { counter-increment: l; content: counter(l); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-weight: 700; flex: none; }
.plan li.fait::before { content: "✓"; background: var(--ok); color: #fff; }

/* ---------- lecteur ---------- */
.progres { display: flex; gap: 6px; margin-bottom: 14px; }
.progres i { flex: 1; height: 6px; border-radius: 3px; background: var(--line); }
.progres i.ok { background: var(--green); } .progres i.ici { background: var(--navy-2); }
.lecon { font-size: 1.08rem; }
.lecon h1 { font-size: 1.35rem; }
.lecon table { border-collapse: collapse; width: 100%; font-size: .95rem; }
.lecon th, .lecon td { border: 1px solid var(--line); padding: 8px; text-align: left; vertical-align: top; }
.lecon th { background: var(--surface-2); }
.table { overflow-x: auto; margin: 0 0 1em; }
.lecon blockquote { margin: 0 0 1em; padding: 10px 14px; border-left: 4px solid var(--copper); background: var(--surface-2); border-radius: 0 10px 10px 0; }
.picto { font-size: 1.4em; vertical-align: -0.15em; margin-right: 4px; }
.retenir { background: var(--ok-soft); border-radius: var(--r); padding: 14px 16px; margin: 0 0 1em; }
.retenir h4 { color: var(--ok); margin-bottom: 6px; }
.retenir ul { margin: 0; padding-left: 20px; }
.bloc-q { border: 2px solid var(--line); border-radius: var(--r); padding: 14px; margin: 0 0 1em; background: var(--surface); }
.bloc-q .etiquette { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--copper); margin-bottom: 6px; }
.options { display: grid; gap: 8px; margin: 10px 0; }
.option { display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 10px 14px; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; text-align: left; width: 100%; }
.option input { width: 22px; height: 22px; accent-color: var(--green); flex: none; }
.option.juste { border-color: var(--ok); background: var(--ok-soft); }
.option.faux { border-color: var(--bad); background: var(--bad-soft); }
.retour { margin-top: 10px; padding: 10px 12px; border-radius: 10px; }
.retour.ok { background: var(--ok-soft); color: var(--ok); } .retour.non { background: var(--bad-soft); color: var(--bad); }
.audio { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border-radius: 99px; padding: 6px 14px 6px 6px; margin-bottom: 14px; }
.audio audio { flex: 1; height: 40px; }
.bas { position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); display: flex; gap: 10px; z-index: 11; }
.bas .btn { flex: 1; }
.cas-elements { border-top: 2px dashed var(--line); margin-top: 12px; padding-top: 12px; }

/* ---------- timbres (badges) : comme les timbres du carnet d'épargne ---------- */
.timbres { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 14px; }
.timbre { position: relative; aspect-ratio: 1; display: grid; place-items: center; text-align: center; color: var(--stamp); }
.timbre svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.timbre .dedans { position: relative; padding: 18%; font-size: .68rem; font-weight: 700; line-height: 1.15; text-transform: uppercase; }
.timbre .dedans .pic { font-size: 1.7rem; display: block; margin-bottom: 2px; }
.timbre.vide { color: var(--line); } .timbre.vide .dedans { color: var(--muted); font-weight: 400; }
.timbre.attente { opacity: .75; }
.carnet { background: var(--paper); border-radius: var(--r-lg); padding: 16px; border: 1px solid var(--line); background-image: repeating-linear-gradient(transparent 0 27px, rgba(15,49,112,.07) 27px 28px); }
.gros-timbre { width: 190px; margin: 0 auto; transform: rotate(-8deg); animation: tampon .5s ease-out; }
@keyframes tampon { from { transform: rotate(-8deg) scale(1.6); opacity: 0; } to { transform: rotate(-8deg) scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .gros-timbre { animation: none; } }

/* ---------- divers ---------- */
.score { font-size: 3rem; font-weight: 700; line-height: 1; }
.barre { height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; }
.barre i { display: block; height: 100%; background: var(--green); }
.notes { display: flex; gap: 8px; justify-content: space-between; }
.notes button { flex: 1; font-size: 1.8rem; min-height: 56px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); cursor: pointer; }
.notes button[aria-pressed="true"] { border-color: var(--green); background: var(--ok-soft); }
.liste { list-style: none; margin: 0; padding: 0; }
.liste li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.vide-etat { text-align: center; padding: 32px 16px; color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 99px; z-index: 50; font-size: .92rem; max-width: 90vw; }
table.admin { width: 100%; border-collapse: collapse; font-size: .9rem; } table.admin td, table.admin th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; }
pre.journal { white-space: pre-wrap; font-size: .82rem; max-height: 300px; overflow: auto; background: var(--surface-2); padding: 10px; border-radius: 10px; }

/* ---------- bannière publicitaire (formations premium) ---------- */
.banniere { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; padding: 14px 16px; border-radius: var(--r-lg); background: linear-gradient(135deg, #B2622A, #8A4A1E); color: #fff; }
.banniere .btn { border-color: #fff; color: #fff; min-height: 42px; }
.banniere .small { opacity: .92; }
.etiquette-pub { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; background: rgba(255,255,255,.2); padding: 3px 8px; border-radius: 99px; }
#chrono.warn { background: var(--bad-soft); color: var(--bad); font-weight: 700; }

/* ---------- certificat ---------- */
.certificat { background: #FFFDF7; color: #0B1A33; border: 10px double #23843A; border-radius: 8px; padding: 24px 22px; text-align: center; font-size: .95rem; }
.cert-tete { display: flex; gap: 12px; align-items: center; justify-content: center; text-align: left; margin-bottom: 14px; }
.cert-tete img { border-radius: 50%; }
.cert-org { font-weight: 700; font-size: 1.1rem; color: #0F3170; }
.cert-titre { font-size: 1.45rem; font-weight: 700; color: #23843A; text-transform: uppercase; letter-spacing: .04em; margin: 8px 0; }
.cert-intro { margin: 8px 0; color: #4A566B; }
.cert-nom { font-size: 1.8rem; font-weight: 700; color: #0F3170; border-bottom: 2px solid #D5DDE8; display: inline-block; padding: 0 18px 4px; margin: 4px 0 8px; }
.cert-cours { list-style: none; padding: 0; margin: 6px 0 14px; font-size: .9rem; }
.cert-pied { display: grid; grid-template-columns: 110px 1fr; gap: 12px; align-items: end; text-align: left; }
.cert-qr svg { width: 100px; height: 100px; background: #fff; }
.cert-qr .small { font-size: .65rem; color: #4A566B; word-break: break-all; }
.cert-signes { grid-column: 1 / -1; display: flex; gap: 20px; justify-content: flex-end; flex-wrap: wrap; }
.cert-signe { text-align: center; min-width: 170px; }
.cert-ligne { border-bottom: 1px solid #0B1A33; height: 36px; margin-bottom: 4px; }
@media (min-width: 640px) { .cert-pied { grid-template-columns: 120px 1fr auto; } .cert-signes { grid-column: auto; } }
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  body { background: #fff; }
  .top, .nav, .bas, .alerte, .row.wrap, .toast { display: none !important; }
  main { padding: 0; max-width: none; }
  .certificat { border-width: 12px; min-height: 170mm; display: flex; flex-direction: column; justify-content: center; }
}

/* ---------- illustrations ---------- */
.lecon figure, .card figure { margin: 0 0 1em; }
.lecon figure img, .card figure img { width: 100%; max-height: 60vh; object-fit: contain; background: var(--surface-2); border-radius: 12px; }
figcaption { font-size: .88rem; color: var(--muted); margin-top: 6px; text-align: center; }
.video-choix .row { margin-top: 6px; gap: 6px; }
.video-choix .puce[aria-pressed="true"] { background: var(--ok-soft); color: var(--ok); font-weight: 700; }

/* Ubuntu partout, y compris les textes préformatés et les zones de saisie */
pre, code, kbd, samp, textarea, input, select, button { font-family: var(--f); }
svg.croquis { display: block; width: 100%; height: auto; max-height: 70vh; background: #fff; border-radius: 12px; font-family: var(--f); }
svg.croquis text { font-family: Ubuntu, sans-serif; }
