:root {
  --bg-deep: #05050d;
  --bg-panel: rgba(11, 14, 31, 0.84);
  --cyan: #00f3ff;
  --magenta: #ff007f;
  --yellow: #ffe600;
  --lime: #00ff88;
  --orange: #ff6b00;
  --text-main: #eef6ff;
  --text-dim: #8a9bb8;
  --border-glow: rgba(0, 243, 255, 0.28);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-deep);
  color: var(--text-main);
  font-family: 'Rajdhani', system-ui, -apple-system, sans-serif;
}

#app-shell {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
}

/* HUD Bar */
.hud-bar {
  height: 68px;
  padding: 0 24px;
  background: linear-gradient(180deg, rgba(8, 12, 28, 0.95) 0%, rgba(5, 7, 18, 0.82) 100%);
  border-bottom: 1px solid var(--border-glow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 20;
  box-shadow: 0 4px 25px rgba(0, 243, 255, 0.12);
}

.hud-group {
  display: flex;
  align-items: center;
  gap: 24px;
}

.hud-stat {
  display: flex;
  flex-direction: column;
}

.hud-label {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  font-weight: 700;
}

.hud-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.4rem;
  font-weight: 900;
  line-height: 1.1;
}

.neon-cyan {
  color: var(--cyan);
  text-shadow: 0 0 12px rgba(0, 243, 255, 0.65);
}

.neon-magenta {
  color: var(--magenta);
  text-shadow: 0 0 12px rgba(255, 0, 127, 0.65);
}

.neon-yellow {
  color: var(--yellow);
  text-shadow: 0 0 12px rgba(255, 230, 0, 0.65);
}

.hud-center {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 1;
  max-width: 540px;
}

.hull-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hull-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.shield-badge {
  font-size: 0.68rem;
  font-family: 'Orbitron', sans-serif;
  padding: 1px 8px;
  border-radius: 99px;
  background: rgba(0, 243, 255, 0.18);
  color: var(--cyan);
  border: 1px solid var(--cyan);
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.4);
}

.hull-track {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.hull-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--lime), var(--cyan));
  box-shadow: 0 0 12px var(--cyan);
  transition: width 0.18s ease-out, background 0.25s ease;
}

.weapon-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}

.weapon-badge {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 4px;
  background: rgba(255, 0, 127, 0.16);
  border: 1px solid rgba(255, 0, 127, 0.55);
  color: #ff85c1;
  letter-spacing: 0.08em;
}

.bomb-badge {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.7rem;
  color: var(--yellow);
  letter-spacing: 0.06em;
}

.hud-btn {
  background: rgba(0, 243, 255, 0.08);
  border: 1px solid rgba(0, 243, 255, 0.35);
  color: var(--text-main);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  letter-spacing: 0.08em;
  transition: all 0.15s ease;
}

.hud-btn:hover {
  background: rgba(0, 243, 255, 0.22);
  box-shadow: 0 0 15px rgba(0, 243, 255, 0.4);
  transform: translateY(-1px);
}

/* Main Canvas Stage */
#canvas-stage {
  position: relative;
  flex: 1;
  width: 100%;
  height: calc(100vh - 68px);
  overflow: hidden;
  cursor: crosshair;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Boss HUD */
.boss-hud {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: min(520px, 86vw);
  z-index: 12;
  text-align: center;
  pointer-events: none;
}

.boss-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.85rem;
  font-weight: 900;
  letter-spacing: 0.2em;
  color: var(--magenta);
  text-shadow: 0 0 12px var(--magenta);
  margin-bottom: 6px;
}

.boss-bar-track {
  height: 12px;
  background: rgba(20, 5, 18, 0.85);
  border: 1px solid var(--magenta);
  border-radius: 99px;
  overflow: hidden;
  box-shadow: 0 0 18px rgba(255, 0, 127, 0.45);
}

.boss-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff0055, #ff9900);
  transition: width 0.1s linear;
}

/* Overlay Modal */
.overlay-screen {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(9, 13, 32, 0.72) 0%, rgba(4, 5, 13, 0.92) 100%);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 30;
  cursor: default;
}

.overlay-card {
  width: min(760px, 95vw);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-panel);
  border: 1px solid rgba(0, 243, 255, 0.35);
  border-radius: 16px;
  padding: 32px;
  text-align: center;
  box-shadow: 0 0 50px rgba(0, 243, 255, 0.15), inset 0 0 25px rgba(0, 243, 255, 0.05);
}

