/* Mr. Boo, shop supervisor. All of his moves live here. */
.boo-dock { position: fixed; right: 18px; bottom: 0; z-index: 60; width: 132px; height: 132px; pointer-events: none; }
.boo-dock > * { pointer-events: auto; }
.boo-btn { position: absolute; left: 0; bottom: -150px; width: 132px; height: 132px; padding: 0; border: 0; background: none; cursor: pointer; transition: bottom .55s cubic-bezier(.3,1.5,.5,1); -webkit-tap-highlight-color: transparent; }
.boo-dock.in .boo-btn { bottom: -26px; }
.boo-dock.in.up .boo-btn { bottom: 4px; }
.boo-btn:focus-visible { outline: 3px solid var(--safety, #E4B53C); outline-offset: 4px; border-radius: 50%; }

.boo-bubble { position: absolute; right: 108px; bottom: 74px; width: max-content; max-width: min(270px, calc(100vw - 150px)); padding: 10px 14px; background: var(--paper, #FFFDF7); border: 2px solid var(--ink, #1E201C); border-radius: 14px 14px 2px 14px; font: 600 15px/1.35 var(--body, Arial, sans-serif); color: var(--ink, #1E201C); box-shadow: 4px 4px 0 var(--ink, #1E201C); opacity: 0; transform: translateY(8px) scale(.96); transition: opacity .2s, transform .2s; pointer-events: none; }
.boo-bubble.show { opacity: 1; transform: none; pointer-events: auto; }
.boo-bubble .boo-sig { display: block; margin-top: 4px; font: 400 13px var(--marker, cursive); color: var(--walnut, #8A5A2B); }
.boo-bubble button { margin: 6px 0 0; padding: 0; border: 0; background: none; font: 600 12px var(--body); color: var(--ink-2, #4A4C45); text-decoration: underline; cursor: pointer; }

/* Sent to bed: a small tab stays so he can be called back */
.boo-tab { position: fixed; right: 0; bottom: 90px; z-index: 60; display: none; align-items: center; gap: 6px; padding: 6px 10px 6px 6px; border: 2px solid var(--ink); border-right: 0; border-radius: 30px 0 0 30px; background: var(--paper); font: 600 13px var(--body); cursor: pointer; box-shadow: 2px 2px 0 var(--ink); }
.boo-tab img { width: 34px; height: 34px; }
.boo-bed .boo-tab { display: flex; }
.boo-bed .boo-dock { display: none; }

/* Tricks */
.boo-zzz { position: absolute; right: 10px; top: -6px; font: 400 22px var(--marker, cursive); color: var(--pine, #2F5D3A); opacity: 0; pointer-events: none; }
.boo-btn.sleep + .boo-zzz { animation: boo-zzz 2.4s ease-in-out infinite; }

@keyframes boo-tilt { to { transform: rotate(-12deg) translateY(-4px); } }
@keyframes boo-spin { to { transform: rotate(360deg); } }
@keyframes boo-sit { 30% { transform: scale(1.06, .86) translateY(10px); } 60% { transform: scale(.97, 1.04); } }
@keyframes boo-shake { 15%, 45%, 75% { transform: rotate(-9deg); } 30%, 60%, 90% { transform: rotate(9deg); } }
@keyframes boo-jump { 40% { transform: translateY(-70px) rotate(-6deg); } 70% { transform: translateY(0) scale(1.05, .92); } }
@keyframes boo-roll { 50% { transform: translateX(-60px) rotate(-360deg); } 100% { transform: translateX(0) rotate(-720deg); } }
@keyframes boo-dead { 20%, 80% { transform: rotate(-90deg) translate(-30px, 10px); } }
@keyframes boo-breathe { 50% { transform: scale(1.02, .98) translateY(3px); } }
@keyframes boo-zzz { 0% { opacity: 0; transform: translate(0, 10px); } 40% { opacity: 1; } 100% { opacity: 0; transform: translate(18px, -26px); } }

/* Zoomies: runs across the bottom of the screen */
.boo-runner { position: fixed; bottom: 10px; left: -160px; z-index: 61; width: 120px; pointer-events: none; animation: boo-run 2.4s linear forwards; }
.boo-runner img { width: 100%; animation: boo-hop .3s ease-in-out infinite; }
@keyframes boo-run { to { left: calc(100vw + 40px); } }
@keyframes boo-hop { 50% { transform: translateY(-14px) rotate(4deg); } }

/* Pops up from the bottom middle when you type B-O-O */
.boo-pop { position: fixed; left: 50%; bottom: -220px; z-index: 61; width: 190px; margin-left: -95px; pointer-events: none; animation: boo-pop 2.6s cubic-bezier(.3,1.4,.5,1) forwards; }
.boo-pop img { width: 100%; }
@keyframes boo-pop { 25%, 75% { bottom: -40px; } 100% { bottom: -220px; } }

/* Sawdust confetti */
.boo-dust { position: fixed; top: -12px; z-index: 62; width: 8px; height: 4px; border-radius: 1px; pointer-events: none; animation: boo-fall linear forwards; }
@keyframes boo-fall { to { transform: translate(var(--dx), 105vh) rotate(var(--r)); } }

/* Hidden Mr. Boos peeking around the site */
.boo-peek { position: absolute; z-index: 5; width: 46px; height: 46px; padding: 0; border: 0; background: url('../img/boo/boo-120.png') center / contain no-repeat; cursor: pointer; opacity: .9; transition: transform .25s, opacity .25s; }
.boo-peek:hover, .boo-peek:focus-visible { transform: scale(1.25) rotate(-10deg); opacity: 1; }
.boo-peek.tl { top: -18px; left: -14px; transform: rotate(-20deg); }
.boo-peek.tr { top: -18px; right: -14px; transform: rotate(18deg); }
.boo-peek.bl { bottom: -16px; left: -12px; transform: rotate(-12deg); }
.boo-peek.br { bottom: -16px; right: -12px; transform: rotate(14deg); }
.boo-peek.found { animation: boo-found .6s ease forwards; }
@keyframes boo-found { 50% { transform: scale(1.6) rotate(20deg); } 100% { transform: scale(0); opacity: 0; } }

/* Certificate when every hidden Boo is found */
.boo-cert-wrap { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px; background: rgba(30,32,28,.55); }
.boo-cert { position: relative; width: min(460px, 100%); padding: 30px 28px 24px; text-align: center; background: var(--paper); border: 3px solid var(--ink); border-radius: 8px; box-shadow: 8px 8px 0 var(--pine); }
.boo-cert img { width: 130px; margin: -80px auto 6px; display: block; }
.boo-cert h2 { margin: 0 0 6px; font: 400 1.7rem/1.1 var(--display); }
.boo-cert .stamp { display: inline-block; margin: 10px 0; padding: 4px 12px; border: 3px solid var(--red); color: var(--red); font: 400 1.1rem var(--marker); transform: rotate(-4deg); }

/* Mr. Boo in page content */
.boo-card { display: grid; grid-template-columns: 150px 1fr; gap: 22px; align-items: center; }
.boo-card img { width: 150px; cursor: pointer; transition: transform .3s; }
.boo-card img:hover { transform: rotate(-8deg) scale(1.04); }
@media (max-width: 600px) { .boo-card { grid-template-columns: 1fr; text-align: center; } .boo-card img { margin: 0 auto; } }

/* Admin: smaller, bottom left, never pops up on its own */
.boo-admin .boo-dock { right: auto; left: 16px; width: 86px; height: 86px; }
.boo-admin .boo-btn { width: 86px; height: 86px; }
.boo-admin .boo-bubble { right: auto; left: 76px; bottom: 50px; border-radius: 14px 14px 14px 2px; }

@media (max-width: 700px) {
  .boo-dock { right: 8px; width: 92px; height: 92px; }
  .boo-btn { width: 92px; height: 92px; }
  .boo-dock.in .boo-btn { bottom: -20px; }
  .boo-bubble { right: 74px; bottom: 50px; font-size: 14px; }
}
@media print { .boo-dock, .boo-tab, .boo-peek { display: none !important; } }
@media (prefers-reduced-motion: reduce) {
  .boo-btn, .boo-bubble, .boo-peek { transition: none; }
  .boo-rig, .boo-rig *, .boo-look, .boo-runner, .boo-pop, .boo-dust { animation: none !important; }
  .boo-runner, .boo-pop, .boo-dust { display: none; }
}


/* ---------- Mr. Boo's rig: layered so he blinks, twitches, pants and breathes ---------- */
.boo-look { position: absolute; inset: 0; transform-origin: 50% 92%; filter: drop-shadow(0 6px 10px rgba(30,32,28,.22)); }
.boo-rig { position: absolute; inset: 0; transform-origin: 50% 100%; animation: boo-breathe 3.6s ease-in-out infinite; }
.boo-rig img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
@keyframes boo-breathe { 50% { transform: scale(1.012, .992) translateY(.5%); } }
.l-ear-l { transform-origin: 24.3% 29.1%; }
.l-ear-r { transform-origin: 65.5% 26.7%; }
.twitch-l .l-ear-l { animation: ear-l .42s ease; }
.twitch-r .l-ear-r { animation: ear-r .42s ease; }
@keyframes ear-l { 30% { transform: rotate(-9deg); } 60% { transform: rotate(3deg); } }
@keyframes ear-r { 30% { transform: rotate(9deg); } 60% { transform: rotate(-3deg); } }
.l-tongue { transform-origin: 53% 61%; animation: boo-pant 1.9s ease-in-out infinite; }
.excited .l-tongue { animation-duration: .36s; }
.excited { animation-duration: 1s; }
@keyframes boo-pant { 50% { transform: translateY(.5%) scaleY(1.06); } }
.lid { position: absolute; display: block; border-radius: 50%; background: radial-gradient(ellipse at 50% 45%, #E9DFCC 0 52%, rgba(233,223,204,.85) 62%, rgba(233,223,204,0) 74%); transform-origin: 50% 10%; scale: 1 0; }
.lid::after { content: ""; position: absolute; left: 18%; right: 18%; top: 38%; height: 30%; border-bottom: 2.5px solid #3b2a1c; border-radius: 0 0 50% 50%; }
.lid-l { left: 31.4%; top: 37.2%; width: 11%; height: 9%; rotate: -6deg; }
.lid-r { left: 53.6%; top: 32.3%; width: 10.7%; height: 8.7%; rotate: -12deg; }
.blink .lid { animation: boo-blink .17s ease-in-out; }
.eyes-shut .lid { scale: 1 1; transition: scale .12s; }
@keyframes boo-blink { 50% { scale: 1 1; } }
.woof { animation: boo-breathe 3.6s ease-in-out infinite, boo-woof .19s ease-out; }
@keyframes boo-woof { 40% { scale: 1.06; translate: 0 -2.5%; } }
.boo-btn.flip .boo-rig { scale: -1 1; transition: scale .35s; }
.boo-btn.sleep .boo-rig { animation-duration: 5.5s; }
.boo-btn.sleep .l-tongue { animation-duration: 4s; }

/* Natural moves (on .boo-look, so they ride on top of breathing) */
.t-tilt .boo-look { animation: b-tilt 1.5s cubic-bezier(.3,1.25,.4,1); }
.t-tilt2 .boo-look { animation: b-tilt2 1.5s cubic-bezier(.3,1.25,.4,1); }
@keyframes b-tilt { 30% { transform: rotate(-15deg); } 45%, 80% { transform: rotate(-12deg); } }
@keyframes b-tilt2 { 30% { transform: rotate(15deg); } 45%, 80% { transform: rotate(12deg); } }
.t-tilt .l-ear-l, .t-tilt2 .l-ear-r { animation: ear-perk 1.5s ease; }
@keyframes ear-perk { 25%, 80% { transform: rotate(var(--perk, -8deg)); } }
.t-tilt2 .l-ear-r { --perk: 8deg; }
.t-perk .boo-look { animation: b-perk .9s cubic-bezier(.3,1.5,.5,1); }
@keyframes b-perk { 35%, 70% { transform: translateY(-7%); } }
.t-perk .l-ear-l { animation: ear-perk .9s ease; --perk: 7deg; }
.t-perk .l-ear-r { animation: ear-perk .9s ease; --perk: -7deg; }
.t-shake .boo-look { animation: b-shake .9s ease-out; }
@keyframes b-shake { 10% { transform: rotate(12deg) translateX(2%); } 22% { transform: rotate(-12deg) translateX(-2%); } 34% { transform: rotate(10deg); } 46% { transform: rotate(-8deg); } 58% { transform: rotate(6deg); } 70% { transform: rotate(-4deg); } 82% { transform: rotate(2deg); } }
.t-shake .l-ear-l { animation: ear-flop .9s ease-out; }
.t-shake .l-ear-r { animation: ear-flop .9s ease-out reverse; }
@keyframes ear-flop { 15% { transform: rotate(-16deg); } 30% { transform: rotate(12deg); } 45% { transform: rotate(-9deg); } 60% { transform: rotate(6deg); } 75% { transform: rotate(-3deg); } }
.t-sneeze .boo-look { animation: b-sneeze .9s ease; }
@keyframes b-sneeze { 25% { transform: rotate(-3deg) translateY(-2%); } 40% { transform: rotate(5deg) translateY(4%) scale(1.03, .95); } 60% { transform: rotate(-2deg) translateY(-1%); } }
.t-bounce .boo-look { animation: b-bounce 1s ease; }
@keyframes b-bounce { 15% { transform: translateY(2%) scale(1.04, .95); } 30% { transform: translateY(-11%); } 45% { transform: translateY(1%) scale(1.03, .96); } 60% { transform: translateY(-8%); } 75% { transform: translateY(0) scale(1.02, .98); } }
.t-sit .boo-look { animation: b-sit .8s ease; }
@keyframes b-sit { 30% { transform: scale(1.05, .9) translateY(6%); } 60% { transform: scale(.98, 1.03); } }
.t-liedown .boo-look { animation: b-lie 3.2s ease-in-out; }
@keyframes b-lie { 15%, 80% { transform: translateY(24%) rotate(-3deg); } 90% { transform: translateY(-3%) scale(1.02, .98); } }
.t-bark .boo-look { animation: b-perk .7s ease; }
