:root {
  --bg: #fbf3ee;
  --paper: #fffaf7;
  --ink: #35222b;
  --muted: #8b727a;
  --line: #ecd8d9;
  --line-strong: #caa9b2;
  --rose: #d6456b;
  --rose-deep: #a8264f;
  --rose-soft: #fbe4ea;
  --plum: #5a2347;
  --gold: #b98a2f;
  --radius: 18px;
  --shadow: 0 10px 30px -18px rgba(90, 35, 71, 0.45);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 8% -8%, #f8d3dc 0, transparent 38%),
    radial-gradient(circle at 105% 18%, #f4e2d2 0, transparent 34%);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
}

.wrap { max-width: 760px; margin: 0 auto; padding-inline: 18px; padding-block: 28px 90px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0 0 0.4em; color: var(--plum); }
a { color: var(--rose-deep); }
.eyebrow { font-size: 0.76rem; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 800; color: var(--rose); margin: 0 0 0.4em; }
.lead { font-size: 1.08rem; color: var(--muted); max-width: 58ch; }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }
.center { text-align: center; }

/* ---------- accueil ---------- */
.hero { text-align: center; padding-block: 24px 10px; }
.hero h1 { font-size: clamp(2.8rem, 12vw, 4.6rem); font-style: italic; letter-spacing: -0.02em; margin-bottom: 0.15em; }
.hero .lead { margin-inline: auto; }
.progress { display: flex; justify-content: center; gap: 6px; margin-top: 14px; font-size: 1.25rem; color: var(--line-strong); }
.progress .on { color: var(--rose); }

.days { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 12px; margin-block: 24px 40px; }
.day-card {
  position: relative; display: flex; flex-direction: column; gap: 4px; min-height: 130px; padding: 16px;
  border-radius: var(--radius); background: var(--paper); border: 1px solid var(--line);
  text-decoration: none; color: inherit; box-shadow: var(--shadow); transition: transform 0.2s;
}
a.day-card:hover { transform: translateY(-3px); }
.day-card.final { grid-column: 1 / -1; min-height: 100px; }
.day-num { font-size: 0.74rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.day-title { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; color: var(--plum); line-height: 1.2; }
.day-state { margin-top: auto; font-size: 0.85rem; font-weight: 700; color: var(--muted); }
.day-card.open { border-color: var(--rose); box-shadow: 0 0 0 3px var(--rose-soft), var(--shadow); }
.day-card.open .day-state { color: var(--rose); }
.day-card.open::after { content: ""; position: absolute; top: 14px; right: 14px; width: 10px; height: 10px; border-radius: 50%; background: var(--rose); animation: pulse 1.8s infinite; }
.day-card.done { background: var(--rose-soft); border-color: transparent; }
.day-card.done .day-state { color: var(--rose-deep); }
.day-card.wait, .day-card.prev { background: transparent; border-style: dashed; border-color: var(--line-strong); box-shadow: none; }
.day-card.wait .day-title, .day-card.prev .day-title { color: var(--line-strong); letter-spacing: 0.2em; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(214, 69, 107, 0.5); }
  70% { box-shadow: 0 0 0 10px rgba(214, 69, 107, 0); }
  100% { box-shadow: 0 0 0 0 rgba(214, 69, 107, 0); }
}

.carnet { text-align: center; }

