/* EurekArcade corner companion. Self-contained: its own palette, no external fonts or images. */
.ea-mascot {
  --ea-ink: #3D2B22;
  --ea-ink-soft: #6B5548;
  --ea-card: #FFFBF2;
  --ea-cream: #FFF4E0;
  --ea-sky: #A7D8EC;
  --ea-mint: #9FD8B0;
  --ea-mint-deep: #3F8F63;
  --ea-coral: #EE8E73;
  --ea-coral-deep: #C45A43;
  --ea-butter: #F7D774;
  --ea-peach: #F9C7A8;
  --ea-size: 124px;
  --ea-round: ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN", "Arial Rounded MT Bold", system-ui, sans-serif;

  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 60;
  width: var(--ea-size);
  height: var(--ea-size);
  font-family: var(--ea-round);
  color: var(--ea-ink);
  pointer-events: none;
  -webkit-font-smoothing: antialiased;
}
.ea-mascot *, .ea-mascot *::before, .ea-mascot *::after { box-sizing: border-box; }

/* ---------- the character ---------- */
.ea-mascot__btn {
  pointer-events: auto;
  position: absolute; inset: 0;
  display: block; width: 100%; height: 100%;
  margin: 0; padding: 0; border: 0; background: none;
  border-radius: 24px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .28s cubic-bezier(.3, 1.4, .5, 1), opacity .2s;
}
.ea-mascot__btn:focus { outline: none; }
.ea-mascot__btn:focus-visible { outline: 3px solid var(--ea-coral-deep); outline-offset: 3px; }

.ea-mascot__lift { position: absolute; inset: 0; display: block; transition: transform .18s ease-out; }
.ea-mascot__btn:hover .ea-mascot__lift { transform: translateY(-3px); }

.ea-mascot__shadow {
  position: absolute; left: 22%; right: 22%; bottom: 1px; height: 9px;
  border-radius: 50%; background: rgba(61, 43, 34, .16);
}
.ea-mascot__figure {
  position: absolute; inset: 0; display: block;
  transform-origin: 50% 96%;
  animation: ea-breathe 3.4s ease-in-out infinite;
}
.ea-mascot__img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; object-position: 50% 100%;
  opacity: 0; user-select: none; -webkit-user-drag: none; pointer-events: none;
}
.ea-mascot[data-pose="idle"] .ea-mascot__img--idle,
.ea-mascot[data-pose="wave"] .ea-mascot__img--wave,
.ea-mascot[data-pose="eureka"] .ea-mascot__img--eureka,
.ea-mascot[data-pose="sleep"] .ea-mascot__img--sleep { opacity: 1; }

/* moves (classes added by mascot.js) */
.ea-mascot.is-hop .ea-mascot__figure { animation: ea-hop .65s ease-out; }
.ea-mascot.is-wiggle .ea-mascot__figure { animation: ea-wiggle .9s ease-in-out; }
.ea-mascot.is-lean .ea-mascot__figure { animation: ea-lean 1.6s ease-in-out; }
.ea-mascot.is-jump .ea-mascot__figure { animation: ea-jump .9s ease-out; }
.ea-mascot.is-asleep .ea-mascot__figure { animation: ea-snore 4.2s ease-in-out infinite; }

/* "surprise" strokes over the head, anime style, eureka only */
.ea-mascot__pop { position: absolute; left: 50%; top: -6%; width: 0; height: 0; display: none; }
.ea-mascot__pop i {
  position: absolute; left: -3px; bottom: 0; width: 6px; height: 16px;
  border-radius: 3px; background: var(--ea-ink); transform-origin: 50% 34px;
}
.ea-mascot__pop i:nth-child(1) { transform: translateY(-18px) rotate(-38deg); }
.ea-mascot__pop i:nth-child(2) { transform: translateY(-22px); }
.ea-mascot__pop i:nth-child(3) { transform: translateY(-18px) rotate(38deg); }
.ea-mascot[data-pose="eureka"] .ea-mascot__pop { display: block; animation: ea-pop .35s ease-out; }

