/* ===== Le logimage de Noël (grille 2D) + le monde en blocs (3D) ===== */
.lg-overlay { position: fixed; inset: 0; z-index: 40; display: grid; place-items: safe center; padding: 8px; overflow: auto; background: rgba(8, 23, 48, .86); perspective: 1100px; }
.lg-box {
  --q: min(5vw, 4.3vh, 34px);
  position: relative; padding: 14px 16px; border-radius: 20px; max-width: 100%;
  background: var(--cream); color: var(--ink); border: 3px solid var(--gold); box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
  font: 600 14px/1.4 var(--body);
}
.lg-x { position: absolute; top: 6px; right: 8px; z-index: 5; border: 0; background: none; font-size: 18px; color: #9b7a52; cursor: pointer; padding: 6px; }
.lg-box h2 { font: 700 26px/1.1 var(--title); color: var(--red); margin: 0 0 4px; }
.lg-help { margin: 0 26px 8px 0; font-size: 13px; color: #7a6652; max-width: calc(var(--q) * 21); }

.lg-story { width: min(520px, 100%); text-align: center; padding: 26px 26px 22px; font-size: 15px; }
.lg-story h2 { font-size: 32px; margin: 4px 0 12px; }
.lg-big { font-size: 62px; line-height: 1.1; }
.lg-kicker { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--green); }
.lg-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }

