/**
 * LexiBlade - Design Dark Fantasy & Interface Jeu Vidéo Épique
 * Inspiré par Diablo IV, Elden Ring, Slay the Spire et Darkest Dungeon
 * 100% Responsive, 0% Scrollbar (Fit 100vh)
 */

:root {
  --gold-primary: #d4af37;
  --gold-glow: rgba(212, 175, 55, 0.45);
  --crimson-dark: #881337;
  --crimson-fire: #e11d48;
  --obsidian-bg: #07090e;
  --panel-bg: rgba(12, 16, 26, 0.92);
  --parchment-bg: #1c1917;
  --border-gold: 2px solid #854d0e;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body, html {
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  overflow: hidden !important;
  background-color: var(--obsidian-bg);
  font-family: 'Montserrat', sans-serif;
  color: #f1f5f9;
}

body.dyslexia-mode {
  font-family: 'Comic Sans MS', 'Verdana', sans-serif !important;
  letter-spacing: 0.14em;
}

#app-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

#ui-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
}

.game-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  overflow: hidden;
  padding: 20px;
}

.hidden {
  display: none !important;
}

/* --- TYPOGRAPHIE GOTHIQUE & RUNES --- */
.dark-heading {
  font-family: 'Cinzel Decorative', 'Cinzel', serif;
  font-size: clamp(1.6rem, 2.8vw, 2.4rem);
  font-weight: 900;
  letter-spacing: 3px;
  color: #f8fafc;
  text-shadow: 0 0 20px var(--gold-glow), 0 2px 4px rgba(0, 0, 0, 0.9);
  text-transform: uppercase;
  text-align: center;
}

.gothic-crest {
  font-size: 1.8rem;
  letter-spacing: 8px;
  color: var(--gold-primary);
  filter: drop-shadow(0 0 10px rgba(212, 175, 55, 0.7));
}

.runic-separator {
  color: var(--gold-primary);
  font-size: 1.1rem;
  letter-spacing: 6px;
  opacity: 0.75;
}

/* --- BOUTONS DARK FANTASY EMBOSSÉS --- */
.btn-gothic {
  background: linear-gradient(180deg, #1f293d 0%, #0f172a 100%);
  border: 1px solid #92400e;
  outline: 1px solid rgba(212, 175, 55, 0.2);
  color: #f8fafc;
  padding: 12px 24px;
  font-family: 'Cinzel', serif;
  font-size: clamp(0.9rem, 1.2vw, 1.15rem);
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.8), 0 4px 15px rgba(0, 0, 0, 0.6);
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-gothic:hover {
  transform: translateY(-2px);
  border-color: var(--gold-primary);
  box-shadow: inset 0 0 15px rgba(212, 175, 55, 0.2), 0 6px 25px rgba(212, 175, 55, 0.4);
  color: #ffffff;
}

.btn-gothic:active {
  transform: translateY(1px);
}

.btn-gothic-primary {
  background: linear-gradient(180deg, #991b1b 0%, #450a0a 100%);
  border-color: #f59e0b;
  box-shadow: inset 0 0 15px rgba(239, 68, 68, 0.3), 0 6px 25px rgba(185, 28, 28, 0.6);
}

.btn-gothic-primary:hover {
  border-color: #fef08a;
  box-shadow: inset 0 0 20px rgba(239, 68, 68, 0.5), 0 8px 35px rgba(239, 68, 68, 0.8);
}

/* --- 1. ÉCRAN TITRE --- */
.dark-title-box {
  background: radial-gradient(circle, rgba(17, 24, 39, 0.95) 0%, rgba(8, 12, 20, 0.98) 80%);
  border: 2px solid #854d0e;
  border-radius: 12px;
  padding: 40px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.9), 0 0 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(180, 83, 9, 0.3);
  backdrop-filter: blur(12px);
  max-width: 580px;
  width: 90%;
}

.dark-logo-title {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(2.8rem, 5vw, 4.2rem);
  font-weight: 900;
  letter-spacing: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #fef08a 40%, #d97706 80%, #78350f 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 25px rgba(217, 119, 6, 0.7));
}

.dark-subtitle {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  letter-spacing: 3px;
  color: #cbd5e1;
  text-align: center;
  text-transform: uppercase;
}

.dark-menu-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  margin-top: 10px;
}

