* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: #000; overflow: hidden; font-family: 'Courier New', monospace; color: #fff; }
canvas { display: block; margin-left: auto; margin-right: auto; }

#hud {
  position: fixed; top: 0; left: 0; right: 0; height: 44px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px; background: rgba(0,12,4,0.88);
  border-bottom: 1px solid #0a4; font-size: 13px; color: #0c6; z-index: 50;
}
#hud span { color: #0f8; font-weight: bold; }
#hud .lives { color: #f44; letter-spacing: 3px; font-size: 16px; }

#overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  overflow-y: auto;
  background: rgba(0,0,0,0.88);
}
#overlay h1 { font-size: 2.6rem; color: #0f8; text-shadow: 0 0 24px #0f8; margin-bottom: 6px; }
#overlay .sub { color: #8fc; font-size: 1rem; margin-bottom: 22px; }
#overlay .info { color: #888; font-size: 0.82rem; line-height: 2.2; text-align: center; margin-bottom: 18px; }
#overlay .info b { color: #0f8; }

#btnStartSound,
#btnStartMusic {
  position: fixed;
  top: 58px;
  right: 14px;
  z-index: 120;
  background: rgba(0, 16, 8, .82);
  border: 1px solid #0a4;
  color: #8fc;
  font-family: 'Courier New', monospace;
  font-size: 10px;
  padding: 5px 9px;
  cursor: pointer;
  letter-spacing: .04em;
  touch-action: manipulation;
}
#btnStartMusic { display: none; }
#btnStartSound.off,
#btnStartMusic.off {
  border-color: #333;
  color: #333;
}
#btnStartMusic.needs-gesture {
  border-color: #0f8;
  color: #dfffef;
  box-shadow: 0 0 16px rgba(0, 255, 136, .25);
}
#btnStartSound:hover,
#btnStartSound:active,
#btnStartMusic:hover,
#btnStartMusic:active {
  background: #0a4;
  color: #000;
}

#lyricRain {
  position: fixed;
  top: 44px;
  right: 0;
  bottom: 0;
  width: min(34vw, 390px);
  z-index: 108;
  overflow: hidden;
  pointer-events: none;
  mask-image: linear-gradient(to bottom, transparent 0, #000 9%, #000 86%, transparent 100%);
}

.nuclear-lyric-chip {
  position: absolute;
  top: -96px;
  left: var(--left, 18px);
  max-width: min(310px, calc(100% - 30px));
  padding: 7px 10px 8px 28px;
  border: 1px solid rgba(80, 214, 176, .58);
  border-left: 3px solid rgba(80, 214, 176, .9);
  background: linear-gradient(90deg, rgba(0, 18, 14, .95), rgba(0, 36, 40, .7));
  color: #baffea;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  line-height: 1.35;
  box-shadow: 0 0 18px rgba(80, 214, 176, .25), inset 0 0 16px rgba(80, 214, 176, .08);
  text-shadow: 0 0 9px rgba(80, 214, 176, .7);
  animation: nuclearLyricFall var(--dur, 9s) linear forwards;
  transform: translateY(-96px) rotate(var(--rot, -2deg));
  will-change: transform, opacity;
}

.nuclear-lyric-chip::before {
  content: "\269B";
  position: absolute;
  left: 8px;
  top: 7px;
  color: #50d6b0;
  font-size: 13px;
  text-shadow: 0 0 10px rgba(80, 214, 176, .9);
}

.nuclear-lyric-chip::after {
  content: attr(data-label);
  display: block;
  margin-top: 4px;
  color: rgba(156, 216, 255, .58);
  font-size: 8px;
  letter-spacing: .12em;
}

.nuclear-lyric-chip.section {
  border-color: rgba(255, 209, 106, .62);
  border-left-color: #ffd16a;
  color: #ffe6a6;
  text-transform: uppercase;
}

.nuclear-lyric-chip.section::before {
  content: "\269B";
  color: #ffd16a;
}

.nuclear-lyric-chip.title {
  max-width: min(350px, calc(100% - 18px));
  padding: 11px 12px 12px 34px;
  border-color: rgba(255, 255, 255, .74);
  border-left-color: #fff;
  background: linear-gradient(90deg, rgba(12, 32, 24, .98), rgba(7, 72, 60, .82));
  color: #fff;
  font-size: 15px;
  font-weight: bold;
  line-height: 1.2;
  text-transform: uppercase;
  box-shadow: 0 0 26px rgba(80, 214, 176, .42), inset 0 0 20px rgba(255, 255, 255, .1);
  animation-name: nuclearTitleFloat;
}

