/* =========================================================
   LA QUÊTE DU CAPITAINE GÉGÉ — feuille de style
   Mobile first · sombre · parchemin · or vieilli · vert fluo
   ========================================================= */

/* ---------- Polices (auto-hébergées, licence SIL OFL) ---------- */
@font-face { font-family: "Cinzel"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/cinzel-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Cinzel"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/cinzel-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Cinzel"; font-style: normal; font-weight: 800; font-display: swap; src: url("../fonts/cinzel-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "Gege Digits"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("../fonts/cinzel-latin-700-normal.woff2") format("woff2"); unicode-range: U+0030-0039; size-adjust: 92%; }
@font-face { font-family: "IM Fell English"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/im-fell-english-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IM Fell English"; font-style: italic; font-weight: 400; font-display: swap; src: url("../fonts/im-fell-english-latin-400-italic.woff2") format("woff2"); }

:root {
  --ink: #0a0705;
  --wood: #1b120c;
  --wood-2: #2a1c12;
  --parch: #eadcbc;
  --parch-2: #d8c39b;
  --parch-ink: #2b1c10;
  --parch-ink-soft: #5a3f24;
  --gold: #c9a45c;
  --gold-2: #8a6a2f;
  --gold-hi: #f0d9a0;
  --green: #39ff7a;
  --green-soft: rgba(57, 255, 122, .35);
  --blood: #7a1f17;
  --text: #eadfc8;
  --muted: #a8977a;
  --error: #ff8f7c;

  --f-title: "Cinzel", "Trajan Pro", Georgia, "Times New Roman", serif;
  --f-body: "Gege Digits", "IM Fell English", Georgia, "Times New Roman", serif;

  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .3 0 0 0 0 .19 0 0 0 0 .08 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--ink);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--f-body);
  font-size: 1.2rem;
  line-height: 1.5;
  color: var(--text);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  background-color: var(--ink);
  background-image:
    radial-gradient(120% 60% at 50% -10%, rgba(74, 46, 24, .55) 0%, transparent 60%),
    radial-gradient(90% 50% at 50% 115%, rgba(30, 90, 52, .22), transparent 70%),
    repeating-linear-gradient(90deg, rgba(255, 220, 160, .018) 0 1px, transparent 1px 46px),
    linear-gradient(180deg, #120c08, #070504 70%);
  background-attachment: fixed;
}

body::after { /* vignette */
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(ellipse at 50% 40%, transparent 45%, rgba(0, 0, 0, .72) 100%);
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

#fx {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: .14;
  background-image: var(--noise);
  mix-blend-mode: overlay;
}

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ---------- Structure ---------- */

.app {
  position: relative;
  z-index: 2;
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding:
    calc(env(safe-area-inset-top, 0px) + 6px)
    calc(env(safe-area-inset-right, 0px) + 16px)
    calc(env(safe-area-inset-bottom, 0px) + 10px)
    calc(env(safe-area-inset-left, 0px) + 16px);
}

main { flex: 1; perspective: 1400px; }

/* ---------- Barre du haut ---------- */

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
}

.progress { display: flex; align-items: center; gap: 12px; }
.progress[hidden] { display: none; }

.medals { display: flex; gap: 8px; margin: 0; padding: 0; list-style: none; }

.medal {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #6c5838;
  background: radial-gradient(circle at 35% 30%, #2d2015, #120c07);
  border: 1px solid #4a3a22;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .8);
  transition: color .4s, border-color .4s, box-shadow .4s;
}
.medal svg { width: 20px; height: 20px; }
.medal.current { border-color: var(--gold); color: var(--gold); }
.medal.done {
  color: var(--green);
  border-color: rgba(57, 255, 122, .7);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .8), 0 0 10px rgba(57, 255, 122, .35);
}
.medal.just-done { animation: medalPop .7s ease; }

.progress-text {
  font-family: var(--f-title);
  font-weight: 800;
  font-size: .85rem;
  letter-spacing: .15em;
  color: var(--gold);
}

.debug-badge {
  font: 700 10px/1 var(--f-title);
  letter-spacing: .15em;
  color: #111;
  background: var(--green);
  padding: 4px 6px;
  border-radius: 4px;
}

.sound-btn {
  margin-left: auto;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(201, 164, 92, .35);
  background: rgba(20, 13, 8, .6);
  color: var(--muted);
  cursor: pointer;
  touch-action: manipulation;
}
.sound-btn svg { width: 20px; height: 20px; grid-area: 1 / 1; }
.sound-btn .ic-on { display: none; }
.sound-btn[aria-pressed="true"] { color: var(--green); border-color: rgba(57, 255, 122, .5); }
.sound-btn[aria-pressed="true"] .ic-on { display: block; }
.sound-btn[aria-pressed="true"] .ic-off { display: none; }
.sound-btn:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* ---------- Écrans ---------- */

.screen { padding: 4px 0 26px; }
.screen[hidden] { display: none; }
.screen > * + * { margin-top: 18px; }
.screen:focus { outline: none; }

.center { text-align: center; }
p { margin: 0; }

/* ---------- Titres ---------- */

.title {
  margin: 4px 0 0;
  text-align: center;
  font-family: var(--f-title);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  line-height: 1.12;
}
.title:focus { outline: none; }
.title .emo {
  display: block;
  font-size: 2rem;
  line-height: 1.2;
  margin-bottom: 6px;
  filter: drop-shadow(0 0 10px rgba(57, 255, 122, .3));
}
.title .t-small {
  display: block;
  font-size: .82rem;
  letter-spacing: .32em;
  color: var(--green);
  text-shadow: 0 0 10px rgba(57, 255, 122, .55);
  margin-bottom: 6px;
}
.title .t-big,
.gold-text {
  display: block;
  font-size: clamp(1.45rem, 6.6vw, 1.95rem);
  background: linear-gradient(180deg, #f6e4b4 0%, #d4b06a 52%, #94712f 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .65));
}
.title::after {
  content: "";
  display: block;
  width: 170px;
  height: 12px;
  margin: 14px auto 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 170 12'%3E%3Cpath d='M0 6h70M100 6h70' stroke='%238a6a2f' stroke-width='1'/%3E%3Cpath d='M85 1l5 5-5 5-5-5z' fill='none' stroke='%23c9a45c'/%3E%3Ccircle cx='85' cy='6' r='1.6' fill='%2339ff7a'/%3E%3Ccircle cx='74' cy='6' r='1.2' fill='%23c9a45c'/%3E%3Ccircle cx='96' cy='6' r='1.2' fill='%23c9a45c'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---------- Emblèmes ---------- */

.emblem { display: grid; place-items: center; margin-top: 8px; }
.emblem svg { overflow: visible; }
.emblem-seal svg { width: 104px; height: 104px; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .75)); animation: sealBreath 4s ease-in-out infinite; }
.emblem .eye, .kraken-art .eye { animation: eyeGlow 3.2s ease-in-out infinite; }

/* ---------- Parchemin ---------- */

.parchment {
  position: relative;
  color: var(--parch-ink);
  padding: 22px 20px;
  border-radius: 5px 10px 6px 9px / 9px 5px 10px 6px;
  background-color: var(--parch);
  background-image:
    radial-gradient(ellipse at 15% 8%, rgba(255, 252, 240, .55), transparent 45%),
    radial-gradient(ellipse at 90% 95%, rgba(130, 85, 35, .3), transparent 55%),
    radial-gradient(ellipse at 5% 90%, rgba(110, 70, 30, .22), transparent 40%),
    var(--noise),
    linear-gradient(180deg, #ecdfc1, #d7c197);
  box-shadow:
    inset 0 0 38px rgba(105, 64, 22, .55),
    inset 0 0 6px rgba(70, 40, 12, .7),
    0 14px 32px rgba(0, 0, 0, .65);
}
.parchment p + p, .parchment p + blockquote, .parchment blockquote + p, .parchment * + .grid-wrap, .parchment .grid-wrap + * { margin-top: .7em; }
.parchment strong { color: #1d1108; }
.parchment .lead { font-size: 1.06rem; }
.parchment .triad {
  text-align: center;
  font-family: var(--f-title);
  font-size: 1.02rem;
  letter-spacing: .04em;
  line-height: 1.6;
  margin-top: 1em;
  padding-top: .9em;
  border-top: 1px solid rgba(90, 60, 30, .3);
}

.riddle, .quote {
  margin: 1em 0 0;
  padding: 14px 6px;
  text-align: center;
  font-style: italic;
  font-size: 1.12rem;
  line-height: 1.55;
  border-top: 1px solid rgba(90, 60, 30, .35);
  border-bottom: 1px solid rgba(90, 60, 30, .35);
}
.riddle strong {
  display: block;
  margin-top: .7em;
  font-family: var(--f-title);
  font-style: normal;
  font-size: 1.05rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--blood);
}
.quote strong { font-weight: 700; }

.question {
  font-family: var(--f-title);
  font-weight: 800;
  text-align: center;
  font-size: 1rem;
  letter-spacing: .03em;
  color: var(--blood);
}

.cipher, .code-line {
  display: block;
  margin: .8em 0 0;
  padding: 14px 8px;
  text-align: center;
  font-family: var(--f-title);
  font-weight: 800;
  font-size: clamp(1.2rem, 6.2vw, 1.6rem);
  letter-spacing: .12em;
  line-height: 1.4;
  color: #2a1408;
  background: rgba(70, 35, 10, .08);
  border: 1px dashed rgba(70, 35, 10, .4);
  border-radius: 4px;
  text-shadow: 0 1px 0 rgba(255, 245, 220, .55);
}
.code-line { font-size: clamp(1.05rem, 5.4vw, 1.4rem); letter-spacing: .04em; word-spacing: -.05em; }

/* ---------- Grille du journal ---------- */

.grid-wrap { display: flex; justify-content: center; }
.grid {
  border-collapse: separate;
  border-spacing: 3px;
  font-family: var(--f-title);
  font-weight: 800;
}
.grid th, .grid td {
  width: clamp(30px, 10.4vw, 42px);
  height: clamp(30px, 10.4vw, 42px);
  padding: 0;
  text-align: center;
  vertical-align: middle;
  border-radius: 3px;
}
.grid td {
  font-size: clamp(.95rem, 4.6vw, 1.15rem);
  color: #24130a;
  background: rgba(80, 45, 15, .1);
  border: 1px solid rgba(80, 45, 15, .32);
}
.grid th { font-size: .85rem; color: var(--blood); }
.grid thead th { border-bottom: 2px solid rgba(122, 31, 23, .35); border-radius: 0; }
.grid tbody th { border-right: 2px solid rgba(122, 31, 23, .35); border-radius: 0; }

/* ---------- Formulaire de réponse ---------- */

.answer { display: grid; gap: 12px; }
.answer[hidden] { display: none; }

.answer input {
  width: 100%;
  min-height: 60px;
  padding: 12px 14px;
  font-family: var(--f-title);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  text-align: center;
  color: var(--gold-hi);
  caret-color: var(--green);
  background: linear-gradient(180deg, #0c0805, #160f09);
  border: 1px solid var(--gold-2);
  border-radius: 10px;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, .85);
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .25s, box-shadow .25s;
}
.answer input::placeholder {
  font-family: var(--f-body);
  font-style: italic;
  font-weight: 400;
  text-transform: none;
  letter-spacing: .02em;
  color: #74644b;
}
.answer input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, .85), 0 0 0 3px rgba(57, 255, 122, .2), 0 0 22px rgba(57, 255, 122, .22);
}
.answer.is-wrong input { border-color: #a2402f; animation: shake .45s ease; }
.answer.code input { letter-spacing: .6em; text-indent: .6em; font-size: 1.6rem; }

.error {
  min-height: 1.5em;
  text-align: center;
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--error);
  text-shadow: 0 0 12px rgba(255, 90, 60, .25);
}
.error.show { animation: errIn .35s ease; }

