/* Aliénor en HG — moteur commun des quêtes 1.1.0 (CC BY-NC-SA 4.0)
   Feuille de style UNIQUE de toutes les quêtes : elle généralise celle du pilote
   « Le coffre des trois mondes ». Un auteur de contenu n'écrit jamais de CSS. */
:root {
  --paper: #f5efe3;
  --surface: #fffdf8;
  --surface-warm: #fbf5e9;
  --ink: #292923;
  --muted: #656155;
  --rose: #ad5875;
  --rose-deep: #7e3852;
  --sage: #75866b;
  --sage-soft: #dce4d5;
  --blue: #667f92;
  --blue-soft: #dfe8ed;
  --terracotta: #b85f3f;
  --leather: #63483a;
  --gold: #c2a35b;
  --gold-soft: #f2e6bd;
  --line: #d8d0c2;
  --success: #476a45;
  --danger: #8d3f42;
  --warn: #8a5a17;
  --shadow: 0 18px 50px rgb(61 45 35 / 12%);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 92px; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgb(173 88 117 / 9%), transparent 28rem),
    linear-gradient(rgb(255 255 255 / 18%) 1px, transparent 1px),
    var(--paper);
  background-size: auto, 100% 28px, auto;
  font-family: Inter, "Avenir Next", "Segoe UI", sans-serif;
  line-height: 1.6;
}

button, select, a, input { font: inherit; }
button, select { color: inherit; }
button:focus-visible, select:focus-visible, a:focus-visible, input:focus-visible, [tabindex="-1"]:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}
[tabindex="-1"]:focus { outline: none; }
[hidden] { display: none !important; }

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 14px; border-radius: 8px; color: white; background: var(--leather); font-weight: 800; text-decoration: none; }
.skip-link:focus { top: 10px; }

.quest-shell { min-height: 100vh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid rgb(99 72 58 / 20%);
  background: rgb(246 241 231 / 94%);
  backdrop-filter: blur(10px);
}
.topbar__inner {
  width: min(1160px, calc(100% - 32px));
  min-height: 68px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand { color: var(--leather); font-family: Georgia, Charter, serif; font-weight: 800; text-decoration: none; }
.brand span { color: var(--rose-deep); font-weight: 600; }
.topbar-link { color: var(--rose-deep); font-weight: 800; text-underline-offset: 4px; }
.progress-cluster { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .86rem; font-weight: 800; }
.fragment-dots { display: flex; gap: 2px; color: var(--gold); font-size: 1.1rem; line-height: 1; }
.fragment-dots .filled { color: var(--terracotta); }
.progress-track { width: min(23vw, 220px); height: 9px; overflow: hidden; border: 1px solid var(--line); border-radius: 999px; background: #e9e1d3; }
.progress-fill { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--rose), var(--terracotta)); transition: width .55s ease; }

.storage-warning, .noscript-warning {
  width: min(1160px, calc(100% - 32px));
  margin: 12px auto 0;
  padding: 10px 14px;
  border: 1px solid #d9b26a;
  border-radius: 10px;
  color: #5b3b06;
  background: #fbf0d3;
  font-size: .9rem;
  font-weight: 700;
}

