/* Folder buddy: the little pixel mascot in the bottom-left corner (scripts/buddy.js). Colours follow the palette and
   Day/Night through the tokens in folio.css / themes.js. */
.buddy {
  --bpx: 4px; /* one sprite pixel */
  --buddy-ink: var(--deep);
  --buddy-tab: var(--tabA);
  --buddy-body: var(--tabB);
  --buddy-text: var(--text);
  position: fixed; left: 24px; bottom: 14px; z-index: 60; pointer-events: none; /* only the button and the panel take clicks */
}
[data-theme="night"] .buddy { --buddy-ink: #06201b; }
@media (max-width: 640px) { .buddy { --bpx: 3px; } }
@media (max-width: 399px) { .buddy { display: none; } }

.bd-btn { all: unset; box-sizing: border-box; position: relative; display: flex; flex-direction: column; align-items: center; pointer-events: auto; cursor: grab; touch-action: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.bd-btn:active { cursor: grabbing; }
.bd-btn:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 6px; border-radius: 12px; }
.bd-flip { display: block; }
.bd-svg { display: block; line-height: 0; }
.bd-sp { display: block; width: calc(var(--bpx) * 26); height: calc(var(--bpx) * 24); overflow: visible; shape-rendering: crispEdges; }
.bd-shadow { width: calc(var(--bpx) * 11); height: calc(var(--bpx) * 1.4); margin-top: calc(var(--bpx) * -1); border-radius: 50%; background: #000; opacity: 0.28; }

.bd-i { fill: var(--buddy-ink); } .bd-t { fill: var(--buddy-tab); } .bd-b { fill: var(--buddy-body); } .bd-x { fill: var(--buddy-text); } .bd-w { fill: #fff; } .bd-tongue { fill: #e58c7f; }
.bd-blush { fill: #f58fb0; } /* his blush: one pink pixel per cheek */

/* ── sprite animations (from the sprite sheet) ── */
.bd-idle, .bd-wave, .bd-breathe, .bd-sway, .bd-jump, .bd-pop, .bd-shake { transform-box: fill-box; }
.bd-idle { transform-origin: 50% 100%; animation: bdBounce 1.8s ease-in-out infinite; }
.bd-blink { animation: bdBlink 4s steps(1) infinite; }
.bd-wave { transform-origin: 0% 100%; animation: bdWave 0.5s ease-in-out infinite alternate; }
.bd-tapA { animation: bdTap 0.3s steps(1) infinite; }
.bd-tapB { animation: bdTap 0.3s steps(1) infinite 0.15s; }
.bd-rise { animation: bdRise 1.8s linear infinite; }
.bd-zf { animation: bdZ 2.6s ease-out infinite; }
.bd-breathe { transform-origin: 50% 100%; animation: bdBreathe 2.6s ease-in-out infinite; }
.bd-sway { transform-origin: 50% 100%; animation: bdSway 1.6s ease-in-out infinite alternate; }
.bd-qbob { animation: bdQ 0.8s ease-in-out infinite alternate; }
.bd-jump { transform-origin: 50% 100%; animation: bdJump 1s cubic-bezier(0.3, 0, 0.4, 1) infinite; }
.bd-pop { transform-origin: 50% 50%; animation: bdPop 1s ease-out infinite; }
.bd-bob { animation: bdBob 0.4s steps(1) infinite; }
.bd-fA { animation: bdFA 0.4s steps(1) infinite; }
.bd-fB { animation: bdFB 0.4s steps(1) infinite; }
.bd-paper { animation: bdPaper 2.6s ease-in-out infinite; }
.bd-shake { transform-origin: 50% 100%; animation: bdShake 0.32s linear infinite; }
.bd-excl { animation: bdQ 0.25s ease-in-out infinite alternate; }
@keyframes bdBounce { 0%, 100% { transform: translateY(0) scale(1, 1); } 12% { transform: translateY(0) scale(1.1, 0.9); } 40% { transform: translateY(-3px) scale(0.95, 1.06); } 58% { transform: translateY(-3px) scale(1, 1); } 88% { transform: translateY(0) scale(1.06, 0.94); } }
@keyframes bdBlink { 0%, 92%, 100% { opacity: 1; } 95% { opacity: 0; } }
@keyframes bdWave { from { transform: rotate(-12deg); } to { transform: rotate(28deg); } }
@keyframes bdTap { 0% { transform: translateY(0); } 50% { transform: translateY(1px); } }
@keyframes bdRise { 0% { transform: translateY(0); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(-9px); opacity: 0; } }
@keyframes bdZ { 0% { transform: translate(0, 0); opacity: 0; } 20% { opacity: 1; } 100% { transform: translate(3px, -6px); opacity: 0; } }
@keyframes bdBreathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.03, 1.05); } }
@keyframes bdSway { from { transform: rotate(-4deg); } to { transform: rotate(4deg); } }
@keyframes bdQ { from { transform: translateY(0); } to { transform: translateY(-1px); } }
@keyframes bdJump { 0%, 100% { transform: translateY(0) scale(1, 1); } 10% { transform: translateY(0) scale(1.12, 0.88); } 45% { transform: translateY(-5px) scale(0.94, 1.08); } 58% { transform: translateY(-5px) scale(1, 1); } 90% { transform: translateY(0) scale(1.08, 0.92); } }
@keyframes bdPop { 0% { transform: scale(0); opacity: 0; } 30% { transform: scale(1.3); opacity: 1; } 100% { transform: translateY(-3px) scale(1); opacity: 0; } }
@keyframes bdBob { 0% { transform: translateY(0); } 50% { transform: translateY(-1px); } }
@keyframes bdFA { 0% { opacity: 1; } 50% { opacity: 0; } }
@keyframes bdFB { 0% { opacity: 0; } 50% { opacity: 1; } }
@keyframes bdPaper { 0%, 15% { transform: translateY(6px); } 45%, 75% { transform: translateY(0); } 100% { transform: translateY(6px); } }
@keyframes bdShake { 0%, 50%, 100% { transform: rotate(-3deg); } 25%, 75% { transform: rotate(3deg); } }
/* reduced motion (or animations switched off): a static frame, no walking */
html:not(.mo) .bd-sp * { animation: none !important; }
@media (prefers-reduced-motion: reduce) { .bd-sp * { animation: none !important; } }
.buddy.bd-paused .bd-sp * { animation-play-state: paused !important; }

/* ── the FAQ panel: a little folder (a tab on top, the body underneath) ── */
.bd-panel { position: absolute; left: 0; --cx: 47px; bottom: calc(100% + 18px); width: min(340px, calc(100vw - 32px)); pointer-events: auto; display: flex; flex-direction: column; filter: drop-shadow(0 16px 26px rgba(0, 0, 0, 0.38)); transform-origin: 24px 100%; }
.bd-panel[hidden] { display: none; }
.bd-panel.bd-right { --cx: calc(100% - 47px); left: auto; right: 0; transform-origin: calc(100% - 24px) 100%; }
.bd-panel.bd-closing { animation: bdShut 0.19s ease-in forwards; }
.bd-ptab { position: relative; z-index: 1; align-self: flex-start; display: flex; align-items: center; height: 34px; margin-bottom: -1px; padding: 0 18px; border-radius: 14px 14px 0 0; background: var(--tabA); color: var(--tab-text); font: 600 11px var(--f); letter-spacing: 0.1em; }
.bd-panel.bd-right .bd-ptab { align-self: flex-end; }
.bd-pbody {
  --wash: linear-gradient(105deg, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0) 40%), linear-gradient(285deg, rgba(0, 0, 0, 0.07) 0%, transparent 46%);
  position: relative; max-height: min(62vh, 440px); overflow-x: hidden; overflow-y: auto; padding: 18px 24px 18px 16px; border-radius: 0 18px 18px 18px; color: var(--tab-text);
  background: var(--grain), var(--wash), var(--tabA); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
  scrollbar-width: none; -ms-overflow-style: none;
}
.bd-panel.bd-right .bd-pbody { border-radius: 18px 0 18px 18px; }
.bd-pbody::-webkit-scrollbar { display: none; }
@keyframes bdShut { to { opacity: 0; transform: translateY(10px) scale(0.9); } }
.bd-x-btn { all: unset; cursor: pointer; position: absolute; top: 44px; right: 10px; z-index: 2; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-size: 18px; line-height: 1; transition: background 0.2s, transform 0.3s cubic-bezier(0.34, 1.6, 0.5, 1); }
.bd-x-btn:hover, .bd-x-btn:focus-visible { background: rgba(0, 0, 0, 0.1); transform: rotate(90deg); outline: 0; }
.bd-view { display: block; }
.bd-hi { margin: 2px 34px 12px 0; font-size: 15px; line-height: 1.4; }
.bd-q { display: grid; gap: 6px; list-style: none; margin: 0; padding: 0; }
.bd-q li { animation: bdChip 0.38s cubic-bezier(0.2, 0.8, 0.2, 1) backwards; animation-delay: calc(var(--k, 0) * 38ms + 0.12s); transition: opacity 0.2s, transform 0.25s; }
@keyframes bdChip { from { opacity: 0; transform: translateY(8px); } }
.bd-q button { all: unset; box-sizing: border-box; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; padding: 10px 14px; border-radius: 12px; background: rgba(0, 0, 0, 0.07); font: 600 14px/1.3 var(--f); transition: background 0.2s, transform 0.25s cubic-bezier(0.34, 1.4, 0.5, 1); }
.bd-q button::after { content: "→"; opacity: 0.55; transition: transform 0.25s, opacity 0.2s; }
.bd-q button:hover, .bd-q button:focus-visible { background: var(--tabB); transform: translateX(3px); outline: 0; }
.bd-q button:hover::after { transform: translateX(3px); opacity: 1; }
/* the chosen question gets pressed in; the others slip away */
.bd-q button.picked { background: var(--tabB); transform: scale(0.97); }
.bd-q button.picked::after { transform: translateX(8px); opacity: 1; }
.bd-q li.bd-gone { opacity: 0; transform: translateX(-14px); }
/* turning the page */
.bd-view.bd-out-l { animation: bdOutL 0.19s ease-in forwards; }
.bd-view.bd-out-r { animation: bdOutR 0.19s ease-in forwards; }
.bd-view.bd-in-r { animation: bdInR 0.4s cubic-bezier(0.2, 0.8, 0.2, 1); }
.bd-view.bd-in-l { animation: bdInL 0.4s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes bdOutL { to { opacity: 0; transform: translateX(-26px); } }
@keyframes bdOutR { to { opacity: 0; transform: translateX(26px); } }
@keyframes bdInR { from { opacity: 0; transform: translateX(30px); } }
@keyframes bdInL { from { opacity: 0; transform: translateX(-30px); } }
.bd-qs { margin: 2px 34px 10px 0; display: inline-block; padding: 5px 10px; border-radius: 8px; background: rgba(0, 0, 0, 0.08); font: 600 11px var(--f); letter-spacing: 0.08em; text-transform: uppercase; animation: bdStamp 0.4s cubic-bezier(0.34, 1.6, 0.5, 1) 0.1s backwards; }
@keyframes bdStamp { from { opacity: 0; transform: scale(1.25) rotate(-3deg); } }
.bd-a { min-height: 4.4em; font-size: 16px; line-height: 1.5; }
.bd-a .caret { display: inline-block; width: 0.5em; height: 1em; margin-left: 1px; vertical-align: -0.12em; background: currentColor; animation: bdCaret 0.7s steps(1) infinite; }
@keyframes bdCaret { 50% { opacity: 0; } }
.bd-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.bd-acts { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 14px; margin-top: 14px; }
.bd-link { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px; font: 600 12px var(--f); letter-spacing: 0.08em; text-transform: uppercase; border: 1.5px solid rgba(0, 0, 0, 0.25); transition: background 0.2s, color 0.2s, transform 0.25s cubic-bezier(0.34, 1.5, 0.5, 1); }
.bd-link:hover, .bd-link:focus-visible { background: var(--tab-text); color: var(--tabA); outline: 0; transform: translateY(-1px); }
.bd-link.solid { background: var(--tab-text); color: var(--tabA); border-color: transparent; }
.bd-link.solid:hover, .bd-link.solid:focus-visible { filter: brightness(1.25); }
.bd-link:active { transform: scale(0.96); }
.bd-back .arr { display: inline-block; transition: transform 0.3s cubic-bezier(0.34, 1.6, 0.5, 1); }
.bd-back:hover .arr, .bd-back:focus-visible .arr { transform: translateX(-4px); }
.bd-back.bd-pressed .arr { animation: bdArr 0.32s ease-in-out; }
@keyframes bdArr { 40% { transform: translateX(-12px); opacity: 0; } 41% { transform: translateX(10px); opacity: 0; } 100% { transform: none; opacity: 1; } }
.bd-talk { margin-top: 12px; }
.bd-acts .bd-talk { margin-top: 0; }
@media (max-width: 640px) { .bd-panel { position: fixed; left: 16px; right: 16px; bottom: calc(3px * 24 + 30px); width: auto; } .bd-panel.bd-right { left: 16px; right: 16px; } .bd-panel.bd-right .bd-ptab { align-self: flex-start; } .bd-panel.bd-right .bd-pbody { border-radius: 0 18px 18px 18px; } }
@media (prefers-reduced-motion: reduce) { .bd-panel, .bd-q li, .bd-qs, .bd-view { animation: none !important; } }
html:not(.mo) .bd-panel, html:not(.mo) .bd-q li, html:not(.mo) .bd-qs { animation: none !important; }

/* ── transitions between states (scripts/buddy.js draw()) ── */
.bd-svg { transform-origin: 50% 100%; }
.bd-svg.bd-t-squash { animation: bdSquash 0.34s cubic-bezier(0.3, 0, 0.3, 1); }
.bd-svg.bd-t-sink { animation: bdSink 0.56s ease-in-out; }
.bd-svg.bd-t-jolt { animation: bdJolt 0.32s cubic-bezier(0.3, 0, 0.4, 1); }
@keyframes bdSquash { 0% { transform: none; } 28% { transform: scale(1.14, 0.8); } 60% { transform: translateY(calc(var(--bpx) * -1.5)) scale(0.94, 1.1); } 100% { transform: none; } }
@keyframes bdSink { 0% { transform: none; } 55% { transform: translateY(calc(var(--bpx) * 0.5)) scale(1.1, 0.84); } 100% { transform: none; } }
@keyframes bdJolt { 0% { transform: none; } 25% { transform: translateY(calc(var(--bpx) * -2.5)) scale(0.9, 1.16); } 62% { transform: scale(1.1, 0.9); } 100% { transform: none; } }
/* the pixel puff at its feet */
.bd-puff { position: absolute; left: 50%; bottom: calc(var(--bpx) * 1.5); width: 0; height: 0; pointer-events: none; }
.bd-puff i { position: absolute; left: 0; bottom: 0; width: calc(var(--bpx) * 1.5); height: calc(var(--bpx) * 1.5); background: var(--buddy-tab); opacity: 0; }
.bd-puff.go i:nth-child(1) { animation: bdPuffA 0.5s ease-out; --dx: calc(var(--bpx) * -9); --dy: calc(var(--bpx) * -2); }
.bd-puff.go i:nth-child(2) { animation: bdPuffA 0.5s ease-out 0.03s; --dx: calc(var(--bpx) * -4.5); --dy: calc(var(--bpx) * -5); }
.bd-puff.go i:nth-child(3) { animation: bdPuffA 0.5s ease-out 0.03s; --dx: calc(var(--bpx) * 4.5); --dy: calc(var(--bpx) * -5); }
.bd-puff.go i:nth-child(4) { animation: bdPuffA 0.5s ease-out; --dx: calc(var(--bpx) * 9); --dy: calc(var(--bpx) * -2); }
@keyframes bdPuffA { 0% { opacity: 0.9; transform: translate(0, 0) scale(1); } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.4); } }
html:not(.mo) .bd-puff { display: none; }
@media (prefers-reduced-motion: reduce) { .bd-puff { display: none; } .bd-svg { animation: none !important; } }

