/* ================= BASE ================= */
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(180deg, #0c0c0f, #121218);
  color: #e8e8ea;
}

#game {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ================= TOP BAR ================= */
#top-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(20, 20, 25, 0.9);
  border-bottom: 1px solid #2a2a35;
}

/* TOP ROW */
#top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#player-stats {
  text-align: right;
}

/* BARS */
#bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* MANA BAR -blue  */
#mana-fill {
  height: 100%;
  background: rgb(63, 192, 187);
  width: 100%;
}

/* tighter bars */
#health-bar {
  height: 12px !important;
  border-radius: 999px;
}

#health-fill {
  height: 100% !important;
  border-radius: 999px;
}
#xp-bar {
  height: 6px; 
  background: #1e1e26;
  border-radius: 999px;
  overflow: hidden;
}

#health-fill {
  height: 100%;
  background: linear-gradient(90deg, #4ade80, #22c55e);
  transition: width 0.3s ease;
}

#xp-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #fbbf24); 
  transition: width 0.7s ease;
}

/* ================= MAIN ================= */
#main {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

#text {
  font-size: 16px;
  margin-bottom: 16px;;
  transition: opacity 0.15s ease;
}

.combat-text {
  font-size: 14px;
  color: #cbd5e1;
  margin-bottom: 12px;
  text-align: center;
}

.combat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 4px;
}

.combat-grid button {
  white-space: pre-line;
  width: 100%;
  max-width: 100%;
}

/* ================= ENEMY ================= */
#enemy-container {
  margin-bottom: 16px;
  padding: 10px;
  background: rgba(30,30,40,0.6);
  border-radius: 10px;
  border: 1px solid #2a2a35;
}

#enemy-bar {
  height: 8px;
  background: #1e1e26;
  border-radius: 999px;
  overflow: hidden;
}

#enemy-fill {
  height: 100%;
  background: #ef4444;
}

/* ================= GRID ================= */
.section {
  display: grid;
  grid-template-columns: repeat(2, 2fr); 
  gap: 10px;
  margin-top: 12px;
}

/* ================= CARDS ================= */
.upgrade-card,
.zone-card {
  background: #1a1a22;
  border: 1px solid #2a2a38;
  border-radius: 10px;
  padding: 8px;

  display: flex;
  flex-direction: column;
  justify-content: space-between; 
  min-height: 90px;               
}

.upgrade-card:hover,
.zone-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 3px 10px rgba(0,0,0,0.3);
}

/* ================= UPGRADE ================= */
.upgrade-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.upgrade-level {
  font-size: 11px;
  opacity: 0.8;
}

.upgrade-preview {
  font-size: 11px;
  opacity: 0.6;
}

.upgrade-cost {
  font-size: 12px;
  font-weight: bold;
}

/* ================= ZONE ================= */
.zone-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.zone-title {
  font-size: 13px;
  font-weight: bold;
}

.zone-desc {
  font-size: 11px;
  opacity: 0.7;
}

/* ================= BUTTONS ================= */
button {
  font-family: inherit;
  width: 100%;
  font-size: 16px;
}

/* ===== SPELL GRID ===== */
.spell-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding: 4px;
}

/* ===== SPELL CARDS ===== */
.spell-grid button {
  border-radius: 14px !important;   /* kills pill shape */
  display: block;
  border-left: 4px solid transparent; 

  white-space: pre-line;
  text-align: left;

  padding: 14px;
  min-height: 110px;

  background: rgba(30, 30, 40, 0.6);
  backdrop-filter: blur(6px);

  border: 1px solid rgba(255,255,255,0.08);

  color: #e5e7eb;
  font-size: 13px;
  line-height: 1.45;

  box-shadow: 
    0 8px 24px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.05);

  transition: all 0.15s ease;

  width: 100%;
  max-width: 100%;
}

.spell-grid button::first-line {
  display: block;          
  text-align: center;     
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 6px;      
}

/* ===== HOVER ===== */
.spell-grid button:hover:not(:disabled) {
  transform: translateY(-2px);

  border-color: rgba(255,255,255,0.2);

  box-shadow: 
    0 12px 28px rgba(0,0,0,0.7),
    inset 0 1px 0 rgba(255,255,255,0.08);

  background: rgba(40, 40, 55, 0.75);
}

/* ===== CLICK ===== */
.spell-grid button:active:not(:disabled) {
  transform: scale(0.98);
}

/* ===== DISABLED (learned / locked) ===== */
.spell-grid button:disabled {
  opacity: 0.5;
  filter: grayscale(30%);
}

/* ===== OPTIONAL: subtle glow on available spells ===== */
.spell-grid button:not(:disabled) {
  border-color: #444;
}

.upgrade-card button,
.zone-card button {
  margin-top: auto;
  padding: 5px;
  font-size: 11px;
}

#choices {
  display: flex;
  flex-direction:column;
  align-items: center;
}

#choices button {
  width: auto;
  min-width: 180px;
  max-width: 280px;
  margin: 6px 0;
  padding: 10px 16px;
  font-size: 12px;
  border-radius: 999px;
  gap: 7px;
  border: 1px solid #2a2a38;
  background: #2f2f3f;
  color: white;
  cursor: pointer;
}

button:hover {
  background: #3f3f55;
}

button:disabled {
  background: #1f1f2a;
  color: #777;
  cursor: not-allowed;
}

.zone-card.locked {
  opacity: 0.4;
  filter: grayscale(0.8);
  transform: none; 
}

