:root {
  --bg-dark: #0f1117;
  --bg-card: #1a1d2e;
  --bg-card-hover: #232740;
  --accent-yellow: #ffd644;
  --accent-green: #44ff88;
  --accent-red: #ff4466;
  --accent-blue: #4488ff;
  --accent-purple: #aa66ff;
  --accent-cyan: #44ddff;
  --text-primary: #e8eaf0;
  --text-secondary: #8890a8;
  --border-glow: rgba(68, 136, 255, 0.3);
}

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

body {
  background: var(--bg-dark);
  color: var(--text-primary);
  font-family: 'Nunito', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(68, 136, 255, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(170, 102, 255, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(68, 221, 255, 0.03) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

#root { position: relative; z-index: 1; }

.pixel-font { font-family: 'Press Start 2P', monospace; }

.battle-btn {
  position: relative;
  background: linear-gradient(135deg, #4488ff 0%, #6644ff 100%);
  border: 3px solid rgba(255,255,255,0.2);
  border-radius: 16px;
  padding: 24px 48px;
  font-size: 28px;
  font-weight: 900;
  color: white;
  cursor: pointer;
  transition: all 0.15s ease;
  text-shadow: 0 2px 8px rgba(0,0,0,0.4);
  box-shadow:
    0 0 30px rgba(68, 136, 255, 0.3),
    0 8px 32px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255,255,255,0.2);
  animation: pulse-glow 2s ease-in-out infinite;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.battle-btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow:
    0 0 50px rgba(68, 136, 255, 0.5),
    0 12px 40px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.3);
}

.battle-btn:active {
  transform: translateY(1px) scale(0.98);
}

.battle-btn.disabled {
  opacity: 0.5;
  pointer-events: none;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 30px rgba(68, 136, 255, 0.3), 0 8px 32px rgba(0,0,0,0.4); }
  50% { box-shadow: 0 0 50px rgba(68, 136, 255, 0.5), 0 8px 32px rgba(0,0,0,0.4); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
  20%, 40%, 60%, 80% { transform: translateX(4px); }
}

@keyframes win-flash {
  0% { background-color: rgba(68, 255, 136, 0.3); }
  100% { background-color: transparent; }
}

@keyframes lose-flash {
  0% { background-color: rgba(255, 68, 102, 0.3); }
  100% { background-color: transparent; }
}

@keyframes slide-in {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes level-up-glow {
  0% { box-shadow: 0 0 0 0 rgba(255, 214, 68, 0.8); }
  50% { box-shadow: 0 0 40px 20px rgba(255, 214, 68, 0.3); }
  100% { box-shadow: 0 0 0 0 rgba(255, 214, 68, 0); }
}

@keyframes confetti-fall {
  0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100px) rotate(720deg); opacity: 0; }
}

@keyframes toast-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toast-out {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

.shake-anim { animation: shake 0.4s ease-in-out; }
.win-flash { animation: win-flash 0.6s ease-out; }
.lose-flash { animation: lose-flash 0.6s ease-out; }
.slide-in { animation: slide-in 0.3s ease-out; }
.level-up-glow { animation: level-up-glow 1s ease-out; }

.xp-bar-fill {
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  background: linear-gradient(90deg, #44ff88 0%, #44ddff 50%, #4488ff 100%);
  background-size: 200% 100%;
  animation: shimmer 2s linear infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.char-card {
  background: var(--bg-card);
  border: 2px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.char-card:hover { background: var(--bg-card-hover); transform: translateY(-1px); }
.char-card.selected { border-color: var(--accent-cyan); box-shadow: 0 0 20px rgba(68, 221, 255, 0.2); }
.char-card.locked { opacity: 0.5; cursor: default; }
.char-card.locked:hover { transform: none; }

.shop-card {
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(40,44,70,1) 100%);
  border: 2px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 20px;
  transition: all 0.2s ease;
}

.shop-card:hover { border-color: rgba(255,255,255,0.15); }

.toast-container {
  position: fixed;
  top: 80px;
  right: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 20px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13px;
  animation: toast-in 0.3s ease-out;
  pointer-events: auto;
  max-width: 320px;
  backdrop-filter: blur(10px);
}

.toast.win { background: rgba(68, 255, 136, 0.15); border: 1px solid rgba(68, 255, 136, 0.3); color: #44ff88; }
.toast.lose { background: rgba(255, 68, 102, 0.15); border: 1px solid rgba(255, 68, 102, 0.3); color: #ff4466; }
.toast.ability { background: rgba(170, 102, 255, 0.15); border: 1px solid rgba(170, 102, 255, 0.3); color: #aa66ff; }
.toast.levelup { background: rgba(255, 214, 68, 0.15); border: 1px solid rgba(255, 214, 68, 0.3); color: #ffd644; }
.toast.buy { background: rgba(68, 136, 255, 0.15); border: 1px solid rgba(68, 136, 255, 0.3); color: #4488ff; }
.toast.switch { background: rgba(170, 102, 255, 0.15); border: 1px solid rgba(170, 102, 255, 0.3); color: #aa66ff; }

.tab-btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  background: transparent;
  color: var(--text-secondary);
}

.tab-btn:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.tab-btn.active { background: rgba(68, 136, 255, 0.15); color: var(--accent-blue); }

.log-entry {
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  animation: slide-in 0.3s ease-out;
}

.log-entry.win { background: rgba(68, 255, 136, 0.08); color: #88ffbb; }
.log-entry.lose { background: rgba(255, 68, 102, 0.08); color: #ff8899; }
.log-entry.ability { background: rgba(170, 102, 255, 0.06); color: #cc99ff; font-style: italic; }

.confetti-piece {
  position: fixed;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  animation: confetti-fall 1.5s ease-in forwards;
  pointer-events: none;
  z-index: 999;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

@media (max-width: 768px) {
  .battle-btn { padding: 18px 36px; font-size: 22px; }
}