/* The bomber (public/bomb.js): walks over everything, lets every tap through. */
.bomb-layer { position: fixed; inset: 0; z-index: 6000; pointer-events: none; overflow: hidden; contain: strict; }
.bomber { position: absolute; left: 0; top: 0; transform-origin: 50% 100%; will-change: transform; }
.bomber svg, .bomb-ball svg { display: block; width: 100%; height: 100%; overflow: visible; }

/* palette: painted, not outlined: sun-dried skin with shading, a wound white turban, a long dark beard gone grey at the
   chin, a faded woodland camo field jacket over a white thobe; a black bomb with a brass cap */
.bomber path, .bomber circle, .bomber rect, .bomber ellipse, .bomb-ball path, .bomb-ball circle, .bomb-ball rect { stroke: #2a1c12; stroke-width: .9; stroke-linejoin: round; stroke-linecap: round; }
.bomber .b-shadow { fill: #000; opacity: .28; stroke: none; }
.bomber .b-skin { fill: url(#bmbSkin); stroke: #6e4429; stroke-width: .7; }
.bomber .b-knuckle, .bomber .b-line { fill: none; stroke: #7a4a2c; stroke-width: .6; opacity: .8; }
.bomber .b-hollow { fill: #5e331c; opacity: .28; stroke: none; }
.bomber .b-socket { fill: #5b3420; opacity: .4; stroke: none; }
.bomber .b-flush { fill: #e0432b; opacity: 0; stroke: none; transition: opacity .6s; }
.bomber .b-turban { fill: url(#bmbTurban); stroke: #9d9278; stroke-width: .8; }
.bomber .b-tfold { fill: none; stroke: #b5aa8f; stroke-width: .8; }
.bomber .b-tshadow { fill: #4a2c18; opacity: .35; stroke: none; }
.bomber .b-beard { fill: url(#bmbBeard); stroke: #1d1713; stroke-width: .6; }
.bomber .b-hair { fill: none; stroke: #8d857a; stroke-width: .6; opacity: .8; }
.bomber .b-hair2 { fill: none; stroke: #16110e; stroke-width: .6; }
.bomber .b-grey { fill: none; stroke: #cfc9bd; stroke-width: 1.2; opacity: .55; }
.bomber .b-stache { fill: #2a221d; stroke: none; }
.bomber .b-jacket { fill: url(#bmbJacket); stroke: #33311f; }
.bomber .b-sleeve { fill: url(#bmbSleeve); stroke: #33311f; }
.bomber .b-c1 { fill: #444327; opacity: .85; stroke: none; }
.bomber .b-c2 { fill: #a3996a; opacity: .7; stroke: none; }
.bomber .b-c3 { fill: #3a2d1d; opacity: .85; stroke: none; }
.bomber .b-dark { fill: #000; opacity: .2; stroke: none; }
.bomber .b-pocket { fill: none; stroke: #33311f; stroke-width: .7; }
.bomber .b-flap { fill: #56543a; opacity: .8; stroke: #33311f; stroke-width: .6; }
.bomber .b-seam { fill: none; stroke: #33311f; stroke-width: .8; }
.bomber .b-wrinkle { fill: none; stroke: #2f2d1c; stroke-width: .7; opacity: .7; }
.bomber .b-button { fill: none; stroke: #1f1c12; stroke-width: 2.4; }
.bomber .b-collar { fill: #5f5d3f; stroke: #33311f; stroke-width: .7; }
.bomber .b-robe { fill: url(#bmbRobe); stroke: #8f8570; }
.bomber .b-fold { fill: none; stroke: #b3a98f; stroke-width: .8; }
.bomber .b-pant { fill: url(#bmbPant); stroke: #8f8570; }
.bomber .b-sole { fill: #4f3219; }
.bomber .b-strap { fill: none; stroke: #5c3a1d; stroke-width: 1.6; }
.bomber .b-nose { fill: #c08961; stroke: #6e4429; stroke-width: .7; }
.bomber .b-eye { fill: #f3eee6; stroke: #3b2416; stroke-width: .6; transition: fill .4s; }
.bomber .b-pupil { fill: #2a180d; stroke: none; transform-box: fill-box; transform-origin: 50% 50%; transition: transform .3s; }
.bomber .b-glint { fill: #fff; stroke: none; }
/* boiling over: red in the face, bloodshot, pinprick pupils, steam out of his ears */
.bomber:is(.rage, .windup, .throw) .b-flush { opacity: .5; }
.bomber:is(.rage, .windup, .throw) .b-nose { fill: #cf5f45; }
.bomber:is(.rage, .windup, .throw) .b-eye { fill: #f7cbbf; stroke: #8e150c; }
.bomber:is(.rage, .windup, .throw) .b-pupil { transform: scale(.6); }
.bomber .b-steam circle { fill: #fff; stroke: #b9bcc8; stroke-width: .8; opacity: 0; transform-box: fill-box; transform-origin: 50% 50%; }
.bomber:is(.rage, .windup) .b-steam .s1 { animation: b-steam-l .6s ease-out infinite; }
.bomber:is(.rage, .windup) .b-steam .s3 { animation: b-steam-l .6s .3s ease-out infinite; }
.bomber:is(.rage, .windup) .b-steam .s2 { animation: b-steam-r .6s .15s ease-out infinite; }
.bomber:is(.rage, .windup) .b-steam .s4 { animation: b-steam-r .6s .45s ease-out infinite; }
@keyframes b-steam-l { 0% { opacity: .95; transform: translate(0, 0) scale(.5); } 100% { opacity: 0; transform: translate(-14px, -24px) scale(2.3); } }
@keyframes b-steam-r { 0% { opacity: .95; transform: translate(0, 0) scale(.5); } 100% { opacity: 0; transform: translate(14px, -24px) scale(2.3); } }
.bomber .b-brow { fill: #1a130e; stroke: none; }
.bomber .b-crease { fill: none; stroke: #6e4429; stroke-width: .8; }
.bomber .b-mouth { fill: #3a0d0b; stroke-width: .7; }
.bomber .b-teeth { fill: #efe7d6; stroke: none; }
.bomber .b-vein { fill: none; stroke: #b3281a; stroke-width: 1.3; opacity: 0; }
.b-ball { fill: #1f2026; }
.bomber .b-ball, .bomb-ball .b-ball { fill: url(#bmbBall); }
.bomb-ball .b-ball { fill: url(#bmbBall2); }
.b-shine { fill: none; stroke: #9aa0ad !important; stroke-width: 2.2 !important; opacity: .7; }
.b-cap { fill: #b89a4e; stroke-width: 1 !important; }
.b-fuse { fill: none; stroke: #8a6a3c !important; stroke-width: 2.2 !important; }
.b-spark path { fill: #ffd23a; stroke: #f0621c !important; stroke-width: .9 !important; }
.b-spark { transform-box: fill-box; transform-origin: 50% 50%; animation: b-spark .09s steps(2) infinite alternate; }
@keyframes b-spark { from { transform: scale(.7) rotate(0); } to { transform: scale(1.15) rotate(24deg); } }

/* joints, in the drawing's own units */
.bomber .b-all, .bomber .b-bob, .bomber .b-arm, .bomber .b-leg, .bomber .b-head, .bomber .b-jaw { transform-box: view-box; }
.bomber .b-all, .bomber .b-bob { transform-origin: 60px 292px; }
.bomber .b-arm-b { transform-origin: 42px 83px; }
.bomber .b-arm-f { transform-origin: 79px 83px; transition: transform .28s cubic-bezier(.3, 0, .3, 1); }
.bomber .b-leg-b { transform-origin: 55px 150px; }
.bomber .b-leg-f { transform-origin: 66px 150px; }
.bomber .b-head { transform-origin: 60px 78px; }
.bomber .b-jaw { transform-origin: 63.5px 58px; }

/* walking in: a stiff, furious stomp */
.bomber.walk .b-all { transform: rotate(3deg); }
.bomber.walk .b-leg-f { animation: b-stride .34s ease-in-out infinite alternate; }
.bomber.walk .b-leg-b { animation: b-stride .34s ease-in-out infinite alternate-reverse; }
.bomber.walk .b-arm-b { animation: b-swing .34s ease-in-out infinite alternate; }
.bomber.walk .b-bob { animation: b-bob .17s ease-out infinite alternate; }
.bomber.walk .b-arm-f { transform: rotate(-14deg); }
@keyframes b-stride { from { transform: rotate(-17deg); } to { transform: rotate(15deg); } }
@keyframes b-swing { from { transform: rotate(-22deg); } to { transform: rotate(26deg); } }
@keyframes b-bob { from { transform: translateY(0); } to { transform: translateY(-5px); } }

/* raging: fist up and shaking, bomb held out, shouting, a throbbing vein, the whole man trembling */
.bomber.rage .b-all { animation: b-tremble .04s linear infinite alternate; }
.bomber.rage .b-arm-b { animation: b-fist .12s ease-in-out infinite alternate; }
.bomber.rage .b-arm-f { transform: rotate(-58deg); }
.bomber.rage .b-jaw { animation: b-shout .2s ease-in-out infinite alternate; }
.bomber.rage .b-head { animation: b-nod .4s ease-in-out infinite alternate; }
.bomber.rage .b-vein { animation: b-vein .3s ease-in-out infinite alternate; }
@keyframes b-tremble { from { transform: translate(-2.4px, .8px) rotate(-.6deg); } to { transform: translate(2.4px, -.8px) rotate(.6deg); } }
@keyframes b-fist { from { transform: rotate(140deg); } to { transform: rotate(180deg); } }
@keyframes b-shout { from { transform: scaleY(1.1); } to { transform: scaleY(1.85); } }
/* stomping his foot, twice */
.bomber.stomp .b-bob { animation: b-stomp .32s cubic-bezier(.4, 0, .9, .5) 2; }
.bomber.stomp .b-leg-f { animation: b-lift .32s cubic-bezier(.4, 0, .9, .5) 2; }
@keyframes b-stomp { 0% { transform: translateY(0); } 45% { transform: translateY(-17px); } 100% { transform: translateY(0); } }
@keyframes b-lift { 0% { transform: rotate(0); } 45% { transform: rotate(-42deg); } 100% { transform: rotate(0); } }
@keyframes b-nod { from { transform: rotate(-3deg); } to { transform: rotate(4deg); } }
@keyframes b-vein { from { opacity: .5; transform: scale(.9); } to { opacity: 1; transform: scale(1.1); } }
.bomber .b-vein { transform-box: fill-box; transform-origin: 50% 50%; }

/* winding up behind his head, then the throw */
.bomber.windup .b-all { transform: rotate(-7deg); transition: transform .3s; }
.bomber.windup .b-arm-f { transform: rotate(128deg); }
.bomber.windup .b-arm-b { transform: rotate(-40deg); }
.bomber.windup .b-jaw { transform: scaleY(1.4); }
.bomber.windup .b-vein { opacity: 1; }
.bomber.throw .b-all { transform: rotate(9deg); transition: transform .12s; }
.bomber.throw .b-arm-f { transform: rotate(-112deg); transition-duration: .13s; }
.bomber.throw .b-arm-b { transform: rotate(30deg); }
.bomber.throw .b-jaw { transform: scaleY(1.5); }
.bomber.throw .b-vein { opacity: 1; }

/* running off */
.bomber.run .b-all { transform: rotate(11deg); }
.bomber.run .b-leg-f { animation: b-stride .19s ease-in-out infinite alternate; }
.bomber.run .b-leg-b { animation: b-stride .19s ease-in-out infinite alternate-reverse; }
.bomber.run .b-arm-b { animation: b-swing .19s ease-in-out infinite alternate-reverse; }
.bomber.run .b-arm-f { animation: b-swing .19s ease-in-out infinite alternate; transition: none; }
.bomber.run .b-bob { animation: b-bob .1s ease-out infinite alternate; }
.bomber.run .b-held { visibility: hidden; }

.bomber.still .b-all, .bomber.still .b-arm-b, .bomber.still .b-jaw, .bomber.still .b-head, .bomber.still .b-vein { animation: none; }
.bomber.still .b-arm-b { transform: rotate(160deg); }
.bomber.still .b-vein { opacity: 1; }

/* "Language!", louder each time */
.bomb-say { position: absolute; left: 0; top: 0; padding: 7px 14px 8px; background: #fff; color: #1d2140; border: 3px solid #1d2140; border-radius: 16px 16px 16px 5px;
  font: 700 22px/1.1 "Atkinson Hyperlegible", system-ui, sans-serif; white-space: nowrap; opacity: 0; transform: scale(.3) rotate(-10deg); transform-origin: 10% 100%;
  transition: opacity .12s, transform .12s ease-in; }
.bomb-say.left { border-radius: 16px 16px 5px 16px; transform-origin: 90% 100%; }
.bomb-say.in { opacity: 1; transform: rotate(-4deg); transition: opacity .1s, transform .26s cubic-bezier(.2, 1.6, .4, 1); animation: b-say .12s .3s linear infinite alternate; }
@keyframes b-say { from { translate: -1px 0; } to { translate: 1px -1px; } }
.bomb-say.l1 { font-size: 26px; color: #a3160d; }
.bomb-say.l2 { font-size: 29px; color: #c0170c; border-color: #7a0f08; border-width: 4px; letter-spacing: .01em; }
.bomb-say.l3 { font-size: 34px; color: #fff; background: #c0170c; border-color: #3b0703; border-width: 4px; }
.bomb-say.l2.in, .bomb-say.l3.in { animation: b-say-hard .06s .25s linear infinite alternate; }
@keyframes b-say-hard { from { translate: -3px 1px; } to { translate: 3px -2px; } }

/* the bomb in flight */
.bomb-ball { position: absolute; left: 0; top: 0; will-change: transform; }
.bomb-ball.landed svg { animation: b-wobble .09s ease-in-out infinite alternate, b-swell .9s ease-in forwards; transform-origin: 45% 90%; }
.bomb-ball.landed .b-ball { animation: b-hot .9s ease-in forwards; }
@keyframes b-wobble { from { rotate: -10deg; } to { rotate: 10deg; } }
@keyframes b-swell { from { scale: 1; } to { scale: 1.22; } }
@keyframes b-hot { 0%, 30% { fill: #1c1d23; } 100% { fill: #8a1c10; } }

/* the blast */
.bomb-flash { position: absolute; inset: 0; background: #fff; opacity: 0; animation: b-flash .75s ease-out; }
@keyframes b-flash { 0% { opacity: 1; background: #fff; } 18% { opacity: .85; background: #ffb13d; } 100% { opacity: 0; background: #e23a1a; } }
.bomb-boom { position: absolute; translate: -50% -50%; display: grid; place-items: center; }
.bomb-boom svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; animation: b-burst 1.7s cubic-bezier(.1, .9, .3, 1) forwards; }
.bomb-boom .bx-1 { fill: #e23a1a; stroke: #3b1206; stroke-width: 3; stroke-linejoin: round; }
.bomb-boom .bx-2 { fill: #ff9a1f; }
.bomb-boom .bx-3 { fill: #ffe45c; }
.bomb-boom b { position: relative; font: 600 min(24vw, 130px)/1 "Barlow Condensed", sans-serif; letter-spacing: .02em; color: #fff; -webkit-text-stroke: 3px #3b1206; paint-order: stroke fill;
  transform: rotate(-8deg); animation: b-word 1.7s forwards; }
.bomb-boom i { position: absolute; left: 50%; top: 50%; width: 30%; aspect-ratio: 1; margin: -15% 0 0 -15%; border-radius: 50%; background: #56545c; box-shadow: inset -8px -8px 0 #3d3b42;
  opacity: 0; animation: b-puff 2s var(--d) ease-out forwards; }
@keyframes b-burst { 0% { transform: scale(.08) rotate(-20deg); opacity: 1; } 18% { transform: scale(1.08) rotate(4deg); } 30% { transform: scale(.96) rotate(0); } 70% { opacity: 1; } 100% { transform: scale(1.12) rotate(6deg); opacity: 0; } }
@keyframes b-word { 0% { transform: scale(.2) rotate(-20deg); opacity: 0; } 14% { transform: scale(1.18) rotate(-6deg); opacity: 1; } 24% { transform: scale(1) rotate(-8deg); } 75% { opacity: 1; } 100% { transform: scale(1.05) rotate(-8deg) translateY(-12px); opacity: 0; } }
@keyframes b-puff { 0% { transform: translate(0, 0) scale(.2); opacity: 0; } 12% { opacity: .95; } 100% { transform: translate(var(--x), calc(var(--y) - 40px)) scale(calc(var(--s) * 1.6)); opacity: 0; } }
/* the shock ring and rubble */
.bomb-boom .bomb-ring { position: absolute; left: 50%; top: 50%; width: 40%; aspect-ratio: 1; margin: -20% 0 0 -20%; border-radius: 50%;
  border: 14px solid #fff6d8; box-shadow: 0 0 30px 10px #ffb13d99; opacity: 0; animation: b-ring .7s cubic-bezier(.1, .7, .3, 1) forwards; }
@keyframes b-ring { 0% { transform: scale(.1); opacity: 1; } 100% { transform: scale(3.2); opacity: 0; border-width: 2px; } }
.bomb-boom s { position: absolute; left: 50%; top: 50%; width: 22px; height: 15px; margin: -7px 0 0 -11px; background: #2b2320; border: 2px solid #0e0a08;
  border-radius: 3px 8px 2px 6px; animation: b-rubble 1.3s cubic-bezier(.15, .7, .4, 1) forwards; }
@keyframes b-rubble { 0% { transform: translate(0, 0) scale(var(--k)) rotate(0); opacity: 1; } 80% { opacity: 1; } 100% { transform: translate(var(--x), calc(var(--y) + 60px)) scale(var(--k)) rotate(var(--r)); opacity: 0; } }

/* cracked glass where it went off */
.bomb-crack { position: absolute; inset: 0; width: 100%; height: 100%; animation: b-crack 3.1s ease-in forwards; }
.bomb-crack path { fill: none; stroke-linejoin: round; stroke-linecap: round; }
.bomb-crack .k1 { stroke: #0009; stroke-width: 4; }
.bomb-crack .k2 { stroke: #ffffffe6; stroke-width: 1.4; }
.bomb-crack circle { fill: #ffffff2e; stroke: #fffc; stroke-width: 1.4; }
@keyframes b-crack { 0% { opacity: 0; } 3% { opacity: 1; } 65% { opacity: 1; } 100% { opacity: 0; } }

.bomb-boom.still svg, .bomb-boom.still b { animation: b-fade 2.2s forwards; transform: none; }
.bomb-boom.still b { transform: rotate(-8deg); }
.bomb-boom.still i { display: none; }
@keyframes b-fade { 0%, 75% { opacity: 1; } 100% { opacity: 0; } }

/* the swearer's bubble, left sooty */
.msg.bombed .bubble, .msg.bombed .vd-bub, .msg.bombed .ph-stack { animation: b-soot 5s ease-in; }
@keyframes b-soot { 0%, 30% { background-color: #2e2621; color: #c9b69c; box-shadow: 0 0 0 3px #1b1512; } }

/* who swore: a letterboard slip, like the troll's */
.bomb-slip { position: fixed; z-index: 6001; left: 50%; top: calc(10px + env(safe-area-inset-top)); width: min(calc(100% - 24px), 380px);
  display: flex; flex-direction: column; gap: 6px; padding: 13px 16px 12px; border-radius: 12px; pointer-events: none;
  box-shadow: 0 0 0 1px #f5f5f21f, 0 3px 0 #0000004d, inset 4px 0 0 #e23a1a;
  transform: translate(-50%, calc(-100% - 20px - env(safe-area-inset-top))); visibility: hidden;
  transition: transform .22s ease-in, visibility 0s .22s; }
.bomb-slip.in { transform: translate(-50%, 0); visibility: visible; transition: transform .32s cubic-bezier(.2, .9, .3, 1.2); }
.bomb-slip .row1 { font-size: 25px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bomb-slip .row2 { text-transform: none; letter-spacing: .04em; font-size: 16px; }

@media (prefers-reduced-motion: reduce) {
  .bomb-slip, .bomb-slip.in, .bomb-say, .bomb-say.in { transition: none; animation: none; }
}
