/* Écrans */
.em2-screen { display: none; margin-top: 24px; }
.em2-screen.visible { display: block; }
.em2-screen-back { margin: 0 0 12px; font-size: 0.9rem; }
.em2-screen-back a { color: var(--text-muted); }
.em2-screen-back a:hover { color: var(--accent); }

/* Badges de type (9 types) */
.em2-type-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}
.em2-type-feu { background: rgba(255, 149, 0, 0.15); color: #ff9500; }
.em2-type-eau { background: rgba(91, 140, 255, 0.15); color: #5b8cff; }
.em2-type-plante { background: rgba(74, 222, 128, 0.15); color: #4ade80; }
.em2-type-electrik { background: rgba(255, 214, 0, 0.15); color: #ffd600; }
.em2-type-sol { background: rgba(193, 154, 107, 0.18); color: #c19a6b; }
.em2-type-vol { background: rgba(179, 217, 255, 0.18); color: #8ecbff; }
.em2-type-ombre { background: rgba(139, 92, 255, 0.18); color: #8b5cff; }
.em2-type-insecte { background: rgba(163, 217, 74, 0.18); color: #a3d94a; }
.em2-type-normal { background: rgba(151, 160, 179, 0.18); color: var(--text-muted); }

/* Écran : choix du starter */
.em2-starter-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 20px;
  max-width: 640px;
  margin-top: 20px;
}
.em2-starter-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 16px;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.em2-starter-card:hover { border-color: var(--accent); transform: translateY(-4px); }
.em2-starter-emoji { font-size: 3rem; }
.em2-starter-card h4 { margin: 0; }

/* HUD */
.em2-hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  margin-bottom: 12px;
}
.em2-hud-item { display: flex; flex-direction: column; gap: 2px; }
.em2-hud-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.em2-hud-value { font-size: 1.1rem; font-weight: 700; color: var(--accent); }
.em2-party-icons { font-size: 1.3rem; }

/* Carte / canvas */
.em2-canvas-wrap {
  position: relative;
  width: 100%;
  max-width: 640px;
}
.em2-canvas-wrap canvas {
  width: 100%;
  height: auto;
  display: block;
  background: #151a24;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  touch-action: none;
}
.em2-dialogue {
  position: absolute;
  left: 4%;
  right: 4%;
  bottom: 6%;
  background: rgba(11, 14, 20, 0.94);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  backdrop-filter: blur(2px);
}
.em2-dialogue-text { margin: 0 0 8px; font-weight: 600; }
.em2-dialogue-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.em2-touch-controls {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
}
.em2-dpad {
  display: grid;
  grid-template-columns: repeat(3, 44px);
  grid-template-rows: repeat(2, 44px);
  gap: 4px;
}
.em2-dpad-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  font-size: 1.1rem;
  cursor: pointer;
  touch-action: none;
}
.em2-dpad-up { grid-column: 2; grid-row: 1; }
.em2-dpad-left { grid-column: 1; grid-row: 2; }
.em2-dpad-right { grid-column: 3; grid-row: 2; }
.em2-dpad-down { grid-column: 2; grid-row: 2; }

/* Combat */
.em2-battle {
  max-width: 640px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  overflow: hidden;
}
.em2-battle canvas#em2BattleFx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.em2-combatant { display: flex; flex-direction: column; gap: 6px; position: relative; z-index: 1; }
.em2-combatant-top { display: flex; align-items: center; gap: 12px; }
.em2-combatant-info { display: flex; flex-direction: column; gap: 4px; }
.em2-combatant-name { font-weight: 700; }
.em2-combatant-level { font-size: 0.8rem; color: var(--text-muted); }
.em2-combatant-emoji { font-size: 2.6rem; display: inline-block; }
.em2-hp-bar {
  height: 10px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.em2-hp-fill { height: 100%; background: linear-gradient(90deg, #4ade80, #34c759); transition: width 0.3s ease; }
.em2-hp-label { align-self: flex-end; font-size: 0.8rem; color: var(--text-muted); }
.em2-xp-bar {
  height: 5px;
  background: var(--bg-alt);
  border-radius: 999px;
  overflow: hidden;
}
.em2-xp-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.4s ease; }
.em2-battle-msg { min-height: 1.4em; font-weight: 600; margin: 0; position: relative; z-index: 1; }
.em2-battle-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; position: relative; z-index: 1; }
.em2-switch-list, .em2-ball-list, .em2-item-list { display: flex; flex-direction: column; gap: 8px; }

/* Écran : équipe & boîte / sac / boutique */
.em2-creature-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.em2-creature-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  flex-wrap: wrap;
}
.em2-creature-emoji { font-size: 1.8rem; }
.em2-creature-info { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 4px; }
.em2-creature-name { font-weight: 600; }
.em2-creature-hp-bar { width: 140px; }
.em2-creature-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.em2-item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
}
.em2-item-name { flex: 1; font-weight: 600; }
.em2-item-qty { color: var(--text-muted); font-size: 0.85rem; }
.em2-shop-money { font-weight: 700; color: var(--accent); }

/* Animations de combat */
@keyframes em2-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(3px); }
}
.em2-fx-shake { animation: em2-shake 0.4s ease; }

@keyframes em2-flash {
  0%, 100% { filter: none; }
  50% { filter: brightness(2.4) saturate(2.4) drop-shadow(0 0 10px #ff6b6b); }
}
.em2-fx-flash { animation: em2-flash 0.35s ease; }

@keyframes em2-wobble {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-18deg); }
  75% { transform: rotate(18deg); }
}
.em2-fx-wobble { animation: em2-wobble 0.3s ease; display: inline-block; }

@keyframes em2-sparkle {
  0% { filter: none; transform: scale(1); }
  50% { filter: brightness(2) drop-shadow(0 0 14px #ffd600); transform: scale(1.25); }
  100% { filter: none; transform: scale(1); }
}
.em2-fx-sparkle { animation: em2-sparkle 0.5s ease; }

@media (hover: none) and (pointer: coarse) {
  .em2-touch-controls { display: flex; }
}
