@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Inter:wght@400;600&display=swap');

*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --emerald: #10b981;
  --sapphire: #3b82f6;
  --gold: #f59e0b;
  --crimson: #ef4444;
  --bg: #06100a;
  --bg2: #0e1e14;
  --card: rgba(16,185,129,0.06);
  --border: rgba(16,185,129,0.2);
  --text: #e0fff0;
  --muted: #3a7a56;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 14px 10px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(16,185,129,0.08) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 70%, rgba(59,130,246,0.06) 0%, transparent 55%);
  pointer-events: none;
}

#game-container {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  max-width: 1100px;
  gap: 12px;
  justify-content: center;
  position: relative;
  z-index: 1;
}

#player-stats, #inventory, #spellbook, #status-area, #dungeon-info {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 14px;
  border-radius: 12px;
  min-width: 180px;
  flex: 1;
  box-shadow: 0 0 20px rgba(16,185,129,0.06);
  backdrop-filter: blur(8px);
}

#player-stats h3, #inventory h3, #spellbook h3, #status-area h3, #dungeon-info h3 {
  font-family: 'Orbitron', monospace;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--emerald);
  text-shadow: 0 0 10px rgba(16,185,129,0.5);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}

#game-grid {
  display: grid;
  grid-template-columns: repeat(7, clamp(36px, 6vw, 50px));
  grid-template-rows: repeat(7, clamp(36px, 6vw, 50px));
  gap: 4px;
  padding: 14px;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 0 30px rgba(16,185,129,0.08);
  width: fit-content;
}

.grid-tile {
  width: clamp(36px, 6vw, 50px);
  height: clamp(36px, 6vw, 50px);
  border: 1px solid rgba(16,185,129,0.12);
  border-radius: 6px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: clamp(0.8rem, 2.5vw, 1.4rem);
  background: rgba(0,0,0,0.3);
  transition: all 0.15s;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.grid-tile:hover {
  background: rgba(16,185,129,0.15);
  border-color: rgba(16,185,129,0.35);
}

button {
  padding: 9px 16px;
  font-size: 0.75rem;
  font-family: 'Orbitron', monospace;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(16,185,129,0.1);
  color: var(--emerald);
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

button:hover {
  background: rgba(16,185,129,0.22);
  box-shadow: 0 0 12px rgba(16,185,129,0.3);
  transform: translateY(-1px);
}

/* ── Battle Interface ── */
#battle-interface {
  width: 100%;
  background: rgba(239,68,68,0.06);
  border: 1px solid rgba(239,68,68,0.25);
  padding: 14px;
  border-radius: 12px;
  margin-top: 4px;
}

#enemy-info, #player-info {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  gap: 10px;
  font-family: 'Orbitron', monospace;
  font-size: 0.75rem;
}

#enemy-health-bar, #player-health-bar {
  flex: 1;
  background: rgba(255,255,255,0.1);
  position: relative;
  height: 16px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  overflow: hidden;
}

#enemy-health-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--crimson), #ff6b6b);
  width: 100%;
  border-radius: 8px;
  transition: width 0.4s ease;
}

#player-health-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--emerald), #34d399);
  width: 100%;
  border-radius: 8px;
  transition: width 0.4s ease;
}

#battle-options {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#battle-options button { margin-top: 0; }

#battle-log {
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--border);
  padding: 10px;
  background: rgba(0,0,0,0.4);
  color: var(--text);
  margin-top: 10px;
  font-size: 0.8rem;
  line-height: 1.5;
  border-radius: 8px;
  scrollbar-width: thin;
}

.spell-icon { width: 28px; height: 28px; vertical-align: middle; }

@keyframes cast-spell {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}
.cast-animation { animation: cast-spell 0.5s forwards; }

/* ── Mobile ── */
@media (max-width: 768px) {
  #game-container { flex-direction: column; }
  #player-stats, #inventory, #spellbook, #status-area, #dungeon-info { min-width: auto; }
  #game-grid { margin: 0 auto; }
}

