/* Scène d’ouverture : décor, identité, personnages et commande de mouvement. */
/* Un décor à explorer : les commandes sont posées dans la scène. */
.opening-scene { position: relative; isolation: isolate; min-height: 760px; height: 100svh; max-height: 1200px; overflow: hidden; background: url("/images/mine.png") center / cover no-repeat #201c26; }
.opening-scene::before { content: ""; position: absolute; z-index: -1; inset: 0; background: linear-gradient(180deg, #060a171a, transparent 30%, transparent 76%, #071729), radial-gradient(ellipse at 20% 46%, #06132535, transparent 57%); }
/* Même cadrage que le décor : la lumière reste sur sa lanterne, même en portrait. */
.lantern-light { position: absolute; z-index: 0; inset: 0; pointer-events: none; background: inherit; filter: brightness(1.7) saturate(1.08); opacity: 0; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1672' height='941' viewBox='0 0 1672 941'%3E%3Cdefs%3E%3CradialGradient id='light'%3E%3Cstop stop-color='white'/%3E%3Cstop offset='1' stop-color='white' stop-opacity='0'/%3E%3C/radialGradient%3E%3C/defs%3E%3Cellipse cx='843' cy='257' rx='135' ry='160' fill='url(%23light)'/%3E%3C/svg%3E") center / cover no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1672' height='941' viewBox='0 0 1672 941'%3E%3Cdefs%3E%3CradialGradient id='light'%3E%3Cstop stop-color='white'/%3E%3Cstop offset='1' stop-color='white' stop-opacity='0'/%3E%3C/radialGradient%3E%3C/defs%3E%3Cellipse cx='843' cy='257' rx='135' ry='160' fill='url(%23light)'/%3E%3C/svg%3E") center / cover no-repeat; }
.character-still, .character-motion { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: bottom; }
.character-motion { display: none; overflow: hidden; }
.scene-motion-control { position: absolute; z-index: 11; left: 32px; bottom: 22px; display: inline-flex; min-height: 36px; align-items: center; gap: 8px; padding: 7px 12px; border: 1px solid #52748b; border-radius: 4px; background: #071729dc; color: #e8f2e8; font-size: 11px; font-weight: 850; line-height: 1.2; cursor: pointer; touch-action: manipulation; }
.scene-motion-control::before { content: ""; display: block; width: 13px; height: 13px; border: 1px solid #99c6db; border-radius: 2px; background: #0a2036; }
.scene-motion-toggle:checked + .scene-motion-control::before { content: "✓"; color: #071729; background: var(--cyan); border-color: var(--cyan); font-size: 12px; line-height: 11px; text-align: center; }
.scene-motion-toggle:focus-visible + .scene-motion-control { outline: 3px solid #bcf5ff; outline-offset: 5px; }
.scene-motion-control:hover { color: #fff; border-color: var(--cyan); }
@media (prefers-reduced-motion: no-preference) {
    .lantern-light { animation: lantern-flicker 9s ease-in-out infinite; animation-play-state: paused; }
    /* Un seul héros visible ; chaque planche termine ses boucles avant le relais. */
    .sprite-ready > .character-still { visibility: hidden; }
    .sprite-ready > .character-motion { display: block; }
    .game-logo { animation: logo-breathe 8s ease-in-out infinite; animation-play-state: paused; transform-origin: 50% 70%; }
    .game-logo span { color: #ffd576; -webkit-text-fill-color: currentColor; animation: logo-shine 10s ease-in-out infinite; animation-play-state: paused; }
    .scene-motion-toggle:checked ~ .lantern-light, .scene-motion-toggle:checked ~ .game-identity .game-logo, .scene-motion-toggle:checked ~ .game-identity .game-logo span { animation-play-state: running; }
    .opening-scene.scene-motion-suspended .lantern-light, .opening-scene.scene-motion-suspended .game-logo, .opening-scene.scene-motion-suspended .game-logo span { animation-play-state: paused; }
}
@keyframes lantern-flicker { 0%, 100% { opacity: .1; } 18% { opacity: .9; } 36% { opacity: .35; } 54% { opacity: .78; } 73% { opacity: .2; } 87% { opacity: .65; } }
@keyframes logo-breathe { 0%, 100% { transform: translateY(0) rotate(-.35deg); } 50% { transform: translateY(-5px) rotate(.35deg); } }
@keyframes logo-shine { 0%, 28%, 72%, 100% { color: #ffd576; filter: brightness(1); } 45%, 52% { color: #ffecad; filter: brightness(1.18); } }
@media (prefers-reduced-motion: reduce) {
    .scene-motion-toggle, .scene-motion-control { display: none; }
    .opening-party::after { display: none; }
}
.game-identity { position: absolute; z-index: 5; top: 22%; left: max(4vw, calc((100vw - 1500px) / 2)); width: 39%; max-width: 610px; text-align: center; }
.game-genre { margin-bottom: 12px; color: #e9f9fc; font-size: 13px; font-weight: 1000; letter-spacing: 3px; text-transform: uppercase; text-shadow: 0 2px 4px #000; }
.game-logo { color: var(--gold); font-size: clamp(104px, 10.9vw, 186px); line-height: .78; letter-spacing: -3px; -webkit-text-stroke: 6px #482510; paint-order: stroke fill; text-shadow: 0 7px 0 #a85e25, 0 12px 0 #3c221c, 0 17px 18px #0008; }
.game-logo span { display: block; }
.game-logo span:last-child { font-size: 1.13em; margin-top: 8px; }
.game-tagline { margin-top: 32px; color: #fff2d1; font-family: var(--display); font-size: clamp(16px, 1.6vw, 23px); text-shadow: 0 2px 0 #171014, 0 0 6px #0d112b; }
.opening-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 12px; margin-top: 20px; }
.prototype-note { margin-top: 7px; color: #f1e4ce; font-size: 12px; font-weight: 850; text-shadow: 0 2px 3px #000; }
/* Une invocation à la fois : le cadrage reste stable quand le héros change. */
.opening-party { position: absolute; z-index: 2; bottom: 8%; right: 3%; width: 46%; height: 72%; }
.opening-party::before { content: ""; position: absolute; z-index: -1; left: 14%; right: 14%; bottom: -7px; height: 7%; border-radius: 50%; background: #100e1190; filter: blur(15px); }
.opening-party::after { content: ""; position: absolute; z-index: 5; inset: 2% 4% -2%; pointer-events: none; background: radial-gradient(ellipse at 50% 55%, #fff6ce 0, #a9f3ffb8 17%, #37bfff73 34%, transparent 68%); opacity: calc(var(--summon-flash, 0) * .85); transform: scale(calc(.92 + var(--summon-flash, 0) * .08)); }
.opening-character { position: absolute; inset: 0; width: 100%; height: 100%; opacity: var(--hero-opacity, 1); filter: drop-shadow(0 12px 6px #0e0b1580); }
.opening-character[hidden] { display: none; }
.scene-motion-suspended .opening-party::after, .scene-motion-toggle:not(:checked) ~ .opening-party::after { opacity: 0; }
.scene-motion-suspended .opening-character, .scene-motion-toggle:not(:checked) ~ .opening-party .opening-character { opacity: 1; }
.explore-cue { position: absolute; z-index: 6; left: 50%; bottom: 19px; display: flex; flex-direction: column; align-items: center; gap: 1px; transform: translateX(-50%); min-height: 48px; color: #f4e9cc; font-size: 11px; font-weight: 1000; letter-spacing: 1px; text-shadow: 0 2px 4px #000; white-space: nowrap; }
.cue-rune { color: var(--cyan); font-size: 35px; line-height: .7; }
@media (min-width: 1700px) {
    .opening-party { right: max(3%, calc((100vw - 1800px) / 2)); width: min(46%, 780px); }
    .game-identity { top: 25%; }
}
@media (max-width: 1100px) {
    .opening-scene { min-height: 730px; }
    .game-identity { top: 25%; left: 3%; width: 40%; }
    .game-genre { font-size: 10px; letter-spacing: 2px; }
    .game-logo { font-size: 12vw; -webkit-text-stroke-width: 4px; }
    .game-tagline { margin-top: 25px; font-size: 17px; }
    .opening-actions { gap: 0; margin-top: 15px; }
    .opening-actions .stone-button { width: 235px; min-height: 68px; font-size: 18px; padding-block: 15px 18px; }
    .opening-party { height: 66%; width: 46%; bottom: 10%; }
}
@media (max-width: 760px) {
    .opening-scene { min-height: 800px; max-height: 1100px; background-position: 50% center; }
    .scene-motion-control { top: 70px; right: 50%; bottom: auto; left: auto; min-height: 24px; padding: 3px 8px; transform: translateX(50%); font-size: 10px; }
    .game-identity { top: 12%; left: 50%; transform: translateX(-50%); width: 90%; max-width: 440px; }
    .game-genre { font-size: 10px; margin-bottom: 10px; }
    .game-logo { font-size: 111px; line-height: .76; -webkit-text-stroke-width: 4px; text-shadow: 0 5px 0 #a85e25, 0 9px 0 #3c221c, 0 12px 14px #0008; }
    .game-logo span:last-child { margin-top: 5px; }
    .game-tagline { margin-top: 22px; font-size: 17px; }
    .opening-actions { position: absolute; top: calc(100svh - 12svh - 166px); left: 50%; width: 290px; transform: translateX(-50%); }
    .opening-actions .stone-button { width: 285px; min-height: 84px; font-size: 22px; }
    .opening-actions .blue-button { display: none; }
    .prototype-note { position: absolute; top: calc(100svh - 12svh - 80px); left: 0; width: 100%; font-size: 10px; }
    .opening-party { bottom: 168px; right: 0; left: 0; width: 80%; max-width: 470px; height: 33%; max-height: calc(100% - 540px); margin-inline: auto; }
    .explore-cue { bottom: 9px; min-height: 29px; gap: 4px; font-size: 9px; }
}
@media (max-width: 440px) {
    .opening-scene { min-height: 740px; }
    .scene-motion-control { top: 64px; }
    .game-identity { top: 12%; width: 93%; }
    .game-logo { font-size: 100px; }
    .game-genre { font-size: 9px; letter-spacing: 2px; }
    .game-tagline { margin-top: 22px; font-size: 15px; }
    .opening-party { height: 34%; max-height: calc(100% - 530px); bottom: 204px; width: 85%; }
    .opening-actions { top: calc(100svh - 12svh - 165px); }
    .opening-actions .stone-button { width: 269px; min-height: 80px; font-size: 21px; }
    .prototype-note { top: calc(100svh - 12svh - 69px); }
}
@media (max-width: 360px) {
    .scene-motion-control { top: 60px; }
    .game-logo { font-size: 88px; }
    .game-tagline { font-size: 13px; }
    .game-genre { font-size: 8px; }
}
@media (max-height: 760px) and (min-width: 761px) {
    .opening-scene { height: 760px; }
    .game-identity { top: 19%; }
    .game-logo { font-size: min(130px, 12vw); }
    .opening-party { height: 76%; }
}
@media (max-height: 740px) and (max-width: 760px) {
    .opening-actions { top: 480px; }
    .prototype-note { top: 574px; }
}
@media (max-height: 740px) and (min-width: 441px) and (max-width: 760px) {
    .opening-party { bottom: 248px; max-height: calc(100% - 600px); }
}
@media (prefers-contrast: more) {
    .prototype-note { color: #e9f4ff; }
}
@media print {
    .opening-actions, .explore-cue, .scene-motion-toggle, .scene-motion-control { display: none; }
    .lantern-light, .character-motion-strip, .game-logo, .game-logo span { animation: none; }
    .game-logo span { background: none; color: var(--gold); -webkit-text-fill-color: currentColor; }
    .sprite-ready > .character-still { visibility: visible; }
    .sprite-ready > .character-motion { display: none; }
    .opening-scene { height: 700px; min-height: 0; }
    .game-identity { top: 100px; }
}
