:root {
  --bg: #030108;
  --cyan: #00f7ff;
  --pink: #ff2bd6;
  --purple: #8b3dff;
  --text: #f9f4ff;
  --muted: #8b8399;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Share Tech Mono", monospace;
}

body {
  position: relative;
}

#matrix {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 50% 42%, rgba(139, 61, 255, 0.12), transparent 30%),
    linear-gradient(180deg, #05030b 0%, #020105 100%);
}

.scanlines,
.noise,
.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.scanlines {
  z-index: 4;
  opacity: 0.18;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.035) 0,
    rgba(255, 255, 255, 0.035) 1px,
    transparent 1px,
    transparent 4px
  );
  animation: scanMove 8s linear infinite;
}

.noise {
  z-index: 3;
  opacity: 0.045;
  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='.95' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.9'/%3E%3C/svg%3E");
  animation: noiseShift 0.22s steps(2) infinite;
}

.vignette {
  z-index: 5;
  box-shadow: inset 0 0 180px 60px rgba(0, 0, 0, 0.85);
}

.screen {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  isolation: isolate;
}

.screen::before {
  content: "";
  position: absolute;
  inset: 22px;
  border: 1px solid rgba(255, 43, 214, 0.45);
  clip-path: polygon(0 20px, 20px 0, calc(100% - 20px) 0, 100% 20px, 100% calc(100% - 20px), calc(100% - 20px) 100%, 20px 100%, 0 calc(100% - 20px));
  box-shadow: 0 0 16px rgba(255, 43, 214, 0.12), inset 0 0 16px rgba(0, 247, 255, 0.08);
  pointer-events: none;
}

.hud {
  position: fixed;
  left: 42px;
  right: 42px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  z-index: 12;
}

.hud-top { top: 34px; }
.hud-bottom { bottom: 34px; }

.intro,
.message {
  width: min(900px, 92vw);
  text-align: center;
}

.intro {
  animation: floatIn 1.4s ease both;
}

.signal {
  width: 8px;
  height: 8px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: var(--pink);
  box-shadow: 0 0 8px var(--pink), 0 0 24px var(--pink), 0 0 48px var(--purple);
  animation: pulse 1.4s infinite;
}