/* ---------- Boutons ---------- */

.btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  width: 100%;
  min-height: 58px;
  padding: 14px 20px;
  font-family: var(--f-title);
  font-weight: 800;
  font-size: 1rem;
  line-height: 1.2;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-align: center;
  text-decoration: none;
  color: var(--gold-hi);
  background: linear-gradient(180deg, #3b2818 0%, #22160d 55%, #170e08 100%);
  border: 1px solid var(--gold-2);
  border-radius: 10px;
  box-shadow:
    inset 0 1px 0 rgba(255, 228, 170, .22),
    inset 0 -3px 0 rgba(0, 0, 0, .45),
    0 8px 20px rgba(0, 0, 0, .55);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  transition: transform .12s, box-shadow .25s, border-color .25s;
}
.btn::before, .btn::after { /* rivets */
  content: "";
  position: absolute;
  top: 50%;
  width: 6px; height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f3dca0, #7d5e27 70%);
  box-shadow: 0 1px 1px rgba(0, 0, 0, .7);
}
.btn::before { left: 12px; }
.btn::after { right: 12px; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }

.btn-primary {
  border-color: var(--gold);
  background: linear-gradient(180deg, #5c3f1e 0%, #34210f 55%, #22150a 100%);
}
.btn-glow {
  animation: btnGlow 2.8s ease-in-out infinite;
}

/* ---------- Compte à rebours ---------- */

.countdown {
  display: flex;
  justify-content: center;
  gap: 8px;
}
.cd-cell {
  min-width: 66px;
  padding: 10px 6px 8px;
  text-align: center;
  border: 1px solid rgba(201, 164, 92, .35);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(40, 27, 16, .85), rgba(15, 10, 6, .85));
  box-shadow: inset 0 0 10px rgba(0, 0, 0, .6);
}
.cd-cell[hidden] { display: none; }
.cd-cell b {
  display: block;
  font-family: var(--f-title);
  font-size: 1.5rem;
  line-height: 1.1;
  color: var(--gold-hi);
  font-variant-numeric: tabular-nums;
}
.cd-cell span {
  display: block;
  margin-top: 2px;
  font-size: .72rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

.sign { font-size: 1.08rem; color: var(--gold-hi); }

/* ---------- Bloc succès ---------- */

.success {
  position: relative;
  text-align: center;
  padding: 22px 18px;
  border-radius: 12px;
  border: 1px solid rgba(57, 255, 122, .38);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(57, 255, 122, .13), transparent 65%),
    linear-gradient(180deg, rgba(20, 22, 14, .92), rgba(10, 9, 6, .92));
  box-shadow: 0 0 34px rgba(57, 255, 122, .08), 0 14px 30px rgba(0, 0, 0, .55);
}
.success[hidden] { display: none; }
.success > * + * { margin-top: 14px; }
.success.fresh { animation: rise .6s cubic-bezier(.2, .8, .2, 1) both; }

