:root {
  --neon: #36e0ff;
  --neon-2: #ff3df0;
  --bg: #05010f;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: #eaf6ff;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

#gl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* HUD */
#hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 28px;
  padding: 16px 22px;
  pointer-events: none;
  z-index: 5;
  text-shadow: 0 0 12px rgba(54, 224, 255, 0.7);
}

.stat { display: flex; flex-direction: column; line-height: 1.1; }
.stat .label {
  font-size: 11px;
  letter-spacing: 2px;
  opacity: 0.65;
}
.stat span:last-child {
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
#lives { color: var(--neon-2); text-shadow: 0 0 12px rgba(255, 61, 240, 0.8); }

/* Overlay */
#overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, rgba(10, 2, 30, 0.55), rgba(2, 0, 8, 0.9));
  backdrop-filter: blur(3px);
  z-index: 10;
}
#overlay.show { display: flex; }

.panel {
  text-align: center;
  padding: 40px 46px;
  border: 1px solid rgba(54, 224, 255, 0.35);
  border-radius: 18px;
  background: rgba(8, 4, 24, 0.6);
  box-shadow: 0 0 60px rgba(54, 224, 255, 0.25), inset 0 0 40px rgba(54, 224, 255, 0.08);
  max-width: 90vw;
}

h1 {
  font-size: clamp(24px, 5.5vw, 42px);
  letter-spacing: 4px;
  font-weight: 800;
  white-space: nowrap;
  background: linear-gradient(90deg, var(--neon), var(--neon-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding-right: 0.16em;
  filter: drop-shadow(0 0 18px rgba(54, 224, 255, 0.5));
}

.tag { margin-top: 10px; opacity: 0.7; font-size: 13px; letter-spacing: 1px; }

.controls {
  margin: 26px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 14px;
  opacity: 0.85;
}

kbd {
  display: inline-block;
  min-width: 22px;
  padding: 2px 7px;
  border: 1px solid rgba(54, 224, 255, 0.5);
  border-radius: 6px;
  background: rgba(54, 224, 255, 0.08);
  font-family: inherit;
  font-size: 12px;
}

button#startBtn {
  margin-top: 8px;
  padding: 14px 42px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--bg);
  background: linear-gradient(90deg, var(--neon), var(--neon-2));
  border: none;
  border-radius: 40px;
  cursor: pointer;
  box-shadow: 0 0 30px rgba(54, 224, 255, 0.6);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
button#startBtn:hover { transform: scale(1.05); box-shadow: 0 0 44px rgba(255, 61, 240, 0.7); }
button#startBtn:active { transform: scale(0.98); }

#gameOverMsg {
  margin-top: 22px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--neon-2);
}
.hidden { display: none; }

#homeLink {
  position: fixed;
  bottom: 12px; left: 16px;
  z-index: 7;
  font-size: 13px;
  letter-spacing: 1px;
  color: rgba(234, 246, 255, 0.6);
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid rgba(54, 224, 255, 0.3);
  border-radius: 20px;
  background: rgba(8, 4, 24, 0.5);
  transition: color 0.15s ease, border-color 0.15s ease;
}
#homeLink:hover { color: var(--neon); border-color: var(--neon); }

/* badge buff súng */
.power {
  align-self: center;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #ffd23b;
  text-shadow: 0 0 14px rgba(255, 210, 59, 0.9);
  transition: transform 0.15s ease;
}
.power.bump { transform: scale(1.3); }

/* thanh máu boss */
#bossbar {
  position: fixed;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  width: min(520px, 86vw);
  z-index: 6;
  text-align: center;
  pointer-events: none;
}
.boss-label {
  font-size: 13px;
  letter-spacing: 3px;
  font-weight: 800;
  color: #ff4d6a;
  text-shadow: 0 0 14px rgba(255, 42, 74, 0.9);
  margin-bottom: 6px;
}
.boss-track {
  height: 14px;
  border: 1px solid rgba(255, 77, 106, 0.6);
  border-radius: 10px;
  background: rgba(40, 4, 14, 0.6);
  overflow: hidden;
  box-shadow: 0 0 20px rgba(255, 42, 74, 0.4);
}
#bossfill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ff2a4a, #ff7a3d);
  box-shadow: 0 0 16px rgba(255, 80, 60, 0.9);
  transition: width 0.15s ease;
}

/* nút cài đặt */
#settingsBtn {
  position: fixed;
  bottom: 12px; right: 16px;
  z-index: 7;
  width: 40px; height: 40px;
  font-size: 20px;
  color: rgba(234, 246, 255, 0.7);
  background: rgba(8, 4, 24, 0.5);
  border: 1px solid rgba(54, 224, 255, 0.3);
  border-radius: 50%;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.2s ease;
}
#settingsBtn:hover { color: var(--neon); border-color: var(--neon); transform: rotate(45deg); }

