/* The troll (public/troll.js): runs over everything, so the layer sits above every overlay but lets taps through. */
.troll-layer { position: fixed; inset: 0; z-index: 6000; pointer-events: none; overflow: hidden; contain: strict; }
.troll { position: absolute; left: 0; top: 0; pointer-events: auto; cursor: pointer; transform-origin: 50% 100%; will-change: transform; -webkit-tap-highlight-color: transparent; touch-action: none; }
.troll:focus-visible { outline: none; }
.troll svg { display: block; width: 100%; height: 100%; overflow: visible; }

/* palette: moss hide, bog shadow, old-bone horns, ember eyes */
.troll svg path, .troll svg circle { stroke: #151906; stroke-width: 2.3; stroke-linejoin: round; stroke-linecap: round; }
.troll .t-shadow { fill: url(#trGround); stroke: none !important; }
.troll .t-skin { fill: #6b7a2c; }
.troll .t-skin-d { fill: #46511a; }
.troll .t-belly { fill: #879545; stroke: none !important; }
.troll .t-wart { fill: #4f5a1c; stroke-width: 1.2; }
.troll .t-hair { fill: none; stroke: #1c1f0b; stroke-width: 3; }
.troll .t-cloth { fill: #4b3221; }
.troll .t-claw { fill: url(#trClaw); stroke-width: 1.4; }
.troll .t-horn { fill: #dbd0ab; }
.troll .t-horn-far { fill: #a89b76; }
.troll .t-ridge { fill: none; stroke: #7d7152 !important; stroke-width: 1.8; }
.troll .t-brow { fill: #333b12; }
.troll .t-glow { fill: url(#trGlow); opacity: .7; stroke: none !important; }
.troll .t-eye { fill: url(#trEye); stroke: #b3170c !important; stroke-width: 1.8; }
.troll .t-glint { fill: #fffdf0; stroke: none !important; opacity: .9; }
.troll .t-blotch { fill: #53611f; stroke: none !important; }
.troll .t-tip { fill: #3d3424; stroke-width: 1.4; }
.troll .t-snarl { fill: none; stroke: #2a300d !important; stroke-width: 1.6; }
.troll .t-pupil { fill: #140000; stroke: none !important; }
.troll .t-mouth { fill: url(#trMaw); }
.troll .t-teeth { fill: #e9dcae; stroke-width: 1.3; }
.troll .t-tusk { fill: #efe4bd; stroke-width: 1.6; }
.troll .t-spit { fill: url(#trSpit); opacity: .9; stroke-width: 1; }
.troll .t-wet { fill: none; stroke: #fff !important; stroke-width: 1; opacity: .85; }
.troll .t-scar { fill: none; stroke: #2a300d !important; stroke-width: 1.6; }

/* the painting pass (troll.js PAINT): cel shadow, rim light, hide speckle, ink on top */
.troll .t-paint path { stroke: none !important; }
.troll .t-tex { fill: url(#trHide); }
.troll pattern circle { stroke: none !important; }
.troll .t-ao { fill: url(#trAO); stroke: none !important; }
.troll .t-sh, .troll .t-core { fill: #1d2604; opacity: .3; }
.troll .t-rim { fill: #d4e284; opacity: .55; }
.troll [class*="t-horn"].t-sh, .troll [class*="t-horn"].t-core, .troll .t-tusk-sh, .troll .t-tusk-core,
.troll .t-teeth-sh, .troll .t-teeth-core, .troll .t-claw-sh, .troll .t-claw-core { fill: #5c4d2c; opacity: .35; }
.troll .t-horn-rim, .troll .t-tusk-rim, .troll .t-teeth-rim, .troll .t-claw-rim { fill: #fffbea; opacity: .8; }
.troll .t-tip-sh, .troll .t-tip-core { fill: #0d0a05; opacity: .35; }
.troll .t-tip-rim { fill: #8c7c5c; opacity: .7; }
.troll .t-cloth-sh, .troll .t-cloth-core { fill: #170d05; opacity: .35; }
.troll .t-cloth-rim { fill: #8a6544; opacity: .55; }
.troll .t-brow-sh, .troll .t-brow-core { fill: #0d1102; opacity: .3; }
.troll .t-paint .t-ink { fill: none; stroke: #151906 !important; stroke-width: 2.3; }
.troll .t-ink-claw, .troll .t-ink-teeth, .troll .t-ink-tip { stroke-width: 1.4 !important; }
.troll .t-ink-tusk { stroke-width: 1.6 !important; }

/* joints (fill-box so the pivots stay put however he's scaled) */
.troll .t-leg, .troll .t-arm, .troll .t-jaw, .troll .t-drool, .troll .t-head, .troll .t-bob, .troll .t-all { transform-box: fill-box; }
.troll .t-leg { transform-origin: 45% 4%; }
.troll .t-arm { transform-origin: 18% 4%; }
.troll .t-jaw { transform-origin: 4% 22%; }
.troll .t-drool { transform-origin: 50% 0; }
.troll .t-head { transform-origin: 20% 80%; }
.troll .t-all { transform-origin: 50% 100%; }

/* running: a heavy, loping gallop */
.troll.run .t-all, .troll.flee .t-all { transform: rotate(7deg); }
.troll.run .t-leg-f, .troll.flee .t-leg-f { animation: t-stride .3s ease-in-out infinite alternate; }
.troll.run .t-leg-b, .troll.flee .t-leg-b { animation: t-stride .3s ease-in-out infinite alternate-reverse; }
.troll.run .t-arm-f, .troll.flee .t-arm-f { animation: t-swing .3s ease-in-out infinite alternate-reverse; }
.troll.run .t-arm-b, .troll.flee .t-arm-b { animation: t-swing .3s ease-in-out infinite alternate; }
.troll.run .t-bob, .troll.flee .t-bob { animation: t-bob .15s ease-out infinite alternate; }
.troll.run .t-jaw { animation: t-chomp .26s ease-in-out infinite alternate; }
.troll.run .t-drool, .troll.flee .t-drool { animation: t-drip .3s ease-in-out infinite alternate; }
.troll.flee .t-leg-f, .troll.flee .t-leg-b, .troll.flee .t-arm-f, .troll.flee .t-arm-b { animation-duration: .2s; }
.troll.flee .t-jaw { transform: rotate(14deg); }
@keyframes t-stride { from { transform: rotate(-32deg); } to { transform: rotate(28deg); } }
@keyframes t-swing { from { transform: rotate(-30deg); } to { transform: rotate(34deg); } }
@keyframes t-bob { from { transform: translateY(0); } to { transform: translateY(-7px); } }
@keyframes t-chomp { from { transform: rotate(0); } to { transform: rotate(11deg); } }
@keyframes t-drip { from { transform: scaleY(1); } to { transform: scaleY(1.7); } }

/* snarling: jaw wide, head thrust at you, the whole body shaking with it, eyes flaring */
.troll.snarl .t-all { animation: t-shake .05s linear infinite alternate; }
.troll.snarl .t-head { animation: t-thrust 1.5s ease-out 1 both; }
.troll.snarl .t-jaw { animation: t-roar 1.5s ease-out 1 both; }
.troll.snarl .t-drool { animation: t-drip .12s linear infinite alternate; }
.troll.snarl .t-arm-f { transform: rotate(-38deg); }
.troll.snarl .t-arm-b { transform: rotate(-22deg); }
.troll.snarl .t-leg-f { transform: rotate(12deg); }
.troll.snarl .t-leg-b { transform: rotate(-14deg); }
.troll.snarl .t-glow { animation: t-flare .2s ease-in-out infinite alternate; }
@keyframes t-shake { from { transform: translate(-1.6px, .6px); } to { transform: translate(1.6px, -.6px); } }
@keyframes t-thrust { 0% { transform: rotate(0); } 15%, 80% { transform: rotate(-9deg) translate(4px, 2px); } 100% { transform: rotate(0); } }
@keyframes t-roar { 0% { transform: rotate(0); } 14% { transform: rotate(27deg); } 30% { transform: rotate(22deg); } 45% { transform: rotate(28deg); } 62% { transform: rotate(21deg); } 80% { transform: rotate(26deg); } 100% { transform: rotate(3deg); } }
@keyframes t-flare { from { opacity: .3; transform: scale(1); } to { opacity: .75; } }
.troll.still .t-all, .troll.still .t-head, .troll.still .t-glow, .troll.still .t-drool { animation: none; }
.troll.still .t-jaw { animation: none; transform: rotate(22deg); }

/* who left: a letterboard slip, like the one Louie Louie drops */
.troll-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 #6b7a2c;
  transform: translate(-50%, calc(-100% - 20px - env(safe-area-inset-top))); visibility: hidden;
  transition: transform .22s ease-in, visibility 0s .22s; }
.troll-slip.in { transform: translate(-50%, 0); visibility: visible; transition: transform .32s cubic-bezier(.2, .9, .3, 1.2); }
.troll-slip .row1 { font-size: 25px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.troll-slip .row2 { text-transform: none; letter-spacing: .04em; font-size: 16px; }

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