/* ─── Reset & base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green:  #39ff14;
  --cyan:   #00e5ff;
  --yellow: #ffe600;
  --red:    #ff2020;
  --dim:    rgba(0,0,0,0.55);
  --nav-h:  44px;
  --hud-h:  56px;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #000;
  font-family: 'Courier New', Courier, monospace;
  color: var(--green);
  user-select: none;
  -webkit-user-select: none;
}

/* ─── Canvas ───────────────────────────────────────────────────────── */
#game-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ─── HUD bar ──────────────────────────────────────────────────────── */
#hud {
  position: fixed;
  top: var(--nav-h); left: 0; right: 0;
  height: var(--hud-h);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 16px;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(57,255,20,0.25);
  pointer-events: none;
  z-index: 10;
}

.hud-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hud-block.center { align-items: center; }
.hud-block.right  { align-items: flex-end; }

.hud-label {
  font-size: 10px;
  letter-spacing: 3px;
  color: rgba(57,255,20,0.55);
  text-transform: uppercase;
}
.hud-value {
  font-size: 22px;
  letter-spacing: 2px;
  color: var(--green);
  text-shadow: 0 0 8px var(--green);
}

#hud-lives {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 2px;
}
.life-icon {
  width: 18px; height: 12px;
  display: inline-block;
}

/* ─── Touch controls ───────────────────────────────────────────────── */
#touch-controls {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 0; right: 0;
  padding: 0 20px;
  pointer-events: none;
  z-index: 20;
  justify-content: space-between;
  align-items: flex-end;
}

#tc-move {
  display: flex;
  gap: 12px;
  pointer-events: none;
}

.tc-btn {
  pointer-events: auto;
  width: 80px; height: 80px;
  border-radius: 12px;
  border: 2px solid var(--green);
  background: rgba(57,255,20,0.08);
  color: var(--green);
  font-size: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  transition: background 0.1s, box-shadow 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.tc-btn:active,
.tc-btn.pressed {
  background: rgba(57,255,20,0.25);
  box-shadow: 0 0 16px var(--green);
}

#btn-fire {
  width: 100px; height: 100px;
  border-radius: 50%;
  font-size: 14px;
  letter-spacing: 2px;
  font-weight: bold;
  border-color: var(--cyan);
  color: var(--cyan);
  background: rgba(0,229,255,0.08);
}
#btn-fire:active,
#btn-fire.pressed {
  background: rgba(0,229,255,0.25);
  box-shadow: 0 0 20px var(--cyan);
}

@media (pointer: coarse) {
  #touch-controls { display: flex; }
  #fullscreen-btn { display: flex; }
}

/* ─── Fullscreen button ────────────────────────────────────────────── */
#fullscreen-btn {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 48px; height: 48px;
  border-radius: 10px;
  border: 1px solid rgba(57,255,20,0.4);
  background: rgba(0,0,0,0.6);
  color: var(--green);
  font-size: 22px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  z-index: 30;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

/* ─── Demo high-score panel ────────────────────────────────────────── */
#demo-scores {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.88);
  border: 2px solid var(--green);
  border-radius: 16px;
  padding: 28px 40px;
  min-width: 280px;
  text-align: center;
  z-index: 5;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 0 40px rgba(57,255,20,0.2);
}
#demo-scores.hidden { display: none; }
#demo-scores h2 {
  font-size: 18px;
  letter-spacing: 5px;
  color: var(--yellow);
  text-shadow: 0 0 10px var(--yellow);
  margin-bottom: 16px;
}
#demo-score-list {
  list-style: none;
  padding: 0;
}
#demo-score-list li {
  display: flex;
  justify-content: space-between;
  gap: 32px;
  font-size: 16px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(57,255,20,0.12);
  color: var(--green);
}
#demo-score-list li:first-child { color: var(--yellow); }
#demo-score-list li .rank { color: rgba(57,255,20,0.45); min-width: 20px; }
#demo-score-list li .name { min-width: 40px; }
#demo-score-list li .pts  { text-align: right; }

/* ─── Utility ──────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ─── Scanline overlay (optional CRT feel) ─────────────────────────── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(0,0,0,0.06) 3px,
    rgba(0,0,0,0.06) 4px
  );
  z-index: 999;
}