/* ── the thought bubble: dots rise from the head, a bubble pops up with "···", then it swells into the folder ── */
.bd-trail, .bd-cloud { position: absolute; display: none; pointer-events: none; }
.bd-trail { left: 0; top: 0; width: 0; height: 0; }
.bd-open .bd-trail { display: block; }
.bd-trail i { position: absolute; border-radius: 50%; background: var(--tabA); filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.3)); }
.bd-trail i:nth-child(1) { left: 38px; top: 12px; width: 9px; height: 9px; }
.bd-trail i:nth-child(2) { left: 44px; top: -8px; width: 14px; height: 14px; }
.bd-rightside .bd-trail i:nth-child(1) { left: 57px; }
.bd-rightside .bd-trail i:nth-child(2) { left: 46px; }
.bd-bubbling .bd-trail i { animation: bdDot 0.4s cubic-bezier(0.34, 1.8, 0.5, 1) backwards; }
.bd-bubbling .bd-trail i:nth-child(2) { animation-delay: 0.14s; }
@keyframes bdDot { from { transform: scale(0); opacity: 0; } }
.bd-cloud { left: 20px; bottom: calc(100% + 18px); width: 54px; height: 54px; border-radius: 50%; background: var(--tabA); filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.35)); grid-auto-flow: column; gap: 5px; align-content: center; justify-content: center; z-index: 2; }
.bd-rightside .bd-cloud { left: auto; right: 20px; }
.bd-bubbling .bd-cloud { display: grid; animation: bdCloud 0.95s both; }
.bd-cloud i { width: 7px; height: 7px; border-radius: 50%; background: var(--tab-text); animation: bdDotBounce 0.5s ease-in-out infinite alternate; }
.bd-cloud i:nth-child(2) { animation-delay: 0.1s; }
.bd-cloud i:nth-child(3) { animation-delay: 0.2s; }
@keyframes bdDotBounce { to { transform: translateY(-4px); } }
@keyframes bdCloud { 0% { transform: scale(0); opacity: 1; } 20% { transform: scale(1.14); } 30% { transform: scale(1); } 56% { opacity: 1; } 100% { transform: scale(1); opacity: 0; } }
/* the folder grows out of the bubble: a circle the size of the bubble, sitting exactly on it, that swells */
.bd-bubbling .bd-panel { animation: bdBubble 0.62s cubic-bezier(0.5, 0, 0.2, 1) 0.44s backwards; }
@keyframes bdBubble { 0% { opacity: 0; clip-path: circle(27px at var(--cx) calc(100% - 27px)); } 1% { opacity: 1; clip-path: circle(27px at var(--cx) calc(100% - 27px)); } 100% { opacity: 1; clip-path: circle(140% at var(--cx) calc(100% - 27px)); } }
.bd-bubbling .bd-pbody { animation: none; }
.bd-bubbling .bd-ptab { animation: bdFade 0.35s ease-out 0.95s backwards; }
.bd-bubbling .bd-view { animation: bdFade 0.4s ease-out 0.9s backwards; }
.bd-bubbling .bd-x-btn { animation: bdFade 0.3s ease-out 1s backwards; }
.bd-bubbling .bd-q li { animation-delay: calc(var(--k, 0) * 38ms + 0.95s); }
@keyframes bdFade { from { opacity: 0; } }
html:not(.mo) .bd-trail, html:not(.mo) .bd-cloud { display: none !important; }
@media (prefers-reduced-motion: reduce) { .bd-trail, .bd-cloud { display: none !important; } .bd-bubbling .bd-panel { animation: none; } }

