:root {
  --night: #060a11;
  --night-raised: #090d14;
  --ink: #eef7f0;
  --muted: #9ea9a7;
  --signal-red: #ff7350;
  --acid-green: #d7ff4f;
  --accent: var(--signal-red);
  --accent-rgb: 255, 115, 80;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Monaco, Consolas,
    "Liberation Mono", monospace;
  color-scheme: dark;
  font-family: var(--mono);
  background: var(--night);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--night);
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, #0d1724 0%, transparent 48%),
    radial-gradient(circle at 78% 12%, #24131a 0%, transparent 31%),
    radial-gradient(circle at 12% 88%, #161d1c 0%, transparent 30%),
    var(--night);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.auth-shell {
  --accent: var(--signal-red);
  --accent-rgb: 255, 115, 80;
  isolation: isolate;
  position: relative;
  width: min(1080px, 100%);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: clamp(38px, 7vh, 78px) clamp(20px, 5vw, 64px) 56px;
  overflow: hidden;
}

.auth-shell::before,
.auth-shell::after {
  content: "";
  pointer-events: none;
  position: fixed;
  z-index: -1;
}

.auth-shell::before {
  inset: 0;
  opacity: 0.68;
  background:
    repeating-linear-gradient(
      0deg,
      transparent 0 8px,
      rgba(var(--accent-rgb), 0.036) 8px 9px
    ),
    radial-gradient(circle at 50% 22%, rgba(var(--accent-rgb), 0.075), transparent 32%);
  transition: background 650ms ease;
}

.auth-shell::after {
  top: -100%;
  right: 0;
  left: 0;
  height: 100%;
  opacity: 0.55;
  background: linear-gradient(
    transparent 48%,
    rgba(var(--accent-rgb), 0.08) 50%,
    transparent 52%
  );
  animation: scan 7s linear infinite;
}

.auth-shell.is-complete {
  --accent: var(--acid-green);
  --accent-rgb: 215, 255, 79;
}

.radar-ring {
  pointer-events: none;
  position: absolute;
  z-index: -1;
  top: -360px;
  left: 50%;
  width: 740px;
  aspect-ratio: 1;
  border: 1px dashed rgba(var(--accent-rgb), 0.19);
  border-radius: 50%;
  box-shadow:
    0 0 90px rgba(var(--accent-rgb), 0.035),
    inset 0 0 80px rgba(0, 0, 0, 0.42);
  transform: translateX(-50%);
  animation: radar-spin 38s linear infinite;
}

.radar-ring::before,
.radar-ring::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(var(--accent-rgb), 0.075);
  border-radius: inherit;
}

.radar-ring::before {
  inset: 12%;
}

.radar-ring::after {
  inset: 27%;
}

.auth-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 150px;
  text-align: center;
}

.delta-mark {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin: 8px 0 36px;
  color: var(--accent);
  border: 2px solid var(--accent);
  background: rgba(6, 10, 17, 0.9);
  box-shadow:
    0 0 34px rgba(var(--accent-rgb), 0.17),
    inset 0 0 22px rgba(var(--accent-rgb), 0.035);
  transform: rotate(45deg);
  transition: color 650ms ease, border-color 650ms ease, box-shadow 650ms ease;
  animation: signal-flicker 4.6s steps(1, end) infinite;
}

.delta-mark::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(var(--accent-rgb), 0.13);
}

.delta-mark span {
  font: 900 32px/1 Arial, sans-serif;
  transform: rotate(-45deg);
}

.status-line {
  min-height: 1.4em;
  margin: 0 0 clamp(30px, 5vh, 48px);
  color: var(--accent);
  font-size: clamp(0.82rem, 1.65vw, 0.96rem);
  font-weight: 700;
  letter-spacing: 0.105em;
  line-height: 1.5;
  text-transform: uppercase;
  transition: color 650ms ease;
}

.vector-panel {
  position: relative;
  border-top: 1px solid rgba(var(--accent-rgb), 0.32);
  border-bottom: 1px solid rgba(var(--accent-rgb), 0.32);
  background:
    linear-gradient(90deg, rgba(5, 9, 16, 0.92), rgba(5, 9, 16, 0.62) 50%, rgba(5, 9, 16, 0.92));
  box-shadow: 0 0 70px rgba(var(--accent-rgb), 0.025);
  transition: border-color 650ms ease, box-shadow 650ms ease;
}

.panel-heading,
.vector-row {
  display: grid;
  grid-template-columns: 132px minmax(120px, 1fr) minmax(120px, 1fr) 224px;
  gap: 14px;
  align-items: center;
}

.panel-heading {
  min-height: 38px;
  padding: 0 16px;
  color: rgba(238, 247, 240, 0.45);
  border-bottom: 1px solid rgba(var(--accent-rgb), 0.14);
  font-size: 0.61rem;
  font-weight: 750;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.vector-row {
  position: relative;
  min-height: 72px;
  padding: 11px 16px;
  border-bottom: 1px solid rgba(var(--accent-rgb), 0.105);
  transition: background 220ms ease, border-color 650ms ease;
}

.vector-row:last-child {
  border-bottom: 0;
}

.vector-row:focus-within {
  background: rgba(var(--accent-rgb), 0.027);
}

.vector-label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
}

.vector-label span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.vector-label strong {
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.2rem;
  font-weight: 850;
  letter-spacing: -0.04em;
}

