:root {
  --bg: #02070d;
  --bg-soft: rgba(6, 16, 28, 0.9);
  --panel: rgba(6, 16, 28, 0.72);
  --panel-strong: rgba(7, 18, 32, 0.92);
  --line: rgba(56, 146, 255, 0.3);
  --line-strong: rgba(86, 177, 255, 0.82);
  --text: #dbeeff;
  --muted: #7b93ad;
  --blue: #2f81ff;
  --blue-2: #58c2ff;
  --blue-3: #8fe0ff;
  --shadow: 0 0 30px rgba(47, 129, 255, 0.16);
  --shadow-lg: 0 18px 70px rgba(0, 0, 0, 0.55);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Space Mono", monospace;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bg-layer {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

#matrixCanvas,
.noise-layer,
.scanline-layer,
.grid-layer {
  position: absolute;
  inset: 0;
}

#matrixCanvas {
  width: 100%;
  height: 100%;
  opacity: 0.18;
}

.noise-layer {
  opacity: 0.08;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(88, 194, 255, 0.3), transparent 14%),
    radial-gradient(circle at 80% 10%, rgba(47, 129, 255, 0.22), transparent 18%),
    radial-gradient(circle at 50% 80%, rgba(143, 224, 255, 0.2), transparent 22%);
  filter: blur(48px);
}

.grid-layer {
  background-image:
    linear-gradient(rgba(72, 139, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(72, 139, 255, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.95), transparent);
  opacity: 0.2;
}

.scanline-layer {
  background: linear-gradient(180deg, transparent 0, rgba(88, 194, 255, 0.06) 50%, transparent 100%);
  background-size: 100% 4px;
  animation: scanline 7s linear infinite;
  opacity: 0.18;
}

.site-shell {
  position: relative;
  z-index: 1;
  width: min(1320px, calc(100% - 40px));
  margin: 0 auto;
  padding: 32px 0 60px;
}

.top-nav {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 76px;
  font-size: 0.95rem;
}

.nav-cluster {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-link {
  position: relative;
  display: inline-block;
  overflow: hidden;
  color: var(--muted);
  min-width: 170px;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  font: inherit;
}

.nav-link--active {
  color: var(--blue-2);
}

.nav-default,
.nav-hover {
  display: block;
  transition: transform 0.3s ease, color 0.3s ease;
}

.nav-hover {
  position: absolute;
  inset: 0;
  transform: translateY(120%);
  color: var(--blue-3);
}

.nav-link:hover .nav-default {
  transform: translateY(-120%);
}

.nav-link:hover .nav-hover {
  transform: translateY(0);
}

.brand {
  color: var(--blue);
  font-size: 2rem;
  text-shadow: 0 0 20px rgba(47, 129, 255, 0.5);
  animation: brandPulse 2.2s ease-in-out infinite;
}

.terminal-shell,
.main-section {
  position: relative;
  z-index: 1;
  margin-bottom: 96px;
}

.site-terminal {
  border: 1px solid rgba(86, 177, 255, 0.34);
  background: linear-gradient(180deg, rgba(5, 13, 24, 0.96), rgba(3, 9, 16, 0.98));
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.site-terminal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(86, 177, 255, 0.18);
  background: rgba(8, 20, 34, 0.92);
}

.site-terminal__lights {
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-terminal__lights span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: rgba(143, 224, 255, 0.5);
}

.site-terminal__lights span:nth-child(2) {
  background: rgba(88, 194, 255, 0.72);
}

.site-terminal__lights span:nth-child(3) {
  background: rgba(47, 129, 255, 0.78);
}

.site-terminal__title {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.site-terminal__body {
  padding: 18px;
}

.site-terminal__output {
  min-height: 112px;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 8px;
  margin-bottom: 24px;
}

.site-terminal__output p {
  margin: 0 0 10px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.terminal-muted {
  color: var(--muted);
  font-weight: 700;
}

.terminal-accent {
  color: var(--blue-2);
  font-weight: 700;
}

.hud-layout {
  display: grid;
  grid-template-columns: 1.1fr 0.95fr 0.95fr;
  gap: 22px;
  align-items: stretch;
}

.hud-panel,
.legal-card,
.stat-card,
.toggle,
.consent,
.notice-block {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(6, 16, 28, 0.76), rgba(3, 10, 18, 0.92));
  box-shadow: var(--shadow-lg);
}

.hud-panel,
.legal-card {
  padding: 24px;
}

.card-kicker,
.eyebrow,
.label {
  margin: 0 0 12px;
  color: var(--blue);
  opacity: 0.92;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.82rem;
}

.hero-title {
  margin: 0 0 14px;
  font-size: clamp(2.7rem, 6vw, 5rem);
  line-height: 0.98;
  letter-spacing: -0.05em;
}

.hero-subtitle {
  margin: 0 0 28px;
  color: var(--blue-2);
  font-size: clamp(0.96rem, 2vw, 1.2rem);
  min-height: 1.8em;
}

.muted,
.phase {
  color: var(--muted);
}

.field {
  margin-bottom: 18px;
}

label {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 0.92rem;
}

input {
  width: 100%;
  border: 1px solid rgba(86, 177, 255, 0.18);
  background: rgba(7, 18, 32, 0.94);
  color: var(--text);
  padding: 14px 16px;
  outline: none;
}

input::placeholder {
  color: rgba(123, 147, 173, 0.66);
}

input:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 1px rgba(86, 177, 255, 0.24);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.stat-card {
  padding: 18px;
}

.stat-card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--blue-2);
  font-size: 1.5rem;
}

.stat-card span {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

.toggles {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.toggle,
.consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 14px;
}

.tooltip-toggle {
  position: relative;
}

.tooltip-toggle::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: calc(100% + 10px);
  padding: 12px 14px;
  border: 1px solid rgba(86, 177, 255, 0.46);
  background: linear-gradient(180deg, rgba(8, 20, 34, 0.98), rgba(3, 10, 18, 0.98));
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.42);
  color: var(--blue-3);
  font-size: 0.78rem;
  line-height: 1.55;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 5;
}

