/* CryptoPilot — пасхалки с маскотом → CryptoPilot Duel.
 * Только transform/opacity. Ничего не перекрывает, пока персонаж не вылез.
 * Общий выключатель — строка require в functions.php, флаги по пасхалкам — в easter.php. */

.cp-egg {
  --cp-egg-h: 150px;
  position: fixed;
  z-index: 250;                 /* ниже мобильного меню (300), выше контента */
  pointer-events: none;         /* кликается только персонаж и пузырь */
  font: 700 15px/1.25 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
@media (min-width: 900px) { .cp-egg { --cp-egg-h: 190px; font-size: 16px; } }

.cp-egg button {
  display: block;
  margin: 0; padding: 0; border: 0; background: none;
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  line-height: 0;
}
.cp-egg button:focus-visible { outline: 2px solid #16c6c9; outline-offset: 4px; border-radius: 12px; }
.cp-egg img { display: block; user-select: none; -webkit-user-drag: none; pointer-events: none; }

/* Пузырь (общий) */
.cp-egg__bubble {
  position: absolute;
  max-width: min(240px, calc(100vw - 32px));
  padding: 10px 36px 10px 14px;
  border-radius: 14px 14px 4px 14px;
  background: #0e141c;
  border: 1px solid rgba(22,198,201,.55);
  box-shadow: 0 10px 30px rgba(0,0,0,.5), 0 0 0 1px rgba(255,92,174,.15) inset;
  color: #f4f7fb;
  white-space: nowrap;
  pointer-events: auto;
  cursor: pointer;
  opacity: 0;
  transform: translate3d(0, 8px, 0) scale(.94);
  transform-origin: 100% 100%;
  transition: opacity .25s ease, transform .3s cubic-bezier(.22, 1.1, .36, 1);
}
.cp-egg__bubble::after {
  content: "";
  position: absolute; right: 22px; bottom: -7px;
  width: 12px; height: 12px;
  background: inherit;
  border-right: 1px solid rgba(22,198,201,.55);
  border-bottom: 1px solid rgba(22,198,201,.55);
  transform: rotate(45deg);
}
.cp-egg.is-out .cp-egg__bubble, .cp-egg.is-go .cp-egg__bubble, .cp-egg.is-final .cp-egg__bubble {
  opacity: 1; transform: translate3d(0, 0, 0) scale(1);
}
.cp-egg__bubble b { color: #16c6c9; }
.cp-egg.is-go .cp-egg__bubble, .cp-egg.is-final .cp-egg__bubble { border-color: #f5c451; }
.cp-egg.is-go .cp-egg__bubble b { color: #f5c451; }
.cp-egg__x {
  position: absolute; top: 2px; right: 2px;
  width: 32px; height: 32px;
  color: rgba(244,247,251,.55);
  font: 400 18px/32px sans-serif;
  border-radius: 10px;
}
.cp-egg__x:hover, .cp-egg__x:focus-visible { color: #ff5cae; outline: none; }

/* ===== 1. PEEK — подглядывает из-за правого края ===== */
.cp-peek { right: 0; bottom: 120px; width: 320px; height: 0; }
@media (min-width: 900px) { .cp-peek { bottom: 96px; } }
.cp-peek .cp-egg__fig {
  position: absolute; right: 0; bottom: 0;
  width: max-content;
  transform-origin: 100% 100%;
  transform: translate3d(115%, 0, 0);
  transition: transform .55s cubic-bezier(.22, 1.1, .36, 1);
  will-change: transform;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,.45));
}
.cp-peek .cp-egg__img { height: var(--cp-egg-h); width: auto; }
.cp-peek.is-peek .cp-egg__fig { transform: translate3d(4%, 0, 0); }
.cp-peek.is-peek .cp-egg__img { animation: cp-glance 4.2s ease-in-out infinite; }   /* «ищет глазами» */
@keyframes cp-glance {
  0%, 60%, 100% { transform: translate3d(0, 0, 0) rotate(0); }
  68%, 80%      { transform: translate3d(-9px, 2px, 0) rotate(-6deg); }
  90%           { transform: translate3d(0, 0, 0) rotate(0); }
}
.cp-peek.is-out .cp-egg__fig, .cp-peek.is-go .cp-egg__fig { transform: translate3d(-8px, 0, 0); }
.cp-peek.is-go .cp-egg__fig { animation: cp-hop .5s ease-out; }
@keyframes cp-hop {
  0%   { transform: translate3d(-8px, 0, 0) scale(1); }
  40%  { transform: translate3d(-8px, -18px, 0) scale(1.06); }
  100% { transform: translate3d(-8px, 0, 0) scale(1); }
}
.cp-peek .cp-egg__bubble { right: 10px; bottom: calc(var(--cp-egg-h) + 8px); }

/* ===== 2. TAIL — виляет из-под нижнего края у подвала ===== */
.cp-tail { --cp-tail-h: 84px; left: 10%; bottom: 0; width: 320px; height: 0; }
@media (min-width: 900px) { .cp-tail { --cp-tail-h: 110px; left: 7%; } }
.cp-tail__tail, .cp-tail__man {
  position: absolute; left: 0; bottom: 0;
  width: max-content;
  transform: translate3d(0, 110%, 0);
  transition: transform .5s cubic-bezier(.22, 1.1, .36, 1);
  will-change: transform;
}
.cp-tail__tail { transform-origin: 50% 100%; }
.cp-tail__img { height: var(--cp-tail-h); width: auto; }
.cp-tail__manimg { height: var(--cp-egg-h); width: auto; }
.cp-tail.is-tail .cp-tail__tail { transform: translate3d(0, 2px, 0); animation: cp-wag 4.6s ease-in-out .5s infinite; }
@keyframes cp-wag {                                  /* четыре взмаха, потом замирает */
  0%, 52%, 100% { transform: translate3d(0, 2px, 0) rotate(0); }
  6%, 18%, 30%, 42% { transform: translate3d(0, 2px, 0) rotate(-16deg); }
  12%, 24%, 36%, 48% { transform: translate3d(0, 2px, 0) rotate(16deg); }
}
.cp-tail.is-out .cp-tail__man, .cp-tail.is-go .cp-tail__man { transform: translate3d(0, 0, 0); }
.cp-tail.is-go .cp-tail__man { animation: cp-hop-up .5s ease-out; }
@keyframes cp-hop-up {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  40%  { transform: translate3d(0, -18px, 0) scale(1.06); }
  100% { transform: translate3d(0, 0, 0) scale(1); }
}
.cp-tail .cp-egg__bubble { left: 0; bottom: calc(var(--cp-egg-h) + 8px); border-radius: 14px 14px 14px 4px; transform-origin: 0 100%; }
.cp-tail .cp-egg__bubble::after { right: auto; left: 22px; }

/* ===== 3. ROCKET — пролетает со следом из свечей ===== */
.cp-rocket { --cp-rk-h: 110px; left: 0; top: 26vh; width: max-content; height: 0; transform: translate3d(-110%, 0, 0); will-change: transform; }
@media (min-width: 900px) { .cp-rocket { --cp-rk-h: 150px; top: 30vh; } }
.cp-rocket.is-fly { animation: cp-fly 5.2s linear forwards; }
@media (min-width: 900px) { .cp-rocket.is-fly { animation-duration: 4.2s; } }
@keyframes cp-fly { from { transform: translate3d(-110%, 0, 0); } to { transform: translate3d(100vw, 0, 0); } }
.cp-rocket.is-held { animation-play-state: paused; }
.cp-rocket__btn { position: relative; padding: 10px; margin: -10px; animation: cp-bob 1.1s ease-in-out infinite; will-change: transform; }
@keyframes cp-bob { 0%, 100% { transform: translate3d(0, 0, 0); } 50% { transform: translate3d(0, -10px, 0); } }
.cp-rocket.is-go .cp-rocket__btn { animation: cp-up .65s cubic-bezier(.4, 0, 1, .6) forwards; }
@keyframes cp-up { to { transform: translate3d(60px, -120vh, 0) rotate(-38deg); } }
.cp-rocket__img { height: var(--cp-rk-h); width: auto; filter: drop-shadow(0 6px 14px rgba(0,0,0,.45)); }
.cp-rocket__c {                                      /* след: четыре свечи, гаснут по очереди */
  position: absolute; left: -6px; top: 62%;
  width: 5px; height: 20px; border-radius: 2px;
  background: #16c6c9;
  opacity: 0;
  animation: cp-trail .7s linear infinite;
}
.cp-rocket__c:nth-child(2) { left: -20px; height: 14px; top: 58%; background: #ff235e; }
.cp-rocket__c:nth-child(3) { left: -34px; height: 24px; top: 60%; }
.cp-rocket__c:nth-child(4) { left: -48px; height: 12px; top: 64%; background: #ff235e; }
@keyframes cp-trail { 0% { opacity: .95; transform: translate3d(0, 0, 0); } 100% { opacity: 0; transform: translate3d(-16px, 6px, 0); } }

/* ===== 4. EYES — знак в шапке открывает глаза ===== */
/* Знак в шапке 36 px — глаза в нём не прочесть, поэтому на время взгляда он
   вырастает влево (справа — название), а потом возвращается. */
.topbar .brand svg.cp-mark { transition: transform .35s cubic-bezier(.22, 1.1, .36, 1); transform-origin: 100% 50%; }
.topbar .brand svg.is-eyes { transform: scale(1.9); }
.cp-eyes { opacity: 0; pointer-events: none; transition: opacity .25s ease .15s; }
svg.is-eyes .cp-eyes { opacity: 1; }
.cp-eyes__eye { transform-box: fill-box; transform-origin: center; }
svg.is-eyes .cp-eyes__eye { animation: cp-blink 3.4s ease-in-out infinite; }
.cp-eyes__eye:nth-child(2) { animation-delay: .07s; }
@keyframes cp-blink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.08); } }
.cp-eyes__white { fill: #ffffff; }
.cp-eyes__pupil { fill: #0e141c; transition: transform .12s linear; will-change: transform; }
.cp-eyes-bubble { width: 320px; height: 0; }
.cp-eyes-bubble .cp-egg__bubble { left: 0; top: 0; border-radius: 4px 14px 14px 14px; transform-origin: 0 0; }
.cp-eyes-bubble .cp-egg__bubble::after { right: auto; left: 22px; bottom: auto; top: -7px; border: 0; border-left: 1px solid rgba(22,198,201,.55); border-top: 1px solid rgba(22,198,201,.55); }

/* ===== 5. COIN — монета падает, лапа из-под героя ===== */
.cp-coin__coin {
  position: absolute; z-index: 2;
  width: 28px; height: 28px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffe79a, #f5c451 55%, #b8862a);
  box-shadow: 0 0 0 2px #fff inset, 0 0 10px rgba(245,196,81,.7);
  opacity: 0; pointer-events: none;
  will-change: transform, opacity;
}
.cp-coin__coin.is-drop { animation: cp-drop 1.2s cubic-bezier(.3, 0, .6, 1) forwards; }
@keyframes cp-drop {
  0%   { opacity: 0; transform: translate3d(0, 0, 0) rotate(0); }
  10%  { opacity: 1; }
  58%  { transform: translate3d(0, var(--fall), 0) rotate(300deg); animation-timing-function: ease-out; }
  74%  { transform: translate3d(0, calc(var(--fall) - 34px), 0) rotate(330deg); animation-timing-function: ease-in; }
  88%  { transform: translate3d(0, var(--fall), 0) rotate(350deg); animation-timing-function: ease-out; }
  95%  { transform: translate3d(0, calc(var(--fall) - 8px), 0) rotate(355deg); }
  100% { opacity: 1; transform: translate3d(0, var(--fall), 0) rotate(360deg); }
}
.cp-coin__coin.is-gone { opacity: 0; transition: opacity .15s; }
.cp-coin { position: absolute; bottom: 0; width: 0; height: 0; z-index: 3; }
.cp-coin__man {
  position: absolute; left: 0; bottom: 0;
  width: max-content;
  transform: translate3d(-50%, 110%, 0);
  transition: transform .55s cubic-bezier(.22, 1.1, .36, 1);
  will-change: transform;
}
.cp-coin__img { height: var(--cp-egg-h); width: auto; }
.cp-coin.is-out .cp-coin__man, .cp-coin.is-go .cp-coin__man { transform: translate3d(-50%, 12%, 0); }
.cp-coin.is-go .cp-coin__man { animation: cp-hop-c .5s ease-out; }
@keyframes cp-hop-c {
  0%   { transform: translate3d(-50%, 12%, 0); }
  40%  { transform: translate3d(-50%, -4%, 0) scale(1.05); }
  100% { transform: translate3d(-50%, 12%, 0); }
}
.cp-coin .cp-egg__bubble { left: 0; bottom: calc(var(--cp-egg-h) * .9); transform-origin: 0 100%; border-radius: 14px 14px 14px 4px; }
.cp-coin .cp-egg__bubble::after { right: auto; left: 22px; }
.cp-coin .cp-egg__bubble { transform: translate3d(-50%, 8px, 0) scale(.94); }
.cp-coin.is-out .cp-egg__bubble, .cp-coin.is-go .cp-egg__bubble { transform: translate3d(-50%, 0, 0) scale(1); }

/* ===== 6. KONAMI — бег на дуэль ===== */
.cp-duel { inset: 0; z-index: 260; }
.cp-duel__flash { position: absolute; inset: 0; background: #16c6c9; opacity: 0; }
.cp-duel.is-run .cp-duel__flash { animation: cp-flash .45s ease-out; }
@keyframes cp-flash { 0% { opacity: 0; } 20% { opacity: .35; } 100% { opacity: 0; } }
.cp-duel__shiba, .cp-duel__bot {
  position: absolute; top: 50%; left: 0;
  transform: translate3d(100vw, -50%, 0);
  will-change: transform;
}
.cp-duel__shiba .cp-duel__img { height: 130px; width: auto; animation: cp-gait .22s ease-in-out infinite alternate; }
.cp-duel__bot .cp-duel__img { height: 160px; width: auto; animation: cp-gait .26s ease-in-out infinite alternate; }
@media (min-width: 900px) { .cp-duel__shiba .cp-duel__img { height: 170px; } .cp-duel__bot .cp-duel__img { height: 210px; } }
@keyframes cp-gait { from { transform: translate3d(0, 0, 0) rotate(-2deg); } to { transform: translate3d(0, -8px, 0) rotate(2deg); } }
.cp-duel.is-run .cp-duel__shiba { animation: cp-run 2.4s cubic-bezier(.35, 0, .65, 1) forwards; }
.cp-duel.is-run .cp-duel__bot { animation: cp-run 2.4s cubic-bezier(.35, 0, .65, 1) .4s forwards; }
@keyframes cp-run { from { transform: translate3d(100vw, -50%, 0); } to { transform: translate3d(-120%, -50%, 0); } }
.cp-duel__go {
  position: absolute; left: 50%; top: 50%;
  transform: translate3d(-50%, -40%, 0) scale(.5);
  opacity: 0;
  transition: transform .4s cubic-bezier(.22, 1.1, .36, 1), opacity .3s ease;
  filter: drop-shadow(0 10px 24px rgba(0,0,0,.5));
}
.cp-duel__goimg { height: 170px; width: auto; }
@media (min-width: 900px) { .cp-duel__goimg { height: 230px; } }
.cp-duel.is-final .cp-duel__go { transform: translate3d(-50%, -40%, 0) scale(1); opacity: 1; }
.cp-duel .cp-egg__bubble { left: 50%; top: 50%; transform: translate3d(-50%, calc(-40% - 150px), 0) scale(.94); border-radius: 14px; transform-origin: 50% 100%; }
.cp-duel .cp-egg__bubble::after { right: calc(50% - 6px); }
.cp-duel.is-final .cp-egg__bubble { transform: translate3d(-50%, calc(-40% - 150px), 0) scale(1); }
@media (min-width: 900px) {
  .cp-duel .cp-egg__bubble { transform: translate3d(-50%, calc(-40% - 200px), 0) scale(.94); }
  .cp-duel.is-final .cp-egg__bubble { transform: translate3d(-50%, calc(-40% - 200px), 0) scale(1); }
}

/* ===== Светлая тема ===== */
:root[data-theme="light"] .cp-egg__bubble {
  background: #ffffff; color: #0e141c;
  border-color: rgba(19,168,168,.6);
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
}
:root[data-theme="light"] .cp-egg__x { color: rgba(14,20,28,.5); }

/* ===== Поменьше движения ===== */
@media (prefers-reduced-motion: reduce) {
  .cp-egg *, .cp-egg__bubble { transition-duration: .01s !important; }
  .cp-peek.is-peek .cp-egg__img, .cp-tail.is-tail .cp-tail__tail, .cp-peek.is-go .cp-egg__fig,
  .cp-tail.is-go .cp-tail__man, .cp-coin.is-go .cp-coin__man, .cp-duel__img, svg.is-eyes .cp-eyes__eye,
  .cp-duel.is-run .cp-duel__flash { animation: none !important; }
  .cp-coin__coin.is-drop { animation-duration: .01s; }
  .cp-tail.is-tail .cp-tail__tail { transform: translate3d(0, 2px, 0); }
}
@media print { .cp-egg, .cp-coin__coin, .cp-eyes { display: none; } }
