
/* ==========================================================================
   V6.40 — DIALOGUES NON BLOQUANTS + DÉMO DU DASH
   --------------------------------------------------------------------------
   Tous les textes existants sont conservés. Seule leur présentation change :
   le jeu reste contrôlable derrière le bandeau et chaque réplique avance seule.
   ========================================================================== */
body.dialogue-open::after{display:none!important}
body.dialogue-open #game,body.dialogue-open #hud{filter:none!important}
body.dialogue-open #touch{opacity:1!important}
body.dialogue-open #touch .touch-actions,body.dialogue-open #touch .touch-pause{pointer-events:auto!important}

#bossDialogue{
  position:fixed!important;z-index:31!important;left:50%!important;top:max(70px,calc(env(safe-area-inset-top) + 62px))!important;
  width:min(760px,94vw)!important;transform:translateX(-50%)!important;pointer-events:none!important;
  filter:drop-shadow(0 8px 18px rgba(0,0,0,.55))!important;
}
#bossDialogueBox{
  position:relative!important;display:grid!important;grid-template-columns:116px minmax(0,1fr) 24px!important;align-items:center!important;gap:9px!important;
  min-height:104px!important;padding:18px 25px 16px 22px!important;border-radius:0!important;overflow:visible!important;
  clip-path:polygon(9px 0,calc(100% - 9px) 0,100% 9px,100% calc(100% - 9px),calc(100% - 9px) 100%,9px 100%,0 calc(100% - 9px),0 9px)!important;
}
#bossPortrait,#bossPortrait.pix-animated-host,#bossPortrait.pix-animated-host.pix-portrait-active,#bossDialogue.tutorial-briefing #bossPortrait.pix-animated-host{
  width:112px!important;height:112px!important;min-width:112px!important;padding:0!important;border:0!important;background:transparent!important;
  box-shadow:none!important;overflow:visible!important;animation:none!important;filter:drop-shadow(0 4px 4px rgba(0,0,0,.35))!important;
}
#bossDialogueName{margin:0 0 5px!important;color:#66efff!important;font-size:11px!important;font-weight:950!important;letter-spacing:.08em!important}
#bossDialogueText{min-height:0!important;color:#f3f7ff!important;font-size:clamp(12px,2vw,17px)!important;font-weight:900!important;line-height:1.35!important;text-shadow:0 2px 0 rgba(0,0,0,.7)!important}
#bossDialogueHint{display:none!important}
.boss-dialogue-progress{height:5px;margin-top:8px;border:1px solid #235c83;background:#09213d;overflow:hidden}
.boss-dialogue-progress i{display:block;width:100%;height:100%;background:linear-gradient(90deg,#18c8e8,#dfad72);transform-origin:left;animation:sbBossDialogueProgress var(--boss-dialogue-duration,4.2s) linear forwards}
@keyframes sbBossDialogueProgress{to{transform:scaleX(0)}}
#bossDialogueClose{align-self:start;position:relative!important;z-index:5!important;width:24px;height:24px;padding:0;border:1px solid #8e5129;background:#ecd18f;color:#442510;font:950 18px/1 monospace;cursor:pointer}
#bossDialogue.dialogue-entering{animation:sbBossDialogueIn .20s steps(4,end) both}
@keyframes sbBossDialogueIn{from{opacity:0;transform:translate(-50%,-12px)}to{opacity:1;transform:translate(-50%,0)}}

/* Démonstration courte avant l’exercice interactif : aucune ressource externe. */
#dashDemoOverlay{position:fixed;inset:0;z-index:46;display:grid;place-items:center;padding:18px;background:rgba(0,4,15,.36);pointer-events:auto}
#dashDemoOverlay.hidden{display:none!important}
.dash-demo-panel{width:min(720px,94vw);padding:18px 20px 16px;background:var(--sb-space-panel);border:1px solid rgba(82,228,255,.52);box-shadow:inset 0 0 0 3px rgba(6,45,101,.58),0 18px 50px rgba(0,0,0,.68);font-family:"Courier New",ui-monospace,monospace}
.dash-demo-head{display:flex;align-items:end;justify-content:space-between;gap:14px;margin-bottom:10px}.dash-demo-head strong{color:#67f1ff;font-size:16px;letter-spacing:.08em}.dash-demo-head span{color:#a9bdd7;font-size:10px;text-align:right}
.dash-demo-scene{position:relative;height:250px;overflow:hidden;border:1px solid rgba(99,243,255,.28);background:radial-gradient(circle at 50% 45%,rgba(24,67,115,.28),rgba(1,5,17,.98) 64%)}
.dash-demo-scene::before{content:"";position:absolute;inset:0;background-image:radial-gradient(circle,rgba(255,255,255,.55) 0 1px,transparent 1.2px);background-size:37px 29px;opacity:.22}
.dash-demo-laser{position:absolute;z-index:2;left:50%;top:8%;bottom:8%;width:5px;transform:translateX(-50%);background:#ff4167;box-shadow:0 0 7px #ff4167,0 0 22px #ff274f}
.dash-demo-laser::after{content:"LASER";position:absolute;left:10px;top:8px;color:#ff7991;font:900 9px monospace;letter-spacing:.12em}
.dash-demo-ship,.dash-demo-ghost{position:absolute;z-index:4;left:17%;top:42%;width:0;height:0;border-left:25px solid #eaffff;border-top:11px solid transparent;border-bottom:11px solid transparent;filter:drop-shadow(0 0 7px #63f3ff);animation:dashDemoShip 5.2s cubic-bezier(.2,.72,.24,1) both}
.dash-demo-ship::before,.dash-demo-ghost::before{content:"";position:absolute;left:-32px;top:-3px;width:16px;height:6px;background:linear-gradient(90deg,transparent,#63f3ff);filter:drop-shadow(0 0 5px #63f3ff)}
.dash-demo-ghost{z-index:3;opacity:0;border-left-color:#76eaff;filter:none}.dash-demo-ghost.g1{animation:dashDemoGhost1 5.2s linear both}.dash-demo-ghost.g2{animation:dashDemoGhost2 5.2s linear both}.dash-demo-ghost.g3{animation:dashDemoGhost3 5.2s linear both}
@keyframes dashDemoShip{0%,12%{left:17%}38%{left:38%}43%{left:40%}52%{left:76%}100%{left:82%}}
@keyframes dashDemoGhost1{0%,42%{left:41%;opacity:0}46%{left:47%;opacity:.65}60%,100%{left:47%;opacity:0}}
@keyframes dashDemoGhost2{0%,44%{left:47%;opacity:0}49%{left:56%;opacity:.5}63%,100%{left:56%;opacity:0}}
@keyframes dashDemoGhost3{0%,46%{left:55%;opacity:0}52%{left:66%;opacity:.36}66%,100%{left:66%;opacity:0}}
.dash-demo-controls{position:absolute;z-index:6;left:0;right:0;bottom:12px;height:82px;pointer-events:none}
.dash-demo-mobile-controls,.dash-demo-pc-controls,.dash-demo-pad-controls{display:none;position:absolute;inset:0}
#dashDemoOverlay.demo-mobile .dash-demo-mobile-controls{display:block}#dashDemoOverlay.demo-pc .dash-demo-pc-controls{display:flex}#dashDemoOverlay.demo-gamepad .dash-demo-pad-controls{display:flex}
.dash-demo-stick{position:absolute;left:8%;bottom:0;width:72px;height:72px;border:2px solid #63f3ff;border-radius:50%;background:rgba(9,36,64,.7)}.dash-demo-stick i{position:absolute;left:50%;top:50%;width:28px;height:28px;border-radius:50%;background:#a8fbff;transform:translate(-50%,-50%);animation:dashDemoStickPush 5.2s ease both}
@keyframes dashDemoStickPush{0%,10%{transform:translate(-50%,-50%)}20%,42%{transform:translate(calc(-50% + 18px),-50%)}55%,100%{transform:translate(-50%,-50%)}}
.dash-demo-tap{position:absolute;right:10%;bottom:4px;width:64px;height:64px;display:grid;place-items:center;border:2px solid #ff72bd;border-radius:50%;background:rgba(87,13,57,.78);color:#fff;font:950 10px monospace;box-shadow:0 0 16px rgba(255,79,163,.3)}
.dash-demo-tap::after{content:"×2";position:absolute;right:-22px;top:-10px;color:#ffd7ec;font:950 13px monospace}.dash-demo-tap{animation:dashDemoDoubleTap 5.2s ease both}
@keyframes dashDemoDoubleTap{0%,34%,100%{transform:scale(1);filter:brightness(1)}37%,39%,43%,45%{transform:scale(.82);filter:brightness(1.8)}38%,40%,44%,46%{transform:scale(1);filter:brightness(1)}}
.dash-demo-pc-controls,.dash-demo-pad-controls{align-items:end;justify-content:center;gap:12px;padding-bottom:9px}.dash-demo-pc-controls kbd,.dash-demo-pad-controls kbd{min-width:54px;padding:11px 13px;border:2px solid #49647f;border-bottom-width:5px;border-radius:7px;background:#0b1628;color:#fff;font:950 13px monospace;text-align:center;box-shadow:0 5px 0 #030811}.dash-demo-pc-controls kbd:first-child{animation:dashDemoDKey 5.2s ease both}.dash-demo-pc-controls kbd.shift{min-width:86px;animation:dashDemoShiftKey 5.2s ease both}.dash-demo-pc-controls span,.dash-demo-pad-controls span{align-self:center;color:#7ff6ff;font-weight:950}
@keyframes dashDemoDKey{0%,12%,55%,100%{transform:none;filter:none}18%,43%{transform:translateY(3px);filter:brightness(1.6);border-bottom-width:2px}}
@keyframes dashDemoShiftKey{0%,39%,52%,100%{transform:none;filter:none}42%,48%{transform:translateY(3px);filter:brightness(1.9);border-color:#9d7cff;border-bottom-width:2px}}
.dash-demo-pad-controls kbd:first-child{animation:dashDemoDKey 5.2s ease both}.dash-demo-pad-controls kbd:last-child{animation:dashDemoShiftKey 5.2s ease both}
.dash-demo-progress{height:5px;margin:10px 0 10px;border:1px solid #235c83;background:#06192d;overflow:hidden}.dash-demo-progress i{display:block;width:100%;height:100%;background:linear-gradient(90deg,#63f3ff,#9d7cff);transform-origin:left;animation:dashDemoProgress 5.2s linear forwards}@keyframes dashDemoProgress{to{transform:scaleX(0)}}
#dashDemoSkip{width:100%;text-align:center!important}

/* Allègement purement visuel, activé seulement après ralentissement soutenu. */
body.sb-perf-lite #radioDialogue,body.sb-perf-lite #bossDialogue{filter:none!important}
body.sb-perf-lite .pix-frame-img{filter:drop-shadow(0 2px 0 rgba(0,0,0,.32))!important}
body.sb-perf-low #vignette{display:none!important}

@media(max-width:700px){
  #bossDialogue{top:max(76px,calc(env(safe-area-inset-top) + 68px))!important;width:96vw!important}
  #bossDialogueBox{grid-template-columns:88px minmax(0,1fr) 20px!important;gap:6px!important;min-height:88px!important;padding:13px 17px 12px 14px!important}
  #bossPortrait,#bossPortrait.pix-animated-host,#bossPortrait.pix-animated-host.pix-portrait-active,#bossDialogue.tutorial-briefing #bossPortrait.pix-animated-host{width:88px!important;height:88px!important;min-width:88px!important}
  #bossDialogueName{font-size:8px!important}#bossDialogueText{font-size:clamp(10px,3.3vw,13px)!important}#bossDialogueClose{width:20px;height:20px;font-size:14px}
  .dash-demo-panel{padding:13px}.dash-demo-scene{height:220px}.dash-demo-head{align-items:start;flex-direction:column;gap:4px}.dash-demo-head span{text-align:left}.dash-demo-ship,.dash-demo-ghost{top:38%}
}
@media(max-height:650px){#dashDemoOverlay{padding:8px}.dash-demo-panel{padding:10px 12px}.dash-demo-scene{height:180px}.dash-demo-controls{height:64px}.dash-demo-stick{width:56px;height:56px}.dash-demo-tap{width:52px;height:52px}}
