/* ==========================================================================
   actually_genius — core stylesheet
   purple / black / kawaii / cyber / dreamy
   ========================================================================== */

:root{
  /* --- color tokens --- */
  --void:        #07040f;
  --void-2:      #0d0819;
  --panel:       #150f28;
  --panel-2:     #1c1436;
  --line:        rgba(155, 110, 255, .28);
  --line-bright: rgba(200, 170, 255, .55);

  --purple:      #9b5cff;
  --purple-deep: #6a2fe0;
  --purple-soft: #c9aeff;
  --pink:        #ff8fd8;
  --pink-soft:   #ffc2ec;
  --cyan:        #7ff7e8;
  --star:        #f7f3ff;
  --danger:      #ff6b8b;

  --grad-hero: radial-gradient(120% 120% at 50% 0%, #241a45 0%, #0d0819 55%, #07040f 100%);
  --grad-card: linear-gradient(160deg, rgba(155,92,255,.14), rgba(255,143,216,.05));
  --grad-text: linear-gradient(95deg, var(--purple-soft) 0%, var(--pink) 45%, var(--cyan) 100%);

  /* --- type tokens --- */
  --font-pixel: 'Press Start 2P', monospace;
  --font-body:  'Quicksand', system-ui, sans-serif;
  --font-mono:  'Space Mono', 'Courier New', monospace;

  /* --- misc --- */
  --radius: 14px;
  --radius-sm: 8px;
  --pixel-border: 4px;
  --shadow-glow: 0 0 0 1px var(--line), 0 8px 40px -8px rgba(155, 92, 255, .45);
  --ease: cubic-bezier(.16,.84,.44,1);
}

/* ==========================================================================
   reset
   ========================================================================== */
*, *::before, *::after{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
body{
  margin: 0;
  background: var(--void);
  color: var(--star);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img, canvas, svg{ display: block; max-width: 100%; }
a{ color: inherit; text-decoration: none; }
button{ font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
ul, ol{ list-style: none; margin: 0; padding: 0; }
h1, h2, h3, p{ margin: 0; }

:focus-visible{
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link{
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--purple);
  color: var(--void);
  padding: .6em 1em;
  z-index: 999;
}
.skip-link:focus{ left: 1rem; top: 1rem; }

/* ==========================================================================
   ambient background layers
   ========================================================================== */
#bg-stars{
  position: fixed;
  inset: 0;
  z-index: -3;
  width: 100%;
  height: 100%;
  background: var(--void);
}

.bg-blobs{
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}
.blob{
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .55;
  mix-blend-mode: screen;
}
.blob--a{
  width: 46vw; height: 46vw;
  background: radial-gradient(circle, var(--purple) 0%, transparent 70%);
  top: -12%; left: -10%;
  animation: drift-a 26s ease-in-out infinite;
}
.blob--b{
  width: 38vw; height: 38vw;
  background: radial-gradient(circle, var(--pink) 0%, transparent 70%);
  bottom: -14%; right: -8%;
  animation: drift-b 32s ease-in-out infinite;
}
.blob--c{
  width: 30vw; height: 30vw;
  background: radial-gradient(circle, var(--cyan) 0%, transparent 70%);
  top: 40%; left: 55%;
  opacity: .35;
  animation: drift-c 22s ease-in-out infinite;
}

.scanlines{
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0) 0px,
    rgba(0,0,0,0) 2px,
    rgba(0,0,0,.12) 3px,
    rgba(0,0,0,0) 4px
  );
  mix-blend-mode: overlay;
  transition: opacity .3s var(--ease);
}
.scanlines.is-off{ opacity: 0; }

.grain{
  position: fixed;
  inset: 0;
  z-index: 39;
  pointer-events: none;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%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)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* floating mascot */
#mascot{
  position: fixed;
  top: 0; left: 0;
  width: 40px; height: 40px;
  z-index: 50;
  pointer-events: none;
  transform: translate(-100px,-100px);
  filter: drop-shadow(0 0 6px rgba(155,92,255,.8));
  transition: transform .12s linear;
}
#mascot svg{ width: 100%; height: 100%; image-rendering: pixelated; }
@media (max-width: 780px), (hover: none){
  #mascot{ display: none; }
}

/* ==========================================================================
   nav
   ========================================================================== */
