/* ===== Jeux du Coran — parchemin, encre brune, vert émeraude, or ===== */
:root {
  --parch: #f1e2b5;
  --parch-hi: #f8eed0;
  --parch-lo: #e4cf96;
  --edge: #c9ad68;
  --ink: #3a2a14;
  --ink-soft: #6b5430;
  --green: #1d6b47;
  --green-hi: #258659;
  --green-deep: #0f3d2a;
  --gold: #b98a2d;
  --gold-hi: #dcb454;
  --good: #1d7a4a;
  --good-bg: #d7ecc9;
  --bad: #a43f2a;
  --bad-bg: #f2cfb6;
  --radius: 14px;
  --shadow: 0 1px 0 rgba(255,255,255,.55) inset, 0 8px 22px -10px rgba(58,42,20,.45), 0 2px 4px rgba(58,42,20,.12);
  --f-head: 'Alegreya', 'Georgia', serif;
  --f-ui: 'Alegreya Sans', 'Segoe UI', system-ui, sans-serif;
  --f-ar: 'Amiri Quran', 'Amiri', 'Scheherazade New', 'Traditional Arabic', serif;
  --f-brand: 'Aref Ruqaa', 'Amiri', serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font-family: var(--f-ui); font-size: 18px; line-height: 1.45; color: var(--ink);
  background-color: var(--parch);
  background-image:
    radial-gradient(ellipse at 50% 0%, rgba(255,250,225,.75), transparent 60%),
    radial-gradient(ellipse at 50% 120%, rgba(150,105,40,.35), transparent 55%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 .45  0 0 0 0 .32  0 0 0 0 .12  0 0 0 .22 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%23b98a2d' stroke-opacity='.16' stroke-width='1.2'%3E%3Crect x='36' y='36' width='48' height='48'/%3E%3Crect x='36' y='36' width='48' height='48' transform='rotate(45 60 60)'/%3E%3C/g%3E%3C/svg%3E");
  background-attachment: fixed;
  box-shadow: inset 0 0 160px rgba(120,80,20,.28);
}
body::before { /* bordure intérieure type manuscrit */
  content: ''; position: fixed; inset: 8px; pointer-events: none; z-index: 40;
  border: 2px solid rgba(185,138,45,.45); border-radius: 6px;
  box-shadow: 0 0 0 4px rgba(185,138,45,.12) inset;
}
h1, h2, h3 { font-family: var(--f-head); margin: 0; line-height: 1.15; }
a { color: var(--green); }
code { font-size: .9em; background: rgba(58,42,20,.08); padding: 1px 5px; border-radius: 4px; }
:focus-visible { outline: 3px solid var(--gold-hi); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.ar { font-family: var(--f-ar); direction: rtl; unicode-bidi: isolate; }

/* ---------- En-tête ---------- */
.site-header {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px; padding: 14px clamp(16px, 4vw, 36px);
  background: linear-gradient(var(--parch-hi), rgba(248,238,208,.88));
  border-bottom: 2px solid var(--edge);
  backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--green-deep); margin-right: auto; }
.brand svg { width: 34px; height: 34px; flex: none; }
.brand b { font-family: var(--f-head); font-size: 1.35rem; font-weight: 700; letter-spacing: .01em; }
.brand .ar { font-family: var(--f-brand); font-size: 1.25rem; color: var(--gold); }
.menu-btn {
  font: inherit; font-weight: 700; color: var(--green-deep); cursor: pointer;
  background: var(--parch-hi); border: 2px solid var(--edge); border-radius: 999px; padding: 6px 16px;
  transition: background .2s, transform .15s;
}
.menu-btn:hover { background: #fff6d9; transform: translateY(-1px); }
.drawer {
  position: fixed; inset: 0; z-index: 60; display: grid; justify-items: end;
  background: rgba(40,28,10,.45); animation: fade .2s ease;
}
.drawer nav {
  width: min(380px, 92vw); height: 100%; overflow: auto; padding: 22px 18px 30px;
  background: var(--parch-hi); border-left: 3px solid var(--gold);
  animation: slide .28s cubic-bezier(.2,.8,.2,1);
}
.drawer h2 { font-size: 1.4rem; margin-bottom: 12px; color: var(--green-deep); display: flex; justify-content: space-between; align-items: center; }
.drawer .close { font-size: 1.6rem; line-height: 1; background: none; border: 0; cursor: pointer; color: var(--ink); }
.drawer a.item {
  display: flex; gap: 12px; align-items: center; padding: 10px 12px; margin-bottom: 6px;
  text-decoration: none; color: var(--ink); border-radius: 10px; border: 1.5px solid transparent;
  font-weight: 600; transition: background .15s, border-color .15s, transform .15s;
}
.drawer a.item:hover, .drawer a.item[aria-current] { background: #fff4cf; border-color: var(--edge); transform: translateX(-3px); }
.drawer a.item span:first-child { font-size: 1.4rem; width: 34px; text-align: center; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }

main { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: clamp(18px, 4vw, 40px) clamp(14px, 4vw, 28px) 48px; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 700 1rem var(--f-ui); text-decoration: none; cursor: pointer;
  padding: 11px 22px; border-radius: 12px; color: var(--green-deep);
  background: var(--parch-hi); border: 2px solid var(--edge);
  box-shadow: 0 3px 0 var(--edge);
  transition: transform .12s, box-shadow .12s, background .2s, filter .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 5px 0 var(--edge); background: #fff6d9; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge); }
.btn.primary {
  color: #fffbe8; border-color: var(--green-deep);
  background: linear-gradient(var(--green-hi), var(--green));
  box-shadow: 0 4px 0 var(--green-deep), 0 10px 18px -8px rgba(15,61,42,.6);
}
.btn.primary:hover { filter: brightness(1.08); box-shadow: 0 6px 0 var(--green-deep), 0 14px 20px -8px rgba(15,61,42,.6); background: linear-gradient(var(--green-hi), var(--green)); }
.btn.primary:active { box-shadow: 0 1px 0 var(--green-deep); }
.btn.big { font-size: 1.2rem; padding: 14px 30px; width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; filter: grayscale(.4); }

/* ---------- Panneau « papier » ---------- */
.paper {
  position: relative; background: linear-gradient(var(--parch-hi), #f4e8c3);
  border: 2px solid var(--edge); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: clamp(18px, 3.5vw, 32px);
}
.paper::after { /* filet doré intérieur */
  content: ''; position: absolute; inset: 5px; border: 1px solid rgba(185,138,45,.4); border-radius: 10px; pointer-events: none;
}

/* ---------- Accueil ---------- */
.hero { text-align: center; padding: clamp(10px, 4vw, 40px) 0 clamp(22px, 4vw, 38px); position: relative; }
.hero-star { width: clamp(120px, 24vw, 190px); height: auto; margin: 0 auto 6px; display: block; }
.hero-star .s1 { animation: spin 40s linear infinite; transform-origin: 100px 100px; }
.hero-star .s2 { animation: spin 40s linear infinite reverse; transform-origin: 100px 100px; }
.hero-star .draw { stroke-dasharray: 700; stroke-dashoffset: 700; animation: draw 2.2s .1s ease-out forwards; }
.hero h1 {
  font-family: var(--f-brand); font-weight: 400; font-size: clamp(3rem, 11vw, 6rem); color: var(--green-deep);
  line-height: 1.1; direction: rtl;
  text-shadow: 0 2px 0 rgba(255,255,255,.55), 0 6px 16px rgba(185,138,45,.35);
  animation: ink 1.3s .5s cubic-bezier(.2,.7,.2,1) both;
}
.hero p { font-family: var(--f-head); font-style: italic; font-size: clamp(1.15rem, 3vw, 1.5rem); color: var(--ink-soft); max-width: 34ch; margin: 6px auto 0; animation: ink 1s 1s both; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes ink { from { opacity: 0; filter: blur(8px); letter-spacing: .08em; } }

.divider { display: flex; align-items: center; gap: 14px; color: var(--gold); margin: 0 auto 22px; max-width: 520px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 2px; background: linear-gradient(90deg, transparent, var(--gold)); }
.divider::after { transform: scaleX(-1); }
.divider span { font-size: 1.3rem; }

.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.tile {
  position: relative; display: grid; grid-template-columns: 62px 1fr; gap: 6px 16px; align-content: start;
  padding: 20px 20px 18px; text-decoration: none; color: var(--ink); overflow: hidden;
  background: linear-gradient(var(--parch-hi), #f3e6bd); border: 2px solid var(--edge); border-radius: var(--radius);
  box-shadow: var(--shadow); transition: transform .2s cubic-bezier(.2,.8,.2,1), box-shadow .2s, border-color .2s;
}
.tile::before { /* étoile en filigrane */
  content: ''; position: absolute; right: -34px; bottom: -34px; width: 120px; height: 120px; opacity: .13; transition: transform .6s, opacity .3s;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cg fill='none' stroke='%231d6b47' stroke-width='3'%3E%3Crect x='20' y='20' width='60' height='60'/%3E%3Crect x='20' y='20' width='60' height='60' transform='rotate(45 50 50)'/%3E%3C/g%3E%3C/svg%3E") center/contain no-repeat;
}
.tile:hover { transform: translateY(-5px) rotate(-.4deg); border-color: var(--green); box-shadow: 0 1px 0 rgba(255,255,255,.55) inset, 0 18px 26px -14px rgba(15,61,42,.55); }
.tile:hover::before { transform: rotate(90deg) scale(1.15); opacity: .25; }
.tile .ico {
  grid-row: span 2; width: 62px; height: 62px; display: grid; place-items: center; font-size: 1.9rem; border-radius: 16px;
  background: linear-gradient(var(--green-hi), var(--green-deep)); border: 2px solid var(--gold); box-shadow: 0 3px 0 rgba(0,0,0,.2), inset 0 0 12px rgba(0,0,0,.25);
  transition: transform .3s;
}
.tile:hover .ico { transform: rotate(-8deg) scale(1.08); }
.tile h3 { font-size: 1.3rem; color: var(--green-deep); align-self: end; }
.tile p { margin: 0; color: var(--ink-soft); font-size: 1rem; line-height: 1.35; grid-column: 2; }
.tile .meta { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: .92rem; }
.pill { font-weight: 700; padding: 2px 11px; border-radius: 999px; background: rgba(29,107,71,.12); color: var(--green-deep); border: 1px solid rgba(29,107,71,.35); }
.best { color: var(--gold); font-weight: 700; }
.best.none { color: var(--ink-soft); font-weight: 500; opacity: .75; }

/* ---------- Réglages ---------- */
.setup { max-width: 720px; margin: 0 auto; }
.setup-head { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.badge-icon { flex: none; width: 66px; height: 66px; display: grid; place-items: center; font-size: 2rem; border-radius: 18px; background: linear-gradient(var(--green-hi), var(--green-deep)); border: 2px solid var(--gold); }
.setup h1 { font-size: clamp(1.6rem, 5vw, 2.2rem); color: var(--green-deep); }
.setup-head p { margin: 4px 0 0; color: var(--ink-soft); }
.group { border: 0; border-top: 1.5px dashed var(--edge); margin: 0; padding: 16px 0 14px; min-width: 0; }
.group legend { font-family: var(--f-head); font-weight: 700; font-size: 1.15rem; padding-right: 10px; color: var(--green-deep); }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button {
  font: 700 1rem var(--f-ui); color: var(--ink); cursor: pointer; padding: 8px 16px; border-radius: 999px;
  background: var(--parch-hi); border: 2px solid var(--edge); transition: all .18s;
}
.seg button:hover { border-color: var(--green); }
.seg button[aria-checked="true"] { color: #fffbe8; background: var(--green); border-color: var(--green-deep); box-shadow: 0 2px 0 var(--green-deep); transform: translateY(-1px); }
.range-row { display: flex; flex-wrap: wrap; gap: 12px 18px; margin-top: 12px; animation: fade .25s; }
.range-row label { display: flex; align-items: center; gap: 8px; font-weight: 700; flex: 1 1 220px; }
select, input[type=number] {
  font: 600 1rem var(--f-ui); color: var(--ink); padding: 9px 10px; border-radius: 10px; min-width: 0; width: 100%;
  background: #fff9e3; border: 2px solid var(--edge);
}
select:focus, input[type=number]:focus { border-color: var(--green); outline: 3px solid rgba(29,107,71,.25); }
.range-info { margin: 10px 0 0; font-family: var(--f-head); font-style: italic; color: var(--ink-soft); }
.check { display: flex; align-items: center; gap: 10px; margin: 6px 0; cursor: pointer; font-weight: 600; }
.check input { width: 20px; height: 20px; accent-color: var(--green); }
.note { font-size: .95rem; color: var(--ink-soft); }
.note.center { text-align: center; margin: 10px 0 0; }
.error { background: var(--bad-bg); border: 2px solid var(--bad); color: #5d1e10; border-radius: 10px; padding: 10px 14px; margin: 8px 0 14px; }

/* ---------- Chargement ---------- */
.loading { max-width: 520px; margin: 8vh auto; text-align: center; }
.loading.err { text-align: left; }
.loading.err h2 { color: var(--bad); margin-bottom: 8px; }
.spinner { width: 54px; height: 54px; margin: 0 auto 14px; border-radius: 50%; border: 5px solid var(--parch-lo); border-top-color: var(--green); animation: spin 1s linear infinite; }
.bar { height: 10px; border-radius: 99px; background: var(--parch-lo); overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--green), var(--gold-hi)); transition: width .15s; }

/* ---------- Partie ---------- */
.view { max-width: 860px; margin: 0 auto; }
.hud { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center; padding: 12px 18px; margin-bottom: 18px; }
.hud-l { display: flex; flex-direction: column; line-height: 1.2; }
.qcount { font-family: var(--f-head); font-weight: 700; font-size: 1.15rem; color: var(--green-deep); }
.range-tag { font-size: .88rem; color: var(--ink-soft); }
.hud-r { display: flex; justify-content: flex-end; gap: 14px; align-items: center; font-weight: 600; }
.hud-r b { font-size: 1.3rem; color: var(--green-deep); }
.streak { color: var(--gold); animation: pop .4s; }
.dots { display: flex; gap: 6px; }
.dots i { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--edge); background: transparent; transition: all .3s; }
.dots i.cur { border-color: var(--green); background: rgba(29,107,71,.25); transform: scale(1.2); }
.dots i.ok { background: var(--good); border-color: var(--good); }
.dots i.ko { background: var(--bad); border-color: var(--bad); }
@keyframes pop { 50% { transform: scale(1.3); } }

.qcard.enter { animation: card .4s cubic-bezier(.2,.8,.2,1); }
@keyframes card { from { opacity: 0; transform: translateX(26px) rotate(.6deg); } }
.qcard.shake { animation: shake .45s; }
.qcard.flash-ok { animation: flash .6s; }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
@keyframes flash { 40% { box-shadow: 0 0 0 6px rgba(29,122,74,.35), var(--shadow); } }
.qtitle { font-size: clamp(1.3rem, 4vw, 1.75rem); color: var(--green-deep); text-align: center; margin-bottom: 16px; }

.surah-card {
  display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 0 auto 16px; max-width: 420px; padding: 12px 20px;
  background: linear-gradient(var(--green-hi), var(--green-deep)); color: #fff7d6; border: 2px solid var(--gold); border-radius: 14px; text-align: center;
}
.surah-card small { opacity: .85; }
.sname { display: flex; flex-direction: column; align-items: center; gap: 0; line-height: 1.2; }
.sname .ar { font-size: 1.7em; line-height: 1.5; }
.sname .lat { font-weight: 700; }
.sname .fr { font-size: .85em; opacity: .8; font-style: italic; }

.verse-box { position: relative; margin: 0 auto 18px; padding: 18px 18px 14px; background: #fffaea; border: 2px solid var(--edge); border-radius: 12px; text-align: center; box-shadow: inset 0 2px 8px rgba(185,138,45,.18); }
.verse-text .ar { display: block; font-size: clamp(1.6rem, 5vw, 2.3rem); line-height: 2.1; color: #22160a; }
.gap { display: inline-block; min-width: 3.4em; padding: 0 .5em; border-bottom: 3px dashed var(--gold); color: var(--gold); border-radius: 4px; transition: all .4s; }
.gap.filled { color: var(--good); border-bottom: 3px solid var(--good); background: rgba(29,122,74,.12); }
.hint-chip { display: inline-block; font-size: .9rem; font-weight: 700; padding: 2px 12px; margin-bottom: 4px; border-radius: 99px; background: rgba(185,138,45,.2); color: var(--ink-soft); }
.translation { margin: 4px auto 0; max-width: 60ch; font-family: var(--f-head); font-style: italic; color: var(--ink-soft); }
.audio-btn { font: 700 .95rem var(--f-ui); margin-top: 6px; cursor: pointer; padding: 5px 14px; border-radius: 99px; color: var(--green-deep); background: var(--parch-hi); border: 2px solid var(--edge); }
.audio-btn:hover { border-color: var(--green); }
.audio-btn.playing { background: var(--green); color: #fff; animation: pulse 1s infinite; }
.audio-btn:disabled { opacity: .6; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(29,107,71,.25); } }

/* QCM */
.options { display: grid; gap: 12px; }
.options.grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 640px) { .options.grid { grid-template-columns: 1fr; } }
.opt {
  position: relative; display: grid; grid-template-columns: 34px 1fr; gap: 4px 12px; align-items: center; text-align: left;
  font: inherit; color: var(--ink); cursor: pointer; padding: 12px 14px; border-radius: 12px;
  background: #fffaea; border: 2px solid var(--edge); box-shadow: 0 3px 0 var(--edge);
  transition: transform .14s, box-shadow .14s, background .2s, border-color .2s;
}
.opt:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--green); box-shadow: 0 5px 0 var(--green); background: #fff; }
.opt:disabled { cursor: default; }
.opt .key { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; font-weight: 800; font-size: .95rem; background: var(--parch-lo); color: var(--ink-soft); }
.opt-body { min-width: 0; }
.opt-body > .ar { display: block; font-size: 1.5rem; line-height: 1.95; text-align: right; }
.opt-ref { grid-column: 2; font-size: .85rem; color: var(--ink-soft); text-align: right; }
.opt-ref:empty { display: none; }
.opt .sname { align-items: flex-start; }
.opt .sname .ar { font-size: 1.5em; line-height: 1.6; }
.opt.right { background: var(--good-bg); border-color: var(--good); box-shadow: 0 3px 0 var(--good); animation: bump .45s; }
.opt.right .key { background: var(--good); color: #fff; }
.opt.wrong { background: var(--bad-bg); border-color: var(--bad); box-shadow: 0 3px 0 var(--bad); }
.opt.wrong .key { background: var(--bad); color: #fff; }
.opt:disabled:not(.right):not(.wrong) { opacity: .6; }
@keyframes bump { 40% { transform: scale(1.025); } }

/* Saisie */
.fields { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 22px; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; width: min(220px, 100%); text-align: center; }
.field input { font-size: 1.6rem; text-align: center; padding: 10px; }
.field input.right { background: var(--good-bg); border-color: var(--good); }
.field input.wrong { background: var(--bad-bg); border-color: var(--bad); }
.field input.empty { border-color: var(--bad); animation: shake .35s; }
.was { font-style: normal; color: var(--good); font-size: 1.2rem; }

/* Ordre */
.order-help { margin: 0 0 12px; text-align: center; color: var(--ink-soft); font-size: .98rem; }
.slots { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; counter-reset: s; }
.slot { counter-increment: s; position: relative; min-height: 54px; display: flex; align-items: center; gap: 12px; padding: 6px 12px 6px 48px; border-radius: 12px; border: 2px dashed var(--edge); background: rgba(255,250,234,.5); transition: all .2s; }
.slot::before { content: counter(s); position: absolute; left: 10px; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; font-weight: 800; background: var(--parch-lo); color: var(--ink-soft); }
.slot .ph { color: transparent; }
.slot.filled { border-style: solid; background: #fffaea; cursor: pointer; animation: bump .3s; }
.slot.filled:hover { border-color: var(--bad); }
.slot.filled::before { background: var(--green); color: #fff; }
.slot.right { background: var(--good-bg); border-color: var(--good); }
.slot.wrong { background: var(--bad-bg); border-color: var(--bad); }
.slot .chip-body { flex: 1; min-width: 0; }
.slot .chip-body > .ar { display: block; text-align: right; font-size: 1.35rem; line-height: 1.9; }
.pool { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.chip { font: inherit; color: var(--ink); cursor: pointer; padding: 8px 14px; border-radius: 12px; background: #fffaea; border: 2px solid var(--edge); box-shadow: 0 3px 0 var(--edge); transition: transform .14s, box-shadow .14s, border-color .2s; max-width: 100%; }
.chip:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--green); box-shadow: 0 5px 0 var(--green); }
.chip > .ar { display: block; text-align: right; font-size: 1.35rem; line-height: 1.9; }
.pool .chip:has(> .ar) { flex: 1 1 100%; }
.chip .sname, .slot .sname { align-items: flex-start; }
.chip .sname .ar, .slot .sname .ar { font-size: 1.4em; line-height: 1.5; }

/* Retour + actions */
.feedback { margin-top: 16px; padding: 12px 16px; border-radius: 12px; border: 2px solid; animation: card .35s; }
.feedback.good { background: var(--good-bg); border-color: var(--good); }
.feedback.bad { background: var(--bad-bg); border-color: var(--bad); }
.feedback strong { font-family: var(--f-head); font-size: 1.2rem; margin-right: 6px; }
.actions { display: flex; justify-content: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.actions .btn { min-width: 200px; }
.actions:has(#main-btn[hidden]) { margin-top: 0; }

/* ---------- Résultats ---------- */
.result { text-align: center; max-width: 720px; margin: 0 auto; }
.stars { display: flex; justify-content: center; gap: 10px; font-size: clamp(2.6rem, 10vw, 4rem); line-height: 1; }
.stars span { color: var(--parch-lo); text-shadow: 0 2px 0 var(--edge); }
.stars span.on { color: var(--gold-hi); text-shadow: 0 2px 0 var(--gold), 0 0 22px rgba(220,180,84,.7); animation: star .7s calc(var(--d) + .3s) both cubic-bezier(.3,1.6,.5,1); }
@keyframes star { from { transform: scale(0) rotate(-120deg); opacity: 0; } }
.big-score { font-family: var(--f-head); margin: 10px 0 4px; }
.big-score b { font-size: clamp(4rem, 16vw, 6.5rem); color: var(--green-deep); line-height: 1; }
.big-score span { font-size: 1.8rem; color: var(--ink-soft); margin-left: 8px; }
.msg { font-family: var(--f-head); font-size: 1.4rem; margin: 0; color: var(--green-deep); }
.sub { color: var(--ink-soft); margin: 4px 0 18px; }
.actions.row { margin: 0 0 22px; }
.actions.row .btn { min-width: 0; flex: 1 1 140px; }
.recap { text-align: left; border-top: 1.5px dashed var(--edge); padding-top: 14px; }
.recap summary { cursor: pointer; font-family: var(--f-head); font-weight: 700; font-size: 1.15rem; color: var(--green-deep); margin-bottom: 8px; }
.recap ol { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.recap li { display: flex; gap: 12px; padding: 10px 12px; border-radius: 10px; border: 1.5px solid; }
.recap li.ok { background: rgba(215,236,201,.6); border-color: rgba(29,122,74,.5); }
.recap li.ko { background: rgba(242,207,182,.6); border-color: rgba(164,63,42,.5); }
.recap .mark { font-weight: 800; font-size: 1.2rem; }
.recap li.ok .mark { color: var(--good); } .recap li.ko .mark { color: var(--bad); }
.r-body { min-width: 0; flex: 1; }
.r-q .ar { display: block; text-align: right; font-size: 1.3rem; line-height: 1.9; }
.r-a { font-size: .98rem; color: var(--ink-soft); }
.r-a .ar { font-size: 1.3rem; color: var(--ink); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 80; }

/* ---------- Pied de page ---------- */
.site-footer { text-align: center; padding: 18px 16px 26px; color: var(--ink-soft); font-size: .95rem; }
.site-footer .ar { font-family: var(--f-brand); color: var(--gold); font-size: 1.3rem; display: block; }

@media (max-width: 640px) {
  body { font-size: 17px; }
  body::before { inset: 4px; }
  .hud { grid-template-columns: 1fr auto; }
  .dots { grid-column: 1 / -1; grid-row: 2; justify-content: center; }
  .tile { grid-template-columns: 54px 1fr; }
  .tile .ico { width: 54px; height: 54px; }
  .brand b { display: none; }
  .opt { grid-template-columns: 28px 1fr; padding: 10px; }
  .actions .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .hero-star .draw { stroke-dashoffset: 0; }
}
