:root {
  --bg: #000000;
  --terminal: #01D69C;
  --terminal-soft: rgba(1, 214, 156, 0.18);
  --terminal-mid: rgba(1, 214, 156, 0.45);
  --terminal-strong: rgba(1, 214, 156, 0.9);
  --white-glow: rgba(255, 255, 255, 0.75);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  min-height: 100%;
  background: var(--bg);
  color: var(--terminal);
  font-family: "Press Start 2P", monospace;
  overflow: hidden;
}

body {
  position: relative;
}

/* Global CRT background */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.025) 0px,
      rgba(255, 255, 255, 0.025) 1px,
      transparent 2px,
      transparent 4px
    ),
    linear-gradient(
      to right,
      rgba(255, 0, 0, 0.03),
      rgba(0, 255, 255, 0.015),
      rgba(0, 0, 255, 0.03)
    );
  opacity: 0.5;
  z-index: 999;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at center, transparent 55%, rgba(0, 0, 0, 0.4) 100%);
  z-index: 998;
}

.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Preloader */
.preloader {
  position: fixed;
  inset: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.preloader.fade-out {
  opacity: 0;
  visibility: hidden;
}

.preloader__content {
  width: min(90vw, 520px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  text-align: center;
  padding: 20px;
}

.preloader__text {
  color: var(--terminal);
  font-size: 18px;
  line-height: 1.6;
  text-shadow:
    0 0 6px var(--terminal),
    0 0 12px var(--terminal),
    0 0 20px rgba(0, 245, 212, 0.35);
  animation: flicker 1.8s infinite;
}

.progress {
  width: min(420px, 100%);
  height: 20px;
  border: 2px solid var(--terminal);
  box-shadow:
    0 0 8px rgba(0, 245, 212, 0.35),
    inset 0 0 8px rgba(0, 245, 212, 0.2);
  padding: 2px;
  position: relative;
}

.progress__bar {
  width: 0%;
  height: 100%;
  background: var(--terminal);
  box-shadow:
    0 0 8px var(--terminal),
    0 0 14px var(--terminal);
  animation: loadingBar 3.2s ease-in-out forwards;
}

/* Cube */
.cube-wrap {
  width: 90px;
  height: 90px;
  perspective: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cube {
  position: relative;
  width: 52px;
  height: 52px;
  transform-style: preserve-3d;
  animation: cubeRotate 2.4s linear infinite;
}

.face {
  position: absolute;
  width: 52px;
  height: 52px;
  border: 2px dashed var(--terminal);
  box-shadow:
    0 0 8px rgba(0, 245, 212, 0.7),
    inset 0 0 8px rgba(0, 245, 212, 0.25);
  background: rgba(0, 245, 212, 0.04);
}

.face-front  { transform: translateZ(26px); }
.face-back   { transform: rotateY(180deg) translateZ(26px); }
.face-left   { transform: rotateY(-90deg) translateZ(26px); }
.face-right  { transform: rotateY(90deg) translateZ(26px); }
.face-top    { transform: rotateX(90deg) translateZ(26px); }
.face-bottom { transform: rotateX(-90deg) translateZ(26px); }

/* Main page */
.page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #000;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

.terminal-window {
  position: relative;
  width: min(100%, 1100px);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  overflow: hidden;
}

.terminal-window::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(0, 245, 212, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 245, 212, 0.045) 1px, transparent 1px);
  background-size: 36px 36px;
  opacity: 0.4;
  pointer-events: none;
}

.scanline {
  position: absolute;
  top: -20%;
  left: 0;
  width: 100%;
  height: 20%;
  background: linear-gradient(
    to bottom,
    rgba(0, 245, 212, 0) 0%,
    rgba(0, 245, 212, 0.06) 40%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(0, 245, 212, 0.06) 60%,
    rgba(0, 245, 212, 0) 100%
  );
  animation: scanMove 5s linear infinite;
  pointer-events: none;
}

.terminal-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

.terminal-content h1 {
  font-size: clamp(22px, 4vw, 56px);
  line-height: 1.45;
  color: var(--terminal);
  text-shadow:
    0 0 6px var(--terminal),
    0 0 12px var(--terminal),
    1px 0 0 rgba(255, 0, 80, 0.15),
    -1px 0 0 rgba(0, 180, 255, 0.15);
  animation: flicker 2.2s infinite;
}

.terminal-content p {
  font-size: clamp(10px, 1.8vw, 18px);
  line-height: 1.8;
  color: var(--terminal);
  opacity: 0.95;
  text-shadow:
    0 0 5px var(--terminal),
    0 0 10px rgba(0, 245, 212, 0.3);
}

.terminal-btn {
  appearance: none;
  border: 2px solid var(--terminal);
  background: transparent;
  color: var(--terminal);
  font-family: inherit;
  font-size: clamp(10px, 1.6vw, 16px);
  padding: 18px 30px;
  min-width: 240px;
  text-transform: lowercase;
  cursor: pointer;
  box-shadow:
    0 0 8px rgba(0, 245, 212, 0.25),
    inset 0 0 8px rgba(0, 245, 212, 0.1);
  text-shadow: 0 0 6px var(--terminal);
  transition: 0.25s ease;
}

.terminal-btn:hover,
.terminal-btn:focus {
  background: rgba(0, 245, 212, 0.08);
  box-shadow:
    0 0 12px rgba(0, 245, 212, 0.6),
    inset 0 0 12px rgba(0, 245, 212, 0.2);
  transform: translateY(-2px);
}

.terminal-btn:active {
  transform: translateY(0);
}

/* Animations */
@keyframes loadingBar {
  0%   { width: 0%; }
  15%  { width: 12%; }
  30%  { width: 27%; }
  50%  { width: 46%; }
  70%  { width: 68%; }
  85%  { width: 84%; }
  100% { width: 100%; }
}

@keyframes cubeRotate {
  0%   { transform: rotateX(-18deg) rotateY(0deg) rotateZ(12deg); }
  50%  { transform: rotateX(-18deg) rotateY(180deg) rotateZ(-8deg); }
  100% { transform: rotateX(-18deg) rotateY(360deg) rotateZ(12deg); }
}

@keyframes flicker {
  0%, 18%, 22%, 25%, 53%, 57%, 100% {
    opacity: 1;
  }
  20%, 24%, 55% {
    opacity: 0.75;
  }
}

@keyframes scanMove {
  0% {
    top: -25%;
  }
  100% {
    top: 105%;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .preloader__content {
    gap: 22px;
  }

  .preloader__text {
    font-size: 12px;
    line-height: 1.8;
  }

  .progress {
    height: 16px;
  }

  .cube-wrap {
    width: 72px;
    height: 72px;
  }

  .cube,
  .face {
    width: 42px;
    height: 42px;
  }

  .face-front  { transform: translateZ(21px); }
  .face-back   { transform: rotateY(180deg) translateZ(21px); }
  .face-left   { transform: rotateY(-90deg) translateZ(21px); }
  .face-right  { transform: rotateY(90deg) translateZ(21px); }
  .face-top    { transform: rotateX(90deg) translateZ(21px); }
  .face-bottom { transform: rotateX(-90deg) translateZ(21px); }

  .terminal-content {
    gap: 22px;
  }

  .terminal-btn {
    min-width: 200px;
    padding: 16px 22px;
  }
}

@media (max-width: 480px) {
  .terminal-window {
    padding: 24px 14px;
  }

  .terminal-content h1 {
    line-height: 1.6;
  }

  .terminal-content p {
    line-height: 1.9;
  }

  .terminal-btn {
    width: 100%;
    max-width: 260px;
  }
}