.eyebrow,
.hint,
.status {
  margin: 0;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.eyebrow {
  color: var(--cyan);
  font-size: clamp(0.75rem, 1.4vw, 1rem);
  text-shadow: 0 0 10px rgba(0, 247, 255, 0.8);
}

.hint {
  margin-top: 20px;
  color: var(--muted);
  font-size: 0.68rem;
}

.reveal-button {
  position: relative;
  margin-top: 34px;
  min-width: min(360px, 82vw);
  padding: 18px 28px;
  color: white;
  background: rgba(8, 4, 18, 0.72);
  border: 1px solid rgba(0, 247, 255, 0.75);
  font-family: "Orbitron", sans-serif;
  font-size: clamp(0.85rem, 2vw, 1.05rem);
  letter-spacing: 0.17em;
  cursor: pointer;
  text-transform: uppercase;
  clip-path: polygon(0 12px, 12px 0, calc(100% - 12px) 0, 100% 12px, 100% calc(100% - 12px), calc(100% - 12px) 100%, 12px 100%, 0 calc(100% - 12px));
  box-shadow: 0 0 18px rgba(0, 247, 255, 0.12), inset 0 0 18px rgba(255, 43, 214, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.reveal-button::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(0, 247, 255, 0.2), transparent);
  transform: translateX(-110%);
  transition: transform 0.55s ease;
}

.reveal-button:hover,
.reveal-button:focus-visible {
  outline: none;
  transform: translateY(-2px) scale(1.01);
  color: var(--cyan);
  box-shadow: 0 0 26px rgba(0, 247, 255, 0.28), 0 0 38px rgba(255, 43, 214, 0.12);
}

.reveal-button:hover::before,
.reveal-button:focus-visible::before {
  transform: translateX(110%);
}

.button-text {
  position: relative;
  z-index: 1;
}

.message {
  display: none;
  opacity: 0;
}

.message.visible {
  display: block;
  animation: messageReveal 0.95s cubic-bezier(.2,.9,.2,1) forwards;
}

.status {
  color: var(--cyan);
  font-size: 0.78rem;
  text-shadow: 0 0 10px rgba(0, 247, 255, 0.8);
}

.glitch {
  position: relative;
  margin: 18px 0 4px;
  font-family: "Orbitron", sans-serif;
  font-size: clamp(4rem, 17vw, 11rem);
  line-height: 0.95;
  letter-spacing: 0.07em;
  color: white;
  text-shadow:
    -3px 0 var(--pink),
    3px 0 var(--cyan),
    0 0 18px rgba(255, 255, 255, 0.55),
    0 0 50px rgba(255, 43, 214, 0.45);
  animation: mainGlitch 4.5s infinite;
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.glitch::before {
  color: var(--pink);
  clip-path: inset(0 0 55% 0);
  transform: translate(-4px, -1px);
  opacity: 0.8;
  animation: glitchTop 2.8s infinite linear alternate-reverse;
}

.glitch::after {
  color: var(--cyan);
  clip-path: inset(58% 0 0 0);
  transform: translate(4px, 1px);
  opacity: 0.8;
  animation: glitchBottom 2.3s infinite linear alternate-reverse;
}

.main-text {
  margin: 12px 0 28px;
  font-family: "Orbitron", sans-serif;
  font-size: clamp(1rem, 3.2vw, 2rem);
  letter-spacing: 0.18em;
  line-height: 1.5;
  color: #ffeefe;
  text-shadow: 0 0 8px rgba(255, 43, 214, 0.8), 0 0 24px rgba(139, 61, 255, 0.65);
}

.terminal {
  min-height: 48px;
  color: var(--cyan);
  font-size: clamp(0.72rem, 1.6vw, 0.95rem);
  letter-spacing: 0.08em;
  text-align: left;
  width: min(560px, 88vw);
  margin: 0 auto;
  border-left: 2px solid var(--pink);
  padding: 12px 16px;
  background: rgba(0, 247, 255, 0.035);
  box-shadow: inset 0 0 20px rgba(0, 247, 255, 0.05);
}

.reset-button {
  margin-top: 24px;
  padding: 10px 18px;
  color: var(--muted);
  background: transparent;
  border: 1px solid rgba(139, 61, 255, 0.55);
  font: inherit;
  letter-spacing: 0.12em;
  cursor: pointer;
  opacity: 0;
  animation: resetFade 0.6s 2.4s forwards;
}

.reset-button:hover {
  color: white;
  border-color: var(--pink);
}

.flash {
  animation: screenFlash 0.55s ease;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.55); opacity: 1; }
}

@keyframes floatIn {
  from { opacity: 0; transform: translateY(18px); filter: blur(5px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

@keyframes messageReveal {
  0% { opacity: 0; transform: scale(0.93); filter: blur(12px); }
  55% { opacity: 1; filter: blur(0); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes mainGlitch {
  0%, 90%, 100% { transform: translate(0); }
  91% { transform: translate(-2px, 1px); }
  92% { transform: translate(3px, -1px); }
  93% { transform: translate(-1px, 0); }
}

@keyframes glitchTop {
  0%, 85%, 100% { transform: translate(-4px, -1px); }
  86% { transform: translate(6px, 0); }
  88% { transform: translate(-8px, 2px); }
}

@keyframes glitchBottom {
  0%, 82%, 100% { transform: translate(4px, 1px); }
  83% { transform: translate(-7px, 0); }
  86% { transform: translate(9px, -2px); }
}

@keyframes screenFlash {
  0%, 100% { filter: none; }
  25% { filter: brightness(1.9) saturate(1.6); }
  45% { filter: invert(0.1) hue-rotate(22deg); }
}

@keyframes resetFade {
  to { opacity: 1; }
}

@keyframes scanMove {
  from { transform: translateY(0); }
  to { transform: translateY(8px); }
}

@keyframes noiseShift {
  0% { transform: translate(0, 0); }
  25% { transform: translate(1%, -1%); }
  50% { transform: translate(-1%, 1%); }
  75% { transform: translate(1%, 1%); }
  100% { transform: translate(-1%, -1%); }
}

@media (max-width: 640px) {
  .screen { padding: 18px; }
  .screen::before { inset: 10px; }
  .hud { left: 20px; right: 20px; font-size: 0.58rem; }
  .hud-top { top: 18px; }
  .hud-bottom { bottom: 18px; }
  .main-text { letter-spacing: 0.1em; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
