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

:root {
  --bg-dark: #0a0a0f;
  --bg-panel: #12121a;
  --neon-cyan: #00ffff;
  --neon-pink: #ff00ff;
  --neon-green: #00ff88;
  --health-red: #ff3366;
  --mana-blue: #3366ff;
  --gold: #ffd700;
  --xp-purple: #9966ff;
  --text-primary: #ffffff;
  --text-secondary: #8888aa;
  --border-glow: 0 0 10px var(--neon-cyan), 0 0 20px var(--neon-cyan);
}

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

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    linear-gradient(transparent 50%, rgba(0, 0, 0, 0.03) 50%),
    linear-gradient(90deg, rgba(255,0,0,0.02), rgba(0,255,0,0.01), rgba(0,0,255,0.02));
  background-size: 100% 2px, 3px 100%;
  pointer-events: none;
  z-index: 1000;
}

/* Title Screen */
.title-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: 
    radial-gradient(ellipse at center, rgba(100, 0, 255, 0.15) 0%, transparent 70%),
    var(--bg-dark);
}

.title-container {
  text-align: center;
  padding: 2rem;
}

.title-coins {
  font-size: 2rem;
  letter-spacing: 1rem;
  margin-bottom: 1rem;
  animation: float 3s ease-in-out infinite;
}

.game-title {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(3rem, 12vw, 6rem);
  font-weight: 900;
  text-shadow: 
    0 0 10px var(--neon-cyan),
    0 0 20px var(--neon-cyan),
    0 0 40px var(--neon-cyan),
    0 0 80px var(--neon-pink);
  letter-spacing: 0.1em;
  animation: pulse-glow 2s ease-in-out infinite;
}

.game-title.subtitle {
  font-size: clamp(2rem, 8vw, 4rem);
  color: var(--neon-pink);
  text-shadow: 
    0 0 10px var(--neon-pink),
    0 0 20px var(--neon-pink),
    0 0 40px var(--neon-pink);
}

.tagline {
  color: var(--text-secondary);
  margin: 2rem 0;
  font-style: italic;
  font-size: 0.9rem;
}

.title-buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  margin-top: 2rem;
}

.name-input {
  background: var(--bg-panel);
  border: 2px solid var(--neon-cyan);
  color: var(--text-primary);
  padding: 0.75rem 1.5rem;
  font-family: inherit;
  font-size: 1rem;
  text-align: center;
  width: 250px;
  border-radius: 4px;
  outline: none;
  transition: all 0.3s;
}

.name-input:focus {
  box-shadow: var(--border-glow);
}

.name-input::placeholder {
  color: var(--text-secondary);
}

/* Buttons */
.neon-button {
  background: transparent;
  border: 2px solid var(--neon-cyan);
  color: var(--neon-cyan);
  padding: 1rem 2rem;
  font-family: 'Orbitron', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.neon-button:hover {
  background: var(--neon-cyan);
  color: var(--bg-dark);
  box-shadow: var(--border-glow);
  transform: translateY(-2px);
}

.neon-button.primary {
  border-color: var(--neon-pink);
  color: var(--neon-pink);
}

.neon-button.primary:hover {
  background: var(--neon-pink);
  box-shadow: 0 0 10px var(--neon-pink), 0 0 20px var(--neon-pink);
}

.neon-button.secondary {
  border-color: var(--neon-green);
  color: var(--neon-green);
}

.neon-button.secondary:hover {
  background: var(--neon-green);
  box-shadow: 0 0 10px var(--neon-green), 0 0 20px var(--neon-green);
}

/* Battle Screen */
.battle-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: 
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 50px,
      rgba(0, 255, 255, 0.03) 50px,
      rgba(0, 255, 255, 0.03) 51px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 50px,
      rgba(0, 255, 255, 0.03) 50px,
      rgba(0, 255, 255, 0.03) 51px
    ),
    var(--bg-dark);
}

.battle-screen.shake {
  animation: shake 0.3s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

/* Header */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--bg-panel);
  border-bottom: 2px solid var(--neon-cyan);
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.2);
}

.floor-info {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.floor-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.floor-number {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--neon-cyan);
  text-shadow: 0 0 10px var(--neon-cyan);
}

.header-title {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(0.8rem, 3vw, 1.2rem);
  color: var(--neon-pink);
  text-shadow: 0 0 10px var(--neon-pink);
  display: none;
}

@media (min-width: 768px) {
  .header-title {
    display: block;
  }
}

.coins-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 215, 0, 0.1);
  padding: 0.5rem 1rem;
  border-radius: 4px;
  border: 1px solid var(--gold);
}

.coin-amount {
  color: var(--gold);
  font-weight: 700;
}