/* Bobby's greeting and sign-off */
.bd-hi b { font-weight: 700; }
.bd-sig { display: block; margin-top: 6px; font: italic 500 14px var(--f); opacity: 0; transform: translateY(3px); transition: opacity 0.4s, transform 0.4s; }
.bd-sig.on { opacity: 0.7; transform: none; }

/* our own scroll slider (replaces the native scrollbar) */
.bd-rail { position: absolute; right: 8px; top: 50px; bottom: 16px; width: 4px; border-radius: 4px; background: rgba(0, 0, 0, 0.1); opacity: 0; pointer-events: none; transition: opacity 0.25s, width 0.2s, right 0.2s; }
.bd-rail.on { opacity: 1; pointer-events: auto; }
.bd-rail:hover, .bd-rail:has(.drag) { width: 8px; right: 6px; }
.bd-rail i { position: absolute; left: 0; right: 0; top: 0; border-radius: 6px; background: var(--tab-text); opacity: 0.5; cursor: grab; touch-action: none; transition: opacity 0.2s; }
.bd-rail:hover i, .bd-rail i.drag { opacity: 0.9; }
.bd-rail i.drag { cursor: grabbing; }
.bd-fade { position: absolute; left: 0; right: 0; bottom: 0; height: 40px; border-radius: 0 0 18px 18px; background: linear-gradient(to bottom, transparent, var(--tabA) 88%); opacity: 0; pointer-events: none; transition: opacity 0.25s; }
.bd-more .bd-fade { opacity: 1; }
.bd-x-btn { color: var(--tab-text); }
.bd-rail { top: 80px; }

