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

:root {
  --bg-color: #0f172a; 
  --text-color: #f8fafc;
  --accent-color: #10b981; 
  --accent-hover: #059669;
  --health-full: #10b981;
  --health-low: #ef4444;
  --glass-bg: rgba(30, 41, 59, 0.5);
  --glass-border: rgba(255, 255, 255, 0.1);
  --card-hover: rgba(51, 65, 85, 0.7);
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: 'Outfit', sans-serif;
  overflow: hidden;
  user-select: none;
}

canvas {
  display: block;
}

#ui-layer {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none; 
  z-index: 10;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 30px 50px;
}

.stats-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info-group {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

#health-bar-container {
  width: 350px;
  height: 28px;
  background-color: rgba(0, 0, 0, 0.6);
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 16px rgba(0,0,0,0.5), inset 0 2px 5px rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
}

#health-bar {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #10b981, #34d399);
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), background 0.25s;
}

#exp-bar-container {
  width: 350px;
  height: 14px;
  background-color: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 7px;
  overflow: hidden;
  box-shadow: 0 4px 8px rgba(0,0,0,0.5);
}

#exp-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#level-display {
  font-size: 26px;
  font-weight: 900;
  text-shadow: 0 4px 12px rgba(0,0,0,0.8);
  background: linear-gradient(to right, #fde047, #f59e0b);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-transform: uppercase;
  letter-spacing: 1px;
}

#boss-health-container {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  text-align: center;
  z-index: 15;
}
#boss-health-container.hidden {
  display: none;
}
#boss-name {
  font-size: 24px;
  font-weight: 900;
  color: #fca5a5;
  margin-bottom: 8px;
  letter-spacing: 4px;
  text-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
}
#boss-health-bar-bg {
  width: 100%;
  height: 24px;
  background-color: rgba(0, 0, 0, 0.8);
  border: 3px solid #7f1d1d;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.5);
}
#boss-health-bar {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #ef4444, #fca5a5);
  transition: width 0.1s;
}

#score-display {
  font-size: 32px;
  font-weight: 900;
  text-shadow: 0 4px 12px rgba(0,0,0,0.6);
  background: linear-gradient(to right, #f8fafc, #94a3b8);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

#game-over-screen {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--glass-bg);
  padding: 60px 100px;
  border-radius: 24px;
  text-align: center;
  border: 1px solid var(--glass-border);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 40px rgba(239, 68, 68, 0.2);
  pointer-events: auto; 
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

#game-over-screen.hidden {
  display: none;
}

#game-over-screen h1 {
  font-size: 64px;
  background: linear-gradient(135deg, #fca5a5, #ef4444);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 20px;
  letter-spacing: 2px;
  font-weight: 900;
}

#game-over-screen p {
  font-size: 32px;
  margin-bottom: 50px;
  color: #cbd5e1;
  font-weight: 600;
}

#restart-btn, #change-char-btn {
  background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
  color: white;
  border: none;
  padding: 18px 54px;
  font-size: 22px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 10px 25px -5px rgba(16, 185, 129, 0.4);
  display: block;
  margin: 0 auto;
}

#restart-btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 20px 30px -5px rgba(16, 185, 129, 0.6);
}

#change-char-btn {
  background: linear-gradient(135deg, #475569, #334155);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
}

#change-char-btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 20px 30px -5px rgba(0, 0, 0, 0.6);
}

/* Character Selection UI */
#character-selection-screen {
  position: absolute;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background-color: rgba(15, 23, 42, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: auto;
  z-index: 20;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow-y: auto;
  padding: 60px 0;
}

#character-selection-screen.hidden {
  display: none;
}

#character-selection-screen h1 {
  font-size: 64px;
  font-weight: 900;
  background: linear-gradient(135deg, #a7f3d0, #10b981);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 60px;
  letter-spacing: -1px;
  text-shadow: 0 10px 30px rgba(16, 185, 129, 0.2);
}

.character-cards {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 1400px;
  padding: 0 40px 80px;
}

.char-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 35px 25px;
  width: 280px;
  text-align: center;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  position: relative;
  overflow: hidden;
}

.char-card::before {
  content: '';
  position: absolute;
  top: 0; left: -100%; width: 50%; height: 100%;
  background: linear-gradient(to right, transparent, rgba(255,255,255,0.05), transparent);
  transform: skewX(-20deg);
  transition: all 0.6s ease;
}

.char-card:hover::before {
  left: 150%;
}

.char-card:hover {
  transform: translateY(-12px) scale(1.03);
  background: var(--card-hover);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 20px 40px rgba(0,0,0,0.6), 0 0 25px rgba(16, 185, 129, 0.3);
}

.char-icon {
  width: 120px;
  height: 120px;
  margin: 0 auto 24px;
  filter: drop-shadow(0 15px 20px rgba(0,0,0,0.4));
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.char-card:hover .char-icon {
  transform: scale(1.15) translateY(-5px) rotate(5deg);
}

.char-card h2 {
  font-size: 26px;
  font-weight: 800;
  background: linear-gradient(to right, #4ade80, #60a5fa);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 12px;
}

.char-card p {
  font-size: 15px;
  color: #94a3b8;
  line-height: 1.6;
  font-weight: 400;
}

/* Custom scrollbar for webkit */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.8);
}
::-webkit-scrollbar-thumb {
  background: rgba(51, 65, 85, 0.8);
  border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(71, 85, 105, 1);
}
