/* EZFUNGE – Magic AI Ball (EPIC V2 for homepage) */
:root{
  --bg:#05060b;
  --panel: rgba(255,255,255,.04);
  --border: rgba(140,220,255,.18);
  --glow: rgba(140,220,255,.30);
  --glow2: rgba(100,160,255,.16);
  --fogA: rgba(110,160,255,.20);
  --fogB: rgba(6,10,22,.98);
  --tri: rgba(185,228,255,.92);
  --txt: rgba(235,248,255,.92);
  --noiseOpacity: .12;

  --ball: min(520px, 92vw);
  --marqueeGap: 56px;
  --marqueeX: 520px;
  --marqueeDur: 4s;
}

html,body{
  margin:0;
  min-height:100%;
  background: radial-gradient(circle at 50% 0%, rgba(80,120,255,.10), rgba(0,0,0,0) 55%),
              radial-gradient(circle at 80% 20%, rgba(140,220,255,.07), rgba(0,0,0,0) 50%),
              var(--bg);
  color:#fff;
  font-family: system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
}

main.stage{
  min-height: 100vh;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:flex-start;
  gap: 18px;
  padding: 26px 16px 40px;
}

.brand{
  text-align:center;
  font-weight: 950;
  letter-spacing:.22em;
  opacity:.92;
  user-select:none;
}
.brand .sub{
  margin-top: 8px;
  letter-spacing:.10em;
  opacity:.75;
  font-weight: 700;
  font-size: 13px;
}

.ball-wrap{
  width: var(--ball);
  aspect-ratio: 1/1;
  position: relative;
  border-radius: 50%;
  isolation: isolate;
  filter: drop-shadow(0 30px 75px rgba(0,0,0,.72));
  user-select:none;
  touch-action: pan-y;
}

.halo{
  position:absolute; inset:-10%;
  border-radius:50%;
  background: radial-gradient(circle at 50% 55%, var(--glow), rgba(0,0,0,0) 62%);
  filter: blur(16px);
  opacity:.85;
  z-index:0;
  pointer-events:none;
}

.ball{
  position:absolute; inset:0;
  border-radius:50%;
  overflow:hidden;
  background:
    radial-gradient(circle at 50% 32%, rgba(255,255,255,.10), rgba(0,0,0,0) 36%),
    radial-gradient(circle at 50% 35%, var(--fogA), var(--fogB) 72%);
  box-shadow:
    inset 0 0 75px rgba(120,170,255,.18),
    inset 0 -30px 60px rgba(0,0,0,.35);
  z-index:1;
}

/* Fog swirl */
.fog{
  position:absolute; inset:-18%;
  border-radius:50%;
  background:
    radial-gradient(circle at 30% 30%, rgba(120,190,255,.18), rgba(0,0,0,0) 55%),
    radial-gradient(circle at 70% 60%, rgba(90,140,255,.16), rgba(0,0,0,0) 55%),
    conic-gradient(from 20deg, rgba(80,130,255,0), rgba(120,180,255,.10), rgba(80,130,255,0));
  filter: blur(1px);
  opacity:.9;
  mix-blend-mode: screen;
  animation: fogSpin 10s linear infinite;
  pointer-events:none;
  z-index:2;
}
@keyframes fogSpin{ from{transform:rotate(0)} to{transform:rotate(360deg)} }

/* Noise drift */
.noise{
  position:absolute; inset:0;
  background-image: repeating-linear-gradient(0deg, rgba(255,255,255,.04), rgba(255,255,255,.04) 1px, rgba(0,0,0,0) 2px, rgba(0,0,0,0) 4px);
  opacity: var(--noiseOpacity);
  mix-blend-mode: overlay;
  pointer-events:none;
  z-index:3;
  animation: noiseDrift 7s ease-in-out infinite;
}
@keyframes noiseDrift{
  0%,100%{ transform: translate3d(0,0,0); }
  50%{ transform: translate3d(10px,-12px,0); }
}

/* Glass */
.glass{
  position:absolute; inset:0;
  border-radius:50%;
  pointer-events:none;
  z-index:10;
  background:
    radial-gradient(circle at 30% 22%, rgba(255,255,255,.55), rgba(255,255,255,.10) 30%, rgba(255,255,255,.03) 58%, rgba(255,255,255,.01) 72%, rgba(0,0,0,0) 78%),
    radial-gradient(circle at 60% 80%, rgba(140,220,255,.09), rgba(0,0,0,0) 52%);
  box-shadow:
    inset 0 0 0 2px rgba(255,255,255,.07),
    inset 0 0 32px rgba(120,190,255,.08);
}