.zone-card.locked:hover {
  transform: none;
  box-shadow: none;
}

.zone-card.locked .zone-title,
.zone-card.locked .zone-desc,
.zone-card.locked .zone-difficulty {
  color: #888;
}

.zone-card.locked button {
  background: #1a1a22;
  color: #666;
}

button:disabled {
  opacity: 0.4;
  filter: blur(1px);
  background: #1f1f2a;
  color: #777;
  cursor: not-allowed;
}

.quickStrike { border-left-color: #facc15 !important; }  /* yellow */
.flameBurst  { border-left-color: #ef4444 !important; }  /* red */
.iceLock     { border-left-color: #60a5fa !important; }  /* blue */
.bloodStrike { border-left-color: #b91c1c !important; }  /* dark red */


/* ================= NAV ================= */
#nav {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 90%;

  display: grid;
  grid-template-columns: repeat(3, 1fr);
  justify-content: center;
  gap: 12px;

  padding: 12px 26px;

  background: rgba(10, 10, 15, 0.95);
  border-top: 1px solid rgba(255,255,255,0.08);

  backdrop-filter: blur(6px);

  max-width: 500px;
  margin: 0 auto;
  left: 0;
  right: 0;

  position: sticky;
  bottom: 0; 
  background: #111;
  padding: 8px;
}

#nav button {
  min-width: 120px;
  flex: 1;
  padding: 10px 16px;
  border-radius: 10px;
  background: #1c1c24;
  color: #ffffff
}



/* ================= FLOATING ================= */
#game {
  max-width: 800px;
  margin: 0 auto;
  padding: 10px;
  position: relative;
}

/* BASE */
.floating {
  position: absolute;
  left: 50%;
  top: 0%;
  transform: translate(-50%, 0);

  font-weight: bold;
  pointer-events: none;

  animation: floatUp 0.8s ease forwards;
}

.floating.enemy {
  color: #ef4444;
  left: 50%;
  top: -10px;
  transform: translateX(-50%);
}

.floating.player {
  color: #f87171;
  left: 50%;
  top: -10px;
  transform: translateX(-50%);
}

#health-bar,
#enemy-bar {
  position: relative;
}


.floating.damage {
  left: 50%;
  top: 45%;
  transform: translateX(-50%);
  color: #ef4444;
}

.floating.heal {
  left: 50%;
  top: -10px;
  transform: translateX(-50%);
  color: #22c55e;
}

.floating.gold {
  position: absolute;
  right: 20px;
  top: 80%;
  color: #facc15;
}

.floating.gain {
  left: 50%;
  top: 30%;
  transform: translateX(-50%);
  color: #4caf50;
}

@keyframes floatUp {
  0% {
    opacity: 0;
    transform: translate(-50%, 10px);
  }
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -40px);
  }
}

/* ================= MODAL ================= */
#modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;

  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
}

#modal.show {
  opacity: 1;
  pointer-events: all;
}

#modal-content {
  background: #1a1a22;
  border-radius: 12px;
  padding: 20px;
  width: 280px;
}

#top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#player-stats {
  text-align: right;
}

.flash-damage {
  animation: damageFlash 0.2s;
}

@keyframes damageFlash {
  0% { background-color: rgba(255, 0, 0, 0.2); }
  100% { background-color: transparent; }
}
/* ===== HEALING ANIMATION TEST - Gant, health breaks it is this ===== */
.flash-heal {
  animation: healFlash 0.4s ease-out;
}

@keyframes healFlash {
  0% {
    background-color: rgba(80, 255, 120, 0.0);
  }
  30% {
    background-color: rgba(80, 255, 120, 0.25);
  }
  100% {
    background-color: rgba(80, 255, 120, 0.0);
  }
}

/* ===== XP LEVEL UP GLOW ===== */
.xp-levelup {
  animation: xpPulse 0.6s ease;
}

@keyframes xpPulse {
  0% {
    box-shadow: 0 0 0px rgba(59,130,246,0);
    transform: scaleY(1);
  }
  40% {
    box-shadow: 0 0 12px rgba(59,130,246,0.8);
    transform: scaleY(1.2);
  }
  100% {
    box-shadow: 0 0 0px rgba(59,130,246,0);
    transform: scaleY(1);
  }
}

#nav button:disabled {
  opacity: 0.3;
  filter: blur(1px);
  cursor: not-allowed;
}

#main {
  flex: 1;
  padding: 24px;
  overflow-y: auto;

  transition: opacity 0.15s ease;
}

#text {
  opacity: 100;
  animation: fadeIn 0.15s ease forwards;
  animation-delay: 0.05s;
}

  /* ===== BUFF BAR N STUFF - GRANT DONT FK THIS UP ===== */

#buff-bar {
  position: absolute;
  bottom: 80px;
  left: 0;
  width: 100%;

  display: flex;
  justify-content: center;
}

.buff {
  background: rgba(0,0,0,0.7);
  border: 1px solid #888;
  padding: 4px 6px;
  font-size: 12px;
  border-radius: 4px;
  color: white;
}

.bar {
  width: 100%;
  height: 12px;
  background: #222;
  border-radius: 6px;
  overflow: hidden;
  margin: 4px 0;
}

.fill {
  height: 100%;
  width: 100%;
  transition: width 0.2s ease;
}

.learned-tag {
  color: #22c55e;
  font-weight: 600;
  text-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
}

* {
  box-sizing: border-box;
}

@media (max-width: 480px) {
  .combat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6 px;
  }

  .spell-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6 px;
  }
}