.brand-logo {
  display: block;
  margin: 0 auto;
  width: min(520px, 70vw);
  height: auto;
  filter: drop-shadow(0 0 22px rgba(132, 186, 255, 0.25))
          drop-shadow(0 0 54px rgba(255, 234, 160, 0.12));
  animation: brandGlow 7.5s ease-in-out infinite alternate;
}

@keyframes brandGlow {
  0% {
    filter: drop-shadow(0 0 16px rgba(132, 186, 255, 0.18))
            drop-shadow(0 0 40px rgba(255, 234, 160, 0.08));
  }
  100% {
    filter: drop-shadow(0 0 30px rgba(132, 186, 255, 0.32))
            drop-shadow(0 0 70px rgba(255, 234, 160, 0.14));
  }
}

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

/* Ensure consistent box-sizing and prevent padding/border from causing overflow */
*, *::before, *::after {
  box-sizing: border-box;
}

/* Media elements should never overflow their containers */
img, canvas, svg, video, iframe {
  max-width: 100%;
  height: auto;
}

/* (footer nav styles removed; nav is now top-of-page) */

/* Social icon plates */
.social-icons {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 0.4rem 0 0.6rem;
}

.social-icons a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background-color: rgba(255,255,255,0.9);
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 8px;
  color: rgba(255,255,255,0.9);
  text-decoration: none;
  font-size: 18px; /* icon size */
  transition: background-color .15s ease, transform .12s ease, border-color .15s ease;
}

.social-icons a:hover {
  background-color: rgba(255,255,255,0.98);
  border-color: rgba(0,0,0,0.22);
}

.social-icons a:active {
  transform: translateY(1px);
}

