/* ============================================
   POWER OF DARKNESS - styles.css
   AAA Photorealistic Fantasy RPG UI
   ============================================ */

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

/* ---- CSS VARIABLES ---- */
:root {
  --gold: #f5c842;
  --gold-dark: #c8960a;
  --gold-glow: #ffe066;
  --deep-black: #070509;
  --dark-purple: #12091a;
  --dark-bg: #0d0a14;
  --panel-bg: rgba(10,6,18,0.96);
  --panel-border: #3a2060;
  --text-light: #e8d9b0;
  --text-dim: #8a7a5a;
  --red: #c0392b;
  --red-bright: #e74c3c;
  --blue: #2980b9;
  --blue-bright: #3498db;
  --green: #27ae60;
  --green-bright: #2ecc71;
  --purple: #8e44ad;
  --purple-bright: #9b59b6;
  --fire: #e05a10;
  --ice: #5dd0f0;
  --lightning: #f0e030;
  --earth: #8b6040;
  --wind: #90e0a0;
  --dark-magic: #7000a0;
  --holy: #ffffc0;
  --water: #20a0d0;
  --hp-color: #e74c3c;
  --mp-color: #3498db;
  --xp-color: #f5c842;
  --font-title: 'Cinzel Decorative', 'Cinzel', serif;
  --font-body: 'Cinzel', serif;
  --shadow-glow: 0 0 30px rgba(200,150,10,0.5);
  --shadow-dark: 0 4px 32px rgba(0,0,0,0.9);
}

/* ---- RESET & BASE ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  background: var(--deep-black);
  font-family: var(--font-body);
  color: var(--text-light);
  overflow: hidden;
  user-select: none;
}

/* ---- SCREENS ---- */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 10;
}
.screen.active { display: flex; }

/* ============================================
   MAIN MENU
   ============================================ */
#mainMenu {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(100,30,150,0.45) 0%, transparent 70%),
    radial-gradient(ellipse at 20% 80%, rgba(200,80,10,0.2) 0%, transparent 50%),
    linear-gradient(180deg, #050308 0%, #0d0616 40%, #18091f 100%);
  overflow: hidden;
}

.menu-bg-overlay {
  position: absolute;
  inset: 0;
  background:
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.015'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
  animation: bgPulse 8s ease-in-out infinite alternate;
}

@keyframes bgPulse {
  from { opacity: 0.4; }
  to { opacity: 1; }
}

.menu-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  width: 100%;
  max-width: 540px;
  padding: 20px;
}

.game-title {
  text-align: center;
  line-height: 1;
  animation: titleFloat 4s ease-in-out infinite alternate;
}

@keyframes titleFloat {
  from { transform: translateY(-4px); filter: drop-shadow(0 0 20px rgba(245,200,66,0.4)); }
  to   { transform: translateY(4px);  filter: drop-shadow(0 0 40px rgba(245,200,66,0.8)); }
}

.title-glow {
  font-family: var(--font-title);
  font-size: clamp(48px, 9vw, 90px);
  font-weight: 900;
  color: var(--gold);
  text-shadow:
    0 0 10px var(--gold-glow),
    0 0 30px var(--gold),
    0 0 60px rgba(245,200,66,0.5),
    2px 2px 0 #000,
    4px 4px 0 rgba(0,0,0,0.5);
  letter-spacing: 0.08em;
}

.title-dark {
  color: #c060ff;
  text-shadow:
    0 0 10px #c060ff,
    0 0 30px #8000c0,
    0 0 60px rgba(192,96,255,0.4),
    2px 2px 0 #000;
}

.title-sub {
  font-family: var(--font-title);
  font-size: clamp(20px, 4vw, 36px);
  color: var(--text-dim);
  letter-spacing: 0.6em;
  text-transform: uppercase;
  margin: 2px 0;
}

.title-tagline {
  font-size: 14px;
  color: var(--text-dim);
  letter-spacing: 0.4em;
  text-transform: uppercase;
  margin-top: 10px;
}

/* Menu Buttons */
.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 360px;
}

