@font-face {
  font-family: "StrangerThings";
  src: url("assets/fonts/Stranger-Things-Regular.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}

:root {
  --black: #030304;
  --tape-panel: rgba(8, 6, 9, 0.9);
  --red: #e2001a;
  --neon-red: #ff003c;
  --yellow: #ffd66b;
  --cream: #f4e4bc;
  --muted: #8a8087;
  --green: #83e89b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--cream);
  background: #030304;
  font-family: "VT323", "Special Elite", monospace;
  font-size: 19px;
  overflow-x: hidden;
}

.crt-frame {
  position: relative;
  z-index: 0;
  min-height: 100vh;
  isolation: isolate;
}

/* Animated WebP background */

.background-gif {
  position: fixed;
  inset: 0;
  z-index: -4;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(3, 2, 4, 0.42), rgba(13, 3, 8, 0.62)),
    url("assets/backgroundgif.webp");
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

/* Random red lightning overlay */

.lightning {
  position: fixed;
  inset: 0;
  z-index: 7;
  pointer-events: none;
  opacity: 0;
  background: rgba(255, 0, 0, 0.15);
  mix-blend-mode: screen;
}

.lightning.active {
  animation: upsideDownFlash 0.4s ease-out;
}

@keyframes upsideDownFlash {
  0% {
    opacity: 0;
  }

  10% {
    opacity: 1;
    background: rgba(255, 20, 20, 0.4);
  }

  20% {
    opacity: 0.2;
  }

  30% {
    opacity: 0.8;
    background: rgba(255, 0, 0, 0.3);
  }

  50% {
    opacity: 0;
  }

  80% {
    opacity: 0.5;
    background: rgba(200, 0, 0, 0.2);
  }

  100% {
    opacity: 0;
  }
}

.noise {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  opacity: 0.09;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.6'/%3E%3C/svg%3E");
}

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.012) 0,
    rgba(255, 255, 255, 0.012) 1px,
    transparent 2px,
    transparent 4px
  );
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  background: radial-gradient(
    ellipse at center,
    transparent 45%,
    rgba(0, 0, 0, 0.75) 100%
  );
}

.corner-sticker {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 12;
  width: 193px;
  pointer-events: none;
  filter: drop-shadow(0 0 14px rgba(226, 0, 26, 0.55));
  animation: stickerFloat 3s ease-in-out infinite;
}

@keyframes stickerFloat {
  0%,
  100% {
    transform: translateY(0) rotate(-2deg);
  }

  50% {
    transform: translateY(-6px) rotate(2deg);
  }
}

.corner-sticker-top-left {
  top: 14px;
  left: 14px;
  right: auto;
  bottom: auto;
  animation: stickerFloatTopLeft 3s ease-in-out infinite;
}

@keyframes stickerFloatTopLeft {
  0%,
  100% {
    transform: translateY(0) rotate(2deg);
  }

  50% {
    transform: translateY(-6px) rotate(-2deg);
  }
}

.app-shell {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: 100vh;
}

.screen {
  display: none;
  min-height: 100vh;
  padding: 24px;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
}

.screen.active {
  display: flex;
  animation: fadeIn 0.8s ease both;
}

#quest-screen.active {
  align-items: center;
  flex-direction: column;
  padding-top: 10px;
}

#guess-screen.active {
  background: rgba(3, 2, 4, 0.35);
}

.tape-card {
  border: 1px solid rgba(226, 0, 26, 0.4);
  background: var(--tape-panel);
  box-shadow:
    0 0 60px rgba(226, 0, 26, 0.28),
    inset 0 0 40px rgba(0, 0, 0, 0.6);
}

.intro-card,
.final-card,
.guess-card {
  width: min(680px, 100%);
  padding: clamp(28px, 6vw, 70px);
  text-align: center;
}

.glitch-title {
  margin: 18px 0;
  color: var(--red);
  font-family: "StrangerThings", Georgia, serif;
  font-size: clamp(40px, 9vw, 92px);
  line-height: 0.95;
  letter-spacing: 3px;
  text-transform: uppercase;
  animation: titleGlow 2.5s ease-in-out infinite alternate;
}

@keyframes titleGlow {
  from {
    text-shadow:
      0 0 8px var(--neon-red),
      0 0 24px rgba(255, 0, 60, 0.6),
      3px 3px 0 #1a0206;
  }

  to {
    text-shadow:
      0 0 16px var(--neon-red),
      0 0 40px rgba(255, 0, 60, 0.85),
      3px 3px 0 #1a0206;
  }
}

.glitch-title span {
  color: var(--cream);
}