/* Improve keyboard accessibility */
.social-icons a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* Brand colors */
.social-icons a.youtube { color: #ff0000; }
.social-icons a.discord { color: #5865F2; }
.social-icons a.x-twitter { color: #000000; }
.social-icons a.github { color: #181717; }

/* Unified plate: all icons share the same semi-white background for consistent look */


/* Space travel chart nav (astro-nav) */
.astro-nav {
  --planet-size: 100px; /* max target size */
  --planet-min: 30px;   /* minimum size when space is tight */
  --planet-count: 4;    /* number of planets; adjust if adding items */
  --ring: 2px;
  --orbit-pad-left: max(10px, env(safe-area-inset-left));
  --orbit-pad-right: max(10px, env(safe-area-inset-right));
  --planet-d: clamp(var(--planet-min), calc((100% - var(--orbit-pad-left) - var(--orbit-pad-right)) / var(--planet-count)), var(--planet-size));
  display: flex;
  align-items: center;
  justify-content: space-between; /* even spacing; flush ends */
  gap: 0;
  width: 100%;
  margin: 6px 0 2px;
  position: relative;
  overflow: visible; /* prevent glow clipping */
  padding-left: var(--orbit-pad-left);
  padding-right: var(--orbit-pad-right);
}

.astro-nav .orbit {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 0;
  border-top: 2px dashed rgba(255,255,255,0.28);
  pointer-events: none;
}

/* Contain the dashed line between first and last planet edges */
.astro-nav .orbit { left: calc(var(--planet-d) / 2 + var(--ring)); right: calc(var(--planet-d) / 2 + var(--ring)); }

/* Inner track handles layout/scroll; parent remains overflow-visible for glows */
.astro-nav .track {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 0;
}

.astro-nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--planet-d);
  height: var(--planet-d);
  flex: 0 0 var(--planet-d); /* size tracks available width; stays circular */
  border-radius: 50%;
  box-shadow: none; /* avoid iOS rectangular halo at larger sizes */
  border: none;
  text-decoration: none;
  color: #0b0c10;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}

/* Planet image */
.astro-nav a .planet-wrap {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden; /* clip image to circle to avoid iOS square halo */
  /* crisp circular mask (no fade) so the ring isn't dimmed */
  -webkit-mask-image: radial-gradient(50% 50% at 50% 50%, #000 100%, transparent 100%);
  mask-image: radial-gradient(50% 50% at 50% 50%, #000 100%, transparent 100%);
  background: transparent;
}

.astro-nav a img.planet {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  content-visibility: auto; /* avoid early paint while decoding */
}

/* Soft ring around planets */
.astro-nav a .planet-wrap { position: relative; }
.astro-nav a .planet-wrap::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: none; box-shadow: none; pointer-events: none; z-index: 1; }

/* Draw the selection ring on the anchor itself so the outer glow isn't clipped by the masked image */
.astro-nav a[aria-current="page"]::before,
.astro-nav a[aria-current="true"]::before { content: none; }

.astro-nav a[aria-current="page"]::after,
.astro-nav a[aria-current="true"]::after {
  content: "";
  position: absolute;
  left: -5px; right: -5px; top: -5px; bottom: -5px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.98);
  /* Ring only; no glow */
  box-shadow: none;
  pointer-events: none;
  z-index: 2;
}

/* Normalize spacing between brand/tagline and nav across pages */
.brand + .astro-nav { margin-top: 1rem; }
.hub-header .tagline { margin-bottom: 0; }

.astro-nav a:focus-visible {
  outline: 2px solid #7ea6ff;
  outline-offset: 2px;
}

.astro-nav a:hover { transform: translateY(-1px) scale(1.03); }
.astro-nav a:active { transform: translateY(0); }

/* Fallback theming when images are unavailable */
.astro-nav.show-labels a { background: radial-gradient(circle at 35% 30%, #cfe9ff, #78b7ff 50%, #4aa7ff 70%, #1b6ad1 100%); }
.astro-nav.show-labels a.mars { background: radial-gradient(circle at 35% 30%, #ffd7c2, #ff9f70 55%, #e66a3d 75%, #b0401c 100%); }
.astro-nav.show-labels a.jupiter { background: radial-gradient(circle at 35% 30%, #fff4d8, #f2e0b8 45%, #e3c79a 65%, #d0a97a 85%, #b4885e 100%); }
.astro-nav.show-labels a.saturn { background: radial-gradient(circle at 35% 30%, #faf0e2, #ead8ba 55%, #d5bb92 75%, #b89872 100%); }

/* Tiny planet rings hint for Saturn */
.astro-nav.show-labels a.saturn::after {
  content: "";
  position: absolute;
  width: 58px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-left-color: transparent;
  border-right-color: transparent;
  border-radius: 50%;
  transform: rotate(-20deg);
  pointer-events: none;
  opacity: .7;
}

/* Labels are screen-reader only by default */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* If images fail, reveal labels visually */
.astro-nav.show-labels a .label {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  width: max-content;
}

/* Per-item image fallback */
.astro-nav a.fallback .label {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  width: max-content;
  /* override sr-only */
  clip: auto; width: auto; height: auto; margin: 0; overflow: visible; position: absolute; border: 0;
}

/* Compact variant: scale planets down instead of horizontal scroll */
@media (max-width: 520px) {
  .astro-nav { --planet-min: 28px; }
}

/* When space is extra tight, shrink planets slightly */
@media (max-width: 340px) {
  .astro-nav { --planet-size: 46px; }
  .astro-nav.show-labels a.saturn::after { width: 54px; height: 16px; }
}

/* Standardized account menu for all pages (React + static) */
.account-menu {
  grid-row: 1;
  grid-column: 3;
  justify-self: end;
  align-self: start;
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  z-index: 5; /* above hero/logo within header */
}
.account-menu a, .account-menu button {
  font-size: 0.92rem;
  padding: 0 0.25rem;
  line-height: 1.2;
  font-family: inherit;
  font-weight: 500;
  letter-spacing: normal;
  text-decoration: none;
  margin: 0;
  display: inline-block;
}
/* Normalize button to look like links in the compact account bar */
.account-menu button {
  background: transparent;
  border: 0;
  color: #646cff;
  padding: 0 0.25rem;
  appearance: none;
  cursor: pointer;
}
.account-menu button:hover { color: #535bf2; }

/* Give the account button a "current" ring on the Account page */
.account-menu a[aria-current="page"] {
  position: relative;
}
.account-menu a[aria-current="page"]::before { content: none; }
.account-menu a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: -8px; right: -8px; top: -6px; bottom: -6px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.98);
  /* Ring only; no glow */
  box-shadow: none;
  pointer-events: none;
  z-index: 2;
}

/* Place brand and nav within the header grid */
.hub-header .brand { grid-row: 1; grid-column: 2; }
.hub-header .astro-nav { grid-row: 2; grid-column: 1 / -1; }

/*
  Base: unify background and overscroll behavior across React and static pages
  - iOS pull-to-refresh can briefly reveal the root background; ensure it's non-white
  - Prevent scroll chaining artifacts that cause flicker on long content
*/
html {
  background: linear-gradient(180deg, var(--bg0, #0b0c10), var(--bg1, #11131a));
  min-height: 100%;
  background-color: var(--bg0, #0b0c10);
  overscroll-behavior-x: none;
  -webkit-tap-highlight-color: transparent;
  height: 100%;
  /* Reserve space for the vertical scrollbar to avoid layout shifts */
  scrollbar-gutter: stable;
}

body {
  min-height: 100%;
  height: 100%;
  background: linear-gradient(180deg, var(--bg0, #0b0c10), var(--bg1, #11131a));
  background-color: var(--bg0, #0b0c10);
  overflow-x: hidden;
  overflow-y: auto; /* desktop uses root scroll */
  -webkit-overflow-scrolling: touch;
}

/* Standard starfield class to match React home */
.starfield {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

/* Ensure page content stacks above the starfield */
.wrap, #root {
  position: relative;
  z-index: 1;
}

/* On iOS Safari only, use an internal scroller to avoid rubber-band issues */
@supports (-webkit-touch-callout: none) {
  @media (hover: none) and (pointer: coarse) {
    html, body { height: 100%; overflow: hidden; }
    .wrap, #root {
      height: 100vh;
      height: 100svh;
      height: 100dvh;
      overflow: auto;
      /* Prevent horizontal scrollbars in the internal scroller on iOS */
      overflow-x: hidden;
      -webkit-overflow-scrolling: touch;
      overscroll-behavior-y: contain;
    }
  }
}

/* Mitigate iOS scroll jank when bouncing at page edges */
@supports (-webkit-touch-callout: none) {
  html, body, .wrap, #root { overscroll-behavior-y: contain; }
}

/* Also reserve gutter for internal scrollers so content doesn't shift when they gain Y scrollbars */
#root, .wrap { scrollbar-gutter: stable; }

/* Fallback for browsers without scrollbar-gutter support */
@supports not (scrollbar-gutter: stable) {
  html { margin-left: calc(100vw - 100%); }
}

/* Alternative/standardized card container to match Home game cards */
.card, .game-card {
  border: 1px solid var(--card-border, rgba(255,255,255,0.08));
  border-radius: 12px;
  padding: 1.1rem 1.1rem 1rem;
  text-align: left;
  /* Use a static glossy gradient instead of backdrop blur to avoid heavy compositing over the animated canvas. */
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  box-shadow:
    0 1px 0 rgba(255,255,255,0.06) inset,
    0 10px 30px rgba(0,0,0,0.25);
  /* Removed backdrop-filter for performance; consider a device-capability toggle later. */
  contain: paint;
}

/* Reduce jank on iOS Safari: disable backdrop-filter which can trigger heavy compositing */
@supports (-webkit-touch-callout: none) {
  .card, .game-card {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  }
}