.menu-btn {
  width: 100%;
  padding: 16px 28px;
  background: linear-gradient(135deg, rgba(40,20,60,0.9), rgba(20,10,35,0.95));
  border: 1px solid var(--panel-border);
  border-top-color: rgba(120,60,200,0.6);
  color: var(--text-light);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.05);
}

.menu-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(120,60,200,0), rgba(120,60,200,0.1));
  opacity: 0;
  transition: opacity 0.25s;
}

.menu-btn:hover::before { opacity: 1; }
.menu-btn:hover {
  border-color: var(--gold-dark);
  color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.8), 0 0 20px rgba(200,150,10,0.2);
}
.menu-btn:active { transform: translateY(0); }

.primary-btn {
  background: linear-gradient(135deg, rgba(120,60,10,0.9), rgba(80,35,5,0.95));
  border-color: var(--gold-dark);
  color: var(--gold);
}
.primary-btn:hover {
  background: linear-gradient(135deg, rgba(160,90,20,0.95), rgba(100,50,10,0.95));
  box-shadow: 0 0 30px rgba(245,200,66,0.4), 0 8px 30px rgba(0,0,0,0.8);
}

.danger-btn {
  background: linear-gradient(135deg, rgba(100,20,20,0.9), rgba(60,10,10,0.95));
  border-color: #5a1010;
}
.danger-btn:hover { border-color: var(--red-bright); color: var(--red-bright); }

.btn-icon { font-size: 18px; }

.menu-footer {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

/* ============================================
   OVERLAY SCREENS (How To Play, Credits)
   ============================================ */
.overlay-screen {
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(5,3,10,0.92);
  z-index: 200;
}

.overlay-panel {
  background: linear-gradient(160deg, #0e0918 0%, #14091f 100%);
  border: 1px solid var(--panel-border);
  border-top: 2px solid var(--gold-dark);
  border-radius: 8px;
  padding: 40px;
  max-width: 680px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 0 60px rgba(100,30,180,0.3), var(--shadow-dark);
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center;
}

.overlay-title {
  font-family: var(--font-title);
  font-size: 28px;
  color: var(--gold);
  text-shadow: 0 0 20px rgba(245,200,66,0.5);
  letter-spacing: 0.15em;
  text-align: center;
}

/* How To Play */
.how-to-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
}

@media (max-width: 600px) { .how-to-content { grid-template-columns: 1fr; } }

.htp-section {
  background: rgba(30,15,50,0.6);
  border: 1px solid rgba(80,40,120,0.4);
  border-radius: 6px;
  padding: 16px;
}

.htp-section h3 {
  font-size: 13px;
  color: var(--gold);
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.htp-section p {
  font-family: 'Cinzel', serif;
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-light);
  opacity: 0.85;
}

/* Credits */
.credits-panel { gap: 16px; }

.credits-game-title {
  font-family: var(--font-title);
  font-size: 32px;
  color: var(--gold);
  text-shadow: 0 0 20px var(--gold);
  letter-spacing: 0.2em;
  text-align: center;
}

.credits-divider {
  width: 80%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dark), transparent);
  margin: 8px auto;
}

.credits-block { text-align: center; }

.credits-label {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.credits-name {
  font-family: var(--font-title);
  font-size: 24px;
  color: var(--gold-glow);
  text-shadow: 0 0 15px var(--gold);
}

.credits-value {
  font-size: 14px;
  color: var(--text-light);
}

.credits-quote {
  font-style: italic;
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
  max-width: 400px;
}

.credits-year {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.3em;
}

/* ============================================
   GAME SCREEN
   ============================================ */
#gameScreen {
  display: none;
  flex-direction: column;
  background: var(--deep-black);
}

/* ---- TOP HUD ---- */
.top-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: linear-gradient(180deg, rgba(5,3,12,0.98) 0%, rgba(10,6,20,0.95) 100%);
  border-bottom: 1px solid rgba(80,40,120,0.5);
  box-shadow: 0 4px 20px rgba(0,0,0,0.7);
  min-height: 74px;
  z-index: 50;
  flex-shrink: 0;
}

.hud-player-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.hud-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.hud-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 2px solid var(--gold-dark);
  object-fit: cover;
  box-shadow: 0 0 12px rgba(200,150,10,0.5);
}

