*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  --bg: #07080c;
  --ink: #e7eaf5;
  --muted: #9aa2b3;
  --accent: #5a7bff;
  --glow: rgba(90, 123, 255, 0.35);
  --panel: rgba(14, 16, 24, 0.78);
  --border: rgba(140, 150, 170, 0.08);
  --shadow: rgba(0, 0, 0, 0.55);
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
}

body {
  line-height: 1.6;
  overflow-x: hidden;
}

.skip-link {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(10, 12, 18, 0.9);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-size: 0.75rem;
  letter-spacing: 0.18rem;
  text-transform: uppercase;
  z-index: 2;
  transform: translateY(-200%);
  transition: transform 0.2s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

#test {
  scroll-margin-top: 96px;
}

canvas#veil,
.mist,
.scanlines {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.mist {
  background: radial-gradient(circle at 20% 20%, rgba(52, 77, 140, 0.15), transparent 60%),
    radial-gradient(circle at 80% 30%, rgba(88, 60, 140, 0.18), transparent 55%),
    radial-gradient(circle at 50% 80%, rgba(40, 80, 120, 0.12), transparent 60%);
  animation: drift 18s ease-in-out infinite;
  mix-blend-mode: screen;
}

.scanlines {
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0.35) 1px,
    rgba(0, 0, 0, 0.05) 2px,
    rgba(0, 0, 0, 0) 4px
  );
  opacity: 0.35;
  mix-blend-mode: soft-light;
  animation: scan 18s linear infinite;
}

@keyframes scan {
  0% {
    transform: translate3d(0, 0, 0);
  }
  100% {
    transform: translate3d(3%, 7%, 0);
  }
}

@keyframes drift {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2%);
  }
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 980px;
  margin: 0 auto;
  padding: 6rem 1.5rem 8rem;
  display: grid;
  gap: 4rem;
}

.hero {
  display: grid;
  gap: 1.5rem;
}

.brand-line {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
}

.brand {
  letter-spacing: 0.6rem;
  text-transform: uppercase;
  font-size: 0.85rem;
  color: var(--muted);
}

.tagline {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco,
    Consolas, "Liberation Mono", "Courier New", monospace;
  letter-spacing: 0.3rem;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: var(--muted);
}

h1 {
  font-size: clamp(2.2rem, 4vw, 3.8rem);
  font-weight: 600;
  margin: 0;
}

h1 span {
  display: block;
  color: var(--muted);
  font-weight: 400;
  margin-top: 0.4rem;
}

.whisper {
  color: var(--muted);
  max-width: 680px;
}

.scroll-cue {
  margin-top: 1rem;
  font-size: 0.75rem;
  letter-spacing: 0.24rem;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.7;
  animation: float 2.6s ease-in-out infinite;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  50% {
    transform: translateY(4px);
    opacity: 1;
  }
}

.cta {
  background: linear-gradient(120deg, rgba(90, 123, 255, 0.95), rgba(120, 190, 255, 0.8));
  color: #0b0d14;
  border: none;
  padding: 0.85rem 1.8rem;
  border-radius: 999px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12rem;
  box-shadow: 0 0 22px var(--glow);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.cta:hover,
.cta:focus {
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(120, 190, 255, 0.45);
}

.cta::after {
  content: "";
  position: absolute;
  inset: -40px;
  background: radial-gradient(
    circle at var(--glow-x, 50%) var(--glow-y, 50%),
    rgba(120, 190, 255, 0.22),
    transparent 55%
  );
  opacity: 0;
  transition: opacity 0.2s ease;
  mix-blend-mode: screen;
  pointer-events: none;
}

.cta:hover::after,
.cta:focus::after {
  opacity: 1;
}

.boundary,
.invitation,
.test {
  padding: 0.5rem 0 0;
}

.test {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0.5rem 0 0;
  box-shadow: none;
  backdrop-filter: none;
}

.boundary p,
.invitation p {
  margin: 0 0 0.75rem;
  color: var(--muted);
}

.boundary .emphasis {
  color: var(--ink);
  font-weight: 500;
}

.invitation p:last-child,
.boundary p:last-child {
  margin-bottom: 0;
}

.test-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.test-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.test h2 {
  margin: 0;
  font-size: clamp(1.4rem, 2.4vw, 2rem);
}

.attempts {
  color: var(--muted);
  font-size: 0.9rem;
  letter-spacing: 0.2rem;
  text-transform: uppercase;
}

.brand,
.attempts,
.hint,
.status,
.result-label {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco,
    Consolas, "Liberation Mono", "Courier New", monospace;
}

textarea {
  width: 100%;
  background: rgba(6, 8, 14, 0.65);
  border: 1px solid rgba(140, 150, 170, 0.18);
  border-radius: 18px;
  padding: 1.2rem;
  color: var(--ink);
  font-size: 1rem;
  resize: vertical;
  min-height: 160px;
  outline: none;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

textarea:focus {
  border-color: rgba(120, 190, 255, 0.8);
  box-shadow: 0 0 0 2px rgba(120, 190, 255, 0.2);
}

textarea:focus-visible,
.cta:focus-visible {
  outline: 2px solid rgba(120, 190, 255, 0.7);
  outline-offset: 2px;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.2rem;
}

.status {
  color: var(--muted);
  font-size: 0.95rem;
}

.result {
  margin-top: 2rem;
  padding: 1.8rem;
  border-radius: 18px;
  border: 1px solid rgba(140, 150, 170, 0.1);
  background: rgba(4, 6, 12, 0.7);
  text-align: center;
  font-size: 1.4rem;
  letter-spacing: 0.3rem;
  text-transform: uppercase;
  min-height: 88px;
  display: grid;
  place-items: center;
}

.result-label::after {
  content: "_";
  margin-left: 0.25rem;
  opacity: 0.7;
  animation: blink 1.1s steps(2, start) infinite;
}

@keyframes blink {
  0%,
  50% {
    opacity: 0.7;
  }
  50.01%,
  100% {
    opacity: 0;
  }
}

.result[data-state="yes"] {
  border-color: rgba(120, 255, 190, 0.25);
  color: #bdf7dc;
  box-shadow: 0 0 18px rgba(120, 255, 190, 0.2);
}

.result[data-state="no"] {
  border-color: rgba(255, 120, 150, 0.22);
  color: #f7c4d1;
  box-shadow: 0 0 18px rgba(255, 120, 150, 0.16);
}

.hint {
  margin: 1.4rem 0 0;
  color: var(--muted);
  text-align: center;
  letter-spacing: 0.2rem;
  text-transform: uppercase;
  font-size: 0.75rem;
}

.test.pulse {
  box-shadow: 0 0 40px rgba(120, 190, 255, 0.35);
  transition: box-shadow 0.6s ease-out;
}

.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  color: var(--muted);
  padding: 0 0 3rem;
  letter-spacing: 0.2rem;
  text-transform: uppercase;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.footer-sep {
  opacity: 0.6;
}

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

@media (max-width: 720px) {
  .shell {
    padding: 4rem 1.2rem 6rem;
  }

  .boundary,
  .invitation,
  .test {
    padding: 1.8rem;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .test-meta {
    flex-direction: column;
    align-items: flex-start;
  }
}