/* ── perched on a tab / peeking over the pill / poof ── */
@property --vis { syntax: "<length>"; inherits: false; initial-value: 0px; }
.buddy.bd-perched, .buddy.bd-peek { bottom: auto; }
.buddy.bd-perched .bd-shadow, .buddy.bd-peek .bd-shadow { opacity: 0; }
.buddy.bd-peek { top: calc(var(--ptop, 0px) - var(--vis)); clip-path: inset(0 0 calc(100% - var(--vis)) 0); transition: --vis 0.65s cubic-bezier(0.3, 1.5, 0.5, 1); }
.buddy.bd-peek .bd-panel, .buddy.bd-peek .bd-trail, .buddy.bd-peek .bd-cloud { display: none !important; }
.buddy.bd-poof-out .bd-btn { transform-origin: 50% 100%; animation: bdPoofOut 0.2s ease-in forwards; }
.buddy.bd-poof-in .bd-btn { transform-origin: 50% 100%; animation: bdPoofIn 0.34s cubic-bezier(0.34, 1.7, 0.5, 1); }
@keyframes bdPoofOut { 0% { transform: none; opacity: 1; } 45% { transform: scale(1.15, 0.7); } 100% { transform: scale(0, 0); opacity: 0; } }
@keyframes bdPoofIn { 0% { transform: scale(0, 0); opacity: 0; } 60% { transform: scale(1.15, 1.2); opacity: 1; } 100% { transform: none; opacity: 1; } }
.bd-smoke { position: fixed; z-index: 61; width: 0; height: 0; pointer-events: none; }
.bd-smoke i { position: absolute; left: -5px; top: -8px; width: 10px; height: 10px; border-radius: 2px; background: var(--tabA); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1); opacity: 0; animation: bdSmoke 0.6s ease-out; }
.bd-smoke i:nth-child(1) { --dx: -36px; --dy: -6px; } .bd-smoke i:nth-child(2) { --dx: -22px; --dy: -24px; } .bd-smoke i:nth-child(3) { --dx: 0px; --dy: -32px; width: 14px; height: 14px; }
.bd-smoke i:nth-child(4) { --dx: 22px; --dy: -24px; } .bd-smoke i:nth-child(5) { --dx: 36px; --dy: -6px; } .bd-smoke i:nth-child(6) { --dx: -8px; --dy: -14px; width: 8px; height: 8px; }
@keyframes bdSmoke { 0% { opacity: 0.95; transform: translate(0, 0) scale(0.6); } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1.3); } }
html:not(.mo) .bd-smoke { display: none; }