.nuclear-lyric-chip.title::before {
  content: "SND";
  left: 7px;
  top: 10px;
  color: #ffd16a;
  font-size: 10px;
  letter-spacing: .08em;
}

.nuclear-lyric-chip.title::after {
  color: rgba(255, 209, 106, .72);
  font-size: 9px;
}
@keyframes nuclearLyricFall {
  0% {
    opacity: 0;
    transform: translateY(-96px) rotate(var(--rot, -2deg));
  }
  8%, 82% {
    opacity: .95;
  }
  100% {
    opacity: 0;
    transform: translateY(calc(100vh + 130px)) rotate(var(--rot-end, 4deg));
  }
}
@keyframes nuclearTitleFloat {
  0% {
    opacity: 0;
    transform: translateY(-118px) scale(.92) rotate(var(--rot, -1deg));
  }
  10%, 74% {
    opacity: .98;
  }
  100% {
    opacity: 0;
    transform: translateY(calc(100vh + 150px)) scale(1.08) rotate(var(--rot-end, 1deg));
  }
}
.gbtn {
  background: transparent; border: 2px solid #0f8; color: #0f8;
  font-family: 'Courier New', monospace; font-size: 1.1rem;
  padding: 10px 28px; cursor: pointer; margin: 6px; transition: all .15s;
}
.gbtn:hover { background: #0f8; color: #000; }
.gbtn.sec { border-color: #556; color: #889; }
.gbtn.sec:hover { background: #556; color: #fff; }

#loadNote { color: #556; font-size: 0.75rem; margin-top: 12px; }
#overlay.hidden { display: none; }
#hCard { color: #0f8; font-weight: bold; }

.hbtn {
  background: transparent; border: 1px solid #0a4; color: #0a4;
  font-family: 'Courier New', monospace; font-size: 10px;
  padding: 2px 6px; cursor: pointer; vertical-align: middle; margin-left: 5px; line-height: 1;
}
.hbtn:hover { background: #0a4; color: #000; }
.hbtn.muted { border-color: #333; color: #333; }
.hbtn.shield-touch {
  display: none;
  border-color: #24608a;
  color: #5ab8ff;
  min-width: 28px;
  min-height: 26px;
  font-size: 15px;
  padding: 2px 7px;
  touch-action: manipulation;
}
.hbtn.shield-touch:disabled {
  border-color: #1a2630;
  color: #263a48;
  cursor: default;
}
.hbtn.shield-touch:not(:disabled):hover,
.hbtn.shield-touch:not(:disabled):active,
.hbtn.shield-touch.ready {
  background: #4af;
  border-color: #8df;
  color: #001018;
}

@keyframes pulse { from { opacity: .5; } to { opacity: 1; } }

#btnMobileFS {
  position: fixed; bottom: 14px; right: 14px; z-index: 150;
  width: 36px; height: 36px;
  background: rgba(0,16,8,.78); border: 1px solid #0a4; color: #0a4;
  font-size: 20px; border-radius: 7px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  touch-action: manipulation; line-height: 1;
  transition: background .12s, color .12s;
}
#btnMobileFS:hover, #btnMobileFS:active { background: #0a4; color: #000; }

#mobileFSTip {
  position: fixed; bottom: 58px; right: 8px; z-index: 150;
  background: rgba(0,20,10,.92); border: 1px solid #0a4; color: #8fc;
  font-family: 'Courier New', monospace; font-size: 11px; line-height: 1.5;
  padding: 6px 10px; border-radius: 6px; text-align: center;
  opacity: 0; transition: opacity .3s; pointer-events: none;
}

@media (max-width: 720px), (pointer: coarse) {
  #hud {
    padding: 0 8px;
    gap: 6px;
    font-size: 10px;
  }
  #hud > div { white-space: nowrap; }
  .hbtn.shield-touch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 6px;
    right: 8px;
    z-index: 160;
    width: 34px;
    height: 32px;
    margin: 0;
    background: rgba(0,16,24,.92);
  }
  #hShield { display: none; }
  .hbtn { margin-left: 2px; }
  #btnStartMusic {
    display: block;
    top: 50px;
    right: 8px;
    font-size: 9px;
    padding: 4px 7px;
  }
  #btnStartSound {
    display: none;
  }
  #lyricRain {
    top: 44px;
    width: min(48vw, 210px);
    opacity: .72;
  }
  .nuclear-lyric-chip {
    max-width: calc(100% - 18px);
    padding: 6px 8px 7px 24px;
    font-size: 9px;
  }
}
