/* 🐾 Mew and Gengar, the roaming pets (2026-11-27). public/js/pets.js builds everything here; lib/pets.js says which pages load it.
   They live in a band along the bottom of the window. The band lets every click through; only a pet's body (.pet-hit) takes one. */
:root { --pets-band: 150px; --pets-bottom: 0px; }
@media (max-width: 639.98px) { :root { --pets-band: 120px; } }

.pets-layer { position: fixed; left: 0; right: 0; bottom: calc(var(--pets-bottom) + env(safe-area-inset-bottom, 0px)); height: var(--pets-band); z-index: 80; pointer-events: none; user-select: none; -webkit-user-select: none; }
.pets-layer > * { position: absolute; left: 0; top: 0; }
.pet-sprite { image-rendering: pixelated; background-repeat: no-repeat; pointer-events: none; will-change: transform; z-index: 2; }
.pet-sprite.front { z-index: 3; }
.pet-shadow { border-radius: 50%; background: rgba(0, 0, 0, .28); pointer-events: none; filter: blur(.5px); z-index: 1; will-change: transform, opacity; }
.pet-hit { pointer-events: auto; cursor: pointer; border-radius: 45%; touch-action: manipulation; -webkit-tap-highlight-color: transparent; z-index: 12; will-change: transform; }
.pet-hit.front { z-index: 13; }
.pet-hit[hidden] { display: none; }

/* one speech bubble per pet, kept inside the window by pets.js (it moves the wrapper; the inside pops) */
.pet-bubble { z-index: 30; pointer-events: none; will-change: transform; }
.pet-bubble-in { position: relative; display: flex; align-items: center; gap: 8px; background: #fff; color: #222; border-radius: 14px; padding: 6px 10px 6px 6px; font: 600 14px/1.25 var(--font-b, system-ui, sans-serif); white-space: nowrap; box-shadow: 0 4px 16px rgba(0, 0, 0, .35); transform-origin: var(--tail, 50%) 100%; animation: pet-pop .18s ease-out; }
.pet-bubble-in img { width: 40px; height: 40px; image-rendering: pixelated; border-radius: 8px; background: #eee; flex: none; }
.pet-bubble-in::after { content: ""; position: absolute; left: var(--tail, 50%); bottom: -7px; margin-left: -7px; border: 7px solid transparent; border-top-color: #fff; border-bottom: 0; }
.pet-bubble-in.gengar { background: #2b2140; color: #eadfff; }
.pet-bubble-in.gengar::after { border-top-color: #2b2140; }
.pet-bubble-in.gengar img { background: #3a2d55; }
@media (max-width: 639.98px) { .pet-bubble-in { font-size: 13px; } .pet-bubble-in img { width: 34px; height: 34px; } }

.pet-z { font-weight: 800; color: #c9b8ff; pointer-events: none; font-size: 15px; z-index: 20; animation: pet-zz 2.4s linear forwards; }
.pet-heart { pointer-events: none; font-size: 16px; z-index: 20; animation: pet-rise 1.4s ease-out both; }
@keyframes pet-pop { from { transform: translateY(8px) scale(.7); opacity: 0; } }
@keyframes pet-zz { from { opacity: 0; transform: translate(0, 0) scale(.7); } 20% { opacity: 1; } to { opacity: 0; transform: translate(18px, -46px) scale(1.2); } }
@keyframes pet-rise { from { opacity: 1; transform: translate(0, 0) scale(.8); } to { opacity: 0; transform: translate(var(--dx, 0px), -60px) scale(1.3); } }

/* the 🐾 button: hide or show them (remembered on this device) */
.pets-toggle { position: fixed; left: 14px; bottom: calc(var(--pets-bottom) + env(safe-area-inset-bottom, 0px) + 14px); z-index: 91; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line-2, rgba(178, 140, 255, .3)); background: rgba(19, 12, 36, .85); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); color: var(--text, #f2ecff); font-size: 17px; line-height: 1; display: grid; place-items: center; cursor: pointer; padding: 0; transition: border-color .2s, opacity .2s, filter .2s; }
.pets-toggle span { filter: grayscale(1) invert(.92); }   /* every platform draws 🐾 dark: lighten it for the dark site */
.pets-toggle:hover { border-color: var(--violet, #a878ff); }
.pets-toggle:focus-visible { outline: 2px solid var(--cyan, #3ee0d0); outline-offset: 3px; border-radius: 50%; }
.pets-toggle.off { opacity: .6; filter: grayscale(1); }

/* room at the end of the page, so the last lines can always scroll clear of the band */
html.pets-on body { padding-bottom: calc(var(--pets-band) + var(--pets-bottom)); }

@media (prefers-reduced-motion: reduce) { .pet-bubble-in { animation: none; } .pets-toggle { transition: none; } }
@media print { .pets-layer, .pets-toggle { display: none !important; } }