/* ── Sweating (form errors) ── */
.bd-drop { fill: #7cc4ff; }
.bd-drip { animation: bdDrip 0.9s ease-in infinite; }
@keyframes bdDrip { 0% { transform: translateY(-1px); opacity: 0; } 25% { opacity: 1; } 100% { transform: translateY(5px); opacity: 0; } }

/* ── Loading screen: Bobby runs on a wheel, then falls off (scripts/bobby.js) ── */
.bd-load { --bpx: 4px; --buddy-ink: var(--deep, #00332b); --buddy-tab: var(--tabA, #d6d1cb); --buddy-body: var(--tabB, #96c59e); --buddy-text: var(--text, #00332b);
  position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center; background: var(--bg, #efede8); transition: opacity 0.45s; }
[data-theme="night"] .bd-load { --buddy-ink: #06201b; }
.bd-load.out { opacity: 0; pointer-events: none; }
.bd-lw { position: relative; width: 150px; height: 250px; }
.bd-lb { position: absolute; left: 50%; bottom: 142px; margin-left: calc(var(--bpx) * -13); display: block; line-height: 0; transform-origin: 50% 100%; }
.bd-wheel { position: absolute; left: 0; bottom: 0; width: 150px; height: 150px; overflow: visible; transform-origin: 50% 50%; }
.bd-wheel circle, .bd-wheel path { stroke: var(--accent-text, #00594a); }
.bd-wheel circle:last-of-type { fill: var(--accent-text, #00594a); }
.bd-spin { transform-origin: 75px 75px; animation: bdSpin 1.6s linear infinite; }
@keyframes bdSpin { to { transform: rotate(-360deg); } }
.bd-load.fall .bd-spin { animation-duration: 4s; }
.bd-load.fall .bd-wheel { animation: bdTip 0.9s ease-in forwards; }
.bd-load.fall .bd-lb { animation: bdFall 0.8s cubic-bezier(0.4, 0, 0.8, 0.6) forwards; }
@keyframes bdFall { 0% { transform: none; } 25% { transform: translate(12px, -22px) rotate(8deg); } 100% { transform: translate(110px, 230px) rotate(95deg); } }
@keyframes bdTip { 0% { transform: none; } 100% { transform: translateX(-16px) rotate(-12deg); } }

/* ── Bobby Run (/run) ── */
.rn-body { background: var(--bg); color: var(--text); }
.rn { max-width: 900px; margin: 0 auto; padding: 24px; }
.rn-top { display: flex; align-items: center; justify-content: space-between; }
.rn-score { font: 600 15px var(--f); letter-spacing: 0.06em; font-variant-numeric: tabular-nums; color: var(--muted); }
.rn-score b { color: var(--text); }
.rn-stage { --bpx: 3px; --buddy-ink: var(--deep); --buddy-tab: var(--tabA); --buddy-body: var(--tabB); --buddy-text: var(--text);
  position: relative; height: 280px; margin-top: 56px; overflow: hidden; border-radius: 18px; border: 1px solid var(--line); background: var(--bg2); touch-action: manipulation; outline: none; cursor: pointer; }
[data-theme="night"] .rn-stage { --buddy-ink: #06201b; }
.rn-ground { position: absolute; left: 0; right: 0; bottom: 0; height: 44px; border-top: 3px solid var(--text);
  background: repeating-linear-gradient(90deg, var(--text) 0 14px, transparent 14px 90px) 0 18px / 100% 4px no-repeat; }
.rn-bob { position: absolute; left: 60px; bottom: 41px; line-height: 0; }
.rn-bug { position: absolute; left: 0; bottom: 41px; display: flex; gap: 6px; line-height: 0; will-change: transform; }
.rn-bug svg { width: 44px; height: 28px; margin-bottom: -4px; }
.bg-b { fill: #e5484d; } .bg-l, .bg-e { fill: var(--text); } .bg-s { fill: #8f1d22; }
.bg-fa { animation: bdFA 0.3s steps(1) infinite; } .bg-fb { animation: bdFB 0.3s steps(1) infinite; }
.rn-msg { position: absolute; left: 0; right: 0; top: 40%; transform: translateY(-50%); text-align: center; margin: 0; font-size: 18px; line-height: 1.7; }
.rn-msg[hidden] { display: none; }
.rn kbd { padding: 2px 8px; border-radius: 6px; border: 1px solid var(--line); font: 600 14px var(--f); }
.rn-hint { margin-top: 18px; color: var(--faint); text-align: center; }

.f404game { margin-top: 28px; color: var(--muted); }
.f404game a { color: var(--accent-text); font-weight: 600; text-decoration: underline; }