.eyebrow,
.mini-label,
.file-label {
  color: var(--yellow);
  font-family: "VT323", monospace;
  font-size: 13px;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.intro-text,
.final-intro {
  color: var(--muted);
  font-family: "Special Elite", monospace;
  line-height: 1.8;
}

.subject {
  margin: 30px 0;
  color: var(--muted);
  font-family: "VT323", monospace;
  font-size: 20px;
  line-height: 2;
  letter-spacing: 2px;
}

.subject strong {
  color: var(--yellow);
}

.main-button {
  padding: 15px 23px;
  border: 2px solid var(--red);
  color: var(--cream);
  background: rgba(226, 0, 26, 0.12);
  font-family: "VT323", monospace;
  font-size: 20px;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: 0.25s ease;
}

.main-button:hover {
  color: white;
  background: var(--red);
  box-shadow: 0 0 30px rgba(255, 26, 61, 0.75);
  transform: translateY(-2px);
}

.small-note {
  margin-top: 26px;
  color: #6b6066;
  font-family: "Special Elite", monospace;
  font-size: 11px;
}

.floating-music {
  position: fixed;
  top: 18px;
  right: 20px;
  z-index: 13;
}

.icon-button {
  padding: 10px 14px;
  border: 1px solid var(--yellow);
  color: var(--yellow);
  background: rgba(3, 3, 4, 0.85);
  font-size: 16px;
  cursor: pointer;
}

.progress-area {
  position: relative;
  z-index: 3;
  width: min(620px, 92%);
  margin-top: 28px;
  text-align: center;
}

.center-label {
  margin-bottom: 8px;
}

.light-wall,
.guess-light-wall {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px 14px;
  margin: 0;
  padding: 40px 10px 10px;
  list-style: none;
}

.light-wall::before,
.guess-light-wall::before {
  content: "";
  position: absolute;
  top: 18px;
  right: 4%;
  left: 4%;
  z-index: 0;
  height: 2px;
  background: #000;
}

.alphabet-light,
.guess-letter {
  position: relative;
  z-index: 2;
  display: inline-flex;
  width: 20px;
  height: 20px;
  margin-top: 22px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  background: #222;
  box-shadow:
    inset 0 0 3px rgba(0, 0, 0, 0.7),
    0 1px 2px rgba(0, 0, 0, 0.6);
  font: bold 10px "VT323", monospace;
  transition: background 0.4s ease, color 0.4s ease, box-shadow 0.4s ease;
}

.alphabet-light::before,
.guess-letter::before {
  content: "";
  position: absolute;
  top: -14px;
  left: 50%;
  z-index: 1;
  width: 2px;
  height: 14px;
  background: #000;
  transform: translateX(-50%);
}

.alphabet-light::after,
.guess-letter::after {
  content: "";
  position: absolute;
  top: -3px;
  left: 50%;
  z-index: 2;
  width: 8px;
  height: 6px;
  border-radius: 2px;
  background: #1a1a1a;
  transform: translateX(-50%);
}

.alphabet-light.lit,
.guess-letter.lit {
  color: #000;
  animation: bulbFlash 1.5s infinite alternate;
}

.alphabet-light.lit[data-color="red"],
.guess-letter.lit[data-color="red"] {
  background: #ff3333;
  box-shadow: 0 0 10px #ff3333, 0 0 4px rgba(255, 255, 255, 0.5) inset;
}

.alphabet-light.lit[data-color="yellow"],
.guess-letter.lit[data-color="yellow"] {
  background: #ffff33;
  box-shadow: 0 0 10px #ffff33, 0 0 4px rgba(255, 255, 255, 0.5) inset;
}

.alphabet-light.lit[data-color="green"],
.guess-letter.lit[data-color="green"] {
  background: #33ff33;
  box-shadow: 0 0 10px #33ff33, 0 0 4px rgba(255, 255, 255, 0.5) inset;
}

.alphabet-light.lit[data-color="blue"],
.guess-letter.lit[data-color="blue"] {
  background: #00ffff;
  box-shadow: 0 0 10px #00ffff, 0 0 4px rgba(255, 255, 255, 0.5) inset;
}

.alphabet-light.lit[data-color="pink"],
.guess-letter.lit[data-color="pink"] {
  background: #ff3fee;
  box-shadow: 0 0 10px #ff3fee, 0 0 4px rgba(255, 255, 255, 0.5) inset;
}

@keyframes bulbFlash {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.35;
    box-shadow: none;
    transform: scale(0.94);
  }

  55% {
    opacity: 0.85;
  }

  60% {
    opacity: 0.25;
  }
}

.progress-track {
  height: 3px;
  background: rgba(255, 255, 255, 0.15);
}

.progress-bar {
  width: 0;
  height: 100%;
  background: var(--red);
  transition: width 0.5s ease;
}

.stage-card {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(300px, 1.1fr);
  width: min(1000px, 100%);
  min-height: 520px;
  margin-top: 20px;
  margin-bottom: 40px;
  transition: 0.7s ease;
}

.stage-card.unlocked {
  border-color: var(--yellow);
  box-shadow: 0 0 70px rgba(255, 214, 107, 0.35);
}

