:root {
  --bg: #020702;
  --green: #32ff8a;
  --green-dim: #1f994f;
  --text: #b2ffc9;
  --danger: #ff4967;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Consolas", "Courier New", monospace;
}

body {
  overflow: hidden;
}

#matrixCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.25;
}

#app {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  padding: 20px;
  display: grid;
  place-items: center;
  transition: filter 400ms ease;
}

#app.blurred {
  filter: blur(10px) brightness(0.45);
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
}

.screen.active {
  display: flex;
}

#intro {
  flex-direction: column;
  text-align: center;
  gap: 18px;
  overflow: hidden;
}

#introGhostImage {
  position: absolute;
  inset: auto;
  width: min(42vw, 520px);
  max-height: 72vh;
  object-fit: contain;
  opacity: 0.30;
  filter: grayscale(0.2) contrast(1.05);
  right: 8%;
  bottom: 6%;
  pointer-events: none;
  z-index: 1;
}

.intro-girlfriend {
  position: absolute;
  top: 34px;
  left: 34px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}

.intro-girlfriend p {
  margin: 0;
  color: #ff9aa7;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-shadow: 0 0 10px rgba(255, 73, 103, 0.7);
}

.intro-girlfriend img {
  width: min(42vw, 520px);
  max-height: 72vh;
  object-fit: contain;
  opacity: 0.30;
  border: none;
  background: transparent;
}

.topline {
  margin: 0;
  font-size: clamp(1rem, 2vw, 1.4rem);
  letter-spacing: 1px;
  text-shadow: 0 0 8px var(--green-dim);
}

h1 {
  margin: 0;
  font-size: clamp(2.4rem, 8vw, 6.3rem);
  color: var(--green);
  letter-spacing: 3px;
  text-shadow: 0 0 24px rgba(50, 255, 138, 0.6);
}

#intro .topline,
#intro h1,
#intro #startBtn {
  position: relative;
  z-index: 2;
}

#startBtn {
  border: 2px solid var(--green);
  background: rgba(0, 0, 0, 0.55);
  color: var(--green);
  padding: 12px 34px;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 170ms ease;
}

#startBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 16px rgba(50, 255, 138, 0.5);
}

#viewer {
  gap: 14px;
  padding: 24px;
}

#viewer.impact {
  animation: hit-shake 180ms ease;
}

.lyrics-box {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 7;
  width: min(72vw, 820px);
  text-align: center;
  padding: 10px 14px;
  border: 1px solid rgba(50, 255, 138, 0.5);
  background: rgba(0, 0, 0, 0.55);
  text-shadow: 0 0 10px rgba(50, 255, 138, 0.45);
}

.lyrics-current {
  position: relative;
  display: inline-block;
  font-size: clamp(1rem, 1.9vw, 1.35rem);
  font-weight: 700;
  letter-spacing: 0.5px;
  min-height: 1.6em;
  line-height: 1.4;
  text-align: center;
  transition: transform 180ms ease, opacity 180ms ease;
}

.lyrics-current.beat {
  transform: scale(1.03);
}

.lyrics-base,
.lyrics-fill {
  display: inline-block;
  white-space: nowrap;
}

.lyrics-base {
  display: none;
}

.lyrics-fill {
  position: static;
  color: var(--green);
  overflow: visible;
  width: auto;
  text-shadow: 0 0 16px rgba(50, 255, 138, 0.82);
}

.image-wrap {
  margin: 0;
  width: min(82vw, 1100px);
  height: min(78vh, 760px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(50, 255, 138, 0.7);
  background: rgba(0, 0, 0, 0.45);
  box-shadow: 0 0 28px rgba(50, 255, 138, 0.2);
  backdrop-filter: blur(1px);
  position: relative;
  overflow: hidden;
}

#galleryImage {
  width: 100%;
  height: calc(100% - 48px);
  object-fit: contain;
  border-bottom: 1px solid rgba(50, 255, 138, 0.35);
  transition: transform 320ms ease, opacity 320ms ease, filter 220ms ease;
}

#galleryImage.slide-out-left {
  transform: translateX(-80px);
  opacity: 0;
}

#galleryImage.slide-out-right {
  transform: translateX(80px);
  opacity: 0;
}

#galleryImage.slide-in-left {
  transform: translateX(-80px);
  opacity: 0;
}