.badge-pill {
  display: inline-block;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  padding: 5px 14px;
  border-radius: 99px;
  background: rgba(0, 243, 255, 0.12);
  border: 1px solid rgba(0, 243, 255, 0.45);
  color: var(--cyan);
  margin-bottom: 12px;
}

.game-title {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  font-weight: 900;
  letter-spacing: 0.12em;
  color: #ffffff;
  text-shadow: 0 0 24px rgba(0, 243, 255, 0.65);
  margin-bottom: 8px;
}

.game-title span {
  color: var(--magenta);
  text-shadow: 0 0 24px rgba(255, 0, 127, 0.8);
}

.game-subtitle {
  color: var(--text-dim);
  font-size: 1.05rem;
  max-width: 540px;
  margin: 0 auto 24px;
  line-height: 1.45;
}

.gameover-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}

.stat-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--text-dim);
}

.stat-num {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.45rem;
  font-weight: 900;
}

.score-form {
  margin: 0 auto 22px;
  max-width: 360px;
  background: rgba(0, 243, 255, 0.06);
  border: 1px solid rgba(0, 243, 255, 0.35);
  padding: 14px;
  border-radius: 10px;
}

.score-form label {
  display: block;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.75rem;
  color: var(--yellow);
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.score-input-row {
  display: flex;
  gap: 8px;
}

.score-input-row input {
  flex: 1;
  background: rgba(5, 7, 18, 0.9);
  border: 1px solid var(--cyan);
  border-radius: 6px;
  padding: 8px 12px;
  color: #fff;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.95rem;
  text-transform: uppercase;
  outline: none;
}

.action-row {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-bottom: 28px;
}

.primary-btn, .secondary-btn {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  padding: 14px 32px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.primary-btn {
  background: linear-gradient(135deg, var(--cyan) 0%, #0088ff 100%);
  color: #040814;
  border: none;
  box-shadow: 0 0 25px rgba(0, 243, 255, 0.55);
}

.primary-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 0 35px rgba(0, 243, 255, 0.85);
}

.small-btn {
  padding: 8px 18px;
  font-size: 0.8rem;
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  text-align: left;
}

.info-panel {
  background: rgba(5, 8, 20, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  padding: 16px 18px;
}

.info-panel h3 {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  color: var(--cyan);
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(0, 243, 255, 0.2);
  padding-bottom: 6px;
}

.controls-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.92rem;
}

.controls-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-dim);
}

kbd {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.7rem;
  padding: 2px 7px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  color: var(--text-main);
}

.leaderboard-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 0.92rem;
}

.leaderboard-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.03);
}

.leaderboard-list li:first-child {
  background: rgba(255, 230, 0, 0.12);
  border: 1px solid rgba(255, 230, 0, 0.35);
  color: var(--yellow);
}

.lb-rank {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-right: 8px;
}

.lb-name {
  font-weight: 700;
  flex: 1;
}

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

.hidden {
  display: none !important;
}

/* Touch Controls for Mobile / Tablets */
.touch-controls {
  display: none;
  position: absolute;
  inset: auto 0 18px 0;
  padding: 0 24px;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
  z-index: 15;
}

.joystick-zone {
  width: 120px;
  height: 120px;
  pointer-events: auto;
  touch-action: none;
}

.joystick-base {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(0, 243, 255, 0.08);
  border: 2px solid rgba(0, 243, 255, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

.joystick-stick {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(0, 243, 255, 0.65);
  box-shadow: 0 0 15px var(--cyan);
}

.touch-buttons {
  display: flex;
  gap: 12px;
  pointer-events: auto;
}

.touch-action-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.7rem;
  font-weight: 900;
  color: #fff;
  border: 2px solid var(--cyan);
  background: rgba(0, 243, 255, 0.18);
  touch-action: none;
}

.touch-action-btn.fire {
  width: 76px;
  height: 76px;
  border-color: var(--magenta);
  background: rgba(255, 0, 127, 0.25);
}

.touch-action-btn.bomb {
  border-color: var(--yellow);
  background: rgba(255, 230, 0, 0.2);
}

@media (max-width: 768px), (pointer: coarse) {
  .touch-controls {
    display: flex;
  }
  .info-grid {
    grid-template-columns: 1fr;
  }
  .hud-bar {
    height: auto;
    flex-wrap: wrap;
    padding: 10px 14px;
  }
  .hud-center {
    order: 3;
    max-width: 100%;
    width: 100%;
  }
}
