@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Orbitron:wght@400;700;900&display=swap');

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

:root {
  --acid:    #00ff41;
  --cyan:    #00e5ff;
  --gold:    #ffd700;
  --magenta: #ff00aa;
  --red:     #ff2020;
  --px: 0;
  --py: 0;
}

html, body {
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 50% 45%, rgba(0, 255, 65, 0.08), transparent 26%),
    radial-gradient(circle at 50% 55%, rgba(0, 229, 255, 0.07), transparent 34%),
    linear-gradient(180deg, #020503 0%, #000300 58%, #010402 100%);
  overflow: hidden;
  font-family: 'Share Tech Mono', monospace;
  cursor: none;
}

body::before,
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  background:
    radial-gradient(circle at 20% 16%, rgba(0, 229, 255, 0.08), transparent 18%),
    radial-gradient(circle at 82% 72%, rgba(255, 0, 170, 0.07), transparent 24%);
  transform: translate3d(calc(var(--px) * -18px), calc(var(--py) * -22px), 0);
  z-index: 1;
}

body::after {
  background: linear-gradient(90deg, transparent 0%, rgba(0, 255, 65, 0.045) 50%, transparent 100%);
  opacity: 0.28;
  transform: translate3d(calc(var(--px) * 10px), 0, 0);
  z-index: 2;
}

/* Custom cursor */
#cursor {
  position: fixed;
  width: 22px;
  height: 22px;
  border: 1px solid var(--acid);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 999;
  mix-blend-mode: screen;
  transition: width .1s, height .1s;
}

#cursor::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 3px;
  background: var(--acid);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

/* Scanline sweep */
#scan {
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(0,0,0,0.18) 3px,
    rgba(0,0,0,0.18) 4px
  );
  pointer-events: none;
  z-index: 90;
}

#scan-line {
  position: fixed;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, rgba(0,255,65,.2) 30%, rgba(0,255,65,.5) 50%, rgba(0,255,65,.2) 70%, transparent 100%);
  animation: sweepdown 5s linear infinite;
  pointer-events: none;
  z-index: 91;
}

@keyframes sweepdown {
  0% { top: -2px; opacity: 1; }
  100% { top: 100%; opacity: .3; }
}

#portal-field {
  position: fixed;
  inset: -10vmax;
  pointer-events: none;
  z-index: 4;
  overflow: hidden;
}

.field-layer {
  position: absolute;
  inset: 0;
  opacity: 0.7;
  will-change: transform, opacity;
}

.layer-grid {
  background:
    linear-gradient(rgba(0,255,65,0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,255,65,0.055) 1px, transparent 1px);
  background-size: 120px 120px;
  -webkit-mask-image: radial-gradient(circle at center, rgba(0,0,0,0.95), transparent 76%);
  mask-image: radial-gradient(circle at center, rgba(0,0,0,0.95), transparent 76%);
  transform: translate3d(calc(var(--px) * -46px), calc(var(--py) * -28px), 0) scale(1.05);
}

.layer-rings {
  background:
    radial-gradient(circle at center, transparent 0 17%, rgba(0,229,255,0.12) 17.5%, transparent 18.3%, transparent 25%, rgba(0,255,65,0.08) 25.5%, transparent 26.2%, transparent 34%, rgba(255,215,0,0.09) 34.5%, transparent 35.4%, transparent 100%);
  opacity: 0.44;
  transform: translate3d(calc(var(--px) * -20px), calc(var(--py) * -14px), 0) scale(1.02);
}

.layer-beam {
  background:
    linear-gradient(115deg, transparent 18%, rgba(0,229,255,0.10) 42%, rgba(255,255,255,0.04) 50%, rgba(0,255,65,0.08) 58%, transparent 80%);
  mix-blend-mode: screen;
  opacity: 0.36;
  transform: translate3d(calc(var(--px) * 36px), calc(var(--py) * 12px), 0) scale(1.08);
}

.layer-noise {
  background-image:
    radial-gradient(circle at 14% 22%, rgba(0,255,65,0.16) 0 1px, transparent 2px),
    radial-gradient(circle at 72% 31%, rgba(0,229,255,0.14) 0 1px, transparent 2px),
    radial-gradient(circle at 84% 68%, rgba(255,215,0,0.14) 0 1px, transparent 2px),
    radial-gradient(circle at 28% 78%, rgba(255,0,170,0.16) 0 1px, transparent 2px);
  background-size: 340px 340px;
  opacity: 0.28;
  transform: translate3d(calc(var(--px) * 58px), calc(var(--py) * 42px), 0) scale(1.12);
}

#stage {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 20px;
  overflow: hidden;
  perspective: 1400px;
  z-index: 20;
}