.hud-level-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  background: linear-gradient(135deg, #2a1060, #1a0840);
  border: 1px solid var(--gold-dark);
  border-radius: 10px;
  padding: 1px 5px;
  font-size: 9px;
  color: var(--gold);
  font-weight: 700;
  white-space: nowrap;
}

.hud-stats { flex: 1; min-width: 0; }

.hud-name {
  font-size: 12px;
  color: var(--gold);
  letter-spacing: 0.1em;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.hud-bar-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}

.hud-bar-label {
  font-size: 9px;
  color: var(--text-dim);
  width: 18px;
  text-align: right;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.hud-bar {
  flex: 1;
  height: 7px;
  background: rgba(30,20,50,0.8);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(80,40,120,0.3);
  min-width: 60px;
  max-width: 160px;
}

.hud-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
  position: relative;
}

.hud-bar-fill::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 50%;
  background: rgba(255,255,255,0.15);
  border-radius: 4px 4px 0 0;
}

.hp-fill { background: linear-gradient(90deg, #a01020, #e74c3c); }
.mp-fill { background: linear-gradient(90deg, #1040a0, #3498db); }
.xp-fill { background: linear-gradient(90deg, #806020, #f5c842); }

.hud-bar-val { font-size: 9px; color: var(--text-dim); white-space: nowrap; }

.hud-center-title {
  font-family: var(--font-title);
  font-size: clamp(12px, 2vw, 18px);
  color: var(--gold);
  text-shadow: 0 0 10px rgba(245,200,66,0.4);
  letter-spacing: 0.1em;
  text-align: center;
  flex: 0 1 auto;
  padding: 0 16px;
}

.hud-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.hud-gold {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
}

.hud-btn {
  background: linear-gradient(135deg, rgba(40,20,70,0.9), rgba(20,10,40,0.95));
  border: 1px solid var(--panel-border);
  color: var(--text-light);
  font-family: var(--font-body);
  font-size: 11px;
  padding: 6px 14px;
  cursor: pointer;
  border-radius: 3px;
  letter-spacing: 0.1em;
  transition: all 0.2s;
}
.hud-btn:hover { border-color: var(--gold-dark); color: var(--gold); }

/* ---- QUICK USE POTIONS (Bottom Right) ---- */
.quick-potions {
  position: absolute;
  bottom: 120px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 30;
}

.quick-item-btn {
  position: relative;
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, rgba(30,15,50,0.95), rgba(15,8,30,0.98));
  border: 2px solid rgba(80,40,120,0.6);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.7);
}

.quick-item-btn:hover {
  border-color: var(--gold-dark);
  background: linear-gradient(135deg, rgba(60,30,90,0.98), rgba(30,15,50,1));
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 20px rgba(0,0,0,0.8), 0 0 20px rgba(200,150,10,0.3);
}

.quick-item-btn:active {
  transform: translateY(0) scale(1);
}

.quick-item-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  border-color: rgba(80,40,120,0.3);
}

.quick-item-icon {
  width: 36px;
  height: 36px;
}

.quick-item-count {
  position: absolute;
  bottom: 3px;
  right: 3px;
  background: rgba(5,3,12,0.98);
  border: 1.5px solid var(--gold-dark);
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--gold);
  min-width: 18px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.8);
}

/* ---- SCENE AREA ---- */
.scene-area {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.scene-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.scene-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  transition: opacity 0.8s ease, filter 0.8s ease;
  filter: brightness(0.55) saturate(0.85) contrast(1.1);
}

.scene-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg,
      transparent 0%,
      transparent 40%,
      rgba(5,3,12,0.6) 70%,
      rgba(5,3,12,0.9) 100%
    ),
    linear-gradient(90deg,
      rgba(5,3,12,0.3) 0%,
      transparent 20%,
      transparent 80%,
      rgba(5,3,12,0.3) 100%
    );
  pointer-events: none;
}

.particle-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

/* NPC Display */
.npc-display {
  position: absolute;
  right: 40px;
  bottom: 180px;
  z-index: 5;
  animation: npcFloat 3s ease-in-out infinite alternate;
}