.image-frame {
  position: relative;
  min-height: 300px;
  overflow: hidden;
  background: linear-gradient(145deg, #270812, #08080d);
}

.image-frame img {
  width: 100%;
  height: 100%;
  min-height: 300px;
  object-fit: cover;
  opacity: 0.75;
  transition: 1s ease;
}

.stage-card.unlocked .image-frame img {
  opacity: 1;
  transform: scale(1.03);
}

.image-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(3, 3, 4, 0.85));
}

.stage-card.steve-message .image-frame img {
  opacity: 1;
  filter: brightness(1.28) contrast(1.08) saturate(1.1);
}

.stage-card.steve-message .image-overlay {
  background: linear-gradient(
    90deg,
    rgba(3, 3, 4, 0.02),
    rgba(3, 3, 4, 0.18)
  );
}

.stage-card.steve-message.unlocked .image-frame img {
  opacity: 1;
  filter: brightness(1.28) contrast(1.08) saturate(1.1);
}

.file-label {
  position: absolute;
  bottom: 18px;
  left: 18px;
}

.stage-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(25px, 5vw, 60px);
}

.stage-content .glitch-title {
  margin: 8px 0 20px;
  font-size: clamp(30px, 5vw, 50px);
}

.stage-prompt {
  color: var(--cream);
  font-family: "Special Elite", monospace;
  font-size: 19px;
  line-height: 1.6;
  white-space: pre-line;
}
.stage-prompt.success-message {
  color: var(--yellow);
  text-shadow: 0 0 10px rgba(255, 214, 107, 0.25);
  animation: messageReveal 0.7s ease both;
}

.question-area,
.message-area {
  margin-top: 24px;
}

input {
  width: 100%;
  margin-bottom: 12px;
  padding: 15px;
  border: 1px solid rgba(226, 0, 26, 0.5);
  outline: none;
  color: var(--cream);
  background: rgba(0, 0, 0, 0.5);
  font-family: "VT323", monospace;
  font-size: 18px;
}

input:focus {
  border-color: var(--yellow);
  box-shadow: 0 0 15px rgba(255, 214, 107, 0.2);
}

.text-button {
  display: block;
  margin: 17px auto 0;
  padding: 0;
  border: 0;
  color: var(--yellow);
  background: transparent;
  font-family: "VT323", monospace;
  font-size: 14px;
  letter-spacing: 1px;
  cursor: pointer;
}

.hint-text {
  color: var(--green);
  font-family: "Special Elite", monospace;
  font-size: 13px;
  line-height: 1.5;
}

.feedback {
  min-height: 20px;
  font-family: "VT323", monospace;
  font-size: 15px;
}

.feedback.success {
  color: var(--green);
}

.feedback.error {
  color: var(--neon-red);
}

.personal-message {
  margin-top: 24px;
  padding: 22px;
  border-left: 2px solid var(--yellow);
  color: var(--cream);
  background: rgba(255, 214, 107, 0.06);
  font-family: "Special Elite", monospace;
  line-height: 1.8;
  white-space: pre-line;
  animation: messageReveal 1s ease both;
}

#continue-button {
  margin-top: 26px;
}

.poem-container {
  margin-top: 35px;
  text-align: left;
  animation: messageReveal 1s ease both;
}

.poem-container h2 {
  color: var(--yellow);
  font-family: "StrangerThings", Georgia, serif;
  letter-spacing: 2px;
  text-align: center;
}

.poem-text {
  padding: 25px;
  border: 1px solid rgba(255, 214, 107, 0.3);
  color: var(--cream);
  background: rgba(255, 255, 255, 0.04);
  font-family: "Special Elite", monospace;
  line-height: 2;
  white-space: pre-line;
}

.final-signature {
  margin-top: 28px;
  color: var(--yellow);
  font-family: "VT323", monospace;
  font-size: 20px;
  line-height: 1.8;
}

.guess-input-area {
  position: relative;
  z-index: 2;
  margin-top: 24px;
}

.hidden {
  display: none !important;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes messageReveal {
  from {
    opacity: 0;
    filter: blur(8px);
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
}

@media (max-width: 720px) {
  .screen {
    padding: 16px;
  }

  .progress-area {
    margin-top: 60px;
  }

  .stage-card {
    display: block;
    margin-top: 20px;
  }

  .image-frame {
    height: 280px;
  }

  .stage-content {
    padding: 28px 22px 35px;
  }

  .light-wall,
  .guess-light-wall {
    gap: 12px 8px;
    padding: 32px 6px 6px;
  }

  .alphabet-light,
  .guess-letter {
    width: 16px;
    height: 16px;
    margin-top: 18px;
    font-size: 8px;
  }

  .glitch-title {
    font-size: 44px;
  }

  .corner-sticker {
    right: 10px;
    bottom: 10px;
    width: 123px;
  }

  .corner-sticker-top-left {
    top: 10px;
    left: 10px;
    right: auto;
    bottom: auto;
  }
}