#portal-core {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transform: translate3d(calc(var(--px) * 22px), calc(var(--py) * 16px), 0) rotateX(calc(var(--py) * -2.8deg)) rotateY(calc(var(--px) * 4.6deg));
  transform-style: preserve-3d;
  will-change: transform;
}

#portal-halo {
  position: absolute;
  width: min(70vw, 760px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, rgba(0,255,65,0.12), transparent 34%),
    radial-gradient(circle at center, rgba(0,229,255,0.08), transparent 56%),
    radial-gradient(circle at center, rgba(255,215,0,0.05), transparent 72%);
  filter: blur(18px);
  opacity: 0.85;
  transform: translate3d(calc(var(--px) * -16px), calc(var(--py) * -10px), -50px) scale(1.02);
  pointer-events: none;
}

#ls-canvas {
  display: block;
  width: min(460px, 56vmin);
  height: min(460px, 56vmin);
  flex-shrink: 1;
  min-height: 0;
  transition: transform 2.2s cubic-bezier(.18,.84,.22,1), opacity 1.2s ease;
  will-change: transform, opacity;
  filter: drop-shadow(0 0 28px rgba(0,255,65,0.16)) drop-shadow(0 0 50px rgba(0,229,255,0.08));
}

#ls-canvas.docking {
  transform: translateY(58px) scale(0.995);
}

#ls-text {
  text-align: center;
  margin-top: 16px;
  flex-shrink: 0;
  transition: transform 2.2s cubic-bezier(.18,.84,.22,1), opacity 1.1s ease;
  will-change: transform, opacity;
  transform: translateZ(36px);
}

#ls-text.docking {
  transform: translateY(58px);
}

#ls-title {
  font-family: 'Orbitron', monospace;
  font-weight: 900;
  font-size: clamp(14px, 2.4vw, 28px);
  letter-spacing: .55em;
  color: var(--acid);
  text-shadow: 0 0 24px rgba(0,255,65,.45);
  opacity: 0;
  transition: opacity 1.4s ease;
}

#ls-sub {
  font-size: clamp(7px, 1vw, 11px);
  letter-spacing: .38em;
  color: var(--cyan);
  opacity: 0;
  margin-top: 5px;
  transition: opacity 1.4s ease;
}

#ls-class {
  font-size: clamp(6px, .75vw, 9px);
  letter-spacing: .2em;
  color: rgba(0,255,65,.32);
  opacity: 0;
  margin-top: 3px;
  transition: opacity 1.4s ease;
}

#ls-status {
  margin-top: 18px;
  display: grid;
  gap: 8px;
  font-size: clamp(8px, .9vw, 11px);
  letter-spacing: .22em;
  color: rgba(0,229,255,0.7);
  opacity: 0.86;
  transform: translateZ(24px);
}

#ls-status span {
  display: block;
  padding: 8px 12px;
  border: 1px solid rgba(0,229,255,0.18);
  background: linear-gradient(90deg, rgba(0,18,16,0.78), rgba(0,18,16,0.28));
  box-shadow: inset 0 0 22px rgba(0,229,255,0.05);
  text-shadow: 0 0 16px rgba(0,229,255,0.2);
}

#ls-buttons {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 28px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1s ease, filter 1s ease;
  width: min(540px, 90vw);
  flex-shrink: 0;
  position: relative;
  transform: translateZ(68px);
}

#ls-buttons.visible {
  opacity: 1;
  pointer-events: all;
}

#ls-buttons.departing {
  opacity: 0;
  filter: blur(1px);
  pointer-events: none;
}

.ls-btn {
  display: block;
  text-decoration: none;
  padding: 18px 24px 14px;
  font-family: 'Share Tech Mono', monospace;
  font-size: clamp(9px, 1.1vw, 13px);
  letter-spacing: .1em;
  cursor: none;
  position: relative;
  transition: box-shadow .25s, background .25s, border-color .25s, opacity .25s ease, transform .25s ease;
  user-select: none;
  backdrop-filter: blur(5px);
}

.ls-btn:hover {
  transform: translate3d(calc(var(--px) * -6px), calc(var(--py) * -4px), 0);
}

#btn-full {
  background: rgba(0,255,65,0.04);
  border: 1px solid rgba(0,255,65,0.5);
  color: var(--acid);
  box-shadow: 0 0 18px rgba(0,255,65,0.08), inset 0 0 30px rgba(0,255,65,0.03);
}

#btn-full:hover {
  background: rgba(0,255,65,0.09);
  border-color: var(--acid);
  box-shadow: 0 0 36px rgba(0,255,65,0.22), inset 0 0 40px rgba(0,255,65,0.07);
}

#btn-full .btn-num {
  font-family: 'Orbitron', monospace;
  font-size: .75em;
  color: rgba(0,255,65,.5);
  letter-spacing: .3em;
  display: block;
  margin-bottom: 4px;
}