.ok {
  font-family: var(--f-title);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--green);
  text-shadow: 0 0 14px rgba(57, 255, 122, .55);
}
.ok:focus { outline: none; }

.translation {
  font-family: var(--f-title);
  font-weight: 800;
  font-size: clamp(1.15rem, 5.6vw, 1.45rem);
  letter-spacing: .1em;
  line-height: 1.35;
  color: var(--gold-hi);
  padding: 12px 6px;
  border-top: 1px solid rgba(201, 164, 92, .3);
  border-bottom: 1px solid rgba(201, 164, 92, .3);
  text-shadow: 0 0 16px rgba(240, 217, 160, .25);
}

.captain-quote {
  margin: 0;
  font-style: italic;
  font-size: 1.2rem;
  line-height: 1.55;
  color: var(--gold-hi);
}
.emph { font-family: var(--f-title); font-weight: 800; letter-spacing: .03em; color: var(--text); }

/* Carte au trésor qui se retourne */
.flip { perspective: 1100px; width: min(100%, 300px); margin-left: auto; margin-right: auto; }
.flip-inner {
  position: relative;
  aspect-ratio: 300 / 200;
  transform-style: preserve-3d;
  transition: transform .9s cubic-bezier(.45, .05, .25, 1);
}
.flip.flipped .flip-inner { transform: rotateY(180deg); }
.flip-face {
  position: absolute;
  inset: 0;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 10px 22px rgba(0, 0, 0, .6), inset 0 0 26px rgba(105, 64, 22, .6);
}
.flip-front {
  background: var(--noise), linear-gradient(160deg, #e9dab6, #cdb27f);
}
.flip-back {
  transform: rotateY(180deg);
  display: grid;
  place-items: center;
  padding: 18px;
  background: var(--noise), linear-gradient(160deg, #c9ae7c, #a88a57);
  font-family: var(--f-title);
  font-weight: 800;
  letter-spacing: .12em;
  font-size: 1.05rem;
  line-height: 1.5;
  color: rgba(50, 25, 8, .75);
  text-shadow: 0 1px 0 rgba(255, 240, 210, .35);
}
.flip-front svg { width: 100%; height: 100%; display: block; }
.success.fresh .flip { animation: mapIn .9s cubic-bezier(.2, .8, .2, 1) both; }

/* Kraken */
.kraken-art {
  width: 170px;
  margin-left: auto;
  margin-right: auto;
  color: var(--gold);
  filter: drop-shadow(0 0 14px rgba(57, 255, 122, .3));
}
.kraken-art svg { width: 100%; height: auto; aspect-ratio: 200 / 165; display: block; }
.success.fresh .kraken-art { animation: krakenRise 1.6s .9s cubic-bezier(.2, .8, .2, 1) both; }
.kraken-art svg { animation: krakenFloat 5s ease-in-out infinite; }

/* Sceau qui se brise */
.seal-break {
  position: relative;
  height: 112px;
  width: 112px;
  margin: 0 auto;
}
.seal-break .half {
  position: absolute;
  inset: 0;
}
.seal-break .half svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .7)); }
.seal-break .left  { clip-path: polygon(0 0, 53% 0, 46% 20%, 56% 38%, 45% 58%, 55% 77%, 48% 100%, 0 100%); }
.seal-break .right { clip-path: polygon(53% 0, 100% 0, 100% 100%, 48% 100%, 55% 77%, 45% 58%, 56% 38%, 46% 20%); }
.seal-break .burst {
  position: absolute;
  inset: -30px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(57, 255, 122, .55), rgba(240, 217, 160, .2) 35%, transparent 65%);
  opacity: 0;
}
.success.fresh .seal-break .left  { animation: sealLeft 1.7s ease-in both; }
.success.fresh .seal-break .right { animation: sealRight 1.7s ease-in both; }
.success.fresh .seal-break .burst { animation: burst 1.7s ease-out both; }
.success:not(.fresh) .seal-break { display: none; }
.success.fresh .after-seal { animation: fadeUp .6s 1.2s both; }

