/* ==========================================================================
   CAVERNA DO PCZÃO — RETRO JRPG DE SILÍCIO & HARDWARE (v5.0 MAGNIFICENT)
   Design System 16-bit Cyber-Fantasy, 100% SVG, Amplo Espaço de Texto
   ========================================================================== */

:root {
  --rpg-bg: #030712;
  --rpg-surface: #0b1329;
  --rpg-surface-soft: #111e38;
  --rpg-neon-cyan: #38bdf8;
  --rpg-neon-purple: #a855f7;
  --rpg-neon-gold: #facc15;
  --rpg-neon-green: #10b981;
  --rpg-neon-red: #ef4444;
  --rpg-line: rgba(56, 189, 248, 0.25);
  --rpg-text: #f8fafc;
  --rpg-text-muted: #94a3b8;
}

body.rpg-app-body {
  background-color: var(--rpg-bg);
  background-image: 
    radial-gradient(circle at 50% 10%, rgba(168, 85, 247, 0.18) 0%, transparent 60%),
    radial-gradient(circle at 80% 80%, rgba(56, 189, 248, 0.1) 0%, transparent 40%),
    linear-gradient(to bottom, #030712, #070e1e);
  color: var(--rpg-text);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

/* ==========================================================================
   ARENA DE BATALHA JRPG RETRÔ (CENÁRIO 16-BIT 2.5D)
   ========================================================================== */
.jrpg-battle-theater {
  background: #020617;
  border: 3px solid var(--rpg-neon-cyan);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 0 35px rgba(56, 189, 248, 0.25), inset 0 0 50px rgba(0, 0, 0, 0.9);
  margin-bottom: 1.25rem;
  position: relative;
}

/* Piso Cibernético em Perspectiva */
.jrpg-battle-stage {
  height: 290px;
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 2rem 3.5rem 2.5rem 3.5rem;
  background: 
    linear-gradient(to bottom, rgba(2, 6, 23, 0.7), rgba(15, 23, 42, 0.95)),
    repeating-linear-gradient(0deg, transparent, transparent 20px, rgba(56, 189, 248, 0.08) 20px, rgba(56, 189, 248, 0.08) 21px),
    repeating-linear-gradient(90deg, transparent, transparent 20px, rgba(168, 85, 247, 0.08) 20px, rgba(168, 85, 247, 0.08) 21px);
  background-size: 100% 100%, 40px 40px, 40px 40px;
}

/* Pedestais dos Personagens */
.jrpg-pedestal {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 10;
}

.pedestal-base {
  width: 120px;
  height: 26px;
  background: radial-gradient(ellipse at center, rgba(56, 189, 248, 0.6) 0%, rgba(56, 189, 248, 0) 75%);
  border-radius: 50%;
  margin-top: -12px;
  filter: blur(1px);
}

.pedestal-base.enemy {
  background: radial-gradient(ellipse at center, rgba(239, 68, 68, 0.7) 0%, rgba(239, 68, 68, 0) 75%);
  width: 150px;
}

/* Sprites com Animações Magníficas */
.jrpg-hero-sprite-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  transition: transform 0.25s ease;
  animation: heroIdle 2.2s infinite ease-in-out;
}

.jrpg-hero-sprite {
  width: 84px;
  height: 84px;
  filter: drop-shadow(0 6px 12px rgba(56, 189, 248, 0.5));
}

@keyframes heroIdle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.jrpg-enemy-sprite-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  animation: enemyFloat 3s infinite ease-in-out;
}

.jrpg-enemy-sprite {
  width: 100px;
  height: 100px;
  filter: drop-shadow(0 0 18px rgba(239, 68, 68, 0.6));
  transition: all 0.2s ease;
}

@keyframes enemyFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(1.03); }
}

/* Mini HUD Flutuante */
.sprite-overhead-hud {
  background: rgba(3, 7, 18, 0.9);
  border: 1.5px solid var(--rpg-line);
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7);
  min-width: 130px;
}

.sprite-name-tag {
  font-size: 0.8rem;
  font-weight: 800;
  color: #ffffff;
  white-space: nowrap;
}

.sprite-hp-bar {
  height: 6px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 3px;
}

.sprite-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #34d399);
  width: 100%;
  transition: width 0.3s ease;
}

.sprite-hp-fill.enemy {
  background: linear-gradient(90deg, #ef4444, #f87171);
}

/* Animações de Ataque e Dano */
.hero-dash-attack {
  animation: dashRight 0.45s ease-in-out forwards;
}

@keyframes dashRight {
  0% { transform: translateX(0); }
  45% { transform: translateX(280px) scale(1.15); }
  100% { transform: translateX(0); }
}

.enemy-lunge-attack {
  animation: lungeLeft 0.45s ease-in-out forwards;
}

@keyframes lungeLeft {
  0% { transform: translateX(0); }
  45% { transform: translateX(-280px) scale(1.15); }
  100% { transform: translateX(0); }
}

.enemy-damage-flash {
  animation: flashRed 0.35s ease-in-out;
}

@keyframes flashRed {
  0%, 100% { filter: drop-shadow(0 0 15px rgba(239, 68, 68, 0.6)); }
  50% { filter: brightness(2.5) drop-shadow(0 0 30px #ffffff); transform: scale(0.92); }
}

.slash-effect {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 130px;
  height: 130px;
  pointer-events: none;
  z-index: 99;
  animation: slashBurst 0.3s ease-out forwards;
}

@keyframes slashBurst {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3) rotate(-30deg); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.2) rotate(15deg); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.5) rotate(45deg); }
}