/* la grille */
.lg-board {
  display: grid; grid-template-columns: auto repeat(var(--n), var(--q)); grid-template-rows: auto repeat(var(--n), var(--q));
  width: max-content; margin: 0 auto; user-select: none; -webkit-user-select: none; touch-action: none;
  transition: transform 1.6s cubic-bezier(.6, 0, .3, 1), opacity .5s 1.2s; transform-origin: 50% 70%;
}
.lg-board.paf { transform: rotateX(74deg) scale(2.6) translateY(-8%); opacity: 0; }
.lg-clue { display: flex; gap: 3px; font: 800 calc(var(--q) * .42)/1 var(--body); color: #5b4a3a; font-variant-numeric: tabular-nums; }
.lg-clue.col { flex-direction: column; justify-content: flex-end; align-items: center; padding: 3px 0 4px; min-height: calc(var(--q) * 2.6); border-left: 1px solid transparent; }
.lg-clue.row { justify-content: flex-end; align-items: center; padding: 0 5px 0 3px; min-width: calc(var(--q) * 2.6); }
.lg-clue.ok { color: #1f9a55; }
.lg-clue.ok span { opacity: .75; }
.lg-cell { width: var(--q); height: var(--q); background: #fff; border-right: 1px solid #d5c4a6; border-bottom: 1px solid #d5c4a6; cursor: pointer; transition: background .5s; }
.lg-cell:nth-child(16n + 2) { border-left: 2px solid #5b4a3a; }
.lg-board > .lg-cell:nth-child(-n + 32) { border-top: 2px solid #5b4a3a; }
.lg-cell.thick, .lg-cell:nth-child(16n + 16) { border-right: 2px solid #5b4a3a; }
.lg-cell.thickb, .lg-board > .lg-cell:nth-last-child(-n + 15) { border-bottom: 2px solid #5b4a3a; }
.lg-cell.on { background: #2a2433; }
.lg-cell.no { background: #fff linear-gradient(45deg, transparent 44%, #c9b596 44%, #c9b596 56%, transparent 56%), linear-gradient(-45deg, transparent 44%, #c9b596 44%, #c9b596 56%, transparent 56%); background-color: #faf4e8; }
.lg-cell.no { background-image: linear-gradient(45deg, transparent 44%, #c9b596 44%, #c9b596 56%, transparent 56%), linear-gradient(-45deg, transparent 44%, #c9b596 44%, #c9b596 56%, transparent 56%); }

.lg-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; }
.lg-foot .btn { font-size: 13px; padding: 7px 12px; }
.lg-count { flex: 1; text-align: center; font-size: 13px; color: #7a6652; }
.lg-modes { display: flex; border: 2px solid #e2c9a0; border-radius: 12px; overflow: hidden; }
.lg-mode { border: 0; background: #fff; padding: 7px 12px; font: 800 13px var(--body); color: var(--ink); cursor: pointer; }
.lg-mode.on { background: var(--red); color: #fff; }

/* le monde 3D */
.lg-world { width: min(1100px, 100%); padding: 6px; background: #0b1226; border-color: #3b4a6b; }
.lg-world .lg-x { color: #fff; background: rgba(0, 0, 0, .35); border-radius: 50%; top: 12px; right: 12px; }
.lg-view { position: relative; width: 100%; height: min(78vh, 680px); border-radius: 14px; overflow: hidden; background: #9ecdf5; }
.vx-canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.lg-view.locked .vx-canvas { cursor: none; }
.vx-hud { position: absolute; inset: 0; pointer-events: none; color: #fff; font: 700 14px var(--body); }
.vx-top { position: absolute; top: 10px; left: 12px; display: flex; gap: 14px; align-items: center; padding: 6px 12px; border-radius: 999px; background: rgba(8, 23, 48, .6); }
.vx-cross { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -54%); font: 400 30px/1 monospace; color: #fff; text-shadow: 0 0 3px #000, 0 0 3px #000; }
.vx-msg { position: absolute; left: 50%; top: 62px; transform: translateX(-50%); max-width: 80%; padding: 8px 14px; border-radius: 14px; background: var(--cream); color: var(--ink); border: 2px solid var(--gold); text-align: center; opacity: 0; transition: opacity .3s; }
.vx-msg.on { opacity: 1; }
.vx-help { position: absolute; left: 12px; right: 12px; bottom: 58px; text-align: center; font-size: 12px; text-shadow: 0 1px 3px #000; opacity: .92; }
.lg-view.locked .vx-help { opacity: .55; }
.vx-pad { position: absolute; left: 0; right: 0; bottom: 8px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; pointer-events: auto; }
.vx-pad .btn { font-size: 13px; padding: 7px 11px; min-width: 44px; touch-action: none; user-select: none; -webkit-user-select: none; }
.vx-nogl { padding: 40px; text-align: center; color: #fff; }

/* lisibilité : indices plus espacés, aide sur fond sombre */
.lg-clue.row { gap: 7px; }
.lg-clue.col { gap: 4px; }
.vx-help { left: 50%; right: auto; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); padding: 5px 12px; border-radius: 12px; background: rgba(8, 23, 48, .55); text-shadow: none; }

/* arrivée dans le monde : la grille tremble et gonfle, puis éclair blanc et chute */
.lg-board.paf { transform: scale(1.12); opacity: 1; animation: lg-shake .09s linear infinite alternate; transition: transform .8s cubic-bezier(.5, 0, 1, .6); }
@keyframes lg-shake { from { translate: -3px 1px; } to { translate: 3px -1px; } }
.lg-world { width: 100%; max-width: 1500px; }
.lg-view { height: min(92vh, 900px); }
.lg-view.enter::after { content: ""; position: absolute; inset: 0; background: #fff; pointer-events: none; animation: lg-flash 1s ease-out forwards; }
@keyframes lg-flash { to { opacity: 0; } }
.lg-view.intro .vx-hud { opacity: 0; }
.vx-hud { transition: opacity .6s; }
.vx-canvas, .lg-view.locked .vx-canvas { cursor: none; }
.vx-rules { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(460px, 86%); padding: 16px 20px; border-radius: 18px; background: var(--cream); color: var(--ink); border: 3px solid var(--gold); text-align: center; pointer-events: auto; cursor: pointer; box-shadow: 0 18px 50px rgba(0, 0, 0, .5); font-weight: 600; }
.vx-rules b { font: 700 26px var(--title); color: var(--red); }
.vx-rules p { margin: 8px 0; font-size: 14px; }
.vx-rules small { display: inline-block; margin-top: 4px; padding: 6px 14px; border-radius: 999px; background: var(--red); color: #fff; font-weight: 800; }

/* pause : la souris a été relâchée */
.vx-pause { position: absolute; inset: 0; display: grid; place-content: center; gap: 6px; border: 0; background: rgba(8, 23, 48, .55); color: #fff; font: 700 15px var(--body); pointer-events: auto; cursor: pointer; text-align: center; }
.vx-pause b { font: 700 44px var(--title); color: var(--gold); }
.vx-pause span { padding: 8px 16px; border-radius: 999px; background: var(--red); font-weight: 800; }
.vx-canvas { cursor: default; }
.lg-view.locked .vx-canvas { cursor: none; }
.lg-view:fullscreen { height: 100vh; border-radius: 0; }

/* barre d'outils façon jeu de blocs */
.vx-bar { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); display: flex; gap: 6px; }
.vx-slot { position: relative; width: 56px; height: 56px; display: grid; place-items: center; font-size: 28px; border-radius: 10px; background: rgba(8, 23, 48, .6); border: 3px solid rgba(255, 255, 255, .35); }
.vx-slot.on { border-color: #ffd257; box-shadow: 0 0 0 2px rgba(255, 210, 87, .5); }
.vx-slot small { position: absolute; left: 5px; top: 1px; font-size: 11px; opacity: .8; }
.vx-slot b { position: absolute; right: 5px; bottom: 1px; font-size: 14px; text-shadow: 0 1px 2px #000; }

.vx-bar { bottom: 132px; }

/* easter egg : la chute hors du monde */
.vx-fade { position: absolute; inset: 0; z-index: 6; background: #000; opacity: 0; pointer-events: none; transition: opacity 1.6s ease-in; }
.lg-view.scene .vx-hud { opacity: 0; }
.lg-view.scene .vx-hud * { pointer-events: none !important; }
.vx-video { position: absolute; inset: 0; z-index: 5; overflow: hidden; background: #000; pointer-events: none; }
.vx-video iframe { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); border: 0; pointer-events: none; }
.vx-back { opacity: 0; transition: opacity .5s; position: absolute; right: 14px; bottom: 12px; z-index: 7; padding: 8px 14px; border: 1px solid rgba(255, 255, 255, .35); border-radius: 999px; background: rgba(0, 0, 0, .55); color: #eee; font: 700 13px var(--body); cursor: pointer; }
.vx-back.on, .vx-back:focus-visible { opacity: 1; }
.lg-view.scene { cursor: none; }
