/* Typing Racer underglow (js/racer/underglow.js): neon lights under a car, lighting the road just past its body.
   The .ugGlow box is the CORE of the car's body (measured per model: no tyres, mirrors or spoilers), and the
   light reaches out from there; the tyres and mirrors are drawn over it. It follows the car picture's moves.
   --c / --c2 are "r,g,b" triplets; --ugEx/--ugEy how far the light reaches past the body, --ugRad the body's
   corner rounding, --ugB the rim's blur, --ugR height/width; --ugA, --ugHot, --ugHotIn, --ugPoolA/X/Y
   come from the shape tuned on /admin-glow (RacerGlow.DEFAULTS).
   Kept subtle on purpose (user, 2026-11-12): a bright edge just barely past the body, not a big haze.
   Only opacity and transform are animated, so a moving glow costs the browser almost nothing.
   --ugSpd is the "Effect speed" set on /admin-glow (1 as designed, 2 twice as fast): every moving extra's time is
   divided by it (the rings, the comet, the spinning discs, the streaks, Siren's swap, Rainbow's roll); the gentle
   breathing of the pool and the rim stays as it is.
   A new underglow is one more .ug-<slug> block here, plus its name in underglow.js and a trg_items row. */

.ugGlow{position:absolute; z-index:99; margin:0; pointer-events:none; --c:43,155,255; --c2:var(--c); --ugEx:3px; --ugEy:4px; --ugRad:20px; --ugB:4px; --ugR:.45;}
.gxCarBox .ugGlow{z-index:0;}
#lobbyRide .ugGlow{z-index:1;}
.ugIn{position:absolute; inset:0; margin:0; transition:transform .35s ease-out;}
/* each layer is its own picture for the graphics card: drawn (and blurred) once, then only faded and turned.
   No blend mode: measured with 8 cars at 4x CPU throttle, screen blending cost about a sixth of the frames. */
.ugGlow i{position:absolute; display:block; margin:0; pointer-events:none; will-change:transform, opacity;}
.ugFlare .ugIn{transform:scale(1.04, 1.14);}		/* nitro */

/* the pool on the road */
.ugPool{left:calc(-1 * var(--ugPoolX, 2%)); right:calc(-1 * var(--ugPoolX, 2%)); top:calc(-1 * var(--ugPoolY, 55%)); bottom:calc(-1 * var(--ugPoolY, 55%)); border-radius:50%;
	background:radial-gradient(closest-side, rgba(var(--c),.32), rgba(var(--c),.16) 60%, rgba(var(--c),0));
	animation:ugBreathe 2.6s ease-in-out infinite;}

/* the light: a strip along the body, taller than it and a little shorter, blurred wide, so light spills out of
   the sides and fades evenly, with just a little past the nose and tail (user: "glowing from the sides out and a
   little out the front and the back ... like how light spreads out in all directions") */
.ugRim{top:calc(-1 * var(--ugEy)); bottom:calc(-1 * var(--ugEy)); left:calc(-1 * var(--ugEx)); right:calc(-1 * var(--ugEx));
	filter:blur(var(--ugB)); animation:ugRimPulse 2.6s ease-in-out infinite;}