/* ---------- Journal ---------- */

.journal { position: relative; perspective: 1600px; }
.journal-cover {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  transform-origin: left center;
  border-radius: 4px 12px 12px 4px;
  background:
    var(--noise),
    radial-gradient(ellipse at 50% 30%, #5a2e18, #2a140a 70%);
  border: 2px solid #8a6a2f;
  box-shadow: inset 0 0 0 6px #2a140a, inset 0 0 0 7px rgba(201, 164, 92, .55), inset 10px 0 18px rgba(0, 0, 0, .6);
}
.journal-cover::after {
  content: "";
  position: absolute;
  left: 50%;
  top: min(40%, 160px);
  width: 110px; height: 90px;
  transform: translate(-50%, -50%);
  background: url("../quest/kraken.webp") center / contain no-repeat;
  opacity: .85;
}
.anim-book .journal-cover {
  display: block;
  animation: coverOpen 1.5s .25s cubic-bezier(.55, .05, .3, 1) both;
}

/* ---------- Rituel final ---------- */

.ritual {
  position: relative;
  text-align: center;
  padding: 26px 18px 28px;
  border-radius: 16px;
  border: 1px solid var(--gold-2);
  background:
    radial-gradient(ellipse at 50% 42%, rgba(57, 255, 122, .11), transparent 55%),
    radial-gradient(ellipse at 50% 0%, rgba(201, 164, 92, .16), transparent 50%),
    linear-gradient(180deg, #20150c, #0d0805);
  box-shadow:
    inset 0 0 0 5px #0e0906,
    inset 0 0 0 6px rgba(201, 164, 92, .45),
    0 0 46px rgba(57, 255, 122, .1),
    0 22px 44px rgba(0, 0, 0, .65);
}
.ritual > * + * { margin-top: 14px; }
.ritual .corner {
  position: absolute;
  width: 26px; height: 26px;
  border-color: var(--gold);
  border-style: solid;
  opacity: .8;
}
.ritual .c-tl { top: 12px; left: 12px; border-width: 2px 0 0 2px; }
.ritual .c-tr { top: 12px; right: 12px; border-width: 2px 2px 0 0; }
.ritual .c-bl { bottom: 12px; left: 12px; border-width: 0 0 2px 2px; }
.ritual .c-br { bottom: 12px; right: 12px; border-width: 0 2px 2px 0; }

.ritual-title { margin-top: 0; }
.ritual-title .t-big {
  font-size: clamp(1.9rem, 9.2vw, 2.55rem);
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .7)) drop-shadow(0 0 16px rgba(57, 255, 122, .28));
}
.ritual-title .emo { font-size: 2.4rem; }

.bigx { width: 150px; margin: 6px auto 0; }
.bigx svg { width: 100%; height: auto; display: block; overflow: visible; }
.bigx .trail { stroke-dasharray: 1 13; animation: march 1.4s linear infinite; }
.bigx .xmark { transform-origin: 100px 186px; animation: xPulse 2.2s ease-in-out infinite; filter: drop-shadow(0 0 4px rgba(255, 60, 80, 1)) drop-shadow(0 0 12px rgba(255, 30, 60, .85)) drop-shadow(0 0 26px rgba(255, 20, 50, .45)); }

.step {
  font-family: var(--f-title);
  font-weight: 800;
  font-size: 1.06rem;
  letter-spacing: .03em;
  color: var(--text);
}
.step-strong { color: var(--green); text-shadow: 0 0 12px rgba(57, 255, 122, .45); }

.phrase {
  margin: 18px 0 0;
  padding: 18px 6px;
  font-family: var(--f-title);
  font-weight: 800;
  font-size: clamp(1.32rem, 6.4vw, 1.75rem);
  line-height: 1.35;
  color: var(--gold-hi);
  text-shadow: 0 0 18px rgba(240, 217, 160, .35), 0 2px 0 rgba(0, 0, 0, .7);
  border-top: 1px solid rgba(201, 164, 92, .45);
  border-bottom: 1px solid rgba(201, 164, 92, .45);
  background: radial-gradient(ellipse at 50% 50%, rgba(57, 255, 122, .07), transparent 70%);
}