/* --- 2. SÉLECTION ÉPIQUE DU HÉROS (THEATER SANS SCROLL) --- */
.epic-hero-theater {
  display: flex;
  flex-direction: column;
  width: 96vw;
  max-width: 1300px;
  height: 94vh;
  background: radial-gradient(circle at 50% 50%, rgba(15, 23, 42, 0.95) 0%, rgba(7, 10, 18, 0.98) 100%);
  border: 2px solid #854d0e;
  border-radius: 12px;
  padding: 20px 30px;
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.9), 0 0 40px rgba(0, 0, 0, 0.9);
  overflow: hidden;
  justify-content: space-between;
}

.theater-header {
  text-align: center;
}

.theater-subtitle {
  color: #94a3b8;
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  letter-spacing: 2px;
  margin-top: 4px;
}

.theater-body {
  display: flex;
  gap: 30px;
  flex: 1;
  min-height: 0;
  margin: 15px 0;
  align-items: center;
}

/* Roster des Héros (Gauche) */
.hero-roster-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 320px;
  max-height: 100%;
  overflow-y: auto;
  padding-right: 8px;
}

.hero-roster-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.hero-roster-item:hover {
  background: rgba(51, 65, 85, 0.8);
  border-color: var(--gold-primary);
  transform: translateX(4px);
}

.hero-roster-item.active {
  background: linear-gradient(90deg, rgba(185, 28, 28, 0.6) 0%, rgba(30, 41, 59, 0.9) 100%);
  border: 2px solid var(--gold-primary);
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
}

.roster-thumb {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid #38bdf8;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.5);
}

.roster-info {
  display: flex;
  flex-direction: column;
}

.roster-name {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  font-weight: 900;
}

.roster-role {
  font-size: 0.75rem;
  color: #94a3b8;
}

/* Showcase Monumental (Droite) */
.hero-showcase-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 25px;
  height: 100%;
}

.showcase-visual-wrapper {
  position: relative;
  width: 280px;
  height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.showcase-aura-bg {
  position: absolute;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.4) 0%, rgba(0, 0, 0, 0) 70%);
  filter: blur(15px);
  animation: auraPulse 2.5s infinite alternate;
}

@keyframes auraPulse {
  0% { transform: scale(0.9); opacity: 0.6; }
  100% { transform: scale(1.1); opacity: 1.0; }
}

.showcase-portrait {
  position: relative;
  z-index: 2;
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  filter: drop-shadow(0 0 20px rgba(0, 0, 0, 0.9));
}

.showcase-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.showcase-badge {
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  color: var(--gold-primary);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.showcase-name {
  font-family: 'Cinzel Decorative', serif;
  font-size: 2rem;
  font-weight: 900;
  color: #f8fafc;
  letter-spacing: 2px;
}

.showcase-desc {
  font-size: 0.9rem;
  color: #cbd5e1;
  line-height: 1.5;
}

.showcase-passive-card {
  background: rgba(30, 41, 59, 0.7);
  border-left: 3px solid var(--gold-primary);
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 0.85rem;
  color: #fef08a;
  display: flex;
  gap: 10px;
  align-items: center;
}

.showcase-stats-bars {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 5px;
}

.stat-bar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  font-family: 'Cinzel', serif;
}

.stat-bar {
  width: 60%;
  height: 8px;
  background: #0f172a;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #d97706, #facc15);
  width: 50%;
}

.theater-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-hero-embark {
  font-size: 1.15rem;
  padding: 16px 36px;
}

/* --- 3. CARTE ROGUELIKE (STYLE SLAY THE SPIRE / INSCRYPTION) --- */
.spire-map-frame {
  width: 95vw;
  max-width: 1200px;
  height: 92vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle, #26201b 0%, #171310 100%);
  border: 3px solid #854d0e;
  border-radius: 12px;
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.9), 0 0 40px rgba(0, 0, 0, 0.9);
  padding: 18px 24px;
  justify-content: space-between;
  overflow: hidden;
}

.spire-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(212, 175, 55, 0.3);
  padding-bottom: 10px;
}