.nav{
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(10px);
  background: rgba(7, 4, 15, .55);
  border-bottom: 1px solid var(--line);
}
.nav__inner{
  max-width: 1120px;
  margin: 0 auto;
  padding: .9rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.nav__logo{
  display: flex;
  align-items: center;
  gap: .5rem;
  font-family: var(--font-pixel);
  font-size: .7rem;
  letter-spacing: .02em;
  color: var(--star);
}
.nav__logo-glyph{
  color: var(--pink);
  animation: spin-slow 6s linear infinite;
  display: inline-block;
}
.nav__logo-text{ white-space: nowrap; }

.nav__links{
  display: flex;
  gap: 1.5rem;
  font-size: .92rem;
  font-weight: 600;
}
.nav__links a{
  position: relative;
  padding: .2rem 0;
  color: var(--purple-soft);
  transition: color .2s;
}
.nav__links a::after{
  content: '';
  position: absolute;
  left: 0; right: 100%;
  bottom: -3px;
  height: 2px;
  background: var(--grad-text);
  transition: right .25s var(--ease);
}
.nav__links a:hover{ color: var(--star); }
.nav__links a:hover::after{ right: 0; }

.nav__toggles{ display: flex; gap: .5rem; }
.icon-btn{
  width: 34px; height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(155,92,255,.08);
  transition: background .2s, border-color .2s, transform .15s;
}
.icon-btn:hover{ background: rgba(155,92,255,.2); border-color: var(--line-bright); transform: translateY(-1px); }
.icon-btn[aria-pressed="false"]{ opacity: .45; }

@media (max-width: 640px){
  .nav__links{ display: none; }
}

/* ==========================================================================
   buttons
   ========================================================================== */
.btn{
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-family: var(--font-pixel);
  font-size: .68rem;
  line-height: 1;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform .15s var(--ease), box-shadow .2s, filter .2s;
  text-align: center;
}
.btn--primary{
  color: var(--void);
  background: var(--grad-text);
  box-shadow: 0 6px 0 0 var(--purple-deep), 0 10px 30px -8px rgba(155,92,255,.7);
}
.btn--primary:hover{ transform: translateY(-2px); filter: brightness(1.08); }
.btn--primary:active{ transform: translateY(2px); box-shadow: 0 2px 0 0 var(--purple-deep); }

.btn--ghost{
  color: var(--purple-soft);
  border: 2px solid var(--line);
  background: rgba(155,92,255,.06);
}
.btn--ghost:hover{ border-color: var(--line-bright); color: var(--star); background: rgba(155,92,255,.14); }
.btn--ghost:disabled{ opacity: .35; cursor: not-allowed; }

.btn--sm{ font-size: .6rem; padding: .7rem .9rem; }

/* ==========================================================================
   hero
   ========================================================================== */
.hero{
  min-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6rem 1.5rem 3rem;
  background: var(--grad-hero);
  position: relative;
}
.hero__inner{ max-width: 720px; }
.hero__eyebrow{
  font-family: var(--font-mono);
  color: var(--cyan);
  font-size: .85rem;
  letter-spacing: .06em;
  margin-bottom: 1.25rem;
  opacity: .8;
}
.hero__title{
  font-family: var(--font-pixel);
  font-size: clamp(1.6rem, 6vw, 3.2rem);
  line-height: 1.4;
  margin-bottom: 1.5rem;
}
.glitch{
  position: relative;
  display: inline-block;
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero__tagline{
  font-size: 1.15rem;
  color: var(--purple-soft);
  max-width: 46ch;
  margin: 0 auto 2.25rem;
}
.hero__actions{
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}
.hero__hint{
  font-family: var(--font-mono);
  font-size: .8rem;
  color: rgba(247,243,255,.4);
}
.hero__scroll{
  position: absolute;
  bottom: 2rem; left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: .7rem;
  color: var(--purple-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  opacity: .7;
}
.hero__scroll span{
  width: 1px; height: 26px;
  background: linear-gradient(var(--purple-soft), transparent);
  animation: scroll-pulse 1.8s ease-in-out infinite;
}

/* ==========================================================================
   sections generic
   ========================================================================== */
section{
  max-width: 1120px;
  margin: 0 auto;
  padding: 6rem 1.5rem;
}
.section-head{ margin-bottom: 3rem; text-align: center; }
.section-tag{
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--cyan);
  border: 1px solid var(--line);
  padding: .3rem .7rem;
  border-radius: 999px;
  margin-bottom: 1rem;
}
.section-title{
  font-family: var(--font-pixel);
  font-size: clamp(1.1rem, 3vw, 1.6rem);
  line-height: 1.6;
  margin-bottom: .75rem;
}
.section-sub{
  color: var(--purple-soft);
  max-width: 56ch;
  margin: 0 auto;
}

/* ==========================================================================
   about
   ========================================================================== */
.about__grid{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}
.about__card{
  background: var(--grad-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.75rem;
  transition: transform .25s var(--ease), border-color .25s;
}
.about__card:hover{
  transform: translateY(-6px);
  border-color: var(--line-bright);
  box-shadow: var(--shadow-glow);
}
.about__badge{
  font-size: 1.5rem;
  color: var(--pink);
  margin-bottom: .75rem;
}
.about__card h3{
  font-family: var(--font-pixel);
  font-size: .82rem;
  line-height: 1.6;
  margin-bottom: .75rem;
  color: var(--star);
}
.about__card p{
  color: var(--purple-soft);
  font-size: .95rem;
}

@media (max-width: 860px){
  .about__grid{ grid-template-columns: 1fr; }
}

/* ==========================================================================
   game
   ========================================================================== */
.game__frame{
  background: var(--panel);
  border: var(--pixel-border) solid var(--purple-deep);
  border-radius: var(--radius);
  box-shadow: var(--shadow-glow);
  padding: 1.5rem;
  image-rendering: pixelated;
}
.game__stats{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .75rem;
  margin-bottom: 1.25rem;
}
.stat{
  background: rgba(0,0,0,.3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: .6rem .5rem;
  text-align: center;
}
.stat__label{
  display: block;
  font-family: var(--font-mono);
  font-size: .65rem;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .3rem;
}
.stat__value{
  font-family: var(--font-pixel);
  font-size: .95rem;
  color: var(--star);
}

.game__canvas-wrap{
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0a0620;
  touch-action: none;
}
#game-canvas{
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  display: block;
}

.game__overlay{
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(7,4,15,.82);
  backdrop-filter: blur(3px);
  text-align: center;
  padding: 1.5rem;
  transition: opacity .3s var(--ease), visibility .3s;
}
.game__overlay.is-hidden{ opacity: 0; visibility: hidden; pointer-events: none; }
.game__overlay-inner{ max-width: 360px; }
.game__overlay-title{
  font-family: var(--font-pixel);
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--star);
}
.game__overlay-text{
  color: var(--purple-soft);
  font-size: .88rem;
  margin-bottom: 1.5rem;
}

.game__controls{
  margin-top: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.game__mobile-hint{
  font-family: var(--font-mono);
  font-size: .72rem;
  color: rgba(247,243,255,.4);
  margin-left: auto;
}
@media (max-width: 640px){
  .game__stats{ grid-template-columns: repeat(2, 1fr); }
  .game__mobile-hint{ margin-left: 0; }
}

/* ==========================================================================
   achievements
   ========================================================================== */
.achievements__progress{
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 480px;
  margin: 0 auto 2.5rem;
}
.achievements__progress-bar{
  flex: 1;
  height: 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--line);
  overflow: hidden;
}
.achievements__progress-fill{
  height: 100%;
  width: 0%;
  background: var(--grad-text);
  transition: width .6s var(--ease);
}
.achievements__progress-label{
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--purple-soft);
  white-space: nowrap;
}

.achievements__grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.1rem;
}
.achv{
  position: relative;
  background: var(--grad-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  gap: .9rem;
  align-items: flex-start;
  transition: transform .2s var(--ease), border-color .2s;
}
.achv:hover{ transform: translateY(-3px); border-color: var(--line-bright); }
.achv[data-locked="true"]{ opacity: .45; filter: grayscale(.6); }
.achv__icon{
  font-size: 1.4rem;
  width: 2.4rem; height: 2.4rem;
  flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,.35);
  border: 1px solid var(--line);
}
.achv__title{
  font-family: var(--font-pixel);
  font-size: .68rem;
  line-height: 1.7;
  margin-bottom: .4rem;
  color: var(--star);
}
.achv__desc{
  font-size: .85rem;
  color: var(--purple-soft);
}
.achv__check{
  position: absolute;
  top: .6rem; right: .6rem;
  color: var(--cyan);
  font-size: .8rem;
}