.tooltip-toggle::before {
  content: "";
  position: absolute;
  left: 26px;
  bottom: calc(100% + 2px);
  width: 12px;
  height: 12px;
  background: rgba(8, 20, 34, 0.98);
  border-left: 1px solid rgba(86, 177, 255, 0.46);
  border-top: 1px solid rgba(86, 177, 255, 0.46);
  transform: rotate(225deg) translateY(-4px);
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
  z-index: 5;
}

.tooltip-toggle:hover::after,
.tooltip-toggle:hover::before,
.tooltip-toggle:focus-within::after,
.tooltip-toggle:focus-within::before {
  opacity: 1;
  transform: translateY(0);
}

.toggle input,
.consent input {
  width: auto;
  margin: 2px 0 0;
}

.notice-block {
  margin-bottom: 18px;
  padding: 14px;
  color: var(--blue-3);
  line-height: 1.75;
}

.notice-block p {
  margin: 0;
}

.notice-block p + p {
  margin-top: 4px;
}

.terminal-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 190px;
  min-height: 50px;
  padding: 0 22px;
  color: var(--blue-2);
  transition: color 0.3s ease;
  background: transparent;
  border: 0;
}

.terminal-button span:nth-child(1),
.terminal-button span:nth-child(2) {
  position: absolute;
  inset: 0;
  border: 1px solid var(--line-strong);
  transition: background 0.3s ease, transform 0.3s ease;
}

.terminal-button span:nth-child(2) {
  transform: translate(6px, 6px);
  opacity: 0.48;
}

.terminal-button:hover {
  color: #041019;
}

.terminal-button:hover span:nth-child(1),
.terminal-button:hover span:nth-child(2) {
  background: var(--blue-2);
}

.terminal-button:hover span:nth-child(2) {
  transform: translate(0, 0);
}

.button-text {
  position: relative;
  z-index: 1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.terminal-button--small {
  min-width: 170px;
  min-height: 46px;
}

.terminal-button--full {
  width: 100%;
}

.terminal-button:disabled {
  opacity: 0.45;
  pointer-events: none;
}

.terminal-button.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.status-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.value {
  margin: 0;
  color: var(--blue-2);
  font-size: 1.7rem;
  font-weight: 700;
}

.progress-track {
  width: 100%;
  height: 6px;
  background: rgba(120, 144, 170, 0.22);
  overflow: hidden;
  margin: 12px 0 16px;
}

.progress-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--blue-3));
  transition: width 0.3s ease;
}

.result-box {
  margin-top: 22px;
}

.error {
  margin-top: 18px;
  color: #ff8ea6;
}

.section-title {
  margin: 0 0 28px;
  text-align: center;
  font-size: clamp(1.8rem, 4vw, 3rem);
}

.glitch-container {
  animation: textShadow 1.6s infinite;
}

.legal-panel {
  max-width: 820px;
  margin: 0 auto 48px;
}

.legal-card {
  text-align: center;
}

.legal-card p {
  margin: 0 0 10px;
  color: var(--muted);
}

.text-link,
.consent a {
  color: var(--blue-2);
}

code {
  color: var(--blue-3);
}

@keyframes scanline {
  0% {
    transform: translateY(-100%);
  }
  100% {
    transform: translateY(100%);
  }
}

@keyframes brandPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.72;
  }
}

@keyframes textShadow {
  0% {
    text-shadow:
      0.44px 0 1px rgba(47, 129, 255, 0.55),
      -0.44px 0 1px rgba(143, 224, 255, 0.35),
      0 0 3px rgba(47, 129, 255, 0.22);
  }
  50% {
    text-shadow:
      2.4px 0 1px rgba(47, 129, 255, 0.55),
      -2.4px 0 1px rgba(143, 224, 255, 0.35),
      0 0 3px rgba(47, 129, 255, 0.22);
  }
  100% {
    text-shadow:
      0.44px 0 1px rgba(47, 129, 255, 0.55),
      -0.44px 0 1px rgba(143, 224, 255, 0.35),
      0 0 3px rgba(47, 129, 255, 0.22);
  }
}

@media (max-width: 1100px) {
  .hud-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .site-shell {
    width: calc(100% - 24px);
    padding-top: 22px;
  }

  .top-nav {
    flex-direction: column;
    gap: 18px;
    margin-bottom: 56px;
  }

  .nav-cluster {
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px 20px;
  }

  .nav-link {
    min-width: auto;
    text-align: center;
  }
}

@media (max-width: 560px) {
  .brand {
    font-size: 1.45rem;
  }

  .hero-title {
    font-size: 2.4rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .hud-panel,
  .legal-card {
    padding: 18px;
  }
}
