/* DONJON SIDE-SCROLLER 2D & COMBAT FINAL FANTASY */
#dungeon-canvas {
  width: 100%;
  max-width: 350px;
  aspect-ratio: 350 / 220;
  display: block;
  margin: 0 auto;
  background: #03060c;
  border: 2px solid var(--neon-blue);
  box-shadow: var(--neon-glow), 0 0 28px rgba(0,0,0,0.8) inset;
  border-radius: 10px;
  touch-action: none;
}

/* CONTRÔLES TACTILES SIDE-SCROLLER (GAUCHE, DROITE, SAUT) */
.platformer-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  gap: 10px;
}

.platformer-group {
  display: flex;
  gap: 8px;
  flex: 1;
}

.plat-btn {
  margin: 0;
  padding: 14px 0;
  font-family: 'Orbitron', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  background: rgba(0, 240, 255, 0.15);
  border: 1px solid var(--neon-blue);
  color: var(--neon-blue);
  border-radius: 8px;
  flex: 1;
  text-align: center;
}

.plat-btn.jump {
  background: rgba(0, 230, 118, 0.18);
  border-color: var(--green);
  color: var(--green);
}

.plat-btn:active {
  background: var(--neon-blue);
  color: #000;
}

/* SCÈNE DE COMBAT FINAL FANTASY */
.ff-battle-stage {
  background: linear-gradient(180deg, #120924 0%, #091526 65%, #050b14 100%);
  border: 2px solid var(--urgent-red);
  border-radius: 10px;
  padding: 12px;
  position: relative;
  overflow: hidden;
}

.ff-battle-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 100%, rgba(255,42,84,0.22), transparent 60%), radial-gradient(ellipse at 50% 0%, rgba(168,85,247,0.18), transparent 55%);
}

.ff-fighters-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  min-height: 135px;
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  position: relative;
  background: linear-gradient(180deg, transparent 55%, rgba(255,255,255,0.05) 56%, rgba(0,0,0,0.35) 100%);
}

.ff-fighter-box {
  width: 46%;
  text-align: center;
  position: relative;
}

.ff-sprite {
  font-size: 3.3rem;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
  position: relative;
  overflow: visible;
}

#ff-hero-sprite { filter: drop-shadow(0 0 8px rgba(0,240,255,0.7)); }
#ff-enemy-sprite { filter: drop-shadow(0 0 10px rgba(255,42,84,0.75)); }
#ff-hero-sprite.hit, #ff-enemy-sprite.hit { animation: shakeHit 0.35s ease; }

@keyframes shakeHit {
  0%, 100% { transform: translateX(0); filter: none; }
  25% { transform: translateX(-8px); filter: brightness(2) drop-shadow(0 0 8px red); }
  75% { transform: translateX(8px); }
}

.ff-sprite.boss { height: 90px; }

.dmg-float {
  position: absolute;
  left: 50%;
  top: 0;
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: 1.3rem;
  pointer-events: none;
  z-index: 5;
  text-shadow: 0 0 8px currentColor, 0 2px 0 #000;
  animation: dmgUp 0.95s ease-out forwards;
}

@keyframes dmgUp {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(.6); }
  15% { opacity: 1; transform: translate(-50%, -6px) scale(1.3); }
  100% { opacity: 0; transform: translate(-50%, -56px) scale(1); }
}

.ff-hp-bar {
  width: 100%;
  height: 10px;
  background: #1a050a;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 5px;
  overflow: hidden;
  margin-top: 4px;
}

.ff-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #00e676, #00b0ff);
  transition: width 0.25s ease;
}

