/* Developed by Slyness */
:root {
  --s: 1;
  --ox: 0px; /* élargissement latéral pour remplir les écrans larges */
  --k: 1;     /* zoom de la scène pour remplir cette largeur */
  --cy: 0px;  /* rognage haut/bas de la scène zoomée */
  --gold: #f4c95d;
  --gold2: #b9832b;
  --ink: #3b2614;
  --cream: #fff6e3;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: radial-gradient(ellipse at 50% 40%, #2a1b3d 0%, #120b1c 70%, #07040b 100%);
  font-family: "Fredoka", system-ui, sans-serif;
  color: var(--cream);
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  touch-action: manipulation;
}

img { -webkit-user-drag: none; user-select: none; }
button { font-family: inherit; cursor: pointer; border: 0; color: inherit; }

/* ---------- Cadre ---------- */
#app {
  position: absolute; left: 50%; top: 50%;
  width: calc(1632px + 2 * var(--ox)); height: 1066px;
  transform: translate(-50%, -50%) scale(var(--s));
  transform-origin: center;
}

#frame {
  position: absolute; inset: 0;
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,.08), rgba(0,0,0,.25)),
    url(../assets/tx_bois.webp) center / cover,
    #4a2414;
  box-shadow:
    0 30px 80px rgba(0,0,0,.7),
    inset 0 0 0 3px #2a1208,
    inset 0 0 0 7px var(--gold2),
    inset 0 0 0 9px #ffe6a1,
    inset 0 0 0 12px #8a5a1c,
    inset 0 0 40px rgba(0,0,0,.6);
}

/* ---------- Barre du haut ---------- */
#topbar {
  position: absolute; left: 16px; right: 16px; top: 16px; height: 110px; z-index: 25;
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 18px 22px 0;
  border-radius: 0;
  background: linear-gradient(180deg, rgba(10,5,2,.6), rgba(10,5,2,.25) 55%, transparent);
  pointer-events: none;
}
#topbar > * { pointer-events: auto; }
body.in-menu #topbar, body.in-end #topbar { opacity: 0; pointer-events: none; }
.plaque {
  display: flex; align-items: center; gap: 12px;
  height: 56px; padding: 0 26px 0 8px;
  border-radius: 30px;
  background: linear-gradient(180deg, #ffe39a, #d6a03f 55%, #a8721f);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.7), inset 0 -3px 0 rgba(0,0,0,.25), 0 4px 10px rgba(0,0,0,.5);
  color: #4a2a0c; font-weight: 700; font-size: 28px; letter-spacing: .5px;
  text-shadow: 0 1px 0 rgba(255,255,255,.6);
}
.plaque img { height: 50px; filter: drop-shadow(0 2px 2px rgba(0,0,0,.35)); }
.room-name {
  position: absolute; left: 50%; transform: translateX(-50%);
  top: 28px; font-size: 30px; font-weight: 600; color: #ffe8b8;
  text-shadow: 0 2px 6px rgba(0,0,0,.8);
  letter-spacing: 1px;
}
.tools { display: flex; align-items: center; gap: 12px; }
.timer {
  font-variant-numeric: tabular-nums; font-size: 26px; font-weight: 600;
  padding: 8px 20px; border-radius: 22px;
  background: rgba(0,0,0,.45); box-shadow: inset 0 0 0 2px rgba(244,201,93,.6);
  color: #ffe9b0;
}
.tbtn {
  position: relative;
  width: 54px; height: 54px; border-radius: 50%; font-size: 26px;
  background: radial-gradient(circle at 40% 30%, #6a3a1c, #2e1408);
  box-shadow: inset 0 0 0 3px var(--gold2), inset 0 0 0 5px #3a1b0a, 0 4px 8px rgba(0,0,0,.5);
  transition: transform .15s, filter .15s;
}
.tbtn:hover { transform: translateY(-2px) scale(1.06); filter: brightness(1.2); }
.tbtn:active { transform: scale(.94); }
#btn-journal[data-count]:not([data-count=""])::after {
  content: attr(data-count);
  position: absolute; right: -4px; top: -4px; min-width: 22px; height: 22px; border-radius: 11px;
  background: #e8483c; color: #fff; font-size: 14px; font-weight: 700; line-height: 22px;
  box-shadow: 0 2px 4px rgba(0,0,0,.5);
}
body.in-menu .tools, body.in-menu .room-name { opacity: 0; pointer-events: none; }

/* ---------- Scène ---------- */
#stage {
  position: absolute; left: 16px; right: 16px; top: 16px; height: 900px;
  border-radius: 0;
}
/* La scène garde ses 1600×900 et ses proportions : elle est zoomée pour couvrir la largeur */
#scene, #fly-layer {
  left: calc(50% - 800px); top: 0; width: 1600px; height: 900px; scale: var(--k);
}
#scene {
  position: absolute; overflow: hidden; border-radius: 0; background: #000;
  clip-path: inset(var(--cy) 0);
  transition: opacity .45s, filter .45s, transform .45s;
}

#bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; transition: filter 1.2s; }

.ov { position: absolute; pointer-events: none; display: none; }
.vignette { display: block; inset: 0; background: radial-gradient(ellipse at center, transparent 55%, rgba(10,4,0,.55) 100%); }

[data-scene=salon]:not(.fire-out) .fireglow {
  display: block; left: -4%; top: 40%; width: 38%; height: 62%;
  background: radial-gradient(ellipse at 45% 60%, rgba(255,150,40,.42), rgba(255,100,20,.15) 40%, transparent 70%);
  mix-blend-mode: screen; animation: flicker 2.2s infinite;
}
@keyframes flicker { 0%,100% { opacity: .85; } 20% { opacity: 1; } 35% { opacity: .7; } 50% { opacity: .95; } 70% { opacity: .75; } 85% { opacity: 1; } }