#galleryImage.slide-in-right {
  transform: translateX(80px);
  opacity: 0;
}

#galleryImage.glitch {
  filter: contrast(1.25) saturate(1.35) hue-rotate(-16deg);
}

#galleryImage.rgb-split {
  filter: contrast(1.35) saturate(1.45) hue-rotate(-24deg) drop-shadow(-2px 0 rgba(255, 0, 0, 0.45))
    drop-shadow(2px 0 rgba(0, 220, 255, 0.45));
}

#counter {
  margin-top: 10px;
  color: var(--green);
  font-size: 1rem;
}

#glitchOverlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  z-index: 3;
}

#glitchOverlay.active {
  opacity: 0.38;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.22) 0 2px,
    rgba(0, 0, 0, 0.08) 2px 4px
  );
  animation: glitch-flicker 90ms steps(2, end) infinite;
}

#glitchOverlay.active::before,
#glitchOverlay.active::after {
  content: "";
  position: absolute;
  inset: 0;
  mix-blend-mode: screen;
  pointer-events: none;
}

#glitchOverlay.active::before {
  background: linear-gradient(90deg, rgba(255, 0, 70, 0.18), transparent 45%, rgba(0, 255, 200, 0.15));
  transform: translateX(-3px);
}

#glitchOverlay.active::after {
  background: linear-gradient(180deg, rgba(0, 255, 140, 0.12), transparent 50%, rgba(255, 255, 255, 0.08));
  transform: translateX(3px);
}

@keyframes glitch-flicker {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-3px, 1px); }
  50% { transform: translate(2px, -1px); }
  75% { transform: translate(1px, 2px); }
  100% { transform: translate(0, 0); }
}

@keyframes hit-shake {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-3px, 1px); }
  50% { transform: translate(3px, -1px); }
  75% { transform: translate(-2px, 0); }
  100% { transform: translate(0, 0); }
}

.music-panel {
  position: absolute;
  top: 14px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 6;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(50, 255, 138, 0.55);
  padding: 7px 10px;
}

#musicToggle {
  border: 1px solid var(--green);
  background: #020a03;
  color: var(--green);
  padding: 5px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
}

.music-panel label {
  font-size: 0.76rem;
  color: var(--green);
}

#musicVolume {
  width: 90px;
  accent-color: var(--green);
}

.nav {
  border: 2px solid var(--green);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: var(--green);
  font-size: 1.8rem;
  cursor: pointer;
  transition: transform 130ms ease, box-shadow 130ms ease;
}

.nav:hover {
  transform: scale(1.08);
  box-shadow: 0 0 14px rgba(50, 255, 138, 0.45);
}

.parental-advisory {
  position: fixed;
  right: 14px;
  bottom: 12px;
  z-index: 5;
  width: 150px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(0, 0, 0, 0.65));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  opacity: 0.08;
  background: radial-gradient(circle at center, transparent 45%, rgba(0, 0, 0, 0.75) 100%);
}

.age-gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
}

.age-gate.active {
  display: flex;
}

.age-card {
  width: min(92vw, 420px);
  border: 2px solid rgba(50, 255, 138, 0.8);
  background: rgba(0, 0, 0, 0.88);
  padding: 22px 20px;
  text-align: center;
  box-shadow: 0 0 24px rgba(50, 255, 138, 0.2);
}

.age-card h2 {
  margin: 0 0 10px;
  color: var(--green);
  letter-spacing: 2px;
}

.age-card p {
  margin: 0 0 16px;
}

.age-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.age-actions button {
  min-width: 116px;
  border: 2px solid var(--green);
  background: rgba(0, 0, 0, 0.55);
  color: var(--green);
  padding: 12px 18px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 170ms ease;
}

.age-actions button:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 16px rgba(50, 255, 138, 0.5);
}

@media (max-width: 800px) {
  #viewer {
    gap: 8px;
  }

  .nav {
    width: 46px;
    height: 46px;
    font-size: 1.4rem;
  }

  .image-wrap {
    width: 88vw;
    height: 72vh;
  }

  .music-panel {
    top: 12px;
    right: 12px;
    padding: 6px 7px;
    gap: 6px;
  }

  .lyrics-box {
    top: 12px;
    width: min(88vw, 700px);
    padding: 8px 10px;
  }

  #musicVolume {
    width: 64px;
  }
}