.coin-line { font-size: 1.12rem; color: var(--gold-hi); }

.buried {
  text-align: center;
  padding: 22px 18px;
  border-radius: 12px;
  border: 1px solid rgba(160, 50, 35, .6);
  background:
    var(--noise),
    radial-gradient(ellipse at 50% 0%, rgba(160, 40, 25, .25), transparent 60%),
    linear-gradient(180deg, #24100b, #120806);
  box-shadow: inset 0 0 24px rgba(0, 0, 0, .7), 0 14px 30px rgba(0, 0, 0, .5);
}
.buried > * + * { margin-top: 10px; }
.buried h2 {
  margin: 0 0 6px;
  font-family: var(--f-title);
  font-weight: 800;
  font-size: 1.12rem;
  letter-spacing: .06em;
  line-height: 1.35;
  color: #f2c8a8;
  text-transform: uppercase;
}
.buried .last {
  font-family: var(--f-title);
  font-weight: 800;
  font-size: 1.18rem;
  color: var(--gold-hi);
  text-shadow: 0 0 14px rgba(240, 217, 160, .3);
}

.divider {
  position: relative;
  height: 1px;
  margin: 34px 0 26px !important;
  border: 0;
  overflow: visible;
  background: linear-gradient(90deg, transparent, var(--gold-2), transparent);
}
.divider::after {
  content: "☠";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -52%);
  padding: 0 12px;
  font-size: 1.1rem;
  color: var(--gold);
  background: var(--ink);
  border-radius: 50%;
}

.locked-note { text-align: center; font-style: italic; color: var(--muted); font-size: 1.04rem; }

.epilogue {
  padding: 22px 18px;
  border-radius: 12px;
  border: 1px solid var(--gold-2);
  background:
    repeating-linear-gradient(0deg, rgba(255, 220, 160, .02) 0 2px, transparent 2px 22px),
    linear-gradient(180deg, #24180f, #110b07);
  box-shadow: inset 0 0 0 4px #110b07, inset 0 0 0 5px rgba(201, 164, 92, .3), 0 14px 30px rgba(0, 0, 0, .55);
  text-align: center;
}
.epilogue > * + * { margin-top: 14px; }
.epilogue h2 {
  margin: 0;
  font-family: var(--f-title);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: .06em;
  line-height: 1.35;
  text-transform: uppercase;
  color: var(--gold-hi);
}

.coin-anim { width: 128px; margin: 0 auto; perspective: 600px; }
.coin-anim svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .7)) drop-shadow(0 0 20px rgba(240, 200, 110, .3)); }
.success.fresh .coin-anim svg { animation: coinSpin 1.8s cubic-bezier(.2, .7, .2, 1) both; }
.success:not(.fresh) .coin-anim svg { animation: coinIdle 6s ease-in-out infinite; }

.done-list { font-size: 1.08rem; line-height: 1.6; }
.done-list p + p { margin-top: 2px; }

/* Apparition progressive (rituel) */
.anim-ritual .rv { animation: fadeUp .7s cubic-bezier(.2, .8, .2, 1) both; animation-delay: var(--d, 0s); }
.anim-ritual .ritual { animation: ritualIn 1.1s ease both; }

/* Transitions d'écran */
.anim-fade { animation: fadeUp .5s ease both; }
.anim-unroll .title, .anim-unroll .emblem { animation: fadeUp .6s ease both; }
.anim-unroll .parchment { animation: unroll 1s .15s cubic-bezier(.3, .7, .2, 1) both; }
.anim-unroll .answer { animation: fadeUp .5s .9s ease both; }
.anim-flip { animation: flipIn .8s cubic-bezier(.2, .7, .2, 1) both; transform-origin: 50% 30%; }
.anim-book .title { animation: fadeUp .5s ease both; }
.anim-book .answer { animation: fadeUp .5s 1.5s ease both; }

/* Lettres qui apparaissent */
.tw .w { display: inline-block; white-space: nowrap; }
.tw .ch { display: inline-block; animation: letterIn .5s ease both; }

/* ---------- Pied de page ---------- */

.foot {
  padding: 18px 0 4px;
  text-align: center;
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
}
.disclaimer { opacity: .5; }
.reset { margin-top: 6px; opacity: .45; }
.reset[hidden] { display: none; }
.reset-confirm[hidden] { display: none; }
.reset-link {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 8px 6px;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  cursor: pointer;
}
.reset:focus-within { opacity: .9; }

.noscript {
  position: relative; z-index: 3;
  text-align: center; padding: 40px 20px; color: var(--gold-hi);
}

/* ---------- Animations ---------- */

