/* Infinimix: the 3D egg hatching (static/egg3d.js) and the Lab's fusion reactor (static/reactor.js). */

/* ------------------------------------------------------------------ the egg hatching */
#egg3d { position: fixed; inset: 0; z-index: 128; opacity: 0; transition: opacity .35s; background: #05040e; touch-action: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#egg3d.pastel { background: #4a3f9c; }
#egg3d.on { opacity: 1; }
#egg3d.out { opacity: 0; transition: opacity .3s; pointer-events: none; }
.e3d-cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: pointer; outline: none; }
.e3d-flash { position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at 50% 50%, #fff, rgba(255, 255, 255, .85) 40%, rgba(255, 236, 250, .6)); }
.e3d-hint { position: absolute; z-index: 2; left: 0; right: 0; bottom: max(34px, calc(env(safe-area-inset-bottom) + 20px)); margin: 0; padding: 0 16px;
  text-align: center; pointer-events: none; font: 400 12px var(--lcd); letter-spacing: 2px; text-transform: uppercase; color: rgba(255, 255, 255, .85);
  text-shadow: 0 1px 8px #000; animation: fadein .5s, blink 1.6s .8s infinite; }
.e3d-hint.lit { color: #fff; text-shadow: 0 0 12px rgba(255, 255, 255, .8), 0 1px 8px #000; }
.e3d-hint[hidden], .e3d-skip[hidden] { display: none; }
.e3d-skip { position: absolute; z-index: 2; top: max(14px, env(safe-area-inset-top)); right: 14px; padding: 7px 15px; border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, .35); background: rgba(10, 6, 30, .35); color: #fff; font: 700 13px Nunito, sans-serif; cursor: pointer;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.e3d-skip:hover { background: rgba(10, 6, 30, .55); }
/* the page's card, which finishes the 3D card's turn and then glides onto the naming ceremony's card */
.e3d-card { position: fixed; z-index: 131; perspective: 1100px; pointer-events: none; transform-origin: 50% 50%; }
.e3d-card.glide { transition: transform .6s cubic-bezier(.3, .8, .3, 1); }
.e3d-card-in { width: 100%; transform: rotateY(-90deg); transition: transform .5s cubic-bezier(.2, .8, .3, 1); }
.e3d-card.on .e3d-card-in { transform: none; }
.e3d-card .card { width: 100%; box-shadow: 0 24px 50px rgba(20, 10, 60, .55), 0 0 0 3px rgba(255, 255, 255, .8), 0 0 60px rgba(255, 190, 240, .7); }
/* once the scene covers the screen, the page behind is hidden (phones free its layers), as with the ceremony */
body.e3d-open > :is(#top, #view, #tabs, #modal, #side, #chat, #chat-fab, #stage, #spot, #tdone) { visibility: hidden; }
/* the naming ceremony after a 3D hatch: its card is the one that glided in, so it has no rise of its own */
#cer.from3d .cer-card { animation: none !important; }
#cer.handoff .cer-card { visibility: hidden; }

/* ------------------------------------------------------------------ the Fusion Reactor (the Lab's mini-game) */
#reactor { position: fixed; inset: 0; z-index: 128; opacity: 0; transition: opacity .3s; background: #140d3a; color: #fff; touch-action: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; overflow: hidden; cursor: pointer; }
#reactor.pastel { background: #5b4bc4; }
#reactor.on { opacity: 1; }
#reactor.out { opacity: 0; pointer-events: none; }
.rx-cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.rx-flash { position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at 50% 45%, #fff, rgba(255, 255, 255, .75) 45%, rgba(255, 230, 250, .5)); }
.rx-top { position: absolute; z-index: 2; top: max(12px, env(safe-area-inset-top)); left: 16px; right: 14px; display: flex; align-items: flex-start;
  justify-content: space-between; gap: 10px; pointer-events: none; }
.rx-ttl { display: flex; flex-direction: column; gap: 3px; min-width: 0; text-shadow: 0 1px 8px rgba(10, 5, 40, .6); }
.rx-ttl b { font: 400 13px var(--lcd); letter-spacing: 2.5px; }
.rx-ttl span { font: 700 14px Fredoka, sans-serif; opacity: .92; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rx-skip { pointer-events: auto; flex: none; padding: 7px 15px; border-radius: 99px; border: 1px solid rgba(255, 255, 255, .35); background: rgba(10, 6, 30, .35);
  color: #fff; font: 700 13px Nunito, sans-serif; cursor: pointer; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.rx-skip[hidden] { display: none; }
.rx-meter { position: absolute; z-index: 2; top: calc(max(12px, env(safe-area-inset-top)) + 56px); left: 50%; width: min(84vw, 340px); transform: translateX(-50%);
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "l v" "b b"; align-items: end; gap: 2px 8px; pointer-events: none; }
.rx-ml { grid-area: l; font: 400 10px var(--lcd); letter-spacing: 1.5px; text-transform: uppercase; opacity: .9; }
.rx-val { grid-area: v; font: 700 22px/1 Fredoka, sans-serif; text-shadow: 0 0 10px rgba(255, 215, 106, .6); }
.rx-bar { grid-area: b; position: relative; height: 12px; margin-bottom: 16px; border-radius: 99px; background: rgba(10, 6, 40, .45);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28); }
.rx-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--ca), #ffd76a 60%, var(--cb));
  box-shadow: 0 0 12px rgba(255, 215, 106, .55); }
.rx-tick { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: rgba(255, 255, 255, .55); }
.rx-tick b { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); font: 800 8.5px Nunito, sans-serif; letter-spacing: .6px; white-space: nowrap;
  text-transform: uppercase; opacity: .8; }
.rx-needle { position: absolute; top: -6px; bottom: -6px; width: 4px; margin-left: -2px; border-radius: 2px; background: #fff; box-shadow: 0 0 8px #fff, 0 0 2px #000; }
.rx-dots { position: absolute; z-index: 2; top: calc(max(12px, env(safe-area-inset-top)) + 118px); left: 0; right: 0; display: flex; justify-content: center; gap: 9px;
  pointer-events: none; }
.rx-dots i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .6); transition: transform .2s, background .2s; }
.rx-dots i.a { border-color: var(--ca); }
.rx-dots i.b { border-color: var(--cb); }
.rx-dots i.now { transform: scale(1.4); box-shadow: 0 0 10px #fff; }
.rx-dots i.perfect { background: #fff; box-shadow: 0 0 8px #ffd76a; }
.rx-dots i.great { background: #ffd76a; }
.rx-dots i.good { background: #9fd7ff; }
.rx-dots i.miss { background: #ff5f6d; border-color: #ff5f6d; }
.rx-pop { position: absolute; z-index: 3; left: 0; right: 0; top: 27%; text-align: center; pointer-events: none; font: 700 34px Fredoka, sans-serif; letter-spacing: 1px; opacity: 0; }
.rx-pop.on { animation: rxpop .85s cubic-bezier(.2, 1.4, .4, 1) forwards; }
@keyframes rxpop { 0% { opacity: 0; transform: scale(.5); } 18% { opacity: 1; transform: scale(1.12); } 70% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: translateY(-18px); } }
.rx-pop.perfect { color: #fff; text-shadow: 0 0 16px #ffd76a, 0 0 4px #ff9a3d, 0 3px 0 #b05a00; }
.rx-pop.great { color: #ffe9a8; text-shadow: 0 0 12px rgba(255, 215, 106, .8), 0 3px 0 rgba(120, 60, 0, .7); }
.rx-pop.good { color: #c9ecff; text-shadow: 0 0 10px rgba(110, 190, 255, .7), 0 2px 0 rgba(20, 40, 90, .6); font-size: 28px; }
.rx-pop.miss { color: #ff8a95; text-shadow: 0 0 10px rgba(255, 60, 80, .6), 0 2px 0 rgba(80, 0, 10, .7); font-size: 28px; }
.rx-hint { position: absolute; z-index: 2; left: 0; right: 0; bottom: max(26px, calc(env(safe-area-inset-bottom) + 14px)); margin: 0; padding: 0 16px; text-align: center;
  pointer-events: none; font: 400 12px var(--lcd); letter-spacing: 1.5px; text-transform: uppercase; text-shadow: 0 1px 8px rgba(10, 5, 40, .8); }
.rx-hint.lit { opacity: .65; }
.rx-end { position: absolute; z-index: 3; left: 50%; top: 21%; width: min(84vw, 330px); transform: translateX(-50%); display: flex; flex-direction: column;
  align-items: center; gap: 4px; padding: 14px 18px 16px; border-radius: 22px; text-align: center; pointer-events: none; background: rgba(20, 12, 60, .55);
  border: 2px solid rgba(255, 255, 255, .4); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); box-shadow: 0 20px 50px rgba(10, 5, 40, .5);
  animation: rxend .6s cubic-bezier(.2, 1.4, .4, 1); }
.rx-end[hidden] { display: none; }
@keyframes rxend { from { opacity: 0; transform: translateX(-50%) scale(.6); } }
.rx-gl { font: 400 11px var(--lcd); letter-spacing: 2px; text-transform: uppercase; opacity: .9; }
.rx-grade { font: 700 46px/1.05 Fredoka, sans-serif; letter-spacing: 1px; text-transform: uppercase; }
.rx-sv { font: 800 15px Nunito, sans-serif; }
.rx-bonus { font: 800 15px Nunito, sans-serif; color: #ffe08a; }
.rx-bonus:empty { display: none; }
.rx-tap { font: 400 10px var(--lcd); letter-spacing: 1.5px; opacity: .75; text-transform: uppercase; margin-top: 4px; }
.rx-end.g-perfect .rx-grade { background: linear-gradient(90deg, #ff5f6d, #ffc371, #fff35c, #5cff9d, #5cc8ff, #b45cff); -webkit-background-clip: text;
  background-clip: text; color: transparent; filter: drop-shadow(0 2px 0 rgba(40, 10, 80, .6)); }
.rx-end.g-gold .rx-grade { color: #ffd23d; text-shadow: 0 0 18px rgba(255, 210, 61, .7), 0 3px 0 #9a6400; }
.rx-end.g-silver .rx-grade { color: #eef2fa; text-shadow: 0 0 14px rgba(220, 230, 255, .7), 0 3px 0 #5d6680; }
.rx-end.g-bronze .rx-grade { color: #f3ad6e; text-shadow: 0 0 14px rgba(240, 150, 90, .6), 0 3px 0 #7a3e12; }
.rx-end.g-unstable .rx-grade { color: #ff8a95; text-shadow: 0 0 14px rgba(255, 80, 100, .6), 0 3px 0 #6a0f1c; }
#reactor.busy::after { content: ""; position: absolute; inset: 0; z-index: 4; background: rgba(10, 6, 30, .35); }
#reactor.still .rx-pop.on { animation: rxfade .85s forwards; }
@keyframes rxfade { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }
#reactor.still .rx-end { animation: none; }
body.rx-open > :is(#top, #view, #tabs, #modal, #side, #chat, #chat-fab) { visibility: hidden; }
@media (max-width: 350px) {
  .rx-ttl b { font-size: 11px; letter-spacing: 1.2px; }
  .rx-ttl span { font-size: 12.5px; }
  .rx-tick b { font-size: 7.5px; letter-spacing: 0; }
  .rx-pop { font-size: 28px; }
}
/* the grade on the fusion's result and on its egg */
.lab-grade { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 6px 0; }
.egg-modal .lab-grade { justify-content: center; }
.rx-badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font: 700 12.5px Fredoka, sans-serif; letter-spacing: .5px; color: #fff; text-transform: uppercase; }
.rx-badge.g-perfect { background: linear-gradient(90deg, #ff5f6d, #ffc371, #5cff9d, #5cc8ff, #b45cff); text-shadow: 0 1px 2px rgba(40, 10, 80, .6); }
.rx-badge.g-gold { background: linear-gradient(180deg, #ffe27a, #e0a800); color: #5a3a00; }
.rx-badge.g-silver { background: linear-gradient(180deg, #f4f7fc, #b9c3d6); color: #39435a; }
.rx-badge.g-bronze { background: linear-gradient(180deg, #f6c08e, #c27a3e); color: #4a2408; }
.rx-badge.g-unstable { background: linear-gradient(180deg, #ff9aa3, #e0465a); }
/* 14/11 (owner): the hatch is scanned: "SCANCARD SUCCESSFUL!" pops over the new card (egg3d.js callout) */
.e3d-call { position: absolute; z-index: 2; left: 0; right: 0; top: 16%; margin: 0; padding: 0 16px; text-align: center; pointer-events: none;
  font: 700 clamp(24px, 7.4vw, 40px)/1.05 Fredoka, sans-serif; letter-spacing: .04em; text-transform: uppercase; color: #fff;
  text-shadow: 0 0 18px rgba(142, 240, 255, .95), 0 0 36px rgba(255, 79, 163, .6), 0 3px 0 #2a1d6e; }
.e3d-call[hidden] { display: none; }
.e3d-call.on { animation: e3d-call 1.5s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes e3d-call { 0% { opacity: 0; transform: scale(.4) translateY(14px); } 18% { opacity: 1; transform: scale(1.12); } 30% { transform: scale(1); }
  80% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.05) translateY(-10px); } }
/* 15/11 (owner: "highlight the tap-the-egg instruction better, with a hand movement showing what to do"): the hint is
   a big white bubble near the bottom, and while it is up a hand taps the egg (its fingertip on the shell) with ripples */
.e3d-hint { left: 50%; right: auto; bottom: max(64px, calc(env(safe-area-inset-bottom) + 50px)); width: max-content; max-width: calc(100% - 32px);
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 11px 22px 12px; border-radius: 22px; transform: translateX(-50%);
  font: 800 13px/1.25 Nunito, sans-serif; letter-spacing: 0; text-transform: none; color: #5a4f80; text-shadow: none; background: #fff;
  box-shadow: 0 0 0 3px rgba(255, 111, 216, .9), 0 10px 28px rgba(10, 4, 30, .5), 0 0 34px rgba(255, 111, 216, .55);
  animation: fadein .5s, e3d-bob 1.4s .5s ease-in-out infinite; }
.e3d-hint.lit { color: #5a4f80; text-shadow: none; }
.e3d-hint b { font: 700 24px/1.1 Fredoka, sans-serif; color: #e0127a; }
.e3d-hint small { font: inherit; }
@keyframes e3d-bob { 50% { transform: translateX(-50%) translateY(-6px); } }
.e3d-guide { position: absolute; z-index: 2; left: 53%; top: 56%; width: 0; height: 0; pointer-events: none; animation: fadein .5s; }
.e3d-hint[hidden] + .e3d-guide { display: none; }
.e3d-hand { position: absolute; left: -20px; top: -4px; font-size: 64px; line-height: 1; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .45));
  animation: e3d-tap 1.3s ease-in-out infinite; }
@keyframes e3d-tap { 0%, 100% { transform: translate(22px, 40px) rotate(-10deg); } 38% { transform: translate(0, 0) rotate(-10deg) scale(.9); }
  55% { transform: translate(6px, 10px) rotate(-10deg); } }
.e3d-ripple { position: absolute; left: -32px; top: -32px; width: 64px; height: 64px; border-radius: 50%; border: 4px solid #fff;
  box-shadow: 0 0 16px #ff6fd8, inset 0 0 12px #ff6fd8; opacity: 0; animation: e3d-rip 1.3s ease-out infinite; }
.e3d-ripple.b { animation-delay: .16s; }
@keyframes e3d-rip { 0%, 34% { transform: scale(.3); opacity: 0; } 40% { opacity: 1; } 100% { transform: scale(1.7); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .e3d-hint, .e3d-hand, .e3d-ripple { animation: none; } .e3d-ripple { opacity: .7; } }
/* 19/11 (owner: "sometimes the old egg shows in the incubator pictures"): where WebGL works, an egg waits hidden for its
   3D picture (eggart.js) instead of showing the old CSS egg first; the CSS egg only shows if no 3D picture came in 4 s */
.egg.e3w:not(.is3d) { visibility: hidden; animation: e3w-late 0s 4s forwards !important; }
@keyframes e3w-late { to { visibility: visible; } }