#btn-full .btn-label {
  font-size: 1.1em;
  letter-spacing: .18em;
  font-weight: bold;
}

#btn-full .btn-sub {
  font-size: .72em;
  color: rgba(0,255,65,.45);
  letter-spacing: .08em;
  margin-top: 6px;
  display: block;
  border-top: 1px solid rgba(0,255,65,.12);
  padding-top: 7px;
}

#btn-full::before,
#btn-full::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  border-color: var(--acid);
  border-style: solid;
  opacity: .5;
  transition: opacity .25s;
}

#btn-full::before { top: 4px; left: 4px; border-width: 1px 0 0 1px; }
#btn-full::after { bottom: 4px; right: 4px; border-width: 0 1px 1px 0; }
#btn-full:hover::before, #btn-full:hover::after { opacity: 1; }

#btn-silent {
  background: rgba(0,229,255,0.03);
  border: 1px solid rgba(0,229,255,0.35);
  color: var(--cyan);
  box-shadow: 0 0 14px rgba(0,229,255,0.06), inset 0 0 30px rgba(0,229,255,0.02);
}

#btn-silent:hover {
  background: rgba(0,229,255,0.07);
  border-color: var(--cyan);
  box-shadow: 0 0 30px rgba(0,229,255,0.18), inset 0 0 40px rgba(0,229,255,0.05);
}

#btn-silent .btn-num {
  font-family: 'Orbitron', monospace;
  font-size: .75em;
  color: rgba(0,229,255,.45);
  letter-spacing: .3em;
  display: block;
  margin-bottom: 4px;
}

#btn-silent .btn-label {
  font-size: 1.1em;
  letter-spacing: .18em;
  font-weight: bold;
}

#btn-silent .btn-sub {
  font-size: .72em;
  color: rgba(0,229,255,.4);
  letter-spacing: .08em;
  margin-top: 6px;
  display: block;
  border-top: 1px solid rgba(0,229,255,.1);
  padding-top: 7px;
}

#btn-silent::before,
#btn-silent::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  border-color: var(--cyan);
  border-style: solid;
  opacity: .4;
  transition: opacity .25s;
}

#btn-silent::before { top: 4px; left: 4px; border-width: 1px 0 0 1px; }
#btn-silent::after { bottom: 4px; right: 4px; border-width: 0 1px 1px 0; }
#btn-silent:hover::before, #btn-silent:hover::after { opacity: .85; }

.corner {
  position: fixed;
  width: 28px;
  height: 28px;
  border-color: rgba(0,255,65,.25);
  border-style: solid;
  z-index: 92;
  will-change: transform;
}

.corner.tl {
  top: 18px;
  left: 18px;
  border-width: 1px 0 0 1px;
  transform: translate3d(calc(var(--px) * -10px), calc(var(--py) * -10px), 0);
}

.corner.tr {
  top: 18px;
  right: 18px;
  border-width: 1px 1px 0 0;
  transform: translate3d(calc(var(--px) * 10px), calc(var(--py) * -10px), 0);
}

.corner.bl {
  bottom: 18px;
  left: 18px;
  border-width: 0 0 1px 1px;
  transform: translate3d(calc(var(--px) * -10px), calc(var(--py) * 10px), 0);
}

.corner.br {
  bottom: 18px;
  right: 18px;
  border-width: 0 1px 1px 0;
  transform: translate3d(calc(var(--px) * 10px), calc(var(--py) * 10px), 0);
}

#ls-footer {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translate3d(calc(-50% + var(--px) * 10px), calc(var(--py) * 6px), 0);
  font-size: clamp(6px, .7vw, 8px);
  letter-spacing: .25em;
  color: rgba(0,255,65,.22);
  white-space: nowrap;
  z-index: 92;
  animation: blink 1.4s step-end infinite;
  transition: opacity .8s ease;
}

@keyframes blink {
  50% { opacity: 0; }
}

#wipe-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 95;
  opacity: 0;
  transition: opacity .25s ease;
}

#wipe-canvas.active { opacity: 1; }

@media (pointer: coarse) {
  html, body, .ls-btn { cursor: auto; }
  #cursor { display: none; }
}

@media (max-width: 720px) {
  #portal-core {
    width: 100%;
    transform: translate3d(calc(var(--px) * 10px), calc(var(--py) * 8px), 0);
  }

  #ls-status {
    font-size: 8px;
    letter-spacing: .16em;
  }

  #ls-status span {
    padding: 7px 10px;
  }

  .ls-btn {
    padding: 16px 18px 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body::before,
  body::after,
  .field-layer,
  #portal-core,
  #portal-halo,
  .corner,
  #ls-footer,
  .ls-btn:hover {
    transform: none !important;
  }

  #scan-line {
    animation-duration: 10s;
  }
}