@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(20px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes errIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes letterIn { from { opacity: 0; transform: translateY(.3em); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes unroll {
  from { clip-path: inset(0 0 100% 0 round 6px); opacity: .3; transform: scaleY(.96); }
  to { clip-path: inset(0 0 0 0 round 6px); opacity: 1; transform: none; }
}
@keyframes flipIn {
  from { opacity: 0; transform: rotateY(-80deg) translateX(-10%); }
  60% { opacity: 1; }
  to { opacity: 1; transform: none; }
}
@keyframes mapIn { from { opacity: 0; transform: rotateX(70deg) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes coverOpen {
  0% { transform: rotateY(0); opacity: 1; }
  80% { transform: rotateY(-108deg); opacity: 1; }
  100% { transform: rotateY(-125deg); opacity: 0; }
}
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); }
}
@keyframes btnGlow {
  0%, 100% { box-shadow: inset 0 1px 0 rgba(255, 228, 170, .22), inset 0 -3px 0 rgba(0, 0, 0, .45), 0 8px 20px rgba(0, 0, 0, .55), 0 0 0 1px rgba(57, 255, 122, .1), 0 0 10px rgba(57, 255, 122, .08); }
  50% { box-shadow: inset 0 1px 0 rgba(255, 228, 170, .22), inset 0 -3px 0 rgba(0, 0, 0, .45), 0 8px 20px rgba(0, 0, 0, .55), 0 0 0 1px rgba(57, 255, 122, .45), 0 0 26px rgba(57, 255, 122, .3); }
}
@keyframes medalPop { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
@keyframes eyeGlow { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes sealBreath { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03); } }
@keyframes krakenRise { from { opacity: 0; transform: translateY(18px) scale(.85); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes krakenFloat { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-5px) rotate(1deg); } }
@keyframes sealLeft {
  0% { transform: none; opacity: 1; }
  12% { transform: translateX(-2px) rotate(-2deg); }
  22% { transform: translateX(2px) rotate(2deg); }
  32% { transform: translateX(-3px); }
  45% { transform: translateX(-4px) rotate(-3deg); opacity: 1; }
  100% { transform: translate(-70px, 30px) rotate(-38deg); opacity: 0; }
}
@keyframes sealRight {
  0% { transform: none; opacity: 1; }
  12% { transform: translateX(2px) rotate(2deg); }
  22% { transform: translateX(-2px) rotate(-2deg); }
  32% { transform: translateX(3px); }
  45% { transform: translateX(4px) rotate(3deg); opacity: 1; }
  100% { transform: translate(70px, 30px) rotate(38deg); opacity: 0; }
}
@keyframes burst {
  0%, 40% { opacity: 0; transform: scale(.4); }
  55% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.5); }
}
@keyframes march { to { stroke-dashoffset: -14; } }
@keyframes xPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes ritualIn {
  0% { opacity: 0; transform: scale(.94); filter: brightness(2.2) saturate(.4); }
  60% { opacity: 1; }
  100% { opacity: 1; transform: none; filter: none; }
}
@keyframes coinSpin {
  0% { transform: rotateY(0) scale(.2); opacity: 0; }
  25% { opacity: 1; }
  100% { transform: rotateY(1080deg) scale(1); opacity: 1; }
}
@keyframes coinIdle { 0%, 100% { transform: rotateY(-12deg); } 50% { transform: rotateY(12deg); } }

/* ---------- Petits écrans ---------- */

@media (max-width: 350px) {
  .parchment { padding: 18px 15px; }
  .cd-cell { min-width: 58px; }
  .btn { font-size: .92rem; letter-spacing: .07em; padding: 14px 24px; }
}

@media (min-width: 560px) {
  .app { padding-top: 24px; }
}

/* =========================================================
   PASSE GRAPHIQUE v2 — illustrations du Capitaine Gégé
   ========================================================= */

:root {
  --glow-1: rgba(57, 255, 122, .45);
  --glow-2: rgba(57, 255, 122, .16);
}

img { max-width: 100%; height: auto; }

/* ---------- Médaillons de progression ---------- */
.medals { gap: 9px; }
.medal {
  width: 38px; height: 38px;
  padding: 0;
  overflow: hidden;
  border: 1px solid #5a4526;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .85), 0 0 0 2px rgba(10, 7, 5, .9), 0 0 0 3px rgba(138, 106, 47, .25);
}
.medal img {
  width: 30px; height: 30px;
  object-fit: contain;
  border-radius: 50%;
  /* verrouillé : on devine à peine le symbole */
  opacity: .32;
  filter: grayscale(1) brightness(.75) blur(1.4px);
  transition: opacity .5s, filter .5s, transform .5s;
}
.medal[data-n="1"] img { width: 100%; height: 100%; object-fit: cover; }
.medal.current {
  border-color: var(--gold);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .85), 0 0 0 2px rgba(10, 7, 5, .9), 0 0 0 3px rgba(201, 164, 92, .45), 0 0 12px rgba(201, 164, 92, .35), 0 0 18px rgba(57, 255, 122, .12);
}
.medal.current img { opacity: .75; filter: grayscale(.35) sepia(.4) brightness(.95) blur(1.1px); }
.medal.done {
  border-color: rgba(57, 255, 122, .75);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .85), 0 0 0 2px rgba(10, 7, 5, .9), 0 0 0 3px rgba(57, 255, 122, .35), 0 0 12px rgba(57, 255, 122, .4);
}
.medal.done img { opacity: 1; filter: none; }

/* ---------- Emblème du capitaine (accueil) ---------- */
.emblem-captain { margin-top: 2px; }
.emblem-captain img {
  display: block;
  width: clamp(96px, 30vw, 122px);
  height: auto;
  animation: captainFloat 6s ease-in-out infinite, spectralGlow 4s ease-in-out infinite;
}

/* ---------- Icônes de titres ---------- */
.title-art {
  display: block;
  margin: 0 auto 8px;
  line-height: 0;
}
.title-art img { display: block; margin: 0 auto; height: auto; }

/* Épreuve 2 : le verso de la carte */
.title-art--map img {
  width: 78px;
  transform: scaleX(-1) rotate(-4deg);
  filter: sepia(.7) brightness(.62) contrast(1.1) drop-shadow(0 4px 8px rgba(0, 0, 0, .8)) drop-shadow(0 0 10px var(--glow-2));
}

/* Épreuve 3 : le journal */
.title-art--journal img {
  width: clamp(62px, 19vw, 78px);
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .8)) drop-shadow(0 0 12px var(--glow-2));
}
.anim-book .title-art--journal img { animation: journalZoom .6s cubic-bezier(.2, .8, .2, 1) both; }

