/* ==========================================================================
   Le Trésor des Roure — Claude Design Candidate
   Un carnet de quête numérique : brun sombre, ivoire, or mat.
   Aucune ressource externe. Polices système uniquement.
   ========================================================================== */

:root {
  /* Palette */
  --bg: #100f0c;
  --bg-2: #171410;
  --paper: #1c1813;          /* fond des cartes */
  --paper-2: #221d16;        /* surfaces pressées / champs */
  --ink: #f2ebdb;            /* ivoire */
  --ink-soft: #d9d0bd;
  --muted: #a89e88;
  --gold: #cdb26b;           /* or mat */
  --gold-deep: #9c8140;
  --gold-ink: #1a150d;       /* texte sur bouton or */
  --line: rgba(205, 178, 107, .2);
  --line-strong: rgba(205, 178, 107, .42);
  --wine: #7a4a44;           /* seule couleur secondaire, très discrète */

  /* Typographie : serif système raffinée, sans-serif système lisible */
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Charter, "Noto Serif", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;

  --font-scale: 1;
  --radius: 14px;
  --radius-s: 10px;
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, .55);

  /* Durées */
  --t-fast: 120ms;
  --t-screen: 200ms;
  --t-quarter: 1000ms;

  font-family: var(--sans);
  color-scheme: dark;
}
:root[data-font-scale="large"]  { --font-scale: 1.12; }
:root[data-font-scale="xlarge"] { --font-scale: 1.25; }

* { box-sizing: border-box; }
html {
  background: var(--bg);
  font-size: calc(16px * var(--font-scale));
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  line-height: 1.5;
  background:
    radial-gradient(60rem 30rem at 50% -14rem, rgba(205, 178, 107, .07), transparent 70%),
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 60%);
  -webkit-font-smoothing: antialiased;
}
button, select { font: inherit; }
button { color: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
img { max-width: 100%; }
b { font-weight: 650; }

.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 100; background: var(--ink); color: var(--gold-ink); padding: .7rem 1rem; border-radius: .5rem; }
.skip-link:focus { top: 1rem; }

/* --------------------------------------------------------------------------
   Coquille
   -------------------------------------------------------------------------- */
