:root {
  color-scheme: dark;
  --gold: #ffd64a;
  --amber: #ff9f1c;
  --cyan: #5ee7ff;
  --red: #ff3b5f;
  --ink: #05060b;
  --steel: #b7c7d8;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  touch-action: pan-y;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% 110%, rgba(255, 214, 74, 0.18), transparent 34rem),
    radial-gradient(circle at 15% 15%, rgba(94, 231, 255, 0.12), transparent 26rem),
    var(--ink);
  color: white;
  font-family: Rajdhani, system-ui, sans-serif;
}

#stars,
.hyperspace {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

#stars {
  z-index: 0;
}

.hyperspace {
  z-index: 1;
  opacity: 0.42;
  background:
    linear-gradient(90deg, transparent 0 47%, rgba(94, 231, 255, 0.12) 49%, transparent 51% 100%),
    repeating-linear-gradient(115deg, transparent 0 5rem, rgba(255, 255, 255, 0.05) 5.1rem 5.18rem, transparent 5.25rem 10rem);
  mask-image: radial-gradient(ellipse at center, black 0 30%, transparent 72%);
  animation: drift 18s linear infinite;
}

.command {
  position: relative;
  z-index: 2;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 8vh 0 12vh;
}

.hero {
  min-height: 88vh;
  display: grid;
  align-content: center;
  justify-items: start;
  padding-bottom: 8vh;
}

.kicker,
.eyebrow {
  color: var(--cyan);
  font-family: Orbitron, system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  margin-top: 1rem;
  color: var(--gold);
  font-family: Orbitron, system-ui, sans-serif;
  font-size: clamp(4rem, 18vw, 12rem);
  line-height: 0.86;
  text-shadow:
    0 0 1rem rgba(255, 214, 74, 0.42),
    0 0 3.8rem rgba(255, 159, 28, 0.22);
}

.lead {
  max-width: 640px;
  margin-top: 1.4rem;
  color: var(--steel);
  font-size: clamp(1.25rem, 3vw, 2rem);
  font-weight: 600;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 2.1rem;
}

.button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.2rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  color: white;
  font-family: Orbitron, system-ui, sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  text-transform: uppercase;
}

.button.primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--gold), var(--amber));
  color: #161000;
}

.button.ghost {
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(14px);
}

.panel,
.grid article {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(7, 10, 18, 0.72);
  box-shadow: 0 1.5rem 5rem rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(16px);
}

.mission {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.2fr);
  gap: 2rem;
  padding: clamp(1.2rem, 4vw, 2rem);
}

.mission h2,
.crawl h2 {
  margin-top: 0.3rem;
  color: white;
  font-family: Orbitron, system-ui, sans-serif;
  font-size: clamp(1.7rem, 4vw, 3rem);
  line-height: 1;
}

.mission p:last-child {
  color: var(--steel);
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.55;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.grid article {
  min-height: 190px;
  padding: 1.2rem;
}

.grid span {
  color: var(--red);
  font-family: Orbitron, system-ui, sans-serif;
  font-weight: 900;
}

.grid h3 {
  margin-top: 1.4rem;
  font-family: Orbitron, system-ui, sans-serif;
  font-size: 1.2rem;
}

.grid p {
  margin-top: 0.65rem;
  color: var(--steel);
  font-size: 1.06rem;
  font-weight: 600;
}

.game-zone {
  display: grid;
  grid-template-columns: minmax(240px, 0.55fr) minmax(0, 1fr);
  gap: clamp(1rem, 4vw, 2rem);
  align-items: center;
  margin-top: 10vh;
}

.game-zone,
.game-zone * {
  -webkit-tap-highlight-color: transparent;
}

.game-copy h2 {
  margin-top: 0.4rem;
  color: white;
  font-family: Orbitron, system-ui, sans-serif;
  font-size: clamp(1.8rem, 4vw, 3.4rem);
  line-height: 1;
}

.game-copy p:last-child {
  margin-top: 1rem;
  color: var(--steel);
  font-size: 1.14rem;
  font-weight: 600;
  line-height: 1.5;
}

.arcade-tabs {
  display: grid;
  gap: 0.65rem;
  margin-top: 1.35rem;
}

.mode-button {
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--steel);
  font-family: Orbitron, system-ui, sans-serif;
  font-size: 0.74rem;
  font-weight: 700;
  text-align: left;
  text-transform: uppercase;
  padding: 0.8rem 0.95rem;
  touch-action: manipulation;
}

