:root {
  --gold: #d6b26a;
  --gold-2: #f3dca0;
  --gold-dk: #8a6a2c;
  --red: #7d1b17;
  --ink: #120c08;
  --text: #f1e6cf;
  --muted: #b9a684;
  --serif: "Cormorant Garamond", Georgia, serif;
  --caps: "Cinzel", "Trajan Pro", Georgia, serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; background: #050302; color: var(--text);
  font-family: var(--serif); overflow: hidden;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
img { -webkit-user-drag: none; user-drag: none; pointer-events: none; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- Encadrement permanent ---------- */
#frame {
  position: fixed; inset: clamp(4px, 1.2vmin, 14px);
  border: 2px solid var(--gold);
  outline: 1px solid var(--gold-dk); outline-offset: 4px;
  box-shadow: 0 0 40px rgba(0,0,0,.9);
  background: radial-gradient(ellipse at center, #1b120b 0%, #070403 75%);
  overflow: hidden;
}

/* ---------- Écrans ---------- */
.screen { position: absolute; inset: 0; display: none; opacity: 0; transition: opacity .8s ease; }
.screen.active { display: flex; }
.screen.shown { opacity: 1; }

/* Préchargement */
#loader { flex-direction: column; align-items: center; justify-content: center; gap: 14px; opacity: 1; }
.laurel { width: clamp(110px, 22vmin, 170px); filter: drop-shadow(0 0 14px rgba(214,178,106,.35)); animation: pulse 2.4s ease-in-out infinite; }
.load-title { font-family: var(--caps); letter-spacing: .45em; font-size: clamp(16px, 3vw, 26px); color: var(--gold-2); padding-left: .45em; }
#loadPct { font-family: var(--caps); font-size: clamp(38px, 8vw, 72px); color: var(--gold); text-shadow: 0 0 24px rgba(214,178,106,.5); }
.load-bar { width: min(380px, 70vw); height: 4px; background: #2a1d10; border: 1px solid var(--gold-dk); }
.load-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-dk), var(--gold-2)); box-shadow: 0 0 12px var(--gold); transition: width .2s; }
.load-sub { font-style: italic; color: var(--muted); }
/* Fin du chargement : la barre cède la place au bouton d'entrée, dans le flux sous le titre */
#btnEnter { display: none; }
.load-escape { display: block; margin: .5em 0 0 -.75em; font-size: .6em; letter-spacing: .7em; padding-left: .7em; text-align: center; color: var(--gold); }
#loader.ready #loadPct, #loader.ready .load-bar, #loader.ready .load-sub { display: none; }
#loader.ready #btnEnter { display: block; margin-top: 18px; animation: enterIn .6s ease-out both, enterGlow 2.4s ease-in-out 1s infinite alternate; }
@keyframes enterIn { from { opacity: 0; transform: translateY(8px); } }
@keyframes enterGlow { to { box-shadow: inset 0 0 0 2px rgba(0,0,0,.35), 0 0 26px rgba(214,178,106,.55); } }