main { width: min(1160px, calc(100% - 32px)); margin: auto; padding: 46px 0 80px; }
.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(330px, .95fr);
  align-items: center;
  gap: 30px;
  min-height: 610px;
  margin-bottom: 38px;
  padding: clamp(30px, 5vw, 66px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: linear-gradient(135deg, #fffdf8 0 58%, #ecdeda 58% 100%);
  box-shadow: var(--shadow);
}
.hero::after { content: ""; position: absolute; right: -150px; bottom: -210px; width: 460px; aspect-ratio: 1; border: 1px solid rgb(126 56 82 / 18%); border-radius: 50%; }
.hero__copy { position: relative; z-index: 2; }
.eyebrow { margin: 0 0 10px; color: var(--rose-deep); font-size: .78rem; font-weight: 900; letter-spacing: .13em; text-transform: uppercase; }
h1, h2, h3 { margin-top: 0; font-family: Georgia, Charter, serif; line-height: 1.14; }
h1 { max-width: 700px; margin-bottom: 18px; font-size: clamp(2.7rem, 6vw, 5.5rem); letter-spacing: -.05em; }
h2 { font-size: clamp(1.9rem, 4vw, 3rem); letter-spacing: -.025em; }
h3 { font-size: 1.25rem; }
.hero__lead { max-width: 62ch; margin: 0 0 24px; color: var(--muted); font-size: clamp(1rem, 1.7vw, 1.2rem); }
.mission-facts { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 28px; }
.mission-facts span { padding: 7px 11px; border-radius: 999px; background: var(--sage-soft); color: #3e5038; font-size: .82rem; font-weight: 850; }
.hero__visual { position: relative; z-index: 1; display: grid; min-height: 400px; place-items: center; }
.hero__visual::before { content: ""; position: absolute; width: min(96%, 440px); aspect-ratio: 1; border: 2px dashed rgb(99 72 58 / 22%); border-radius: 50%; animation: turn 26s linear infinite; }
.hero__visual img { position: relative; z-index: 1; width: min(118%, 550px); max-width: none; height: auto; filter: drop-shadow(0 25px 28px rgb(68 47 37 / 24%)); transform: rotate(-2deg); }
@keyframes turn { to { transform: rotate(360deg); } }

.primary-button {
  display: inline-flex;
  min-height: 49px;
  align-items: center;
  justify-content: center;
  padding: 12px 21px;
  border: 0;
  border-radius: 12px;
  color: white;
  background: var(--terracotta);
  box-shadow: 0 6px 0 #7f3d29;
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
}
.primary-button:hover { transform: translateY(-2px); box-shadow: 0 8px 0 #7f3d29; }
.primary-button:active { transform: translateY(4px); box-shadow: 0 2px 0 #7f3d29; }
.primary-button:disabled { cursor: default; opacity: .65; transform: none; box-shadow: 0 3px 0 #7f3d29; }
.primary-button.small { min-height: 40px; padding: 8px 15px; box-shadow: 0 4px 0 #7f3d29; }
.hint-button {
  display: inline-flex;
  min-height: 47px;
  align-items: center;
  padding: 10px 15px;
  border: 1px solid var(--leather);
  border-radius: 12px;
  color: var(--leather);
  background: transparent;
  font-weight: 780;
  text-decoration: none;
  cursor: pointer;
}
.hint-button:hover { background: #f3eadf; }
.hint-button:disabled { cursor: default; opacity: .6; background: transparent; }
.text-link { color: var(--rose-deep); font-weight: 850; text-underline-offset: 4px; }

.paper-note {
  width: min(900px, 92%);
  margin: -75px auto 72px;
  padding: 30px 36px;
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 28px;
  align-items: center;
  border: 1px solid #cdbda7;
  border-radius: 3px 18px 5px 16px;
  background: #fffaf0;
  box-shadow: 0 14px 30px rgb(67 50 38 / 15%);
  transform: rotate(-.6deg);
}
.paper-note--plain { grid-template-columns: 1fr; }
.paper-note::before { content: ""; position: absolute; inset: 8px; pointer-events: none; border: 1px dashed rgb(99 72 58 / 22%); }
.paper-note img { width: 100%; height: auto; transform: rotate(-8deg); }
.paper-note h2 { margin-bottom: 10px; font-size: clamp(1.6rem, 3vw, 2.3rem); }
.paper-note p { margin: 0 0 12px; }
.no-stress { color: var(--muted); font-size: .94rem; }
.chapter-separator { display: flex; align-items: center; gap: 14px; margin: 0 auto 42px; color: var(--rose); }
.chapter-separator::before, .chapter-separator::after { content: ""; height: 1px; flex: 1; background: var(--line); }

/* ---- Missions ---- */
.mission-card {
  --accent: var(--rose);
  position: relative;
  width: min(980px, 100%);
  margin: 0 auto 42px;
  padding: clamp(25px, 4.5vw, 48px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.mission-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 7px; background: var(--accent); }
.mission-card[data-tone="1"] { --accent: var(--blue); }
.mission-card[data-tone="2"] { --accent: var(--gold); }
.mission-card[data-tone="3"] { --accent: var(--sage); }
.mission-card[data-tone="4"] { --accent: var(--terracotta); }
.mission-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.mission-kicker { display: inline-flex; padding: 5px 10px; border-radius: 8px; color: white; background: var(--rose-deep); font-size: .76rem; font-weight: 900; letter-spacing: .05em; text-transform: uppercase; }
.mission-status { color: var(--muted); font-size: .8rem; font-weight: 850; }
.mission-card h2 { margin-bottom: 10px; }
.story { max-width: 72ch; margin: 0 0 12px; color: var(--muted); }
.mission-card.completed { border-color: #9fb098; }
.mission-card.completed::before { background: var(--success); }
.mission-card.completed .mission-status { color: var(--success); }

.locked { min-height: 260px; }
.locked .mission-content { filter: blur(5px); opacity: .2; pointer-events: none; user-select: none; }
.lock-screen { position: absolute; inset: 0; z-index: 5; display: grid; align-content: center; justify-items: center; padding: 30px; text-align: center; background: rgb(255 253 248 / 68%); backdrop-filter: blur(2px); }
.lock-screen span { font-size: 2.4rem; }
.lock-screen p { margin: 6px 0 0; color: var(--leather); font-weight: 850; }
.mission-card:not(.locked) .lock-screen { display: none; }

.activity { margin: 22px 0; }
.activity-prompt { margin: 0 0 10px; font-family: Georgia, serif; font-weight: 800; }
label { font-weight: 750; }

.match-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 15px; margin: 6px 0 4px; }
.clue-card, .voice-card, .monument-grid article {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-warm);
}
.clue-card { display: flex; flex-direction: column; }
.clue-card p { flex: 1; margin: 0 0 8px; color: var(--muted); font-size: .92rem; }
.card-symbol { display: grid; width: 43px; aspect-ratio: 1; margin-bottom: 13px; place-items: center; border-radius: 50%; background: var(--gold-soft); color: var(--leather); font-size: 1.4rem; }
.clue-card h3, .voice-card h3 { margin-bottom: 5px; }

.select-wrap { position: relative; margin-top: 8px; }
select {
  width: 100%;
  min-height: 46px;
  margin: 0;
  padding: 8px 38px 8px 10px;
  border: 1px solid #afa697;
  border-radius: 9px;
  background: white;
  font-weight: 620;
}
.select-wrap .mark { position: absolute; top: 50%; right: 34px; transform: translateY(-50%); font-weight: 900; pointer-events: none; }
.select-wrap[data-state="correct"] .mark { color: var(--success); }
.select-wrap[data-state="wrong"] .mark { color: var(--danger); }
select.correct { border: 2px solid var(--success); background: #eff6ed; }
select.wrong { border: 2px solid var(--danger); background: #fbefee; }
select:disabled { opacity: 1; color: var(--ink); }

.voice-stack { display: grid; gap: 13px; margin: 6px 0 4px; }
.voice-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(190px, 260px); align-items: center; gap: 25px; }
.voice-card blockquote { margin: 0; color: #403d35; font-family: Georgia, serif; font-size: 1.05rem; font-style: italic; }
.voice-card blockquote::before { content: "“"; color: var(--rose); font-size: 2rem; line-height: 0; }

.monument-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin: 22px 0; text-align: center; }
.monument-grid article { background: linear-gradient(#faf4e8, #f8efe0); }
.monument-grid article:nth-child(3n+2) { background: linear-gradient(#edf1f3, #e6edf0); }
.monument-grid article:nth-child(3n) { background: linear-gradient(#f0f2e9, #e5ebdd); }
.monument-grid h3 { margin-bottom: 8px; }
.monument-grid p { margin: 0; color: var(--muted); font-size: .91rem; }
.monument-icon { display: block; margin-bottom: 10px; color: var(--terracotta); font-size: 2.1rem; }
.doc-text { max-width: 72ch; margin: 14px 0; }
.doc-figure { margin: 22px 0; text-align: center; }
.doc-figure img { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 12px; }
.doc-figure figcaption { margin-top: 8px; color: var(--muted); font-size: .88rem; }
.doc-quote { margin: 22px 0; padding: 4px 0 4px 18px; border-left: 4px solid var(--rose); color: var(--leather); font-family: Georgia, serif; font-style: italic; }
.doc-quote p { margin: 0 0 4px; }
.doc-quote footer { color: var(--muted); font-family: Inter, sans-serif; font-size: .85rem; font-style: normal; }
.callout { display: flex; gap: 12px; align-items: center; margin: 20px 0; padding: 13px 16px; border-left: 4px solid var(--sage); background: var(--sage-soft); }
.callout span { font-size: 2rem; }
.callout p { margin: 0; font-size: .91rem; }

.choice-panel { display: grid; gap: 10px; margin: 22px 0; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.choice-panel legend { padding: 0 7px; font-family: Georgia, serif; font-weight: 800; }
.choice-panel legend.sr-only { padding: 0; }
.choice-panel label { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 9px; background: #f7f3eb; cursor: pointer; }
.choice-panel input { margin-top: 5px; accent-color: var(--rose-deep); }
.choice-panel input:disabled + span { color: var(--muted); }

.contact-list { display: grid; gap: 10px; margin: 6px 0 4px; }
.row-item { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 16px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-warm); font-weight: 650; }
.row-item .select-wrap { margin: 0; }

.timeline-list { display: grid; gap: 10px; max-width: 740px; margin: 14px auto; padding: 0; list-style: none; counter-reset: steps; }
.timeline-list li { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 66px; padding: 12px 14px 12px 19px; border: 1px solid var(--line); border-left: 6px solid var(--gold); border-radius: 12px; background: var(--surface-warm); box-shadow: 0 4px 10px rgb(69 49 38 / 7%); }
.timeline-list li::before { counter-increment: steps; content: counter(steps); display: grid; flex: 0 0 30px; aspect-ratio: 1; place-items: center; border-radius: 50%; color: white; background: var(--rose-deep); font-weight: 900; }
.order-text { flex: 1; }
.move-buttons { display: flex; gap: 5px; }
.move-buttons button { width: 40px; height: 40px; border: 1px solid var(--leather); border-radius: 8px; color: var(--leather); background: white; font-size: 1.2rem; font-weight: 900; cursor: pointer; }
.move-buttons button:hover:not(:disabled) { background: #eee4d7; }
.move-buttons button:disabled { opacity: .35; cursor: default; }

.mission-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 22px; }
.hints:empty { display: none; }
.hint { margin-top: 12px; padding: 13px 16px; border-left: 4px solid var(--gold); background: #faf0ce; color: #554729; }
.hints { margin-top: 6px; }
.feedback { min-height: 30px; margin: 17px 0 0; color: var(--danger); font-weight: 800; }
.feedback[data-outcome="empty"] { color: var(--warn); }
.feedback[data-outcome="info"] { color: var(--muted); font-weight: 650; }
.feedback.success { color: var(--success); }
.knowledge-reveal { display: grid; grid-template-columns: minmax(180px, .35fr) 1fr; gap: 18px; align-items: center; margin-top: 17px; padding: 16px 18px; border: 1px solid #9fb098; border-radius: 13px; background: #f0f6ed; color: #395139; }
.knowledge-reveal strong { font-family: Georgia, serif; font-size: 1.05rem; }

/* ---- Victoire ---- */
.victory {
  position: relative;
  width: min(1040px, 100%);
  margin: 70px auto 42px;
  padding: clamp(30px, 5vw, 62px);
  overflow: hidden;
  border: 2px solid var(--gold);
  border-radius: 28px;
  background: radial-gradient(circle at 15% 20%, #fff6d6, transparent 26rem), linear-gradient(135deg, #fffdf8, #f1dfd6);
  box-shadow: 0 25px 80px rgb(102 71 40 / 20%);
}
.victory::before { content: "✦  ✧  ✦"; position: absolute; right: 28px; top: 22px; color: var(--gold); font-size: 1.4rem; letter-spacing: .3em; }
.victory h2 { max-width: 750px; margin-bottom: 12px; font-size: clamp(2.2rem, 5vw, 4.2rem); }
.victory-secret { max-width: 78ch; padding-left: 17px; border-left: 4px solid var(--rose); color: var(--leather); font-family: Georgia, serif; font-size: clamp(1.05rem, 2vw, 1.3rem); font-style: italic; }
.victory-grid { display: grid; grid-template-columns: minmax(260px, .85fr) 1.15fr; gap: 38px; align-items: center; margin-top: 34px; }
.badge-stage { position: relative; display: grid; place-items: center; min-height: 330px; }
.badge-stage::before { content: ""; position: absolute; width: 83%; aspect-ratio: 1; border: 2px dashed rgb(184 95 63 / 30%); border-radius: 50%; animation: turn 28s linear infinite reverse; }
.badge-stage img { position: relative; z-index: 1; width: min(100%, 355px); height: auto; filter: drop-shadow(0 16px 18px rgb(72 49 36 / 25%)); }
.victory-copy h3 { margin-bottom: 8px; font-size: 1.7rem; }
.victory-copy > p { color: var(--muted); }
.victory-actions { display: flex; flex-wrap: wrap; gap: 13px; margin: 21px 0; }
.rank-unlocked { display: flex; align-items: center; gap: 15px; margin-top: 25px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: rgb(255 253 248 / 80%); }
.rank-unlocked img { width: 72px; height: 72px; object-fit: contain; }
.rank-unlocked p { margin: 0; font-size: .91rem; }

.memory-card { width: min(900px, 100%); margin: 45px auto; padding: 28px 34px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.memory-card h2 { margin-bottom: 20px; font-size: 2rem; }
.memory-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.memory-grid p { display: grid; margin: 0; padding: 16px; border-radius: 12px; background: var(--surface-warm); }
.memory-grid strong { color: var(--rose-deep); font-family: Georgia, serif; font-size: 1.1rem; }
.memory-grid span { color: var(--muted); font-size: .88rem; }

.quest-footer { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding-top: 25px; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }
.quest-footer p { margin: 0; }
.quest-footer a { color: var(--rose-deep); text-underline-offset: 3px; }
.quest-footer .credits { flex-basis: 100%; order: 3; font-size: .8rem; }
.reset-zone { text-align: right; }
.reset-button { border: 0; color: var(--rose-deep); background: transparent; font-weight: 800; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.reset-confirm { max-width: 340px; margin-top: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-align: left; }
.reset-confirm p { margin: 0 0 10px; color: var(--ink); font-weight: 700; }

.reprise-zone { flex-basis: 100%; order: 4; margin-top: 10px; padding-top: 18px; border-top: 1px dashed var(--line); text-align: left; }
.reprise-intro { margin: 0 0 10px; }
.reprise-panel { max-width: 420px; margin: 12px 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.reprise-panel p { margin: 0 0 10px; }
.reprise-code { display: block; margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: #fff; border: 1px dashed var(--leather); color: var(--ink); font-size: 1.1rem; font-weight: 800; letter-spacing: .04em; word-break: break-all; user-select: all; text-align: center; }
.reprise-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.reprise-note { margin: 0 0 4px; font-size: .85rem; color: var(--muted); }
.reprise-import { margin-top: 14px; }
.reprise-import label, .reprise-identite p { display: block; margin-bottom: 6px; font-weight: 700; color: var(--ink); }
.reprise-import-row { display: flex; gap: 8px; flex-wrap: wrap; }
.reprise-import-row input { flex: 1 1 220px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; letter-spacing: .03em; }
.reprise-identite { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.reprise-identite-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.reprise-identite-row label { flex: 1 1 140px; font-size: .85rem; font-weight: 700; color: var(--ink); }
.reprise-identite-row input, .reprise-identite-row select { display: block; width: 100%; margin-top: 4px; min-height: 42px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; font: inherit; }
/* Code de classe (2026-10-06, « session prof ») : flex-basis 100% pour que
   l'aide tienne sur sa propre ligne, entre le champ et le niveau en
   dessous, sans perturber la ligne flex existante (prénom / niveau /
   complément). */
.reprise-codeclasse-hint { flex-basis: 100%; margin: 0 0 4px; font-size: .8rem; font-weight: 400; color: var(--muted); }

.toast { position: fixed; z-index: 60; left: 50%; bottom: 25px; max-width: calc(100% - 30px); padding: 12px 18px; border-radius: 12px; color: white; background: var(--leather); box-shadow: 0 12px 30px rgb(0 0 0 / 25%); font-weight: 800; transform: translateX(-50%); }
.confetti-layer { position: fixed; inset: 0; z-index: 50; overflow: hidden; pointer-events: none; }
.confetti-piece { position: absolute; top: -25px; width: 12px; height: 18px; border-radius: 2px; animation: fall 2.7s ease-in forwards; }
@keyframes fall { to { transform: translate3d(var(--drift), 110vh, 0) rotate(720deg); opacity: .1; } }

.preview-banner { position: fixed; z-index: 90; left: 0; right: 0; bottom: 0; padding: 8px 14px; color: #3d2a05; background: #f3d98a; border-top: 2px solid #b38a1a; font-size: .85rem; text-align: center; }
body:has(.preview-banner) .toast { bottom: 62px; }

/* ---- Guide enseignant ---- */
.guide-page { max-width: 860px; padding-top: 34px; }
.guide h1 { font-size: clamp(2rem, 4vw, 3rem); }
.guide-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 24px; }
.guide-content { padding: clamp(18px, 3vw, 34px); border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.guide-content h2 { margin-top: 1.6em; font-size: 1.6rem; }
.guide-content h3 { margin-top: 1.3em; }
.guide-content table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: .92rem; }
.guide-content th, .guide-content td { padding: 8px 10px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.guide-content th { background: var(--surface-warm); }
.guide-content blockquote { margin: 14px 0; padding: 4px 16px; border-left: 4px solid var(--gold); color: var(--leather); }
.guide-content code { padding: 1px 5px; border-radius: 4px; background: #f0e9dc; font-size: .9em; }
.guide-content pre { overflow: auto; padding: 12px; border-radius: 8px; background: #f0e9dc; }
.guide-content a { color: var(--rose-deep); }
.guide-note { color: var(--muted); font-size: .85rem; }

/* ---- Souvenir : invisible à l'écran, seul élément imprimé ---- */
.souvenir { display: none; }

@media (max-width: 820px) {
  html { scroll-padding-top: 125px; }
  .topbar__inner { align-items: flex-start; padding: 11px 0; flex-direction: column; gap: 6px; }
  .progress-cluster { width: 100%; }
  .progress-track { flex: 1; }
  main { padding-top: 24px; }
  .hero { min-height: 0; grid-template-columns: 1fr; gap: 14px; }
  .hero__visual { min-height: 290px; }
  .hero__visual::before { width: 290px; }
  .hero__visual img { width: min(110%, 430px); }
  .paper-note { margin-top: -45px; grid-template-columns: 75px 1fr; }
  .match-grid, .monument-grid { grid-template-columns: 1fr; }
  .voice-card { grid-template-columns: 1fr; gap: 10px; }
  .row-item { grid-template-columns: 1fr; gap: 6px; }
  .victory-grid { grid-template-columns: 1fr; gap: 10px; }
  .memory-grid { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
  main, .topbar__inner { width: min(100% - 20px, 1160px); }
  .fragment-dots { display: none; }
  .hero { padding: 26px 21px; border-radius: 20px; }
  h1 { font-size: 2.65rem; }
  .paper-note { width: 95%; padding: 24px 22px; grid-template-columns: 1fr; }
  .paper-note img { width: 64px; }
  .mission-card { padding: 25px 20px; border-radius: 18px; }
  .mission-heading { align-items: flex-start; flex-direction: column; gap: 7px; }
  .knowledge-reveal { grid-template-columns: 1fr; gap: 5px; }
  .timeline-list li { align-items: flex-start; flex-wrap: wrap; }
  .move-buttons { margin-left: auto; }
  .quest-footer { flex-direction: column; }
  .reset-zone { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

/* ---- Impression ---- */
@page { size: A4 portrait; margin: 12mm; }
@media print {
  body { background: white; color: #222; font-size: 11pt; line-height: 1.4; }
  body:not(.guide-body) > *:not(.souvenir) { display: none !important; }
  body:not(.guide-body) > .souvenir { display: block !important; }
  .souvenir { page-break-inside: avoid; break-inside: avoid; }
  .souvenir__frame { display: flex; flex-direction: column; align-items: center; gap: 3.5mm; padding: 9mm 11mm; border: 1.2mm double #8a6c3b; text-align: center; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .souvenir__brand { margin: 0; color: #7e3852; font-size: 9.5pt; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
  .souvenir h2 { margin: 0; font-size: 24pt; letter-spacing: -.02em; }
  .souvenir h3 { margin: 2mm 0 0; font-size: 12pt; }
  .souvenir__quest { margin: 0; color: #555; font-size: 10.5pt; }
  .souvenir__badge img { display: block; width: auto; max-width: 62mm; max-height: 58mm; height: auto; margin: 0 auto; }
  .souvenir__secret { max-width: 150mm; margin: 0; padding: 0 0 0 4mm; border-left: .8mm solid #ad5875; color: #4b3629; font-family: Georgia, serif; font-size: 11.5pt; font-style: italic; text-align: left; }
  .souvenir__items { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.6mm 2.4mm; margin: 0; padding: 0; list-style: none; }
  .souvenir__items li { padding: .8mm 3mm; border: .3mm solid #c2a35b; border-radius: 4mm; background: #f8eecb; font-size: 9.5pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .souvenir__memo { width: 100%; text-align: left; }
  .souvenir__memo h3 { text-align: center; }
  .souvenir__memo p { margin: 1mm 0; font-size: 10pt; }
  .souvenir__foot { margin: 2mm 0 0; color: #777; font-size: 8.5pt; }
  .guide-body .topbar, .guide-body .guide-actions, .guide-body .preview-banner, .guide-body .skip-link { display: none !important; }
  .guide-page { max-width: none; padding: 0; width: 100%; }
  .guide-content { border: 0; padding: 0; }
}
