/* Académie AFECO — charte AFECO (orange #FF7F38, noir, blanc) + motifs africains (kente, bogolan) */
:root {
  --orange: #FF7F38;
  --orange-dk: #D9601E;
  --orange-bg: #FFF0E6;
  --ink: #2B2724;          /* texte */
  --black: #1C1A17;        /* accents ponctuels : badges, boutons foncés, certificat */
  --night: #4A443E;        /* grandes surfaces foncées : menu, en-tête, connexion, bandeau d’accueil */
  --night-2: #5B544C;
  --ink2: #2E2A26;
  --bg: #F7F2EA;
  --card: #FFFFFF;
  --muted: #6F6A63;
  --light: #9B958C;
  --border: #E8E0D3;
  --border-strong: #D3C9B9;
  --sand: #F3E7D3;
  --ochre: #C98A2B;
  --brown: #8A5A2B;
  --green: #2F7D4F;
  --green-bg: #E6F3EA;
  --red: #B42318;
  --red-bg: #FDECEA;
  --blue: #2458A6;
  --blue-bg: #E8EFFB;
  --teal: #16877A;
  --yellow: #F2B632;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(28, 26, 23, 0.06), 0 2px 8px rgba(28, 26, 23, 0.05);
  --font: Arial, 'Helvetica Neue', Helvetica, system-ui, sans-serif;
  --kente: repeating-linear-gradient(90deg, #FF7F38 0 18px, #1C1A17 18px 24px, #F2B632 24px 36px, #2F7D4F 36px 42px, #FF7F38 42px 54px, #8A5A2B 54px 60px);
  --bogolan: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%238A5A2B' stroke-opacity='.10' stroke-width='2'%3E%3Cpath d='M0 16 L8 8 L16 16 L24 8 L32 16 L40 8 L48 16 L56 8 L64 16'/%3E%3Cpath d='M0 48 L8 40 L16 48 L24 40 L32 48 L40 40 L48 48 L56 40 L64 48'/%3E%3C/g%3E%3Cg fill='%238A5A2B' fill-opacity='.10'%3E%3Ccircle cx='16' cy='32' r='2.5'/%3E%3Ccircle cx='48' cy='32' r='2.5'/%3E%3Cpath d='M30 26 L34 26 L32 22 Z'/%3E%3Cpath d='M30 38 L34 38 L32 42 Z'/%3E%3C/g%3E%3C/svg%3E");
  --wax: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='none' stroke='%23FFFFFF' stroke-opacity='.10' stroke-width='3'%3E%3Ccircle cx='40' cy='40' r='14'/%3E%3Ccircle cx='40' cy='40' r='26'/%3E%3Ccircle cx='0' cy='0' r='14'/%3E%3Ccircle cx='80' cy='0' r='14'/%3E%3Ccircle cx='0' cy='80' r='14'/%3E%3Ccircle cx='80' cy='80' r='14'/%3E%3C/g%3E%3C/svg%3E");
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: var(--font); font-size: 15px; line-height: 1.45; color: var(--ink); background: var(--bg) var(--bogolan); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { max-width: 100%; }
.boot { padding: 60px 20px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.center { text-align: center; }
.mt { margin-top: 16px; }
.mt2 { margin-top: 24px; }
.mb { margin-bottom: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.kente { height: 8px; background: var(--kente); }
.ic { width: 20px; height: 20px; flex: none; }

/* ---------- Structure ---------- */
.layout { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { background: var(--night) var(--wax); color: #E8E2D8; position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow-y: auto; scrollbar-width: thin; }
.side .kente { flex: none; }
.side .brand { padding: 18px 18px 14px; display: flex; flex-direction: column; gap: 6px; }
.side .brand img { width: 128px; background: #fff; border-radius: 8px; padding: 6px 8px; }
.side .brand b { color: var(--orange); letter-spacing: 0.14em; font-size: 12px; }
.side nav { display: flex; flex-direction: column; gap: 2px; padding: 4px 10px; }
.side .sect { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: #C2BAAE; padding: 14px 10px 6px; }
.side nav a { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 10px; text-decoration: none; color: #E8E2D8; font-weight: 600; }
.side nav a:hover { background: rgba(255, 255, 255, 0.07); }
.side nav a.on { background: var(--orange); color: #fff; }
.side .cnt { margin-left: auto; background: var(--orange); color: #fff; font-size: 11px; border-radius: 10px; padding: 1px 7px; }
.side nav a.on .cnt { background: #fff; color: var(--orange-dk); }
.side .spacer { flex: 1; }
.side .me { border-top: 1px solid rgba(255, 255, 255, 0.1); padding: 14px 18px 18px; font-size: 13px; }
.side .me b { display: block; color: #fff; font-size: 14px; }
.side .me .lvl { color: var(--yellow); }
.side .me button { margin-top: 10px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.page { padding: 26px 30px 90px; max-width: 1180px; width: 100%; }
.page.narrow { max-width: 860px; }
.ph { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.ph h1 { font-size: 26px; margin: 0; letter-spacing: -0.01em; }
.ph .sub { color: var(--muted); margin-top: 4px; }
.crumb { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: 14px; margin-bottom: 8px; cursor: pointer; background: none; border: 0; padding: 0; }
.crumb:hover { color: var(--ink); }
.topbar { display: none; }
.tabbar { display: none; }
.netbar { background: var(--night); color: #fff; font-size: 13px; padding: 7px 16px; display: flex; gap: 8px; align-items: center; justify-content: center; }
.netbar.off { background: #6B4A1E; }
.netbar .ic { width: 16px; height: 16px; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { display: none; }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--night); color: #fff; position: sticky; top: 0; z-index: 30; }
  .topbar img { height: 30px; background: #fff; border-radius: 6px; padding: 3px 5px; }
  .topbar .t { font-weight: 700; color: var(--orange); letter-spacing: 0.1em; font-size: 12px; }
  .topbar .xp { margin-left: auto; font-size: 13px; color: var(--yellow); font-weight: 700; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--border); z-index: 40; padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 7px; font-size: 11px; text-decoration: none; color: var(--muted); font-weight: 600; }
  .tabbar a.on { color: var(--orange-dk); }
  .page { padding: 18px 14px 96px; }
  .ph h1 { font-size: 22px; }
}

/* ---------- Composants ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-b { padding: 18px; }
.card-h { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.card-h h3 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.card.k { overflow: hidden; }
.card.k::before { content: ''; display: block; height: 6px; background: var(--kente); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .g2, .g3 { grid-template-columns: 1fr; } }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--border-strong); background: #fff; border-radius: 10px; padding: 9px 16px; cursor: pointer; font-weight: 700; text-decoration: none; min-height: 40px; white-space: nowrap; }
.btn:hover { background: #FBF8F3; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.pri { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn.pri:hover { background: var(--orange-dk); border-color: var(--orange-dk); }
.btn.dark { background: var(--black); border-color: var(--black); color: #fff; }
.btn.ok { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { color: var(--red); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(0, 0, 0, 0.05); }
.btn.sm { padding: 5px 11px; min-height: 32px; font-size: 13px; }
.btn.lg { padding: 13px 22px; min-height: 52px; font-size: 16px; }
.btn.block { width: 100%; }
.btn .ic { width: 18px; height: 18px; }
.side .btn { background: transparent; color: #E8E2D8; border-color: rgba(255, 255, 255, 0.2); }
label.f { display: block; }
label.f > span { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.in, select.in, textarea.in { width: 100%; border: 1px solid var(--border-strong); background: #fff; border-radius: 10px; padding: 9px 12px; min-height: 42px; outline: none; }
textarea.in { resize: vertical; min-height: 80px; line-height: 1.45; }
textarea.code { font-family: Consolas, Menlo, monospace; font-size: 12.5px; min-height: 260px; }
.in:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255, 127, 56, 0.18); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--orange); }
.chip { display: inline-flex; align-items: center; gap: 5px; border-radius: 20px; padding: 3px 10px; font-size: 12px; font-weight: 700; background: #F1ECE4; color: var(--ink2); white-space: nowrap; }
.chip.or { background: var(--orange-bg); color: var(--orange-dk); }
.chip.ok { background: var(--green-bg); color: var(--green); }
.chip.ko { background: var(--red-bg); color: var(--red); }
.chip.bl { background: var(--blue-bg); color: var(--blue); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.alert { border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-size: 14px; }
.alert.err { background: var(--red-bg); color: var(--red); }
.alert.info { background: var(--blue-bg); color: var(--blue); }
.alert.ok { background: var(--green-bg); color: var(--green); }
.alert.warn { background: #FDF2DC; color: #8A5800; }
.bar { height: 10px; background: #EEE7DC; border-radius: 10px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--orange), #FFB000); border-radius: 10px; transition: width 0.5s; }
.bar.g > i { background: var(--green); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: none; padding: 10px 14px; cursor: pointer; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--orange); }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: #fff; padding: 7px 13px; cursor: pointer; font-weight: 700; font-size: 13px; }
.seg button + button { border-left: 1px solid var(--border-strong); }
.seg button.on { background: var(--black); color: #fff; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); background: #FBF8F3; white-space: nowrap; }
table.t td { padding: 10px 12px; border-bottom: 1px solid #F0EAE0; vertical-align: middle; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #FCF9F4; }
table.t.mini td, table.t.mini th { padding: 6px 10px; }
.tbl { overflow-x: auto; }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--night); color: #fff; padding: 11px 18px; border-radius: 12px; z-index: 100; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25); max-width: 92vw; font-weight: 600; }
.toast.err { background: var(--red); }
.modal-bg { position: fixed; inset: 0; background: rgba(28, 26, 23, 0.55); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: #fff; border-radius: 18px; max-width: 520px; width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); }
.modal.wide { max-width: 820px; }
.modal .kente { border-radius: 18px 18px 0 0; }
.modal-b { padding: 22px; }
.modal h2 { margin: 0 0 8px; font-size: 20px; }

/* ---------- Connexion ---------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--night) var(--wax); }
.login .card { width: 100%; max-width: 420px; overflow: hidden; }
.login .card-b { padding: 28px; }
.login img.logo { width: 170px; display: block; margin: 0 auto 6px; }
.login h1 { text-align: center; font-size: 22px; margin: 6px 0 4px; }
.login .tag { text-align: center; color: var(--muted); margin-bottom: 18px; }
.login .guides { display: flex; justify-content: center; gap: 10px; margin: 10px 0 6px; }

/* ---------- Accueil ---------- */
.hero { background: var(--night) var(--wax); color: #fff; border-radius: 18px; overflow: hidden; }
.hero .in2 { padding: 22px 24px; display: flex; gap: 18px; align-items: center; }
.hero h2 { margin: 0 0 4px; font-size: 22px; }
.hero p { margin: 0; color: #DCD5CA; }
.hero .bar { background: rgba(255, 255, 255, 0.15); }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat b { font-size: 26px; letter-spacing: -0.02em; }
.stat span { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.bubble { position: relative; background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow); }
.say { display: flex; gap: 14px; align-items: flex-start; }
.say .guide-av { flex: none; }
.say .who { font-size: 12px; font-weight: 700; color: var(--orange-dk); margin-bottom: 3px; }

/* ---------- Carte du parcours ---------- */
.trackhead { display: flex; align-items: center; gap: 10px; margin: 26px 0 8px; }
.trackhead h2 { font-size: 17px; margin: 0; }
.trackhead .line { flex: 1; height: 6px; border-radius: 6px; background: var(--kente); opacity: 0.6; }
.road { position: relative; padding: 6px 0 10px; }
.stop { display: grid; grid-template-columns: 74px 1fr; gap: 14px; align-items: center; position: relative; padding: 10px 0; }
.stop::before { content: ''; position: absolute; left: 36px; top: -10px; bottom: -10px; width: 6px; background: repeating-linear-gradient(180deg, var(--ochre) 0 10px, transparent 10px 18px); z-index: 0; }
.stop:first-child::before { top: 40px; }
.stop:last-child::before { bottom: 50%; }
.node { width: 74px; height: 74px; border-radius: 50%; display: flex; align-items: center; justify-content: center; position: relative; z-index: 1; border: 5px solid #fff; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15); background: #DDD5C8; color: #fff; }
.node .ic { width: 30px; height: 30px; }
.node.open { background: var(--orange); animation: pulse 2.4s infinite; }
.node.done { background: var(--green); }
.node.lock { background: #CFC6B8; color: #8A8276; }
.node .num { position: absolute; top: -6px; right: -6px; background: var(--black); color: #fff; font-size: 12px; font-weight: 700; border-radius: 12px; padding: 2px 7px; border: 2px solid #fff; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 127, 56, 0.45); } 50% { box-shadow: 0 0 0 12px rgba(255, 127, 56, 0); } }
.stop .card { cursor: pointer; transition: transform 0.15s; }
.stop .card:hover { transform: translateX(3px); }
.stop.locked .card { opacity: 0.6; cursor: not-allowed; }
.stop h3 { margin: 0 0 3px; font-size: 16px; }
.stars { display: inline-flex; gap: 2px; color: var(--yellow); }
.stars .ic { width: 16px; height: 16px; }
.stars .off { color: #E2DACD; }

/* ---------- Module ---------- */
.acts { display: grid; gap: 10px; }
.act { display: flex; align-items: center; gap: 14px; padding: 14px 16px; cursor: pointer; }
.act:hover { background: #FCF9F4; }
.act .aic { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--orange-bg); color: var(--orange-dk); flex: none; }
.act.done .aic { background: var(--green-bg); color: var(--green); }
.act b { display: block; }
.player { max-width: 900px; margin: 0 auto; }
.player-h { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.player-h .bar { flex: 1; }

/* Leçon */
.lesson .art-wrap { background: #FBF7F0; border-radius: 14px; padding: 12px; margin: 12px 0; text-align: center; border: 1px solid var(--border); }
.lesson .art-wrap svg { width: 100%; height: auto; max-height: 360px; }
.lesson .art-wrap svg.engine { max-width: 320px; }
.lesson h2 { margin: 2px 0 8px; font-size: 21px; }
.md p { margin: 0 0 10px; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 22px; }
.md li { margin: 3px 0; }
.md strong { color: var(--ink); }
.term { background: var(--orange-bg); color: var(--orange-dk); border-radius: 6px; padding: 0 5px; font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap; }
.term:hover { background: #FFE0CC; }
.art-guides { display: flex; justify-content: center; gap: 24px; }
.lesson .art-wrap .art-guides svg { width: 120px; height: 120px; }
.dots { display: flex; gap: 6px; justify-content: center; margin: 14px 0; flex-wrap: wrap; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: #E2DACD; }
.dots i.on { background: var(--orange); width: 24px; border-radius: 6px; }

/* Schéma du chariot */
svg.fk { width: 100%; height: auto; display: block; user-select: none; -webkit-tap-highlight-color: transparent; }
svg.fk .hs { transition: opacity 0.2s, filter 0.2s; }
svg.fk .hs.dim { opacity: 0.25; }
svg.fk .hs.on { filter: drop-shadow(0 0 6px rgba(255, 127, 56, 0.95)) drop-shadow(0 0 2px #FF7F38); }
svg.fk.m-explore .hs, svg.fk.m-find .hs { cursor: pointer; }
svg.fk.m-explore .hs:hover, svg.fk.m-find .hs:hover { filter: drop-shadow(0 0 5px rgba(255, 127, 56, 0.9)); }
svg.fk .hs.found { filter: drop-shadow(0 0 4px rgba(47, 125, 79, 0.9)); }
svg.fk .hs.good { filter: drop-shadow(0 0 8px #2F7D4F) drop-shadow(0 0 3px #2F7D4F); }
svg.fk .hs.wrong { filter: drop-shadow(0 0 8px #B42318) drop-shadow(0 0 3px #B42318); }
svg.fk .mk { cursor: pointer; }
.fk-wrap { background: linear-gradient(180deg, #FFFFFF, #F6F0E6); border: 1px solid var(--border); border-radius: 14px; padding: 6px; position: relative; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.prompt { font-size: 20px; font-weight: 700; text-align: center; margin: 4px 0 12px; }
.prompt small { display: block; font-size: 13px; color: var(--muted); font-weight: 400; margin-top: 3px; }

/* Quiz */
.q { font-size: 19px; font-weight: 700; margin: 4px 0 14px; }
.opts { display: grid; gap: 10px; }
.opt { display: flex; align-items: center; gap: 12px; text-align: left; border: 2px solid var(--border); background: #fff; border-radius: 12px; padding: 13px 15px; cursor: pointer; font-weight: 600; min-height: 52px; width: 100%; }
.opt:hover { border-color: var(--orange); }
.opt .k { width: 28px; height: 28px; border-radius: 8px; background: #F1ECE4; display: flex; align-items: center; justify-content: center; font-weight: 700; flex: none; font-size: 13px; }
.opt.sel { border-color: var(--orange); background: var(--orange-bg); }
.opt.sel .k { background: var(--orange); color: #fff; }
.opt.good { border-color: var(--green); background: var(--green-bg); }
.opt.good .k { background: var(--green); color: #fff; }
.opt.bad { border-color: var(--red); background: var(--red-bg); }
.opt.bad .k { background: var(--red); color: #fff; }
.opt:disabled { cursor: default; }
.explain { margin-top: 12px; border-radius: 12px; padding: 12px 14px; background: #FBF7F0; border-left: 5px solid var(--ochre); }
.explain.ok { border-left-color: var(--green); }
.explain.ko { border-left-color: var(--red); }
.vf { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.timer { font-weight: 700; color: var(--orange-dk); font-variant-numeric: tabular-nums; }

/* Tri par système */
.sort-card { text-align: center; padding: 22px 16px; border: 3px dashed var(--orange); border-radius: 16px; background: #fff; margin-bottom: 14px; }
.sort-card .fr { font-size: 22px; font-weight: 700; }
.sort-card .en { color: var(--muted); font-style: italic; margin-top: 3px; }
.buckets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
@media (max-width: 600px) { .buckets { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.bucket { border: 0; border-radius: 12px; padding: 12px 10px; color: #fff; font-weight: 700; cursor: pointer; min-height: 56px; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 14px; transition: transform 0.12s; }
.bucket:hover { transform: translateY(-2px); }
.bucket.flash-ok { outline: 4px solid var(--green); }
.bucket.flash-ko { outline: 4px solid var(--red); animation: shake 0.35s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* Paires */
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.match .col { display: grid; gap: 9px; align-content: start; }
.mitem { border: 2px solid var(--border); background: #fff; border-radius: 12px; padding: 10px 12px; cursor: pointer; font-weight: 600; text-align: left; min-height: 50px; display: flex; align-items: center; gap: 8px; width: 100%; }
.mitem svg.engine { width: 100%; height: 70px; }
.mitem.sel { border-color: var(--orange); background: var(--orange-bg); }
.mitem.done { border-color: var(--green); background: var(--green-bg); color: var(--green); cursor: default; opacity: 0.75; }
.mitem.ko { border-color: var(--red); animation: shake 0.35s; }

/* Cartes de révision */
.flash { perspective: 1000px; max-width: 520px; margin: 0 auto; }
.flash .inner { position: relative; height: 240px; transition: transform 0.5s; transform-style: preserve-3d; cursor: pointer; }
.flash.flip .inner { transform: rotateY(180deg); }
.flash .face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 22px; text-align: center; border: 1px solid var(--border); box-shadow: var(--shadow); }
.flash .front { background: #fff; }
.flash .back { background: var(--night) var(--wax); color: #fff; transform: rotateY(180deg); }
.flash .big { font-size: 26px; font-weight: 700; }
.flash .back .big { color: var(--orange); }

/* Scénario */
.chat { display: grid; gap: 12px; }
.msg { display: flex; gap: 10px; align-items: flex-end; max-width: 92%; }
.msg .av { width: 40px; height: 40px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; background: var(--blue); overflow: hidden; }
.msg .txt { background: #fff; border: 1px solid var(--border); border-radius: 16px 16px 16px 4px; padding: 11px 14px; }
.msg .txt .who { font-size: 12px; font-weight: 700; color: var(--blue); margin-bottom: 2px; }
.msg.me { margin-left: auto; flex-direction: row-reverse; }
.msg.me .txt { background: var(--orange-bg); border-color: #FFD3B8; border-radius: 16px 16px 4px 16px; }
.msg.narrator { max-width: 100%; }
.msg.narrator .txt { background: #FBF7F0; border-style: dashed; }
.context { background: #FBF7F0; border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; white-space: pre-line; }

/* Plaque de charge */
.plate-sim { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 760px) { .plate-sim { grid-template-columns: 1fr; } }
svg.plate { width: 100%; height: auto; }
.case { background: #FBF7F0; border-radius: 14px; padding: 14px 16px; border: 1px solid var(--border); }
.case dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; }
.case dt { color: var(--muted); font-size: 13px; }
.case dd { margin: 0; font-weight: 700; }

/* Inspection */
.insp { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 820px) { .insp { grid-template-columns: 1fr; } }
.zone { padding: 12px 14px; border: 2px solid var(--border); border-radius: 12px; background: #fff; }
.zone.sel { border-color: var(--orange); }
.zone .row .btn { flex: 1; }

/* Chasse aux dangers */
.scene-wrap { position: relative; border-radius: 14px; overflow: hidden; border: 1px solid var(--border); background: #fff; }
.scene-wrap svg.scene { width: 100%; height: auto; display: block; cursor: crosshair; }
.scene-wrap .ring { position: absolute; border: 4px solid var(--green); border-radius: 50%; transform: translate(-50%, -50%); pointer-events: none; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.7); }
.scene-wrap .ring.miss { border-color: var(--red); }
.scene-wrap .miss-dot { position: absolute; width: 18px; height: 18px; border-radius: 50%; background: var(--red); transform: translate(-50%, -50%); pointer-events: none; opacity: 0.8; }

/* Remets dans l'ordre */
.olist { display: grid; gap: 8px; }
.oitem { display: flex; align-items: center; gap: 10px; border: 2px solid var(--border); background: #fff; border-radius: 12px; padding: 11px 13px; cursor: pointer; font-weight: 600; text-align: left; width: 100%; }
.oitem .n { width: 30px; height: 30px; border-radius: 50%; background: #F1ECE4; display: flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.oitem.placed { border-color: var(--green); background: var(--green-bg); cursor: default; }
.oitem.placed .n { background: var(--green); color: #fff; }
.oitem.ko { border-color: var(--red); animation: shake 0.35s; }

/* Résultat */
.result { text-align: center; padding: 26px 18px; }
.result .score { font-size: 54px; font-weight: 700; letter-spacing: -0.03em; }
.result .score.ok { color: var(--green); }
.result .score.ko { color: var(--orange-dk); }
.xp-gain { display: inline-flex; align-items: center; gap: 6px; background: var(--black); color: var(--yellow); border-radius: 20px; padding: 6px 14px; font-weight: 700; margin-top: 8px; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 95; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 10px; height: 14px; animation: fall 2.6s linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); } }

/* Badges */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.badge { text-align: center; padding: 16px 10px; border-radius: 14px; background: #fff; border: 1px solid var(--border); }
.badge .medal { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 8px; display: flex; align-items: center; justify-content: center; color: #fff; background: radial-gradient(circle at 30% 30%, #FFB37A, var(--orange-dk)); border: 4px solid #FFE0CC; box-shadow: 0 0 0 3px var(--orange); }
.badge .medal .ic { width: 30px; height: 30px; }
.badge.off .medal { background: #E4DDD2; border-color: #F1ECE4; box-shadow: 0 0 0 3px #E4DDD2; color: #B5AD9F; }
.badge b { display: block; font-size: 14px; }
.badge span { font-size: 12px; color: var(--muted); }

/* Classement */
.rank { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid #F0EAE0; }
.rank .pos { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; background: #F1ECE4; flex: none; }
.rank .pos.p1 { background: #F2B632; color: #fff; }
.rank .pos.p2 { background: #B9B3A8; color: #fff; }
.rank .pos.p3 { background: #C98A2B; color: #fff; }
.rank.me { background: var(--orange-bg); }

/* Lexique */
.parts { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.pcard { padding: 12px 14px; cursor: pointer; border-left: 6px solid var(--orange); }
.pcard:hover { background: #FCF9F4; }
.pcard b { display: block; }
.pcard i { color: var(--muted); font-size: 13px; }
.pdetail h3 { margin: 4px 0 2px; font-size: 21px; }
.pdetail .en { color: var(--muted); font-style: italic; }
.pdetail h4 { margin: 14px 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.pdetail ul { margin: 0; padding-left: 20px; }

/* Défi du jour */
.daily { background: linear-gradient(135deg, var(--night) 0%, #6B5440 100%); color: #fff; border-radius: 18px; overflow: hidden; }
.daily .in2 { padding: 18px 20px; }
.daily .flame { color: #FFB000; display: inline-flex; align-items: center; gap: 4px; font-weight: 700; }

/* Admin */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { padding: 14px 16px; }
.kpi b { font-size: 26px; display: block; }
.kpi span { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.cards-edit { display: grid; gap: 10px; }
.cedit { border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: #FCFAF6; }

/* Certificat (impression) */
.cert-page { background: #fff; max-width: 1060px; margin: 0 auto; aspect-ratio: 297 / 210; position: relative; border: 1px solid var(--border); box-shadow: var(--shadow); overflow: hidden; }
.cert-page .frame { position: absolute; inset: 18px; border: 3px solid var(--black); }
.cert-page .band { position: absolute; left: 0; right: 0; height: 16px; background: var(--kente); }
.cert-page .band.top { top: 0; }
.cert-page .band.bot { bottom: 0; }
.cert-page .content { position: absolute; inset: 40px 60px; display: flex; flex-direction: column; align-items: center; text-align: center; justify-content: center; gap: 6px; }
.cert-page .content img { width: 200px; }
.cert-page h1 { font-family: Garamond, Georgia, serif; font-size: 44px; margin: 6px 0 0; letter-spacing: 0.02em; }
.cert-page .name { font-family: Garamond, Georgia, serif; font-size: 38px; font-weight: 700; color: var(--orange-dk); border-bottom: 2px solid var(--ink); padding: 0 30px 4px; margin: 6px 0; }
.cert-page .meta { display: flex; gap: 40px; margin-top: 14px; font-size: 14px; }
.cert-page .meta b { display: block; font-size: 16px; }
.cert-page .sign { position: absolute; bottom: 52px; right: 80px; text-align: center; font-size: 14px; }
.cert-page .sign .l { width: 200px; border-bottom: 1px solid var(--ink); height: 40px; margin-bottom: 4px; }
.cert-page .seal { position: absolute; bottom: 46px; left: 80px; }
@media print {
  @page { size: A4 landscape; margin: 0; }
  body { background: #fff; }
  .side, .topbar, .tabbar, .netbar, .noprint, .toast { display: none !important; }
  .layout { display: block; }
  .page { padding: 0; max-width: none; }
  .cert-page { border: 0; box-shadow: none; width: 297mm; height: 210mm; max-width: none; aspect-ratio: auto; }
}
