/* fonts and stuff, skidded from github */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@700;900&family=JetBrains+Mono:wght@300;400&display=swap');

/* main styles */
@import url(themes.css);
@import url(main.css);
@import url(nav.css);

/* custom font i found somewhere */
@font-face {
  font-family: "gg sans";
  font-style: normal;
  font-weight: 400;
  src: url(/assets/fonts/ggsans.woff2) format("woff2");
  font-display: swap;
}

/* reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

/* trying to set font but it keeps overriding??? */
body, html, div, span, p, a, button, input {
  font-family: "JetBrains Mono", monospace;
  font-weight: 400;
}

body {
  /* background-image carries the themed gradient; background-color is a solid
     layer underneath so themes with transparent gradient stops (e.g. dark-blue)
     don't reveal the parent frame's canvas through the "holes". Keep these as
     separate longhands - the `background` shorthand resets background-color. */
  background-image: var(--background);
  background-color: #0a0a0f;
  color: var(--text-color);
  min-height: 100vh;
  position: relative;
  text-align: center;
}

/* animated grid thingy */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: -3;

  --grid-size: 42px;
  --grid-line: rgba(255, 255, 255, 0.08);
  --grid-glow: rgba(255, 255, 255, 0.03);

  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px),
    radial-gradient(circle at 50% 50%, var(--grid-glow), transparent 55%);

  background-size:
    var(--grid-size) var(--grid-size),
    var(--grid-size) var(--grid-size),
    900px 900px;

  animation: driftGrid 28s linear infinite;
}

/* stars background removed - was a drifting 1px dot pattern on a fullscreen
 * fixed element, barely visible but cost a fullscreen compositor repaint on
 * every animation tick. Grid provides enough visual texture on its own. */

/* animations - transform based so they run on the compositor thread */
@keyframes driftGrid {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(var(--grid-size), var(--grid-size), 0); }
}

/* online counter, shows how many people are playing right now - thank you claude */
.bottomStatus {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 8px 16px;
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  font-size: 14px;
  text-align: center;
  z-index: 20;
  backdrop-filter: blur(6px);
}

.bottomStatus span:first-child {
  font-weight: 600;
  color: #a855f7;
}

/* performance mode for my ipads */
@media (prefers-reduced-motion: reduce) {
  body::before {
    animation: none;
  }
}

/* auto-throttle on smaller/touch-only devices - these are usually the ones
   that struggle. users can still get the full effect on desktop. */
@media (hover: none) and (pointer: coarse) {
  body::before {
    /* keep the grid but stop animating it - static is fine */
    animation: none;
  }
  /* iOS Safari really hates backdrop-filter, so kill it on touch */
  .sidebar,
  .nav-overlay,
  .glassCard,
  .wideGlassCard,
  body[theme="dark"] .dark-search {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
}

.lowPowerMode body::before,
.powerSaving body::before,
html.powerSaving body::before {
  animation: none !important;
  background-image: none !important;
}

.lowPowerMode canvas,
.powerSaving canvas,
html.powerSaving canvas {
  display: none !important;
}

.lowPowerMode .glass-card,
.lowPowerMode .glass-panel,
.powerSaving .glass-card,
.powerSaving .glass-panel,
html.powerSaving .glassCard,
html.powerSaving .wideGlassCard,
html.powerSaving .sidebar,
html.powerSaving .nav-overlay {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.lowPowerMode *,
.powerSaving *,
html.powerSaving * {
  transition: none !important;
  box-shadow: none !important;
}

.lowPowerMode body,
.powerSaving body,
html.powerSaving body {
  background: #0f0f16 !important;
}

/* mobile stuff idek */
@media (max-width: 900px) {
  body {
    /* Force the purple theme gradient on mobile regardless of selected theme.
       Using background-image here (not the `background` shorthand) so the
       background-color fallback from the main body rule stays in effect and
       prevents parent-frame bleed-through when loaded inside an iframe. */
    background-image: linear-gradient(135deg, #3b0a3f 0%, #5b1a6e 40%, #3c1361 100%) !important;
  }
  
  body::before {
    opacity: 0.75 !important;
  }
  
  canvas {
    opacity: 0.9;
  }
}