.mode-button.is-active {
  border-color: rgba(255, 214, 74, 0.82);
  background: linear-gradient(135deg, rgba(255, 214, 74, 0.24), rgba(94, 231, 255, 0.1));
  color: white;
  box-shadow: 0 0 1.2rem rgba(255, 214, 74, 0.14);
}

.game-panel {
  grid-column: 2;
  grid-row: 1;
  display: none;
}

.game-panel.is-active {
  display: grid;
}

.game-shell {
  position: relative;
  grid-template-rows: auto auto auto;
  overflow: hidden;
  border: 1px solid rgba(94, 231, 255, 0.34);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(6, 9, 19, 0.94), rgba(11, 14, 29, 0.82));
  box-shadow:
    0 1.5rem 5rem rgba(0, 0, 0, 0.34),
    0 0 2.5rem rgba(94, 231, 255, 0.12);
  touch-action: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
}

.mini-game {
  min-height: 520px;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid rgba(94, 231, 255, 0.34);
  border-radius: 8px;
  background:
    radial-gradient(circle at 18% 20%, rgba(255, 214, 74, 0.16), transparent 28%),
    radial-gradient(circle at 86% 78%, rgba(94, 231, 255, 0.15), transparent 30%),
    linear-gradient(180deg, rgba(6, 9, 19, 0.96), rgba(11, 14, 29, 0.86));
  box-shadow:
    0 1.5rem 5rem rgba(0, 0, 0, 0.34),
    0 0 2.5rem rgba(94, 231, 255, 0.12);
  touch-action: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
}

.mini-hud {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--steel);
  font-family: Orbitron, system-ui, sans-serif;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.mini-hud strong {
  color: var(--gold);
}

.saber-arena {
  position: relative;
  min-height: 360px;
  overflow: hidden;
}

.saber-arena::before {
  content: "";
  position: absolute;
  inset: 12%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transform: perspective(340px) rotateX(56deg);
}

.saber-target {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 86px;
  height: 86px;
  border: 2px solid rgba(255, 255, 255, 0.76);
  border-radius: 999px;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.9) 0 12%, transparent 13%),
    radial-gradient(circle, rgba(255, 59, 95, 0.9), rgba(255, 59, 95, 0.18));
  color: white;
  font-family: Orbitron, system-ui, sans-serif;
  font-size: 0.74rem;
  font-weight: 900;
  transform: translate(-50%, -50%);
  box-shadow:
    0 0 1.2rem rgba(255, 59, 95, 0.62),
    0 0 3rem rgba(94, 231, 255, 0.18);
  touch-action: none;
}

.saber-target.is-waiting {
  opacity: 0.34;
  filter: grayscale(0.6);
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.72rem;
  align-content: center;
  padding: 1rem;
}

.memory-card {
  aspect-ratio: 1;
  border: 1px solid rgba(94, 231, 255, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(94, 231, 255, 0.14), rgba(255, 214, 74, 0.08)),
    rgba(255, 255, 255, 0.05);
  color: transparent;
  font-family: Orbitron, system-ui, sans-serif;
  font-size: clamp(1.45rem, 5vw, 2.35rem);
  font-weight: 900;
  touch-action: manipulation;
}

.memory-card.is-open,
.memory-card.is-matched {
  border-color: rgba(255, 214, 74, 0.8);
  background: linear-gradient(135deg, rgba(255, 214, 74, 0.9), rgba(94, 231, 255, 0.84));
  color: #05060b;
  box-shadow: 0 0 1.2rem rgba(255, 214, 74, 0.18);
}