/* floating z's while asleep: they drift up and to the left, away from the screen edge */
.ea-mascot__zz { position: absolute; left: 34%; top: 10%; display: none; }
.ea-mascot__zz i {
  position: absolute; font-style: normal; font-weight: 800; color: var(--ea-ink);
  line-height: 1; opacity: 0; animation: ea-z 3s ease-in infinite;
}
.ea-mascot__zz i:nth-child(1) { left: 0; top: 14px; font-size: 14px; }
.ea-mascot__zz i:nth-child(2) { left: -12px; top: 0; font-size: 18px; animation-delay: 1s; }
.ea-mascot__zz i:nth-child(3) { left: -26px; top: -16px; font-size: 22px; animation-delay: 2s; }
.ea-mascot.is-asleep .ea-mascot__zz { display: block; }

/* ---------- speech bubble (greeting, eureka line) ---------- */
.ea-mascot__say {
  pointer-events: none;
  position: absolute; right: calc(var(--ea-size) * .62); bottom: calc(var(--ea-size) * .78);
  width: max-content; max-width: 220px;
  padding: 10px 14px;
  background: var(--ea-card); color: var(--ea-ink);
  border: 3px solid var(--ea-ink); border-radius: 18px 18px 6px 18px;
  box-shadow: 4px 4px 0 var(--ea-ink);
  font: 700 15px/1.35 var(--ea-round);
  opacity: 0; transform: translateY(6px) scale(.92); transform-origin: 100% 100%;
  transition: opacity .2s, transform .25s cubic-bezier(.3, 1.4, .5, 1);
  cursor: pointer;
}
.ea-mascot.is-saying .ea-mascot__say { opacity: 1; transform: none; pointer-events: auto; }
/* leave room for the surprise strokes over the head */
.ea-mascot[data-pose="eureka"] .ea-mascot__say { right: calc(var(--ea-size) * .86); }
.ea-mascot.is-open .ea-mascot__say { display: none; }

/* ---------- panel with the fixed tips ---------- */
.ea-mascot__panel {
  pointer-events: auto;
  position: absolute; right: 0; bottom: calc(var(--ea-size) + 12px);
  width: 312px; max-width: calc(100vw - 24px);
  padding: 14px 14px 14px;
  background: var(--ea-card); color: var(--ea-ink);
  border: 3px solid var(--ea-ink); border-radius: 22px;
  box-shadow: 5px 5px 0 var(--ea-ink);
  transform-origin: 85% 100%;
  animation: ea-open .22s cubic-bezier(.3, 1.4, .5, 1);
}
.ea-mascot__panel::after {
  content: ""; position: absolute; right: calc(var(--ea-size) * .42); bottom: -10px;
  width: 16px; height: 16px; background: var(--ea-card);
  border-right: 3px solid var(--ea-ink); border-bottom: 3px solid var(--ea-ink);
  transform: rotate(45deg);
}
.ea-mascot__head { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 12px; }
.ea-mascot__title { margin: 0; font: 800 19px/1.2 var(--ea-round); letter-spacing: .01em; }
.ea-mascot__sub { margin: 3px 0 0; font: 600 14px/1.3 var(--ea-round); color: var(--ea-ink-soft); }
.ea-mascot__close {
  flex: none; margin-left: auto; width: 34px; height: 34px; padding: 0;
  border: 3px solid var(--ea-ink); border-radius: 50%;
  background: var(--ea-peach); color: var(--ea-ink);
  font: 800 20px/1 var(--ea-round); cursor: pointer;
  box-shadow: 2px 2px 0 var(--ea-ink);
}
.ea-mascot__close:hover { background: var(--ea-coral); }
.ea-mascot__close:active { transform: translate(2px, 2px); box-shadow: none; }
.ea-mascot__close:focus-visible, .ea-mascot__link:focus-visible { outline: 3px solid var(--ea-coral-deep); outline-offset: 3px; }