.spire-map-title {
  font-family: 'Cinzel Decorative', serif;
  font-size: 1.6rem;
  color: var(--gold-primary);
  letter-spacing: 3px;
}

.spire-run-hud {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  display: flex;
  gap: 20px;
}

.spire-legend {
  display: flex;
  gap: 12px;
  font-size: 0.8rem;
  color: #a8a29e;
  font-family: 'Cinzel', serif;
}

/* Zone Parchemin avec SVG connecté */
.spire-parchment-area {
  position: relative;
  flex: 1;
  margin: 15px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spire-svg-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.spire-nodes-grid {
  position: relative;
  z-index: 3;
  display: flex;
  width: 100%;
  height: 100%;
  justify-content: space-around;
  align-items: center;
}

.spire-act-column {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  height: 80%;
}

.spire-node-btn {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: radial-gradient(circle, #292524 0%, #1c1917 100%);
  border: 2px solid #78716c;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  cursor: pointer;
  position: relative;
  transition: all 0.25s;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8), 0 4px 10px rgba(0, 0, 0, 0.6);
}

.spire-node-btn .node-name-label {
  position: absolute;
  bottom: -20px;
  font-size: 0.65rem;
  font-family: 'Cinzel', serif;
  color: #d6d3d1;
  white-space: nowrap;
  letter-spacing: 1px;
}

.spire-node-btn.available {
  border-color: var(--gold-primary);
  box-shadow: 0 0 25px rgba(212, 175, 55, 0.6), inset 0 0 12px rgba(212, 175, 55, 0.3);
  animation: nodeCandlePulse 2s infinite alternate;
}

@keyframes nodeCandlePulse {
  0% { transform: scale(1.0); box-shadow: 0 0 15px rgba(212, 175, 55, 0.4); }
  100% { transform: scale(1.1); box-shadow: 0 0 30px rgba(212, 175, 55, 0.8); }
}

.spire-node-btn.visited {
  opacity: 0.4;
  border-color: #57534e;
  cursor: not-allowed;
}

.spire-node-btn.locked {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Token joueur (Sceau de Sang) */
.spire-player-token {
  position: absolute;
  top: -10px;
  right: -10px;
  font-size: 1.2rem;
  filter: drop-shadow(0 0 8px #ef4444);
  animation: tokenBob 1.5s infinite alternate;
}

@keyframes tokenBob {
  0% { transform: translateY(0); }
  100% { transform: translateY(-4px); }
}

/* --- BOÎTES DE DIALOGUE & ÉVÉNEMENTS --- */
.dark-dialog-box {
  background: radial-gradient(circle, rgba(23, 23, 23, 0.96) 0%, rgba(10, 10, 10, 0.98) 100%);
  border: 2px solid #854d0e;
  border-radius: 12px;
  padding: 35px;
  max-width: 650px;
  width: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  box-shadow: inset 0 0 35px rgba(0, 0, 0, 0.9), 0 0 40px rgba(0, 0, 0, 0.8);
}

.dark-dialog-text {
  font-family: 'Cinzel', serif;
  font-size: 1.05rem;
  color: #e7e5e4;
  line-height: 1.6;
  text-align: center;
}

.dark-choices-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

/* --- MODAL PARAMÈTRES (FONCTIONNEL ET FERMABLE) --- */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(8px);
  pointer-events: auto !important; /* CRUCIAL pour capturer les clics */
}

.modal-content.dark-modal {
  position: relative;
  background: radial-gradient(circle, #18181b 0%, #09090b 100%);
  border: 2px solid var(--gold-primary);
  border-radius: 12px;
  padding: 35px 40px;
  width: 90%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.9), 0 0 30px rgba(212, 175, 55, 0.3);
  pointer-events: auto !important;
}

.modal-close-x {
  position: absolute;
  top: 15px;
  right: 15px;
  background: transparent;
  border: 1px solid #71717a;
  color: #f43f5e;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 900;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-close-x:hover {
  background: #e11d48;
  color: #fff;
  border-color: #f43f5e;
  transform: scale(1.1);
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  color: #e4e4e7;
}

.gothic-select, .gothic-checkbox {
  background: #27272a;
  border: 1px solid #71717a;
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-family: 'Montserrat', sans-serif;
}
