/* ─────────────────────────────────────────────────────────────────────────────
   TRICKS — the global secrets: magic words, modes, physics toys, the glitch hunt.
   Owned by the tricks agent (js/tricks/*, js/lib/*). Everything here is prefixed af-,
   except the shared mode classes on <html>: .pixel, .glitch-mode (and .calm from base.css).
   ───────────────────────────────────────────────────────────────────────────── */

/* ── the mode dock (pills under the header's right end) ─────────────────── */
.af-dock {
  position: fixed; z-index: 64; top: calc(var(--head-h) + 10px); right: max(12px, env(safe-area-inset-right));
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none;
}
.af-pill {
  pointer-events: auto; display: inline-flex; align-items: center; gap: .45em; min-height: 36px; padding: 4px 6px 4px 14px;
  border-radius: 99px; border: 2px solid var(--outline); background: rgba(13, 17, 32, .88); color: var(--cream);
  font: 600 .85rem/1 var(--font-display); box-shadow: 0 4px 0 rgba(0, 0, 0, .35);
  animation: af-pill-in .45s var(--spring) both;
}
.af-pill-dot { opacity: .6; }
.af-pill-btn {
  min-height: 28px; padding: 0 12px; border-radius: 99px; border: 2px solid var(--outline); background: var(--molten); color: var(--outline);
  font: 700 .8rem/1 var(--font-display); cursor: pointer; transition: transform .2s var(--spring);
}
.af-pill-btn:hover { transform: scale(1.08); }
button.af-pill { cursor: pointer; padding: 4px 12px 4px 6px; transition: transform .2s var(--spring), border-color .2s; }
button.af-pill:hover { transform: translateY(-2px); border-color: var(--green); }
.af-pill-ico { width: 26px; height: 26px; display: block; }
.af-pill-ico svg { width: 100%; height: 100%; }
.af-pill-state { min-width: 2.2em; padding: .3em .5em; border-radius: 99px; background: var(--soot-3); text-align: center; font-size: .75rem; }
.af-pill-glitch[aria-pressed="true"] .af-pill-state { background: var(--green); color: var(--outline); }
@keyframes af-pill-in { from { transform: translateY(-12px) scale(.8); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 760px) { .af-dock { top: calc(var(--head-h) + 8px); } .af-pill { font-size: .78rem; min-height: 34px; } }

/* ── 8-bit mode (the Konami code). Fonts swap in base.css. ─────────────── */
.af-crt {
  position: fixed; inset: 0; z-index: 95; pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 50%, transparent 58%, rgba(0, 0, 0, .34) 100%),
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, .13) 0 1px, transparent 1px 3px);
}
.af-crt.is-booting::after { /* one CRT power-on sweep, not a flicker */
  content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 100%; margin-top: -50vh;
  background: rgba(255, 255, 255, .35); transform-origin: 50% 50%;
  animation: af-crt-on .55s ease-out forwards;
}
@keyframes af-crt-on { 0% { transform: scaleY(.004); opacity: 1; } 60% { transform: scaleY(1); opacity: .35; } 100% { transform: scaleY(1); opacity: 0; } }
.af-pixel-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
html.pixel img { filter: url(#af-pixelate); }
html.pixel #main svg *, html.pixel .site-head svg *, html.pixel .jar svg * { shape-rendering: crispEdges; }
html.pixel .btn, html.pixel .panel, html.pixel .tool, html.pixel .toast, html.pixel .site-nav a, html.pixel .af-pill,
html.pixel .af-pill-btn, html.pixel input, html.pixel textarea, html.pixel .settings, html.pixel .cab-body,
html.pixel .cab-marquee, html.pixel .cab-screen, html.pixel .jar-count, html.pixel .draft-tag, html.pixel .af-tw-paper { border-radius: 0 !important; }
html.pixel .btn { box-shadow: 4px 4px 0 var(--outline); letter-spacing: 0; }
html.pixel .btn:hover { box-shadow: 6px 6px 0 var(--outline); }
html.pixel .btn:active { box-shadow: 1px 1px 0 var(--outline); }
html.pixel .panel, html.pixel .toast { box-shadow: 6px 6px 0 rgba(0, 0, 0, .45); }
html.pixel .toast-t, html.pixel .toast-q { line-height: 1.5; }
html.pixel .toast-q { font-size: .7rem; }
html.pixel .af-pill { font-size: .7rem; line-height: 1.2; }

/* ── gravity ───────────────────────────────────────────────────────────── */
.af-grav-src { visibility: hidden !important; }
html.af-gravity-on #main { animation: none !important; }
.af-grav { position: fixed; inset: 0; z-index: 45; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; overflow: hidden; }
.af-grav.is-grabbing { cursor: grabbing; }
.af-grav-piece { position: absolute; transform-origin: 50% 50%; will-change: transform; pointer-events: none; contain: layout style; }
.af-grav-piece > * { pointer-events: none !important; }
.af-grav-bar {
  position: fixed; z-index: 66; left: 50%; top: calc(var(--head-h) + 18px); transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none;
  animation: af-drop-in .6s var(--bounce) both .35s;
}
.af-grav-bar > * { pointer-events: auto; }
.af-grav-reset { white-space: nowrap; max-width: calc(100vw - 24px); }
html.pixel .af-grav-reset { font-size: .85rem; }
html.pixel .af-grav-hint { font-size: .6rem; }
.af-grav-reset-ico { width: 1.2em; height: 1.2em; display: inline-block; }
.af-grav-reset-ico svg { width: 100%; height: 100%; }
.af-grav-hint {
  margin: 0; padding: .35em .9em; border-radius: 99px; background: rgba(13, 17, 32, .8); color: var(--cream);
  font: 700 .85rem/1.2 var(--font-body); border: 2px solid var(--outline);
}
@keyframes af-drop-in { 0% { transform: translate(-50%, -30px) scale(.7); opacity: 0; } 100% { transform: translate(-50%, 0); opacity: 1; } }

/* ── party ─────────────────────────────────────────────────────────────── */
/* The ball hangs in a window that starts at the header's bottom edge, so it drops out from under it. */
.af-disco { position: fixed; z-index: 64; left: 50%; width: 180px; height: 250px; margin-left: -90px; overflow: hidden; pointer-events: none; }
.af-disco-inner { position: relative; width: 110px; margin: 0 auto; transform: translateY(-250px); transition: transform .9s var(--bounce); }
.af-disco.is-down .af-disco-inner { transform: translateY(0); }
.af-disco-chain {
  width: 8px; height: 96px; margin: 0 auto; border-radius: 4px;
  background: repeating-linear-gradient(to bottom, #8E969F 0 7px, #0D1120 7px 9px, #C9D2E8 9px 14px, #0D1120 14px 16px);
  border-left: 2px solid #0D1120; border-right: 2px solid #0D1120;
}
.af-disco-ball { width: 110px; height: 116px; margin-top: -8px; animation: af-sway 3.2s ease-in-out infinite; transform-origin: 50% -90px; }
.af-disco-ball svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .45)); }
.af-disco-spin { animation: af-facets 2.4s linear infinite; }
@keyframes af-facets { from { transform: translateX(0); } to { transform: translateX(20px); } }
@keyframes af-sway { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
.af-glint { position: absolute; width: 18px; height: 18px; background: #fff; opacity: 0;
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
  animation: af-glint 2.1s ease-in-out infinite; }
.af-glint-0 { left: 4px; top: 122px; }
.af-glint-1 { right: 2px; top: 150px; animation-delay: .7s; width: 14px; height: 14px; }
.af-glint-2 { left: 30px; top: 190px; animation-delay: 1.4s; width: 12px; height: 12px; }
@keyframes af-glint { 0%, 100% { opacity: 0; transform: scale(.3) rotate(0); } 50% { opacity: .95; transform: scale(1) rotate(45deg); } }

.af-party-lights {
  position: fixed; inset: 0; z-index: 63; pointer-events: none; overflow: hidden;
  background: rgba(10, 8, 30, .22); opacity: 0; transition: opacity .6s ease;
}
.af-party-lights.is-on { opacity: 1; }
.af-spot {
  position: absolute; width: 60vmax; height: 60vmax; left: -30vmax; top: -30vmax; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--c) 42%, transparent) 0%, color-mix(in srgb, var(--c) 18%, transparent) 38%, transparent 66%);
  will-change: transform;
}
.af-spot-0 { animation: af-sweep-a 7s ease-in-out infinite alternate; }
.af-spot-1 { animation: af-sweep-b 8.5s ease-in-out infinite alternate; }
.af-spot-2 { animation: af-sweep-c 6.5s ease-in-out infinite alternate; }
.af-spot-3 { animation: af-sweep-d 9s ease-in-out infinite alternate; }
.af-spot-4 { animation: af-sweep-b 7.5s ease-in-out -3s infinite alternate-reverse; }
.af-spot-5 { animation: af-sweep-a 8s ease-in-out -4s infinite alternate-reverse; }
@keyframes af-sweep-a { from { transform: translate(10vw, 20vh); } to { transform: translate(90vw, 70vh); } }
@keyframes af-sweep-b { from { transform: translate(85vw, 15vh); } to { transform: translate(15vw, 85vh); } }
@keyframes af-sweep-c { from { transform: translate(50vw, 95vh); } to { transform: translate(40vw, 10vh); } }
@keyframes af-sweep-d { from { transform: translate(-5vw, 60vh); } to { transform: translate(105vw, 35vh); } }