/* Rituel : le capitaine, glow plus intense */
.title-art--captain img {
  width: clamp(84px, 27vw, 110px);
  animation: captainFloat 6s ease-in-out infinite, spectralGlowStrong 3.4s ease-in-out infinite;
}

/* ---------- Carte au trésor (épreuve 1) ---------- */
.flip { width: min(94%, 360px); }
.flip-inner { aspect-ratio: 4 / 3; }
.flip-face { overflow: visible; border-radius: 0; box-shadow: none; }
.flip-front { background: none; }
.flip-front img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .7));
}
.flip-back {
  isolation: isolate;
  background: none;
  color: rgba(40, 20, 6, .88);
  text-shadow: 0 1px 0 rgba(255, 236, 200, .45);
}
.flip-back::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: url("../quest/carte-tresor.webp") center / contain no-repeat;
  transform: scaleX(-1);
  filter: sepia(.85) saturate(1.15) brightness(.78) contrast(.88) blur(1.3px) drop-shadow(0 10px 14px rgba(0, 0, 0, .7));
}
.success.fresh .flip { animation: mapReveal .6s .1s cubic-bezier(.2, .8, .2, 1) both; }

/* ---------- Kraken (épreuve 2) ---------- */
.kraken-art {
  width: clamp(140px, 46vw, 180px);
  color: inherit;
  filter: none;
}
.kraken-art img {
  display: block;
  width: 100%;
  height: auto;
  animation: krakenFloat 5s ease-in-out infinite, spectralGlow 4.2s ease-in-out infinite;
}
.success.fresh .kraken-art { animation: krakenDark 1.1s .7s cubic-bezier(.2, .8, .2, 1) both; }

/* Miniature du journal avant « Ouvrir le journal » */
.journal-thumb { line-height: 0; }
.journal-thumb img {
  width: 88px;
  height: auto;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .8)) drop-shadow(0 0 10px var(--glow-2));
}
.success.fresh .journal-thumb { animation: journalZoom .6s 1.6s cubic-bezier(.2, .8, .2, 1) both; }

/* Couverture du journal : le Kraken doré */
.journal-cover::after { width: 120px; height: 120px; opacity: .9; }

/* ---------- Animations v2 ---------- */
@keyframes captainFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes spectralGlow {
  0%, 100% { filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .7)) drop-shadow(0 0 6px rgba(57, 255, 122, .22)) drop-shadow(0 0 16px rgba(57, 255, 122, .08)); }
  50% { filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .7)) drop-shadow(0 0 8px rgba(57, 255, 122, .4)) drop-shadow(0 0 22px rgba(57, 255, 122, .16)); }
}
@keyframes spectralGlowStrong {
  0%, 100% { filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .7)) drop-shadow(0 0 8px rgba(57, 255, 122, .38)) drop-shadow(0 0 22px rgba(57, 255, 122, .16)); }
  50% { filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .7)) drop-shadow(0 0 12px rgba(57, 255, 122, .6)) drop-shadow(0 0 30px rgba(57, 255, 122, .28)); }
}
@keyframes mapReveal {
  from { opacity: 0; transform: scale(.96) rotateX(18deg); clip-path: inset(0 50% 0 50%); }
  to { opacity: 1; transform: none; clip-path: inset(-20% -20% -20% -20%); }
}
@keyframes krakenDark {
  from { opacity: 0; transform: translateY(10px) scale(.94); filter: brightness(0) blur(4px); }
  60% { opacity: 1; filter: brightness(.6) blur(1px); }
  to { opacity: 1; transform: none; filter: none; }
}
@keyframes journalZoom { from { opacity: 0; transform: scale(.82); } to { opacity: 1; transform: none; } }

@media (max-width: 350px) {
  .medal { width: 34px; height: 34px; }
  .medal img { width: 26px; height: 26px; }
  .medals { gap: 7px; }
}

/* =========================================================
   v3 — page d'attente, X rouge, sceau
   ========================================================= */

/* Page d'attente : le capitaine endormi, scellé à la cire */
.emblem-sealed {
  position: relative;
  width: clamp(104px, 32vw, 128px);
  margin: 4px auto 22px;
}
.sealed-captain {
  display: block;
  width: 100%;
  height: auto;
  animation: captainFloat 6s ease-in-out infinite, sleepyGlow 5s ease-in-out infinite;
}
.sealed-wax {
  position: absolute;
  right: -10px;
  bottom: -8px;
  width: 50px;
  height: 50px;
  transform: rotate(-12deg);
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .8));
  animation: sealBreath 4s ease-in-out infinite;
}
@keyframes sleepyGlow {
  0%, 100% { filter: brightness(.78) saturate(.85) drop-shadow(0 6px 10px rgba(0, 0, 0, .75)) drop-shadow(0 0 5px rgba(57, 255, 122, .14)); }
  50% { filter: brightness(.9) saturate(.95) drop-shadow(0 6px 10px rgba(0, 0, 0, .75)) drop-shadow(0 0 12px rgba(57, 255, 122, .3)); }
}

/* Petites icônes dans le texte (remplacent les emojis) */
.inline-ico {
  display: inline-block;
  width: auto;
  height: 1.35em;
  vertical-align: -0.32em;
  margin-right: .1em;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .55));
}
.inline-ico--seal { width: 1.35em; }
.inline-ico--glow { filter: drop-shadow(0 0 6px rgba(57, 255, 122, .35)); }

/* X rouge fluo : halo rouge discret derrière */
.bigx { position: relative; }
.bigx::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 130px;
  height: 110px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(255, 40, 70, .22), transparent 65%);
  pointer-events: none;
}