.memory-card.is-matched {
  opacity: 0.72;
}

.mini-start {
  justify-self: center;
  margin: 0.85rem;
}

.game-hud {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--steel);
  font-family: Orbitron, system-ui, sans-serif;
  font-size: 0.76rem;
  text-transform: uppercase;
}

.game-hud span {
  white-space: nowrap;
}

.game-hud strong {
  color: var(--gold);
}

#ataa-game {
  display: block;
  width: 100%;
  aspect-ratio: 900 / 520;
  background:
    radial-gradient(circle at 50% 85%, rgba(255, 214, 74, 0.18), transparent 30%),
    radial-gradient(circle at 25% 18%, rgba(94, 231, 255, 0.16), transparent 26%),
    #03050c;
  cursor: crosshair;
  touch-action: none;
}

.game-overlay {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(3, 5, 12, 0.62);
  text-align: center;
}

.game-overlay.is-visible {
  display: grid;
}

.game-overlay p {
  margin-bottom: 1rem;
  color: var(--gold);
  font-family: Orbitron, system-ui, sans-serif;
  font-size: clamp(1.1rem, 3vw, 2rem);
  font-weight: 900;
}

.game-controls {
  display: none;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.game-controls button {
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: white;
  font-size: 1.4rem;
  font-weight: 900;
  touch-action: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
}

.crawl-wrap {
  height: 520px;
  margin-top: 10vh;
  overflow: hidden;
  perspective: 360px;
  color: var(--gold);
  font-family: Orbitron, system-ui, sans-serif;
  text-align: center;
}

.crawl {
  max-width: 760px;
  margin: 0 auto;
  transform: rotateX(27deg) translateY(400px);
  animation: crawl 24s linear infinite;
}

.crawl p {
  margin-top: 1.4rem;
  font-size: clamp(1.1rem, 3vw, 1.8rem);
  font-weight: 700;
  line-height: 1.45;
}

@keyframes drift {
  to {
    transform: translate3d(-7rem, 3rem, 0);
  }
}

@keyframes crawl {
  to {
    transform: rotateX(27deg) translateY(-720px);
  }
}

@media (max-width: 760px) {
  .command {
    width: min(100% - 24px, 1120px);
    padding-top: 5vh;
  }

  .mission,
  .grid,
  .game-zone {
    grid-template-columns: 1fr;
  }

  .grid {
    gap: 0.8rem;
  }

  .hero {
    min-height: 84vh;
  }

  .crawl-wrap {
    height: 440px;
  }

  .game-zone {
    margin-top: 6vh;
  }

  .game-copy h2 {
    font-size: clamp(1.45rem, 8vw, 2.3rem);
  }

  .game-copy p:last-child {
    font-size: 1rem;
    line-height: 1.35;
  }

  .arcade-tabs {
    grid-template-columns: 1fr;
  }

  .game-panel {
    grid-column: 1;
    grid-row: auto;
  }

  .game-shell {
    grid-template-rows: auto minmax(0, 1fr) auto;
    height: min(70svh, 620px);
    min-height: 430px;
  }

  .game-hud {
    justify-items: center;
    padding: 0.72rem 0.62rem;
    font-size: clamp(0.64rem, 3vw, 0.82rem);
  }

  #ataa-game {
    height: 100%;
    min-height: 0;
    aspect-ratio: auto;
  }

  .game-controls {
    display: grid;
    padding: 0.62rem;
  }

  .game-controls button {
    min-height: 62px;
    font-size: 1.9rem;
  }

  .mini-game {
    min-height: 430px;
    height: min(70svh, 620px);
  }

  .mini-hud {
    justify-items: center;
    padding: 0.72rem 0.62rem;
    font-size: clamp(0.6rem, 2.8vw, 0.76rem);
  }

  .saber-arena {
    min-height: 0;
  }

  .saber-target {
    width: 76px;
    height: 76px;
  }

  .memory-grid {
    gap: 0.55rem;
    padding: 0.8rem;
  }
}

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