/* ── coffee ────────────────────────────────────────────────────────────── */
.af-mug { position: fixed; z-index: 66; width: 48px; height: 44px; pointer-events: none; animation: af-mug-in .5s var(--spring) both; transition: opacity .4s, transform .4s; }
.af-mug svg { width: 100%; height: 100%; }
.af-mug.is-out { opacity: 0; transform: translateY(8px) scale(.8); }
@keyframes af-mug-in { from { transform: translateY(14px) scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── the typewriter (magic words on phones) ────────────────────────────── */
/* THE TICKER: what you're typing (outside text boxes) on a strip of typewriter paper. tricks/words.js */
.af-tick {
  position: fixed; z-index: 149; left: 50%; top: calc(var(--head-h) + 12px); pointer-events: none;
  min-width: min(250px, calc(100vw - 32px)); max-width: calc(100vw - 32px);
  transform: translateX(-50%); animation: af-tick-in .35s var(--spring) both;
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .35));
}
.af-tick.is-out { animation: af-tick-out .28s ease-in both; }
@keyframes af-tick-in { from { transform: translate(-50%, -18px) scale(.9); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@keyframes af-tick-out { to { transform: translate(-50%, -14px) scale(.94); opacity: 0; } }
.af-tick-paper {
  position: relative; z-index: 1; margin: 0 18px -8px; padding: 9px 14px 15px; display: flex; align-items: baseline; gap: 10px;
  background: #FFFBF1; color: #1A150C; border: 3px solid var(--outline); border-bottom: 0; border-radius: 6px 6px 0 0;
  transition: background-color .15s;
}
.af-tick-k { font: 800 .68rem/1 var(--font-body); text-transform: uppercase; letter-spacing: .14em; color: #7A5C22; white-space: nowrap; }
.af-tick-t { display: inline-block; min-height: 1.2em; font: 700 1.3rem/1.2 'Courier New', ui-monospace, monospace; letter-spacing: .08em; white-space: pre; }
.af-tick-t::after { content: ''; display: inline-block; width: .55em; height: 3px; margin-left: 2px; background: var(--ember); vertical-align: -3px; animation: af-tick-caret 1s steps(1) infinite; }
@keyframes af-tick-caret { 50% { opacity: 0; } }
.af-tick-t.is-hit { animation: af-tick-hit .16s ease-out; }
@keyframes af-tick-hit { 40% { transform: translateY(-2px); } }
.af-tick-roller { position: relative; z-index: 2; height: 16px; margin: 0 6px; border-radius: 8px; border: 3px solid var(--outline);
  background: linear-gradient(to bottom, #4A4F63, #1E2233 60%, #2D3246); }
.af-tick-roller i { position: absolute; top: 50%; width: 12px; height: 20px; margin-top: -10px; border-radius: 5px; border: 3px solid var(--outline); background: linear-gradient(#E6C88B, #9A7433); }
.af-tick-roller i:first-child { left: -9px; } .af-tick-roller i:last-child { right: -9px; }
.af-tick.is-stamp .af-tick-paper { background: var(--molten); }
.af-tick.is-stamp .af-tick-k { color: var(--outline); }
.af-tick.is-stamp .af-tick-t { text-transform: uppercase; animation: af-tick-stamp .4s var(--spring); }
.af-tick.is-stamp .af-tick-t::after { display: none; }
@keyframes af-tick-stamp { from { transform: scale(1.45) rotate(-4deg); opacity: .3; } }
html.pixel .af-tick-paper { border-radius: 0 !important; }
@media (prefers-reduced-motion: reduce) {
  .af-tick, .af-tick.is-out, .af-tick-t.is-hit, .af-tick.is-stamp .af-tick-t { animation-duration: .01ms !important; }
  .af-tick-t::after { animation: none; }
}

.af-tw {
  position: fixed; z-index: 150; left: 50%; top: calc(var(--head-h) + 14px); width: min(380px, calc(100vw - 24px));
  transform: translateX(-50%); animation: af-tw-in .45s var(--spring) both;
}
.af-tw.is-out { animation: af-tw-out .25s ease-in both; }
@keyframes af-tw-in { from { transform: translate(-50%, -24px) scale(.85); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@keyframes af-tw-out { to { transform: translate(-50%, -16px) scale(.9); opacity: 0; } }
.af-tw-machine { position: relative; margin: 0; padding-top: 4px; filter: drop-shadow(0 12px 18px rgba(0, 0, 0, .45)); }
.af-tw-machine.is-miss { animation: af-tw-miss .4s ease-in-out; }
@keyframes af-tw-miss { 20% { transform: translateX(-8px) rotate(-1deg); } 50% { transform: translateX(7px) rotate(1deg); } 80% { transform: translateX(-3px); } }
.af-tw-paper {
  position: relative; z-index: 1; margin: 0 34px -14px; padding: 14px 16px 26px; background: #FFFBF1; color: #2A2418;
  border: 3px solid var(--outline); border-bottom: 0; border-radius: 6px 6px 0 0;
  background-image: repeating-linear-gradient(to bottom, transparent 0 25px, rgba(79, 140, 209, .22) 25px 27px);
}
.af-tw-label { display: block; font: 700 .95rem/1.2 'Courier New', ui-monospace, monospace; letter-spacing: .02em; margin-bottom: 6px; }
.af-tw-in {
  width: 100%; border: 0 !important; border-bottom: 2px dashed #2A2418 !important; border-radius: 0 !important; background: transparent !important;
  color: #1A150C !important; padding: 4px 2px !important; box-shadow: none !important;
  font: 700 1.35rem/1.2 'Courier New', ui-monospace, monospace !important; letter-spacing: .08em; text-transform: lowercase;
}
.af-tw-in:focus { border-bottom-color: var(--ember) !important; }
.af-tw-roller { position: relative; z-index: 2; height: 22px; margin: 0 10px; border-radius: 11px; border: 3px solid var(--outline);
  background: linear-gradient(to bottom, #4A4F63, #1E2233 60%, #2D3246); }
.af-tw-roller i { position: absolute; top: 50%; width: 18px; height: 26px; margin-top: -13px; border-radius: 6px; border: 3px solid var(--outline); background: linear-gradient(#E6C88B, #9A7433); }
.af-tw-roller i:first-child { left: -14px; } .af-tw-roller i:last-child { right: -14px; }
.af-tw-body {
  position: relative; margin-top: -4px; padding: 16px 14px 14px; display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center;
  background: linear-gradient(170deg, #E3C27A 0%, #C8A15A 38%, #8F6B2B 100%); border: 3px solid var(--outline);
  border-radius: 14px 14px 22px 22px; box-shadow: inset 0 3px 0 rgba(255, 243, 223, .5), inset 0 -6px 0 rgba(0, 0, 0, .18);
}
.af-tw-keys { display: grid; gap: 5px; justify-items: center; }
.af-tw-row { display: flex; gap: 4px; }
.af-tw-row:nth-child(2) { margin-left: 10px; } .af-tw-row:nth-child(3) { margin-left: 22px; }
.af-tw-key {
  width: 21px; height: 21px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 40% 35%, #3C4258, #151927); border: 2px solid #E6D2A2; color: #FFF3DF;
  font: 700 .6rem/1 'Courier New', ui-monospace, monospace; box-shadow: 0 2px 0 var(--outline); transition: transform .08s;
}
.af-tw-key.is-down { animation: af-key .18s ease-out; }
@keyframes af-key { 40% { transform: translateY(3px); box-shadow: 0 0 0 var(--outline); } }
.af-tw-go {
  width: 72px; height: 72px; border-radius: 50%; border: 3px solid var(--outline); cursor: pointer;
  background: radial-gradient(circle at 40% 35%, #FFF7E6, #FFE0A8 55%, #E7B45A); color: var(--outline);
  font: 700 1.1rem/1 var(--font-display); box-shadow: 0 5px 0 #6B4A0B, inset 0 0 0 5px #C8A15A;
  transition: transform .15s var(--spring), box-shadow .15s;
}
.af-tw-go:hover { transform: scale(1.05); }
.af-tw-go:active { transform: translateY(4px); box-shadow: 0 1px 0 #6B4A0B, inset 0 0 0 5px #C8A15A; }
.af-tw-x {
  position: absolute; z-index: 3; top: -8px; right: 14px; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  border: 3px solid var(--outline); background: var(--cream); color: var(--outline); cursor: pointer; transition: transform .2s var(--spring);
}
.af-tw-x svg { width: 18px; height: 18px; }
.af-tw-x:hover { transform: rotate(90deg); }
/* the game pad: arrows, B and A (the Konami code without a keyboard or any swiping) */
.af-tw-pad {
  grid-column: 1 / -1; display: flex; justify-content: center; align-items: center; gap: 6px; padding: 7px 12px;
  background: linear-gradient(#2A2F42, #171A26); border: 3px solid var(--outline); border-radius: 999px;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .08);
}
.af-tw-pb {
  width: 34px; height: 34px; padding: 0; display: grid; place-items: center; cursor: pointer; touch-action: manipulation;
  border: 2px solid var(--outline); border-radius: 9px; background: linear-gradient(#555B72, #2A2F42); color: #FFF3DF;
  font: 700 1rem/1 var(--font-display); box-shadow: 0 3px 0 var(--outline); transition: transform .06s;
}
.af-tw-pb:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--outline); }
.af-tw-pb.is-ab { border-radius: 50%; background: radial-gradient(circle at 40% 35%, #FF9A8A, #E0403A 60%, #A5241F); color: #fff; }
.af-tw-pb.is-b { margin-left: 8px; }
@media (max-width: 360px) {
  .af-tw-key { width: 18px; height: 18px; } .af-tw-go { width: 60px; height: 60px; }
  .af-tw-pad { gap: 4px; padding: 6px 8px; } .af-tw-pb { width: 30px; height: 30px; } .af-tw-pb.is-b { margin-left: 4px; }
}

/* ── the logo takes swipes on touch screens (Konami code) ──────────────── */
/* 'none' (not 'pinch-zoom'): every phone browser honors it, so a swipe that starts on the logo never scrolls the page */
@media (hover: none) and (pointer: coarse) { .brand { touch-action: none; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; } }
.brand.af-swipe .brand-mark { animation: af-nudge .3s var(--spring); }
@keyframes af-nudge { 50% { transform: scale(1.18) rotate(-10deg); } }

/* ── pinball ───────────────────────────────────────────────────────────── */
[data-trick="pinball"] { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
/* A default squash for the plunger; the floor's own art can override it using --pull (0..1). */
:where([data-trick="pinball"].is-pulling) { transform: translateY(calc(var(--pull, 0) * 12px)) scaleY(calc(1 - var(--pull, 0) * .25)); transform-origin: 50% 100%; transition: none; }
:where([data-trick="pinball"].is-fired) { animation: af-plunge .35s var(--spring); }
@keyframes af-plunge { 0% { transform: translateY(-10px) scaleY(1.12); } 100% { transform: none; } }
.af-pin-meter {
  position: fixed; z-index: 88; width: 16px; height: 100px; border-radius: 8px; border: 3px solid var(--outline);
  background: var(--soot); overflow: hidden; pointer-events: none; box-shadow: 0 3px 0 rgba(0, 0, 0, .35);
}
.af-pin-meter i { position: absolute; inset: 0; transform-origin: 50% 100%; transform: scaleY(0);
  background: linear-gradient(to top, var(--steam), var(--molten) 60%, var(--ember)); }
.af-pin-meter.is-full { box-shadow: 0 0 0 3px var(--molten), 0 3px 0 rgba(0, 0, 0, .35); }
.af-ball {
  position: fixed; z-index: 88; left: 0; top: 0; width: 22px; height: 22px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 34% 30%, #FFFFFF 0 12%, #D9DEE9 26%, #8A93A8 58%, #3C4358 88%);
  border: 2px solid var(--outline); box-shadow: 0 4px 6px rgba(0, 0, 0, .35); will-change: transform;
}
.af-ball.is-out { transition: opacity .35s; opacity: 0; }
.af-bumped { animation: af-bumped .45s var(--spring); }
@keyframes af-bumped { 0% { transform: scale(1); } 25% { transform: scale(1.06, .94) rotate(-1.5deg); } 55% { transform: scale(.97, 1.03) rotate(1deg); } 100% { transform: none; } }
.af-pin-pts {
  position: fixed; z-index: 89; pointer-events: none; transform: translate(-50%, -50%);
  font: 700 1.05rem/1 var(--font-display); color: var(--molten); text-shadow: 0 2px 0 var(--outline), 0 0 8px rgba(255, 107, 26, .6);
  animation: af-pts .9s ease-out forwards;
}
@keyframes af-pts { 0% { transform: translate(-50%, -30%) scale(.6); opacity: 0; } 20% { transform: translate(-50%, -60%) scale(1.15); opacity: 1; } 100% { transform: translate(-50%, -200%) scale(1); opacity: 0; } }
.af-pin-score {
  position: fixed; z-index: 88; left: 50%; top: calc(var(--head-h) + 12px); transform: translateX(-50%);
  display: flex; align-items: baseline; gap: .6em; padding: .5em 1.1em; border-radius: 99px;
  background: #10091F; border: 3px solid var(--outline); box-shadow: 0 0 0 2px var(--pink), 0 0 22px rgba(255, 90, 205, .45), 0 5px 0 rgba(0, 0, 0, .4);
  color: var(--cream); font: 600 1rem/1 var(--font-display); pointer-events: none; white-space: nowrap;
  animation: af-pill-in .4s var(--spring) both;
}
.af-pin-score b { color: var(--pink); text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; }
.af-pin-score span { font-variant-numeric: tabular-nums; color: var(--molten); font-size: 1.2rem; }
.af-pin-score small { font: 700 .72rem/1 var(--font-body); color: var(--fg-muted); color: #B7B9CC; max-width: 20em; overflow: hidden; transition: max-width .4s, opacity .3s; }
.af-pin-score.no-hint small { max-width: 0; opacity: 0; margin-left: -.6em; }
.af-pin-score.is-bump span { animation: af-score-bump .3s var(--spring); display: inline-block; }
.af-pin-score.is-over { box-shadow: 0 0 0 2px var(--steam), 0 5px 0 rgba(0, 0, 0, .4); }
.af-pin-score.is-over b { color: var(--steam); }
.af-pin-score.is-gone { opacity: 0; transition: opacity .35s; }
@keyframes af-score-bump { 50% { transform: scale(1.3); } }

/* ── speedrunner ───────────────────────────────────────────────────────── */
.af-stopwatch {
  position: fixed; z-index: 120; left: 50%; top: 28%; transform: translate(-50%, 0);
  display: flex; align-items: center; gap: 14px; padding: 14px 24px 14px 14px; border-radius: var(--r-lg);
  background: var(--soot); color: var(--cream); border: 3px solid var(--molten); box-shadow: 0 8px 0 #6B4A0B, 0 0 36px rgba(255, 194, 61, .4);
  animation: af-sw-in .6s var(--bounce) both; pointer-events: none;
}
.af-stopwatch.is-out { animation: af-sw-out .35s ease-in both; }
.af-sw-art { width: 70px; height: 80px; flex: none; }
.af-sw-art svg { width: 100%; height: 100%; }
.af-sw-hand { transform-origin: 40px 52px; animation: af-sw-spin 1.2s cubic-bezier(.2, .8, .3, 1) both; }
.af-sw-text { display: grid; gap: 4px; }
.af-sw-text b { font: 700 var(--step-2)/1 var(--font-display); color: var(--molten); }
.af-sw-text span { font: 700 var(--step-3)/1 var(--font-display); font-variant-numeric: tabular-nums; }
@keyframes af-sw-in { 0% { transform: translate(-50%, 40px) scale(.5); opacity: 0; } 100% { transform: translate(-50%, 0); opacity: 1; } }
@keyframes af-sw-out { to { transform: translate(-50%, -20px) scale(.9); opacity: 0; } }
@keyframes af-sw-spin { from { transform: rotate(-720deg); } to { transform: rotate(0); } }

/* ── the glitch critter ────────────────────────────────────────────────── */
.af-critter {
  position: fixed; z-index: 66; width: 72px; height: 72px; padding: 4px; border: 0; border-radius: 12px; background: transparent;
  cursor: crosshair; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.af-critter svg { position: absolute; inset: 4px; width: 64px; height: 64px; }
.af-critter-main { animation: af-jitter 1s steps(1) infinite; }
.af-critter-r { opacity: .7; mix-blend-mode: screen; animation: af-rgb-r 1.7s ease-in-out infinite alternate; }
.af-critter-b { opacity: .7; mix-blend-mode: screen; animation: af-rgb-b 1.9s ease-in-out infinite alternate; }
.af-critter:hover .af-critter-main, .af-critter:focus-visible .af-critter-main { animation-duration: .67s; }
@keyframes af-jitter { 0% { translate: 0 0; } 34% { translate: 2px -1px; } 67% { translate: -1px 2px; } }
@keyframes af-rgb-r { from { translate: -2px 0; } to { translate: -5px 1px; } }
@keyframes af-rgb-b { from { translate: 2px 0; } to { translate: 5px -1px; } }
.af-glitch-toast { border-color: var(--green) !important; }
.af-glitch-toast .toast-icon { width: 52px; height: 52px; animation: none; }
.af-glitch-toast .toast-icon svg { width: 100%; height: 100%; }
.af-glitch-toast .toast-k { color: var(--green); }

/* Glitch mode (the reward): a gentle, steady RGB split on headings. No flashing. */
html.glitch-mode #main :is(h1, h2, h3) {
  text-shadow: -2px 0 rgba(255, 90, 205, .55), 2px 0 rgba(79, 209, 197, .55);
  animation: af-glitch-drift 7s ease-in-out infinite alternate;
}
html.glitch-mode .wordmark { text-shadow: -1.5px 0 rgba(255, 90, 205, .6), 1.5px 0 rgba(79, 209, 197, .6); }
@keyframes af-glitch-drift {
  from { text-shadow: -2px 0 rgba(255, 90, 205, .55), 2px 0 rgba(79, 209, 197, .55); }
  to { text-shadow: -3px 1px rgba(255, 90, 205, .5), 3px -1px rgba(79, 209, 197, .5); }
}

/* ── calm mode: tricks still work, with fades instead of motion ────────── */
html.calm .af-critter-main, html.calm .af-critter-r, html.calm .af-critter-b, html.calm .af-disco-ball,
html.calm .af-disco-spin, html.calm .af-spot, html.calm .af-glint { animation: none !important; }
html.calm .af-glint { opacity: .8; }
html.calm .af-spot-0 { transform: translate(20vw, 30vh); } html.calm .af-spot-1 { transform: translate(80vw, 25vh); }
html.calm .af-spot-2 { transform: translate(50vw, 80vh); } html.calm .af-spot-3 { transform: translate(10vw, 75vh); }
html.calm .af-spot-4 { transform: translate(65vw, 55vh); } html.calm .af-spot-5 { transform: translate(35vw, 10vh); }
html.calm .af-disco-inner { transform: none; }
html.calm .af-bumped { animation: none; outline: 3px solid var(--molten); outline-offset: 2px; }
html.calm #main :is(h1, h2, h3) { animation: none; }

/* ── the coloring page: hidden on screen, the only thing that prints ───── */
.coloring-sheet { display: none; }
@media print {
  @page { margin: 12mm; }
  html.af-has-sheet:not(.af-print-real) body > :not(.coloring-sheet) { display: none !important; }
  html.af-has-sheet:not(.af-print-real) body { background: #fff !important; color: #000 !important; min-height: 0; }
  html.af-has-sheet:not(.af-print-real) .coloring-sheet { display: block !important; break-inside: avoid; page-break-inside: avoid; }
  .coloring-sheet svg { display: block; width: 100%; height: auto; max-height: 246mm; margin: 0 auto; }
  .coloring-note { margin: 2mm 0 0; text-align: center; font: 400 8pt/1.2 var(--font-body); color: #666; }
  html.af-print-real .coloring-sheet { display: none !important; }
}