@keyframes npcFloat {
  from { transform: translateY(-4px); }
  to   { transform: translateY(4px); }
}

.npc-frame {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.npc-img {
  width: clamp(100px, 16vw, 200px);
  height: clamp(130px, 22vw, 280px);
  object-fit: cover;
  object-position: center top;
  border-radius: 6px;
  border: 2px solid rgba(120,60,200,0.5);
  box-shadow: 0 0 30px rgba(100,30,180,0.4), 0 20px 40px rgba(0,0,0,0.8);
  filter: brightness(0.9) saturate(1.1);
}

.npc-nameplate {
  background: linear-gradient(135deg, rgba(20,10,40,0.95), rgba(10,5,20,0.95));
  border: 1px solid var(--gold-dark);
  border-radius: 4px;
  padding: 4px 14px;
  font-size: 11px;
  color: var(--gold);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-top: 6px;
  box-shadow: 0 0 10px rgba(200,150,10,0.3);
}

/* Story Panel */
.story-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(5,3,12,0.97) 20%);
  padding: 20px 24px 16px;
  z-index: 6;
  pointer-events: none;
}

.story-text {
  font-size: clamp(12px, 1.8vw, 15px);
  line-height: 1.8;
  color: var(--text-light);
  text-shadow: 0 1px 4px rgba(0,0,0,0.9);
  max-width: 800px;
  min-height: 80px;
}

/* ---- ACTION PANEL ---- */
.action-panel {
  background: linear-gradient(180deg, rgba(8,5,16,0.97) 0%, rgba(5,3,12,0.99) 100%);
  border-top: 1px solid rgba(80,40,120,0.4);
  padding: 12px 16px;
  flex-shrink: 0;
  min-height: 100px;
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  max-width: 900px;
  margin: 0 auto;
}

.action-btn {
  padding: 10px 20px;
  background: linear-gradient(135deg, rgba(30,15,55,0.95), rgba(15,8,30,0.98));
  border: 1px solid rgba(80,40,140,0.6);
  border-top-color: rgba(120,60,200,0.5);
  color: var(--text-light);
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.action-btn svg { flex-shrink: 0; }

.action-btn:hover {
  border-color: var(--gold-dark);
  color: var(--gold);
  background: linear-gradient(135deg, rgba(60,30,90,0.95), rgba(30,15,55,0.98));
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.7), 0 0 15px rgba(200,150,10,0.2);
}

.action-btn:active { transform: translateY(0); }

.action-btn.primary-action {
  border-color: var(--gold-dark);
  color: var(--gold);
  background: linear-gradient(135deg, rgba(80,40,10,0.9), rgba(40,20,5,0.95));
}

.action-btn.danger-action {
  border-color: #5a1010;
  color: #e07060;
}

.action-btn.travel-action {
  border-color: rgba(60,120,200,0.6);
  color: #80c0ff;
}

/* ---- DIALOGUE PANEL ---- */
.dialogue-panel {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(160deg, rgba(8,5,18,0.99), rgba(12,7,24,0.99));
  border-top: 2px solid var(--gold-dark);
  padding: 16px;
  z-index: 20;
  animation: slideUp 0.3s ease;
  min-height: 180px;
}

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.dialogue-inner {
  display: flex;
  gap: 16px;
  max-width: 900px;
  margin: 0 auto;
}

.dialogue-portrait-wrap {
  flex-shrink: 0;
  text-align: center;
}

.dialogue-portrait {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold-dark);
  box-shadow: 0 0 15px rgba(200,150,10,0.4);
}

.dialogue-speaker {
  font-size: 10px;
  color: var(--gold);
  letter-spacing: 0.1em;
  margin-top: 4px;
  text-transform: uppercase;
}

.dialogue-text-wrap { flex: 1; }

.dialogue-text {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-light);
  margin-bottom: 14px;
  min-height: 60px;
}

.dialogue-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice-btn {
  padding: 8px 18px;
  background: linear-gradient(135deg, rgba(30,15,55,0.95), rgba(15,8,30,0.98));
  border: 1px solid rgba(100,60,180,0.5);
  color: var(--text-light);
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.1em;
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.2s;
}