.achievements__danger{
  margin-top: 3rem;
  text-align: center;
}

/* ==========================================================================
   footer
   ========================================================================== */
.footer{
  border-top: 1px solid var(--line);
  padding: 3rem 1.5rem 2.5rem;
  text-align: center;
}
.footer__inner{ max-width: 640px; margin: 0 auto; }
.footer__brand{
  font-family: var(--font-pixel);
  font-size: .8rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
}
.footer__note, .footer__hint{
  color: var(--purple-soft);
  font-size: .85rem;
  margin-bottom: .5rem;
}
.kbd{
  font-family: var(--font-mono);
  background: rgba(155,92,255,.15);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: .1rem .4rem;
}
.footer__year{
  font-family: var(--font-mono);
  font-size: .72rem;
  color: rgba(247,243,255,.35);
  margin-top: 1.25rem;
}

/* ==========================================================================
   toasts
   ========================================================================== */
.toast-root{
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  max-width: 320px;
}
.toast{
  background: var(--panel-2);
  border: 2px solid var(--purple);
  border-radius: var(--radius-sm);
  padding: .8rem 1rem;
  box-shadow: 0 10px 30px -8px rgba(0,0,0,.6), 0 0 0 1px rgba(155,92,255,.3);
  display: flex;
  gap: .7rem;
  align-items: center;
}
.toast__icon{ font-size: 1.3rem; }
.toast__title{
  font-family: var(--font-pixel);
  font-size: .6rem;
  color: var(--cyan);
  margin-bottom: .3rem;
}
.toast__body{ font-size: .82rem; color: var(--star); }

@media (max-width: 480px){
  .toast-root{ left: 1rem; right: 1rem; max-width: none; }
}

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