/* Triangle */
.window{
  position:absolute;
  left:50%;
  top:50%;
  transform: translate(-50%,-50%);
  width:0;height:0;
  border-left: 74px solid transparent;
  border-right: 74px solid transparent;
  border-top: 108px solid var(--tri);
  filter: drop-shadow(0 0 22px rgba(160,220,255,.60));
  z-index:8;
  opacity:0;
  transition: opacity .22s ease;
}

/* Answer ticker */
.answer{
  position:absolute;
  left:50%;
  top:64%;
  transform: translateX(-50%);
  width: 78%;
  z-index:9;
  opacity:0;
  transition: opacity .22s ease;
  overflow:hidden;
  text-align:center;
}

.answer .track{
  display:inline-flex;
  align-items:center;
  gap: var(--marqueeGap);
  will-change: transform;
}
.answer .track.is-marquee{
  animation: marquee var(--marqueeDur) linear infinite;
}
@keyframes marquee{
  from{ transform: translate3d(0,0,0); }
  to{ transform: translate3d(calc(-1 * var(--marqueeX)),0,0); }
}
.answer .track > span{
  white-space: nowrap;
  font-weight: 950;
  letter-spacing: .18em;
  text-transform: uppercase;
  font-size: clamp(18px, 2.3vw, 34px);
  color: var(--txt);
  text-shadow: 0 0 18px rgba(160,220,255,.55);
}

/* Reveal + shake */
.ball-wrap.revealed .window,
.ball-wrap.revealed .answer{ opacity: 1; }

.ball-wrap.shake{ animation: shake 1.25s cubic-bezier(.2,.9,.2,1) 1; }
@keyframes shake{
  0%{ transform: translate3d(0,0,0) rotate(0) scale(1); }
  12%{ transform: translate3d(8px,10px,0) rotate(4deg) scale(.99); }
  28%{ transform: translate3d(-12px,14px,0) rotate(-7deg) scale(.985); }
  44%{ transform: translate3d(10px,-8px,0) rotate(6deg) scale(1.01); }
  60%{ transform: translate3d(-6px,6px,0) rotate(-4deg) scale(1.005); }
  100%{ transform: translate3d(0,0,0) rotate(0) scale(1); }
}

/* UI */
.controls{
  width: min(860px, 96vw);
  display:flex;
  flex-direction:column;
  gap: 10px;
  align-items:center;
  margin-top: 8px;
}

.controls input{
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  color:#fff;
  outline:none;
}

.controls .row{
  width: 100%;
  display:flex;
  gap: 10px;
  justify-content:center;
  flex-wrap: wrap;
}

.controls button{
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(60,120,255,.12);
  color:#fff;
  font-weight: 950;
  letter-spacing:.14em;
  cursor:pointer;
}

.dice{
  width: 54px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size: 22px;
  border-radius: 14px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.10);
}

.hint{
  opacity:.78;
  font-weight: 900;
  letter-spacing:.20em;
  user-select:none;
}


/* === IDLE TRIANGLE LOGO (show on load) === */
/* Triangle always visible */
.window{
  opacity: 1 !important;
}

/* Answer stays hidden until revealed */
.answer{
  opacity: 0 !important;
}
.ball-wrap.revealed .answer{
  opacity: 1 !important;
}


/* === TRIANGLE LOGO MARK === */
.window{
  position:absolute;
}

/* Add "AI" inside triangle as the logo mark */
/* Make the triangle feel more “logo” sharp */
.window{
  filter:
    drop-shadow(0 0 26px rgba(160,220,255,.62))
    drop-shadow(0 0 48px rgba(90,160,255,.22));
}


/* === AI BALL SKIN SWAP (aiball.png + aimask.png) === */

/* Replace the ball body visuals with your aiball.png */
.ball{
  background: url("/assets/img/aiball.png") center/contain no-repeat !important;
  box-shadow: none !important;
}

/* Optional: keep subtle glow halo behind it */
.halo{
  opacity: .85 !important;
}

/* Hide swirl/noise layers if your PNG already includes texture.
   (If you WANT them, set display:block instead) */
.fog{ display: none !important; }
.noise{ display: none !important; }