/* panel cài đặt */
#settings {
  position: fixed; inset: 0;
  z-index: 12;
  display: none;
  align-items: center; justify-content: center;
  background: rgba(3, 0, 12, 0.7);
  backdrop-filter: blur(3px);
}
#settings.open { display: flex; }
.settings-card {
  text-align: center;
  padding: 30px 36px;
  border: 1px solid rgba(54, 224, 255, 0.35);
  border-radius: 16px;
  background: rgba(10, 5, 30, 0.85);
  box-shadow: 0 0 50px rgba(54, 224, 255, 0.2);
}
.settings-card h3 {
  font-size: 15px; letter-spacing: 3px; font-weight: 800;
  color: var(--neon); margin-bottom: 18px;
}
.qrow { display: flex; gap: 10px; }
.qrow button {
  padding: 12px 22px;
  font-size: 15px; font-weight: 700; letter-spacing: 1px;
  color: #eaf6ff;
  background: rgba(54, 224, 255, 0.08);
  border: 1px solid rgba(54, 224, 255, 0.3);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.14s ease;
}
.qrow button:hover { background: rgba(54, 224, 255, 0.2); }
.qrow button.active {
  color: #06121a;
  background: linear-gradient(90deg, var(--neon), var(--neon-2));
  border-color: transparent;
  box-shadow: 0 0 22px rgba(54, 224, 255, 0.6);
}
.qhint { margin: 16px 0 20px; font-size: 12px; opacity: 0.6; }
#settingsClose {
  padding: 10px 34px;
  font-size: 14px; font-weight: 800; letter-spacing: 2px;
  color: #06121a;
  background: linear-gradient(90deg, var(--neon), var(--neon-2));
  border: none; border-radius: 30px; cursor: pointer;
}

/* nút trợ giúp (?) */
#helpBtn {
  position: fixed;
  bottom: 12px; right: 64px;
  z-index: 7;
  width: 40px; height: 40px;
  font-size: 20px; font-weight: 800;
  color: rgba(234, 246, 255, 0.7);
  background: rgba(8, 4, 24, 0.5);
  border: 1px solid rgba(54, 224, 255, 0.3);
  border-radius: 50%;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
#helpBtn:hover { color: var(--neon); border-color: var(--neon); transform: scale(1.1); }

/* panel hướng dẫn */
#help {
  position: fixed; inset: 0;
  z-index: 12;
  display: none;
  align-items: center; justify-content: center;
  background: rgba(3, 0, 12, 0.75);
  backdrop-filter: blur(3px);
  padding: 20px;
}
#help.open { display: flex; }
.help-card {
  text-align: left;
  max-width: 460px;
  padding: 28px 30px;
  border: 1px solid rgba(54, 224, 255, 0.35);
  border-radius: 16px;
  background: rgba(10, 5, 30, 0.9);
  box-shadow: 0 0 50px rgba(54, 224, 255, 0.2);
}
.help-card h3 {
  font-size: 16px; letter-spacing: 3px; font-weight: 800;
  color: var(--neon); margin-bottom: 16px; text-align: center;
}
.help-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.help-list li { font-size: 13.5px; line-height: 1.5; opacity: 0.9; padding-left: 4px; }
.help-list b { color: var(--neon); }
#helpClose {
  display: block;
  margin: 22px auto 0;
  padding: 10px 34px;
  font-size: 14px; font-weight: 800; letter-spacing: 2px;
  color: #06121a;
  background: linear-gradient(90deg, var(--neon), var(--neon-2));
  border: none; border-radius: 30px; cursor: pointer;
}

/* thanh chiêu cuối (ULTI) */
#ulti {
  position: fixed;
  right: 16px;
  top: 16px;
  z-index: 7;
  width: min(220px, 42vw);
  height: 28px;
  border: 1px solid rgba(124, 92, 255, 0.55);
  border-radius: 16px;
  background: rgba(12, 6, 30, 0.6);
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(124, 92, 255, 0.3);
}
#ultifill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: linear-gradient(90deg, #36e0ff, #7c5cff);
  transition: width 0.1s linear;
}
#ultilabel {
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; letter-spacing: 3px;
  color: #fff;
  text-shadow: 0 0 8px rgba(0,0,0,0.6);
}
#ulti.ready {
  border-color: #ffd23b;
  box-shadow: 0 0 26px rgba(255, 210, 59, 0.8);
  animation: ultipulse 0.8s ease-in-out infinite;
}
#ulti.ready #ultifill { background: linear-gradient(90deg, #ffd23b, #ff7a3d, #ff3df0); }
#ulti.ready #ultilabel::after { content: " READY"; }
@keyframes ultipulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
