:root {
  --signal: #39ff7d;
  --signal-soft: rgba(57, 255, 125, 0.62);
  --signal-faint: rgba(57, 255, 125, 0.2);
  --ink: #e8fff0;
  --void: #010805;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--void);
}

body {
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
}

button,
input {
  font: inherit;
}

.matrix-shell {
  position: relative;
  display: grid;
  width: 100vw;
  height: 100svh;
  min-height: 520px;
  place-items: center;
  isolation: isolate;
  overflow: hidden;
  background: var(--void);
}

.matrix-canvas,
.matrix-vignette,
.scanlines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.matrix-canvas {
  z-index: -3;
  opacity: 0.83;
}

.matrix-vignette {
  z-index: -2;
  background:
    radial-gradient(
      circle at center,
      rgba(1, 8, 5, 0.08) 0%,
      rgba(1, 8, 5, 0.31) 48%,
      rgba(1, 8, 5, 0.92) 100%
    ),
    linear-gradient(
      90deg,
      rgba(1, 8, 5, 0.5) 0%,
      transparent 22%,
      transparent 78%,
      rgba(1, 8, 5, 0.5) 100%
    );
}

.scanlines {
  z-index: -1;
  pointer-events: none;
  opacity: 0.16;
  background-image: linear-gradient(
    to bottom,
    transparent 0,
    transparent 3px,
    rgba(155, 255, 194, 0.18) 4px
  );
  background-size: 100% 4px;
}

.command-panel {
  width: min(720px, calc(100vw - 40px));
  padding: 30px;
  border: 1px solid rgba(84, 255, 148, 0.35);
  background: rgba(1, 10, 6, 0.78);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.72),
    0 0 70px rgba(22, 255, 107, 0.1),
    inset 0 0 42px rgba(13, 255, 102, 0.035);
  backdrop-filter: blur(9px);
  animation: signal-lock 500ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.command-panel.signal-refresh {
  animation: signal-lock 500ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.system-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 54px;
  color: var(--signal-soft);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 12px var(--signal);
  animation: status-blink 1.8s steps(2, end) infinite;
}

.system-separator {
  opacity: 0.45;
}

h1 {
  max-width: 100%;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: clamp(2rem, 7vw, 5rem);
  font-weight: 560;
  letter-spacing: -0.07em;
  line-height: 0.94;
  text-shadow:
    0 0 12px rgba(166, 255, 201, 0.58),
    0 0 40px rgba(57, 255, 125, 0.2);
}

.instruction {
  max-width: 480px;
  margin: 22px 0 38px;
  color: rgba(207, 255, 224, 0.6);
  font-size: 12px;
  line-height: 1.6;
}

.signal-form {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  min-height: 58px;
  border-top: 1px solid var(--signal-faint);
  border-bottom: 1px solid var(--signal-faint);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.signal-form:focus-within {
  border-color: rgba(57, 255, 125, 0.72);
  box-shadow: 0 12px 24px -18px rgba(57, 255, 125, 0.5);
}

.prompt-mark {
  padding-right: 12px;
  color: var(--signal);
  font-size: 20px;
  text-shadow: 0 0 10px rgba(57, 255, 125, 0.7);
}

.signal-form input {
  width: 100%;
  min-width: 0;
  padding: 18px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  caret-color: var(--signal);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.signal-form input::placeholder {
  color: rgba(145, 205, 166, 0.4);
}

.signal-form button {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-left: 16px;
  padding: 10px 0 10px 18px;
  border: 0;
  border-left: 1px solid var(--signal-faint);
  background: transparent;
  color: var(--signal);
  cursor: pointer;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  transition:
    color 140ms ease,
    text-shadow 140ms ease;
}

.signal-form button:hover,
.signal-form button:focus-visible {
  color: var(--ink);
  outline: none;
  text-shadow: 0 0 12px var(--signal);
}

.signal-form button span {
  font-size: 16px;
}

.signal-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
  color: rgba(91, 220, 136, 0.42);
  font-size: 9px;
  letter-spacing: 0.12em;
}

.corner {
  position: absolute;
  color: rgba(100, 255, 157, 0.38);
  font-size: 9px;
  letter-spacing: 0.14em;
}

.corner-top-left {
  top: 24px;
  left: 26px;
}

.corner-top-right {
  top: 24px;
  right: 26px;
}

.corner-bottom-left {
  bottom: 24px;
  left: 26px;
}

.corner-bottom-right {
  right: 26px;
  bottom: 24px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes signal-lock {
  0% {
    opacity: 0.35;
    transform: translateY(5px) scale(0.995);
    filter: brightness(1.8);
  }
  45% {
    opacity: 1;
  }
  100% {
    transform: translateY(0) scale(1);
    filter: brightness(1);
  }
}

@keyframes status-blink {
  50% {
    opacity: 0.35;
  }
}

@media (max-width: 640px) {
  .matrix-shell {
    min-height: 460px;
  }

  .command-panel {
    width: calc(100vw - 24px);
    padding: 22px 20px;
  }

  .system-line {
    margin-bottom: 40px;
  }

  h1 {
    font-size: clamp(2rem, 13vw, 3.8rem);
  }

  .instruction {
    margin-bottom: 28px;
  }

  .signal-form {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .signal-form button {
    grid-column: 1 / -1;
    justify-content: flex-end;
    width: 100%;
    min-height: 44px;
    margin: 0;
    padding: 8px 0;
    border-top: 1px solid var(--signal-faint);
    border-left: 0;
  }

  .signal-meta span:last-child {
    display: none;
  }

  .corner {
    display: none;
  }
}

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