/* Replace the triangle with your aimask.png logo */
.window{
  width: 190px !important;
  height: 160px !important;
  border: none !important;
  background: url("/assets/img/aimask.png") center/contain no-repeat !important;
  filter: drop-shadow(0 0 28px rgba(140,220,255,.55)) !important;
  opacity: 1 !important; /* show on idle */
}

/* Keep answer hidden until revealed */
.answer{ opacity: 0 !important; }
.ball-wrap.revealed .answer{ opacity: 1 !important; }

/* Move answer a bit down so it sits under the logo */
.answer{
  top: 68% !important;
}

/* Make the glass layer slightly lighter so your ball PNG feels glassy */
.glass{
  opacity: .90 !important;
}


/* === LOGO_LIFE === */
/* 1) gentle breathing glow */
@keyframes logoPulse{
  0%,100% { filter: drop-shadow(0 0 18px rgba(140,220,255,.45)); opacity: .92; }
  50%     { filter: drop-shadow(0 0 34px rgba(140,220,255,.80)); opacity: 1; }
}

/* 2) subtle float */
@keyframes logoFloat{
  0%,100% { transform: translate(-50%,-50%) translateY(0); }
  50%     { transform: translate(-50%,-50%) translateY(-5px); }
}

/* 3) shimmer sweep over the logo (hologram feel) */
@keyframes logoShine{
  0%   { transform: translateX(-140%) rotate(18deg); opacity: 0; }
  10%  { opacity: .25; }
  40%  { opacity: .18; }
  60%  { opacity: 0; }
  100% { transform: translateX(140%) rotate(18deg); opacity: 0; }
}

.window{
  animation: logoPulse 3.2s ease-in-out infinite, logoFloat 5.6s ease-in-out infinite;
  position: relative;
}

.window::before{
  content:"";
  position:absolute;
  inset:-22px;
  background: linear-gradient(120deg, rgba(255,255,255,0), rgba(255,255,255,.22), rgba(255,255,255,0));
  mix-blend-mode: screen;
  opacity: 0;
  animation: logoShine 4.8s ease-in-out infinite;
  pointer-events:none;
}


/* === DISABLE_SHIMMER_BLOCK === */
.window::before{ display:none !important; content:none !important; }


/* === FILL_CIRCLE_AI_BALL === */
.ball-wrap{
  border-radius: 50% !important;
  overflow: hidden !important; /* hard clip */
}

/* If you're using aiball.png as the ball background, force COVER */
.ball{
  background-position: center !important;
  background-size: cover !important;
}

/* Tone down outer halo so it doesn't look like an extra circle */
.halo{
  opacity: .55 !important;
  filter: blur(18px) !important;
}



/* === BLUE TOP HIGHLIGHT (LESS WHITE, MORE AI BLUE) === */
.glass{
  background:
    radial-gradient(circle at 30% 22%,
      rgba(120,200,255,.55),
      rgba(120,200,255,.10) 30%,
      rgba(255,255,255,.02) 58%,
      rgba(255,255,255,.01) 72%,
      rgba(0,0,0,0) 78%),
    radial-gradient(circle at 60% 80%,
      rgba(120,200,255,.12),
      rgba(0,0,0,0) 52%) !important;
}


/* === SIZE_CLAMP_STABLE === */
:root{
  --ball: min(520px, 92vw) !important;
}


/* === MOBILE_OVERFLOW_FIX === */
html, body{
  overflow-x: hidden !important;
}
.ball-wrap{
  max-width: 100vw !important;
}


/* === MOBILE_TRIANGLE_LOCK === */
@media (max-width: 640px){
  .ball-wrap{ width: min(520px, 92vw) !important; }

  .window{
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%,-50%) !important;
  }

  .answer{
    left: 50% !important;
    top: 66% !important;
    transform: translateX(-50%) !important;
  }
}


/* === MOBILE_SCROLL_WHITE_LINE_FIX === */
@media (max-width: 640px){
  html, body{
    overflow-x: clip !important; /* stronger than hidden on mobile */
    width: 100% !important;
  }

  /* prevent any element from expanding page width */
  .stage, .controls, .row, .ball-wrap{
    max-width: 100% !important;
  }

  /* avoid transform creating a wider bounding box during shake */
  .ball-wrap{
    transform: none !important;
  }
  .ball-wrap.shake{
    transform: none !important;
  }
}