[data-scene=salon].fire-out .coldfire {
  display: block; left: 9.5%; top: 56%; width: 15%; height: 37%;
  backdrop-filter: grayscale(1) brightness(.38) contrast(1.1);
  -webkit-backdrop-filter: grayscale(1) brightness(.38) contrast(1.1);
  -webkit-mask: radial-gradient(ellipse at 50% 60%, #000 50%, transparent 72%);
  mask: radial-gradient(ellipse at 50% 60%, #000 50%, transparent 72%);
}
[data-scene=salon].fire-out #bg { filter: brightness(.88) saturate(.92); }

[data-scene=chambre] .lampglow {
  display: block; left: 17%; top: 28%; width: 22%; height: 34%;
  background: radial-gradient(circle, rgba(255,200,110,.35), transparent 65%);
  mix-blend-mode: screen; animation: flicker 5s infinite;
}

[data-scene=salon] .trapdark { display: none; }
[data-scene=salon]:has(.ladder) .trapdark {
  display: block; left: 43.6%; top: 2.6%; width: 11.6%; height: 11%;
  background: radial-gradient(ellipse at 50% 40%, #000 30%, #1a0e06 80%);
  box-shadow: inset 0 0 20px #000; border-radius: 3px;
  animation: appear .8s ease-out;
}

[data-scene=cuisine]:not(.power-on) .kitchen-dim {
  display: block; inset: 0; background: rgba(12, 22, 60, .42); mix-blend-mode: multiply;
}
[data-scene=cuisine] .led {
  display: block; left: 80.6%; top: 71.4%; width: 10px; height: 10px; border-radius: 50%;
  background: #444; box-shadow: 0 0 0 2px rgba(0,0,0,.4);
}
[data-scene=cuisine].power-on .led { background: #ff4141; box-shadow: 0 0 12px 4px rgba(255,60,60,.8); animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* Grenier sombre + lampe torche */
#dark { position: absolute; inset: 0; pointer-events: none; display: none; }
.is-dark #dark { display: block; background: rgba(2,3,10,.93); transition: background .3s; }
.is-dark.has-light #dark {
  background: radial-gradient(circle 260px at var(--lx, 800px) var(--ly, 450px), rgba(255,240,200,.08) 0, rgba(2,3,10,.35) 45%, rgba(2,3,10,.9) 100%);
}

/* Sprites */
.sprite { position: absolute; height: auto; filter: drop-shadow(0 6px 6px rgba(0,0,0,.45)); }
.sprite.deco { pointer-events: none; }
.sprite.pick { cursor: pointer; animation: bob 2.6s ease-in-out infinite; transition: filter .2s; }
.sprite.pick:hover { filter: drop-shadow(0 0 12px rgba(255,230,140,.95)) drop-shadow(0 6px 6px rgba(0,0,0,.45)) brightness(1.1); }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-2deg); } }
.sprite.appear { animation: appear .8s ease-out; }
@keyframes appear { from { opacity: 0; transform: scale(.9); filter: brightness(2.5); } }
.sprite.gone { pointer-events: none; animation: gone .6s ease-in forwards; }
@keyframes gone { to { opacity: 0; transform: scale(1.4) translateY(-30px); filter: brightness(2); } }
.sprite.slide-away { animation: slideaway 1.1s cubic-bezier(.5,0,.75,0) forwards; filter: drop-shadow(0 10px 10px rgba(0,0,0,.5)); }
@keyframes slideaway { 30% { transform: rotate(-4deg) translate(-10px, 0); } to { transform: rotate(-14deg) translate(-60px, 260px); opacity: 0; } }
.sprite.ladder { transform-origin: top; }
.sprite.ladder.appear { animation: ladder .9s cubic-bezier(.3,1.4,.6,1); }
@keyframes ladder { from { transform: scaleY(.05); } }

/* Zones cliquables */
.hot { position: absolute; cursor: pointer; }
.hot.exit { cursor: e-resize; }

/* Flèches */
.nav-btn {
  position: absolute; z-index: 5;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 14px; border-radius: 50px;
  background: rgba(20,10,4,.35); backdrop-filter: blur(3px);
  box-shadow: inset 0 0 0 2px rgba(244,201,93,.55);
  transition: transform .2s, background .2s;
  animation: navpulse 2.4s ease-in-out infinite;
}
.nav-btn:hover { background: rgba(40,20,8,.65); transform: scale(1.08); }
.nav-btn .chev { width: 30px; height: 30px; border-right: 7px solid var(--gold); border-bottom: 7px solid var(--gold); border-radius: 3px; filter: drop-shadow(0 0 6px rgba(255,200,80,.7)); }
.nav-btn .nlabel { font-size: 18px; font-weight: 600; color: #ffeec5; text-shadow: 0 1px 3px #000; }
.nav-btn.left { left: 16px; top: 50%; translate: 0 -50%; }
.nav-btn.left .chev { transform: rotate(135deg); margin-left: 10px; }
.nav-btn.right { right: 16px; top: 50%; translate: 0 -50%; }
.nav-btn.right .chev { transform: rotate(-45deg); margin-right: 10px; }
.nav-btn.down { left: 50%; bottom: calc(var(--cy, 0px) + 14px); translate: -50% 0; flex-direction: column-reverse; }
.nav-btn.down .chev { transform: rotate(45deg); margin-top: -8px; }
.nav-btn.up { left: 50%; top: calc(var(--cy, 0px) + 150px); translate: -50% 0; }
.nav-btn.up .chev { transform: rotate(-135deg); margin-top: 10px; }
@keyframes navpulse { 50% { box-shadow: inset 0 0 0 2px rgba(244,201,93,.95), 0 0 18px rgba(244,201,93,.4); } }

/* Fuite finale */
#escape-cat { position: absolute; width: 12%; left: 73%; top: 60%; opacity: 0; pointer-events: none; z-index: 4; }
#scene.escape #escape-cat { animation: escape 1.3s ease-in forwards; }
@keyframes escape {
  0% { opacity: 0; transform: translate(-200px, 40px) scale(1.4); }
  25% { opacity: 1; transform: translate(-120px, 0) scale(1.3); }
  70% { opacity: 1; transform: translate(20px, 60px) scale(.6); }
  100% { opacity: 0; transform: translate(40px, 90px) scale(.2); }
}

/* ---------- Dialogue ---------- */
#dialog {
  position: absolute; left: 24px; bottom: 22px; z-index: 26;
  display: flex; align-items: flex-end; gap: 6px; max-width: 1060px;
  opacity: 0; transform: translateY(20px); pointer-events: none;
  transition: opacity .25s, transform .25s;
  cursor: pointer;
}
#dialog.show { opacity: 1; transform: none; pointer-events: auto; }
#dialog.pop img { animation: catpop .4s ease-out; }
@keyframes catpop { 40% { transform: scale(1.1) rotate(-4deg); } }
#dialog img { width: 150px; filter: drop-shadow(0 6px 8px rgba(0,0,0,.6)); }
#dialog .say-bubble {
  position: relative; margin-bottom: 26px;
  padding: 16px 26px 18px; border-radius: 22px;
  background: #fffaf0;
  color: #2a1606; box-shadow: 0 8px 24px rgba(0,0,0,.6), inset 0 0 0 3px #c8902f;
  min-width: 360px;
}
#dialog .say-bubble::before { content: ""; position: absolute; left: -14px; bottom: 26px; border: 14px solid transparent; border-right-color: #c8902f; border-left: 0; }
#dialog .say-bubble b { color: #b4500f; font-size: 20px; }
#dialog p { margin: 4px 0 0; font-size: 30px; line-height: 1.35; font-weight: 600; color: #2a1606; }

/* ---------- Tooltip / vol ---------- */
#tooltip {
  position: absolute; left: 0; top: 0; z-index: 30; pointer-events: none;
  padding: 7px 16px; border-radius: 16px; white-space: nowrap; translate: -50% 0;
  background: rgba(25,12,4,.85); color: #ffe9b0; font-size: 20px; font-weight: 500;
  box-shadow: inset 0 0 0 2px rgba(244,201,93,.6);
  opacity: 0; transition: opacity .15s;
}
#tooltip.show { opacity: 1; }
#fly-layer { position: absolute; pointer-events: none; z-index: 40; }
.fly { position: absolute; width: 120px; filter: drop-shadow(0 0 16px rgba(255,230,140,1)); transition: transform .8s cubic-bezier(.5,-0.3,.6,1); }
#fx { position: absolute; left: calc(50% - 800px); top: 0; width: 1600px; height: 1040px; scale: var(--k); transform-origin: 800px 450px; pointer-events: none; z-index: 60; }