.ea-mascot__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.ea-mascot__list li { margin: 0; padding: 0; }
.ea-mascot__link, .ea-mascot__tip {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 10px 12px;
  border: 3px solid var(--ea-ink); border-radius: 15px;
  background: #fff; color: var(--ea-ink); text-decoration: none;
  box-shadow: 3px 3px 0 var(--ea-ink);
  transition: transform .1s, box-shadow .1s, background-color .1s;
}
.ea-mascot__link:hover { color: var(--ea-ink); background: var(--ea-cream); transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ea-ink); }
.ea-mascot__link:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ea-ink); }
.ea-mascot__tip { background: var(--ea-cream); border-style: dashed; box-shadow: none; }
.ea-mascot__dot {
  flex: none; width: 22px; height: 22px; margin-top: 1px;
  border: 3px solid var(--ea-ink); border-radius: 8px; background: var(--ea-mint);
}
.ea-c-mint { background: var(--ea-mint); }
.ea-c-butter { background: var(--ea-butter); }
.ea-c-coral { background: var(--ea-coral); }
.ea-c-lav { background: #c9b8e8; }
.ea-c-sky { background: var(--ea-sky); border-radius: 50%; }
.ea-mascot__txt { display: block; min-width: 0; }
.ea-mascot__txt b { display: block; font: 800 15.5px/1.25 var(--ea-round); }
.ea-mascot__txt span { display: block; margin-top: 2px; font: 500 14px/1.35 var(--ea-round); color: var(--ea-ink-soft); }

/* ---------- phones ---------- */
@media (max-width: 640px) {
  .ea-mascot { --ea-size: 80px; right: max(8px, env(safe-area-inset-right)); bottom: max(8px, env(safe-area-inset-bottom)); }
  .ea-mascot__panel { width: calc(100vw - 16px); max-width: 360px; right: 0; }
  .ea-mascot__say { max-width: min(220px, calc(100vw - 110px)); font-size: 14px; }
  /* tuck to the edge while the page scrolls */
  .ea-mascot.is-tucked .ea-mascot__btn { transform: translateX(62%) rotate(-10deg); opacity: .9; }
}

/* ---------- motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  .ea-mascot, .ea-mascot *, .ea-mascot *::before, .ea-mascot *::after {
    animation: none !important; transition: none !important;
  }
  .ea-mascot__zz i { opacity: 1; }
  .ea-mascot__zz i:nth-child(3) { display: none; }
}
@media print { .ea-mascot { display: none !important; } }

/* ---------- keyframes ---------- */
@keyframes ea-breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.012, .988); } }
@keyframes ea-snore { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.025, .975); } }
@keyframes ea-hop {
  0% { transform: none; }
  20% { transform: scale(1.07, .92); }
  50% { transform: translateY(-13px) scale(.96, 1.05); }
  80% { transform: scale(1.05, .95); }
  100% { transform: none; }
}
@keyframes ea-wiggle {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-5deg); }
  50% { transform: rotate(4deg); }
  75% { transform: rotate(-2deg); }
}
@keyframes ea-lean {
  0%, 100% { transform: none; }
  25%, 70% { transform: rotate(-6deg) translateX(-3px); }
}
@keyframes ea-jump {
  0% { transform: none; }
  15% { transform: scale(1.1, .88); }
  45% { transform: translateY(-24px) scale(.94, 1.07); }
  70% { transform: scale(1.07, .93); }
  85% { transform: translateY(-5px); }
  100% { transform: none; }
}
@keyframes ea-pop { 0% { transform: scale(.2); opacity: 0; } 70% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }
@keyframes ea-open { 0% { transform: translateY(10px) scale(.9); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes ea-z {
  0% { opacity: 0; transform: translate(0, 6px) scale(.7); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translate(-10px, -24px) scale(1.1); }
}