.app-shell { min-height: 100vh; padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: 1fr auto auto; gap: .75rem; align-items: center;
  padding: calc(.5rem + env(safe-area-inset-top)) max(.9rem, env(safe-area-inset-right)) .5rem max(.9rem, env(safe-area-inset-left));
  background: rgba(16, 15, 12, .92);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand-button {
  display: flex; gap: .6rem; align-items: center; min-width: 0;
  background: none; border: 0; padding: 0; text-align: left; min-height: 44px; cursor: pointer;
}
.brand-mark {
  flex: none; display: grid; place-items: center; width: 30px; height: 30px;
  border: 1px solid var(--gold-deep); border-radius: 50%;
  color: var(--gold); font-family: var(--serif); font-size: .95rem; line-height: 1;
}
.brand-text { min-width: 0; }
.brand-text b { display: block; font-family: var(--serif); font-weight: 600; font-size: min(.95rem, 4.6vw); letter-spacing: .005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { display: block; color: var(--muted); font-size: .68rem; letter-spacing: .04em; margin-top: .05rem; }

.progress { display: grid; justify-items: end; gap: .2rem; padding-right: .15rem; }
.progress b { font-family: var(--serif); font-weight: 500; font-size: 1.05rem; line-height: 1; color: var(--gold); letter-spacing: .02em; }
.progress b span { color: var(--muted); font-size: .8rem; }
.progress-dots { display: inline-flex; gap: 4px; }
.progress-dots i { width: 5px; height: 5px; border-radius: 50%; border: 1px solid var(--gold-deep); background: transparent; transition: background var(--t-fast) ease; }
.progress-dots i.on { background: var(--gold); border-color: var(--gold); }

.icon-button {
  display: grid; place-items: center; width: 42px; height: 42px;
  border: 1px solid var(--line); border-radius: var(--radius-s); background: transparent;
  color: var(--ink-soft); cursor: pointer; transition: background var(--t-fast) ease, color var(--t-fast) ease;
}
.icon-button:active { background: var(--paper-2); color: var(--gold); }

.screen { width: min(600px, 100%); margin: 0 auto; padding: clamp(.9rem, 3.5vw, 1.5rem); }
.screen.has-debug { padding-bottom: 3rem; }
@media (min-width: 700px) { .screen { padding-top: 2rem; } }

/* --------------------------------------------------------------------------
   La carte : une page du carnet. Une seule par écran.
   -------------------------------------------------------------------------- */
.card {
  position: relative;
  background: linear-gradient(180deg, #1e1a14 0%, var(--paper) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 4.5vw, 1.9rem);
  box-shadow: var(--shadow);
  animation: screen-in var(--t-screen) ease-out both;
}
.card::before { /* filet or en tête, comme le bord doré d'une page */
  content: ""; position: absolute; left: 12%; right: 12%; top: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
}
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
@keyframes screen-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Alignement : les moments de célébration sont centrés, la lecture est à gauche. */
.card--home, .card--hunt, .card--reveal, .card--transition, .card--mystery,
.card--sleep, .card--feedback, .card--seal, .card--reward, .card--recovery { text-align: center; }
.card--home .copy, .card--feedback .lead, .card--mystery .copy, .card--seal .copy, .card--sleep .copy, .card--hunt .lead { max-width: 30rem; margin-left: auto; margin-right: auto; }
.card--home { margin-top: clamp(.5rem, 4vh, 2.5rem); }

/* --------------------------------------------------------------------------
   Typographie
   -------------------------------------------------------------------------- */
h1, h2, .display, .next-room, .room-name, .count { font-family: var(--serif); font-weight: 500; letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 6.2vw, 2.3rem); line-height: 1.15; margin: .35rem 0 .75rem; text-wrap: balance; }
h1.display { font-size: clamp(2rem, 8vw, 2.8rem); line-height: 1.08; margin-bottom: .55rem; }
h1.question { font-size: clamp(1.4rem, 5.4vw, 1.9rem); line-height: 1.28; margin: .4rem 0 1.1rem; }
h2 { font-size: 1.5rem; margin: 0; }

.eyebrow {
  margin: 0 0 .55rem; color: var(--gold);
  font-size: .68rem; font-weight: 600; letter-spacing: .17em; text-transform: uppercase;
}
.eyebrow--lord { display: inline-flex; align-items: center; gap: .45rem; }
.eyebrow--lord span { color: var(--muted); letter-spacing: .1em; font-weight: 500; }
.eyebrow--lord svg { color: var(--gold-deep); }

.lead { font-size: 1.06rem; line-height: 1.5; color: var(--ink-soft); margin: .4rem 0 .9rem; }
.copy { line-height: 1.6; color: var(--ink-soft); margin: .6rem 0; }
.copy--ask { font-family: var(--serif); font-size: 1.35rem; color: var(--gold); margin: .9rem 0; }
.copy--strong { color: var(--ink); font-weight: 600; }
.quiet-note { color: var(--muted); font-size: .86rem; line-height: 1.45; margin: .85rem 0 0; }
.room-name { color: var(--gold); font-size: 1.15rem; margin: 0; }
.next-room { color: var(--gold); font-size: clamp(1.7rem, 6.5vw, 2.1rem); line-height: 1.15; margin: .6rem 0 1.4rem; text-wrap: balance; }
.count { font-size: 2rem; color: var(--muted); line-height: 1; margin: .2rem 0 .9rem; }
.count b { font-weight: 500; color: var(--gold); font-size: 2.4rem; }

/* --------------------------------------------------------------------------
   Boutons : or mat plein, filet or, texte souligné. 100/150 ms.
   -------------------------------------------------------------------------- */
.primary-button, .secondary-button, .danger-button, .text-button, .micro-link {
  width: 100%; min-height: 50px; border-radius: 12px; border: 1px solid transparent;
  padding: .8rem 1rem; cursor: pointer;
  transition: background var(--t-fast) ease, border-color var(--t-fast) ease, color var(--t-fast) ease, transform var(--t-fast) ease;
}
.primary-button { background: var(--gold); color: var(--gold-ink); font-weight: 700; letter-spacing: .01em; margin-top: 1rem; }
.primary-button:active { background: #b99d59; transform: scale(.985); }
.secondary-button { background: transparent; border-color: var(--line-strong); color: var(--ink); font-weight: 600; }
.secondary-button:active { background: var(--paper-2); }
.secondary-button span { display: block; color: var(--muted); font-size: .7rem; font-weight: 500; letter-spacing: .06em; margin-top: .08rem; }
.danger-button { background: transparent; border-color: var(--wine); color: #d9b3ad; }
.danger-button:active { background: #221514; }
.text-button, .micro-link { background: transparent; color: var(--gold); text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--gold-deep); }
.text-button { min-height: 44px; margin-top: .25rem; }
.micro-link { font-size: .82rem; min-height: 42px; color: var(--muted); text-decoration-color: rgba(168, 158, 136, .5); }
button:focus-visible, select:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* --------------------------------------------------------------------------
   Accueil
   -------------------------------------------------------------------------- */
.promise { display: flex; justify-content: center; align-items: center; gap: .7rem; margin: .9rem 0 1rem; font-family: var(--serif); font-size: .98rem; color: var(--gold); }
.promise b { font-weight: 500; }
.promise i { width: 3px; height: 3px; border-radius: 50%; background: var(--gold-deep); }
.card--home .quiet-note { margin-top: .8rem; }
.loader { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--gold); margin: .4rem auto 1.2rem; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.ready-list { list-style: none; padding: 0; margin: .6rem 0; color: var(--muted); line-height: 2; display: grid; justify-items: center; }
.ready-list li { display: inline-flex; align-items: center; gap: .5rem; }
.ready-list svg { color: var(--gold-deep); }

/* --------------------------------------------------------------------------
   Recherche d'une marque
   -------------------------------------------------------------------------- */
.card--hunt .eyebrow { margin-bottom: .2rem; }
.seal {
  display: grid; place-items: center; width: 44px; height: 44px; margin: 1rem auto .5rem;
  border: 1px solid var(--gold-deep); border-radius: 50%;
  font-family: var(--serif); font-size: 1.25rem; color: var(--gold); line-height: 1;
  box-shadow: 0 0 0 4px rgba(205, 178, 107, .06);
}
.phone-down { margin: .9rem auto 1.1rem; font-family: var(--serif); font-style: italic; font-size: 1.05rem; color: var(--gold); }
.hint-zone { display: grid; gap: .55rem; margin-top: .4rem; text-align: left; }
.hint { position: relative; padding: .35rem 0 .35rem 1rem; }
.hint::before { content: ""; position: absolute; left: 0; top: .2rem; bottom: .2rem; width: 2px; background: linear-gradient(180deg, var(--gold), transparent); }
.hint b { display: block; color: var(--gold); font-size: .68rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.hint p { margin: .3rem 0 0; line-height: 1.5; color: var(--ink-soft); }
.hint--2 p { color: var(--ink); }

/* --------------------------------------------------------------------------
   QCM : des cartes tactiles, compactes, lettrées.
   -------------------------------------------------------------------------- */
.choice-list { display: grid; gap: .55rem; margin-top: .25rem; }
.choice-button {
  display: grid; grid-template-columns: 30px 1fr; align-items: center; gap: .8rem;
  width: 100%; min-height: 56px; padding: .75rem .9rem; text-align: left;
  background: rgba(255, 255, 255, .02); border: 1px solid var(--line); border-radius: 12px;
  color: var(--ink); cursor: pointer;
  transition: background var(--t-fast) ease, border-color var(--t-fast) ease, transform var(--t-fast) ease;
}
.choice-button span {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--gold-deep); color: var(--gold);
  font-family: var(--serif); font-size: .92rem; line-height: 1;
  transition: background var(--t-fast) ease, color var(--t-fast) ease;
}
.choice-button em { font-style: normal; font-weight: 550; line-height: 1.35; }
.choice-button:active { background: rgba(205, 178, 107, .1); border-color: var(--gold); transform: scale(.99); }
.choice-button:active span { background: var(--gold); color: var(--gold-ink); }
.card--question .quiet-note { margin: -.4rem 0 .9rem; }
.card--lord { border-color: var(--line-strong); }

/* --------------------------------------------------------------------------
   Blason : l'élément graphique principal.
   -------------------------------------------------------------------------- */
.blason { margin: .9rem auto 1.1rem; width: min(280px, 72vw, 33vh); } /* 33vh ≈ 40 % de hauteur d'écran */
.blason--large { width: min(300px, 76vw, 37vh); }
.blason--mini { width: min(150px, 36vw, 20vh); margin: .2rem auto 1.1rem; }
.blason-shield {
  position: relative; width: 100%; aspect-ratio: 836 / 1000; margin: 0 auto;
  clip-path: polygon(0 0, 100% 0, 100% 73%, 92% 88%, 66% 97%, 50% 100%, 34% 97%, 8% 88%, 0 73%);
}
.blason-shield img { width: 100%; height: 100%; display: block; }
.blason-mask-grid { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: 46.3% 53.7%; pointer-events: none; }
.blason-mask {
  position: relative; overflow: hidden;
  background:
    repeating-linear-gradient(135deg, rgba(205, 178, 107, .045) 0 1px, transparent 1px 7px),
    linear-gradient(160deg, #262119, #16130f);
  box-shadow: inset 0 0 0 1px rgba(205, 178, 107, .16);
  transition: opacity .4s ease;
}
.blason-mask.unlocked { opacity: 0; }
/* Le quartier qui vient d'être gagné : un reflet doré le traverse, puis il s'efface. */
.blason-mask.new { animation: reveal-quarter var(--t-quarter) cubic-bezier(.4, 0, .2, 1) .15s forwards; }
.blason-mask.new::after {
  content: ""; position: absolute; inset: -40% -60%;
  background: linear-gradient(105deg, transparent 38%, rgba(205, 178, 107, .55) 50%, transparent 62%);
  animation: sheen var(--t-quarter) ease-in-out .15s forwards;
}
@keyframes reveal-quarter { 0%, 45% { opacity: 1; } 100% { opacity: 0; } }
@keyframes sheen { from { transform: translateX(-70%); } to { transform: translateX(70%); } }
.blason { filter: drop-shadow(0 14px 22px rgba(0, 0, 0, .35)); }
.blason.is-complete { filter: drop-shadow(0 0 28px rgba(205, 178, 107, .18)) drop-shadow(0 14px 22px rgba(0, 0, 0, .35)); }
.card--seal .blason.is-complete { animation: blason-appear 1.4s ease-out both; }
@keyframes blason-appear { from { opacity: 0; transform: scale(.96); filter: drop-shadow(0 0 0 rgba(205, 178, 107, 0)); } to { opacity: 1; transform: none; } }
.blason.is-mystery { filter: none; opacity: .9; }
.blason.is-mystery .blason-mask { box-shadow: inset 0 0 0 1px rgba(205, 178, 107, .22); }

.card--mystery .blason { width: min(250px, 64vw, 28vh); margin-bottom: .6rem; }
.card--mystery .copy { margin: .45rem auto; }
.card--reveal .eyebrow { margin-bottom: .3rem; }
.card--reveal .quiet-note { margin-top: 0; }

/* --------------------------------------------------------------------------
   Fil de l'histoire : éditorial, un fil de soie doré.
   -------------------------------------------------------------------------- */
.thread {
  position: relative; margin: 1.1rem 0 1.4rem; padding: .15rem 0 .15rem 1.15rem;
  font-family: var(--serif); font-size: 1.12rem; line-height: 1.65; color: var(--ink);
}
.thread::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 1.5px; background: linear-gradient(180deg, var(--gold) 0%, var(--gold-deep) 60%, transparent 100%); }
.decision { display: grid; gap: .55rem; margin-top: 1rem; }
.decision p { text-align: center; color: var(--muted); font-size: .92rem; margin: 0 0 .2rem; }
.decision .primary-button { margin-top: .25rem; }

/* --------------------------------------------------------------------------
   Pause, transitions, doublon, rattrapage
   -------------------------------------------------------------------------- */
.phone-glyph { display: grid; place-items: center; margin: 1.2rem auto .9rem; color: var(--gold-deep); }
.card--sleep .copy b { color: var(--gold); font-weight: 600; }
.missing-list { list-style: none; padding: 0; margin: .4rem auto 1.2rem; max-width: 22rem; text-align: left; display: grid; gap: .3rem; }
.missing-list li { display: grid; grid-template-columns: 26px 1fr; align-items: center; gap: .6rem; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.missing-list li:last-child { border-bottom: 0; }
.missing-list span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--gold-deep); color: var(--gold); font-family: var(--serif); font-size: .85rem; }

/* --------------------------------------------------------------------------
   Sceau de Jeanne : une frise verticale, un fil, quatre noms.
   -------------------------------------------------------------------------- */
.lineage { list-style: none; padding: 0; margin: 1rem auto 1.1rem; max-width: 22rem; text-align: left; position: relative; }
.lineage::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 1px; background: linear-gradient(180deg, var(--gold-deep), var(--gold), var(--gold-deep)); }
.lineage li { position: relative; padding: .35rem 0 .35rem 1.5rem; }
.lineage li::before { content: ""; position: absolute; left: 3px; top: .95rem; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 3px var(--paper); }
.lineage b { display: block; font-family: var(--serif); font-weight: 500; font-size: 1.12rem; line-height: 1.25; }
.lineage small { display: block; color: var(--muted); font-size: .8rem; margin-top: .1rem; }
.lineage-union::after { content: "+"; position: absolute; left: -1px; top: -.55rem; font-family: var(--serif); color: var(--gold); font-size: 1rem; line-height: 1; background: var(--paper); padding: 0 2px; }
.card--seal .copy--strong { margin-top: 1rem; }

/* --------------------------------------------------------------------------
   Récompense : un billet sobre, double filet or.
   -------------------------------------------------------------------------- */
.card--reward { padding: .9rem; background: var(--paper); }
.card--reward::before { display: none; }
.reward {
  padding: clamp(1.2rem, 4.5vw, 1.8rem) clamp(1rem, 4vw, 1.4rem) 1.2rem;
  border: 1px solid var(--gold-deep); border-radius: 8px;
  box-shadow: inset 0 0 0 4px var(--paper), inset 0 0 0 5px var(--line-strong);
}
.reward .blason { margin: .5rem auto .7rem; width: min(280px, 72vw, 33vh); }
.reward-count { color: var(--ink-soft); font-size: .95rem; margin: .2rem 0 .3rem; }
.reward-count b { color: var(--gold); font-family: var(--serif); font-size: 1.12rem; font-weight: 500; }
.reward-note { margin: .4rem auto 0; max-width: 20rem; color: var(--ink); font-weight: 600; line-height: 1.45; }
.reward-meta { margin: .8rem 0 0; color: var(--muted); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }
.card--reward .text-button { margin-top: .5rem; }

/* --------------------------------------------------------------------------
   Réglages
   -------------------------------------------------------------------------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(8, 7, 5, .72); display: grid; place-items: end center; padding: .75rem; padding-bottom: max(.75rem, env(safe-area-inset-bottom)); }
.modal { width: min(540px, 100%); background: var(--paper); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 1.1rem; box-shadow: var(--shadow); max-height: 86vh; overflow: auto; outline: 0; animation: screen-in var(--t-screen) ease-out both; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: .6rem; border-bottom: 1px solid var(--line); }
.field { display: grid; gap: .45rem; padding: .95rem 0; border-bottom: 1px solid var(--line); }
.field span { color: var(--muted); font-size: .85rem; }
.field select { background: var(--paper-2); color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--radius-s); padding: .7rem; -webkit-appearance: none; appearance: none; }
.field.readonly { grid-template-columns: 1fr auto; align-items: center; }
.modal .danger-button { margin-top: 1rem; }
.debug-panel { margin-top: 1rem; padding: .9rem; background: #0e1114; border: 1px solid #2b3742; border-radius: var(--radius-s); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; color: #c3d4e2; }
.debug-panel p { margin: .4rem 0 0; }
.debug-links { display: grid; grid-template-columns: repeat(2, 1fr); gap: .35rem; margin-top: .7rem; }
.debug-links a { color: #98c7ef; }
.debug-strip { position: fixed; left: .45rem; bottom: calc(.45rem + env(safe-area-inset-bottom)); z-index: 70; background: rgba(9, 16, 22, .9); color: #9bc8ea; border: 1px solid #27445a; border-radius: 7px; padding: .25rem .45rem; font: 9px ui-monospace, SFMono-Regular, Menlo, monospace; max-width: calc(100vw - .9rem); opacity: .8; pointer-events: none; }
@media (min-width: 700px) { .modal-backdrop { place-items: center; } }


/* --------------------------------------------------------------------------
   Orchestration des moments (une fois, jamais en boucle)
   -------------------------------------------------------------------------- */
/* 1. Révélation : les autres caches s'assombrissent le temps du reflet ;
      le chiffre et le point du header ne s'allument qu'après le quartier. */
.blason.is-revealing .blason-mask:not(.new):not(.unlocked) { animation: mask-dim 1.15s ease-in-out .15s both; }
@keyframes mask-dim { 0%, 100% { filter: brightness(1); } 45% { filter: brightness(.62); } }
.card--reveal .eyebrow { animation: fade-in .3s ease both; }
.card--reveal .count { animation: count-in .45s cubic-bezier(.2, .7, .3, 1) 1.15s both; }
@keyframes count-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.card--reveal .quiet-note, .card--reveal .primary-button { animation: fade-in .4s ease 1.3s both; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.topbar:has(+ .screen .card--reveal) .progress-dots i.last { animation: dot-on .35s ease 1.15s both; }
.topbar:has(+ .screen .card--reveal) .progress b { animation: fade-in .35s ease 1.15s both; }
@keyframes dot-on { from { background: transparent; border-color: var(--gold-deep); } to { background: var(--gold); border-color: var(--gold); } }

/* 2. 6/6 : un seul reflet parcourt les six quartiers, de gauche à droite. */
.card--mystery .blason-shield::after {
  content: ""; position: absolute; inset: -40% -60%; pointer-events: none; z-index: 2;
  background: linear-gradient(105deg, transparent 42%, rgba(255, 241, 205, .38) 50%, transparent 58%);
  animation: sheen 1.3s ease-in-out .45s both;
}
.card--mystery .copy, .card--mystery .primary-button { animation: fade-in .4s ease .9s both; }

/* 3. Sceau de Jeanne : le fil se trace, les noms arrivent en cascade, puis le secret et le blason. */
.card--seal .lineage::before { transform-origin: top; animation: draw-line 1s ease-out .15s both; }
@keyframes draw-line { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.card--seal .lineage li { animation: rise-in .45s ease-out both; }
.card--seal .lineage li:nth-child(1) { animation-delay: .2s; }
.card--seal .lineage li:nth-child(2) { animation-delay: .45s; }
.card--seal .lineage li:nth-child(3) { animation-delay: .7s; }
.card--seal .lineage li:nth-child(4) { animation-delay: .95s; }
@keyframes rise-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.card--seal h1 { animation: rise-in .5s ease-out 1.15s both; }
.card--seal .copy { animation: fade-in .5s ease 1.3s both; }
.card--seal .blason.is-complete { animation-delay: 1.4s; }
.card--seal .primary-button { animation: fade-in .4s ease 2.2s both; }

/* 4. Transition : la prochaine salle arrive un temps après le titre. */
.card--transition .lead { animation: fade-in .3s ease .15s both; }
.card--transition .next-room { animation: rise-in .45s ease-out .35s both; }
.card--transition .primary-button { animation: fade-in .3s ease .6s both; }

/* 5. Accueil : le blason masqué se pose, une fois. */
.blason.is-mystery { animation: mystery-in .45s ease-out .1s both; }
@keyframes mystery-in { from { opacity: 0; transform: scale(.97); } to { opacity: .9; transform: none; } }

/* --------------------------------------------------------------------------
   Petits écrans / mouvement réduit
   -------------------------------------------------------------------------- */
@media (max-width: 380px) {
  .screen { padding: .75rem; }
  .card { padding: 1.1rem; }
  .brand-text small { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .blason-mask.new { opacity: 0; }
}

/* --------------------------------------------------------------------------
   Scanner QR intégré — Beta 1.1
   -------------------------------------------------------------------------- */
.scan-launch { width: 100%; }
.scan-help { margin: .4rem 0 .9rem; color: var(--muted); font-size: .78rem; }

.scanner-backdrop {
  position: fixed; inset: 0; z-index: 100;
  display: grid; align-items: end; justify-items: center;
  padding: max(.65rem, env(safe-area-inset-top)) max(.65rem, env(safe-area-inset-right)) max(.65rem, env(safe-area-inset-bottom)) max(.65rem, env(safe-area-inset-left));
  background: rgba(6, 6, 5, .94);
}
.scanner-panel {
  width: min(560px, 100%); max-height: 100%; overflow: auto;
  background: var(--paper); border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: .9rem; box-shadow: var(--shadow);
}
.scanner-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.scanner-head .eyebrow { margin-bottom: .1rem; }
.scanner-head h2 { font-family: var(--serif); font-size: 1.45rem; font-weight: 500; }
.scanner-close { flex: none; font-size: 1.45rem; line-height: 1; }
.scanner-view {
  position: relative; overflow: hidden; aspect-ratio: 4 / 3; max-height: 48dvh;
  background: #090806; border: 1px solid var(--line); border-radius: var(--radius-s);
}
.scanner-video { width: 100%; height: 100%; object-fit: cover; display: block; background: #090806; }
.scanner-target { position: absolute; inset: 10%; pointer-events: none; }
.scanner-target::before {
  content: ""; position: absolute; inset: 0; border: 1px solid rgba(242, 235, 219, .28); border-radius: 12px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, .22);
}
.scanner-target i { position: absolute; width: 28px; height: 28px; border-color: var(--gold); border-style: solid; }
.scanner-target i:nth-child(1) { left: 0; top: 0; border-width: 2px 0 0 2px; border-radius: 8px 0 0 0; }
.scanner-target i:nth-child(2) { right: 0; top: 0; border-width: 2px 2px 0 0; border-radius: 0 8px 0 0; }
.scanner-target i:nth-child(3) { right: 0; bottom: 0; border-width: 0 2px 2px 0; border-radius: 0 0 8px 0; }
.scanner-target i:nth-child(4) { left: 0; bottom: 0; border-width: 0 0 2px 2px; border-radius: 0 0 0 8px; }
.scanner-status { min-height: 2.7em; margin: .75rem .25rem .2rem; color: var(--ink); text-align: center; font-weight: 600; }
.scanner-status[data-tone="success"] { color: var(--gold); }
.scanner-status[data-tone="notice"] { color: var(--ink-soft); }
.scanner-status[data-tone="error"] { color: #e3b8b1; }
.scanner-privacy { margin: .25rem auto .7rem; max-width: 30rem; color: var(--muted); font-size: .76rem; text-align: center; line-height: 1.45; }
.scanner-cancel { width: 100%; margin-top: .25rem; }
@media (min-width: 600px) {
  .scanner-backdrop { align-items: center; }
  .scanner-view { aspect-ratio: 4 / 3; }
}
