:root {
  --navy: #1d3557;
  --teal: #2ec4b6;
  --orange: #ff9f1c;
  --yellow: #ffd166;
  --green: #6cc551;
  --coral: #e76f51;
  --cream: #fffaf0;
  --ice: #eaf6ff;
  --radius: 22px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #cfe9f5; }
body {
  font-family: 'Fredoka', system-ui, sans-serif;
  color: var(--navy);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
#world { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
.hidden { display: none !important; }

/* ---------- boutons ---------- */
.btn {
  font: 600 18px 'Fredoka', sans-serif;
  color: var(--navy);
  background: var(--yellow);
  border: 3px solid var(--navy);
  border-radius: 16px;
  padding: 10px 22px;
  box-shadow: 0 5px 0 var(--navy);
  cursor: pointer;
  transition: transform .08s, box-shadow .08s, background .15s;
}
.btn:hover { background: #ffdb85; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--navy); }
.btn:disabled { background: #d5dce6; color: #6b7a90; cursor: not-allowed; }
.btn:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }
.btn-ghost { background: #fff; }
.btn-ghost:hover { background: var(--ice); }
.btn-big { font-size: 22px; padding: 14px 30px; }
.btn-small { font-size: 15px; padding: 6px 14px; box-shadow: 0 3px 0 var(--navy); }
.icon-btn {
  width: 44px; height: 44px;
  border-radius: 14px; border: 3px solid var(--navy);
  background: #fff; font-size: 20px; cursor: pointer;
  box-shadow: 0 3px 0 var(--navy);
}
.icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--navy); }

/* ---------- HUD ---------- */
.hud {
  position: fixed; top: 16px; left: 16px; right: 16px;
  display: flex; justify-content: space-between; align-items: center;
  pointer-events: none;
}
.hud > * { pointer-events: auto; }
.brand {
  font-size: 26px; font-weight: 700;
  background: #fff; border: 3px solid var(--navy); border-radius: 16px;
  padding: 4px 16px; box-shadow: 0 4px 0 var(--navy);
}
.hud-right { display: flex; gap: 10px; align-items: center; }
.pill {
  font-weight: 600; font-size: 18px;
  background: #fff; border: 3px solid var(--navy); border-radius: 999px;
  padding: 6px 16px; box-shadow: 0 3px 0 var(--navy);
}

/* ---------- panneau du jour ---------- */
.panel {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  display: grid; grid-template-columns: 1fr auto; gap: 4px 20px; align-items: center;
  width: min(560px, calc(100vw - 32px));
  background: var(--cream); border: 3px solid var(--navy); border-radius: var(--radius);
  padding: 14px 18px; box-shadow: 0 6px 0 var(--navy);
}
.panel-day { font-size: 22px; font-weight: 700; }
.panel-info { font-size: 16px; color: #3d5577; }
.panel-info::first-letter { text-transform: uppercase; }
.panel-keys { grid-column: 1 / -1; font-size: 13px; color: #7a8ca6; }
.panel.nope { animation: shake .4s; }

/* ---------- overlays ---------- */
.overlay {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: rgba(29, 53, 87, .45);
  backdrop-filter: blur(3px);
  padding: 16px;
}
.title-screen { background: linear-gradient(180deg, #8fd3f4 0%, #e9f7ff 70%, #fff 100%); }
.title-card { text-align: center; max-width: 560px; }
.title-card h1 {
  font-size: clamp(48px, 9vw, 88px); margin: 0; line-height: 1;
  color: #fff; -webkit-text-stroke: 3px var(--navy);
  text-shadow: 0 6px 0 var(--navy);
  letter-spacing: 1px;
}
#title-hero { width: 200px; height: 200px; }
#title-sub { font-size: 20px; font-weight: 500; margin: 18px 0 24px; }
.title-hint { color: #4c6385; margin-top: 22px; }

.modal-card {
  position: relative; overflow: hidden;
  width: min(800px, 100%); max-height: calc(100vh - 32px); overflow-y: auto;
  background: var(--cream); border: 3px solid var(--navy); border-radius: 26px;
  box-shadow: 0 8px 0 var(--navy);
  padding: 22px 26px 26px;
  animation: pop .25s cubic-bezier(.3, 1.4, .6, 1);
}
.modal-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.modal-kicker { font-size: 14px; font-weight: 600; color: var(--teal); text-transform: uppercase; letter-spacing: 1px; }
.modal-head h2 { margin: 2px 0 4px; font-size: 30px; }
.modal-head p { margin: 0; color: #3d5577; }
.modal-body { margin-top: 18px; }
.modal-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 22px; }
.game-status { text-align: center; margin-top: 14px; font-weight: 600; font-size: 17px; min-height: 24px; }
.game-canvas {
  display: block; width: 100%; height: auto; margin: 0 auto;
  border: 3px solid var(--navy); border-radius: 18px; background: #fff;
}
.big-emoji { font-size: 90px; text-align: center; animation: bounce 1.2s infinite; }
.wobble { animation: wobble 1s infinite; }
.confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* ---------- récompense ---------- */
.reward { text-align: center; }
.reward-gift { font-size: 84px; animation: bounce 1.2s infinite; }
.reward-line { font-size: 20px; margin: 8px 0 12px; }
.reward-big {
  display: inline-block; font-size: 38px; font-weight: 700; letter-spacing: 3px;
  background: #fff; border: 3px dashed var(--navy); border-radius: 18px;
  padding: 10px 28px;
}
.reward-big.emoji { font-size: 72px; padding: 6px 30px; }
.reward-note { font-size: 17px; color: var(--coral); font-weight: 600; margin-top: 16px; }
.reward-final { font-size: 22px; font-weight: 600; margin-top: 16px; }

/* ---------- memory ---------- */
.mem-grid { display: grid; gap: 12px; max-width: 560px; margin: 0 auto; }
.mem-card {
  position: relative; aspect-ratio: 1; border: 0; padding: 0; background: none; cursor: pointer;
  perspective: 600px;
}
.mem-card span {
  position: absolute; inset: 0; display: grid; place-items: center;
  border: 3px solid var(--navy); border-radius: 16px;
  backface-visibility: hidden; transition: transform .35s;
  font-size: clamp(28px, 5vw, 44px);
}
.mem-back { background: var(--teal); color: #fff; box-shadow: inset 0 -5px 0 rgba(0,0,0,.12); }
.mem-front { background: #fff; transform: rotateY(180deg); }
.mem-card.flipped .mem-back { transform: rotateY(180deg); }
.mem-card.flipped .mem-front { transform: rotateY(360deg); }
.mem-card.matched .mem-front { background: #fff3cf; }
.mem-card:hover:not(.flipped) .mem-back { background: #3dd3c5; }

/* ---------- taquin ---------- */
.slide-wrap { display: flex; gap: 24px; justify-content: center; align-items: flex-start; flex-wrap: wrap; }
.slide-board {
  position: relative; border: 3px solid var(--navy); border-radius: 14px; background: #d5e6f0;
  box-sizing: content-box; overflow: hidden;
}
.slide-tile {
  position: absolute; left: 0; top: 0; cursor: pointer;
  border: 1.5px solid rgba(29,53,87,.5);
  transition: transform .15s ease-out;
}
.slide-tile span {
  position: absolute; top: 4px; left: 6px; font-size: 13px; font-weight: 700;
  background: rgba(255,255,255,.85); border-radius: 6px; padding: 0 5px;
}
.slide-board.solved .slide-tile { border-color: transparent; }
.slide-board.solved .slide-tile span { display: none; }
.slide-preview {
  width: 120px; height: 120px; background-size: cover;
  border: 3px solid var(--navy); border-radius: 12px;
}

/* ---------- simon ---------- */
.simon-grid { display: grid; grid-template-columns: repeat(2, 150px); gap: 16px; justify-content: center; }
.simon-pad {
  position: relative; height: 150px; border-radius: 26px; border: 3px solid var(--navy);
  background: var(--c); cursor: pointer; font-size: 52px;
  box-shadow: 0 6px 0 var(--navy); filter: saturate(.55) brightness(.92);
  transition: filter .1s, transform .1s;
}
.simon-pad small { position: absolute; bottom: 8px; right: 12px; font: 600 16px 'Fredoka', sans-serif; color: var(--navy); }
.simon-pad.lit { filter: saturate(1.2) brightness(1.15); transform: scale(1.05); }

/* ---------- mot mystère ---------- */
.word-wrap { text-align: center; }
.word-clue { font-size: 18px; margin-bottom: 18px; }
.word-clue span { font-size: 30px; vertical-align: middle; }
.word-slots, .word-tiles { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 18px; }
.word-slot, .word-tile {
  width: 52px; height: 58px; border-radius: 14px; border: 3px solid var(--navy);
  font: 700 28px 'Fredoka', sans-serif; color: var(--navy); cursor: pointer;
}
.word-slot { background: #fff; border-style: dashed; }
.word-slot.filled { border-style: solid; background: var(--ice); }
.word-slots.correct .word-slot { background: #c9f2cf; }
.word-slots.shake { animation: shake .4s; }
.word-tile { background: var(--yellow); box-shadow: 0 4px 0 var(--navy); }
.word-tile.used { visibility: hidden; }
.word-tools { display: flex; gap: 10px; justify-content: center; }

/* ---------- animations ---------- */
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes wobble { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
@keyframes shake {
  0%, 100% { translate: 0; } 20% { translate: -10px; } 40% { translate: 10px; }
  60% { translate: -6px; } 80% { translate: 6px; }
}
@media (max-width: 640px) {
  .panel { grid-template-columns: 1fr; }
  .simon-grid { grid-template-columns: repeat(2, 120px); }
  .simon-pad { height: 120px; }
  .brand { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* =================== Escape game =================== */
.icon-btn.wide { width: auto; padding: 0 14px; font: 600 16px 'Fredoka', sans-serif; color: var(--navy); }
.title-kicker { font-size: 16px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; color: #3d5577; margin-bottom: 8px; }
.modal-card.boss { border-color: var(--coral); box-shadow: 0 8px 0 var(--coral); }
.modal-card.finale { background: #10163a; color: #e8ecff; }
.modal-card.finale h2, .modal-card.finale .story { color: #e8ecff; }
.story { font-size: 17px; line-height: 1.55; margin: 0 0 16px; color: #2b4266; }
.story.center, .center { text-align: center; }
.story.outro { background: #fff; border-left: 5px solid var(--teal); padding: 12px 16px; border-radius: 10px; }
.finale .story.outro { background: rgba(255,255,255,.08); }
.final-msg { text-align: center; font-size: 22px; font-weight: 600; color: var(--yellow); }
.muted { color: #7a8ca6; }

.doc-wrap { margin: 6px 0 18px; }
.doc {
  background: #fbf5e6; border: 2px solid #d9cba6; border-radius: 6px;
  padding: 16px 20px; box-shadow: 2px 3px 0 rgba(0,0,0,.08);
  font-family: 'Special Elite', 'Courier New', monospace; font-size: 17px; line-height: 1.6; color: #3a3226;
}
.doc.typed { letter-spacing: 2px; text-align: center; font-size: 19px; }
.doc.morse { font-size: 26px; letter-spacing: 1px; }
.doc.plaque { text-align: center; background: linear-gradient(135deg, #e8b27a, #c98a4b); color: #3a2410; border-color: #8a5a2b; }
.doc.eq { text-align: center; font-size: 24px; line-height: 1.7; }
.doc.letter { font-style: italic; }
.doc-note { font-size: 16px; color: #3d5577; margin: 12px 0 0; }
table.doc { border-collapse: collapse; width: 100%; }
table.doc td, table.doc th { padding: 6px 10px; border-bottom: 1px dashed #d9cba6; text-align: left; }
table.doc.lock td:first-child { font-size: 22px; letter-spacing: 6px; white-space: nowrap; font-weight: bold; }
table.doc.grid5, table.doc.sky { width: auto; margin: 0 auto 12px; }
table.doc.grid5 td, table.doc.grid5 th { text-align: center; width: 40px; font-size: 20px; border: 1px solid #d9cba6; }
table.doc.sky { background: #1a2350; color: #dfe6ff; border-color: #3b4a8a; font-family: 'Fredoka', sans-serif; }
table.doc.sky td, table.doc.sky th { text-align: center; font-size: 13px; border: 1px solid #34437e; padding: 6px 4px; min-width: 70px; line-height: 1.2; }
table.doc.sky th { color: #9fb0e8; }
table.doc.sky td.glow { background: rgba(255, 209, 102, .35); box-shadow: inset 0 0 0 2px var(--yellow); }
ol.doc.clues { padding-left: 42px; margin-top: 10px; }
.doc.lamps { text-align: center; font-size: 34px; letter-spacing: 6px; font-family: 'Fredoka', sans-serif; transition: transform .6s; }
.doc.lamps.mirrored { transform: scaleX(-1); }
.visual { display: flex; justify-content: center; margin: 4px 0 16px; }
.clock { width: 220px; height: 220px; }
.tool { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 14px; }
.tool-out { margin: 0; font-size: 16px; text-align: center; }

.answer { background: #fff; border: 3px solid var(--navy); border-radius: 18px; padding: 14px 16px; margin: 8px 0 14px; }
.answer label { display: block; font-weight: 600; font-size: 18px; margin-bottom: 8px; }
.answer-row { display: flex; gap: 10px; }
.answer input {
  flex: 1; min-width: 0; font: 600 22px 'Fredoka', sans-serif; letter-spacing: 2px; color: var(--navy);
  border: 3px solid var(--navy); border-radius: 14px; padding: 8px 14px; background: var(--ice);
  user-select: text;
}
.answer input:focus { outline: 3px solid var(--teal); outline-offset: 2px; }
.answer-fb { min-height: 22px; margin-top: 8px; color: var(--coral); font-weight: 600; }
.answer.shake { animation: shake .4s; }
.hints { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.hint { background: #fff8e1; border: 2px dashed var(--orange); border-radius: 12px; padding: 8px 12px; font-size: 16px; }
.btn.btn-small:disabled { box-shadow: 0 3px 0 #9aa7ba; }
.solved-answer { text-align: center; font-size: 18px; }

.gains { display: flex; flex-direction: column; gap: 10px; margin: 0 0 18px; }
.gain { display: flex; gap: 12px; align-items: center; background: #fff; border: 2px solid var(--navy); border-radius: 14px; padding: 10px 14px; }
.gain-ico { font-size: 32px; }
.reward { background: #fff; border: 3px solid var(--navy); border-radius: 18px; padding: 14px; color: var(--navy); }
.reward-title { font-weight: 700; font-size: 18px; }
.aurora { display: block; width: 100%; max-width: 700px; margin: 0 auto 16px; border-radius: 16px; border: 3px solid #3b4a8a; }

.carnet-sec { margin-bottom: 20px; }
.carnet-sec h3 { margin: 0 0 10px; font-size: 20px; }
.carnet-sec .gain { margin-bottom: 8px; }
.frag { font-family: 'Special Elite', monospace; background: #fbf5e6; border: 1px solid #d9cba6; border-radius: 6px; padding: 8px 12px; margin-bottom: 6px; }
.frag-day { display: inline-block; font-family: 'Fredoka', sans-serif; font-weight: 700; background: var(--navy); color: #fff; border-radius: 6px; padding: 0 6px; margin-right: 6px; font-size: 13px; }
.morse-table, .periodic { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; }
.morse-table span, .periodic span { background: #fff; border: 2px solid #cfd8e6; border-radius: 8px; padding: 4px 8px; font-size: 16px; }
.periodic span { text-align: center; font-weight: 700; font-size: 18px; }
.periodic small { display: block; font-weight: 400; font-size: 11px; color: #7a8ca6; }
.notes { width: 100%; min-height: 140px; font: 16px 'Special Elite', monospace; padding: 12px; border: 2px solid #d9cba6; border-radius: 10px; background: #fbf5e6; user-select: text; }

/* ---- casse-tête ---- */
.pz-tools { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.pz-tools .btn.active { background: var(--yellow); }
.lo-grid { display: grid; gap: 10px; max-width: 380px; margin: 0 auto; }
.lo-cell { aspect-ratio: 1; border-radius: 16px; border: 3px solid var(--navy); background: #2a3d62; cursor: pointer; display: grid; place-items: center; box-shadow: 0 4px 0 var(--navy); }
.lo-cell span { width: 44%; height: 44%; border-radius: 50%; background: #56688f; transition: background .15s, box-shadow .15s; }
.lo-cell.on { background: #33487a; }
.lo-cell.on span { background: var(--yellow); box-shadow: 0 0 18px 6px rgba(255, 209, 102, .7); }
.lo-cell:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--navy); }
.pc-wrap { overflow-x: auto; display: flex; justify-content: center; }
.pc-grid { --pc: 32px; display: grid; gap: 0; user-select: none; }
.pc-clue { font: 600 14px 'Fredoka', sans-serif; color: var(--navy); display: flex; justify-content: flex-end; align-items: center; padding: 0 8px; }
.pc-col { align-items: flex-end; justify-content: center; text-align: center; padding: 4px 0; line-height: 1.15; }
.pc-clue.ok { color: #9fb0c8; }
.pc-cell { width: var(--pc); height: var(--pc); background: #fff; border: 1px solid #b9c6d8; cursor: pointer; position: relative; }
.pc-cell.br { border-right: 2px solid var(--navy); }
.pc-cell.bb { border-bottom: 2px solid var(--navy); }
.pc-cell.fill { background: var(--navy); }
.pc-cell.cross::after { content: '✕'; position: absolute; inset: 0; display: grid; place-items: center; color: #9fb0c8; font-size: 16px; }
.pc-grid.solved .pc-cell.fill { background: var(--orange); }
.mm-wrap { max-width: 460px; margin: 0 auto; }
.mm-history { max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.mm-row { display: flex; align-items: center; gap: 12px; background: #fff; border: 2px solid #cfd8e6; border-radius: 12px; padding: 4px 12px; }
.mm-n { font-weight: 700; color: #7a8ca6; width: 20px; }
.mm-g { font-size: 26px; letter-spacing: 4px; flex: 1; }
.mm-fb { display: grid; grid-template-columns: repeat(2, 12px); gap: 4px; }
.mm-fb i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #cfd8e6; }
.mm-fb i.w { background: var(--green); border-color: #3d8a2c; }
.mm-fb i.m { background: #fff; border-color: var(--navy); }
.mm-current { display: flex; gap: 10px; justify-content: center; margin-bottom: 12px; }
.mm-slot { width: 58px; height: 58px; border: 3px dashed var(--navy); border-radius: 14px; display: grid; place-items: center; font-size: 30px; background: #fff; }
.mm-palette { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.mm-sym { position: relative; width: 56px; height: 56px; font-size: 28px; border: 3px solid var(--navy); border-radius: 14px; background: #fff; cursor: pointer; box-shadow: 0 3px 0 var(--navy); }
.mm-sym small { position: absolute; bottom: 1px; right: 5px; font: 600 11px 'Fredoka', sans-serif; color: #7a8ca6; }
.mm-sym:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--navy); }
.sd-grid { display: grid; grid-template-columns: repeat(6, 56px); border: 3px solid var(--navy); width: max-content; margin: 0 auto; border-radius: 8px; overflow: hidden; }
.sd-cell { width: 56px; height: 56px; border: 1px solid #cfd8e6; background: #fff; font-size: 26px; cursor: pointer; padding: 0; }
.sd-cell.br { border-right: 3px solid var(--navy); }
.sd-cell.bb { border-bottom: 3px solid var(--navy); }
.sd-cell.given { background: #e6edf7; cursor: default; }
.sd-cell.sel { background: #fff3cf; box-shadow: inset 0 0 0 3px var(--orange); }
.sd-cell.bad { background: #ffd9d0; }
@media (max-width: 640px) {
  .sd-grid { grid-template-columns: repeat(6, 44px); }
  .sd-cell { width: 44px; height: 44px; font-size: 20px; }
  .pc-grid { --pc: 24px; }
}
.pc-row { white-space: nowrap; letter-spacing: 1px; }
.pc-wrap { justify-content: safe center; }
@media (max-width: 640px) { .hud .brand { font-size: 16px; } .icon-btn.wide { font-size: 14px; padding: 0 8px; } }
.visual, .doc-wrap, .carnet-sec { overflow-x: auto; }
.visual { justify-content: safe center; }

/* =================== Exploration (v3) =================== */
body.explore .hud { top: 12px; }
.hud-left { display: flex; flex-direction: column; gap: 6px; }
.hud-day { background: rgba(255,255,255,.9); border: 2px solid var(--navy); border-radius: 10px; padding: 2px 10px; font-size: 14px; font-weight: 600; width: fit-content; }
.hud-day::first-letter { text-transform: uppercase; }
.prompt {
  position: fixed; transform: translate(-50%, -100%); pointer-events: none; z-index: 5;
  background: var(--navy); color: #fff; border-radius: 10px; padding: 4px 10px; font-size: 14px; white-space: nowrap;
}
.prompt kbd { background: #fff; color: var(--navy); border-radius: 5px; padding: 0 5px; font: 600 12px 'Fredoka', sans-serif; margin-right: 4px; }
.toast {
  position: fixed; left: 50%; top: 76px; transform: translateX(-50%); z-index: 40;
  background: #fff; border: 3px solid var(--navy); border-radius: 14px; padding: 8px 16px; box-shadow: 0 4px 0 var(--navy);
  font-size: 16px; max-width: min(620px, calc(100vw - 32px)); text-align: center;
}
.toast.show { animation: pop .25s cubic-bezier(.3, 1.4, .6, 1); }
.dialog {
  position: fixed; left: 50%; bottom: 112px; transform: translateX(-50%); z-index: 30;
  width: min(700px, calc(100vw - 32px)); background: var(--cream); border: 3px solid var(--navy); border-radius: 18px;
  box-shadow: 0 6px 0 var(--navy); padding: 16px 20px 10px; cursor: pointer; animation: pop .2s;
}
.dialog-text { font-size: 18px; line-height: 1.5; }
.dialog-more { text-align: right; font-size: 13px; color: #7a8ca6; margin-top: 4px; }

.inv-bar { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(760px, calc(100vw - 24px)); }
.inv { display: flex; gap: 8px; background: rgba(29,53,87,.88); padding: 8px; border-radius: 18px; border: 3px solid var(--navy); flex-wrap: wrap; justify-content: center; }
.inv-slot { width: 58px; height: 58px; border-radius: 12px; border: 3px solid #3b4f78; background: #2a3d62; font-size: 30px; cursor: pointer; display: grid; place-items: center; transition: transform .1s; }
.inv-slot:not(:disabled):hover { transform: translateY(-3px); background: #33487a; }
.inv-slot:disabled { cursor: default; opacity: .5; }
.inv-slot.sel { border-color: var(--yellow); background: #4a5f8f; box-shadow: 0 0 0 3px var(--yellow); }
.inv-info { background: #fff; border: 3px solid var(--navy); border-radius: 14px; padding: 6px 10px; display: flex; gap: 8px; align-items: center; font-size: 15px; }
body.holding .cu-body .hs, body.holding #world { cursor: crosshair; }

.overlay.cu { z-index: 50; padding-bottom: calc(var(--inv-h, 80px) + 26px); }
.cu-card {
  position: relative; width: min(760px, 100%); max-height: calc(100vh - var(--inv-h, 80px) - 50px); overflow-y: auto;
  background: var(--cream); border: 3px solid var(--navy); border-radius: 24px; box-shadow: 0 8px 0 var(--navy);
  padding: 18px 22px 22px; animation: pop .22s cubic-bezier(.3, 1.4, .6, 1);
}
.cu-card h2 { margin: 0; font-size: 26px; }
.cu-body { margin-top: 12px; }
.cu-svg { width: 100%; height: auto; display: block; border-radius: 14px; }
.cu-svg .hs, .cu-svg [data-hs] { cursor: pointer; }
.cu-svg [data-hs]:hover { filter: brightness(1.12) drop-shadow(0 0 6px rgba(255, 209, 102, .9)); }
.lock-step[data-hs] { cursor: pointer; }
.cu-note { background: #fff; border-left: 5px solid var(--teal); border-radius: 10px; padding: 12px 16px; font-size: 17px; line-height: 1.5; margin-bottom: 10px; }
.cu-hint { font-size: 15px; color: #4c6385; text-align: center; margin: 10px 0 0; }
.doc.plaque.frost { background: linear-gradient(135deg, #eaf8ff, #cfeaf6); color: #6b8fb0; border-color: #a9cfe6; }
.item-exam { text-align: center; }
.item-big { font-size: 90px; }
.item-exam .doc { text-align: left; margin-top: 12px; }
.hidden { display: none !important; }

.keypad-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.keypad-screen { font: 700 34px 'Special Elite', monospace; letter-spacing: 8px; background: #1a2a1a; color: #7dff9a; padding: 8px 22px; border-radius: 10px; border: 3px solid var(--navy); min-width: 200px; text-align: center; }
.keypad-screen.ok { color: #fff; background: #2a8a3a; }
.keypad-screen.ko { color: #fff; background: #b8433a; animation: shake .4s; }
.keypad { display: grid; grid-template-columns: repeat(3, 64px); gap: 8px; }
.key { height: 56px; border-radius: 12px; border: 3px solid var(--navy); background: #fff; font: 700 22px 'Fredoka', sans-serif; color: var(--navy); cursor: pointer; box-shadow: 0 3px 0 var(--navy); }
.key:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--navy); }

.lock-form { background: #fff; border: 3px solid var(--navy); border-radius: 16px; padding: 12px 14px; margin-top: 12px; }
.lock-form label { display: block; font-weight: 600; margin-bottom: 8px; }
.lock-form input { flex: 1; min-width: 0; font: 600 20px 'Fredoka', sans-serif; letter-spacing: 2px; color: var(--navy); border: 3px solid var(--navy); border-radius: 12px; padding: 6px 12px; background: var(--ice); user-select: text; }
.lock-form.shake { animation: shake .4s; }
.lock-step { margin-top: 12px; padding: 10px 14px; border: 3px dashed var(--navy); border-radius: 14px; text-align: center; font-weight: 600; background: #fff; }
.lock-step.ok { border-style: solid; background: #e2f7df; }
.sym-lock { text-align: center; margin-top: 8px; }
.sym-wheels { display: flex; gap: 10px; justify-content: center; }
.sym-wheel { width: 60px; height: 70px; border-radius: 12px; border: 3px solid var(--navy); background: #fff; font-size: 32px; cursor: pointer; box-shadow: 0 3px 0 var(--navy); }

.capsules { display: flex; flex-direction: column; gap: 12px; }
.capsule { background: #fff; border: 3px solid var(--navy); border-radius: 16px; padding: 12px 14px; }
.capsule.open { background: #fff8e1; }
.capsule-head { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.capsule-head small { color: #4c6385; }
.capsule-head strong::first-letter { text-transform: uppercase; }
.capsule-ico { font-size: 34px; }
.capsule .lock-form { margin-top: 6px; }

.carnet h3 { margin: 14px 0 8px; }
.carnet-inv { display: flex; flex-wrap: wrap; gap: 8px; }
.carnet-inv span { background: #fff; border: 2px solid #cfd8e6; border-radius: 10px; padding: 4px 10px; }

.radio-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.radio-display { font: 700 40px 'Special Elite', monospace; background: #2a1a0a; color: #ffb347; padding: 10px 26px; border-radius: 12px; border: 3px solid var(--navy); text-shadow: 0 0 10px rgba(255,179,71,.7); }
.radio-display.near { animation: flicker .3s infinite; }
@keyframes flicker { 50% { opacity: .7; } }
.radio-knob { width: min(460px, 90%); accent-color: var(--coral); }
.radio-row { display: flex; gap: 8px; }
.radio-sub { max-width: 600px; text-align: center; font-size: 17px; line-height: 1.5; min-height: 20px; }

/* ---- Salle 2 ---- */
.doc.chalk { background: #2f4a3a; color: #eef5ea; border-color: #1d2e24; font-size: 20px; text-align: center; }
.doc.uv { background: #1a0f2e; color: #6b5a8a; border-color: #3d2466; }
.glow-uv { color: #d6b4ff; text-shadow: 0 0 10px #b06cff, 0 0 20px #7b2cbf; }
.term { background: #0b140c; border: 3px solid var(--navy); border-radius: 12px; padding: 12px; font-family: 'Special Elite', monospace; color: #7dff9a; }
.term-out { white-space: pre-wrap; min-height: 180px; max-height: 300px; overflow-y: auto; font-size: 15px; line-height: 1.5; }
.term-in { display: flex; gap: 8px; align-items: center; border-top: 1px dashed #2a5a2e; padding-top: 8px; }
.term-in input { flex: 1; background: transparent; border: 0; color: #7dff9a; font: 16px 'Special Elite', monospace; outline: none; text-transform: uppercase; user-select: text; }
.develop { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.baths { display: flex; gap: 10px; }
.bath { padding: 10px 14px; border: 3px solid var(--navy); border-radius: 12px; font-weight: 600; opacity: .55; }
.bath.cur { opacity: 1; box-shadow: 0 0 0 3px var(--yellow); }
.dev-clock { font: 700 28px 'Special Elite', monospace; background: #2a0a0a; color: #ff6b6b; padding: 6px 24px; border-radius: 12px; border: 3px solid var(--navy); }
.dev-paper { width: 160px; height: 110px; background: #e8e2d0 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 110'%3E%3Ctext x='30' y='70' font-size='40'%3E♄ ☾%3C/text%3E%3C/svg%3E") center/cover; border: 3px solid var(--navy); border-radius: 6px; opacity: 0; }

/* ---- Salle 3 ---- */
.doc.journal p { margin: 0 0 10px; }
.buee { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.mirror-fog { --fog: 0; position: relative; width: min(420px, 90%); aspect-ratio: 4 / 3; border-radius: 50% / 40%; border: 6px solid #b88a5a; background: linear-gradient(135deg, #cfeaf6, #eaf8ff 45%, #bfe0ee); overflow: hidden; display: grid; place-items: center; }
.mirror-fog::before { content: ''; position: absolute; inset: 0; background: rgba(255, 255, 255, .92); opacity: var(--fog); transition: opacity .3s; }
.mirror-msg { position: relative; font: 28px 'Special Elite', cursive; color: #7fa2b8; text-align: center; opacity: var(--fog); line-height: 1.35; transform: rotate(-4deg); transition: transform .6s; }
.mirror-msg.mirror-writing { transform: scaleX(-1) rotate(-4deg); }
.doc.journal .other-hand { font-family: 'Special Elite', monospace; color: #3a7bd5; font-style: italic; }
.avent { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; background: #8a5a3c; padding: 14px; border-radius: 14px; border: 3px solid var(--navy); max-width: 520px; margin: 0 auto; }
.avent-door { aspect-ratio: 1; border: 3px solid var(--navy); border-radius: 8px; background: #e8c9a0; font: 700 20px 'Fredoka', sans-serif; color: var(--navy); cursor: pointer; }
.avent-door.open { background: #2b2230; color: var(--yellow); }

/* ---- Salle 4 ---- */
.finale .aurora { display: block; width: 100%; max-width: 700px; margin: 0 auto 14px; border-radius: 16px; border: 3px solid #3b4a8a; }
.finale .final-msg { color: var(--coral); }
.ico { display: inline-block; vertical-align: middle; image-rendering: auto; }
.inv-slot .ico { pointer-events: none; }
.item-big .ico { filter: drop-shadow(0 4px 0 rgba(29,53,87,.15)); }
.gl { display: inline-block; vertical-align: middle; }
.capsule-head { align-items: center; }
.capsule-txt { flex: 1; }
.capsule-seal { flex: none; filter: drop-shadow(0 2px 0 rgba(29,53,87,.2)); }
.capsule-ico .gl { display: block; }
.lock-step .gl, .lock-step .ico { margin-right: 6px; }
.sym-wheel .gl { pointer-events: none; }
table.doc.sky td .gl { margin-bottom: 2px; }
#mute, #carnet-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
#carnet-ico .gl { display: block; }
.reward-big.emoji { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; }
.gift-sym-name { font: 600 15px 'Fredoka', sans-serif; letter-spacing: 0; color: var(--navy); }
#talkie-btn { position: relative; display: inline-flex; align-items: center; gap: 6px; }
#talkie-ico .gl { display: block; }
.dot { position: absolute; top: -4px; right: -4px; width: 14px; height: 14px; border-radius: 50%; background: var(--coral); border: 2px solid var(--navy); animation: bounce 1.2s infinite; }
.talkie { display: flex; flex-direction: column; gap: 12px; }
.talkie-day { background: #fff; border: 3px solid var(--navy); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.talkie-head { display: flex; align-items: center; gap: 8px; }
.talkie-head strong::first-letter, .news-item strong::first-letter { text-transform: uppercase; }
.news { display: flex; flex-direction: column; gap: 10px; }
.news-item { display: flex; gap: 10px; align-items: center; background: #fff; border: 2px solid var(--navy); border-radius: 12px; padding: 8px 12px; }
.radio-msg { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.radio-waves { position: relative; width: 120px; height: 90px; display: grid; place-items: center; }
.radio-waves span { position: absolute; top: 18px; right: 10px; width: 18px; height: 18px; border: 3px solid var(--teal); border-left-color: transparent; border-bottom-color: transparent; border-radius: 50%; transform: rotate(45deg); animation: ping 1.6s infinite; opacity: 0; }
.radio-waves span:nth-child(3) { animation-delay: .5s; } .radio-waves span:nth-child(4) { animation-delay: 1s; }
@keyframes ping { 0% { opacity: .9; transform: rotate(45deg) scale(.6); } 100% { opacity: 0; transform: rotate(45deg) scale(2.4); } }
.radio-freq { font: 600 13px 'Fredoka', sans-serif; color: #4c6385; letter-spacing: 1px; text-transform: uppercase; }
.radio-text { font-size: 18px; line-height: 1.55; max-width: 560px; margin: 0; }
.talkie-radio { background: #eaf6ff; border: 3px solid var(--navy); border-radius: 14px; padding: 10px 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.talkie-radio strong { width: 100%; }
.talkie-select { font: 500 14px 'Fredoka', sans-serif; padding: 5px 8px; border: 2px solid var(--navy); border-radius: 10px; background: #fff; color: var(--navy); }

/* Notifications et dialogues toujours au-dessus des fenêtres ouvertes */
.toast { z-index: 90; }
.dialog { z-index: 85; }