.choice-btn:hover {
  border-color: var(--gold-dark);
  color: var(--gold);
  transform: translateY(-1px);
}

/* ---- IN-GAME MENU ---- */
.ingame-menu {
  position: absolute;
  inset: 0;
  background: rgba(3,2,8,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.ingame-menu-panel {
  background: linear-gradient(160deg, #0e0918, #14091f);
  border: 1px solid var(--panel-border);
  border-top: 2px solid var(--gold-dark);
  border-radius: 8px;
  padding: 32px;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 0 60px rgba(100,30,180,0.3), var(--shadow-dark);
}

.ingame-menu-title {
  font-family: var(--font-title);
  font-size: 20px;
  color: var(--gold);
  text-align: center;
  letter-spacing: 0.2em;
  margin-bottom: 8px;
}

/* ---- SIDE PANELS ---- */
.side-panel {
  position: absolute;
  inset: 0;
  background: rgba(3,2,8,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.side-panel-inner {
  background: linear-gradient(160deg, #0e0918, #14091f);
  border: 1px solid var(--panel-border);
  border-top: 2px solid var(--gold-dark);
  border-radius: 8px;
  padding: 28px;
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 0 60px rgba(100,30,180,0.3), var(--shadow-dark);
}

.side-panel-title {
  font-family: var(--font-title);
  font-size: 20px;
  color: var(--gold);
  letter-spacing: 0.15em;
  text-align: center;
  border-bottom: 1px solid rgba(120,60,200,0.3);
  padding-bottom: 12px;
}

/* Inventory */
.inventory-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.inv-item {
  background: rgba(20,10,40,0.8);
  border: 1px solid rgba(80,40,120,0.4);
  border-radius: 6px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.inv-item:hover {
  border-color: var(--gold-dark);
  background: rgba(40,20,60,0.9);
}

.inv-item-icon {
  width: 40px;
  height: 40px;
}

.inv-item-name {
  font-size: 11px;
  color: var(--gold);
  letter-spacing: 0.1em;
  text-align: center;
}

.inv-item-desc {
  font-size: 10px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.4;
}

.inv-item-count {
  font-size: 10px;
  color: var(--text-light);
  background: rgba(60,30,100,0.6);
  border: 1px solid rgba(80,40,120,0.4);
  border-radius: 10px;
  padding: 2px 8px;
}

/* Spell List */
.spell-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.spell-card {
  background: rgba(15,8,30,0.9);
  border: 1px solid rgba(80,40,120,0.4);
  border-radius: 6px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.spell-card:hover { border-color: var(--gold-dark); }

.spell-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.spell-icon-wrap {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.spell-card-name {
  font-size: 13px;
  color: var(--gold);
  font-weight: 600;
}

.spell-card-element {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.spell-card-stats {
  display: flex;
  gap: 10px;
  font-size: 10px;
  color: var(--text-dim);
}

.spell-stat-dmg { color: #e07070; }
.spell-stat-mp  { color: #70a0e0; }
.spell-stat-lvl { color: var(--gold); }

.spell-card-desc {
  font-size: 10px;
  color: var(--text-light);
  opacity: 0.75;
  line-height: 1.5;
}

/* Character Stats */
.char-stats-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.char-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(20,10,40,0.6);
  border: 1px solid rgba(80,40,120,0.3);
  border-radius: 4px;
  padding: 10px 14px;
}

.char-stat-label {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.char-stat-value {
  font-size: 14px;
  color: var(--gold);
  font-weight: 700;
}

/* Quest Log */
.quest-list { display: flex; flex-direction: column; gap: 10px; }

.quest-entry {
  background: rgba(20,10,40,0.7);
  border: 1px solid rgba(80,40,120,0.4);
  border-left: 3px solid var(--gold-dark);
  border-radius: 4px;
  padding: 12px 16px;
}

.quest-entry.completed { border-left-color: var(--green); opacity: 0.7; }
.quest-entry.failed    { border-left-color: var(--red); opacity: 0.5; }

.quest-name { font-size: 13px; color: var(--gold); margin-bottom: 4px; }
.quest-desc { font-size: 11px; color: var(--text-light); line-height: 1.5; }
.quest-status { font-size: 10px; color: var(--text-dim); margin-top: 6px; }

/* ============================================
   BATTLE SCREEN
   ============================================ */
.battle-screen {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: none;
  flex-direction: column;
  background: linear-gradient(160deg, #08040f 0%, #0e0618 40%, #150920 100%);
}

.battle-screen.active { display: flex; }

.battle-bg-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(150,30,200,0.1), transparent 70%),
    radial-gradient(ellipse at 20% 80%, rgba(200,60,10,0.08), transparent 50%);
  pointer-events: none;
  animation: battleBgPulse 3s ease-in-out infinite alternate;
}

@keyframes battleBgPulse {
  from { opacity: 0.5; }
  to { opacity: 1; }
}

.battle-arena {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  flex: 1;
  min-height: 0;
  padding: 20px;
  align-items: center;
}

.battle-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.battle-char-frame {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.battle-char-img {
  width: clamp(120px, 18vw, 240px);
  height: clamp(150px, 24vw, 320px);
  object-fit: cover;
  object-position: center top;
  border-radius: 8px;
  box-shadow: 0 0 40px rgba(0,0,0,0.8);
  transition: all 0.3s ease;
}

.enemy-frame .battle-char-img {
  border: 2px solid rgba(200,30,30,0.5);
  box-shadow: 0 0 40px rgba(200,30,30,0.3), 0 20px 40px rgba(0,0,0,0.8);
}

.player-frame .battle-char-img {
  border: 2px solid rgba(30,100,200,0.5);
  box-shadow: 0 0 40px rgba(30,100,200,0.3), 0 20px 40px rgba(0,0,0,0.8);
}

.battle-effect {
  position: absolute;
  inset: -10px;
  border-radius: 12px;
  pointer-events: none;
  transition: all 0.3s;
}

.battle-char-info { text-align: center; }

.battle-char-name {
  font-family: var(--font-title);
  font-size: 16px;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}

.enemy-name { color: #e05050; text-shadow: 0 0 10px rgba(200,50,50,0.5); }
.player-name { color: #5080e0; text-shadow: 0 0 10px rgba(50,80,200,0.5); }

.battle-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.battle-bar-label {
  font-size: 10px;
  color: var(--text-dim);
  width: 20px;
  text-align: right;
}

.battle-bar {
  flex: 1;
  height: 10px;
  background: rgba(20,10,40,0.8);
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid rgba(80,40,120,0.3);
  min-width: 100px;
}

.battle-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.5s ease;
  position: relative;
}
.battle-bar-fill::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 50%;
  background: rgba(255,255,255,0.2);
  border-radius: 5px 5px 0 0;
}

.enemy-hp-fill  { background: linear-gradient(90deg, #800010, #e74c3c); }
.player-hp-fill { background: linear-gradient(90deg, #a01020, #e74c3c); }
.player-mp-fill { background: linear-gradient(90deg, #1040a0, #3498db); }

.battle-bar-val { font-size: 10px; color: var(--text-dim); }

/* Battle Log */
.battle-log-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.battle-log {
  background: rgba(5,3,12,0.9);
  border: 1px solid rgba(80,40,120,0.4);
  border-radius: 6px;
  padding: 16px;
  min-height: 160px;
  max-height: 200px;
  width: 100%;
  overflow-y: auto;
  font-size: 12px;
  line-height: 1.8;
  color: var(--text-light);
}

.battle-log::-webkit-scrollbar { width: 4px; }
.battle-log::-webkit-scrollbar-track { background: transparent; }
.battle-log::-webkit-scrollbar-thumb { background: rgba(100,60,160,0.5); border-radius: 2px; }

.battle-log-entry { margin-bottom: 4px; }
.log-damage  { color: #e05050; }
.log-heal    { color: #50e080; }
.log-spell   { color: var(--gold); }
.log-system  { color: var(--text-dim); font-style: italic; }
.log-crit    { color: #ffb020; font-weight: 700; }
.log-miss    { color: #8070a0; }

.battle-effect-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-size: 48px;
  font-weight: 900;
  opacity: 0;
  z-index: 10;
  text-shadow: 0 0 30px currentColor;
}

/* Battle Actions */
.battle-actions {
  background: linear-gradient(180deg, rgba(5,3,12,0.98), rgba(8,5,18,0.99));
  border-top: 1px solid rgba(80,40,120,0.4);
  padding: 14px 16px;
  flex-shrink: 0;
}

.battle-actions-label {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 10px;
}

.battle-spell-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 10px;
  max-width: 900px;
  margin: 0 auto 10px;
}

.battle-spell-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(20,10,40,0.95), rgba(10,5,20,0.98));
  border: 1px solid rgba(80,40,120,0.5);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 80px;
  color: var(--text-light);
  font-family: var(--font-body);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.battle-spell-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: var(--gold-dark);
  box-shadow: 0 6px 20px rgba(0,0,0,0.6);
}

.battle-spell-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.battle-spell-btn svg { width: 28px; height: 28px; }
.bsb-name { font-size: 10px; }
.bsb-mp { font-size: 9px; color: #80a0e0; }

.battle-other-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 10px;
}

.battle-action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  background: rgba(20,10,40,0.9);
  border: 1px solid rgba(80,40,120,0.4);
  color: var(--text-light);
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.1em;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

.flee-btn { border-color: rgba(200,150,10,0.4); color: var(--gold); }
.item-btn { border-color: rgba(50,150,80,0.4); color: #80e0a0; }

.battle-action-btn:hover {
  transform: translateY(-1px);
  border-color: var(--gold-dark);
}

/* ============================================
   SHOP
   ============================================ */
.shop-gold-display {
  text-align: center;
  color: var(--gold);
  font-size: 14px;
  background: rgba(80,40,10,0.3);
  border: 1px solid rgba(200,150,10,0.3);
  border-radius: 4px;
  padding: 8px;
}

.shop-list { display: flex; flex-direction: column; gap: 10px; }

.shop-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(20,10,40,0.7);
  border: 1px solid rgba(80,40,120,0.4);
  border-radius: 6px;
  padding: 12px;
  transition: all 0.2s;
}

.shop-item:hover { border-color: var(--gold-dark); }

.shop-item-icon { width: 36px; height: 36px; flex-shrink: 0; }
.shop-item-info { flex: 1; }
.shop-item-name { font-size: 13px; color: var(--gold); margin-bottom: 3px; }
.shop-item-desc { font-size: 11px; color: var(--text-dim); line-height: 1.4; }

.shop-buy-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: linear-gradient(135deg, rgba(80,40,10,0.9), rgba(40,20,5,0.95));
  border: 1px solid var(--gold-dark);
  color: var(--gold);
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.1em;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.shop-buy-btn:hover { background: linear-gradient(135deg, rgba(120,60,15,0.9), rgba(60,30,8,0.95)); }

/* ============================================
   NOTIFICATIONS / TOASTS
   ============================================ */
.notif-toast {
  position: absolute;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, rgba(20,10,40,0.98), rgba(10,5,20,0.99));
  border: 1px solid var(--gold-dark);
  border-radius: 6px;
  padding: 12px 24px;
  font-size: 13px;
  color: var(--gold);
  z-index: 200;
  box-shadow: 0 0 20px rgba(200,150,10,0.3), var(--shadow-dark);
  letter-spacing: 0.1em;
  animation: toastIn 0.3s ease;
  white-space: nowrap;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ============================================
   LEVEL UP OVERLAY
   ============================================ */
.levelup-overlay {
  position: absolute;
  inset: 0;
  background: rgba(3,2,8,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 150;
  backdrop-filter: blur(6px);
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.levelup-panel {
  background: linear-gradient(160deg, #0e0918, #14091f);
  border: 2px solid var(--gold);
  border-radius: 12px;
  padding: 40px;
  max-width: 440px;
  width: 90%;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
  box-shadow: 0 0 80px rgba(245,200,66,0.3), var(--shadow-dark);
  animation: levelupPop 0.5s cubic-bezier(0.175,0.885,0.32,1.275);
}

@keyframes levelupPop {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.levelup-title {
  font-family: var(--font-title);
  font-size: 40px;
  color: var(--gold);
  text-shadow: 0 0 30px var(--gold), 0 0 60px rgba(245,200,66,0.5);
  letter-spacing: 0.1em;
  animation: levelupPulse 1s ease-in-out infinite alternate;
}

@keyframes levelupPulse {
  from { text-shadow: 0 0 20px var(--gold), 0 0 40px rgba(245,200,66,0.4); }
  to   { text-shadow: 0 0 40px var(--gold), 0 0 80px rgba(245,200,66,0.6); }
}

.levelup-content {
  font-size: 14px;
  color: var(--text-light);
  line-height: 2;
}

/* ============================================
   GAME OVER / VICTORY
   ============================================ */
.gameover-screen, .victory-screen {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(8px);
}

.gameover-screen { background: rgba(20,0,0,0.92); }
.victory-screen { background: rgba(0,10,40,0.92); }

.gameover-panel, .victory-panel {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
  padding: 50px;
}

.gameover-title {
  font-family: var(--font-title);
  font-size: 56px;
  color: var(--red-bright);
  text-shadow: 0 0 40px rgba(200,30,30,0.8);
  letter-spacing: 0.1em;
}

.gameover-subtitle {
  font-family: var(--font-title);
  font-size: 20px;
  color: #ff6060;
  letter-spacing: 0.25em;
  margin-top: -10px;
  margin-bottom: 20px;
  text-shadow: 0 0 20px rgba(255,60,60,0.6);
}

.gameover-text { 
  font-size: 15px; 
  color: var(--text-dim); 
  max-width: 450px; 
  line-height: 1.8; 
  text-align: center;
  margin-bottom: 30px;
}

.victory-title {
  font-family: var(--font-title);
  font-size: 60px;
  color: var(--gold);
  text-shadow: 0 0 40px var(--gold);
  letter-spacing: 0.1em;
}

.victory-subtitle {
  font-family: var(--font-title);
  font-size: 18px;
  color: #80c0ff;
  letter-spacing: 0.3em;
}

.victory-text { font-size: 15px; color: var(--text-light); max-width: 500px; line-height: 1.8; }

/* ============================================
   UTILITY
   ============================================ */
.hidden { display: none !important; }

/* Scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(10,5,20,0.5); }
::-webkit-scrollbar-thumb { background: rgba(100,60,160,0.5); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(140,90,200,0.7); }

/* Damage / Heal floaters */
.float-text {
  position: absolute;
  font-family: var(--font-title);
  font-size: 28px;
  font-weight: 700;
  pointer-events: none;
  z-index: 90;
  animation: floatUp 1.2s ease forwards;
  text-shadow: 0 2px 8px rgba(0,0,0,0.9);
}

@keyframes floatUp {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  40%  { opacity: 1; transform: translateY(-30px) scale(1.2); }
  100% { opacity: 0; transform: translateY(-70px) scale(0.9); }
}

/* Attack shake */
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-8px); }
  40%,80% { transform: translateX(8px); }
}

.shake { animation: shake 0.4s ease; }

/* Spell glow effects */
@keyframes firePulse {
  0%,100% { box-shadow: 0 0 20px rgba(220,80,10,0.6), 0 0 40px rgba(220,80,10,0.3); }
  50%      { box-shadow: 0 0 40px rgba(220,80,10,0.9), 0 0 80px rgba(220,80,10,0.5); }
}
@keyframes icePulse {
  0%,100% { box-shadow: 0 0 20px rgba(100,220,240,0.6); }
  50%      { box-shadow: 0 0 40px rgba(100,220,240,0.9); }
}
@keyframes lightPulse {
  0%,100% { box-shadow: 0 0 20px rgba(240,230,60,0.6); }
  50%      { box-shadow: 0 0 60px rgba(240,230,60,0.9); }
}
@keyframes darkPulse {
  0%,100% { box-shadow: 0 0 20px rgba(120,0,200,0.6); }
  50%      { box-shadow: 0 0 50px rgba(120,0,200,0.9); }
}
@keyframes holyPulse {
  0%,100% { box-shadow: 0 0 20px rgba(255,255,200,0.6); }
  50%      { box-shadow: 0 0 50px rgba(255,255,200,0.9); }
}
