/* ============================================================
   main.css — resets, page layout, galaxy scene backdrop
   ============================================================ */

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  font-family: var(--font-body);
  color: var(--text-primary);
  overflow-x: hidden;
  overflow-y: auto;
  position: relative;
  background: var(--bg-void);
  -webkit-tap-highlight-color: transparent;
  touch-action: pan-y;
  overscroll-behavior-y: contain;
}

/* ---------- animated galaxy backdrop (behind everything, fixed) ---------- */

#cosmos {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse 120% 60% at 50% -10%, var(--nebula-1) 0%, transparent 55%),
    radial-gradient(ellipse 90% 50% at 85% 15%, var(--nebula-2) 0%, transparent 50%),
    radial-gradient(ellipse 100% 60% at 10% 85%, var(--nebula-3) 0%, transparent 55%),
    radial-gradient(ellipse 140% 100% at 50% 50%, var(--bg-mid) 0%, var(--bg-void) 75%);
}

#cosmos .nebula-cloud {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.35;
  mix-blend-mode: screen;
  will-change: transform;
}

#cosmos .planet {
  position: absolute;
  border-radius: 50%;
  will-change: transform;
  filter: drop-shadow(0 0 30px rgba(120, 100, 255, 0.35));
}

#cosmos .planet::after {
  content: '';
  position: absolute;
  inset: -18% -35%;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  transform: rotate(-18deg) scaleY(0.32);
}

#starfield, #shootingStars {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ---------- page shell ---------- */

.app-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 560px;
  padding: 14px 12px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-top: 4px;
}

.brand-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 30px;
  letter-spacing: 4px;
  font-weight: 800;
  background: linear-gradient(90deg, var(--accent-pink), var(--accent-violet), var(--accent-cyan), var(--accent-gold));
  background-size: 300% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: brandShimmer 6s linear infinite;
  text-shadow: 0 0 40px rgba(120, 100, 255, 0.25);
}

.brand-sub {
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-dim);
  font-family: var(--font-ui);
}

/* ---------- game stage ---------- */

#stageWrap {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  width: 100%;
  max-width: 480px;
  aspect-ratio: 480 / 640;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.08),
    0 0 0 5px rgba(120, 90, 255, 0.10),
    0 0 60px rgba(120, 80, 255, 0.28),
    0 20px 60px rgba(0,0,0,0.65);
  background: #060312;
}

#stageWrap.shake {
  animation: screenShake 0.35s cubic-bezier(.36,.07,.19,.97);
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

#flashLayer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: white;
  opacity: 0;
}

#flashLayer.flash {
  animation: screenFlash 0.28s ease-out;
}

/* floating score / combo text layer sits above canvas */
#fxLayer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

@media (max-width: 480px) {
  .brand-title { font-size: 24px; letter-spacing: 2.5px; }
}

/* ---------- site footer ---------- */

.game-footer {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 22px 14px calc(28px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  font-family: var(--font-ui);
}

.game-footer .gf-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 16px;
}

.game-footer a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 12px;
  letter-spacing: 0.4px;
}

.game-footer a:hover { color: var(--text-primary); }

.game-footer .gf-home {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 30px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 12.5px;
}

.game-footer .gf-copy {
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.4px;
}
