:root {
  --bg: #05060f;
  --panel: rgba(7, 10, 28, 0.78);
  --cyan: #00f5ff;
  --green: #50ff7a;
  --pink: #ff2ccf;
  --amber: #ffd84d;
  --text: #f5fbff;
  --muted: #9ab0c4;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Rajdhani", system-ui, sans-serif;
  overflow-x: hidden;
}

.arena {
  position: relative;
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: clamp(22px, 5vw, 56px);
  isolation: isolate;
  background:
    radial-gradient(circle at 18% 18%, rgba(0, 245, 255, 0.2), transparent 28%),
    radial-gradient(circle at 78% 20%, rgba(255, 44, 207, 0.2), transparent 24%),
    radial-gradient(circle at 55% 85%, rgba(80, 255, 122, 0.15), transparent 30%),
    linear-gradient(135deg, #05060f 0%, #0d1020 48%, #070711 100%);
}

.grid {
  position: absolute;
  inset: 0;
  z-index: -3;
  background-image:
    linear-gradient(rgba(0, 245, 255, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 245, 255, 0.12) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(to bottom, transparent 0%, black 28%, black 72%, transparent 100%);
  transform: perspective(620px) rotateX(58deg) translateY(18%);
  transform-origin: center bottom;
  animation: gridMove 5s linear infinite;
}

.scanlines {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.045) 0 1px,
    transparent 1px 5px
  );
  mix-blend-mode: screen;
  opacity: 0.32;
}

.sparks span {
  position: absolute;
  width: 9px;
  height: 9px;
  border: 1px solid var(--cyan);
  box-shadow: 0 0 18px currentColor;
  color: var(--cyan);
  animation: floatSpark 7s ease-in-out infinite;
}

.sparks span:nth-child(1) {
  left: 12%;
  top: 17%;
}

.sparks span:nth-child(2) {
  left: 82%;
  top: 24%;
  color: var(--pink);
  animation-delay: -1.2s;
}

.sparks span:nth-child(3) {
  left: 18%;
  top: 74%;
  color: var(--green);
  animation-delay: -2.4s;
}

.sparks span:nth-child(4) {
  left: 72%;
  top: 72%;
  color: var(--amber);
  animation-delay: -3.6s;
}

.sparks span:nth-child(5) {
  left: 48%;
  top: 12%;
  color: var(--green);
  animation-delay: -4.8s;
}

.sparks span:nth-child(6) {
  left: 88%;
  top: 58%;
  animation-delay: -6s;
}

.join-panel {
  width: min(100%, 560px);
  padding: clamp(22px, 5vw, 42px);
  border: 1px solid rgba(0, 245, 255, 0.38);
  background: var(--panel);
  box-shadow:
    0 0 38px rgba(0, 245, 255, 0.18),
    inset 0 0 42px rgba(255, 44, 207, 0.08);
  backdrop-filter: blur(14px);
  text-align: center;
  clip-path: polygon(18px 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%, 0 18px);
}

.tag {
  margin: 0 0 10px;
  color: var(--green);
  font-family: "Orbitron", system-ui, sans-serif;
  font-size: clamp(0.78rem, 2.4vw, 0.98rem);
  letter-spacing: 0;
  text-transform: uppercase;
  text-shadow: 0 0 14px rgba(80, 255, 122, 0.8);
}

h1 {
  margin: 0 0 clamp(26px, 5vw, 38px);
  font-family: "Orbitron", system-ui, sans-serif;
  font-size: clamp(3.1rem, 14vw, 6.6rem);
  line-height: 0.92;
  text-transform: uppercase;
  text-shadow:
    0 0 12px rgba(0, 245, 255, 0.9),
    4px 4px 0 rgba(255, 44, 207, 0.75);
}

.player-field {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 216, 77, 0.42);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 18px rgba(255, 216, 77, 0.08);
}

.player-field span {
  color: var(--amber);
  font-family: "Orbitron", system-ui, sans-serif;
  font-size: clamp(1rem, 3vw, 1.22rem);
  text-transform: uppercase;
}

.player-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: 700 clamp(1.35rem, 5vw, 2rem) "Rajdhani", system-ui, sans-serif;
}

.player-field input::placeholder {
  color: rgba(245, 251, 255, 0.42);
}

.join-button {
  width: 100%;
  min-height: clamp(92px, 18vw, 130px);
  margin-top: 18px;
  border: 0;
  color: #031014;
  cursor: pointer;
  font-family: "Orbitron", system-ui, sans-serif;
  font-size: clamp(1.25rem, 5vw, 2.2rem);
  font-weight: 800;
  line-height: 1.05;
  text-transform: uppercase;
  background:
    linear-gradient(90deg, transparent 0 12px, rgba(255, 255, 255, 0.55) 12px 14px, transparent 14px 100%),
    linear-gradient(135deg, var(--green), var(--cyan) 48%, var(--pink));
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.1),
    0 0 30px rgba(0, 245, 255, 0.55),
    0 12px 0 rgba(0, 0, 0, 0.42);
  transform: translateY(0);
  transition:
    transform 160ms ease,
    filter 160ms ease,
    box-shadow 160ms ease;
}

.join-button:hover,
.join-button:focus-visible {
  filter: saturate(1.2) brightness(1.07);
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.15),
    0 0 44px rgba(255, 44, 207, 0.58),
    0 12px 0 rgba(0, 0, 0, 0.42);
}

.join-button:active {
  transform: translateY(7px);
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.1),
    0 0 28px rgba(80, 255, 122, 0.52),
    0 5px 0 rgba(0, 0, 0, 0.42);
}

.status {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: clamp(0.98rem, 3vw, 1.12rem);
  font-weight: 700;
}

@keyframes gridMove {
  from {
    background-position: 0 0;
  }

  to {
    background-position: 0 46px;
  }
}

@keyframes floatSpark {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(0deg);
    opacity: 0.45;
  }

  50% {
    transform: translate3d(10px, -18px, 0) rotate(45deg);
    opacity: 1;
  }
}

@media (max-width: 520px) {
  .arena {
    padding: 16px;
  }

  .join-panel {
    padding: 22px 16px;
  }

  .player-field {
    grid-template-columns: 1fr;
    gap: 4px;
    text-align: left;
  }
}

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