.ff-hp-fill.enemy {
  background: linear-gradient(90deg, #ff2a54, #ff9100);
}

.ff-mp-bar {
  width: 100%;
  height: 7px;
  background: #08051a;
  border: 1px solid rgba(168,85,247,0.5);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 3px;
}

.ff-mp-fill {
  height: 100%;
  background: linear-gradient(90deg, #7e22ce, #c084fc);
  transition: width 0.25s ease;
}

.ff-log {
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(0, 240, 255, 0.3);
  border-radius: 6px;
  padding: 8px 10px;
  margin: 10px 0;
  min-height: 54px;
  font-size: 0.9rem;
  color: #fff;
  font-weight: 600;
}

.ff-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ff-actions-grid button {
  margin: 0;
  padding: 11px 8px;
  font-size: 0.88rem;
}
/* Commandes tactiles : multi-touch, grandes zones, pas de menu contextuel */
.plat-btn { touch-action: none; min-height: 60px; -webkit-touch-callout: none; }
.plat-btn.active { background: var(--neon-blue); color: #000; }
.platformer-group { flex: 1.5; }
.plat-btn.jump { flex: 1; font-size: 1.15rem; }

/* ===== Mode plein écran (jeu) ===== */
body.jeu-actif { overflow: hidden; padding: 0; }
body.jeu-actif .top-bar, body.jeu-actif .bottom-nav { display: none; }
body.jeu-actif #system-toast { top: calc(46px + env(safe-area-inset-top)); left: 50%; right: auto; width: max-content; max-width: 70vw; transform: translate(-50%, -14px); padding: 6px 14px; font-size: .85rem; border-width: 1px; background: rgba(6,18,36,.88); }
body.jeu-actif #system-toast.show { transform: translate(-50%, 0); }
.plein-ecran #map-header-title { display: none; }
#dungeon-map-view.plein-ecran { position: fixed; inset: 0; z-index: 1500; margin: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; background: #02040a; }
.plein-ecran #dungeon-canvas { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; aspect-ratio: auto; border: 0; border-radius: 0; box-shadow: none; }
@media (orientation: portrait) { .plein-ecran #dungeon-canvas { inset: auto; left: 0; top: calc(64px + env(safe-area-inset-top)); height: auto; aspect-ratio: 350 / 220; } }
.plein-ecran .panel-title { position: absolute; top: env(safe-area-inset-top); left: 10px; right: 90px; z-index: 3; margin: 6px 0 0; padding: 0; border: 0; font-size: .7rem; pointer-events: none; text-shadow: 0 1px 3px #000; }
.plein-ecran .ff-hp-bar, .plein-ecran .ff-mp-bar { position: absolute; left: 10px; width: 36%; z-index: 3; margin: 0 !important; }
.plein-ecran .ff-hp-bar { top: calc(env(safe-area-inset-top) + 28px); height: 8px; }
.plein-ecran .ff-mp-bar { top: calc(env(safe-area-inset-top) + 40px); height: 6px; }
.plein-ecran > div[style*="text-align:center"] { display: none; }
.plein-ecran > .btn-danger-ancien { position: absolute; top: calc(env(safe-area-inset-top) + 6px); right: 10px; width: auto; margin: 0; padding: 6px 10px; font-size: .7rem; z-index: 5; }
.plein-ecran .platformer-controls { position: absolute; left: 0; right: 0; bottom: 0; margin: 0; padding: 0 16px calc(12px + env(safe-area-inset-bottom)); z-index: 4; align-items: flex-end; pointer-events: none; }
.plein-ecran .platformer-group { gap: 14px; flex: 1; }
.plein-ecran .plat-actions { justify-content: flex-end; }
.plein-ecran .plat-btn { pointer-events: auto; flex: 0 0 auto; width: 68px; height: 68px; min-height: 0; padding: 0; border-radius: 50%; font-size: 1.4rem; opacity: .8; backdrop-filter: blur(4px); }
.plein-ecran .plat-btn.jump { width: 78px; height: 78px; }

@media (orientation: portrait) {
  .plein-ecran::after { content: "📱 Tourne ton téléphone à l'horizontale : le jeu s'affiche en grand"; position: absolute; left: 24px; right: 24px; top: 48%; text-align: center; color: var(--text-muted); font-size: .9rem; line-height: 1.4; pointer-events: none; }
}

/* ===== Interface de jeu ===== */
.run-hud, .btn-pause, .btn-eveil, .run-overlay { display: none; }
.plein-ecran .run-hud { display: flex; position: absolute; left: 10px; top: calc(env(safe-area-inset-top) + 52px); gap: 6px; z-index: 5; flex-wrap: wrap; max-width: 60vw; }
.hud-chip { display: inline-flex; align-items: center; gap: 3px; width: auto; margin: 0; padding: 3px 8px; font-size: .72rem; font-weight: 700; letter-spacing: 0; text-transform: none;
  border-radius: 12px; background: rgba(4,8,17,.72); border: 1px solid rgba(0,240,255,.35); color: #e8f4ff; }
.hud-chip.or { color: var(--gold); border-color: rgba(255,200,0,.45); }
.hud-chip.xp { color: var(--neon-blue); }
.hud-chip.ombre { color: #e9d5ff; border-color: rgba(168,85,247,.55); }
button.hud-chip { border-color: var(--green); color: var(--green); cursor: pointer; }
.plein-ecran .btn-pause { display: flex; position: absolute; top: calc(env(safe-area-inset-top) + 8px); right: 12px; width: 44px; height: 44px; margin: 0; padding: 0;
  border-radius: 50%; font-size: 1.1rem; z-index: 6; background: rgba(4,8,17,.72); }
.plein-ecran .btn-eveil.visible { display: flex; position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(96px + env(safe-area-inset-bottom)); width: auto; margin: 0;
  padding: 10px 24px; z-index: 6; font-family: 'Orbitron', sans-serif; font-weight: 900; letter-spacing: 2px; color: #f3e8ff;
  background: rgba(88,28,135,.88); border: 2px solid #c084fc; border-radius: 30px; animation: pulseEveil .7s infinite alternate; }
@keyframes pulseEveil { from { box-shadow: 0 0 8px rgba(192,132,252,.5); } to { box-shadow: 0 0 28px rgba(192,132,252,1); } }
.plat-btn#btn-dash { border-color: #94a3b8; }
.plat-btn#btn-ombre { border-color: var(--purple-shadow); }
.run-overlay.visible { display: flex; position: absolute; inset: 0; z-index: 20; align-items: center; justify-content: center; padding: 16px;
  background: rgba(2,4,10,.74); backdrop-filter: blur(3px); }
.run-carte { width: min(430px, 100%); max-height: 100%; overflow: auto; text-align: center; padding: 16px; border-radius: 14px;
  background: rgba(9,20,38,.97); border: 1px solid var(--neon-blue); box-shadow: 0 0 30px rgba(0,240,255,.25); animation: entreeCarte .35s ease; }
@keyframes entreeCarte { from { transform: scale(.92); opacity: 0; } to { transform: none; opacity: 1; } }
.run-carte h2 { font-family: 'Orbitron', sans-serif; font-size: 1.15rem; letter-spacing: 2px; margin-bottom: 4px; }
.run-rang { font-family: 'Orbitron', sans-serif; font-weight: 900; font-size: 2.6rem; line-height: 1; margin: 6px 0 8px; text-shadow: 0 0 18px currentColor; }
.run-ligne { display: flex; justify-content: space-between; gap: 10px; font-size: .88rem; padding: 4px 2px; border-bottom: 1px solid rgba(255,255,255,.07); text-align: left; }
.run-ligne b { color: #fff; text-align: right; }
.run-statut { font-size: .8rem; color: var(--text-muted); margin-top: 8px; min-height: 1.2em; }
.run-boutons { display: flex; gap: 8px; }
.run-aide { font-size: .74rem; color: var(--text-muted); margin-top: 10px; line-height: 1.45; text-align: left; }
@media (max-height: 430px) {
  .run-carte { padding: 10px 14px; } .run-rang { font-size: 1.9rem; margin: 2px 0 4px; } .run-ligne { padding: 2px; font-size: .8rem; }
  .run-carte button { padding: 9px 10px; margin-top: 6px; }
}
/* Petits écrans / portrait : six commandes sur la largeur */
@media (max-width: 460px) {
  .plein-ecran .platformer-controls { padding: 0 8px calc(10px + env(safe-area-inset-bottom)); }
  .plein-ecran .platformer-group { gap: 7px; }
  .plein-ecran .plat-btn { width: 50px; height: 50px; font-size: 1.05rem; }
  .plein-ecran .plat-btn.jump { width: 58px; height: 58px; }
}
/* Armée des Ombres au portail */
.armee { margin: 4px 0 8px; }
.armee-titre { display: flex; justify-content: space-between; font-family: 'Orbitron', sans-serif; font-size: .74rem; color: #e9d5ff; letter-spacing: 1px; margin-bottom: 6px; }
.armee-ombre { display: flex; align-items: center; gap: 8px; padding: 6px 8px; margin-bottom: 5px; border-radius: 8px; background: rgba(88,28,135,.22); border: 1px solid rgba(168,85,247,.4); }
.armee-icone { font-size: 1.3rem; filter: drop-shadow(0 0 4px #a855f7); }
.armee-nom { flex: 1; font-weight: 700; font-size: .88rem; line-height: 1.2; }
.armee-nom small { display: block; font-weight: 600; font-size: .72rem; color: var(--text-muted); }
.armee-vide { font-size: .8rem; color: var(--text-muted); padding: 6px 8px; border: 1px dashed rgba(168,85,247,.45); border-radius: 8px; }

/* Sans classe : ni magie, ni Armée des Ombres, ni jauge de MP */
.sans-ombre #btn-ombre, .sans-ombre #hud-armee, .sans-ombre .ff-mp-bar, .sans-ombre .ombre-seul, .sans-ombre .btn-eveil { display: none !important; }
