@import url(https://fonts.googleapis.com/css?family=Righteous);

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

body {
  background-color: #0984e3;
  overflow: hidden; 
  font-family: 'Righteous', serif;
}

/* --- VIEW MANAGEMENT --- */
.view {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  opacity: 0;
  pointer-events: none; 
  transition: opacity 0.1s;
}

.view.active {
  opacity: 1;
  pointer-events: all;
}

.main-container {
  width: 100%;
  max-width: 800px;
}

/* --- THE MILKY CURTAIN --- */
#transition-curtain {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #fdfbf7; 
  z-index: 9999; 
  clip-path: circle(0% at 0% 0%);
  transition: clip-path 1s cubic-bezier(0.645, 0.045, 0.355, 1);
  pointer-events: none;
}

#transition-curtain.active {
  clip-path: circle(150% at 0% 0%);
  pointer-events: all;
}

/* --- LANDING PAGE STYLES --- */
h1 {
  display: inline-block;
  color: #ffffff;
  font-size: 10em; 
  text-shadow: .03em .03em 0 #0984e3;
  margin-bottom: 20px;
}

h1:after {
  content: attr(data-shadow);
  position: absolute;
  top: .06em; left: .06em;
  z-index: -1;
  text-shadow: none;
  background-image: linear-gradient(45deg, transparent 45%, #ebe9e0 45%, #ebe9e0 55%, transparent 0);
  background-size: .05em .05em;
  -webkit-background-clip: text;
  background-clip: text; 
  -webkit-text-fill-color: transparent;
  color: transparent; 
  animation: shad-anim 15s linear infinite;
}

@keyframes shad-anim {
  0% {background-position: 0 0}
  100% {background-position: 100% -100%} 
}

.input-area {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-bottom: 50px;
}

input {
  font-family: 'Righteous', serif;
  background: #ffffff1a;
  border: 4px solid #ebe9e0; 
  color: #ffffff;
  padding: 15px 20px;
  font-size: 1.5rem;
  border-radius: 8px;
  outline: none;
  text-align: center;
  transition: all 0.3s;
  width: 280px;
}

input::placeholder { color: #ffffff99; }
input:focus { background: #ffffff33; transform: scale(1.05); }

.vs { color: #ebe9e0; font-size: 2.5rem; }

button {
  font-family: 'Righteous', serif;
  background-color: #ebe9e0;
  color: #0984e3; 
  border: none;
  padding: 15px 50px;
  font-size: 2.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.1s;
  box-shadow: 0 8px 0 #00000033;
}

button:active {
  transform: translateY(8px); 
  box-shadow: 0 0 0 #00000033;
}

/* --- BATTLEGROUND LAYOUT --- */
#battleground .main-container {
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* --- THE ARENA BLOCK --- */
.arena-block {
  background-color: #6D4C41;
  background-image: linear-gradient(to bottom, #795548 0%, #6D4C41 40%, #5D4037 80%, #4E342E 100%);
  border: 8px solid #3E2723;
  border-radius: 30px;
  padding: 60px 40px 40px 40px;
  width: 100%;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6); 
  transform: translateY(150vh); 
  transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.2);
}

.arena-block.rise { transform: translateY(0); }
.arena-block.float { transition: none; animation: islandBob 4s ease-in-out infinite; }

@keyframes islandBob {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-15px); }
  100% { transform: translateY(0px); }
}

/* --- STAGE & CARDS --- */
.arena-block .battle-title {
  color: #ffffff; text-shadow: 2px 2px 0 #3E2723; font-size: 3.5rem; margin-bottom: 30px;
}

.battle-stage {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 40px; padding: 0 20px;
}

.mage-card { display: flex; flex-direction: column; align-items: center; color: #ebe9e0; }
.mage-card h3 { font-size: 1.8rem; margin-bottom: 5px; text-shadow: 2px 2px 0 #3E2723; }
.stats { font-size: 1.2rem; color: #81C784; text-shadow: 1px 1px 0 #000; }
.battle-vs { font-size: 3rem; color: #ff4757; text-shadow: 3px 3px 0 #3E2723; animation: pulse 1.5s infinite; }

@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }

/* --- HEALTH BARS --- */
.hp-container {
  width: 100%; height: 12px; background-color: #2e1d16; border: 2px solid #ebe9e0;
  border-radius: 6px; margin-bottom: 10px; overflow: hidden;
}
.hp-fill { width: 100%; height: 100%; background-color: #4CAF50; transition: width 0.3s ease-out; }

/* --- STICKMAN MAGES --- */
.stickman-wrapper {
  position: relative; display: flex; flex-direction: column; align-items: center;
  height: 220px; width: 150px; margin-top: 10px; transition: all 0.5s ease;
}

#mage2-stickman { transform: scaleX(-1); }
.mage-head {
  width: 90px; height: 90px; border-radius: 50%; border: 4px solid #ebe9e0;
  z-index: 2; position: absolute; top: 0; background-color: #1a1a1a; box-shadow: 0 10px 20px rgba(0,0,0,0.5);
}
#mage2-stickman .mage-head { transform: scaleX(-1); }
.mage-body { width: 100px; height: 120px; position: absolute; top: 80px; z-index: 1; }

.staff-gem { animation: pulseGem 1s infinite alternate; }
@keyframes pulseGem {
  0% { filter: drop-shadow(0 0 2px currentColor); }
  100% { filter: drop-shadow(0 0 15px currentColor); }
}

/* --- BATTLE ANIMATIONS --- */
.cast-spell { animation: castAnim 0.4s ease-in-out; }
@keyframes castAnim {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(20deg) scale(1.1); }
}

.take-damage { animation: hitFlash 0.4s; }
@keyframes hitFlash {
  0%, 100% { filter: brightness(1); transform: translateX(0); }
  50% { filter: brightness(2) sepia(1) hue-rotate(-50deg) saturate(5); transform: translateX(-15px) rotate(-10deg); }
}

.dead {
  transform: rotate(90deg) translateY(50px) !important; 
  filter: grayscale(1) brightness(0.5); pointer-events: none;
}

.fireball {
  position: absolute; width: 25px; height: 25px; border-radius: 50%; z-index: 100; pointer-events: none;
}

/* --- COMBAT LOG & BUTTON --- */
.combat-log {
  background-color: rgba(0, 0, 0, 0.4); border: 4px solid #3E2723; border-radius: 8px;
  padding: 15px; color: #ebe9e0; font-family: monospace; font-size: 1.2rem; height: 60px;
  margin-bottom: 30px; display: flex; align-items: center; justify-content: center; text-shadow: 1px 1px 0 #000;
}

#reset-btn {
  font-size: 1.5rem; background-color: transparent; color: #ebe9e0; border: 4px solid #ebe9e0; box-shadow: none;
}
#reset-btn:hover { background-color: #ebe9e0; color: #0984e3; }
#reset-btn:active { transform: translateY(4px); }