/* ---------- composants ---------- */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-block: 16px; }
.callout { background: var(--rose-soft); border-left: 4px solid var(--rose); border-radius: 12px; padding: 12px 16px; margin-block: 14px; }
.start { text-align: center; }
.big-count { font-family: var(--serif); font-size: clamp(1.6rem, 7vw, 2.2rem); color: var(--plum); margin: 0.2em 0 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4em;
  font: inherit; font-weight: 800; border: 0; border-radius: 999px; padding: 0.72em 1.35em;
  background: var(--rose); color: #fff; text-decoration: none; cursor: pointer; transition: background 0.2s, transform 0.1s;
}
.btn:hover { background: var(--rose-deep); }
.btn:active { transform: scale(0.97); }
.btn:disabled { background: var(--line-strong); cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--rose-deep); box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.btn.ghost:hover { background: var(--rose-soft); }
.btn.ghost:disabled { color: var(--muted); background: transparent; }
.btn.small { font-size: 0.86rem; padding: 0.5em 1em; }
.btn[aria-pressed="true"] { background: var(--plum); color: #fff; box-shadow: none; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-block: 12px; }

.field { font: inherit; font-size: 1.05rem; padding: 0.7em 1em; border-radius: 12px; border: 1.5px solid var(--line-strong); background: #fff; color: var(--ink); min-width: 0; flex: 1 1 180px; }
.field:focus { outline: none; border-color: var(--rose); box-shadow: 0 0 0 3px var(--rose-soft); }
.feedback { min-height: 1.5em; font-weight: 700; color: var(--rose-deep); margin: 0.6em 0 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip { font: inherit; font-weight: 800; letter-spacing: 0.06em; padding: 0.45em 0.85em; border-radius: 10px; background: var(--paper); border: 1.5px solid var(--line-strong); color: var(--plum); }
button.chip { cursor: pointer; }
button.chip:hover { border-color: var(--rose); }
.chip.empty { color: var(--line-strong); border-style: dashed; background: transparent; }
.chip.used { opacity: 0.25; }
.chips.answer { min-height: 60px; padding: 10px; border: 2px dashed var(--line-strong); border-radius: 14px; margin-block: 12px; align-items: center; }

.topnav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.back { font-weight: 700; text-decoration: none; }
.day-head h1 { font-size: clamp(2rem, 8vw, 2.8rem); font-style: italic; }

/* ---------- récompense ---------- */
.fragment-card { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 10px auto 24px; padding: 16px 30px; width: fit-content; background: var(--plum); color: #fff; border-radius: 16px; box-shadow: var(--shadow); }
.fragment-card span { font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.8; }
.fragment-card strong { font-family: var(--serif); font-size: 2rem; letter-spacing: 0.08em; }
.chapter { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(20px, 5vw, 40px); box-shadow: var(--shadow); }
.chapter h2 { font-style: italic; font-size: 1.8rem; }
.chapter p:not(.eyebrow) { font-family: var(--serif); font-size: 1.08rem; line-height: 1.8; margin: 0 0 1em; }
.chapter h2 + p::first-letter { font-size: 3.1em; float: left; line-height: 0.9; margin: 0.06em 0.1em 0 0; color: var(--rose); font-weight: 600; }
.next { text-align: center; margin-block: 22px; }

/* ---------- toast, animations ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); z-index: 60;
  background: var(--plum); color: #fff; padding: 0.7em 1.2em; border-radius: 999px; font-weight: 700;
  opacity: 0; pointer-events: none; transition: 0.3s; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.shake { animation: shake 0.4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.burst { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.burst span { position: absolute; bottom: -40px; color: var(--rose); font-size: calc(22px * var(--s)); opacity: 0; animation: rise var(--d) ease-out var(--delay) forwards; }
@keyframes rise {
  0% { transform: translate(0, 0); opacity: 0; }
  10% { opacity: 1; }
  100% { transform: translate(var(--dx), -110vh) rotate(25deg); opacity: 0; }
}

.devbar { position: fixed; left: 8px; right: 8px; bottom: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; background: #222; color: #fff; padding: 6px 10px; border-radius: 12px; font-size: 0.8rem; z-index: 70; opacity: 0.92; }
.devbar button { font: inherit; border: 0; border-radius: 8px; padding: 4px 8px; cursor: pointer; }

/* ---------- jour 1 : cryptogramme ---------- */
.crypto { display: flex; flex-wrap: wrap; gap: 16px 20px; }
.cw { display: flex; gap: 3px; }
.cc { display: flex; flex-direction: column; align-items: center; width: 26px; }
.ci {
  width: 26px; height: 34px; padding: 0; border: 0; border-bottom: 2px solid var(--ink); border-radius: 4px 4px 0 0;
  background: transparent; text-align: center; font: 800 1.15rem var(--sans); text-transform: uppercase; color: var(--plum);
}
.ci:focus { outline: none; background: var(--rose-soft); }
.cl { font: 600 0.72rem ui-monospace, Consolas, monospace; color: var(--muted); margin-top: 2px; }
.cp { font-weight: 800; font-size: 1.15rem; padding-top: 4px; color: var(--plum); }
.cc.hl .ci { background: var(--rose-soft); }
.cc.given .ci { color: var(--gold); border-bottom-color: var(--gold); }
.cc.conflict .ci { color: var(--rose); border-bottom-color: var(--rose); }
.crypto.solved .ci { color: var(--rose-deep); border-bottom-color: transparent; }
.freq-list { display: flex; flex-wrap: wrap; gap: 6px; }
.fq { display: flex; flex-direction: column; align-items: center; min-width: 34px; padding: 4px 6px; background: #fff; border: 1px solid var(--line); border-radius: 8px; font-family: ui-monospace, Consolas, monospace; }
.fq small { color: var(--muted); }
@media (max-width: 420px) {
  .cc, .ci { width: 22px; }
  .crypto { gap: 12px 14px; }
}

/* ---------- jour 2 : taquin ---------- */
.taquin { position: relative; width: min(100%, 440px); max-width: 100%; aspect-ratio: 1; margin: 0 auto; border-radius: 16px; overflow: hidden; background: #2a1233; box-shadow: var(--shadow); touch-action: manipulation; }
.tile {
  position: absolute; width: calc(100% / var(--n)); height: calc(100% / var(--n));
  left: calc(var(--x) * 100% / var(--n)); top: calc(var(--y) * 100% / var(--n));
  border: 0; padding: 0; background-image: var(--img); background-repeat: no-repeat;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35); cursor: pointer; transition: left 0.14s ease, top 0.14s ease;
}
.tile.last { opacity: 0; pointer-events: none; }
.taquin.solved .tile { box-shadow: none; cursor: default; transition: box-shadow 0.6s, opacity 0.8s; }
.taquin.solved .tile.last { opacity: 1; }
.num { display: none; position: absolute; top: 5px; left: 5px; min-width: 20px; padding: 0 5px; border-radius: 6px; background: rgba(20, 10, 25, 0.6); color: #fff; font-size: 0.75rem; font-weight: 800; }
.show-nums .num { display: block; }
.taquin.solved .num { display: none; }
.modele { display: block; width: 150px; max-width: 100%; border-radius: 10px; margin: 10px auto; box-shadow: var(--shadow); }

/* ---------- jour 3 : énigmes ---------- */
.dots { display: flex; gap: 8px; justify-content: center; margin-bottom: 8px; }
.dots span { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.dots .on { background: var(--rose); }
.dots .cur { background: var(--plum); transform: scale(1.3); }
.riddle-q { font-family: var(--serif); font-size: 1.28rem; line-height: 1.5; color: var(--plum); margin: 0.2em 0 1em; }
.answer-row { display: flex; gap: 8px; flex-wrap: wrap; }
.hint-text { font-style: italic; color: var(--plum); background: var(--rose-soft); padding: 10px 14px; border-radius: 10px; }
.found { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; margin-top: 12px; }
.found b { color: var(--rose); }

/* ---------- jour 4 : nonogramme ---------- */
.nono-scroll { overflow-x: auto; padding-bottom: 6px; }
.nono {
  --cell: clamp(17px, calc((100vw - 130px) / 15), 30px);
  display: grid; grid-template-columns: auto repeat(var(--w), var(--cell));
  width: max-content; margin: 0 auto; user-select: none; -webkit-user-select: none; touch-action: none;
}
.nc-top { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; padding-bottom: 4px; font-size: 0.72rem; font-weight: 800; line-height: 1.2; color: var(--plum); }
.nc-left { display: flex; justify-content: flex-end; align-items: center; gap: 6px; padding-right: 6px; font-size: 0.72rem; font-weight: 800; color: var(--plum); }
.nc-top.ok, .nc-left.ok { color: var(--line-strong); }
.cell { width: var(--cell); height: var(--cell); position: relative; background: #fff; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); cursor: pointer; }
.cell.x0 { border-left: 2px solid var(--line-strong); }
.cell.y0 { border-top: 2px solid var(--line-strong); }
.cell.bx { border-right: 2px solid var(--line-strong); }
.cell.by { border-bottom: 2px solid var(--line-strong); }
.cell.f { background: var(--ink); }
.cell.x::after { content: "✕"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--line-strong); font-size: calc(var(--cell) * 0.55); }
.cell.err { background: #f59a9a !important; }
.nono.solved .cell { border-color: transparent; cursor: default; }
.nono.solved .cell.f { background: var(--rose); transition: background 0.8s; }
.nono.solved .cell.x::after { content: none; }

/* ---------- jour 5 : coffre (mastermind) ---------- */
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.9rem; align-items: center; }
.legend .peg { display: inline-block; vertical-align: middle; margin-right: 4px; }
.mm { display: flex; flex-direction: column; gap: 4px; }
.mm-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px; }
.mm-row.cur { background: var(--rose-soft); }
.mm-row.code { background: var(--plum); }
.mm-num { width: 1.6em; text-align: right; font-weight: 800; color: var(--muted); font-size: 0.85rem; }
.slots { display: flex; gap: 6px; }
.slot { width: 42px; height: 42px; border-radius: 50%; border: 2px dashed var(--line-strong); background: #fff; font-size: 1.3rem; display: grid; place-items: center; padding: 0; line-height: 1; color: inherit; }
.slot.filled { border-style: solid; border-color: var(--line); }
.mm-row.cur .slot.filled { cursor: pointer; }
.pegs { display: grid; grid-template-columns: repeat(3, 11px); gap: 4px; margin-left: auto; }
.peg { width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid var(--line-strong); }
.peg.b { background: var(--rose); border-color: var(--rose); }
.peg.w { border: 2.5px solid var(--rose); }
.palette { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.sym { width: 50px; height: 50px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff; font-size: 1.5rem; cursor: pointer; padding: 0; }
.sym:hover { border-color: var(--rose); }
.sym.used { opacity: 0.3; }
@media (max-width: 400px) {
  .slot { width: 36px; height: 36px; font-size: 1.1rem; }
  .slots { gap: 4px; }
  .mm-row { gap: 6px; padding: 6px; }
  .sym { width: 44px; height: 44px; }
}

/* ---------- jour 6 : labyrinthe ---------- */
.maze-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; }
canvas.maze { display: block; max-width: 100%; border-radius: 16px; background: #140e1b; box-shadow: var(--shadow); touch-action: none; }
.dpad { display: grid; grid-template-areas: ". haut ." "gauche . droite" ". bas ."; grid-template-columns: repeat(3, 58px); grid-template-rows: repeat(3, 58px); gap: 6px; }
.dp { border: 0; border-radius: 16px; background: var(--plum); color: #fff; font-size: 1.3rem; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; }
.dp:active { background: var(--rose); }
.dp.haut { grid-area: haut; } .dp.bas { grid-area: bas; } .dp.gauche { grid-area: gauche; } .dp.droite { grid-area: droite; }
@media (hover: hover) and (pointer: fine) { .dpad { display: none; } }

/* ---------- jour 7 : serrures & lettre ---------- */
.q { border: 0; padding: 0; margin: 0 0 18px; }
.q legend { font-weight: 800; color: var(--plum); margin-bottom: 4px; }
.opt { display: flex; gap: 10px; align-items: center; padding: 0.6em 0.9em; border: 1.5px solid var(--line); border-radius: 12px; margin-top: 6px; cursor: pointer; background: #fff; }
.opt:has(input:checked) { border-color: var(--rose); background: var(--rose-soft); }
.opt input { accent-color: var(--rose); }
.reread { margin-block: 18px; }
.reread > summary { cursor: pointer; font-weight: 800; color: var(--rose-deep); }
.reread-ch { margin: 10px 0; padding: 10px 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; }
.reread-ch summary { cursor: pointer; font-weight: 700; }
.reread-ch p { font-family: var(--serif); }

.finale { display: flex; flex-direction: column; align-items: center; gap: 18px; padding-block: 20px; }
.envelope {
  position: relative; width: min(330px, 100%); aspect-ratio: 3 / 2; border: 0; padding: 0; border-radius: 10px;
  background: #efc3cd; cursor: pointer; overflow: hidden; box-shadow: 0 24px 40px -24px rgba(90, 35, 71, 0.6);
  transition: transform 0.5s, opacity 0.5s 0.4s; animation: float 3s ease-in-out infinite;
}
.envelope::after { content: ""; position: absolute; inset: 0; background: #f6d7de; clip-path: polygon(0 100%, 50% 48%, 100% 100%); }
.envelope::before { content: ""; position: absolute; inset: 0; background: #e5a7b7; clip-path: polygon(0 0, 100% 0, 50% 60%); transform-origin: top; transition: transform 0.6s; z-index: 1; }
.seal { position: absolute; left: 50%; top: 60%; transform: translate(-50%, -50%); width: 54px; height: 54px; border-radius: 50%; background: var(--rose-deep); color: #fff; display: grid; place-items: center; font-size: 1.5rem; z-index: 2; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2); transition: opacity 0.2s; }
.envelope.open { animation: none; opacity: 0; transform: translateY(-20px) scale(0.95); }
.envelope.open::before { transform: scaleY(-1); }
.envelope.open .seal { opacity: 0; }
@keyframes float { 50% { transform: translateY(-6px); } }

.letter {
  width: 100%; max-width: 620px; background: #fffdf8; border-radius: 6px; padding: clamp(24px, 6vw, 48px);
  box-shadow: 0 30px 60px -30px rgba(90, 35, 71, 0.5);
  font-family: var(--hand); font-size: clamp(1.35rem, 4.6vw, 1.65rem); line-height: 1.45; color: #2d1f33;
}
.letter p { margin: 0 0 0.8em; opacity: 0; animation: appear 1s ease forwards; animation-delay: calc(var(--i) * 1.4s + 0.3s); }
.letter .signature { text-align: right; font-size: 1.3em; color: var(--rose-deep); margin: 0; }
.late { opacity: 0; animation: appear 1s ease forwards; display: flex; flex-direction: column; align-items: center; gap: 12px; }
@keyframes appear { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* =====================================================================
   Application mobile, animations, secrets
   ===================================================================== */
body { -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
button, a { touch-action: manipulation; }
body.no-scroll { overflow: hidden; }
.wrap { position: relative; z-index: 1; padding-top: max(28px, env(safe-area-inset-top)); padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
.toast { bottom: calc(24px + env(safe-area-inset-bottom)); transition: opacity 0.3s, transform 0.45s cubic-bezier(0.3, 1.5, 0.5, 1); }

/* fond : cœurs qui flottent */
.ambiance { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.ambiance span { position: absolute; bottom: -40px; color: var(--rose); opacity: var(--o); font-size: calc(18px * var(--s)); animation: flotte var(--d) linear var(--delay) infinite; }
@keyframes flotte {
  0% { transform: translate(0, 0) rotate(0); }
  50% { transform: translate(24px, -55vh) rotate(20deg); }
  100% { transform: translate(-10px, -115vh) rotate(-10deg); }
}

/* entrée des pages */
.entree > * { animation: vueIn 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) backwards; animation-delay: calc(var(--k, 0) * 70ms); }
@keyframes vueIn { from { opacity: 0; transform: translateY(18px); } }

.hero h1 {
  background: linear-gradient(100deg, var(--plum) 0%, var(--plum) 40%, var(--rose) 50%, var(--plum) 60%, var(--plum) 100%);
  background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: brille 6s ease-in-out infinite; padding-inline: 0.12em;
}
@keyframes brille { 0% { background-position: 100% 0; } 60%, 100% { background-position: 0 0; } }
.progress span { display: inline-block; animation: pop 0.5s cubic-bezier(0.3, 1.6, 0.5, 1) backwards; animation-delay: calc(var(--i) * 80ms + 0.3s); }
@keyframes pop { from { transform: scale(0); opacity: 0; } }
.day-card { animation: carteIn 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) backwards; animation-delay: calc(var(--i) * 60ms + 0.15s); }
@keyframes carteIn { from { opacity: 0; transform: translateY(16px) scale(0.96); } }
.btn { transition: background 0.2s, transform 0.15s, box-shadow 0.2s; }
.fragment-card { animation: flipIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) 0.35s backwards; }
@keyframes flipIn { from { opacity: 0; transform: perspective(600px) rotateY(100deg) scale(0.8); } }
.chapter > * { animation: apparait 0.7s ease backwards; animation-delay: calc(var(--i, 0) * 110ms + 0.6s); }
@keyframes apparait { from { opacity: 0; transform: translateY(10px); } }
.dots .cur { animation: pouls 1.6s ease-in-out infinite; }
@keyframes pouls { 50% { transform: scale(1.6); } }
.cell.f { animation: pop 0.18s ease-out; }
.taquin.solved { animation: lueur 1.4s ease; }
@keyframes lueur { 50% { box-shadow: 0 0 0 8px var(--rose-soft), 0 0 40px 10px rgba(214, 69, 107, 0.4); } }
.crypto.solved { animation: lueurTexte 1.4s ease; }
@keyframes lueurTexte { 50% { transform: scale(1.02); } }
.psst { text-align: center; font-family: var(--hand); font-size: 1.45rem; color: var(--rose-deep); margin: 18px 0 0; animation: apparait 1s ease 2.2s backwards; }

/* mots secrets qui scintillent */
.secret-word {
  font: inherit; border: 0; padding: 0; margin: 0; cursor: pointer; color: var(--ink);
  background: linear-gradient(100deg, var(--ink) 40%, #e9a93b 50%, var(--ink) 60%);
  background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  animation: scintille 4.5s ease-in-out infinite;
}
.signature .secret-word { background-image: linear-gradient(100deg, var(--rose-deep) 40%, #e9a93b 50%, var(--rose-deep) 60%); }
@keyframes scintille { 0%, 55% { background-position: 100% 0; } 85%, 100% { background-position: 0 0; } }

/* le chat du jour 3 qui passe la tête */
.chat-peek, .entree > .chat-peek {
  position: fixed; right: -64px; bottom: calc(150px + env(safe-area-inset-bottom)); z-index: 20;
  font-size: 56px; line-height: 1; border: 0; background: none; padding: 0; cursor: pointer;
  animation: coucou 8s ease-in-out 2.5s infinite;
}
@keyframes coucou {
  0%, 62%, 100% { transform: translateX(0); }
  68%, 86% { transform: translateX(-72px) rotate(-12deg); }
  77% { transform: translateX(-66px) rotate(-4deg); }
}

/* fenêtre qui monte du bas */
.sheet-fond { position: fixed; inset: 0; z-index: 80; background: rgba(40, 18, 34, 0.55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); display: flex; align-items: flex-end; justify-content: center; animation: fondu 0.25s ease backwards; }
.sheet-fond.sortie { opacity: 0; transition: opacity 0.25s; }
.sheet { position: relative; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; background: var(--bg); border-radius: 24px 24px 0 0; padding: 26px 18px calc(24px + env(safe-area-inset-bottom)); animation: monte 0.45s cubic-bezier(0.2, 0.9, 0.25, 1) backwards; }
.sheet h2 { font-style: italic; padding-right: 44px; }
.sheet-close { position: absolute; top: 14px; right: 14px; width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--rose-soft); color: var(--plum); font-size: 1rem; cursor: pointer; }
@media (min-width: 640px) { .sheet-fond { align-items: center; } .sheet { border-radius: 24px; } }
@keyframes fondu { from { opacity: 0; } }
@keyframes monte { from { transform: translateY(100%); } }
.big-emoji { font-size: 3.5rem; margin: 0; animation: pop 0.5s cubic-bezier(0.3, 1.6, 0.5, 1); }
.secret-fin { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-block: 16px; }
.suivi { padding-left: 1.2em; }
.suivi li { margin: 0.35em 0; }

/* bons cadeaux */
.coupon { position: relative; display: flex; align-items: stretch; margin: 14px auto; max-width: 420px; background: #fff; border-radius: 16px; box-shadow: 0 18px 40px -20px rgba(90, 35, 71, 0.55); overflow: hidden; animation: couponIn 0.9s cubic-bezier(0.2, 0.9, 0.25, 1.2) backwards; text-align: left; }
.coupon::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, 0.75) 50%, transparent 65%); transform: translateX(-100%); animation: reflet 3s ease-in-out 1s infinite; pointer-events: none; }
.coupon-emoji { display: grid; place-items: center; min-width: 92px; font-size: 2.8rem; background: var(--rose); border-right: 3px dashed #fff; }
.coupon-corps { padding: 14px 16px; }
.coupon-corps h3 { font-size: 1.35rem; margin: 0 0 0.2em; }
.coupon-corps p { margin: 0 0 0.3em; }
.coupon-pied { font-size: 0.75rem; color: var(--muted); margin-top: 0.6em !important; }
@keyframes couponIn { 0% { opacity: 0; transform: translateY(40px) rotate(-8deg) scale(0.6); } 60% { opacity: 1; transform: translateY(-6px) rotate(2deg) scale(1.03); } }
@keyframes reflet { 0% { transform: translateX(-100%); } 40%, 100% { transform: translateX(100%); } }

/* trésors (accueil) */
.tresors { text-align: center; margin-top: 44px; }
.tresor-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-block: 14px 8px; }
.tresor { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 100px; padding: 10px 6px; border-radius: 16px; border: 1.5px dashed var(--line-strong); color: var(--muted); text-decoration: none; font: inherit; background: transparent; animation: carteIn 0.5s backwards; animation-delay: calc(var(--i) * 60ms + 0.2s); }
.tresor-emoji { font-size: 1.8rem; display: inline-block; }
.tresor-nom { font-size: 0.78rem; font-weight: 700; line-height: 1.2; }
a.tresor { color: var(--rose-deep); border-color: var(--rose); }
a.tresor .tresor-emoji { animation: scintilleEmoji 2.4s ease-in-out infinite; }
.tresor.gagne { background: #fff; border: 1.5px solid var(--gold); color: var(--plum); cursor: pointer; box-shadow: var(--shadow); }
@keyframes scintilleEmoji { 50% { transform: scale(1.2) rotate(12deg); } }
.cloud { margin-top: 36px; }

/* bannière d'installation */
.install { display: flex; gap: 14px; align-items: flex-start; border-color: var(--rose); }
.install-icone { font-size: 2rem; animation: wiggle 2.5s ease-in-out infinite; }
.install p { margin: 0.2em 0 0; }
@keyframes wiggle { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-12deg); } 90% { transform: rotate(10deg); } 95% { transform: rotate(-6deg); } }

/* ----- mini-jeux secrets ----- */
.secret-zone { margin-top: 8px; }
.sg-hud { text-align: center; font-weight: 800; color: var(--plum); margin: 0 0 10px; }
.sg-gros { width: 100%; font-size: 1.1rem; padding: 1em; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.sg-gros.tap { animation: tap 0.15s; }
@keyframes tap { 50% { transform: scale(0.95); } }

.sg-aire { position: relative; height: min(56vh, 420px); border-radius: 18px; overflow: hidden; background: linear-gradient(#fff, var(--rose-soft)); border: 1px solid var(--line); touch-action: none; }
.sg-aire::after { content: "🗑️"; position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%); font-size: 2rem; opacity: 0.45; }
.sg-boule, .sg-lettre { position: absolute; top: 0; margin-left: -28px; width: 56px; height: 56px; border: 0; padding: 0; cursor: pointer; background: none; font-size: 2.2rem; will-change: transform; }
.sg-boule::before { content: ""; position: absolute; inset: 9px; border-radius: 45% 55% 50% 45%; background: radial-gradient(circle at 35% 30%, #fff, #d9ccc8 72%); box-shadow: inset -3px -4px 0 rgba(0, 0, 0, 0.08), 0 3px 6px rgba(0, 0, 0, 0.14); }
.pouf { opacity: 0 !important; transition: opacity 0.2s; }

.sg-simon { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 320px; margin: 0 auto; }
.sg-pad { aspect-ratio: 1; border: 0; border-radius: 28px; font-size: 3rem; cursor: pointer; background: #fff; color: inherit; box-shadow: var(--shadow); transition: transform 0.12s, background 0.12s, box-shadow 0.12s; }
.sg-pad:nth-child(1) { border-top-left-radius: 90px; }
.sg-pad:nth-child(2) { border-top-right-radius: 90px; }
.sg-pad:nth-child(3) { border-bottom-left-radius: 90px; }
.sg-pad:nth-child(4) { border-bottom-right-radius: 90px; }
.sg-pad:disabled { cursor: default; }
.sg-pad.on { background: var(--rose-soft); transform: scale(1.06); box-shadow: 0 0 0 4px var(--rose), 0 0 30px 6px rgba(214, 69, 107, 0.45); }
.sg-gerard { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 70px; height: 70px; border-radius: 50%; background: var(--bg); display: grid; place-items: center; font-size: 2.3rem; pointer-events: none; }

.sg-chat { font-size: 6rem; text-align: center; line-height: 1.15; transition: transform 0.2s; }
.sg-chat.alerte { animation: frisson 0.15s infinite; }
.sg-chat.regarde { transform: scale(1.2); }
@keyframes frisson { 50% { transform: translateX(3px) rotate(4deg); } }
.sg-jauge { height: 16px; border-radius: 999px; background: var(--line); overflow: hidden; margin-block: 8px 16px; }
.sg-jauge span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--rose), var(--gold)); transition: width 0.15s; }

.sg-memo { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; max-width: 360px; margin: 0 auto; }
.sg-carte { position: relative; aspect-ratio: 3 / 4; border: 0; padding: 0; background: none; cursor: pointer; perspective: 600px; }
.sg-carte span { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 12px; backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: transform 0.4s; font-size: 2rem; }
.sg-carte .dos { background: var(--plum); color: #fff; font-weight: 800; font-size: 1.4rem; }
.sg-carte .face { background: #fff; transform: rotateY(180deg); box-shadow: inset 0 0 0 2px var(--line); }
.sg-carte.open .dos { transform: rotateY(-180deg); }
.sg-carte.open .face { transform: rotateY(0); }
.sg-carte.ok .face { box-shadow: inset 0 0 0 3px var(--rose); background: var(--rose-soft); }

.sg-table { position: relative; height: 210px; max-width: 360px; margin: 0 auto; --duree: 400ms; background: radial-gradient(ellipse at 50% 82%, #f1d9b8 0 46%, transparent 47%); }
.sg-gob, .sg-galet { position: absolute; transition: left var(--duree) ease-in-out, transform 0.3s ease; }
.sg-gob { bottom: 36px; width: 92px; height: 84px; left: calc(var(--slot, 0) * 33.333% + 16.666% - 46px); border: 0; padding: 0; cursor: pointer; z-index: 1; border-radius: 50% 50% 16px 16px / 80% 80% 16px 16px; background: repeating-linear-gradient(90deg, #f7cdb4 0 11px, #eba98a 11px 22px); box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.08), 0 8px 14px -8px rgba(0, 0, 0, 0.4); }
.sg-gob:disabled { cursor: default; }
.sg-gob.haut { transform: translateY(-18px) scale(0.94); z-index: 0; }
.sg-gob.bas { transform: translateY(10px) scale(1.05); z-index: 2; }
.sg-gob.leve { transform: translateY(-84px) rotate(-6deg); }
.sg-galet { bottom: 40px; width: 46px; height: 30px; left: calc(var(--slot, 0) * 33.333% + 16.666% - 23px); border-radius: 50%; background: radial-gradient(circle at 35% 30%, #e7e2dc, #9a918a 75%); box-shadow: 0 3px 4px rgba(0, 0, 0, 0.25); z-index: 0; }

.sg-bar { position: relative; width: 140px; margin: 10px auto 22px; }
.sg-bar::after { content: ""; position: absolute; right: -36px; top: 34px; width: 36px; height: 64px; border: 8px solid var(--plum); border-left: 0; border-radius: 0 32px 32px 0; }
.sg-tasse { position: relative; height: 170px; border: 8px solid var(--plum); border-top: 0; border-radius: 0 0 46px 46px; background: #fff; overflow: hidden; }
.sg-cafe { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: linear-gradient(#b27a4a, #5b3a22 60%); }
.sg-cafe::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 8px; background: #d8a877; }
.sg-cafe.ok::before { background: #f7e0b5; }
.sg-cafe.rate { background: linear-gradient(#c0584f, #5b2a22); }
.sg-cible { position: absolute; left: 0; right: 0; z-index: 2; background: rgba(233, 169, 59, 0.28); border-block: 2px dashed #d99a2b; }

.sg-ciel { position: relative; width: min(100%, 360px); aspect-ratio: 1; margin: 0 auto; border-radius: 18px; overflow: hidden; background: radial-gradient(circle at 50% 40%, #3a2561, #120d25); }
.sg-lignes { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.sg-lignes line { stroke: #ff9fbd; stroke-width: 0.8; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: trace 0.35s forwards; }
.sg-ciel.fini .sg-lignes line { stroke: #ffd1df; stroke-width: 1.2; }
@keyframes trace { to { stroke-dashoffset: 0; } }
.sg-poussiere { position: absolute; width: 2px; height: 2px; background: #fff; border-radius: 50%; opacity: 0.5; animation: twinkle 3s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: 0.1; } }
.sg-etoile { position: absolute; width: 38px; height: 38px; margin: -19px 0 0 -19px; border: 0; padding: 0; background: transparent; cursor: pointer; z-index: 1; }
.sg-etoile::before { content: ""; position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px; border-radius: 50%; background: #fff; box-shadow: 0 0 8px 2px rgba(255, 255, 255, 0.55); transition: background 0.2s, box-shadow 0.2s, transform 0.2s; }
.sg-etoile span { position: absolute; left: 50%; top: -6px; transform: translateX(-50%); font-size: 0.72rem; font-weight: 800; color: #ffd9e5; transition: opacity 0.6s; }
.sg-ciel.cache .sg-etoile span { opacity: 0; }
.sg-etoile.on::before { background: #ff8fb1; box-shadow: 0 0 14px 5px rgba(255, 79, 126, 0.8); transform: scale(1.3); }
.sg-etoile.faux::before { background: #ff5a5a; transform: scale(1.6); }
.sg-ciel.fini { animation: lueur 1.4s ease; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition: none !important; }
  .chat-peek, .entree > .chat-peek { transform: translateX(-40px); }
}