/* === MOBILE_TRIANGLE_CENTER_FIX === */
@media (max-width: 640px){
  /* Hard-pin the logo triangle in the center */
  .window{
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%,-50%) !important;
    animation: none !important; /* stop any dip animation affecting it */
  }

  /* If windowDip was running on shake, disable it on mobile */
  .ball-wrap.shake .window{
    animation: none !important;
  }

  /* Keep answer in the right place too */
  .answer{
    left: 50% !important;
    top: 68% !important;
    transform: translateX(-50%) !important;
  }
}








/* === BLUE_TOP_HIGHLIGHT (FORCE CLEAN) === */
.glass{
  background:
    radial-gradient(circle at 30% 20%,
      rgba(120,210,255,.62),
      rgba(120,210,255,.14) 28%,
      rgba(255,255,255,.03) 55%,
      rgba(255,255,255,.01) 70%,
      rgba(0,0,0,0) 78%),
    radial-gradient(circle at 60% 80%,
      rgba(120,210,255,.14),
      rgba(0,0,0,0) 52%) !important;
}

/* === POWERED_BY_BOOB (CLEAN) === */
.powered-by-boob{
  margin-top: 16px;
  display:flex;
  align-items:center;
  gap:12px;
  padding:10px 14px;
  border-radius:16px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(120,210,255,.18);
  box-shadow: 0 0 24px rgba(120,210,255,.10);
  max-width: min(860px, 96vw);
}
.powered-by-boob img{
  width:44px;
  height:44px;
  border-radius:12px;
  box-shadow: 0 0 18px rgba(120,210,255,.22);
}
.powered-by-boob .p1{
  font-weight:950;
  letter-spacing:.18em;
  font-size:13px;
  opacity:.92;
}
.powered-by-boob .p2{
  font-weight:700;
  letter-spacing:.10em;
  font-size:12px;
  opacity:.68;
}
@media (max-width: 640px){
  .powered-by-boob{
    width: 92vw;
    justify-content:center;
  }
}


/* === MOBILE_FORCE_CENTER_LOGO === */
@media (max-width: 640px){
  /* ensure the ball is the containing block */
  .ball-wrap{
    position: relative !important;
    overflow: hidden !important;
  }

  /* force the logo/window to exist and be on top */
  .window{
    position: absolute !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%,-50%) !important;
    display: block !important;
    z-index: 999 !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: none !important;
  }

  /* make sure glass doesn't cover it */
  .glass{ z-index: 900 !important; }
}


/* === POWERED_BY_LINK === */
.powered-by-link{
  text-decoration: none;
  color: inherit;
  display: inline-block;
}
.powered-by-link:active{ transform: scale(.99); }


/* === SPIN_AND_SINK_V1 === */
/* IMPORTANT: we spin the ball IMAGE layer, not the wrapper (prevents mobile overflow) */

/* Make sure .ball is a layer we can rotate */
.ball{
  transform-origin: 50% 50%;
  will-change: transform;
}

/* Spin on shake */
.ball-wrap.spin .ball{
  animation: ezf_ballSpin 1.05s cubic-bezier(.2,.9,.2,1) 1;
}

/* Smooth, toy-like spin + micro-tilt */
@keyframes ezf_ballSpin{
  0%   { transform: rotate(0deg) scale(1); }
  18%  { transform: rotate(22deg) scale(.995); }
  42%  { transform: rotate(-28deg) scale(.99); }
  70%  { transform: rotate(14deg) scale(1.005); }
  100% { transform: rotate(0deg) scale(1); }
}

/* Triangle sink/rise/wobble inside the window */
.window{
  transform-origin: 50% 40%;
  will-change: transform;
}

.ball-wrap.tri-move .window{
  animation: ezf_triSink 1.05s cubic-bezier(.2,.9,.2,1) 1;
}

@keyframes ezf_triSink{
  0%   { transform: translate(-50%,-50%) translateY(0) rotate(0deg) scale(1); }
  18%  { transform: translate(-50%,-50%) translateY(34px) rotate(-4deg) scale(.97); } /* sink */
  55%  { transform: translate(-50%,-50%) translateY(-6px) rotate(3deg) scale(1.02); } /* rise + bump */
  74%  { transform: translate(-50%,-50%) translateY(3px) rotate(-2deg) scale(1.01); } /* settle */
  100% { transform: translate(-50%,-50%) translateY(0) rotate(0deg) scale(1); }
}

/* Mobile: keep it centered and still allow the animation */
@media (max-width: 640px){
  .window{
    left: 50% !important;
    top: 50% !important;
  }
  /* ensure wrapper doesn't shift page width */
  .ball-wrap{ overflow: hidden !important; }
}