.ugRim::before, .ugRim::after{content:""; position:absolute; inset:0; border-radius:var(--ugRad);}
.ugRim::before{background:rgb(var(--c)); opacity:var(--ugA, .9);}
.ugRim::after{top:calc(var(--ugEy) + var(--ugHotIn, 0px)); bottom:calc(var(--ugEy) + var(--ugHotIn, 0px)); left:4%; right:4%; background:#fff; opacity:var(--ugHot, .4);}		/* brighter right by the body's sides */
.ugRim2{display:none;}
/* a shape drawn for this car on /admin-glow: cut every light layer to it (js/racer/underglow.js sets --ugClip) */
.ugShaped .ugRim::before, .ugShaped .ugRim::after{border-radius:0; clip-path:var(--ugClip);}
.ugFx{display:none;}

@keyframes ugBreathe{0%,100%{opacity:calc(var(--ugPoolA, 1) * .75); transform:scale(.98);} 50%{opacity:var(--ugPoolA, 1); transform:scale(1.02);}}
@keyframes ugRimPulse{0%,100%{opacity:.82;} 50%{opacity:1;}}
@keyframes ugSpin{to{transform:rotate(360deg);}}
@keyframes ugAltA{0%,40%{opacity:1;} 55%,90%{opacity:.08;} 100%{opacity:1;}}
@keyframes ugAltB{0%,40%{opacity:.08;} 55%,90%{opacity:1;} 100%{opacity:.08;}}
@keyframes ugRing{0%{opacity:0; transform:scale(.98, .98);} 12%{opacity:1;} 55%{opacity:.85;} 85%{opacity:.55;} 100%{opacity:0; transform:scale(1.12, 1.55);}}
@keyframes ugTwinkle{0%,100%{opacity:.15;} 50%{opacity:1;}}
@keyframes ugFlicker{0%{opacity:.75; transform:scaleX(.88);} 30%{opacity:1; transform:scaleX(1.04);} 55%{opacity:.82; transform:scaleX(.95);} 80%{opacity:1; transform:scaleX(1.08);} 100%{opacity:.75; transform:scaleX(.88);}}
@keyframes ugCycle{0%{opacity:1;} 33%{opacity:0;} 66%{opacity:0;} 100%{opacity:1;}}

/* a spinning disc under the car, squashed flat to the car's shape: .ugSpin wrapper, ::before turns */
.ug-chase .ugFx, .ug-rainbow .ugFx, .ug-legend .ugFx2{display:block; left:-8%; right:-8%; top:50%; height:0; transform:scaleY(calc(var(--ugR) * 1.5));}
.ug-chase .ugFx::before, .ug-rainbow .ugFx::before, .ug-legend .ugFx2::before{content:""; position:absolute; left:0; width:100%; padding-top:100%; top:0; margin-top:-50%; border-radius:50%;
	animation:ugSpin calc(1.5s / var(--ugSpd, 1)) linear infinite;}

/* streak of light on the road behind the car */
.ug-hyper .ugFx, .ug-legend .ugFx{display:block; right:97%; width:38%; top:36%; height:28%; border-radius:50% 0 0 50%; transform-origin:100% 50%;
	filter:blur(2px); animation:ugFlicker calc(.7s / var(--ugSpd, 1)) linear infinite;}

/* ---------- the colors ---------- */
.ug-neonblue{--c:43,155,255;}
.ug-hotpink{--c:255,52,160;}
.ug-toxic{--c:90,255,60;}
.ug-toxic .ugPool{animation-duration:1.9s;}
.ug-violet{--c:150,70,255;}
.ug-violet .ugRim::after{background:rgb(230,200,255);}
.ug-red{--c:255,36,48;}
.ug-red .ugRim::after{background:rgb(255,205,205);}
.ug-orange{--c:255,122,18;}
.ug-orange .ugRim::after{background:rgb(255,226,190);}
.ug-yellow{--c:255,224,36;}
.ug-yellow .ugRim::after{background:rgb(255,250,215);}
.ug-teal{--c:0,196,196;}
.ug-teal .ugRim::after{background:rgb(200,255,250);}
.ug-white{--c:236,243,255;}
.ug-white .ugPool{opacity:.8;}
.ug-royalblue{--c:40,78,255;}
.ug-royalblue .ugRim::after{background:rgb(200,212,255);}
.ug-lime{--c:175,255,0;}
.ug-lime .ugRim::after{background:rgb(238,255,200);}

/* Ice Crystal: cold blue with sparkles winking around the car */
.ug-ice{--c:110,225,255;}
.ug-ice .ugPool{animation-duration:3.4s;}
.ug-ice .ugFx{display:block; left:-5%; right:-5%; top:-20%; bottom:-20%;
	background:
		radial-gradient(circle at 8% 30%, #fff 0 1.5px, rgba(180,240,255,.7) 2.5px, transparent 5px),
		radial-gradient(circle at 34% 6%, #fff 0 1px, rgba(180,240,255,.7) 2px, transparent 4px),
		radial-gradient(circle at 70% 94%, #fff 0 1.5px, rgba(180,240,255,.7) 2.5px, transparent 5px),
		radial-gradient(circle at 96% 62%, #fff 0 1px, rgba(180,240,255,.7) 2px, transparent 4px),
		radial-gradient(circle at 52% 98%, #fff 0 1px, rgba(180,240,255,.6) 2px, transparent 4px);
	animation:ugTwinkle calc(1.7s / var(--ugSpd, 1)) ease-in-out infinite;}
.ug-ice .ugFx2{background:
		radial-gradient(circle at 22% 96%, #fff 0 1.5px, rgba(180,240,255,.7) 2.5px, transparent 5px),
		radial-gradient(circle at 60% 3%, #fff 0 1.5px, rgba(180,240,255,.7) 2.5px, transparent 5px),
		radial-gradient(circle at 88% 12%, #fff 0 1px, rgba(180,240,255,.7) 2px, transparent 4px),
		radial-gradient(circle at 3% 70%, #fff 0 1px, rgba(180,240,255,.7) 2px, transparent 4px);
	animation-delay:-.85s;}

/* Sunset Fade: hot pink at the tail melting into orange at the nose */
.ug-sunset{--c:255,95,110;}
.ug-sunset .ugPool{background:
	radial-gradient(closest-side at 30% 50%, rgba(255,40,140,.62), rgba(255,40,140,.25) 50%, rgba(255,40,140,0)),
	radial-gradient(closest-side at 70% 50%, rgba(255,150,30,.62), rgba(255,150,30,.25) 50%, rgba(255,150,30,0));}
.ug-sunset .ugRim::before{background:linear-gradient(90deg, rgb(255,40,150), rgb(255,90,90) 50%, rgb(255,170,30));}
.ug-sunset .ugRim::after{background:rgb(255,230,200);}

/* Siren: red and blue taking turns, softly (no hard strobe) */
.ug-siren{--c:255,40,50; --c2:40,110,255;}
.ug-siren .ugPool{top:-40%; bottom:-15%; animation:ugAltA calc(1.2s / var(--ugSpd, 1)) ease-in-out infinite;}
.ug-siren .ugRim{transform:translateY(-5%); animation:ugAltA calc(1.2s / var(--ugSpd, 1)) ease-in-out infinite;}
.ug-siren .ugRim2{display:block; transform:translateY(5%); animation:ugAltB calc(1.2s / var(--ugSpd, 1)) ease-in-out infinite;}
.ug-siren .ugRim2::before{background:rgb(var(--c2));}
.ug-siren .ugFx{display:block; left:-8%; right:-8%; top:-15%; bottom:-40%; border-radius:50%;
	background:radial-gradient(closest-side, rgba(var(--c2),.32), rgba(var(--c2),.16) 60%, rgba(var(--c2),0));
	animation:ugAltB calc(1.2s / var(--ugSpd, 1)) ease-in-out infinite;}

/* Light Chase: a dim cyan glow with a bright comet running round and round the car */
.ug-chase{--c:40,230,255;}
.ug-chase .ugPool{opacity:.55; animation:none;}
.ug-chase .ugRim{animation:none; opacity:.7;}
.ug-chase .ugFx{left:-5%; right:-5%; filter:blur(1.5px);}
.ug-chase .ugFx::before{
	background:conic-gradient(from 0deg, rgba(var(--c),0) 0turn, rgba(var(--c),0) .6turn, rgba(var(--c),.5) .88turn, rgba(255,255,255,1) .99turn, rgba(var(--c),0) 1turn);
	-webkit-mask:radial-gradient(closest-side, transparent 60%, #000 70%, #000 78%, transparent 90%); mask:radial-gradient(closest-side, transparent 60%, #000 70%, #000 78%, transparent 90%);
	animation-duration:calc(1.25s / var(--ugSpd, 1));}

/* Shockwave: rings of light ripple out across the road */
.ug-pulse{--c:0,255,190;}
.ug-pulse .ugFx, .ug-pulse .ugFx2{display:block; inset:-6% -2%; border-radius:var(--ugRad); border:2px solid rgba(var(--c),.95);
	box-shadow:0 0 6px rgba(var(--c),.9); filter:blur(1px); animation:ugRing calc(1.9s / var(--ugSpd, 1)) ease-out infinite;}
.ug-pulse .ugFx2{animation-delay:calc(-.95s / var(--ugSpd, 1));}

/* On a car with a drawn shape (/admin-glow), the comet and the rings follow its outline instead:
   .ugPath is that outline in an SVG stretched over a box a little bigger than the body */
.ugPath{display:none; position:absolute; overflow:visible; pointer-events:none;}
.ugPath polygon{fill:none; vector-effect:non-scaling-stroke; stroke-linejoin:round; stroke-linecap:round;}
.ugShaped.ug-chase .ugFx, .ugShaped.ug-pulse .ugFx{display:none;}
.ugShaped.ug-chase .ugPath{display:block; top:-16%; left:-4%; width:108%; height:132%; filter:blur(1px);}
.ug-chase .ugP1{stroke:rgba(var(--c),.4); stroke-width:calc(var(--ugSw, 2px) * 1.6); stroke-dasharray:26 74; animation:ugRun26 calc(1.25s / var(--ugSpd, 1)) linear infinite;}
.ug-chase .ugP2{stroke:rgba(var(--c),.9); stroke-width:calc(var(--ugSw, 2px) * 1.2); stroke-dasharray:11 89; animation:ugRun11 calc(1.25s / var(--ugSpd, 1)) linear infinite;}
.ug-chase .ugP3{stroke:#fff; stroke-width:var(--ugSw, 2px); stroke-dasharray:3 97; animation:ugRun3 calc(1.25s / var(--ugSpd, 1)) linear infinite;}
@keyframes ugRun26{from{stroke-dashoffset:26;} to{stroke-dashoffset:-74;}}
@keyframes ugRun11{from{stroke-dashoffset:11;} to{stroke-dashoffset:-89;}}
@keyframes ugRun3{from{stroke-dashoffset:3;} to{stroke-dashoffset:-97;}}
.ugShaped.ug-pulse .ugPath{display:block; top:-6%; left:-2%; width:104%; height:112%; filter:blur(1.1px) drop-shadow(0 0 3px rgba(var(--c),.9));}
.ug-pulse .ugP1, .ug-pulse .ugP2{stroke:rgba(var(--c),.95); stroke-width:2.2px; transform-box:view-box; transform-origin:50% 50%; animation:ugRing calc(1.9s / var(--ugSpd, 1)) ease-out infinite;}
.ug-pulse .ugP2{animation-delay:calc(-.95s / var(--ugSpd, 1));}
.ug-pulse .ugP3{display:none;}

/* Rainbow Cycle: a rainbow swirling under the car, the rim colors rolling front to back */
.ug-rainbow{--c:255,255,255;}
.ug-rainbow .ugPool{display:none;}
.ug-rainbow .ugFx::before{
	background:conic-gradient(rgba(255,40,60,.85), rgba(255,170,0,.85), rgba(255,240,40,.85), rgba(60,255,90,.85), rgba(30,220,255,.85), rgba(80,90,255,.85), rgba(220,60,255,.85), rgba(255,40,60,.85));
	-webkit-mask:radial-gradient(closest-side, #000 25%, rgba(0,0,0,.35) 62%, transparent 82%); mask:radial-gradient(closest-side, #000 25%, rgba(0,0,0,.35) 62%, transparent 82%);
	animation-duration:calc(3.2s / var(--ugSpd, 1));}
.ug-rainbow .ugRim::before{background:linear-gradient(90deg, #ff2a3c, #ffb000, #fff028, #3cff5a, #1edcff, #5a5aff, #dc3cff);}
.ug-rainbow .ugRim2{display:block; animation:ugCycle calc(2.4s / var(--ugSpd, 1)) ease-in-out infinite;}
.ug-rainbow .ugRim2::before{background:linear-gradient(90deg, #dc3cff, #5a5aff, #1edcff, #3cff5a, #fff028, #ffb000, #ff2a3c);}
.ug-rainbow .ugRim2::after{display:none;}

/* Hyperdrive (Grandmaster bots): cyan outline, a pink haze, and a light streak trailing the tail */
.ug-hyper{--c:55,227,255; --c2:255,90,220;}
.ug-hyper .ugPool{background:radial-gradient(closest-side, rgba(var(--c2),.3), rgba(var(--c2),.14) 60%, rgba(var(--c),0));}
.ug-hyper .ugFx{background:linear-gradient(to left, rgba(55,227,255,.9), rgba(255,120,220,.45) 50%, rgba(255,255,255,0));}
.ug-hyper .ugFx2{display:block; right:98%; width:30%; top:46%; height:8%; border-radius:50% 0 0 50%; transform-origin:100% 50%;
	background:linear-gradient(to left, #fff, rgba(55,227,255,.6) 40%, rgba(55,227,255,0)); animation:ugFlicker calc(.45s / var(--ugSpd, 1)) linear infinite reverse;}

/* Legend Gold (Legend bots): gold light, a gold streak, sun rays slowly turning under the car, a shimmering edge */
.ug-legend{--c:255,206,60; --c2:255,140,30;}
.ug-legend .ugPool{background:radial-gradient(closest-side, rgba(255,214,90,.34), rgba(var(--c2),.16) 60%, rgba(var(--c2),0));}
.ug-legend .ugRim::after{background:rgb(255,248,220);}
.ug-legend .ugFx{background:linear-gradient(to left, rgba(255,214,74,.95), rgba(255,140,40,.45) 55%, rgba(255,255,255,0));}
.ug-legend .ugFx2::before{
	background:repeating-conic-gradient(rgba(255,226,130,.6) 0deg 5deg, rgba(255,226,130,0) 9deg 24deg);
	-webkit-mask:radial-gradient(closest-side, transparent 58%, #000 68%, rgba(0,0,0,.3) 80%, transparent 90%); mask:radial-gradient(closest-side, transparent 58%, #000 68%, rgba(0,0,0,.3) 80%, transparent 90%);
	animation-duration:calc(9s / var(--ugSpd, 1));}
.ug-legend .ugRim2{display:block; animation:ugTwinkle calc(1.1s / var(--ugSpd, 1)) ease-in-out infinite;}
.ug-legend .ugRim2::before{background:rgb(255,250,215); inset:calc(var(--ugEy) * .4) calc(var(--ugEx) * .4);}
.ug-legend .ugRim2::after{display:none;}

@media (prefers-reduced-motion: reduce){
	.ugGlow i, .ugGlow i::before, .ugGlow i::after, .ugPath polygon{animation:none !important;}
}

/* The race lags (html.trgLean, js/racer/trails.js RacerLoad, owner 2026-12-03): other cars' underglows go until it
   catches up (their trails and Turbo flames stop in the scripts); your own car and the one the camera follows keep
   theirs. Hidden, not faded: a hidden glow's animations stop costing anything. */
html.trgLean .raceCar:not(.localRacer):not(.camCar) .ugGlow{display:none;}
