:root {
  --acid: #b9ff3d;
  --bg: #07090d;
  --cyan: #6ee8ff;
  --ink: #f2f3ec;
  --muted: #9ba5aa;
  --panel: rgba(10, 17, 23, 0.72);
  --panel-strong: rgba(8, 13, 18, 0.92);
  --line: rgba(183, 225, 239, 0.16);
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  isolation: isolate;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 17% 7%, rgba(69, 122, 134, 0.2), transparent 34%),
    radial-gradient(circle at 82% 28%, rgba(111, 80, 164, 0.13), transparent 30%),
    linear-gradient(165deg, #071014, #030608 52%, var(--bg));
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
  color: inherit;
  font: inherit;
}

button,
[role="button"],
a[href] {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--acid);
  outline-offset: 4px;
}

.cursor-comet {
  position: fixed;
  z-index: 30;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.cursor-comet__trail {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.cursor-comet__head {
  position: absolute;
  top: 0;
  left: 0;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    #fff 0 7%,
    #fff9e9 14%,
    #ffe8bfe8 28%,
    #ffc97978 54%,
    #ffc97900 100%
  );
  transform: translate3d(-200px, -200px, 0) translate(-50%, -50%);
  transform-origin: center;
  will-change: transform;
}

.arcade-sky {
  position: fixed;
  z-index: -1;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

main {
  width: min(1380px, calc(100% - 48px));
  margin-inline: auto;
}

.arcade-hero {
  display: grid;
  max-width: 1180px;
  min-height: 39vh;
  align-content: center;
  margin-inline: auto;
  padding: calc(clamp(3rem, 8vw, 7rem) - 2rem) 0
    calc(clamp(3rem, 6vw, 5rem) + 2rem);
}

.game-console__eyebrow {
  margin: 0 0 1rem;
  color: var(--acid);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.arcade-hero h1 {
  margin: 0;
  font-size: clamp(4rem, 10vw, 8.7rem);
  font-weight: 750;
  letter-spacing: -0.085em;
  line-height: 0.77;
}

.arcade-hero h1 em {
  color: transparent;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  -webkit-text-stroke: 1px rgba(240, 241, 234, 0.65);
}

.arcade-hero > p:last-child {
  max-width: 600px;
  margin: 2.25rem 0 0;
  color: #aeb7ba;
  font-size: clamp(1rem, 1.6vw, 1.25rem);
  line-height: 1.6;
}

.game-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin-bottom: clamp(2.5rem, 5vw, 4.5rem);
}

.game-card {
  position: relative;
  display: grid;
  min-height: 144px;
  grid-template-columns: 76px 1fr;
  gap: 1rem;
  align-items: center;
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at 0 0, rgba(255, 255, 255, 0.055), transparent 54%),
    rgba(8, 14, 19, 0.58);
  text-align: left;
  transition:
    border-color 220ms ease,
    background 220ms ease,
    transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
  backdrop-filter: blur(16px) saturate(120%);
}

.game-card::after {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at var(--card-x, 50%) var(--card-y, 50%),
    rgba(110, 232, 255, 0.15),
    transparent 36%
  );
  content: "";
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.game-card:hover,
.game-card:focus-visible {
  border-color: rgba(110, 232, 255, 0.42);
  background-color: rgba(11, 21, 28, 0.76);
  transform: translateY(-4px);
}

.game-card:hover::after,
.game-card:focus-visible::after {
  opacity: 1;
}

.game-card.is-active {
  border-color: rgba(185, 255, 61, 0.72);
  background-color: rgba(17, 28, 23, 0.84);
  box-shadow:
    inset 0 0 0 1px rgba(185, 255, 61, 0.08),
    0 22px 55px rgba(0, 0, 0, 0.24);
}

.game-card__art {
  position: relative;
  width: 72px;
  aspect-ratio: 1;
  border-radius: 22px;
  background: rgba(0, 0, 0, 0.32);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 18px 32px rgba(0, 0, 0, 0.24);
}

.game-card__art::before,
.game-card__art::after {
  position: absolute;
  content: "";
}

.game-card__art--blocks::before {
  top: 19px;
  left: 17px;
  width: 17px;
  height: 17px;
  border-radius: 4px;
  background: #66e4ff;
  box-shadow:
    18px 0 #66e4ff,
    18px 18px #ba76ff,
    36px 18px #ba76ff,
    0 36px #b9ff3d,
    18px 36px #b9ff3d;
  filter: drop-shadow(0 0 7px rgba(110, 232, 255, 0.58));
}

.game-card__art--prism::before {
  top: 18px;
  left: 18px;
  width: 18px;
  height: 18px;
  background: linear-gradient(135deg, #fff0a8, #ff7ed8 55%, #8a5cff);
  box-shadow:
    20px 0 #76edff,
    0 20px #76edff,
    20px 20px #ff7ed8,
    40px 20px #b9ff3d,
    20px 40px #b9ff3d;
  transform: rotate(45deg) scale(0.7);
  filter: drop-shadow(0 0 8px rgba(255, 126, 216, 0.5));
}

.game-card__art--snake::before {
  top: 34px;
  left: 15px;
  width: 42px;
  height: 18px;
  border: 7px solid #b9ff3d;
  border-top-color: transparent;
  border-radius: 50%;
  rotate: -14deg;
  filter: drop-shadow(0 0 7px rgba(185, 255, 61, 0.65));
}

.game-card__art--snake::after {
  top: 22px;
  right: 12px;
  width: 13px;
  height: 13px;
  border-radius: 50% 50% 50% 18%;
  background: #e8ffd0;
  rotate: 28deg;
  box-shadow: 0 0 12px rgba(185, 255, 61, 0.8);
}

.game-card__art--breaker::before {
  top: 16px;
  left: 14px;
  width: 43px;
  height: 9px;
  border-radius: 3px;
  background: linear-gradient(90deg, #ff6f91 0 30%, #ffcf5c 30% 64%, #6ee8ff 64%);
  box-shadow:
    0 13px rgba(255, 255, 255, 0.28),
    9px 26px #8d72ff;
}

.game-card__art--breaker::after {
  right: 14px;
  bottom: 12px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 13px #fff;
}

.game-card__art--duel::before {
  top: 16px;
  bottom: 16px;
  left: 16px;
  width: 7px;
  border-radius: 8px;
  background: #6ee8ff;
  box-shadow: 34px 0 #ff7ed8;
}

.game-card__art--duel::after {
  top: 30px;
  left: 32px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 14px #fff;
}

.game-card__art--drift::before {
  top: 18px;
  left: 20px;
  width: 33px;
  height: 40px;
  background: linear-gradient(140deg, #f6f7ee, #6ee8ff 72%);
  clip-path: polygon(50% 0, 100% 100%, 50% 74%, 0 100%);
  filter: drop-shadow(0 0 10px rgba(110, 232, 255, 0.58));
}

.game-card__art--signal::before {
  top: 20px;
  left: 17px;
  width: 38px;
  height: 29px;
  border: 3px solid #6ee8ff;
  border-top: 0;
  clip-path: polygon(0 0, 50% 100%, 100% 0, 76% 0, 50% 57%, 24% 0);
  filter: drop-shadow(0 0 8px rgba(110, 232, 255, 0.72));
}

.game-card__art--signal::after {
  top: 13px;
  left: 33px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #b9ff3d;
  box-shadow:
    0 0 10px #b9ff3d,
    -15px 36px 0 -1px #ff7ecb,
    15px 36px 0 -1px #ff7ecb;
}

.game-card__art--summit::before {
  right: 10px;
  bottom: 13px;
  left: 9px;
  height: 34px;
  border-bottom: 8px solid #dff8ff;
  border-radius: 0 0 58% 18%;
  rotate: 12deg;
  filter: drop-shadow(0 0 9px rgba(110, 232, 255, 0.48));
}

.game-card__art--summit::after {
  top: 21px;
  left: 25px;
  width: 28px;
  height: 6px;
  border-radius: 50%;
  background: #ff7ecb;
  box-shadow: 0 -9px 0 -1px #f7f7ee;
  rotate: -13deg;
  filter: drop-shadow(0 0 7px rgba(255, 126, 203, 0.62));
}

.game-card__art--flock::before {
  top: 22px;
  left: 18px;
  width: 36px;
  height: 21px;
  background: linear-gradient(135deg, #ff7ecb, #ffc85a 52%, #6ee8ff);
  clip-path: polygon(0 18%, 43% 42%, 50% 0, 57% 42%, 100% 18%, 70% 68%, 50% 100%, 30% 68%);
  filter: drop-shadow(0 0 9px rgba(255, 126, 203, 0.65));
}

.game-card__art--flock::after {
  inset: 12px;
  border: 1px solid rgba(247, 247, 238, 0.55);
  border-radius: 50%;
  box-shadow:
    inset 0 0 0 12px rgba(0, 0, 0, 0.32),
    0 0 12px rgba(110, 232, 255, 0.28);
}

.game-card__copy {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 0.45rem;
}

.game-card__copy strong {
  font-size: 1.08rem;
  letter-spacing: -0.02em;
}

.game-card__copy small {
  color: #8c989b;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.game-console {
  padding: clamp(1rem, 2.5vw, 2rem);
  border: 1px solid rgba(155, 196, 211, 0.16);
  border-radius: clamp(24px, 3vw, 40px);
  background:
    radial-gradient(circle at 50% 0, rgba(110, 232, 255, 0.09), transparent 44%),
    rgba(5, 10, 14, 0.78);
  box-shadow:
    0 60px 120px rgba(0, 0, 0, 0.45),
    inset 0 1px rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(22px) saturate(120%);
}

.game-console__topline {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  gap: clamp(1rem, 3vw, 3rem);
  align-items: center;
  padding: 0.3rem 0 1.5rem;
}

.game-console__eyebrow {
  margin-bottom: 0.35rem;
}

.game-console h2 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 3.1rem);
  letter-spacing: -0.055em;
}

.game-stats {
  display: flex;
  gap: clamp(1.25rem, 4vw, 3.5rem);
  margin: 0;
}

.game-stats div {
  min-width: 64px;
}

.game-stats dt,
.game-stats dd {
  margin: 0;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  text-transform: uppercase;
}

.game-stats dt {
  margin-bottom: 0.32rem;
  color: #768287;
  font-size: 0.56rem;
  letter-spacing: 0.14em;
}

.game-stats dd {
  color: var(--ink);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
}

.game-restart {
  min-height: 44px;
  padding: 0 1rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: #c3cbcd;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition:
    border-color 180ms ease,
    color 180ms ease,
    transform 180ms ease;
}

.game-restart:hover,
.game-restart:focus-visible {
  border-color: rgba(185, 255, 61, 0.62);
  color: var(--ink);
  transform: translateY(-2px);
}

.game-stage {
  position: relative;
  scroll-margin-top: var(--game-scroll-top, 16px);
  max-width: var(--game-stage-width, 100%);
  margin-inline: auto;
  aspect-ratio: 16 / 10;
  border: 1px solid rgba(110, 232, 255, 0.16);
  border-radius: clamp(18px, 2vw, 28px);
  overflow: hidden;
  background: #030609;
  transition: none;
  box-shadow:
    inset 0 0 80px rgba(0, 0, 0, 0.65),
    0 35px 80px rgba(0, 0, 0, 0.32);
}

.game-stage[data-game="snake"] {
  aspect-ratio: 3 / 2;
}

.game-stage::after {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.016) 0 1px,
    transparent 1px 4px
  );
  content: "";
  mix-blend-mode: soft-light;
  pointer-events: none;
}

.game-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.game-status {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  background: rgba(2, 5, 7, 0.58);
  text-align: center;
  backdrop-filter: blur(10px);
}

.game-status[hidden] {
  display: none;
}

.game-status__detail {
  margin-bottom: 0.5rem;
  font-size: 1rem;
  color: var(--muted);
}

.game-status p {
  margin: 0 0 1.2rem;
  font-size: clamp(2.1rem, 7vw, 5.5rem);
  font-weight: 750;
  letter-spacing: -0.07em;
}

.game-status button {
  min-height: 52px;
  padding: 0 1.4rem;
  border-radius: 999px;
  background: var(--acid);
  color: #071006;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.game-status__hint {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.game-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 1.4rem 0 0.25rem;
}

.game-controls > p {
  margin: 0;
  color: #909b9e;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.64rem;
  line-height: 1.55;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.touch-controls {
  display: flex;
  gap: 0.45rem;
}

.touch-controls button {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  color: #cdd5d5;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 1rem;
  transition:
    border-color 120ms ease,
    background 120ms ease,
    transform 120ms ease;
  touch-action: manipulation;
}

.touch-controls button[hidden] {
  display: none;
}

.touch-controls button:hover,
.touch-controls button:focus-visible,
.touch-controls button.is-pressed {
  border-color: rgba(110, 232, 255, 0.58);
  background: rgba(110, 232, 255, 0.12);
  color: #fff;
  transform: translateY(-2px);
}

.touch-controls .touch-controls__action {
  margin-left: 0.4rem;
  border-color: rgba(185, 255, 61, 0.42);
  color: var(--acid);
  font-size: 0.7rem;
}

@media (min-width: 681px) {
  .game-console {
    width: 85%;
    margin-inline: auto;
  }
}

@media (max-width: 980px) {
  .game-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .game-console__topline {
    grid-template-columns: 1fr auto;
  }

  .game-stats {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: space-between;
  }

  .game-restart {
    grid-column: 2;
    grid-row: 1;
  }
}

@media (max-width: 680px) {
  main {
    width: min(100% - 24px, 1380px);
  }

  .arcade-hero {
    min-height: 45vh;
    padding-top: 1rem;
    padding-bottom: 6.5rem;
  }

  .arcade-hero h1 {
    font-size: clamp(3.55rem, 19vw, 5.7rem);
    line-height: 0.82;
  }

  .game-picker {
    display: flex;
    margin-right: -12px;
    padding-right: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .game-picker::-webkit-scrollbar {
    display: none;
  }

  .game-card {
    min-width: min(82vw, 330px);
    scroll-snap-align: start;
  }

  .game-card:hover,
  .game-card:focus-visible {
    transform: none;
  }

  .game-console {
    padding: 0.75rem;
    border-radius: 24px;
  }

  .game-console__topline {
    padding: 0.5rem 0.35rem 1rem;
  }

  .game-console h2 {
    font-size: 2rem;
  }

  .game-stats {
    gap: 0.75rem;
  }

  .game-stats div {
    min-width: 0;
  }

  .game-stage {
    aspect-ratio: 4 / 5;
    border-radius: 18px;
  }

  .game-controls {
    flex-direction: column;
    align-items: stretch;
    padding-top: 1rem;
  }

  .game-controls > p {
    min-height: 2.9em;
    padding-inline: 0.35rem;
  }

  .touch-controls {
    justify-content: center;
  }

  .touch-controls button {
    width: min(15vw, 52px);
    height: min(15vw, 52px);
  }
}

@media (pointer: fine) and (prefers-reduced-motion: no-preference) {
  body,
  a,
  button,
  canvas {
    cursor: none;
  }
}

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

  .cursor-comet {
    display: none;
  }
}
