/* ============================================================
   Zheng Arcade — "Neon Arcade Hall" theme
   Near-black room · cyan + magenta neon · CRT scanlines · grain
   Tokens + global base + atmospheric background/overlay layers.
   (Only the platform shell loads this; games are self-contained.)
   ============================================================ */

:root {
  /* Room / surfaces */
  --void: #05050b;
  --bg: #08080f;
  --panel: #0e0e1a;
  --panel-2: #14142440;
  --line: rgba(120, 130, 200, 0.16);
  --line-soft: rgba(120, 130, 200, 0.09);

  /* Neon */
  --cyan: #19f0e4;
  --magenta: #ff2e97;
  --amber: #ffc24b;
  --violet: #9b6bff;

  /* Text */
  --ink: #f3f1ff;
  --ink-dim: #9a98c4;
  --ink-faint: #5f5d86;

  /* Type */
  --font-sign: "Monoton", "Chakra Petch", cursive;
  --font-ui: "Chakra Petch", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "Share Tech Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Shape & motion */
  --radius: 6px;
  --radius-lg: 12px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 240ms;

  /* Glow helpers */
  --glow-cyan: 0 0 6px rgba(25, 240, 228, 0.7), 0 0 22px rgba(25, 240, 228, 0.45);
  --glow-magenta: 0 0 6px rgba(255, 46, 151, 0.7), 0 0 22px rgba(255, 46, 151, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--void);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}
button {
  font-family: inherit;
  cursor: pointer;
}

::selection {
  background: var(--magenta);
  color: #fff;
}

/* ---------- Atmospheric background: synthwave room ---------- */
.bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background:
    radial-gradient(140% 70% at 50% -10%, rgba(155, 107, 255, 0.16), transparent 55%),
    radial-gradient(120% 60% at 50% 112%, rgba(255, 46, 151, 0.12), transparent 55%),
    var(--void);
}

/* Glowing horizon line where the floor meets the dark */
.bg-horizon {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 30vh;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), var(--magenta), transparent);
  filter: blur(1px);
  opacity: 0.6;
  box-shadow: 0 0 30px 6px rgba(25, 240, 228, 0.3);
}

/* Perspective grid floor scrolling toward the horizon */
.bg-grid {
  position: absolute;
  left: -25%;
  right: -25%;
  bottom: 0;
  height: 30vh;
  background-image:
    linear-gradient(rgba(25, 240, 228, 0.35) 1px, transparent 1px),
    linear-gradient(90deg, rgba(155, 107, 255, 0.28) 1px, transparent 1px);
  background-size: 56px 56px;
  transform: perspective(40vh) rotateX(70deg);
  transform-origin: bottom center;
  mask-image: linear-gradient(to top, #000 5%, transparent 95%);
  -webkit-mask-image: linear-gradient(to top, #000 5%, transparent 95%);
  animation: grid-roll 6s linear infinite;
  opacity: 0.5;
}
@keyframes grid-roll {
  to { background-position: 0 56px, 0 0; }
}

/* ---------- CRT overlay: scanlines + grain + vignette ---------- */
.crt {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  /* horizontal scanlines */
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0) 0,
      rgba(0, 0, 0, 0) 2px,
      rgba(0, 0, 0, 0.16) 3px,
      rgba(0, 0, 0, 0.16) 3px
    );
  mix-blend-mode: multiply;
}
/* grain + vignette as a second layer */
.crt::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: 0.05;
  mix-blend-mode: overlay;
}
.crt::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 100% at 50% 50%, transparent 60%, rgba(0, 0, 0, 0.55) 100%);
}

/* a slow scanline sweep down the screen */
@media (prefers-reduced-motion: no-preference) {
  .crt {
    overflow: hidden;
  }
}

/* ---------- Scrollbars ---------- */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--violet) transparent;
}
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-thumb {
  background: rgba(155, 107, 255, 0.5);
  border-radius: 0;
  border: 3px solid transparent;
  background-clip: padding-box;
}

@media (prefers-reduced-motion: reduce) {
  .bg-grid { animation: none; }
}
