@font-face { font-family: 'neon'; src: local('Arial'); }
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  background: #000;
  overflow: hidden;
  font-family: 'Segoe UI', Arial, sans-serif;
  color: #d7f6ff;
  user-select: none;
}
#gameRoot {
  width: 100vw; height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, #050414 0%, #000000 100%);
}
#canvasWrap {
  position: relative;
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
#gameCanvas {
  background: #03020a;
  box-shadow: 0 0 80px rgba(120, 50, 255, 0.25), 0 0 200px rgba(0, 220, 255, 0.08);
  image-rendering: optimizeSpeed;
}
#vignette {
  position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 180px 40px rgba(0,0,0,0.85);
}
#damageFlash {
  position: absolute; inset: 0; pointer-events: none;
  background: rgba(255, 0, 60, 0);
  transition: background 0.08s ease-out;
}
#damageFlash.active { background: rgba(255, 0, 60, 0.35); }

.hidden { display: none !important; }

/* Screens */
.screen {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 30%, rgba(60,0,100,0.35), rgba(0,0,0,0.92) 70%);
  z-index: 50;
  animation: fadeIn 0.25s ease-out;
  backdrop-filter: blur(2px);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.screenInner {
  text-align: center;
  padding: 30px 50px;
  max-width: 820px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}