/* ---------- Inventaire ---------- */
#inventory {
  position: absolute; left: 16px; right: 16px; top: 930px; height: 120px; z-index: 28;
  display: flex; align-items: center; gap: 14px;
  padding: 0 14px 0 26px;
  border-radius: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.5), rgba(0,0,0,.3));
  box-shadow: inset 0 3px 10px rgba(0,0,0,.7), inset 0 0 0 2px rgba(244,201,93,.25), 0 1px 0 rgba(255,230,160,.15);
}
.inv-tip {
  position: absolute; left: 0; bottom: calc(100% + 10px); z-index: 2; pointer-events: none;
  padding: 7px 16px; border-radius: 16px; white-space: nowrap; translate: -50% 0;
  background: rgba(25,12,4,.85); color: #ffe9b0; font-size: 20px; font-weight: 500;
  box-shadow: inset 0 0 0 2px rgba(244,201,93,.6);
  opacity: 0; transition: opacity .15s;
}
.inv-tip.show { opacity: 1; }
#slots {
  display: flex; gap: 8px; flex: 1; min-width: 0; padding: 0 2px;
  overflow-x: auto; scroll-behavior: smooth; scroll-snap-type: x mandatory; scrollbar-width: none;
}
#slots::-webkit-scrollbar { display: none; }
body.in-menu #inventory, body.in-end #inventory { visibility: hidden; }
#inventory:not(.scrollable) #slots { justify-content: center; }
#slots .slot { scroll-snap-align: start; }
.inv-arrow {
  display: none; flex: none; width: 58px; height: 104px; border-radius: 16px;
  background: linear-gradient(180deg, #7b4524, #4a2412);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.18), inset 0 0 0 2px var(--gold2), 0 4px 10px rgba(0,0,0,.5);
  place-items: center; transition: filter .15s, opacity .2s, transform .15s;
}
.inv-arrow::before {
  content: ""; width: 18px; height: 18px;
  border-right: 6px solid var(--gold); border-bottom: 6px solid var(--gold); border-radius: 2px;
}
.inv-arrow.prev::before { transform: rotate(135deg); margin-left: 8px; }
.inv-arrow.next::before { transform: rotate(-45deg); margin-right: 8px; }
.inv-arrow:hover { filter: brightness(1.2); }
.inv-arrow:active { transform: scale(.94); }
.inv-arrow:disabled { opacity: .3; pointer-events: none; }
#inventory.scrollable .inv-arrow { display: grid; }
.slot {
  width: 104px; height: 104px; border-radius: 16px; flex: none;
  background: radial-gradient(circle at 50% 35%, rgba(255,240,210,.18), rgba(0,0,0,.55));
  box-shadow: inset 0 0 0 3px #8a5a1c, inset 0 0 0 5px rgba(255,230,160,.35), inset 0 6px 14px rgba(0,0,0,.6);
  display: grid; place-items: center; position: relative;
  transition: transform .15s, box-shadow .2s; overflow: hidden;
}
.slot img { width: 84px; height: 84px; object-fit: contain; filter: drop-shadow(0 4px 4px rgba(0,0,0,.55)); transition: opacity .2s; pointer-events: none; }
.slot[data-id] { cursor: pointer; }
.slot[data-id]:hover { box-shadow: inset 0 0 0 3px var(--gold), inset 0 0 0 5px rgba(255,230,160,.6), 0 0 20px rgba(255,210,100,.35); }
.slot.sel { box-shadow: inset 0 0 0 4px #9dffbf, 0 0 26px rgba(130,255,180,.6); animation: selpulse 1s ease-in-out infinite; }
@keyframes selpulse { 50% { box-shadow: inset 0 0 0 4px #9dffbf, 0 0 40px rgba(130,255,180,.85); } }
.slot.born { animation: born .6s cubic-bezier(.3,1.6,.6,1); }
@keyframes born { from { transform: scale(.4); } }
.slot.fusing { animation: fusing .7s ease-in forwards; }
@keyframes fusing { 50% { transform: scale(1.15) rotate(8deg); filter: brightness(2); } to { transform: scale(.6); filter: brightness(3) blur(2px); opacity: .3; } }

/* ---------- Crédit menu ---------- */
.dev-credit {
  position: absolute; left: 510px; bottom: 90px;
  display: flex; align-items: baseline; gap: 12px;
  font-size: 24px; font-weight: 500; letter-spacing: 1px; color: #ffe9c4;
  text-shadow: 0 2px 8px rgba(0,0,0,.85);
}
.sly {
  position: relative; font-family: "Caveat", cursive; font-size: 54px; font-weight: 700; letter-spacing: 0;
  background: linear-gradient(100deg, #ffb347 0%, #ffe9a0 22%, #fff 30%, #ffe9a0 38%, #f08a24 60%, #ffcf6b 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 0 10px rgba(255,190,80,.55)) drop-shadow(0 3px 2px rgba(60,25,5,.9));
  animation: slyshine 4s ease-in-out infinite, slyglow 2.6s ease-in-out infinite;
}
@keyframes slyshine { 0% { background-position: 100% 0; } 55%, 100% { background-position: -50% 0; } }
@keyframes slyglow { 50% { filter: drop-shadow(0 0 18px rgba(255,200,90,.9)) drop-shadow(0 3px 2px rgba(60,25,5,.9)); } }
/* étincelles façon étoiles de la nuit */
.sly i {
  position: absolute; width: 14px; height: 14px; pointer-events: none;
  background: radial-gradient(circle, #fff 0 18%, transparent 20%),
    linear-gradient(0deg, transparent 42%, #fff6d0 50%, transparent 58%),
    linear-gradient(90deg, transparent 42%, #fff6d0 50%, transparent 58%);
  filter: drop-shadow(0 0 4px #ffd36b);
  opacity: 0; animation: twinkle 2.4s ease-in-out infinite;
}
.sly i:nth-of-type(1) { left: -10px; top: 6px; }
.sly i:nth-of-type(2) { right: -14px; top: -4px; width: 18px; height: 18px; animation-delay: .8s; }
.sly i:nth-of-type(3) { right: 30%; bottom: 0; width: 11px; height: 11px; animation-delay: 1.6s; }
@keyframes twinkle { 0%, 100% { opacity: 0; transform: scale(.3) rotate(0); } 45% { opacity: 1; transform: scale(1) rotate(45deg); } }

/* ---------- Logo World Escape Games ---------- */
.weg { display: block; flex: none; transition: transform .15s, filter .15s; }
.weg img { display: block; height: 100%; width: auto; filter: drop-shadow(0 2px 6px rgba(0,0,0,.45)); }
.weg:hover { transform: translateY(-2px); filter: brightness(1.12); }
.weg-menu { position: absolute; left: 110px; bottom: 40px; height: 128px; }
.weg-menu img { filter: drop-shadow(0 0 2px rgba(255,255,255,.9)) drop-shadow(0 0 14px rgba(255,255,255,.45)) drop-shadow(0 4px 10px rgba(0,0,0,.5)); }
.weg-inv {
  height: 96px; margin-left: 4px; padding-left: 22px;
  border-left: 2px solid rgba(244,201,93,.3);
}
.weg-inv img { filter: drop-shadow(0 0 1.5px rgba(255,255,255,.9)) drop-shadow(0 0 10px rgba(255,255,255,.35)); }
.weg-end { height: 96px; width: max-content; margin: 26px auto 0; }
.weg-end img { filter: none; }

/* ---------- Boutons ---------- */
.btn {
  padding: 14px 34px; border-radius: 40px; font-size: 24px; font-weight: 600;
  background: linear-gradient(180deg, #7b4524, #4a2412);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.2), inset 0 0 0 2px var(--gold2), 0 6px 14px rgba(0,0,0,.5);
  color: #ffeccc; transition: transform .15s, filter .15s;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.15); }
.btn:active { transform: scale(.96); }
.btn.gold { background: linear-gradient(180deg, #ffe39a, #e0a93f 55%, #b07a22); color: #4a2a0c; text-shadow: 0 1px 0 rgba(255,255,255,.5); box-shadow: inset 0 2px 0 rgba(255,255,255,.7), inset 0 -3px 0 rgba(0,0,0,.2), 0 6px 16px rgba(0,0,0,.5); }
.btn.big { font-size: 30px; padding: 18px 50px; min-width: 360px; }
.btn.ghost { background: rgba(0,0,0,.35); box-shadow: inset 0 0 0 2px rgba(244,201,93,.5); font-size: 20px; }
.btn.small { padding: 8px 18px; font-size: 22px; }

/* ---------- Menu ---------- */
#menu, #intro, #ending, #preloader { position: absolute; inset: 0; border-radius: 0; overflow: hidden; }
/* Menu, préchargement, splash et fin occupent aussi la zone de l'inventaire */
#menu, #ending, #preloader, #splash { bottom: -134px !important; border-radius: 0; }
#menu { z-index: 50; opacity: 0; pointer-events: none; transition: opacity .6s; }
#menu.show { opacity: 1; pointer-events: auto; }
.menu-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; animation: kenburns 30s ease-in-out infinite alternate; }
@keyframes kenburns { to { transform: scale(1.08) translate(-1%, -1%); } }
.menu-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(10,5,25,.82) 0%, rgba(10,5,25,.5) 45%, transparent 75%); }
.menu-cat { position: absolute; right: 120px; bottom: 30px; width: 400px; filter: drop-shadow(0 20px 30px rgba(0,0,0,.7)); animation: catbreath 3.5s ease-in-out infinite; transform-origin: bottom; }
@keyframes catbreath { 50% { transform: scale(1.02, .985) translateY(2px); } }
.menu-box { position: absolute; left: 110px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 22px; align-items: flex-start; }
.menu-box h1 { margin: 0 0 30px; line-height: .9; }
.menu-box h1 span {
  display: block; font-size: 150px; font-weight: 700; letter-spacing: 2px;
  background: linear-gradient(180deg, #fff2c4 0%, #ffd36b 45%, #e08a1e 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 6px 0 #5a2a0a) drop-shadow(0 14px 20px rgba(0,0,0,.6));
  animation: titlein 1.1s cubic-bezier(.2,1.4,.5,1);
}
.menu-box h1 small { display: block; font-family: "Caveat", cursive; font-size: 96px; color: #ffe7b5; margin: -6px 0 0 160px; transform: rotate(-4deg); text-shadow: 0 4px 12px rgba(0,0,0,.7); }
@keyframes titlein { from { opacity: 0; transform: translateY(-40px) scale(.8); } }

/* ---------- Intro ---------- */
#intro { z-index: 45; display: grid; place-items: center; background: rgba(8,4,16,.62); backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity .6s; }
#intro.show { opacity: 1; pointer-events: auto; }
.intro-card {
  width: 880px; padding: 40px 60px 44px; border-radius: 30px; text-align: center;
  background: linear-gradient(180deg, rgba(40,22,12,.92), rgba(20,10,6,.95));
  box-shadow: inset 0 0 0 3px var(--gold2), inset 0 0 0 6px rgba(255,230,160,.2), 0 30px 60px rgba(0,0,0,.6);
}
.intro-card img { width: 170px; margin-top: -120px; filter: drop-shadow(0 10px 14px rgba(0,0,0,.6)); }
#intro-text { font-size: 34px; line-height: 1.4; min-height: 150px; margin: 18px 0 28px; color: #ffefd2; }
#intro-text.in { animation: txtin .6s ease-out; }
@keyframes txtin { from { opacity: 0; transform: translateY(12px); filter: blur(4px); } }

/* ---------- Fin ---------- */
#ending { z-index: 55; opacity: 0; pointer-events: none; transition: opacity 1s; }
#ending.show { opacity: 1; pointer-events: auto; }
.end-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; animation: kenburns 20s ease-in-out infinite alternate; filter: brightness(.55) saturate(.6) contrast(1.1); }
.end-night {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(1.5px 1.5px at 6% 8%, #fff 99%, transparent), radial-gradient(1px 1px at 14% 22%, #fff 99%, transparent),
    radial-gradient(2px 2px at 33% 6%, #fff 99%, transparent), radial-gradient(1px 1px at 41% 18%, #fff 99%, transparent),
    radial-gradient(1.5px 1.5px at 56% 4%, #fff 99%, transparent), radial-gradient(1px 1px at 61% 24%, #fff 99%, transparent),
    radial-gradient(2px 2px at 70% 12%, #fff 99%, transparent), radial-gradient(1px 1px at 77% 30%, #fff 99%, transparent),
    radial-gradient(1.5px 1.5px at 86% 7%, #fff 99%, transparent), radial-gradient(1px 1px at 93% 20%, #fff 99%, transparent),
    radial-gradient(1px 1px at 49% 30%, #fff 99%, transparent), radial-gradient(1.5px 1.5px at 24% 3%, #fff 99%, transparent),
    radial-gradient(circle at 50% 10%, rgba(170,200,255,.25), transparent 40%),
    linear-gradient(180deg, rgba(10,18,60,.75), rgba(15,25,70,.55) 45%, rgba(5,10,35,.7));
  mix-blend-mode: normal;
}
.end-moon {
  position: absolute; left: 740px; top: 50px; width: 140px; height: 140px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 38% 35%, #fffef4, #f3ecc8 55%, #d9cf9e);
  box-shadow: 0 0 40px 10px rgba(255,250,220,.55), 0 0 140px 50px rgba(190,210,255,.25);
}
.end-cat { position: absolute; left: 130px; bottom: 60px; width: 470px; filter: brightness(.85) drop-shadow(0 0 18px rgba(200,220,255,.35)) drop-shadow(0 30px 30px rgba(0,0,0,.45)); animation: hop 1.1s ease-in-out infinite; }
@keyframes hop { 0%,100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-60px) rotate(3deg); } }
.end-box {
  position: absolute; right: 120px; top: 50%; transform: translateY(-50%);
  width: 620px; padding: 40px; border-radius: 30px; text-align: center;
  background: rgba(255,250,235,.9); color: var(--ink);
  box-shadow: inset 0 0 0 4px #e0b25a, 0 30px 60px rgba(0,0,0,.4);
}
.end-box h2 { margin: 0; font-size: 96px; color: #e0781e; text-shadow: 0 4px 0 #ffd88a; }
.end-box p { font-size: 26px; margin: 8px 0 24px; }
.stats { display: flex; gap: 20px; justify-content: center; margin-bottom: 28px; }
.stats div { background: #fff; border-radius: 18px; padding: 12px 30px; box-shadow: inset 0 0 0 2px #e8cf9a; }
.stats span { display: block; font-size: 18px; color: #8a6a44; }
.stats b { font-size: 40px; }

/* ---------- Préchargement ---------- */
#preloader { z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; background: radial-gradient(circle at 50% 40%, #3b2350, #140a1f 75%); transition: opacity .8s; }
#preloader.gone { opacity: 0; pointer-events: none; }
.pl-cat { width: 200px; animation: catbreath 2s ease-in-out infinite; filter: drop-shadow(0 10px 20px rgba(0,0,0,.6)); }
.pl-pct { font-size: 90px; font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; text-shadow: 0 0 30px rgba(255,200,80,.5); }
.pl-track { width: 640px; height: 26px; border-radius: 13px; background: rgba(0,0,0,.5); box-shadow: inset 0 0 0 2px rgba(244,201,93,.5); overflow: hidden; padding: 4px; }
.pl-bar { height: 100%; width: 0; border-radius: 9px; background: linear-gradient(90deg, #ffb347, #ffe58a, #ffb347); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; transition: width .25s; box-shadow: 0 0 14px rgba(255,210,100,.8); }
@keyframes shimmer { to { background-position: -200% 0; } }
.pl-txt { font-size: 24px; color: #e8d4ff; opacity: .8; }

/* ---------- Splash ---------- */
#splash { position: absolute; inset: 0; z-index: 99; border-radius: 0; overflow: hidden; display: none; place-items: center; background: radial-gradient(ellipse at 50% 45%, #2a1a12 0%, #0c0705 70%, #050302 100%); transition: opacity .9s ease; }
#splash.show { display: grid; }
#splash.gone { opacity: 0; pointer-events: none; }
.sp-glow { position: absolute; width: 1200px; height: 900px; border-radius: 50%; background: radial-gradient(circle, rgba(255,170,90,.28), transparent 65%); opacity: 0; animation: spglow 3.6s ease-out .2s forwards; }
@keyframes spglow { 40% { opacity: 1; } to { opacity: .7; } }
.sp-card {
  position: relative; width: 900px; aspect-ratio: 791 / 590; border-radius: 22px; overflow: hidden;
  box-shadow: 0 0 0 2px rgba(255,220,170,.25), 0 40px 90px rgba(0,0,0,.8), 0 0 120px rgba(255,150,80,.18);
  opacity: 0; transform: scale(1.12); filter: blur(14px) brightness(.4);
  animation: spin 1.6s cubic-bezier(.16,1,.3,1) .25s forwards;
}
.sp-card img { width: 100%; height: 100%; display: block; animation: spzoom 4.5s ease-out .25s forwards; }
@keyframes spin { to { opacity: 1; transform: scale(1); filter: blur(0) brightness(1); } }
@keyframes spzoom { from { transform: scale(1.06); } to { transform: scale(1); } }
.sp-shine { position: absolute; inset: 0; background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.45) 50%, transparent 65%); transform: translateX(-120%); animation: spshine 1.3s ease-in-out 1.6s forwards; mix-blend-mode: overlay; }
@keyframes spshine { to { transform: translateX(120%); } }
.sp-line { position: absolute; bottom: 120px; height: 2px; width: 0; background: linear-gradient(90deg, transparent, #ffd9a0, transparent); animation: spline 1.4s ease-out 1.2s forwards; }
@keyframes spline { to { width: 520px; } }

/* ---------- Modales ---------- */
#modal { position: absolute; inset: 0; z-index: 48; display: grid; place-items: center; background: rgba(6,3,12,.66); backdrop-filter: blur(4px); opacity: 0; pointer-events: none; transition: opacity .3s; }
#modal.show { opacity: 1; pointer-events: auto; }
.modal-card {
  position: relative; min-width: 560px; max-width: 1100px; max-height: 840px; overflow: hidden;
  padding: 30px 46px 40px; border-radius: 28px; text-align: center;
  background: linear-gradient(180deg, #4b2815, #2a140a);
  box-shadow: inset 0 0 0 3px var(--gold2), inset 0 0 0 6px rgba(255,230,160,.18), 0 40px 80px rgba(0,0,0,.7);
  transform: scale(.85); transition: transform .35s cubic-bezier(.3,1.5,.6,1);
}
#modal.show .modal-card { transform: none; }
.modal-card h3 { margin: 0 0 14px; font-size: 36px; color: var(--gold); text-shadow: 0 2px 6px rgba(0,0,0,.6); }
.mclose { position: absolute; right: 18px; top: 18px; width: 48px; height: 48px; border-radius: 50%; font-size: 22px; background: rgba(0,0,0,.4); box-shadow: inset 0 0 0 2px var(--gold2); }
.mclose:hover { background: #7b2a1a; }
.pz-sub { font-size: 22px; color: #f3dfbf; margin: 0 0 22px; }
.shake { animation: shake .45s; }
@keyframes shake { 20%,60% { transform: translateX(-12px); } 40%,80% { transform: translateX(12px); } }
#stage.shake { animation: shake .45s; }

/* Notes */
.modal-card.note { background: none; box-shadow: none; padding: 0; overflow: visible; }
.modal-card.note h3 { position: absolute; left: 0; right: 0; top: 46px; z-index: 2; color: #6b3a12; text-shadow: none; font-family: "Caveat", cursive; font-size: 50px; }
.modal-card.note .mclose { right: -14px; top: -14px; z-index: 3; background: #4a2412; }
.paper {
  width: 820px; padding: 120px 80px 60px; text-align: left;
  background: url(../assets/tx_papier.webp) center / 420px, #f3e3c0;
  color: #3e2a14; border-radius: 6px;
  font-family: "Caveat", cursive; font-size: 40px; line-height: 1.25;
  box-shadow: 0 30px 60px rgba(0,0,0,.6), inset 0 0 60px rgba(120,70,20,.35);
  transform: rotate(-1.2deg);
}
.paper p { margin: 0 0 16px; }
.paper b { color: #8a2c0e; }
.paper .sign { text-align: right; }
.paper .big { font-size: 80px; text-align: center; letter-spacing: 10px; color: #1b3a7a; }
.journal .jlist { display: flex; flex-direction: column; gap: 12px; min-width: 620px; }
.jitem { display: flex; gap: 14px; align-items: center; padding: 16px 22px; border-radius: 16px; font-size: 24px; text-align: left; background: rgba(255,240,210,.08); box-shadow: inset 0 0 0 2px rgba(244,201,93,.35); }
.jitem:hover { background: rgba(255,240,210,.18); }
.empty { font-size: 24px; opacity: .8; }

/* Cadenas (tiroir + malle) */
.lock { display: inline-flex; gap: 16px; padding: 26px 34px; border-radius: 24px; transition: box-shadow .4s; }
.lock.brass { background: linear-gradient(180deg, #f3cf75, #b5802b); box-shadow: inset 0 3px 0 rgba(255,255,255,.6), inset 0 -4px 0 rgba(0,0,0,.25), 0 10px 26px rgba(0,0,0,.5); }
.lock.leather { background: linear-gradient(180deg, #8a3a26, #4c1c10); box-shadow: inset 0 0 0 4px #c79a4a, 0 10px 26px rgba(0,0,0,.5); }
.lock.solved { box-shadow: 0 0 0 6px #9dffbf, 0 0 60px rgba(130,255,180,.8); }
.wheel { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.wwin {
  width: 104px; height: 120px; border-radius: 16px; overflow: hidden; cursor: pointer;
  display: grid; place-items: center; font-size: 64px;
  background: linear-gradient(180deg, #ccc 0%, #fff 30%, #fff 70%, #bbb 100%);
  box-shadow: inset 0 0 0 3px #5a3a12, inset 0 8px 14px rgba(0,0,0,.35), inset 0 -8px 14px rgba(0,0,0,.35);
  color: #3b2614; font-weight: 700;
}
.wheel.letter .wwin { width: 86px; font-size: 62px; }
.roll-up { animation: rollup .2s ease-out; } .roll-dn { animation: rolldn .2s ease-out; }
@keyframes rollup { from { transform: translateY(-60%); opacity: 0; } }
@keyframes rolldn { from { transform: translateY(60%); opacity: 0; } }
.wbtn { width: 64px; height: 36px; border-radius: 12px; background: rgba(0,0,0,.35); position: relative; }
.wbtn::after { content: ""; position: absolute; left: 50%; top: 50%; border: 11px solid transparent; translate: -50% -75%; }
.wbtn.up::after { border-bottom-color: #ffeccc; }
.wbtn.dn::after { border-top-color: #ffeccc; translate: -50% -25%; }
.wbtn:hover { background: rgba(0,0,0,.55); }

/* Horloge */
.clockface {
  position: relative; width: 440px; height: 440px; margin: 0 auto 24px; border-radius: 50%;
  background: radial-gradient(circle, #fffaf0 0%, #f1e2c2 70%, #d9c095 100%);
  box-shadow: 0 0 0 16px #7a3f1b, 0 0 0 20px var(--gold), 0 0 0 24px #5a2a10, 0 20px 40px rgba(0,0,0,.6), inset 0 0 40px rgba(120,70,20,.4);
  transition: box-shadow .4s;
}
.clockface.solved { box-shadow: 0 0 0 16px #7a3f1b, 0 0 0 20px #9dffbf, 0 0 0 24px #5a2a10, 0 0 80px rgba(130,255,180,.9); }
.cnum { position: absolute; transform: translate(-50%, -50%); font-family: Georgia, serif; font-size: 30px; font-weight: 700; color: #3b2614; }
.ctick { position: absolute; left: 50%; top: 4px; width: 2px; height: 10px; margin-left: -1px; background: #6b4a2a; transform-origin: 1px 216px; }
.ctick.big { width: 4px; margin-left: -2px; height: 18px; transform-origin: 2px 216px; background: #3b2614; }
.hand { position: absolute; left: 50%; bottom: 50%; border-radius: 6px; transform-origin: 50% 100%; transition: transform .3s cubic-bezier(.3,1.4,.6,1); background: linear-gradient(90deg, #2a1608, #5a3a1a); }
.hand.hour { width: 14px; height: 120px; margin-left: -7px; }
.hand.minute { width: 8px; height: 180px; margin-left: -4px; }
.cpin { position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; margin: -13px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff3c0, var(--gold) 45%, #8a5a1c); }
.clock-ctrl { display: flex; gap: 40px; justify-content: center; }
.cgroup { display: flex; align-items: center; gap: 12px; }
.clab { font-size: 22px; min-width: 90px; }

/* Coffre-fort */
.safe { display: inline-block; padding: 30px; border-radius: 24px; background: linear-gradient(180deg, #9aa3ad, #5d6670); box-shadow: inset 0 3px 0 rgba(255,255,255,.5), inset 0 -4px 0 rgba(0,0,0,.3), 0 14px 30px rgba(0,0,0,.6); }
.safe-screen { font-family: "Courier New", monospace; font-size: 56px; font-weight: 700; letter-spacing: 16px; color: #7dffb0; background: #0d1a12; border-radius: 12px; padding: 10px 20px 10px 36px; margin-bottom: 22px; box-shadow: inset 0 0 18px rgba(0,0,0,.8); text-shadow: 0 0 12px rgba(125,255,176,.8); }
.safe-screen.bad { color: #ff6b6b; text-shadow: 0 0 12px rgba(255,80,80,.8); }
.safe-screen.ok { letter-spacing: 6px; }
.keypad { display: grid; grid-template-columns: repeat(3, 96px); gap: 14px; }
.key { height: 76px; border-radius: 16px; font-size: 34px; font-weight: 700; color: #2a2f36; background: linear-gradient(180deg, #f4f6f8, #c4cad1); box-shadow: inset 0 -4px 0 rgba(0,0,0,.2), 0 4px 8px rgba(0,0,0,.35); }
.key:active { transform: translateY(3px); box-shadow: inset 0 -1px 0 rgba(0,0,0,.2); }

/* Aquarium */
.tank {
  position: relative; width: 760px; height: 440px; margin: 0 auto; border-radius: 26px; overflow: hidden;
  background: linear-gradient(180deg, #74d4f2 0%, #2b8fc7 55%, #145a8e 100%);
  box-shadow: inset 0 0 0 6px rgba(255,255,255,.35), inset 0 0 60px rgba(0,30,80,.6), 0 16px 30px rgba(0,0,0,.6);
}
.tank::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(100deg, rgba(255,255,255,.08) 0 30px, transparent 30px 90px); animation: caustic 6s linear infinite; pointer-events: none; }
@keyframes caustic { to { background-position: 360px 0; } }
.sand { position: absolute; left: 0; right: 0; bottom: 0; height: 60px; background: linear-gradient(180deg, #f2d79a, #c9a35e); border-radius: 50% 50% 0 0 / 20px 20px 0 0; }
.weed { position: absolute; bottom: 30px; font-size: 80px; transform-origin: bottom; animation: sway 3s ease-in-out infinite; }
.w1 { left: 60px; } .w2 { left: 300px; animation-delay: -1s; } .w3 { left: 520px; font-size: 60px; } .w4 { left: 660px; animation-delay: -2s; }
@keyframes sway { 50% { transform: rotate(8deg); } }
.crit { position: absolute; left: 0; top: 0; font-size: 46px; line-height: 1; will-change: transform; }
.crit.crab, .crit.snail { font-size: 40px; }
.bubble { position: absolute; bottom: -20px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid rgba(255,255,255,.7); animation: bubble 6s linear infinite; }
@keyframes bubble { to { transform: translateY(-480px) translateX(20px); opacity: .2; } }

/* Piano */
.sheet { width: 760px; margin: 0 auto 26px; padding: 14px 20px 20px; border-radius: 10px; background: url(../assets/tx_papier.webp) center / 300px, #f3e3c0; color: #3e2a14; box-shadow: 0 10px 20px rgba(0,0,0,.4); transition: box-shadow .4s; }
.sheet.solved { box-shadow: 0 0 0 5px #9dffbf, 0 0 50px rgba(130,255,180,.8); }
.sheet-title { font-family: "Caveat", cursive; font-size: 34px; font-weight: 700; }
.staff { position: relative; height: 150px; }
.sline { position: absolute; left: 10px; right: 10px; height: 2px; background: #3e2a14; }
.clef { position: absolute; left: 20px; top: 30px; font-size: 64px; line-height: 1; color: #3e2a14; }
.sbar { position: absolute; top: 30px; width: 2px; height: 74px; background: #3e2a14; }
.snote { position: absolute; width: 22px; height: 16px; border-radius: 50%; background: #2a1608; transform: rotate(-20deg); transition: background .2s, box-shadow .2s; }
.snote::after { content: ""; position: absolute; right: 0; bottom: 8px; width: 2px; height: 46px; background: inherit; transform: rotate(20deg); transform-origin: bottom; }
.snote.ledger::before { content: ""; position: absolute; left: -7px; top: 7px; width: 36px; height: 2px; background: #3e2a14; transform: rotate(20deg); }
.snote.lit { background: #e88a12; box-shadow: 0 0 12px 3px rgba(255,170,40,.9); }
.nlab { position: absolute; top: 30px; left: -8px; transform: rotate(20deg); font-family: "Caveat", cursive; font-size: 26px; font-weight: 700; color: #b3360f; }
.keyboard { position: relative; display: flex; width: 760px; height: 230px; margin: 0 auto; padding: 0 10px 10px; border-radius: 0 0 16px 16px; background: linear-gradient(180deg, #2a1206, #5a2a10); box-shadow: 0 12px 24px rgba(0,0,0,.6); }
.pkey { flex: 1; margin: 0 2px; border-radius: 0 0 10px 10px; background: linear-gradient(180deg, #e8e2d6, #fffdf8 20%, #f4efe4); box-shadow: inset 0 -8px 0 #d8d0c0, 0 4px 6px rgba(0,0,0,.5); display: flex; align-items: flex-end; justify-content: center; padding-bottom: 18px; color: #6b4a2a; font-size: 22px; font-weight: 600; transition: transform .05s; }
.pkey.down { transform: translateY(4px); box-shadow: inset 0 -3px 0 #d8d0c0; background: linear-gradient(180deg, #ffe7a0, #fff3cf); }
.pblack { position: absolute; top: 0; width: 6.8%; height: 58%; z-index: 2; border-radius: 0 0 8px 8px; background: linear-gradient(180deg, #111, #333); box-shadow: inset 0 -6px 0 #000, 0 4px 6px rgba(0,0,0,.6); }
.pblack:active { height: 56%; }

/* Épices */
.shelf { display: flex; gap: 20px; justify-content: center; padding: 20px 30px 0; border-bottom: 22px solid #7a3f1b; border-radius: 4px; box-shadow: 0 14px 18px rgba(0,0,0,.4); }
.jar { width: 110px; background: none; display: flex; flex-direction: column; align-items: center; transform-origin: 50% 100%; transition: transform .2s; }
.jar:hover { transform: translateY(-8px); }
.jar.pour { animation: pour .6s ease-in-out; }
@keyframes pour { 40% { transform: translate(20px, -40px) rotate(35deg); } }
.lid { width: 76px; height: 22px; border-radius: 8px 8px 4px 4px; background: linear-gradient(180deg, #c49043, #7a5320); }
.glass { position: relative; width: 96px; height: 130px; border-radius: 14px 14px 22px 22px; overflow: hidden; background: rgba(255,255,255,.25); box-shadow: inset 0 0 0 3px rgba(255,255,255,.55), inset 10px 0 12px rgba(255,255,255,.35); }
.powder { position: absolute; left: 0; right: 0; bottom: 0; height: 70%; filter: contrast(1.1); background-image: radial-gradient(rgba(255,255,255,.15) 1px, transparent 1px) !important; background-size: 6px 6px; }
.label { position: absolute; left: 6px; right: 6px; top: 44px; padding: 6px 0; border-radius: 6px; background: #fff7e2; color: #4a2a0c; font-family: "Caveat", cursive; font-size: 24px; font-weight: 700; box-shadow: 0 2px 4px rgba(0,0,0,.3); }
.pot { position: relative; width: 340px; height: 120px; margin: 34px auto 0; border-radius: 20px 20px 120px 120px; background: linear-gradient(180deg, #4a4f57, #1d2025); box-shadow: inset 0 10px 0 #6a707a, 0 10px 20px rgba(0,0,0,.5); display: grid; place-items: center; transition: box-shadow .4s; }
.pot.solved { box-shadow: inset 0 10px 0 #6a707a, 0 0 60px rgba(255,210,100,.9); }
.pot-dots { display: flex; gap: 14px; }
.pot-dots i { width: 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,.12); box-shadow: inset 0 0 0 2px rgba(255,255,255,.3); transition: transform .3s; }
.pot-dots i.on { transform: scale(1.2); box-shadow: 0 0 12px rgba(255,220,140,.8); }

/* Télescope */
.scope { width: 760px; height: 440px; margin: 0 auto; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 14px #2a1608, 0 0 0 18px var(--gold2), 0 20px 40px rgba(0,0,0,.6); }
.scope canvas { display: block; }
.focus-row { display: flex; align-items: center; gap: 20px; justify-content: center; margin-top: 34px; }
.focus-lab { font-size: 22px; }
.focus { -webkit-appearance: none; appearance: none; width: 460px; height: 14px; border-radius: 7px; background: linear-gradient(90deg, #3b2614, #8a5a1c); outline: none; }
.focus::-webkit-slider-thumb { -webkit-appearance: none; width: 40px; height: 40px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff3c0, var(--gold) 45%, #8a5a1c); box-shadow: 0 3px 8px rgba(0,0,0,.6); cursor: grab; }
.focus::-moz-range-thumb { width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--gold); cursor: grab; }
.scope-cap { height: 50px; margin-top: 16px; font-size: 40px; font-weight: 700; letter-spacing: 12px; color: var(--gold); opacity: 0; transition: opacity .6s; }
.scope-cap.on { opacity: 1; text-shadow: 0 0 20px rgba(255,210,100,.9); }

/* Câbles */
.wires { position: relative; display: inline-block; padding: 18px 70px; border-radius: 20px; background: linear-gradient(180deg, #4d555e, #2a2f35); box-shadow: inset 0 0 0 4px #6b747e, 0 14px 30px rgba(0,0,0,.6); transition: box-shadow .4s; }
.wires.solved { box-shadow: inset 0 0 0 4px #ffe066, 0 0 60px rgba(255,220,80,.8); }
.wgrid { display: grid; grid-template-columns: repeat(6, 100px); grid-template-rows: repeat(4, 100px); gap: 4px; }
.wtile { position: relative; background: #1b1f24; border-radius: 10px; box-shadow: inset 0 0 0 2px #39414a; }
.wtile:hover { background: #252a31; }
.winner { position: absolute; inset: 0; transition: transform .2s cubic-bezier(.3,1.4,.6,1); }
.arm { position: absolute; background: #5e6873; border-radius: 6px; transition: background .2s, box-shadow .2s; }
.arm.n { left: 50%; top: 0; width: 16px; height: 58px; margin-left: -8px; }
.arm.s { left: 50%; bottom: 0; width: 16px; height: 58px; margin-left: -8px; }
.arm.e { top: 50%; right: 0; height: 16px; width: 58px; margin-top: -8px; }
.arm.w { top: 50%; left: 0; height: 16px; width: 58px; margin-top: -8px; }
.hub { position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; margin: -13px; border-radius: 50%; background: #707b86; }
.wtile.on .arm, .wtile.on .hub { background: #ffd84a; box-shadow: 0 0 14px rgba(255,216,74,.9); }
.wsrc, .wdst { position: absolute; font-size: 46px; transform: translateY(-50%); filter: grayscale(.7) brightness(.7); transition: filter .3s; }
.wsrc { left: 14px; } .wdst { right: 14px; }
.wsrc.on, .wdst.on { filter: drop-shadow(0 0 12px #ffd84a); }

/* ---------- Mobile portrait ---------- */
#rotate { display: none; }
@media (pointer: coarse) {
  #inventory { gap: 12px; padding: 0 12px; }
  #slots { gap: 12px; }
  .slot { width: 104px; height: 104px; }
  .slot img { width: 84px; height: 84px; }
  .inv-arrow { width: 72px; height: 104px; }
  .weg-inv { height: 92px; padding-left: 16px; }
}
@media (orientation: portrait) and (pointer: coarse) {
  #rotate { display: flex; position: fixed; inset: 0; z-index: 999; flex-direction: column; align-items: center; justify-content: center; background: #140a1f; font-size: 22px; text-align: center; }
  #rotate div { font-size: 70px; animation: rotatehint 2s ease-in-out infinite; }
}

@keyframes rotatehint { 50% { transform: rotate(90deg); } }

/* ---------- Bouton « Jouer » du préchargement ---------- */
.pl-play { display: none; animation: plpop .5s cubic-bezier(.3,1.6,.6,1); }
#preloader.ready .pl-play { display: block; }
#preloader.ready .pl-track, #preloader.ready .pl-txt { display: none; }
#preloader.ready .pl-pct { display: none; }
@keyframes plpop { from { opacity: 0; transform: scale(.7); } }

/* ---------- Classement ---------- */
#scores { position: absolute; inset: 0; bottom: -134px; z-index: 60; border-radius: 0; display: grid; place-items: center; background: rgba(6,3,12,.7); backdrop-filter: blur(5px); opacity: 0; pointer-events: none; transition: opacity .35s; }
#scores.show { opacity: 1; pointer-events: auto; }
.sc-card {
  position: relative; width: 680px; padding: 0 48px 40px; border-radius: 30px; text-align: center;
  background: linear-gradient(180deg, rgba(75,40,21,.94), rgba(36,18,9,.97)), url(../assets/tx_bois.webp) center / cover;
  box-shadow: inset 0 0 0 3px var(--gold2), inset 0 0 0 7px #3a1b0a, inset 0 0 0 9px rgba(255,230,160,.35), 0 40px 90px rgba(0,0,0,.75);
  transform: translateY(30px) scale(.92); transition: transform .45s cubic-bezier(.3,1.4,.6,1);
}
#scores.show .sc-card { transform: none; }
.sc-card .mclose { z-index: 2; }
.sc-head { display: flex; flex-direction: column; align-items: center; }
.sc-head img { width: 150px; margin-top: -86px; filter: drop-shadow(0 10px 14px rgba(0,0,0,.6)); }
.sc-head h3 {
  margin: 0 0 22px; font-size: 64px; font-weight: 700; line-height: 1;
  background: linear-gradient(180deg, #fff2c4 0%, #ffd36b 45%, #e08a1e 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 #5a2a0a) drop-shadow(0 8px 12px rgba(0,0,0,.5));
}
.sc-you { display: grid; grid-template-columns: auto auto auto auto; align-items: baseline; justify-content: center; gap: 4px 14px; margin: -6px 0 18px; padding: 12px 20px; border-radius: 16px; background: rgba(244,201,93,.14); box-shadow: inset 0 0 0 2px rgba(244,201,93,.5); }
.sc-you span { font-size: 18px; color: #e9cf9f; }
.sc-you b { font-size: 34px; color: var(--gold); font-variant-numeric: tabular-nums; margin-right: 14px; }
.sc-you sup { font-size: .5em; }
.sc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sc-row {
  display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 16px;
  height: 54px; padding: 0 22px 0 8px; border-radius: 27px;
  background: rgba(255,240,210,.07); box-shadow: inset 0 0 0 1.5px rgba(244,201,93,.22);
  font-size: 26px; text-align: left;
  animation: scrow .45s ease-out both; animation-delay: calc(var(--i) * 45ms);
}
@keyframes scrow { from { opacity: 0; transform: translateX(-24px); } }
.sc-rank {
  width: 40px; height: 40px; margin-left: 4px; border-radius: 50%; display: grid; place-items: center;
  font-size: 20px; font-weight: 700; color: #e9cf9f; background: rgba(0,0,0,.35); box-shadow: inset 0 0 0 2px rgba(244,201,93,.35);
}
.sc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #ffefd2; }
.sc-time { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--gold); letter-spacing: 1px; }
.sc-row.p1 .sc-rank { color: #5a3a06; background: radial-gradient(circle at 35% 30%, #fff6c8, #f4c95d 50%, #a8731c); box-shadow: 0 0 14px rgba(255,210,90,.6); }
.sc-row.p2 .sc-rank { color: #3c4248; background: radial-gradient(circle at 35% 30%, #ffffff, #c9d1d8 50%, #7f8992); }
.sc-row.p3 .sc-rank { color: #4a2410; background: radial-gradient(circle at 35% 30%, #ffd9b8, #d08a52 50%, #8a4c22); }
.sc-row.p1 { background: linear-gradient(90deg, rgba(244,201,93,.22), rgba(244,201,93,.05)); }
.sc-row.me { background: linear-gradient(90deg, rgba(255,180,70,.45), rgba(255,180,70,.12)); box-shadow: inset 0 0 0 2px var(--gold), 0 0 18px rgba(255,200,80,.35); }
.sc-row.me .sc-name { font-weight: 600; color: #fff; }
.sc-row.empty .sc-name { color: rgba(255,239,210,.3); }
.sc-row.skel .sc-name, .sc-row.skel .sc-time { height: 16px; border-radius: 8px; background: linear-gradient(90deg, rgba(255,240,210,.08), rgba(255,240,210,.2), rgba(255,240,210,.08)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.sc-row.skel .sc-name { width: 60%; }
.sc-row.skel .sc-time { width: 80px; }
.sc-msg { padding: 60px 20px; font-size: 24px; color: #e9cf9f; }

/* ---------- Enregistrement du temps (écran de fin) ---------- */
.end-score { margin: -8px 0 24px; }
.es-row { display: flex; gap: 12px; justify-content: center; }
.es-row input {
  width: 300px; height: 62px; padding: 0 24px; border: 0; border-radius: 31px; outline: none;
  font: 500 26px "Fredoka", sans-serif; color: var(--ink); background: #fff;
  box-shadow: inset 0 0 0 2px #e8cf9a, inset 0 3px 6px rgba(120,80,30,.12);
  user-select: text; -webkit-user-select: text; transition: box-shadow .2s;
}
.es-row input:focus { box-shadow: inset 0 0 0 3px #e0a93f, 0 0 0 5px rgba(244,201,93,.3); }
.es-row input::placeholder { color: #bfa27a; }
.es-row .btn { height: 62px; padding: 0 28px; }
.es-row .btn:disabled { filter: grayscale(.4) brightness(.9); cursor: default; transform: none; }
.es-msg { min-height: 30px; margin: 10px 0 0 !important; font-size: 21px !important; color: #8a6a44; }
.es-msg b { color: #e0781e; }
.end-score.bad .es-msg { color: #c0392b; }
.end-score.bad input { animation: shake .4s; box-shadow: inset 0 0 0 3px #e06a5a; }
.end-score.done .es-row, .end-score.off .es-row { display: none; }
.end-score.done .es-msg { font-size: 26px !important; color: var(--ink); }
.es-link { display: block; margin: 8px auto 0; padding: 0; background: none; font-size: 20px; font-weight: 600; color: #b9832b; text-decoration: underline; text-underline-offset: 4px; }
.es-link:hover { color: #e0781e; }

/* ---------- Splash World Escape Games, dans le cadre du jeu ---------- */
#stage > #weg-splash { position: absolute; inset: 0; bottom: -134px; z-index: 100; border-radius: 0; overflow: hidden; --u: 16px; }