/* Floating Numbers */
.floating-dmg-number {
  position: absolute;
  font-family: 'Courier New', Courier, monospace;
  font-weight: 900;
  font-size: 1.6rem;
  pointer-events: none;
  z-index: 999;
  text-shadow: 0 0 12px rgba(0, 0, 0, 0.9), 0 2px 4px #000;
  animation: floatDmgUp 1.2s forwards cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.floating-dmg-number.damage { color: #f87171; }
.floating-dmg-number.crit { color: #facc15; font-size: 2.1rem; text-shadow: 0 0 20px #facc15, 0 2px 6px #000; }
.floating-dmg-number.heal { color: #34d399; }
.floating-dmg-number.mana { color: #38bdf8; }

@keyframes floatDmgUp {
  0% { opacity: 0; transform: translateY(10px) scale(0.6); }
  25% { opacity: 1; transform: translateY(-15px) scale(1.15); }
  75% { opacity: 1; transform: translateY(-40px) scale(1); }
  100% { opacity: 0; transform: translateY(-65px) scale(0.9); }
}

/* ==========================================================================
   PAINEL DE COMANDOS JRPG — ESPAÇO AMPLIADO PARA O DIÁRIO DE COMBATE
   ========================================================================== */
.jrpg-command-window {
  background: linear-gradient(180deg, #0f172a 0%, #020617 100%);
  border-top: 2px solid var(--rpg-line);
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  min-height: 165px;
}

@media (max-width: 840px) {
  .jrpg-command-window {
    grid-template-columns: 1fr;
  }
}

/* Diário de Combate Retrô com Amplo Espaço de Texto */
.jrpg-narrative-panel {
  padding: 1.25rem 1.75rem;
  border-right: 1.5px solid var(--rpg-line);
  font-size: 0.95rem;
  line-height: 1.65;
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
}

/* Botões do Menu de Batalha com Ícones SVG */
.jrpg-action-menu {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  padding: 0.95rem;
  background: rgba(0, 0, 0, 0.4);
}

.btn-jrpg-cmd {
  background: #0b1329;
  border: 1.5px solid rgba(56, 189, 248, 0.35);
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 800;
  padding: 0.7rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.15s ease;
  font-family: inherit;
}

.btn-jrpg-cmd:hover:not(:disabled) {
  background: rgba(56, 189, 248, 0.25);
  border-color: var(--rpg-neon-cyan);
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
  transform: translateX(3px);
}

.btn-jrpg-cmd:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Submenu de Magias / Habilidades */
.jrpg-spells-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(3, 7, 18, 0.96);
  border-top: 2px solid var(--rpg-neon-purple);
  padding: 1.15rem 1.5rem;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  z-index: 99;
  backdrop-filter: blur(10px);
}

.spell-option-row {
  background: #0f172a;
  border: 1px solid var(--rpg-line);
  padding: 0.65rem 1rem;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #ffffff;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.15s ease;
}

.spell-option-row:hover:not(.disabled) {
  background: rgba(168, 85, 247, 0.25);
  border-color: var(--rpg-neon-purple);
}

.spell-option-row.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Trilha & Relíquias */
.motherboard-track-container {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--rpg-line);
  border-radius: 12px;
  padding: 0.9rem 1.15rem;
  margin-bottom: 1.25rem;
}

.track-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.motherboard-track {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
}

@media (max-width: 768px) {
  .motherboard-track {
    grid-template-columns: repeat(2, 1fr);
  }
}

.track-step {
  background: #0b1329;
  border: 1.5px solid var(--rpg-line);
  border-radius: 8px;
  padding: 0.6rem 0.4rem;
  text-align: center;
  font-size: 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.track-step.done {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
}

.track-step.current {
  border-color: #facc15;
  background: rgba(250, 204, 21, 0.15);
  box-shadow: 0 0 15px rgba(250, 204, 21, 0.3);
  font-weight: 800;
  color: #ffffff;
}

.track-step.locked { opacity: 0.5; }

.relics-tray-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--rpg-line);
  border-radius: 10px;
  padding: 0.65rem 1rem;
}

.relics-tray {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  flex: 1;
}

.relic-badge {
  background: #0f172a;
  border: 1px solid var(--rpg-line);
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  font-size: 0.78rem;
  color: var(--rpg-text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  opacity: 0.5;
}

.relic-badge.collected {
  opacity: 1;
  border-color: #facc15;
  color: #facc15;
  background: rgba(250, 204, 21, 0.15);
  font-weight: 700;
}