.title {
  font-size: 5.2rem;
  letter-spacing: 6px;
  margin: 0;
  font-weight: 900;
  color: #8ef9ff;
  text-shadow: 0 0 10px #4af7ff, 0 0 30px #4af7ff, 0 0 60px #9b4dff;
}
.title span { color: #ff4df0; text-shadow: 0 0 10px #ff4df0, 0 0 30px #ff4df0, 0 0 60px #9b4dff; }
.subtitle {
  letter-spacing: 8px;
  color: #8a8fd9;
  text-transform: uppercase;
  margin-top: -5px;
  margin-bottom: 40px;
  font-size: 0.9rem;
}
.screenTitle {
  font-size: 2.4rem;
  letter-spacing: 4px;
  color: #8ef9ff;
  text-shadow: 0 0 10px #4af7ff, 0 0 25px #4af7ff;
  margin-bottom: 20px;
}
.victoryTitle { color: #ffe44d; text-shadow: 0 0 10px #ffe44d, 0 0 30px #ff9a4d; }
.glitch { color: #ff4040; text-shadow: 0 0 10px #ff4040, 0 0 30px #ff0000; animation: glitchAnim 0.3s infinite; }
@keyframes glitchAnim {
  0% { transform: translate(0,0); }
  25% { transform: translate(-2px,1px); }
  50% { transform: translate(2px,-1px); }
  75% { transform: translate(-1px,-1px); }
  100% { transform: translate(0,0); }
}

.menuButtons { display: flex; flex-direction: column; gap: 14px; align-items: center; margin-top: 10px; }
.btn {
  min-width: 280px;
  padding: 14px 28px;
  background: linear-gradient(180deg, rgba(20,20,50,0.8), rgba(10,10,30,0.9));
  border: 1px solid #3a4ad9;
  color: #c9d6ff;
  font-size: 1rem;
  letter-spacing: 3px;
  cursor: pointer;
  text-transform: uppercase;
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
  transition: all 0.15s ease;
  box-shadow: 0 0 10px rgba(60,80,255,0.2) inset;
}
.btn:hover {
  background: linear-gradient(180deg, rgba(60,40,120,0.9), rgba(20,10,50,0.95));
  border-color: #8ef9ff;
  color: #fff;
  box-shadow: 0 0 25px rgba(140,240,255,0.5), 0 0 10px rgba(255,80,240,0.3) inset;
  transform: translateY(-2px);
}
.btnPrimary { border-color: #ff4df0; color: #fff; box-shadow: 0 0 20px rgba(255,77,240,0.35) inset; }
.btnPrimary:hover { box-shadow: 0 0 30px rgba(255,77,240,0.7); }

.menuFooter { margin-top: 30px; color: #6b78c2; letter-spacing: 2px; font-size: 0.85rem; }

.howtoGrid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin: 20px 0; text-align: left;
}
.howtoItem {
  background: rgba(30,20,60,0.5); border: 1px solid #3a4ad9;
  padding: 10px 14px; border-radius: 4px; font-size: 0.9rem;
}
.howtoItem b { color: #8ef9ff; margin-right: 6px; }
.howtoText { color: #a9b3e8; line-height: 1.6; font-size: 0.92rem; }

.metaEnergy { color: #ffe44d; font-size: 1.2rem; margin-bottom: 20px; letter-spacing: 2px; }
.metaList { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; max-height: 50vh; overflow-y: auto; }
.metaItem {
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(20,20,50,0.6); border: 1px solid #3a4ad9; padding: 10px 16px; border-radius: 4px;
}
.metaItem .metaInfo { text-align: left; }
.metaItem .metaName { color: #8ef9ff; font-weight: bold; }
.metaItem .metaDesc { font-size: 0.78rem; color: #9aa6e0; }
.metaItem button {
  background: #1a1a40; border: 1px solid #8ef9ff; color: #8ef9ff; padding: 6px 14px; cursor: pointer;
  letter-spacing: 1px;
}
.metaItem button:disabled { opacity: 0.35; cursor: not-allowed; }
.metaItem button:hover:not(:disabled) { background: #8ef9ff; color: #000; }

.settingRow { display: flex; justify-content: space-between; align-items: center; margin: 14px 0; font-size: 1rem; }

.upgradeChoices { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.upgradeCard {
  width: 220px; padding: 20px 16px; background: linear-gradient(180deg, rgba(25,15,60,0.9), rgba(8,5,25,0.95));
  border: 1px solid #5a4ad9; cursor: pointer; transition: all 0.15s ease;
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
}
.upgradeCard:hover { border-color: #8ef9ff; box-shadow: 0 0 30px rgba(140,240,255,0.5); transform: translateY(-4px) scale(1.03); }
.upgradeCard .upIcon { font-size: 2.2rem; margin-bottom: 10px; }
.upgradeCard .upName { font-weight: bold; color: #fff; letter-spacing: 1px; margin-bottom: 8px; font-size: 1.05rem; }
.upgradeCard .upDesc { font-size: 0.82rem; color: #b3bbe8; line-height: 1.4; }

.statsGrid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px 30px;
  margin: 20px 0 30px; text-align: left; font-size: 1.05rem;
}
.statsGrid .statLabel { color: #8a8fd9; }
.statsGrid .statValue { color: #8ef9ff; font-weight: bold; text-align: right; }

/* HUD */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 20; font-family: 'Consolas', monospace; }
.hud-top-left { position: absolute; top: 18px; left: 18px; width: 300px; }
.hpBarOuter {
  position: relative; width: 100%; height: 22px; background: rgba(20,10,30,0.7);
  border: 1px solid #ff2d6a; box-shadow: 0 0 10px rgba(255,45,106,0.4);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}
.hpBarInner { height: 100%; width: 100%; background: linear-gradient(90deg, #ff2d6a, #ff8a4d); transition: width 0.15s ease; box-shadow: 0 0 12px #ff2d6a; }
.hpText { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; color: #fff; text-shadow: 0 0 4px #000; letter-spacing: 1px; }
.xpBarOuter { width: 100%; height: 8px; background: rgba(10,10,30,0.7); margin-top: 5px; border: 1px solid #4ad9ff; }
.xpBarInner { height: 100%; width: 0%; background: linear-gradient(90deg, #4ad9ff, #9b4dff); transition: width 0.2s ease; }
.statRow { display: flex; justify-content: space-between; margin-top: 6px; font-size: 0.78rem; letter-spacing: 1px; color: #9db3ff; text-shadow: 0 0 4px #000; }
.lvlTag, .sectorTag { background: rgba(10,10,30,0.6); padding: 2px 8px; border: 1px solid #3a4ad9; }

.hud-top-right { position: absolute; top: 18px; right: 18px; text-align: right; }
.scoreVal { font-size: 1.8rem; font-weight: bold; color: #8ef9ff; text-shadow: 0 0 10px #4af7ff; }
.comboVal { font-size: 1.1rem; color: #ff4df0; text-shadow: 0 0 10px #ff4df0; min-height: 1.4rem; }

.hud-bottom-left { position: absolute; bottom: 18px; left: 18px; }
.abilityRow { display: flex; gap: 12px; }
.abilityIcon {
  position: relative; width: 56px; height: 56px; background: rgba(10,10,30,0.7);
  border: 2px solid #4ad9ff; display: flex; align-items: center; justify-content: center;
  overflow: hidden; box-shadow: 0 0 10px rgba(74,217,255,0.3);
}
.abilityIcon span { position: relative; z-index: 2; font-size: 0.65rem; color: #fff; text-shadow: 0 0 4px #000; font-weight: bold; }
.abilityFill { position: absolute; left: 0; right: 0; bottom: 0; height: 100%; background: rgba(0,0,0,0.75); transform-origin: bottom; }

.hud-bottom-right { position: absolute; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 4px; max-width: 260px; align-items: flex-end; }
.upgradeTag { font-size: 0.68rem; background: rgba(20,10,40,0.7); border: 1px solid #9b4dff; padding: 3px 8px; color: #d4c2ff; letter-spacing: 0.5px; }

/* Boss UI */
#bossWarning {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 40; pointer-events: none; animation: bossWarnFlash 0.4s infinite;
}
.bossWarningText { font-size: 4rem; color: #ff2040; letter-spacing: 10px; text-shadow: 0 0 20px #ff2040, 0 0 50px #ff0000; font-weight: 900; }
.bossWarningSub { font-size: 1.3rem; color: #ffae40; letter-spacing: 4px; margin-top: 10px; text-shadow: 0 0 10px #ff8800; }
@keyframes bossWarnFlash { 0%,100% { background: rgba(255,0,30,0); } 50% { background: rgba(255,0,30,0.12); } }

#bossHealthWrap { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); width: 50%; min-width: 320px; z-index: 25; text-align: center; }
.bossName { color: #ff4df0; letter-spacing: 4px; font-weight: bold; text-shadow: 0 0 10px #ff4df0; margin-bottom: 4px; }
.bossHpOuter { width: 100%; height: 16px; background: rgba(20,10,30,0.7); border: 1px solid #ff4df0; }
.bossHpInner { height: 100%; width: 100%; background: linear-gradient(90deg, #ff4df0, #9b4dff); transition: width 0.2s ease; }
.bossPhase { font-size: 0.75rem; color: #ffae40; letter-spacing: 2px; margin-top: 3px; }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: #4a4ad9; }
::-webkit-scrollbar-track { background: transparent; }
