/* The Ovena — un immeuble qui s'allume niveau après niveau. Pensé pour un écran de 360 px. */

/* Police Fredoka (licence libre OFL, voir assets/fonts/), servie par le site lui-même. */
@font-face { font-family: Fredoka; font-style: normal; font-weight: 300 700; font-display: swap; src: url("/assets/fonts/fredoka.woff2") format("woff2"); }

:root {
  --bg: #f6f3ff; --card: #fff; --text: #241747; --soft: #6a6189; --line: #e3dcf6; --field: #fbfaff;
  --primary: #7c3aed; --primary-d: #5b21b6; --gold: #ffc02e; --gold-d: #d98e00; --good: #17a55a; --good-d: #0e7a41;
  --bad: #e93e57; --bad-d: #b32238; --locked: #dcd7ec; --locked-d: #bdb7d6; --link: #6d28d9; --bar: 66px; --outside: #e9e4fa;
  --sky: linear-gradient(180deg, #8fd6ff 0, #c9ecff 45%, #fdf1ff 100%); --ground: #b7a6d6;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15102a; --card: #221a40; --text: #f4f0ff; --soft: #bcb3dc; --line: #392e66; --field: #1a1433;
    --locked: #3a3160; --locked-d: #261f45; --link: #c4aaff; --outside: #0a0714;
    --sky: radial-gradient(1.5px 1.5px at 20px 30px, #fff 99%, transparent) 0 0 / 130px 170px, radial-gradient(1px 1px at 70px 110px, #cdd6ff 99%, transparent) 0 0 / 90px 140px, linear-gradient(180deg, #131a45, #2a1d5c 60%, #432a72);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15102a; --card: #221a40; --text: #f4f0ff; --soft: #bcb3dc; --line: #392e66; --field: #1a1433;
  --locked: #3a3160; --locked-d: #261f45; --link: #c4aaff; --outside: #0a0714;
  --sky: radial-gradient(1.5px 1.5px at 20px 30px, #fff 99%, transparent) 0 0 / 130px 170px, radial-gradient(1px 1px at 70px 110px, #cdd6ff 99%, transparent) 0 0 / 90px 140px, linear-gradient(180deg, #131a45, #2a1d5c 60%, #432a72);
  color-scheme: dark;
}

/* Couleur de façade de chaque chapitre : mur, ombre. */
.c0 { --wall: #ef7d6a; --wall-d: #cd5c4d; }
.c1 { --wall: #34b6a8; --wall-d: #208f84; }
.c2 { --wall: #8d6ce6; --wall-d: #6d4cc4; }
.c3 { --wall: #f2a33a; --wall-d: #cb7f1c; }
.c4 { --wall: #4f8fe8; --wall-d: #336fc4; }
.c5 { --wall: #e86aa6; --wall-d: #c24b85; }

/* ───── Structure : une application, une seule colonne ───── */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--outside); }
body { display: flex; flex-direction: column; max-width: 480px; min-height: 100vh; min-height: 100dvh; margin: 0 auto; background: var(--bg); color: var(--text); font: 400 1.0625rem/1.5 Fredoka, ui-rounded, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow-wrap: anywhere; overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
body.tabbed { padding-bottom: calc(var(--bar) + env(safe-area-inset-bottom)); }
/* clip : une carte qui se retourne ne doit pas élargir l'écran sur téléphone. */
body.focus main { display: flex; flex-direction: column; overflow-x: clip; }
main { width: 100%; flex: 1; padding: calc(16px + env(safe-area-inset-top)) 16px 16px; }
.pass + main { padding-top: 14px; }
.pass + main:has(.city) { display: flex; flex-direction: column; padding: 0; }
.city > .notice { margin: 0 16px 12px; }
a { color: var(--link); }
h1 { margin: 0 0 12px; font-size: 1.7rem; font-weight: 700; line-height: 1.2; }
h2 { margin: 0 0 10px; font-size: 1.2rem; font-weight: 600; line-height: 1.3; }
strong, b { font-weight: 600; }
small { display: block; font-weight: 400; color: var(--soft); font-size: .875rem; }
sup { position: relative; top: -.5em; margin-left: .04em; font-size: .68em; line-height: 0; vertical-align: baseline; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
a.btn, button, .flat, .answer, .tabbar a { -webkit-user-select: none; user-select: none; touch-action: manipulation; }

/* ───── Carte de l'élève, toujours visible en haut ───── */
.pass { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: calc(8px + env(safe-area-inset-top)) 12px 10px; background: linear-gradient(135deg, #8b46f5, #5b21b6); box-shadow: 0 5px 0 rgb(43 12 99 / .35); color: #fff; }
.pass a { color: #fff; text-decoration: none; }
.pass small { color: #e6d8ff; font-size: .72rem; line-height: 1.2; }
.pass-subject { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 48px; line-height: 1.2; }
.pass-subject > span:last-child { min-width: 0; }
.pass-subject strong { display: block; max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .95rem; }
.pass-icon { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 14px; background: #fff; box-shadow: 0 4px 0 #cdb5ff; font-size: 1.35rem; }
.pass-xp { display: flex; flex: 1; align-items: center; min-width: 0; min-height: 48px; }
.pass-rank { position: relative; z-index: 1; display: grid; place-items: center; flex: none; width: 34px; height: 34px; border: 3px solid #fff; border-radius: 50%; background: linear-gradient(135deg, #2fd6c3, #12a0d8); font-weight: 700; }
.pass-bar { flex: 1; min-width: 0; margin-left: -6px; text-align: right; }
.pass-bar progress { height: 14px; margin: 0; border-radius: 0 99px 99px 0; background: rgb(25 5 70 / .4); }
.pass-bar progress::-webkit-progress-bar { background: rgb(25 5 70 / .4); }
.pass-bar progress::-webkit-progress-value { background: linear-gradient(90deg, #2fd6c3, #8cf08a); }
.pass-bar progress::-moz-progress-bar { background: #4fe0a8; }
.pass-flame { display: flex; flex: none; align-items: center; gap: 4px; min-height: 44px; padding: 4px 12px; border-radius: 14px; background: #ff7a2f; box-shadow: 0 4px 0 #c24f0d; font-weight: 700; font-size: 1.1rem; }
.pass-flame img { filter: brightness(0) invert(1); animation: flicker 1.6s ease-in-out infinite; }
.pass-flame.out { background: #8d82b3; box-shadow: 0 4px 0 #6a6090; }
.pass-flame.out img { animation: none; }

/* ───── Barre du bas : des pictogrammes ───── */
.tabbar { position: fixed; left: 50%; bottom: 0; z-index: 20; display: flex; width: 100%; max-width: 480px; transform: translateX(-50%); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-top: 2px solid var(--line); background: var(--card); }
.tabbar a { position: relative; display: flex; flex: 1 1 0; align-items: center; justify-content: center; min-width: 0; min-height: 52px; border: 2px solid transparent; border-radius: 14px; color: var(--soft); text-decoration: none; }
.tabbar svg { width: 30px; height: 30px; }
.tabbar a.map { color: #f26b2c; } .tabbar a.books { color: #0e9bd8; } .tabbar a.chart { color: var(--gold-d); } .tabbar a.user { color: var(--primary); }
.tabbar a.book { color: #0e9bd8; } .tabbar a.upload { color: var(--gold-d); } .tabbar a.mail { color: #f26b2c; } .tabbar a.check { color: var(--good); }
.tabbar a[aria-current="page"] { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 14%, var(--card)); }
.tabbar a[aria-current="page"] svg { animation: hop .45s ease; }
.tabbar a.play .ico { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 50%; background: var(--primary); box-shadow: 0 4px 0 var(--primary-d); color: #fff; }

/* ───── Boutons ───── */
.btn { display: block; width: 100%; min-height: 54px; margin: 8px 0; padding: 12px 18px; border: 0; border-radius: 18px; background: var(--primary); box-shadow: 0 5px 0 var(--primary-d); color: #fff; font-family: inherit; font-size: 1.1rem; font-weight: 600; line-height: 1.3; letter-spacing: .04em; text-transform: uppercase; text-align: center; text-decoration: none; cursor: pointer; transition: transform .08s, box-shadow .08s; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--primary-d); }
.btn.ghost { border: 2px solid var(--line); background: var(--card); box-shadow: 0 5px 0 var(--line); color: var(--text); }
.btn.danger, .btn.bad { background: var(--bad); box-shadow: 0 5px 0 var(--bad-d); }
.btn.good { background: var(--good); box-shadow: 0 5px 0 var(--good-d); }
.btn.small { display: inline-flex; align-items: center; justify-content: center; width: auto; min-height: 44px; margin: 0 0 4px; padding: 8px 14px; font-size: .9rem; }
a.btn:not(.small) { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.btn:disabled { opacity: .4; cursor: default; transform: none; }
.btn.link-btn { background: none; box-shadow: none; color: var(--link); }

/* ───── Éléments communs ───── */
.card { margin-bottom: 18px; padding: 20px 16px; border: 2px solid var(--line); border-radius: 22px; background: var(--card); box-shadow: 0 5px 0 var(--line); animation: rise .35s ease both; }
.card:nth-of-type(2) { animation-delay: .07s; }
.card:nth-of-type(3) { animation-delay: .14s; }
.tint-orange { --tint: #ff8a3d; }
.tint-blue { --tint: #2aa8e8; }
.tint-gold { --tint: #ffc02e; }
.tint-violet { --tint: #8b46f5; }
.card[class*="tint-"] { border-color: var(--tint); background: color-mix(in srgb, var(--tint) 13%, var(--card)); box-shadow: 0 5px 0 color-mix(in srgb, var(--tint) 55%, var(--card)); }
.badge-ico { display: inline-grid; place-items: center; width: 38px; height: 38px; margin-right: 4px; border-radius: 12px; background: var(--card); box-shadow: 0 3px 0 rgb(40 10 90 / .14); vertical-align: middle; }
.center { text-align: center; }
.prose h2 { margin-top: 18px; }
.draft { padding: 8px 12px; border-radius: 10px; background: var(--gold); color: #2a1d00; font-weight: 600; }
.hint { color: var(--soft); font-size: .95rem; }
.eyebrow { margin: 0 0 6px; color: var(--soft); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.back { display: inline-block; padding: 8px 0; font-weight: 600; text-decoration: none; }
.mascot { display: block; max-width: 100%; height: auto; margin: 0 auto 8px; }
.avatar { border-radius: 24px; }
.legal { margin-top: 16px; color: var(--soft); font-size: .8rem; text-align: center; }
.legal p { margin: 4px 0; }
.legal.links { line-height: 2.2; }
.legal.links a { display: inline-block; }
.prose a:not(.btn) { overflow-wrap: anywhere; }
.prose li { margin-bottom: 6px; }
.demo { display: inline-block; padding: 4px 10px; border-radius: 10px; background: var(--gold); color: #2a1d00; font-weight: 600; }
.install { display: block; width: min(320px, 100%); min-height: 48px; margin: 12px auto 0; border: 2px solid var(--line); border-radius: 14px; background: var(--card); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.install-ios { margin: 8px 0 0; color: var(--soft); font-size: .9rem; text-align: center; }
.splash { display: flex; flex-direction: column; justify-content: center; min-height: calc(100vh - 140px); min-height: calc(100dvh - 140px); text-align: center; }
.splash .mascot { animation: bob 2.6s ease-in-out infinite; }
.splash h1 { margin-bottom: 4px; color: var(--primary); font-size: 2.8rem; }
.splash > p { margin: 0 0 24px; color: var(--soft); font-weight: 500; font-size: 1.2rem; }
:root[data-theme="dark"] .splash h1 { color: var(--link); }

label { display: block; margin-bottom: 14px; font-weight: 600; }
input, select, textarea { display: block; width: 100%; min-height: 50px; margin-top: 6px; padding: 10px 14px; border: 2px solid var(--line); border-radius: 14px; background: var(--field); color: var(--text); font: inherit; }
textarea { min-height: 96px; resize: vertical; }
input[type="file"] { padding: 10px; }
input:focus, select:focus, textarea:focus, summary:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
fieldset { margin: 0; padding: 0; border: 0; }
legend { margin-bottom: 4px; padding: 0; font-weight: 600; }
fieldset .row label { flex: 1; font-weight: 400; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { flex: none; width: 24px; height: 24px; min-height: 0; margin: 0; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.choice-row { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.choice-row input[type="radio"] { flex: none; width: 28px; height: 28px; min-height: 0; margin: 0; }
.choice-row input[type="text"] { margin: 0; }

.notice { margin: 0 0 14px; padding: 10px 14px; border: 2px solid; border-radius: 14px; font-weight: 500; }
.notice p { margin: 0; }
.notice.ok { border-color: var(--good); background: color-mix(in srgb, var(--good) 16%, var(--card)); }
.notice.info { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 18%, var(--card)); }
.notice.error { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, var(--card)); }

.list { margin: 0 0 16px; padding: 0; list-style: none; }
.list li { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 2px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list li > div:first-child { min-width: 0; }
.list li:has(progress) > div:first-child { flex: 1; }
progress { display: block; width: 100%; height: 16px; margin: 8px 0 12px; overflow: hidden; border: 0; border-radius: 99px; background: var(--line); appearance: none; }
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--primary); border-radius: 99px; transition: width .4s; }
progress::-moz-progress-bar { background: var(--primary); border-radius: 99px; }
progress.gold::-webkit-progress-value { background: var(--gold); }
progress.gold::-moz-progress-bar { background: var(--gold); }
.tag { display: inline-block; padding: 2px 10px; border: 2px solid var(--line); border-radius: 99px; font-size: .85rem; font-weight: 500; }
.tag.ok { border-color: var(--good); }
.meter { font-weight: 600; white-space: nowrap; }
details { margin-bottom: 10px; border: 2px solid var(--line); border-radius: 16px; }
summary { min-height: 48px; padding: 12px 14px; font-weight: 600; cursor: pointer; }
.course { background: var(--card); }
.course .list, .course .summary { margin: 0; padding: 0 14px 12px 14px; }
.course .summary { padding-left: 34px; }
.summary li { margin-bottom: 8px; }

.stars-hint { margin: 2px auto 12px; max-width: 19em; text-wrap: balance; color: var(--soft); font-size: .95rem; line-height: 1.35; }
.stars { display: inline-flex; gap: 1px; }
.stars span { display: flex; }
.stars svg { width: 22px; height: 22px; }
.stars .on { color: var(--gold); }
.stars .off { color: color-mix(in srgb, var(--soft) 40%, transparent); }
.list li > div:first-child > .stars { display: flex; }

/* ───── L'immeuble ───── */
.city { position: relative; flex: 1; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; padding-top: 18px; background: var(--sky); }
.clouds i { position: absolute; left: -90px; width: 76px; height: 24px; border-radius: 99px; background: rgb(255 255 255 / .75); animation: drift 38s linear infinite; }
.clouds i::before { content: ""; position: absolute; left: 16px; bottom: 8px; width: 36px; height: 36px; border-radius: 50%; background: inherit; }
.clouds i:nth-child(1) { top: 40px; }
.clouds i:nth-child(2) { top: 38%; animation-delay: -14s; animation-duration: 52s; }
.clouds i:nth-child(3) { top: 72%; animation-delay: -29s; animation-duration: 45s; }
:root[data-theme="dark"] .clouds { opacity: .12; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .clouds { opacity: .12; } }

.top-roof { padding-left: 106px; }
.rooftop { display: block; width: 100%; height: 74px; }
.block { position: relative; }
.flats { margin: 0; padding: 0; list-style: none; }
.flat { display: grid; grid-template-columns: 80px 26px 1fr; color: var(--text); text-decoration: none; }
.marker { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 8px 0; }
.marker .stars svg { width: 20px; height: 20px; filter: drop-shadow(0 2px 0 rgb(40 10 80 / .25)); }
.marker .stars { align-items: flex-end; }
.marker .stars span:nth-child(2) svg { width: 26px; height: 26px; }
.marker .stars span:nth-child(2) { transform: translateY(3px); }
.marker .stars .off { color: color-mix(in srgb, var(--soft) 45%, transparent); }
.flat.locked .marker .stars .off { color: color-mix(in srgb, var(--soft) 25%, transparent); }
/* Trois étoiles : le niveau parfaitement réussi se voit en or. */
.flat.passed.perfect .pin { background: var(--gold); box-shadow: 0 6px 0 var(--gold-d); color: #4a2c00; }
.tally { display: inline-block; margin: 6px 0 0; padding: 2px 14px; border-radius: 99px; background: rgb(255 255 255 / .14); font-weight: 600; font-size: .95rem; }
.pin { display: grid; place-items: center; width: 58px; height: 54px; border-radius: 50%; background: var(--locked); box-shadow: 0 6px 0 var(--locked-d); color: var(--soft); font-size: 1.5rem; font-weight: 700; transition: transform .08s, box-shadow .08s; }
.pin svg { width: 30px; height: 30px; }
.flat.passed .pin { background: var(--good); box-shadow: 0 6px 0 var(--good-d); color: #fff; }
.flat.open .pin { background: var(--primary); box-shadow: 0 6px 0 var(--primary-d); color: #fff; animation: pulse 1.6s ease-in-out infinite; }
/* L'anneau du niveau à jouer entoure le bouton et son ombre. */
.flat.open .pin::after { content: ""; position: absolute; inset: -9px -9px -15px; border: 4px solid #a875ff; border-radius: 50%; pointer-events: none; }
a.flat:active .pin { transform: translateY(5px); }

/* L'échelle de secours */
.ladder { background: linear-gradient(90deg, transparent 5px, #e0a461 5px 9px, transparent 9px 18px, #e0a461 18px 22px, transparent 22px); position: relative; }
.ladder::before { content: ""; position: absolute; inset: 0 8px; background: repeating-linear-gradient(180deg, transparent 0 13px, #e0a461 13px 17px); }

/* La façade : deux fenêtres et la plaque du niveau */
.wall { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-width: 0; padding: 14px 10px 16px; border-left: 9px solid var(--wall-d); background: var(--wall); }
.wall::after { content: ""; position: absolute; left: -9px; right: 0; bottom: 0; height: 5px; background: var(--wall-d); }
.windows { position: relative; display: flex; justify-content: center; align-items: flex-end; gap: 12px; width: 100%; }
.window { display: block; flex: 1 1 0; width: 100%; min-width: 0; max-width: 118px; height: auto; filter: drop-shadow(0 4px 0 rgb(60 20 40 / .22)); }
.window.passed { filter: drop-shadow(0 4px 0 rgb(60 20 40 / .22)) drop-shadow(0 0 9px rgb(255 214 107 / .8)); }
.plate { max-width: 100%; text-align: center; padding: 3px 12px; border-radius: 10px; background: rgb(255 255 255 / .95); color: #2c1a52; font-size: .85rem; font-weight: 600; line-height: 1.3; }
.flat.locked .plate { background: rgb(255 255 255 / .62); }
/* Le dernier étage d'un chapitre : le boss */
/* Seul le sommet de l'immeuble a un coin arrondi : les chapitres se suivent sans trou. */
.block:first-of-type .summit .wall { border-top: 9px solid var(--wall-d); border-radius: 28px 0 0 0; }
.penthouse { display: block; width: 100%; max-width: 230px; height: auto; filter: drop-shadow(0 4px 0 rgb(60 20 40 / .22)); }
.penthouse.passed { filter: drop-shadow(0 0 12px rgb(255 214 107 / .85)); }
.summit .pin { border-radius: 18px; }
.flat.summit.open .pin { background: var(--gold); box-shadow: 0 6px 0 var(--gold-d); color: #4a2c00; }
.flat.summit.open .pin::after { border-color: var(--gold); border-radius: 26px; }
.flat.summit.passed .pin { background: var(--gold); box-shadow: 0 6px 0 var(--gold-d); color: #4a2c00; }

/* L'enseigne sous chaque chapitre, intégrée à la façade, avec son auvent */
.shop { display: grid; grid-template-columns: 80px 26px 1fr; }
.shop .ladder { grid-column: 2; }
.sign { min-width: 0; padding: 0 12px 12px; border-left: 9px solid var(--wall-d); background: #2c1a58; color: #fff; text-align: center; }
.sign::before { content: ""; display: block; height: 16px; margin: 0 -12px 8px; background: linear-gradient(var(--wall), var(--wall)) 0 0 / 100% 8px no-repeat, radial-gradient(circle at 12px 8px, var(--wall) 11.5px, transparent 12px) 0 0 / 24px 16px repeat-x; }
.sign span { color: #ffd66b; font-size: .72rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.sign h2 { margin: 0; font-size: 1.05rem; }

/* Les erreurs à revoir : un bouton rond au-dessus de la barre du bas */
.review-fab { position: fixed; left: max(10px, calc(50% - 230px)); bottom: calc(var(--bar) + 12px + env(safe-area-inset-bottom)); z-index: 15; display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%; background: var(--card); box-shadow: 0 5px 0 var(--bad-d), 0 0 0 3px var(--bad); font-size: 1.7rem; text-decoration: none; animation: bob 1.8s ease-in-out infinite; }
.review-fab b { position: absolute; top: -6px; right: -6px; min-width: 24px; padding: 0 6px; border: 2px solid var(--card); border-radius: 99px; background: var(--bad); color: #fff; font-size: .8rem; line-height: 20px; text-align: center; }

/* Le pied de l'immeuble */
.ground { position: relative; display: grid; grid-template-columns: 106px 1fr; align-items: end; }
/* L'échelle descend jusqu'au trottoir, derrière le vélo. */
.ground::before { content: ""; position: absolute; top: 0; bottom: 12px; left: 80px; width: 26px; background: linear-gradient(90deg, transparent 5px, #e0a461 5px 9px, transparent 9px 18px, #e0a461 18px 22px, transparent 22px); }
.ground::after { content: ""; position: absolute; top: 0; bottom: 12px; left: 88px; width: 10px; background: repeating-linear-gradient(180deg, transparent 0 13px, #e0a461 13px 17px); }
.street { position: relative; z-index: 1; }
.street, .entrance { display: block; width: 100%; height: 130px; }
.lobby { border-left: 9px solid var(--wall-d); background: linear-gradient(var(--wall) 0 90%, var(--ground) 90%); }
.lamp { animation: glow 2.4s ease-in-out infinite; }

/* Les habitants bougent un peu */
.blink { transform-box: fill-box; transform-origin: center; animation: blink 4.5s infinite; }
.wave, .tail { transform-box: fill-box; transform-origin: bottom left; animation: wave 1.5s ease-in-out infinite; }
.tail { animation-duration: 2.4s; }
.dance { transform-box: fill-box; transform-origin: bottom center; animation: dance 1.1s ease-in-out infinite; }
.note, .balloon { animation: bob 1.8s ease-in-out infinite; }
.swim { animation: swim 3s ease-in-out infinite; }
.halo { animation: glow 1.6s ease-in-out infinite; }
.spark, .crown, .beacon { transform-box: fill-box; transform-origin: center; animation: twinkle 1.5s ease-in-out infinite; }
.pennant { transform-box: fill-box; transform-origin: top center; animation: dance 2s ease-in-out infinite; }

/* ───── Page d'un niveau ───── */
.door { margin-bottom: 20px; border-radius: 24px; background: var(--card); box-shadow: 0 6px 0 var(--line); animation: rise .35s ease both; }
.door-wall { display: flex; justify-content: center; gap: 14px; padding: 22px 16px 24px; border-bottom: 8px solid var(--wall-d); border-radius: 24px 24px 0 0; background: var(--wall); }
.door-body { padding: 16px; }
.door h1 { margin-bottom: 8px; }
.door .stars svg { width: 36px; height: 36px; }
.goal { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 1.15rem; font-weight: 500; }
.lives { display: inline-flex; color: #ef3d5b; }

/* ───── Choix de la classe et de la matière ───── */
.levels fieldset { margin-bottom: 18px; }
.levels fieldset > div { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.g0 { --tint: #17a55a; } .g1 { --tint: #2a8fe8; } .g2 { --tint: #8b46f5; }
.level { min-height: 58px; padding: 6px; border: 2px solid var(--tint); border-radius: 16px; background: color-mix(in srgb, var(--tint) 12%, var(--card)); box-shadow: 0 4px 0 var(--tint); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.level.on { background: var(--tint); color: #fff; }
.level:active, .subject:active:enabled { transform: translateY(3px); box-shadow: 0 1px 0 var(--tint); }
.subjects { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
/* Un nombre impair de matières : la dernière prend toute la largeur. */
.subjects .subject:nth-of-type(odd):last-of-type { grid-column: 1 / -1; }
.subject { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; padding: 16px 8px; border: 3px solid var(--tint); border-radius: 22px; background: color-mix(in srgb, var(--tint) 14%, var(--card)); box-shadow: 0 5px 0 var(--tint); color: var(--text); font: inherit; cursor: pointer; }
.s-maths { --tint: #8b46f5; } .s-francais { --tint: #e9506b; } .s-histoire-geo { --tint: #d9861f; } .s-anglais { --tint: #2a8fe8; } .s-physique-chimie { --tint: #12a89a; } .s-svt { --tint: #3fae45; }
.subject.on { background: var(--tint); color: #fff; }
.subject.on small { color: #fff; }
.subject:disabled { box-shadow: none; opacity: .5; cursor: default; }
.subject .emoji { font-size: 2.6rem; line-height: 1.2; }
.field { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 52px; border-top: 2px solid var(--line); color: var(--text); text-align: left; text-decoration: none; }
.field strong { color: var(--link); }

/* ───── Progrès ───── */
.flame-card img { margin: 0 auto; }
.flame-card.done img { animation: flicker 1.4s ease-in-out infinite; }
.big { margin: 0; font-size: 3rem; font-weight: 700; line-height: 1.2; }
.badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0; padding: 0; list-style: none; font-weight: 500; }
.badges li { padding: 6px 14px; border-radius: 99px; background: var(--card); }

/* ───── Badges ───── */
.medal { --medal: #17a55a; --medal-d: #0e7a41; display: grid; flex: none; place-items: center; width: 68px; height: 68px; border-radius: 50%; border: 4px solid #fff6e6; background: radial-gradient(circle at 35% 28%, color-mix(in srgb, var(--medal) 45%, #fff), var(--medal) 62%); box-shadow: 0 5px 0 var(--medal-d); font-size: 1.9rem; line-height: 1; }
.medal.blue { --medal: #2a9fe8; --medal-d: #1672ad; }
.medal.violet { --medal: #8b46f5; --medal-d: #5b21b6; }
.medal.gold { --medal: #ffc02e; --medal-d: #c98300; }
.medal.pink { --medal: #ef6aa8; --medal-d: #b9447b; }
.medal.red { --medal: #e93e57; --medal-d: #a92039; }
.medal.orange { --medal: #ff8a3d; --medal-d: #c25a12; }
.medal.locked { --medal: var(--locked); --medal-d: var(--locked-d); border-color: var(--line); }
.medal.locked span { filter: grayscale(1); opacity: .45; }
.medals { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 18px 8px; margin: 0; padding: 0; list-style: none; text-align: center; }
.medals li { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.medals strong { margin-top: 6px; font-size: .9rem; line-height: 1.2; }
.medals small { font-size: .75rem; line-height: 1.25; }
.medals .count { padding: 0 8px; border-radius: 99px; background: var(--card); color: var(--text); font-weight: 600; }
.medals .earned .medal { animation: pop .45s ease both; }
.unlocked { display: grid; gap: 12px; margin: 0 0 16px; padding: 0; list-style: none; }
.unlocked li { display: flex; align-items: center; gap: 14px; padding: 12px; border: 2px solid var(--gold); border-radius: 20px; background: var(--card); box-shadow: 0 5px 0 var(--gold-d); text-align: left; animation: pop .5s .9s ease both; }
.unlocked li + li { animation-delay: 1.15s; }
.unlocked li > span:last-child { min-width: 0; }
.unlocked strong { display: block; font-size: 1.15rem; line-height: 1.25; }
.unlocked .medal { animation: spin .8s 1.1s ease both; }

/* ───── Figures de géométrie ───── */
.figure { display: block; width: 100%; max-width: 300px; margin: 12px auto 0; overflow: visible; }
.figure .shape { fill: rgb(255 214 107 / .14); stroke: currentColor; stroke-width: 2.5; stroke-linejoin: round; }
.figure .square, .figure .cube { fill: rgb(120 190 255 / .2); stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
.figure .edge { fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.figure .cut { stroke: #ffd66b; stroke-width: 3; stroke-linecap: round; }
.figure .mark { fill: none; stroke: #ffd66b; stroke-width: 2.5; }
.figure .measure { stroke: currentColor; stroke-width: 1.5; opacity: .6; }
.figure .full { fill: #ffc02e; stroke: currentColor; stroke-width: 2; }
.figure .dot { fill: #ffd66b; }
.figure text { fill: currentColor; font-family: Fredoka, system-ui, sans-serif; font-size: 15px; text-anchor: middle; dominant-baseline: central; }
.figure text.name { font-weight: 700; }
.figure text.value { font-weight: 500; }
.figure text.area { font-size: 20px; font-weight: 700; }
.figure text.unknown { fill: #ffd66b; font-size: 22px; font-weight: 700; }
.figure text.area.unknown { font-size: 28px; }
.board-prompt + .figure { max-width: 230px; max-height: 18vh; }
.mistakes .figure { max-width: 220px; margin: 6px 0; }
.mistakes .figure .cut, .mistakes .figure .mark, .mistakes .figure .dot, .mistakes .figure text.unknown { stroke: #d98e00; }
.mistakes .figure text.unknown, .mistakes .figure .dot { fill: #d98e00; stroke: none; }
/* Avec une figure, tout se resserre pour que « Valider » reste à l'écran d'un téléphone. */
.question .board:has(.figure) { min-height: 0; margin-bottom: 14px; padding: 12px 14px 10px; }
.question .board:has(.figure) h1 { font-size: 1.15rem; line-height: 1.45; }
.question .board .figure { max-width: 250px; max-height: 21vh; margin-top: 6px; }
.question:has(.figure) fieldset.answers { gap: 10px; margin-bottom: 12px; }
.question:has(.figure) .answer > span { min-height: 50px; padding-top: 6px; padding-bottom: 6px; }

/* ───── Menu qui monte du bas (quitter un exercice) ───── */
.sheet { width: min(480px, 100%); max-width: 100%; margin: auto auto 0; padding: 0; border: 0; border-radius: 30px 30px 0 0; background: var(--card); box-shadow: 0 -5px 0 var(--primary); color: var(--text); text-align: center; }
.sheet[open] { animation: sheet-up .28s cubic-bezier(.2, .9, .3, 1) both; }
.sheet::backdrop { background: rgb(20 8 48 / .68); }
.sheet > div { padding: 10px 20px calc(14px + env(safe-area-inset-bottom)); }
.sheet-grip { display: block; width: 52px; height: 6px; margin: 0 auto 14px; border-radius: 99px; background: var(--line); }
.sheet h2 { margin: 0 0 6px; font-size: 1.6rem; }
.sheet-score { margin: 0; font-size: 1.1rem; }
.sheet-score b { color: var(--good); font-size: 1.5rem; }
.sheet-warn { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 12px; border: 2px solid var(--gold); border-radius: 14px; font-weight: 600; }
.sheet-warn svg { flex: none; width: 22px; height: 22px; }
.sheet-loss { padding: 8px 12px; border: 2px solid var(--bad); border-radius: 14px; font-weight: 500; }
.sheet-loss b { color: var(--bad); font-weight: 700; }
.sheet .btn.leave { color: var(--bad); }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }

/* ───── Choix du chapitre ───── */
/* « clip » coupe comme « hidden » mais laisse le bouton de chapitre rester collé en haut. */
.city { overflow: clip; }
.chapter-switch { position: sticky; top: calc(72px + env(safe-area-inset-top)); z-index: 12; display: flex; align-items: center; gap: 8px; width: max-content; max-width: calc(100% - 32px); min-height: 46px; margin: 0 auto 10px; padding: 6px 18px; border-radius: 99px; background: var(--card); box-shadow: 0 4px 0 var(--primary-d), 0 0 0 2px var(--primary); color: var(--text); font-weight: 600; text-decoration: none; }
.chapter-switch > span:nth-child(2) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chapters { display: grid; gap: 14px; }
.chapter-card { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px; border: 3px solid transparent; border-radius: 22px; background: var(--wall); box-shadow: 0 5px 0 var(--wall-d); color: #fff; font: inherit; text-align: left; cursor: pointer; animation: rise .35s ease both; }
.chapter-card:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--wall-d); }
.chapter-card.on { border-color: #fff6e6; box-shadow: 0 5px 0 var(--wall-d), 0 0 0 4px var(--primary); }
.chapter-card > b { display: grid; flex: none; place-items: center; width: 48px; height: 48px; border-radius: 16px; background: #fff6e6; color: #2c1a52; font-size: 1.35rem; }
.chapter-card > span { flex: 1; min-width: 0; }
.chapter-card strong { display: block; font-size: 1.1rem; line-height: 1.25; text-shadow: 0 1px 2px rgb(40 10 60 / .35); }
.chapter-card small { color: #fff; font-weight: 500; }
.chapter-card progress { height: 10px; margin: 6px 0 0; background: rgb(40 10 60 / .25); }
.chapter-card progress::-webkit-progress-bar { background: rgb(40 10 60 / .25); }
.chapter-card progress::-webkit-progress-value { background: #fff6e6; }
.chapter-card progress::-moz-progress-bar { background: #fff6e6; }

/* ───── Fenêtres d'annonce ───── */
.popup { --tint: var(--primary); width: min(320px, calc(100% - 32px)); padding: 24px 18px 14px; border: 4px solid var(--tint); border-radius: 30px; background: var(--card); box-shadow: 0 10px 0 rgb(10 4 30 / .35); color: var(--text); text-align: center; }
.popup[open] { animation: popin .45s cubic-bezier(.2, 1.4, .4, 1) both; }
.popup::backdrop { background: rgb(20 8 48 / .68); }
.popup.is-win { --tint: var(--gold); }
.popup.is-flame { --tint: #ff7a2f; }
.popup.is-lost { --tint: #8d82b3; }
.popup h2 { font-size: 1.6rem; font-weight: 700; }
.popup img { display: block; margin: 0 auto 8px; }
.popup-icon { margin: 0 0 4px; font-size: 3.6rem; line-height: 1.2; animation: bob 1.6s ease-in-out infinite; }
.popup .stars { display: flex; justify-content: center; gap: 6px; margin: 4px 0 12px; }
.popup .stars svg { width: 54px; height: 54px; filter: drop-shadow(0 4px 0 rgb(150 90 0 / .35)); }
.popup .stars .on { animation: star .6s .35s ease both; }
.popup .stars .on:nth-child(2) { animation-delay: .6s; }
.popup .stars .on:nth-child(3) { animation-delay: .85s; }
.popup-xp { display: inline-block; margin: 0 0 8px; padding: 4px 18px; border-radius: 99px; background: var(--gold); color: #3a2500; font-weight: 700; font-size: 1.2rem; }
.popup-xp + form { display: block; }
.popup-flame { position: relative; display: flex; flex-direction: column; align-items: center; margin: 0 0 6px; }
.popup-flame img { margin: 0; animation: flicker 1.1s ease-in-out infinite; }
.popup-flame b { margin-top: -6px; color: #ff7a2f; font-size: 3rem; font-weight: 700; line-height: 1.1; animation: pop .6s .5s ease both; }
.popup .btn.link-btn { margin-bottom: 0; }

/* ───── Forfait The Ovena + ───── */
.premium-card { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; padding: 16px; border-radius: 22px; background: linear-gradient(120deg, #6d28d9, #d946a6 55%, #ff8a3d); box-shadow: 0 5px 0 #4c1d95; color: #fff; text-decoration: none; }
.premium-card > span:first-child { font-size: 2.2rem; animation: bob 2.2s ease-in-out infinite; }
.premium-card > span:nth-child(2) { flex: 1; min-width: 0; }
.premium-card > span:last-child { font-size: 1.8rem; }
.premium-card strong { display: block; font-size: 1.25rem; }
.premium-card small { color: #fff; }
.offer-head { margin-bottom: 20px; padding: 22px 16px 18px; border-radius: 28px; background: linear-gradient(150deg, #5b21b6, #b8329c 60%, #ff8a3d); box-shadow: 0 6px 0 #3b137f; color: #fff; }
.offer-head h1 { margin-bottom: 4px; font-size: 2.2rem; }
.offer-head h1 span { color: #ffd66b; }
.offer-head p { margin: 0; }
.offer-crown { font-size: 3.6rem; line-height: 1.2; animation: bob 2.2s ease-in-out infinite; }
.offer-head .soon { display: inline-block; margin-top: 12px; padding: 3px 16px; border-radius: 99px; background: #ffd66b; color: #3a2500; font-weight: 600; font-size: .9rem; }
.benefits { display: grid; gap: 14px; margin: 0 0 22px; padding: 0; list-style: none; }
.benefits li { display: flex; align-items: center; gap: 14px; }
.benefits .medal { width: 56px; height: 56px; font-size: 1.5rem; }
.benefits li > span:last-child { min-width: 0; }
.benefits strong { display: block; line-height: 1.3; }
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.plan { position: relative; display: flex; margin: 0; cursor: pointer; }
.plan input { position: absolute; width: 1px; height: 1px; min-height: 0; margin: 0; opacity: 0; }
.plan > span { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; padding: 22px 8px 14px; border: 3px solid var(--line); border-radius: 22px; background: var(--card); box-shadow: 0 5px 0 var(--line); text-align: center; }
.plan input:checked + span { border-color: var(--primary); box-shadow: 0 5px 0 var(--primary); background: color-mix(in srgb, var(--primary) 14%, var(--card)); }
.plan input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }
.plan b { font-size: 1.7rem; font-weight: 700; line-height: 1.3; }
.plan em { position: absolute; top: -10px; left: 50%; padding: 2px 10px; transform: translateX(-50%); border-radius: 99px; background: #17a55a; color: #fff; font-size: .75rem; font-style: normal; font-weight: 600; white-space: nowrap; }
.btn.premium { background: linear-gradient(120deg, #6d28d9, #d946a6 60%, #ff8a3d); box-shadow: 0 5px 0 #4c1d95; }

/* ───── Séries ───── */
.run-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.hearts { display: flex; gap: 6px; }
.hearts span { display: flex; }
.hearts svg { width: 32px; height: 32px; }
.hearts .on { color: #ef3d5b; }
.hearts .off { color: color-mix(in srgb, var(--soft) 40%, transparent); }
.hearts .broke svg { animation: break .8s ease both; }
.hearts.low .on svg { animation: beat 1s ease-in-out infinite; }
.mode { display: flex; align-items: center; gap: 8px; color: #0e9bd8; font-weight: 600; }
.btn.quit { flex: none; margin: 0 0 5px; white-space: nowrap; }
/* Petits téléphones : cœurs, chrono et « Quitter » tiennent sur la même ligne. */
@media (max-width: 359px) {
  .run-top { gap: 6px; }
  .run-top .hearts { gap: 2px; }
  .run-top .hearts svg { width: 25px; height: 25px; }
  .run-top .timer { min-width: 66px; padding-left: 7px; padding-right: 7px; }
  .run-top .btn.quit { padding-left: 10px; padding-right: 10px; }
}
.bricks { display: flex; gap: 4px; margin: 0 0 14px; padding: 0; list-style: none; }
.bricks li { flex: 1; height: 12px; border-radius: 99px; background: var(--locked); }
.bricks li.on { background: linear-gradient(180deg, #8cf08a, #17a55a); animation: pop .4s ease both; }

/* ───── Écritures mathématiques ───── */
.frac { display: inline-flex; flex-direction: column; align-items: stretch; margin: 0 .14em; font-size: .94em; line-height: 1.15; text-align: center; vertical-align: middle; }
.frac > span:first-child { padding: 0 .22em .08em; border-bottom: .1em solid currentColor; }
.frac > span:last-child { padding: .08em .22em 0; }
.root { display: inline-flex; align-items: stretch; margin: 0 .08em; vertical-align: middle; white-space: nowrap; }
.root > svg { flex: none; width: .62em; height: auto; min-height: 1.25em; fill: none; stroke: currentColor; stroke-width: .09em; stroke-linejoin: round; }
.root > svg path { vector-effect: non-scaling-stroke; stroke-width: 2px; }
.root > span { padding: .08em .14em 0 .06em; border-top: 2px solid currentColor; line-height: 1.2; }
.board h1 .frac, .board-prompt .frac { margin: 0 .18em; }
.board h1 { line-height: 1.7; }
.preview { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2px; min-height: 58px; margin: 10px 0 0; padding: 6px 12px; border: 2px dashed var(--line); border-radius: 14px; font-size: 1.5rem; font-weight: 600; white-space: pre-wrap; }

/* Chronomètre */
.timer { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 0 6px; min-width: 76px; padding: 4px 10px 6px; border: 2px solid #12a0d8; border-radius: 16px; background: var(--card); box-shadow: 0 4px 0 #12a0d8; color: #12a0d8; }
.timer svg { width: 22px; height: 22px; }
.timer b { min-width: 2ch; color: var(--text); font-size: 1.25rem; line-height: 1.2; text-align: center; font-variant-numeric: tabular-nums; }
.timer progress { grid-column: 1 / -1; height: 6px; margin: 2px 0 0; }
.timer progress::-webkit-progress-value { background: #12a0d8; transition: width .2s linear; }
.timer progress::-moz-progress-bar { background: #12a0d8; }
.timer.hurry { border-color: var(--bad); box-shadow: 0 4px 0 var(--bad); color: var(--bad); animation: beat 1s ease-in-out infinite; }
.timer.hurry progress::-webkit-progress-value { background: var(--bad); }
.timer.hurry progress::-moz-progress-bar { background: var(--bad); }
.timed { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 0 12px; color: #12a0d8; font-weight: 600; }
.pin { position: relative; }
.pin .clock { position: absolute; z-index: 1; bottom: -10px; right: -10px; display: grid; place-items: center; width: 28px; height: 28px; border: 2px solid #fff; border-radius: 50%; background: #12a0d8; color: #fff; }
.pin .clock svg { width: 17px; height: 17px; }

/* La carte « tableau » de la question */
.board { position: relative; margin-bottom: 18px; padding: 22px 18px; border-radius: 24px; background: linear-gradient(145deg, #7c3aed, #3d1c8f); box-shadow: 0 6px 0 #2b1269; color: #fff; }
.board h1 { margin: 0; font-size: 1.55rem; font-weight: 600; }
.board-kind { margin: 0 0 8px; color: #e0d0ff; font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.question { display: flex; flex: 1; flex-direction: column; }
.question .board { display: flex; flex-direction: column; justify-content: center; min-height: 180px; margin-top: 6px; text-align: center; animation: rise .35s ease both; }
.question .btn { margin-top: auto; }
.question fieldset.answers { display: grid; gap: 14px; margin: 0 0 16px; }
.answers.pairs { grid-template-columns: 1fr 1fr; }
.k0 { --tint: #ff6b6b; } .k1 { --tint: #2aa8e8; } .k2 { --tint: #2fb866; } .k3 { --tint: #f59b23; }
.answer { position: relative; display: flex; margin: 0; cursor: pointer; font-weight: 500; animation: rise .35s ease both; }
.answer:nth-child(2) { animation-delay: .06s; } .answer:nth-child(3) { animation-delay: .12s; } .answer:nth-child(4) { animation-delay: .18s; }
.answer input { position: absolute; width: 1px; height: 1px; min-height: 0; margin: 0; opacity: 0; }
.answer > span, .solved li { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 10px 12px; border: 2px solid var(--line); border-radius: 18px; background: var(--card); box-shadow: 0 4px 0 var(--line); }
.answer > span { border-color: color-mix(in srgb, var(--tint) 55%, var(--card)); box-shadow: 0 4px 0 color-mix(in srgb, var(--tint) 55%, var(--card)); font-size: 1.1rem; transition: transform .1s; }
.answer b, .solved b { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 11px; background: var(--locked); color: var(--text); font-size: .95rem; }
.answer b { background: var(--tint); color: #fff; }
.answer em { min-width: 0; font-style: normal; }
.answer input:checked + span { border-color: var(--tint); background: color-mix(in srgb, var(--tint) 24%, var(--card)); box-shadow: 0 4px 0 var(--tint); animation: select .3s ease; }
.answer input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }
.answer:active > span { transform: translateY(3px); }
.chalk { min-height: 64px; margin: 0; font-size: 1.4rem; font-weight: 600; text-align: center; }
.keys { flex-wrap: nowrap; gap: 6px; margin: 12px 0 16px; }
.key { flex: 1; min-width: 0; min-height: 50px; padding: 0; border: 2px solid var(--line); border-radius: 14px; background: var(--card); box-shadow: 0 3px 0 var(--line); color: var(--text); font: inherit; font-size: 1.25rem; font-weight: 600; cursor: pointer; }
.key:active { transform: translateY(3px); box-shadow: none; }

/* Correction : la carte se retourne */
.verdict { margin-top: 4px; text-align: center; animation: flip .45s ease both; }
.verdict.good { background: linear-gradient(145deg, #21c06b, #0b7a45); box-shadow: 0 6px 0 #075c33; }
.verdict.bad { background: linear-gradient(145deg, #ff5d73, #b81f3d); box-shadow: 0 6px 0 #8d1630; }
.stamp { display: inline-block; margin: 0 0 10px; padding: 2px 20px; border: 3px solid currentColor; border-radius: 14px; font-size: 1.7rem; font-weight: 700; transform: rotate(-4deg); animation: stamp .5s .25s ease both; }
.xp { position: absolute; top: -12px; right: 12px; padding: 4px 14px; border-radius: 99px; background: var(--gold); box-shadow: 0 3px 0 var(--gold-d); color: #3a2500; font-weight: 700; white-space: nowrap; animation: pop .45s .4s ease both; }
.board-prompt { margin: 0; font-weight: 500; }
.solved { display: grid; gap: 10px; margin: 0 0 16px; padding: 0; list-style: none; font-weight: 500; }
.solved li { min-height: 56px; }
.solved li > span { flex: 1; min-width: 0; }
.solved small { flex: none; }
.solved li.right { border-color: var(--good); background: color-mix(in srgb, var(--good) 18%, var(--card)); box-shadow: 0 4px 0 var(--good); }
.solved li.right b { background: var(--good); color: #fff; }
.solved li.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 15%, var(--card)); box-shadow: 0 4px 0 var(--bad); animation: shake .4s ease; }
.solved li.wrong b { background: var(--bad); color: #fff; }
.why { margin-bottom: 12px; padding: 12px 14px; border: 2px solid var(--line); border-radius: 18px; background: var(--card); }
.why h2 { margin-bottom: 4px; color: var(--link); font-size: 1rem; }
.why p { margin: 0; }
.btn.next { margin-top: auto; }

/* ───── Résultat ───── */
.result { position: relative; }
.party .door-wall { border-radius: 24px; }
.party .window { max-width: 128px; }
.result.good .party .window { animation: light .8s ease both; }
.result.good .party .window + .window { animation-delay: .25s; }
.result h1 { font-size: 2rem; }
.result > .stars { gap: 8px; margin-bottom: 4px; }
.result > .stars svg { width: 58px; height: 58px; filter: drop-shadow(0 4px 0 rgb(150 90 0 / .35)); }
.result > .stars .on { animation: star .6s .5s ease both; }
.result > .stars .on:nth-child(2) { animation-delay: .75s; }
.result > .stars .on:nth-child(3) { animation-delay: 1s; }
.score { margin: 0 0 14px; font-size: 2.6rem; font-weight: 700; line-height: 1.2; }
.lost { display: flex; justify-content: center; gap: 10px; margin: 0 0 8px; color: color-mix(in srgb, var(--soft) 40%, transparent); }
.lost svg { width: 42px; height: 42px; }
.rewards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 14px; padding: 0; list-style: none; }
.rewards li { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; padding: 10px 4px; border: 2px solid var(--tint); border-radius: 18px; background: color-mix(in srgb, var(--tint) 16%, var(--card)); box-shadow: 0 4px 0 var(--tint); font-size: .95rem; animation: pop .45s ease both; }
.rewards .gain { --tint: #ffc02e; } .rewards .flame { --tint: #ff7a2f; animation-delay: .12s; } .rewards .rank { --tint: #12a0d8; animation-delay: .24s; }
.rewards strong { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.rewards span { color: var(--soft); font-size: .75rem; }
.actions { margin-bottom: 10px; }
.mistakes li { display: block; }
.mistakes li > span { display: block; }
.confetti { position: absolute; inset: 0 0 auto 0; z-index: 3; height: 0; pointer-events: none; }
.confetti i { position: absolute; top: 0; width: 10px; height: 16px; border-radius: 3px; background: var(--gold); opacity: 0; animation: fall 2s ease-in forwards; }
.confetti i:nth-child(4n) { background: #ff5d73; }
.confetti i:nth-child(4n+1) { background: #2aa8e8; }
.confetti i:nth-child(4n+2) { height: 10px; border-radius: 50%; background: #2fd679; }
.confetti i:nth-child(1) { left: 3%; } .confetti i:nth-child(2) { left: 9%; animation-delay: .25s; } .confetti i:nth-child(3) { left: 15%; animation-delay: .05s; }
.confetti i:nth-child(4) { left: 20%; animation-delay: .45s; } .confetti i:nth-child(5) { left: 26%; animation-delay: .15s; } .confetti i:nth-child(6) { left: 31%; animation-delay: .35s; }
.confetti i:nth-child(7) { left: 37%; } .confetti i:nth-child(8) { left: 43%; animation-delay: .3s; } .confetti i:nth-child(9) { left: 48%; animation-delay: .2s; }
.confetti i:nth-child(10) { left: 54%; animation-delay: .5s; } .confetti i:nth-child(11) { left: 60%; animation-delay: .05s; } .confetti i:nth-child(12) { left: 66%; animation-delay: .35s; }
.confetti i:nth-child(13) { left: 71%; animation-delay: .1s; } .confetti i:nth-child(14) { left: 77%; animation-delay: .22s; } .confetti i:nth-child(15) { left: 82%; animation-delay: .4s; }
.confetti i:nth-child(16) { left: 87%; } .confetti i:nth-child(17) { left: 92%; animation-delay: .28s; } .confetti i:nth-child(18) { left: 96%; animation-delay: .12s; }

/* ───── Administration ───── */
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.filters label { min-width: 0; }
.filters .btn { grid-column: 1 / -1; margin: 0; }
.arrows { display: flex; flex: none; gap: 6px; }
.list li:has(> .arrows) { flex-wrap: nowrap; }
.list li:has(> .arrows) > div:first-child { flex: 1; min-width: 0; }
.arrows .btn { min-width: 44px; }
.format { overflow-x: auto; padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px; background: var(--field); font: .85rem/1.6 ui-monospace, Consolas, monospace; white-space: pre; }
.errors-list { padding-left: 20px; }

@keyframes beat { 50% { transform: scale(1.18); } }
@keyframes popin { from { opacity: 0; transform: scale(.5) translateY(40px); } }
@keyframes spin { 50% { transform: rotateY(180deg) scale(1.15); } 100% { transform: rotateY(360deg); } }
@keyframes break { 0% { color: #ef3d5b; transform: scale(1); } 30% { transform: scale(1.5) rotate(-12deg); } 55% { transform: scale(1.2) rotate(14deg); } 100% { transform: scale(1); } }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes pulse { 50% { transform: scale(1.08); } }
@keyframes hop { 50% { transform: translateY(-6px); } }
@keyframes bob { 50% { transform: translateY(-5px); } }
@keyframes pop { 0% { opacity: 0; transform: scale(.5); } 70% { transform: scale(1.12); } }
@keyframes select { 50% { transform: scale(1.04); } }
@keyframes stamp { 0% { opacity: 0; transform: scale(2.2) rotate(-4deg); } 70% { transform: scale(.92) rotate(-4deg); } }
@keyframes star { 0% { opacity: 0; transform: scale(0) rotate(-180deg); } 70% { transform: scale(1.35) rotate(10deg); } }
@keyframes light { 0% { filter: brightness(.3); } 60% { transform: scale(1.08); filter: brightness(1.25); } }
@keyframes flip { from { opacity: 0; transform: perspective(600px) rotateX(-70deg); } }
@keyframes flicker { 50% { transform: scale(1.1) rotate(-4deg); } }
@keyframes glow { 50% { opacity: .55; } }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes wave { 50% { transform: rotate(13deg); } }
@keyframes dance { 25% { transform: rotate(-6deg); } 75% { transform: rotate(6deg); } }
@keyframes swim { 50% { transform: translateX(10px); } }
@keyframes twinkle { 50% { transform: scale(1.14); } }
@keyframes drift { to { transform: translateX(600px); } }
@keyframes fall { 0% { opacity: 1; transform: translateY(-20px) rotate(0); } 100% { opacity: 0; transform: translateY(480px) rotate(460deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } .confetti, .clouds { display: none; } }

/* Rejouer : le bouton reste à droite du titre. */
.tint-blue .list li { flex-wrap: nowrap; }
.tint-blue .list li > div:first-child { flex: 1; }