/* Splash */
#splash { align-items: center; justify-content: center; background: #050302; transition: opacity 1s ease; }
.splash-bg { position: absolute; inset: -40px; background: url(../img/brand/slyness.png) center/cover; filter: blur(28px) brightness(.35) saturate(1.2); transform: scale(1.1); }
.splash-bg::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at center, transparent 20%, rgba(5,3,2,.92) 75%); }
.splash-card {
  position: relative; width: min(78vw, 120vh, 720px); aspect-ratio: 791 / 590; overflow: hidden; border-radius: 6px;
  border: 1px solid var(--gold); box-shadow: 0 0 0 5px rgba(0,0,0,.45), 0 0 0 6px rgba(214,178,106,.4), 0 30px 80px #000, 0 0 60px rgba(214,178,106,.18);
  opacity: 0; transform: scale(.92); filter: blur(8px);
}
#splash.shown .splash-card { animation: splashIn 1.4s cubic-bezier(.2,.8,.2,1) .2s forwards, breathe 6s ease-in-out 1.6s infinite alternate; }
.splash-card img { display: block; width: 100%; height: 100%; object-fit: cover; }
.splash-shine { position: absolute; inset: 0; background: linear-gradient(105deg, transparent 35%, rgba(255,240,200,.45) 50%, transparent 65%); transform: translateX(-120%); }
#splash.shown .splash-shine { animation: shine 1.3s ease-in-out 1.4s forwards; }
/* Splash : couronne de laurier, torches, braises, lumière de la porte */
.splash-wrap { position: relative; }
.splash-fx { z-index: 1; }
.splash-wrap { z-index: 2; }
.crown { position: absolute; left: -14%; width: 128%; top: -10%; height: 122%; overflow: visible; pointer-events: none; filter: drop-shadow(0 0 10px rgba(214,178,106,.45)) drop-shadow(0 3px 2px #000); }
.crown .stem { fill: none; stroke: url(#laurelGold); stroke-width: 7; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.crown .leaf { fill: url(#laurelGold); opacity: 0; transform: scale(0); }
#splash.shown .crown .stem { animation: drawStem 1.5s ease-out .6s forwards; }
#splash.shown .crown .leaf { animation: leafIn .5s cubic-bezier(.3,1.6,.5,1) forwards; }
@keyframes drawStem { to { stroke-dashoffset: 0; } }
@keyframes leafIn { from { opacity: 0; transform: scale(0); } to { opacity: 1; transform: scale(1); } }
/* Lumière dans l'ouverture noire de la porte du logo (mesurée sur l'image), coupée à ses bords */
.splash-door { position: absolute; left: 39.7%; top: 29.7%; width: 21.7%; height: 48.4%; overflow: hidden; clip-path: inset(0); pointer-events: none; mix-blend-mode: screen; opacity: 0;
  background: radial-gradient(ellipse at 50% 100%, rgba(255,214,130,.95), rgba(255,170,60,.45) 45%, transparent 75%); }
.splash-door::after { content: ""; position: absolute; left: -120%; right: -120%; top: -60%; bottom: -30%; mix-blend-mode: screen;
  background: repeating-conic-gradient(from 180deg at 50% 92%, rgba(255,220,150,.22) 0 4deg, transparent 4deg 13deg);
  -webkit-mask: radial-gradient(ellipse at 50% 92%, #000 10%, transparent 65%); mask: radial-gradient(ellipse at 50% 92%, #000 10%, transparent 65%);
  animation: rays 9s linear infinite; }
#splash.shown .splash-door { animation: doorGlow 1.6s ease-out 1.3s forwards, doorPulse 2.2s ease-in-out 2.9s infinite alternate; }
@keyframes doorGlow { to { opacity: .9; } }
@keyframes doorPulse { from { opacity: .9; } to { opacity: .6; } }
@keyframes rays { 50% { transform: rotate(4deg); } }
.splash-torch { position: absolute; top: 50%; width: 46vmin; aspect-ratio: 1; transform: translate(-50%, -50%); mix-blend-mode: screen; pointer-events: none; opacity: 0;
  background: radial-gradient(circle, rgba(255,170,70,.5), rgba(255,110,30,.15) 40%, transparent 70%); }
.splash-torch.l { left: 6%; } .splash-torch.r { left: 94%; }
#splash.shown .splash-torch { animation: fadeIn 1.2s ease .3s forwards, flicker 1s ease-in-out 1.5s infinite alternate; }
#splash.shown .splash-torch.r { animation-duration: 1.2s, .8s; }
@keyframes splashIn { to { opacity: 1; transform: scale(1); filter: blur(0); } }
@keyframes shine { to { transform: translateX(120%); } }

/* Logo World Escape Games */
.weg { position: absolute; right: clamp(14px, 2.5vmin, 30px); bottom: clamp(14px, 2.5vmin, 30px); z-index: 5; display: block; line-height: 0;
  opacity: .85; transition: opacity .25s, transform .25s, filter .25s; filter: drop-shadow(0 4px 10px #000); }
.weg img { width: clamp(90px, 16vmin, 150px); height: auto; }
.weg:hover { opacity: 1; transform: translateY(-2px); filter: drop-shadow(0 4px 10px #000) drop-shadow(0 0 10px rgba(214,178,106,.45)); }
#menu .weg img { width: clamp(170px, 30vmin, 300px); }
#ending .weg img { width: clamp(170px, 30vmin, 300px); }
.weg.inline { position: static; flex: none; }
.weg.inline img { width: clamp(110px, 19vmin, 210px); }

/* Developed by */
.dev { margin-top: 10px; font-family: var(--caps); font-size: 12px; letter-spacing: .3em; color: var(--muted); text-transform: uppercase; }
.sly { position: relative; display: inline-block; margin-left: .3em; font-family: var(--serif); font-style: italic; font-weight: 600;
  font-size: 22px; letter-spacing: .06em; text-transform: none;
  background: linear-gradient(100deg, #c8302a 0%, #ff6a3d 30%, #fff1c4 48%, #ff6a3d 62%, #9b1d18 100%); background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: slyShine 4s linear infinite, slyTorch 2.2s ease-in-out infinite; }
.sly::after { content: ""; position: absolute; left: -10%; right: -10%; bottom: -2px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-2), transparent); animation: pulse 2.2s ease-in-out infinite; }
@keyframes slyShine { from { background-position: 150% 0; } to { background-position: -100% 0; } }
@keyframes slyTorch {
  0%,100% { filter: drop-shadow(0 0 4px rgba(255,110,50,.55)) drop-shadow(0 0 12px rgba(214,178,106,.25)); }
  40% { filter: drop-shadow(0 0 7px rgba(255,140,60,.85)) drop-shadow(0 0 18px rgba(214,178,106,.45)); }
  70% { filter: drop-shadow(0 0 3px rgba(255,90,40,.5)) drop-shadow(0 0 10px rgba(214,178,106,.2)); }
}

/* Menu */
#menu, #ending { align-items: center; justify-content: center; }
.menu-bg { position: absolute; inset: 0; background: url(../img/scenes/menu.webp) center/cover; }
.menu-bg::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(10,5,3,.25), rgba(5,2,1,.9) 80%); }
.menu-bg.end { background-image: url(../img/scenes/fin_bonne.webp); }
.menu-bg.end::before { content: ""; position: absolute; inset: 0; opacity: 0; }
#ending.played .menu-bg.end::before { animation: fadeIn 5s ease 0.6s forwards; }
#ending.good .menu-bg.end::before { background: radial-gradient(ellipse at 85% 25%, rgba(255,200,120,.45), transparent 60%); mix-blend-mode: screen; }
#ending.tragic .menu-bg.end::before { background: radial-gradient(ellipse at 50% 60%, rgba(150,10,5,.1), rgba(110,0,0,.7) 85%); mix-blend-mode: multiply; }
#ending.tragic.played .menu-bg.end { animation: bleed 7s ease forwards; }
@keyframes bleed { to { filter: grayscale(.8) contrast(1.15) brightness(.8); } }
@keyframes fadeIn { to { opacity: 1; } }
#ending.tragic h1 { background-image: linear-gradient(180deg, #ffd6c8 0%, #c0392b 55%, #4a0b07 100%); filter: drop-shadow(0 3px 0 #1a0604) drop-shadow(0 0 18px rgba(192,57,43,.45)); }
.fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.menu-box {
  position: relative; z-index: 2; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: clamp(20px, 4vw, 44px) clamp(24px, 6vw, 70px);
  background: linear-gradient(180deg, rgba(20,11,6,.78), rgba(10,5,3,.88));
  border: 1px solid var(--gold-dk); box-shadow: 0 0 0 4px rgba(0,0,0,.4), 0 0 0 5px rgba(214,178,106,.35), 0 20px 60px #000;
  max-width: 92%;
}
.menu-box.small { padding: 28px 40px; }
.menu-kicker { font-family: var(--caps); font-size: 12px; letter-spacing: .35em; color: var(--muted); }
h1 { margin: 0; font-family: var(--caps); font-weight: 800; font-size: clamp(36px, 8vw, 84px); letter-spacing: .06em; line-height: 1;
  background: linear-gradient(180deg, #fff3c9 0%, var(--gold) 55%, var(--gold-dk) 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 #2a1608) drop-shadow(0 0 18px rgba(214,178,106,.35)); }
h2 { margin: 0 0 6px; font-family: var(--caps); color: var(--gold); letter-spacing: .2em; }
.menu-sep { width: 70%; height: 1px; margin: 6px 0 10px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.btn {
  min-width: 240px; padding: 11px 26px; font-family: var(--caps); font-size: 15px; letter-spacing: .14em;
  background: linear-gradient(180deg, #5b1712, #3a0d0a); color: var(--gold-2);
  border: 1px solid var(--gold); box-shadow: inset 0 0 0 2px rgba(0,0,0,.35), 0 4px 14px rgba(0,0,0,.5);
  transition: transform .15s, box-shadow .2s, filter .2s;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.2); box-shadow: inset 0 0 0 2px rgba(0,0,0,.35), 0 0 18px rgba(214,178,106,.4); }
.btn.ghost { background: rgba(20,12,6,.6); }
.lang { position: relative; }
.lang-sel { min-width: 240px; padding: 9px 34px 9px 16px; font-family: var(--caps); font-size: 14px; letter-spacing: .08em; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  color: var(--gold-2); background: rgba(20,12,6,.6) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23d6b26a' stroke-width='1.6'/%3E%3C/svg%3E") right 14px center no-repeat;
  border: 1px solid var(--gold); }
.lang-sel:focus-visible, .lang-sel[aria-expanded="true"] { outline: none; box-shadow: 0 0 14px rgba(214,178,106,.4); }
.flag { width: 24px; height: 16px; object-fit: cover; flex: none; box-shadow: 0 0 0 1px rgba(0,0,0,.6); }
.lang-list { position: absolute; z-index: 5; left: 0; right: 0; bottom: calc(100% + 4px); margin: 0; padding: 4px; list-style: none;
  max-height: 60vh; overflow-y: auto; background: #1a100a; border: 1px solid var(--gold); box-shadow: 0 10px 30px #000; }
.lang-list li { display: flex; align-items: center; gap: 10px; padding: 7px 12px; cursor: pointer; color: var(--gold-2); font-size: 15px; text-align: left; }
.lang-list li:hover { background: rgba(214,178,106,.15); }
.lang-list li[aria-selected="true"] { background: rgba(214,178,106,.25); }
.btn:disabled { opacity: .35; pointer-events: none; }
#scores { width: min(420px, 100%); display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 6px; }
#scoreForm { display: flex; gap: 8px; width: 100%; }
#scoreForm[hidden] { display: none; }
#scoreName { flex: 1; min-width: 0; padding: 10px 12px; font: inherit; font-size: 17px; background: rgba(0,0,0,.45); color: var(--gold-2); border: 1px solid var(--gold-dk); }
#scoreName:focus { outline: none; border-color: var(--gold); }
#scoreForm .btn { min-width: 0; padding: 10px 16px; }
#scoreMsg { margin: 0; min-height: 1.2em; font-style: italic; color: var(--muted); }
#scoreMsg:empty { display: none; }
#scoreTop { list-style: none; margin: 0; padding: 0; width: 100%; font-size: 16px; }
#scoreTop li { display: flex; gap: 10px; padding: 3px 8px; border-bottom: 1px solid rgba(214,178,106,.15); }
#scoreTop li span { width: 2em; color: var(--muted); }
#scoreTop li b { flex: 1; font-weight: 600; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#scoreTop li i { font-style: normal; font-family: var(--caps); color: var(--gold); }
#scoreTop li.me { background: rgba(214,178,106,.15); color: var(--gold-2); }
#ending .menu-box { max-height: 94vh; overflow-y: auto; }
/* Fin : la scène se montre seule, puis la fenêtre apparaît (un clic l'affiche tout de suite). */
#ending .menu-box { opacity: 0; visibility: hidden; transform: translateY(16px); }
#ending .menu-bg.end::after { opacity: .25; }
#ending.played .menu-box { animation: endBox 1.2s ease 4.5s forwards; }
#ending.played .menu-bg.end::after { animation: endDim 1.6s ease 4.2s forwards; }
#ending.reveal .menu-box { animation: endBox .5s ease forwards; }
#ending.reveal .menu-bg.end::after { animation: endDim .6s ease forwards; }
/* Vidéo de fin : jouée d'abord, fondu au noir, puis l'image de fin. */
.end-cine { position: absolute; inset: 0; background: #000; display: none; transition: opacity .8s ease; }
.end-cine video { width: 100%; height: 100%; object-fit: cover; transition: opacity .5s ease; }
#ending.cine .end-cine { display: block; }
#ending.cine.black .end-cine video { opacity: 0; }
#ending.cine.played .end-cine { opacity: 0; pointer-events: none; }
@keyframes endBox { to { opacity: 1; visibility: visible; transform: none; } }
@keyframes endDim { to { opacity: 1; } }
#endText { max-width: 560px; font-size: 19px; line-height: 1.5; margin: 0 0 8px; }

/* Intro */
#intro { align-items: center; justify-content: center; background: radial-gradient(ellipse at center, #26170c, #070403 80%); }
.scroll {
  width: min(640px, 90%); padding: clamp(22px, 4vw, 42px); color: #2b1a0c; font-size: clamp(16px, 2.2vw, 20px); line-height: 1.5;
  background: radial-gradient(ellipse at 30% 20%, #f4e4bd, #dcc08a 70%, #b8955a);
  box-shadow: 0 0 0 1px #7b5a2a, 0 25px 70px #000, inset 0 0 60px rgba(120,80,30,.45);
  border-radius: 3px; text-align: left; display: flex; flex-direction: column; gap: 6px;
  animation: unroll 1.2s cubic-bezier(.2,.8,.2,1) both;
}
.scroll p { margin: 0 0 6px; }
.scroll-date { font-family: var(--caps); font-size: 14px; letter-spacing: .15em; color: var(--red); }
.scroll .btn { align-self: center; margin-top: 10px; }
.scroll-note { margin-top: 8px; padding: 12px 16px; border-left: 3px solid var(--red); background: rgba(125,27,23,.08); font-size: .82em; line-height: 1.45; font-style: italic; }
.scroll-note-title { display: block; margin-bottom: 4px; font-family: var(--caps); font-style: normal; font-size: 13px; letter-spacing: .15em; text-transform: uppercase; color: var(--red); }

/* ---------- Jeu ---------- */
#game { flex-direction: column; }
#topbar { height: 42px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 14px 0 10px;
  border-bottom: 1px solid rgba(214,178,106,.35); background: linear-gradient(180deg, #160d07, #0c0705); }
#sceneName { font-family: var(--caps); letter-spacing: .18em; color: var(--gold-2); font-size: clamp(11px, 2vw, 15px); text-align: center; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#timer { font-family: var(--caps); color: var(--muted); font-size: 14px; min-width: 56px; text-align: right; transition: color 2s; }
#timer.soon { color: #e0a050; }
#timer.late { color: #e0503c; animation: timerPulse 1.6s ease-in-out infinite; }
@keyframes timerPulse { 50% { opacity: .55; text-shadow: 0 0 10px rgba(224,80,60,.8); } }
.icon-btn { background: none; border: 1px solid rgba(214,178,106,.45); color: var(--gold); width: 32px; height: 28px; font-size: 16px; line-height: 1; }

#stageWrap { flex: 1; min-height: 0; position: relative; container-type: size; }
#stage { position: absolute; inset: 0; overflow: hidden; background: #000; }
/* La scène 16:9 couvre toute la largeur, collée en haut. */
#scene { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: max(100cqw, 100cqh * 16 / 9); aspect-ratio: 16 / 9; }
.bg { position: absolute; inset: 0; background: center/cover no-repeat; opacity: 0; transition: opacity .7s ease; }
.bg.on { opacity: 1; }
#sky { opacity: 0; transition: opacity .7s ease; }
#sky.on { opacity: 1; }
#stage.shake { animation: shake .45s; }

#sprites, #hotspots { position: absolute; inset: 0; }
.sprite { position: absolute; transform: translate(-50%, -50%); transition: opacity .5s, transform .5s; pointer-events: none; }
.sprite.glint::after { content: ""; }
.hot { position: absolute; cursor: pointer; border-radius: 10px; }
.hot:hover { background: radial-gradient(ellipse at center, rgba(243,220,160,.10), transparent 70%); }
.using .hot { cursor: pointer; }

#dark { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .6s; --mx: 50%; --my: 50%; }
#dark.black { opacity: 1; background: rgba(0,0,0,.965); }
#dark.lamp { opacity: 1; background: radial-gradient(circle at var(--mx) var(--my), rgba(255,170,60,.06) 0, rgba(0,0,0,.25) 9%, rgba(0,0,0,.82) 19%, rgba(0,0,0,.97) 30%); }

#ghost { position: absolute; height: 78%; left: 50%; bottom: 4%; transform: translateX(-50%); opacity: 0; pointer-events: none; mix-blend-mode: screen; filter: blur(1px); }
#ghost.show { animation: spectre 4.6s ease-in-out forwards; }
#flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; background: radial-gradient(circle, rgba(255,240,200,.9), rgba(255,210,120,.3) 50%, transparent 80%); }
#flash.go { animation: flash .9s ease-out; }
#flash.blue { background: radial-gradient(circle, rgba(170,220,255,.8), rgba(80,140,255,.25) 50%, transparent 80%); }

/* Flèches */
.nav { position: absolute; z-index: 5; width: clamp(34px, 5.4%, 58px); aspect-ratio: 1; border-radius: 50%; display: none;
  border: 1px solid rgba(243,220,160,.75); background: rgba(18,10,5,.55); backdrop-filter: blur(2px);
  box-shadow: 0 0 0 3px rgba(0,0,0,.25), 0 0 16px rgba(214,178,106,.25); transition: transform .2s, background .2s; }
.nav::before { content: ""; position: absolute; inset: 0; margin: auto; width: 34%; height: 34%; border: solid var(--gold-2); border-width: 0 3px 3px 0; }
.nav.show { display: block; }
.nav:hover { background: rgba(125,27,23,.75); transform: scale(1.08); }
.nav.locked { border-color: rgba(200,90,70,.8); }
.nav.locked::after { content: "🔒︎"; position: absolute; right: -6px; top: -8px; font-size: 13px; filter: grayscale(1) brightness(1.6); }
.nav.up { top: 3%; left: 50%; margin-left: calc(clamp(34px, 5.4%, 58px) / -2); } .nav.up::before { transform: translateY(20%) rotate(-135deg); }
.nav.down { bottom: 3%; left: 50%; margin-left: calc(clamp(34px, 5.4%, 58px) / -2); } .nav.down::before { transform: translateY(-20%) rotate(45deg); }
.nav.left { left: 1.5%; top: 50%; transform: translateY(-50%); } .nav.left::before { transform: translateX(20%) rotate(135deg); }
.nav.right { right: 1.5%; top: 50%; transform: translateY(-50%); } .nav.right::before { transform: translateX(-20%) rotate(-45deg); }
.nav.left:hover, .nav.right:hover { transform: translateY(-50%) scale(1.08); }

/* Plan sur papyrus */
.papyrus { width: min(86vw, 640px); padding: clamp(10px, 2vw, 22px); border-radius: 4px;
  background: radial-gradient(ellipse at 30% 25%, #f3e2b8, #dcc08a 65%, #b48f55);
  box-shadow: inset 0 0 50px rgba(110,70,25,.55), 0 0 0 1px #7b5a2a, 0 14px 40px #000; animation: unroll 0.9s cubic-bezier(.2,.8,.2,1) both; }
.papyrus svg { width: 100%; display: block; }
.papyrus .ink { stroke: #5a3a1a; stroke-width: 3; stroke-linecap: round; fill: none; }
.papyrus .ink.lock { stroke: #8a2418; stroke-dasharray: 2 9; }
.papyrus .room { fill: rgba(255,245,215,.35); stroke: #5a3a1a; stroke-width: 2; }
.papyrus .room.unseen { fill: rgba(90,58,26,.12); stroke-dasharray: 5 4; }
.papyrus .room.here { fill: rgba(125,27,23,.25); stroke: #7d1b17; stroke-width: 3; }
.papyrus .let { font-family: Cinzel, serif; font-weight: 800; font-size: 26px; fill: #3b240f; text-anchor: middle; }
.papyrus .nm { font-family: Cinzel, serif; font-size: 10.5px; fill: #5a3a1a; text-anchor: middle; }
.papyrus .you { fill: #7d1b17; animation: pulse 1.4s infinite; }
.papyrus .legend { font-family: "Cormorant Garamond", serif; font-style: italic; font-size: 13px; fill: #5a3a1a; }

/* Infobulle & narration */
#tip { position: absolute; z-index: 7; pointer-events: none; padding: 3px 9px; font-family: var(--caps); font-size: 12px; letter-spacing: .08em;
  background: rgba(10,6,3,.85); border: 1px solid var(--gold-dk); color: var(--gold-2); white-space: nowrap; opacity: 0; transition: opacity .15s; transform: translate(-50%, -150%); }
#tip.on { opacity: 1; }
#caption { position: absolute; z-index: 8; left: 50%; bottom: 13%; transform: translate(-50%, 10px); width: min(86%, 760px);
  padding: 10px 18px; text-align: center; font-size: clamp(13px, 1.75vw, 20px); line-height: 1.35;
  background: linear-gradient(180deg, rgba(14,8,4,.88), rgba(28,14,6,.9)); border: 1px solid var(--gold-dk); border-left: 3px solid var(--gold); border-right: 3px solid var(--gold);
  opacity: 0; pointer-events: none; transition: opacity .35s, transform .35s; }
#caption.on { opacity: 1; transform: translate(-50%, 0); }
#caption b { color: var(--gold-2); font-weight: 600; }

/* Panneau de gros plan */
#panel { position: absolute; inset: 0; z-index: 20; display: none; align-items: center; justify-content: center; background: rgba(4,2,1,.72); backdrop-filter: blur(3px); }
#panel.on { display: flex; animation: fade .3s; }
.panel-inner { position: relative; max-width: 94%; max-height: 94%; overflow: auto; padding: clamp(12px, 2.5vw, 26px) clamp(14px, 3vw, 34px);
  background: radial-gradient(ellipse at top, #2c1a0d, #120a05 75%); border: 1px solid var(--gold);
  box-shadow: 0 0 0 4px rgba(0,0,0,.5), 0 0 0 5px rgba(214,178,106,.3), 0 20px 50px #000; animation: rise .35s cubic-bezier(.2,.8,.2,1); }
.panel-close { position: absolute; right: 6px; top: 6px; background: none; border: 0; color: var(--gold); font-size: 18px; width: 30px; height: 30px; z-index: 2; }
#panelBody { display: flex; flex-direction: column; align-items: center; gap: clamp(8px, 1.4vw, 14px); text-align: center; }
.p-title { font-family: var(--caps); color: var(--gold-2); letter-spacing: .14em; font-size: clamp(13px, 1.8vw, 18px); margin: 0 26px; }
.p-text { font-size: clamp(13px, 1.6vw, 18px); color: var(--text); max-width: 560px; line-height: 1.4; }
.p-latin { font-family: var(--caps); color: var(--gold); letter-spacing: .08em; font-size: clamp(12px, 1.6vw, 17px); line-height: 1.6; }
.p-row { display: flex; gap: clamp(6px, 1.2vw, 14px); align-items: center; justify-content: center; flex-wrap: wrap; }
.p-btn { font-family: var(--caps); font-size: clamp(11px, 1.4vw, 14px); letter-spacing: .08em; padding: 7px 14px; color: var(--gold-2);
  background: linear-gradient(180deg, #4c1410, #2c0a08); border: 1px solid var(--gold-dk); }
.p-btn:hover { filter: brightness(1.25); }
.p-btn.sel { border-color: var(--gold-2); box-shadow: 0 0 12px rgba(243,220,160,.6); }

/* Inventaire */
#inventory { flex: none; height: clamp(64px, 12vh, 96px); border-top: 1px solid rgba(214,178,106,.35);
  background: linear-gradient(180deg, #120a05, #070403); display: flex; align-items: center; justify-content: center; gap: 10px; padding: 6px 10px; }
#invSlots { flex: 1 1 auto; min-width: 0; justify-content: safe center; display: flex; gap: clamp(4px, .8vw, 10px); overflow-x: auto; overflow-y: hidden; max-width: 100%; padding: 3px; scrollbar-width: thin; }
.slot { position: relative; flex: none; width: clamp(50px, 9vh, 76px); aspect-ratio: 1; border: 1px solid rgba(214,178,106,.35);
  background: radial-gradient(circle at 50% 40%, #2b1a0e, #120a05); display: grid; place-items: center; cursor: pointer; transition: transform .15s, box-shadow .2s; }
.slot img { width: 84%; height: 84%; object-fit: contain; }
.slot:hover { transform: translateY(-2px); border-color: var(--gold); }
.slot.sel { border-color: var(--gold-2); box-shadow: 0 0 0 1px var(--gold-2), 0 0 16px rgba(243,220,160,.55); background: radial-gradient(circle at 50% 40%, #5a2a12, #1e0f07); }
.slot.empty { cursor: default; opacity: .4; }
.slot.empty:hover { transform: none; border-color: rgba(214,178,106,.35); }
.slot.new { animation: newItem 1s ease-out; }

/* Curseur d'objet */
#cursorItem { position: fixed; z-index: 100; width: 48px; height: 48px; pointer-events: none; transform: translate(8px, 8px); opacity: .9; display: none; }

/* Pause */
#pause { position: absolute; inset: 0; z-index: 40; display: none; align-items: center; justify-content: center; background: rgba(3,1,0,.75); backdrop-filter: blur(4px); }
#pause.on { display: flex; }

/* ---------- Puzzles ---------- */
.vessels { display: flex; gap: clamp(10px, 2.5vw, 30px); align-items: flex-end; justify-content: center; }
.vessel { display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; }
.vessel .jar { position: relative; width: clamp(54px, 8vw, 90px); border: 2px solid #b0703a; border-top: 0; border-radius: 0 0 40% 40% / 0 0 22% 22%; overflow: hidden;
  background: linear-gradient(90deg, #5a2d14, #8a4b26 40%, #5a2d14); box-shadow: inset 0 0 14px #000; }
.vessel .wine { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(180deg, #a3192c, #4a0610); transition: height .5s ease; box-shadow: 0 -2px 6px rgba(255,80,90,.4); }
.vessel .ticks { position: absolute; inset: 0; background: repeating-linear-gradient(0deg, transparent 0 calc(100% / var(--n) - 1px), rgba(255,220,170,.35) calc(100% / var(--n) - 1px) calc(100% / var(--n))); }
.vessel.sel .jar { border-color: var(--gold-2); box-shadow: inset 0 0 14px #000, 0 0 16px rgba(243,220,160,.6); }
.vessel .lbl { font-family: var(--caps); font-size: 12px; color: var(--gold-2); }
.vessel .amt { font-family: var(--caps); font-size: 13px; color: var(--muted); }

.dial-row { display: flex; gap: 10px; }
.dial { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.dial button { background: none; border: 1px solid var(--gold-dk); color: var(--gold); width: 46px; height: 24px; font-size: 12px; }
.dial .val { width: clamp(52px, 7vw, 70px); height: clamp(52px, 7vw, 70px); display: grid; place-items: center; font-family: var(--caps); font-size: clamp(22px, 3.4vw, 34px);
  color: var(--gold-2); background: radial-gradient(circle at 40% 30%, #6a5230, #2a1d10); border: 2px solid var(--gold); border-radius: 8px; box-shadow: inset 0 0 12px #000, 0 2px 8px #000; }
.dial .val.wide { width: clamp(110px, 16vw, 160px); font-size: clamp(14px, 2vw, 20px); }

.gods { display: flex; gap: clamp(6px, 1.5vw, 18px); }
.god { width: clamp(64px, 10vw, 110px); display: flex; flex-direction: column; align-items: center; cursor: pointer; padding: 6px 2px; border: 1px solid transparent; transition: transform .2s; }
.god img { width: 100%; aspect-ratio: 1; object-fit: contain; }
.god span { font-family: var(--caps); font-size: clamp(10px, 1.2vw, 13px); color: var(--gold-2); }
.god:hover { transform: translateY(-3px); }
.god.lit { border-color: var(--gold); background: radial-gradient(circle, rgba(243,220,160,.22), transparent 70%); }
.god.lit img { filter: drop-shadow(0 0 14px rgba(255,220,140,.9)); }

.pipes { display: grid; grid-template-columns: repeat(var(--c), 1fr); gap: 2px; width: min(70vw, 360px); position: relative; padding: 0 22px; }
.pipe { aspect-ratio: 1; background: #1a120b; border: 1px solid #3a2a18; cursor: pointer; transition: transform .2s; }
.pipe svg { width: 100%; height: 100%; display: block; transition: transform .2s; }
.pipe .p { stroke: #8a6a3a; stroke-width: 22; stroke-linecap: round; fill: none; }
.pipe.wet .p { stroke: #3fa7e8; filter: drop-shadow(0 0 4px #4bc0ff); }
.pipes .src, .pipes .snk { position: absolute; width: 20px; font-size: 18px; color: #4bc0ff; }

.cipher { position: relative; width: max(130px, min(64vw, 320px, 100cqh - 310px)); aspect-ratio: 1; flex: none; }
.cipher svg { width: 100%; height: 100%; }
.cipher .inner { transition: transform .35s ease; transform-origin: 50% 50%; }
.cipher-msg { font-family: var(--caps); letter-spacing: .12em; font-size: clamp(11px, 1.5vw, 15px); color: var(--muted); max-width: 640px; word-break: break-word; }
.cipher-out { font-family: var(--caps); letter-spacing: .12em; font-size: clamp(12px, 1.6vw, 16px); color: var(--gold-2); max-width: 640px; min-height: 2.6em; word-break: break-word; }

.mosaic { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; width: min(56vh, 70vw, 330px); background: #000; padding: 2px; border: 2px solid var(--gold-dk); }
.tile { aspect-ratio: 1; background-size: 300% 300%; cursor: pointer; transition: transform .3s ease; }
.tile.missing { background: repeating-linear-gradient(45deg, #1c130b 0 6px, #241910 6px 12px) !important; box-shadow: inset 0 0 12px #000; }
.mosaic.done .tile { transform: none !important; cursor: default; }
.mosaic.done { gap: 0; box-shadow: 0 0 30px rgba(243,220,160,.5); }

.scale-wrap { width: min(70vw, 440px); }
.scale-wrap svg { width: 100%; }
.weights { display: grid; grid-template-columns: repeat(3, minmax(70px, 110px)); gap: 6px; }
.wt-head { font-family: var(--caps); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); text-align: center; }
.wt-cell { height: 34px; font-family: var(--caps); font-size: 16px; border: 1px dashed rgba(214,178,106,.35); border-radius: 6px; background: rgba(42,29,16,.5); color: var(--gold-2); cursor: pointer; transition: background .15s, border-color .15s; }
.wt-cell:hover { border-color: var(--gold-2); }
.wt-cell.on { border: 1px solid var(--gold-2); background: linear-gradient(#5a4220, #2a1d10); box-shadow: 0 0 10px rgba(243,220,160,.35); cursor: default; }
.wt-cell[data-col="0"].on { opacity: .7; box-shadow: none; }

.shields { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(6px, 1.2vw, 12px); }
.shield { width: clamp(52px, 8vw, 84px); aspect-ratio: 3/4; cursor: pointer; perspective: 400px; }
.shield .face { width: 100%; height: 100%; border-radius: 10px 10px 40% 40% / 10px 10px 30% 30%; transition: transform .45s, background .45s;
  background: linear-gradient(180deg, #3a2a1a, #1f160c); border: 2px solid #6a5434; display: grid; place-items: center; font-size: clamp(22px, 3.4vw, 34px); color: #6a5434; }
.shield.on .face { background: radial-gradient(circle at 50% 40%, #b52a22, #6d120d); border-color: var(--gold); color: var(--gold-2); transform: rotateY(180deg); text-shadow: 0 0 10px rgba(255,220,140,.8); }
.shield.on .face span { transform: rotateY(180deg); }
.shield .face span img { display: block; width: clamp(34px, 5.4vw, 58px); filter: drop-shadow(0 0 6px rgba(255,220,140,.7)); }

.rings { width: min(60vh, 70vw, 340px); aspect-ratio: 1; position: relative; }
.rings svg { width: 100%; height: 100%; }
.rings .ring { cursor: pointer; transition: transform .35s ease; transform-origin: 160px 160px; }
.rings .ring:hover circle.band { stroke: #6a8fbf; }
.rings .ring:hover text { fill: var(--gold-2); }
.rings text { font-size: 22px; fill: #cfe6ff; text-anchor: middle; dominant-baseline: central; font-family: "Segoe UI Symbol", "Noto Sans Symbols", "DejaVu Sans", serif; pointer-events: none; }

.horns { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.horn { width: clamp(80px, 13vw, 130px); height: clamp(54px, 8vw, 80px); border: 2px solid var(--gold-dk); border-radius: 12px; font-family: var(--caps); font-size: 13px; color: var(--gold-2);
  background: radial-gradient(circle at 50% 40%, var(--c), #1a0f06 85%); opacity: .7; transition: opacity .15s, box-shadow .15s, transform .15s; }
.horn.lit, .horn:active { opacity: 1; box-shadow: 0 0 24px var(--c); transform: scale(1.05); border-color: var(--gold-2); }
.horns.wait .horn { pointer-events: none; }

.pw { font-family: var(--caps); font-size: 18px; letter-spacing: .12em; padding: 8px 12px; width: min(80vw, 320px); text-align: center; text-transform: uppercase;
  background: #1a120b; border: 1px solid var(--gold); color: var(--gold-2); outline: none; user-select: text; -webkit-user-select: text; }

.graffiti { font-family: "Comic Sans MS", var(--caps); font-size: clamp(16px, 2.6vw, 28px); color: #3a2a1c; background: #cbb89a radial-gradient(circle at 30% 40%, #ddd0b6, #a89273); padding: 16px 26px; transform: rotate(-2deg); box-shadow: inset 0 0 30px rgba(60,40,20,.6); line-height: 1.5; letter-spacing: .1em; }
.letter { background: radial-gradient(ellipse at 30% 20%, #f4e4bd, #d8bb83); color: #2b1a0c; padding: 18px 24px; max-width: 520px; text-align: left; font-size: clamp(13px, 1.7vw, 18px); line-height: 1.45; box-shadow: inset 0 0 40px rgba(120,80,30,.4); }

/* ---------- Animations ---------- */
@keyframes pulse { 50% { opacity: .65; } }
@keyframes breathe { from { transform: scale(1); } to { transform: scale(1.02); } }
@keyframes shake { 0%,100% { transform: none; } 20% { transform: translate(-6px, 2px); } 40% { transform: translate(5px, -3px); } 60% { transform: translate(-4px, 3px); } 80% { transform: translate(3px, -1px); } }
@keyframes flash { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; } }
@keyframes spectre {
  0% { opacity: 0; transform: translateX(-50%) translateY(6%) scale(.92); filter: blur(8px); }
  25% { opacity: .75; filter: blur(1px); }
  50% { opacity: .55; transform: translateX(-52%) translateY(0) scale(1); }
  65% { opacity: .8; transform: translateX(-48%) translateY(-1%) scale(1.01); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-6%) scale(1.06); filter: blur(10px); }
}
@keyframes glint { 0%,100% { opacity: .15; transform: scale(.6); } 50% { opacity: 1; transform: scale(1.2); } }
@keyframes newItem { 0% { box-shadow: 0 0 0 0 rgba(243,220,160,.9); transform: scale(1.25); } 100% { box-shadow: 0 0 0 18px rgba(243,220,160,0); transform: scale(1); } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(20px) scale(.97); } }
@keyframes unroll { from { clip-path: inset(48% 0 48% 0); opacity: .3; } to { clip-path: inset(0 0 0 0); opacity: 1; } }

@media (max-width: 640px) {
  #topbar { height: 36px; }
  .btn { min-width: 200px; font-size: 13px; }
  #caption { bottom: 4%; }
}
@media (orientation: portrait) {
  #scene { width: 100cqw; }
  #caption { bottom: 3%; }
}

/* Grilles animées (Custodia) */
.doors { position: absolute; perspective: 900px; pointer-events: none; }
.doors > div { position: absolute; top: 0; height: 100%; background-repeat: no-repeat; }
.doors .void { background-size: 100% 100%; }
.doors .leaf { transition: transform 2.8s cubic-bezier(.45,.05,.25,1), filter 2.8s; filter: drop-shadow(0 0 0 transparent); }
.doors .leaf { transform: rotateZ(var(--tilt)) rotateY(0) rotateZ(calc(-1 * var(--tilt))); }
.doors .leaf.l { transform-origin: 1.3% 50%; }
.doors .leaf.r { transform-origin: 98.6% 50%; }
.doors.open .leaf { filter: brightness(.75) drop-shadow(-6px 0 8px rgba(0,0,0,.5)); }
.doors.open .leaf.l { transform: rotateZ(var(--tilt)) rotateY(var(--al, 62deg)) rotateZ(calc(-1 * var(--tilt))); }
.doors.open .leaf.r { transform: rotateZ(var(--tilt)) rotateY(calc(-1 * var(--ar, 66deg))) rotateZ(calc(-1 * var(--tilt))); }
.doors::after { content: ""; position: absolute; left: -15%; width: 130%; top: 90%; height: 28%; pointer-events: none;
  background: radial-gradient(ellipse 50% 70% at 50% 0, rgba(150,180,240,.32), rgba(110,140,210,.12) 55%, transparent 80%);
  mix-blend-mode: screen; opacity: 0; transition: opacity 2.4s ease .4s; }
.doors.open::after { opacity: 1; }
#beams { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; mix-blend-mode: screen; }
#beams .beam { fill: rgba(200,225,255,.5); filter: blur(6px); opacity: 0; animation: beamIn 1.4s ease-out forwards, beamShimmer 3s ease-in-out 1.4s infinite alternate; }
#beams .spot { fill: rgba(220,235,255,.75); }
@keyframes beamIn { from { opacity: 0; } to { opacity: .85; } }
@keyframes beamShimmer { from { opacity: .85; } to { opacity: .55; } }
.flyer { position: fixed; z-index: 60; pointer-events: none; object-fit: contain; filter: drop-shadow(0 0 14px rgba(255,220,140,.85)); }
#stage.draining .bg { transition: opacity 3.8s ease; }
.swirl { position: absolute; left: 50%; top: 80%; width: 32%; aspect-ratio: 1; pointer-events: none; mix-blend-mode: screen; animation: swirl 4.8s ease-in forwards; }
.swirl i { position: absolute; inset: 0; border-radius: 50%; animation: spin 1.6s linear infinite;
  background: repeating-conic-gradient(rgba(160,225,255,.4) 0 10deg, transparent 10deg 30deg);
  -webkit-mask: radial-gradient(closest-side, transparent 8%, #000 30%, transparent 100%); mask: radial-gradient(closest-side, transparent 8%, #000 30%, transparent 100%); }
@keyframes swirl {
  0% { opacity: 0; transform: translate(-50%, -50%) scaleY(.36) scale(1.1); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scaleY(.36) scale(.12); }
}
@keyframes spin { to { transform: rotate(-360deg); } }
.fire { position: absolute; aspect-ratio: 1; transform: translate(-50%, -50%); pointer-events: none; mix-blend-mode: screen;
  background: radial-gradient(circle, rgba(255,180,80,.42), rgba(255,120,30,.16) 38%, transparent 68%); animation: flicker 1s ease-in-out infinite alternate; }
@keyframes flicker {
  0% { opacity: .75; transform: translate(-50%, -50%) scale(1); }
  30% { opacity: 1; transform: translate(-50%, -51%) scale(1.06); }
  55% { opacity: .82; transform: translate(-49.5%, -50%) scale(.97); }
  100% { opacity: .95; transform: translate(-50.5%, -50.5%) scale(1.04); }
}
.doors.lazy:not(.open) > div { visibility: hidden; }
/* Ronde du prétorien : silhouette qui passe derrière la haie de la cour, torche à la main. */
.doors .guard { position: absolute; height: auto; transition: opacity 1.2s .4s; }
.doors.open .guard { opacity: 0; }
.doors .patrol { left: 0; width: 100%; overflow: hidden; }
.patrol .front { position: absolute; inset: 0; background-size: 100% 100%; }
.patrol .walker { position: absolute; top: 43.5%; height: 30%; aspect-ratio: 163 / 300; left: 100%; visibility: hidden; }
.patrol.go .walker { visibility: visible; animation: patrol 10s linear forwards; }
.patrol .bob { position: relative; width: 100%; height: 100%; }
.patrol.go .bob { animation: bob .55s ease-in-out infinite alternate; }
.patrol img { display: block; width: 100%; height: 100%; opacity: .94; filter: drop-shadow(1px 0 0 rgba(150,180,255,.3)); }
.patrol .torch { position: absolute; left: 7%; top: 7%; width: 260%; aspect-ratio: 1; transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255,225,150,1) 0, rgba(255,160,60,.6) 5%, rgba(255,120,40,.2) 20%, transparent 55%);
  animation: flicker .8s ease-in-out infinite alternate; }
@keyframes patrol { from { left: 100%; } to { left: -27%; } }
@keyframes bob { from { transform: translateY(0) rotate(-.6deg); } to { transform: translateY(-2.5%) rotate(.6deg); } }
.doors-front { position: absolute; background: center/100% 100% no-repeat; pointer-events: none; }

/* ---------- Classement : la Tabula Honoris ---------- */
#board { position: absolute; inset: 0; z-index: 45; display: none; align-items: center; justify-content: center; padding: 12px;
  background: radial-gradient(ellipse at center, rgba(20,10,4,.6), rgba(3,1,0,.9)); backdrop-filter: blur(5px); }
#board.on { display: flex; animation: fadeIn .35s ease both; }
.tablet { position: relative; width: min(520px, 100%); max-height: 100%; overflow-y: auto; text-align: center;
  padding: clamp(18px, 4vh, 34px) clamp(18px, 5vw, 46px) clamp(16px, 3vh, 26px);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(214,178,106,.12), transparent 60%),
    repeating-linear-gradient(115deg, rgba(255,255,255,.012) 0 2px, transparent 2px 9px),
    linear-gradient(180deg, #2a1a0e, #140a05 70%, #0e0703);
  border: 1px solid var(--gold); box-shadow: 0 0 0 5px #0c0603, 0 0 0 6px var(--gold-dk), 0 30px 80px #000, inset 0 0 60px rgba(0,0,0,.7);
  animation: tabletIn .55s cubic-bezier(.2,.9,.3,1.1) both; }
/* Équerres dorées aux quatre coins */
.tablet::before, .tablet::after { content: ""; position: absolute; inset: 9px; pointer-events: none;
  border: 1px solid rgba(214,178,106,.28);
  -webkit-mask: linear-gradient(#000 0 0) top left / 26px 26px no-repeat, linear-gradient(#000 0 0) top right / 26px 26px no-repeat,
    linear-gradient(#000 0 0) bottom left / 26px 26px no-repeat, linear-gradient(#000 0 0) bottom right / 26px 26px no-repeat;
          mask: linear-gradient(#000 0 0) top left / 26px 26px no-repeat, linear-gradient(#000 0 0) top right / 26px 26px no-repeat,
    linear-gradient(#000 0 0) bottom left / 26px 26px no-repeat, linear-gradient(#000 0 0) bottom right / 26px 26px no-repeat; }
.tablet::after { inset: 14px; border-color: rgba(214,178,106,.14); -webkit-mask: none; mask: none; }
@keyframes tabletIn { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.tablet-close { position: absolute; right: 12px; top: 10px; z-index: 2; width: 34px; height: 34px; background: none; border: 0; color: var(--gold); font-size: 18px; }
.tablet-close:hover { color: var(--gold-2); }
.tablet-crest svg { width: clamp(64px, 12vh, 92px); margin: 0 auto; display: block; filter: drop-shadow(0 0 12px rgba(214,178,106,.35)); }
.tablet-title { margin: 6px 0 2px; font-family: var(--caps); font-weight: 800; font-size: clamp(22px, 4.4vw, 34px); letter-spacing: .22em; padding-left: .22em;
  background: linear-gradient(180deg, #fff3c9, var(--gold) 55%, var(--gold-dk)); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 #1a0d05); }
#board .menu-sep { margin: 10px auto 14px; }
#boardList { list-style: none; margin: 0; padding: 0; text-align: left; }
#boardList li { display: grid; grid-template-columns: 46px 1fr auto; align-items: center; gap: 12px; padding: 7px 6px;
  border-bottom: 1px solid rgba(214,178,106,.12); animation: rowIn .45s ease both; animation-delay: calc(var(--i) * 60ms + .15s); }
#boardList li:last-child { border-bottom: 0; }
@keyframes rowIn { from { opacity: 0; transform: translateX(-10px); } }
.rank { justify-self: center; font-family: var(--caps); font-weight: 600; font-size: 15px; color: var(--muted); }
#boardList li:nth-child(-n+3) .rank { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; font-weight: 800; font-size: 14px;
  color: #2a1606; box-shadow: inset 0 0 0 2px rgba(255,255,255,.35), inset 0 -3px 6px rgba(0,0,0,.35), 0 2px 6px rgba(0,0,0,.6); }
#boardList li:nth-child(1) .rank { background: radial-gradient(circle at 35% 30%, #fff6cf, #e8be5c 45%, #9a6b1c); box-shadow: inset 0 0 0 2px rgba(255,255,255,.35), inset 0 -3px 6px rgba(0,0,0,.35), 0 0 16px rgba(232,190,92,.55); }
#boardList li:nth-child(2) .rank { background: radial-gradient(circle at 35% 30%, #ffffff, #c9cdd3 45%, #7d838c); }
#boardList li:nth-child(3) .rank { background: radial-gradient(circle at 35% 30%, #ffd9b0, #c98a4b 45%, #7a4a1e); }
.who { display: flex; align-items: baseline; gap: 10px; min-width: 0; font-size: 19px; font-weight: 600; color: var(--text); }
.who b { font-weight: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who::after { content: ""; flex: 1; min-width: 12px; border-bottom: 1px dotted rgba(214,178,106,.35); transform: translateY(-4px); }
#boardList li:nth-child(1) .who { color: var(--gold-2); font-size: 21px; }
.time { font-family: var(--caps); font-size: 16px; letter-spacing: .06em; color: var(--gold); }
#boardList li.me { background: linear-gradient(90deg, rgba(214,178,106,.16), transparent); }
#boardList li.me .who b::after { content: " ✦"; color: var(--gold); font-size: .7em; }
#boardMsg { margin: 6px 0 0; font-style: italic; color: var(--muted); }
#boardMsg:empty { display: none; }
#boardMsg.loading::after { content: ""; display: inline-block; width: 1em; text-align: left; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

/* Sous-titre du menu : « Escape » sous le nom du jeu */
h1 .h1-sub { display: block; margin-top: .35em; font-size: .32em; font-weight: 600; letter-spacing: .6em; text-indent: .6em; }

/* Textes traduisibles cachés tant que la langue n'est pas chargée (pas de français furtif) */
.i18n-pending [data-t], .i18n-pending #btnSound { visibility: hidden; }