/* Battle Container */
.battle-container {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr auto;
  gap: 1rem;
  padding: 1rem;
  overflow: hidden;
}

@media (min-width: 768px) {
  .battle-container {
    grid-template-columns: 200px 1fr 200px;
    grid-template-rows: 1fr auto;
  }
}

/* Player Panel */
.player-panel {
  background: var(--bg-panel);
  border: 2px solid var(--neon-cyan);
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
}

@media (min-width: 768px) {
  .player-panel {
    flex-direction: column;
    justify-content: flex-start;
    grid-row: 1;
    grid-column: 1;
  }
}

.player-avatar {
  font-size: 3rem;
  animation: float 3s ease-in-out infinite;
}

.player-name {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  color: var(--neon-cyan);
}

.player-level {
  background: var(--neon-pink);
  color: var(--bg-dark);
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.8rem;
}

.stat-bar {
  width: 100%;
  max-width: 200px;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.bar-container {
  background: rgba(0, 0, 0, 0.5);
  border-radius: 4px;
  height: 20px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.bar-container.xp-bar {
  height: 8px;
}

.bar-fill {
  height: 100%;
  transition: width 0.3s ease;
  position: relative;
}

.bar-fill.hp {
  background: linear-gradient(90deg, #ff0044, var(--health-red));
  box-shadow: 0 0 10px var(--health-red);
}

.bar-fill.mana {
  background: linear-gradient(90deg, #0044ff, var(--mana-blue));
  box-shadow: 0 0 10px var(--mana-blue);
}

.bar-fill.xp {
  background: linear-gradient(90deg, #6633ff, var(--xp-purple));
  box-shadow: 0 0 10px var(--xp-purple);
}

.bar-fill.enemy-hp {
  background: linear-gradient(90deg, #880000, #ff0044);
  box-shadow: 0 0 10px #ff0044;
}

.bar-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.7rem;
  font-weight: 700;
  text-shadow: 0 0 4px black;
}

.stat-numbers {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.buffs {
  display: flex;
  gap: 0.5rem;
}

.buff-icon {
  font-size: 1.5rem;
  animation: pulse 1s ease-in-out infinite;
}

/* Enemy Panel */
.enemy-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem;
}

@media (min-width: 768px) {
  .enemy-panel {
    grid-row: 1;
    grid-column: 2;
  }
}

.enemy-sprite {
  font-size: 6rem;
  animation: enemy-idle 2s ease-in-out infinite;
  text-shadow: 0 0 30px currentColor;
}

.enemy-sprite.boss {
  font-size: 8rem;
  animation: boss-pulse 1s ease-in-out infinite;
}

.enemy-name {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.5rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.enemy-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-style: italic;
}

.enemy-hp-bar {
  width: 80%;
  max-width: 300px;
  height: 24px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
  border: 2px solid var(--health-red);
}

/* Battle Log */
.battle-log {
  background: var(--bg-panel);
  border: 2px solid var(--neon-pink);
  border-radius: 8px;
  padding: 1rem;
  max-height: 150px;
  overflow-y: auto;
  font-size: 0.85rem;
}

@media (min-width: 768px) {
  .battle-log {
    grid-row: 1;
    grid-column: 3;
    max-height: none;
  }
}

.log-entry {
  padding: 0.25rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  animation: fade-in 0.3s ease;
}

.log-entry:last-child {
  border-bottom: none;
  color: var(--neon-cyan);
}

/* Action Panel */
.action-panel {
  background: var(--bg-panel);
  border-top: 2px solid var(--neon-cyan);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.main-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.action-button {
  flex: 1;
  min-width: 100px;
  max-width: 150px;
  padding: 1rem;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  border: 2px solid;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
}

.action-button.attack {
  border-color: var(--health-red);
  color: var(--health-red);
}

.action-button.attack:hover {
  background: var(--health-red);
  color: var(--bg-dark);
  box-shadow: 0 0 20px var(--health-red);
}

.action-button.defend {
  border-color: var(--mana-blue);
  color: var(--mana-blue);
}

.action-button.defend:hover {
  background: var(--mana-blue);
  color: var(--bg-dark);
  box-shadow: 0 0 20px var(--mana-blue);
}

.action-button.item {
  border-color: var(--gold);
  color: var(--gold);
}

.action-button.item:hover {
  background: var(--gold);
  color: var(--bg-dark);
  box-shadow: 0 0 20px var(--gold);
}

.ability-bar {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.ability-button {
  width: 60px;
  height: 60px;
  background: var(--bg-dark);
  border: 2px solid var(--neon-pink);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  position: relative;
}

.ability-button:hover:not(.disabled) {
  background: var(--neon-pink);
  box-shadow: 0 0 20px var(--neon-pink);
  transform: scale(1.1);
}

.ability-button.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  border-color: var(--text-secondary);
}

.ability-icon {
  font-size: 1.5rem;
}

.ability-cost {
  font-size: 0.6rem;
  color: var(--mana-blue);
  font-weight: 700;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fade-in 0.2s ease;
}

.modal {
  background: var(--bg-panel);
  border: 2px solid var(--neon-cyan);
  border-radius: 8px;
  padding: 2rem;
  max-width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 0 40px var(--neon-cyan);
}

.modal h2 {
  font-family: 'Orbitron', sans-serif;
  color: var(--neon-cyan);
  margin-bottom: 1rem;
  text-align: center;
}

.modal h3 {
  color: var(--neon-pink);
  margin: 1rem 0 0.5rem;
  font-size: 0.9rem;
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.inventory-item {
  background: var(--bg-dark);
  border: 1px solid var(--text-secondary);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  transition: all 0.2s;
}

.inventory-item:hover {
  border-color: var(--neon-green);
  box-shadow: 0 0 10px var(--neon-green);
}

.item-icon {
  font-size: 1.5rem;
}

.item-name {
  font-size: 0.7rem;
  text-align: center;
}

.item-qty {
  font-size: 0.6rem;
  color: var(--text-secondary);
}

.equipment-slots {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.equip-slot {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem;
  background: var(--bg-dark);
  border-radius: 4px;
}

.slot-label {
  color: var(--text-secondary);
  font-size: 0.7rem;
}

.slot-item {
  font-size: 0.8rem;
}

/* Shop Screen */
.shop-screen {
  min-height: 100vh;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: 
    radial-gradient(ellipse at top, rgba(255, 215, 0, 0.1) 0%, transparent 50%),
    var(--bg-dark);
}

.shop-title {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(1.5rem, 5vw, 2.5rem);
  color: var(--gold);
  text-shadow: 0 0 20px var(--gold);
  margin-bottom: 0.5rem;
}

.shop-coins {
  font-size: 1.2rem;
  color: var(--gold);
  margin-bottom: 2rem;
}

.shop-sections {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  width: 100%;
  max-width: 800px;
}

.shop-section h3 {
  color: var(--neon-cyan);
  margin-bottom: 0.5rem;
}

.shop-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
}

.shop-item {
  background: var(--bg-panel);
  border: 2px solid var(--text-secondary);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 8px;
}

.shop-item:hover:not(.unaffordable):not(.owned) {
  border-color: var(--neon-green);
  box-shadow: 0 0 15px var(--neon-green);
  transform: translateY(-3px);
}

.shop-item.unaffordable {
  opacity: 0.4;
  cursor: not-allowed;
}

.shop-item.owned {
  border-color: var(--neon-cyan);
  background: rgba(0, 255, 255, 0.1);
}

.item-stat {
  color: var(--neon-green);
  font-size: 0.7rem;
}

.item-price {
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 700;
}

.continue-btn {
  margin-top: 2rem;
  padding: 1.5rem 3rem;
}

/* Game Over Screen */
.gameover-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: 
    radial-gradient(ellipse at center, rgba(255, 0, 100, 0.2) 0%, transparent 60%),
    var(--bg-dark);
}

.glitch-container {
  text-align: center;
  margin-bottom: 2rem;
}

.gameover-title {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(2rem, 10vw, 4rem);
  color: var(--health-red);
  text-shadow: 
    0 0 10px var(--health-red),
    0 0 20px var(--health-red),
    0 0 40px var(--health-red);
  animation: glitch 0.5s infinite;
}

.skull {
  font-size: 5rem;
  animation: float 2s ease-in-out infinite;
}

.stats-summary {
  background: var(--bg-panel);
  border: 2px solid var(--health-red);
  border-radius: 8px;
  padding: 2rem;
  width: 100%;
  max-width: 400px;
  margin-bottom: 2rem;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-row:last-child {
  border-bottom: none;
}

/* Footer */
.game-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.5rem;
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-secondary);
  background: var(--bg-panel);
}

.game-footer a {
  color: var(--neon-cyan);
  text-decoration: none;
}

.game-footer a:hover {
  text-decoration: underline;
}

/* Animations */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

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

@keyframes enemy-idle {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-5px) scale(1.02); }
}

@keyframes boss-pulse {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.05); filter: brightness(1.2); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes glitch {
  0% { transform: translate(0); }
  20% { transform: translate(-2px, 2px); }
  40% { transform: translate(-2px, -2px); }
  60% { transform: translate(2px, 2px); }
  80% { transform: translate(2px, -2px); }
  100% { transform: translate(0); }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
  background: var(--neon-cyan);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--neon-pink);
}