.component-field {
  position: relative;
  min-width: 0;
}

.component-input {
  width: 100%;
  height: 45px;
  padding: 0 14px;
  color: var(--ink);
  caret-color: var(--accent);
  border: 1px solid rgba(var(--accent-rgb), 0.44);
  border-radius: 0;
  outline: 0;
  background: rgba(1, 4, 8, 0.64);
  box-shadow: inset 0 -3px 0 rgba(var(--accent-rgb), 0.045);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  transition:
    color 240ms ease,
    border-color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease;
}

.component-input::placeholder {
  color: rgba(238, 247, 240, 0.34);
}

.component-input:hover {
  border-color: rgba(var(--accent-rgb), 0.7);
}

.component-input:focus {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.045);
  box-shadow:
    inset 0 -3px 0 rgba(var(--accent-rgb), 0.12),
    0 0 22px rgba(var(--accent-rgb), 0.07);
}

.row-action {
  display: grid;
  align-items: center;
  height: 45px;
}

.row-action > * {
  grid-area: 1 / 1;
}

.submit-vector,
.mission-button {
  cursor: pointer;
  border: 1px solid var(--accent);
  border-radius: 0;
  outline: 0;
  background: rgba(var(--accent-rgb), 0.045);
  box-shadow:
    inset 0 -4px 0 rgba(var(--accent-rgb), 0.12),
    0 0 24px rgba(var(--accent-rgb), 0.04);
  color: var(--accent);
  font-size: 0.67rem;
  font-weight: 850;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  transition:
    opacity 180ms ease,
    transform 180ms ease,
    color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.submit-vector {
  width: 100%;
  height: 45px;
  opacity: 0;
  pointer-events: none;
  transform: translateX(7px);
}

.vector-row.is-ready .submit-vector {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.vector-row.is-ready .submit-vector:focus-visible,
.mission-button:focus-visible {
  outline: 1px dashed var(--accent);
  outline-offset: 6px;
}

.submit-vector:hover,
.mission-button:hover {
  color: var(--night);
  background: var(--accent);
  box-shadow: 0 0 28px rgba(var(--accent-rgb), 0.16);
}

.vector-row.is-submitting .submit-vector {
  cursor: wait;
  opacity: 0.45;
}

.vector-row.is-solved {
  background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb), 0.028), transparent);
}

.vector-row.is-solved .vector-label strong,
.vector-row.is-solved .component-input {
  color: var(--accent);
}

.vector-row.is-solved .component-input {
  cursor: default;
  pointer-events: none;
  user-select: none;
  caret-color: transparent;
  border-color: rgba(var(--accent-rgb), 0.26);
  background: rgba(var(--accent-rgb), 0.025);
  box-shadow: none;
}

.format-invalid,
.solved-meta {
  width: 100%;
  margin: 0;
  color: var(--accent);
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.045em;
  line-height: 1.55;
  text-align: left;
  text-transform: uppercase;
}

.format-invalid {
  letter-spacing: 0.14em;
}

.format-invalid[hidden],
.solved-meta[hidden] {
  display: none;
}

.solved-meta {
  display: flex;
  height: 45px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  justify-self: start;
  white-space: nowrap;
}

.solved-meta::before {
  content: "Authenticated";
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 0.6rem;
  letter-spacing: 0.15em;
}

.mission-footer {
  display: flex;
  justify-content: center;
  padding-top: 38px;
}

.mission-footer[hidden] {
  display: none;
}

.mission-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  min-width: 260px;
  min-height: 52px;
  padding: 0 20px;
  animation: mission-arrive 520ms ease-out both;
}

.noscript-message {
  color: var(--signal-red);
  text-align: center;
}

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

@keyframes scan {
  to { transform: translateY(200%); }
}

@keyframes radar-spin {
  from { transform: translateX(-50%) rotate(0); }
  to { transform: translateX(-50%) rotate(360deg); }
}

@keyframes signal-flicker {
  0%, 91%, 94%, 100% { opacity: 1; }
  92% { opacity: 0.58; }
  93% { opacity: 0.84; }
}

@keyframes mission-arrive {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 800px) {
  .auth-shell {
    padding-inline: 16px;
  }

  .panel-heading {
    display: none;
  }

  .vector-row {
    grid-template-columns: 104px minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
    padding-block: 14px;
  }

  .row-action {
    grid-column: 2 / -1;
  }

  .solved-meta {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 9px;
    font-size: clamp(0.76rem, 2.6vw, 0.86rem);
  }

  .solved-meta::before {
    display: inline;
    flex: 0 0 auto;
    margin: 0;
    font-size: inherit;
  }

  .submit-vector {
    width: min(220px, 100%);
  }
}

@media (max-width: 520px) {
  .auth-shell {
    padding-top: 34px;
  }

  .radar-ring {
    top: -280px;
    width: 570px;
  }

  .delta-mark {
    width: 64px;
    height: 64px;
    margin-bottom: 30px;
  }

  .delta-mark span {
    font-size: 27px;
  }

  .vector-row {
    grid-template-columns: 1fr 1fr;
  }

  .vector-label {
    grid-column: 1 / -1;
  }

  .row-action {
    grid-column: 1 / -1;
  }

  .submit-vector {
    width: 100%;
  }
}

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