/* Sceau brisé : il se brise PAR-DESSUS le message (plus d'espace vide) */
.success.fresh .seal-break {
  position: absolute;
  top: 6px;
  left: 50%;
  margin: 0 0 0 -56px;
  z-index: 2;
  pointer-events: none;
}
.success.fresh .seal-break + .ok { margin-top: 0; }

/* =========================================================
   v4 — logo épreuve 1, code du journal en pastilles
   ========================================================= */
.title-art--e1 img {
  width: clamp(66px, 20vw, 82px);
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .75)) drop-shadow(0 0 8px rgba(57, 255, 122, .28)) drop-shadow(0 0 18px rgba(57, 255, 122, .1));
  animation: captainFloat 6s ease-in-out infinite;
}
.code-line {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: clamp(4px, 1.6vw, 8px);
  padding: 12px 6px;
  letter-spacing: .02em;
  font-size: clamp(1rem, 4.6vw, 1.3rem);
}
.code-line span {
  flex: 0 1 2.4em;
  min-width: 0;
  padding: 4px 2px;
  border-radius: 4px;
  border: 1px solid rgba(80, 45, 15, .4);
  background: rgba(255, 245, 220, .35);
  box-shadow: inset 0 -2px 0 rgba(80, 45, 15, .15);
}

/* =========================================================
   v5 — LISIBILITÉ MOBILE
   IM Fell English a un petit œil : on grossit le texte courant,
   on évite les tailles < 13 px et on soigne les retours à la ligne.
   ========================================================= */

/* Retours à la ligne plus harmonieux */
.title, .question, .ok, .step, .phrase, .translation, .buried h2, .epilogue h2,
.btn, .riddle strong, .emph, .triad, .sign { text-wrap: balance; }
p, blockquote, .captain-quote { text-wrap: pretty; }
.nw { white-space: nowrap; }
body { overflow-wrap: break-word; hyphens: manual; }

/* Paragraphes */
.parchment { font-size: 1.04em; line-height: 1.5; }
.parchment p + p, .parchment p + blockquote, .parchment blockquote + p { margin-top: .75em; }
.success, .ritual, .buried, .epilogue { line-height: 1.5; }

/* Italiques (énigme, citations) : plus grandes et plus contrastées */
.riddle, .quote {
  font-size: 1.32rem;
  line-height: 1.5;
  color: #22140a;
}
.riddle strong { font-size: 1.05rem; margin-top: .6em; }
.quote strong { font-weight: 400; }
.captain-quote { font-size: 1.36rem; line-height: 1.5; }
.locked-note { font-size: 1.16rem; line-height: 1.5; color: #c9b693; }

/* Textes en Cinzel : tailles minimales confortables */
.question { font-size: 1.06rem; line-height: 1.4; }
.step { font-size: 1.1rem; line-height: 1.4; }
.title .t-small { font-size: .88rem; letter-spacing: .26em; }
.ok { font-size: 1.18rem; line-height: 1.3; }
.translation { font-size: clamp(1.2rem, 5.8vw, 1.5rem); }
.phrase { font-size: clamp(1.4rem, 6.8vw, 1.8rem); }
.btn { font-size: 1.02rem; letter-spacing: .08em; line-height: 1.25; }
.emph { letter-spacing: .02em; }
.buried h2, .epilogue h2 { font-size: 1.14rem; }
.buried .last { font-size: 1.2rem; }

/* Champs de saisie : gros, centrés, et le texte saisi reste lisible */
.answer input { font-size: 1.4rem; }
.answer input::placeholder { font-size: 1.15rem; color: #8a7a5e; }
.error { font-size: 1.12rem; line-height: 1.35; }

/* Compte à rebours */
.cd-cell { min-width: 70px; }
.cd-cell b { font-size: 1.65rem; }
.cd-cell span { font-size: .8rem; letter-spacing: .1em; color: #b9a684; }

/* Pied de page : discret mais lisible */
.foot { font-size: 12.5px; }
.disclaimer { opacity: .62; }
.reset { opacity: .55; }

/* Petits écrans (iPhone SE, 320 px) */
@media (max-width: 359px) {
  html { font-size: 16px; }
  .parchment { padding: 18px 15px; }
  .success, .buried, .epilogue { padding-left: 14px; padding-right: 14px; }
  .ritual { padding-left: 14px; padding-right: 14px; }
  .cd-cell { min-width: 60px; }
  .btn { letter-spacing: .05em; padding-left: 26px; padding-right: 26px; }
  .title .t-small { letter-spacing: .2em; }
}

/* Grands téléphones */
@media (min-width: 410px) {
  html { font-size: 17.5px; }
}

/* Énigme : un vers par ligne, coupé proprement à la virgule si besoin */
.riddle .verse { display: block; }
.riddle .verse + .verse { margin-top: .35em; }
.captain-quote { margin-top: 16px !important; }

/* Pièce du trésor (remplace l'emoji 🪙) */
.coin-line-art {
  display: block;
  width: 64px;
  height: 64px;
  margin: 4px auto 10px;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .7)) drop-shadow(0 0 14px rgba(240, 200, 110, .35));
  animation: coinIdle 6s ease-in-out infinite;
}
.inline-coin {
  display: inline-block;
  width: 1.3em;
  height: 1.3em;
  vertical-align: -0.3em;
  margin-right: .15em;
  filter: drop-shadow(0 0 6px rgba(240, 200, 110, .3));
}

/* ---------- Mouvement réduit ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .journal-cover, .seal-break { display: none !important; }
}

/* ---------- Ajustements ---------- */
.nw { white-space: nowrap; display: inline-block; }
.epilogue-lock > * + * { margin-top: 10px; }
.epilogue-lock[hidden] { display: none; }
.epilogue .success { border: 0; background: none; box-shadow: none; padding: 4px 0 0; }
.epilogue .success .ok { font-size: 1.45rem; }
