/* =====================================================================
   Shell Shock (Lith Harbor) — the sideways street. Shared by both
   themes; the town skin (buttons, panels) lives in each theme's sheet.

   The snail crawls left → right from the harbor dock, across vertical
   lanes of Lith Harbor's white-marble street (real whiteMarble tiles), to
   the finish line and the grass meadow past it (real grassySoil grass).
   Mushrooms bounce down every lane.

   Set by crossing.js from the stage size: --W one lane's width,
   --H the road's height, --pill the multiplier strip under it,
   --start the dock's width, --px / --px-traffic / --px-big sprite scales.
   ===================================================================== */

.stage-crossing .stage-inner { padding: 0; }
/* the result note sits over the bay, never over the road */
.stage-crossing .result.dock { top: 50px; bottom: auto; }

.xing {
  --W: 110px; --H: 420px; --pill: 52px; --start: 176px; --px: 1.9;
  position: relative; align-self: stretch; flex: 1; width: 100%; min-height: 0; overflow: hidden;
  user-select: none; -webkit-user-select: none;
}

/* the bay above the street (slow parallax as the camera moves) */
.xing-sky {
  position: absolute; left: 0; right: 0; top: 0; height: 16%;
  background: url("/static/img/maple-lith.jpg") 0 35% / auto 700% no-repeat;
  transition: background-position 720ms cubic-bezier(.45, .05, .4, 1);
  box-shadow: inset 0 -14px 16px -10px rgba(10, 30, 50, 0.55);
}
.xing-sky.no-anim { transition: none; }

.xing-view { position: absolute; left: 0; right: 0; top: 14%; bottom: 0; overflow: hidden; }
.xing-world {
  position: absolute; left: 0; top: 0; bottom: 0;
  transition: transform 720ms cubic-bezier(.45, .05, .4, 1); will-change: transform;
}
.xing-world.no-anim { transition: none; }
.xing-ground, .xing-actors { position: absolute; inset: 0; }
.xing-actors { pointer-events: none; z-index: 3; }
.xing-traffic { position: absolute; left: 0; top: 0; width: 100%; height: var(--H); overflow: hidden; pointer-events: none; z-index: 2; }

/* ---- the street: white-marble flagstones, grey cobble lane lines ---- */
.xing-ground::before {
  /* the cobble curb along the top of the street */
  content: ""; position: absolute; left: var(--start); right: 0; top: 0; height: 12px; z-index: 1;
  background: url("/static/img/crossing/lith/curb.png") 0 0 / auto 100% repeat-x;
  box-shadow: 0 3px 4px rgba(60, 50, 30, 0.25);
}
.xing-lane {
  position: absolute; top: 0; height: var(--H);
  left: calc(var(--start) + var(--i) * var(--W)); width: var(--W);
  background: url("/static/img/crossing/lith/road.png") calc(var(--i) * var(--W) * -1) 0 / calc(var(--W) * 2.7) calc(var(--W) * 1.2) repeat;
}
.xing-lane.alt { box-shadow: inset 0 0 0 999px rgba(120, 100, 60, 0.05); }
.xing-lane::before {
  /* lane line: a strip of the town's grey cobbles */
  content: ""; position: absolute; left: -5px; top: 0; bottom: 0; width: 10px; z-index: 1;
  background: url("/static/img/crossing/lith/curb-v.png") 0 0 / 100% auto repeat-y;
  filter: drop-shadow(1px 0 0 rgba(60, 50, 30, 0.25));
}

/* the multiplier strip along the bottom (one pill per lane) */
.xing-pillbar {
  position: absolute; left: 0; right: 0; top: var(--H); bottom: 0;
  background: linear-gradient(#1d4468, #102a43); border-top: 3px solid #c9a46a;
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.08);
}
.lane-pill {
  position: absolute; z-index: 4; top: calc(var(--H) + 9px); height: calc(var(--pill) - 18px);
  left: calc(var(--start) + var(--i) * var(--W) + 6px); width: calc(var(--W) - 12px);
  display: flex; align-items: center; justify-content: center; gap: 4px; padding: 0; margin: 0;
  border-radius: 999px; border: 2px solid #3f6f99; background: #22507a; color: #d7e6f4;
  font: 800 clamp(13px, calc(var(--pill) * 0.38), 20px) / 1 "Barlow Condensed", var(--cond, system-ui), sans-serif;
  font-variant-numeric: tabular-nums; letter-spacing: 0.02em; cursor: var(--cur-default); opacity: 1;
  transition: background 0.25s, color 0.25s, border-color 0.25s, transform 0.15s;
}
.lane-pill:disabled { opacity: 1; cursor: var(--cur-default); }
.pill-tag:empty { display: none; }
.lane-pill.next { background: #ffd84a; border-color: #fff1a8; color: #2a1d00; box-shadow: 0 0 14px rgba(255, 216, 74, 0.7); animation: pill-glow 1.3s ease-in-out infinite; }
.lane-pill.next:not(:disabled) { cursor: var(--cur-click); }
.lane-pill.next:not(:disabled):hover { transform: translateY(-2px); }
.lane-pill.done { background: #2f9e66; border-color: #93f2b9; color: #fff; }
.lane-pill.squish { background: #c93a44; border-color: #ffb0b0; color: #fff; }
.lane-pill.reveal { background: rgba(160, 40, 50, 0.85); border-style: dashed; border-color: #ff9a9a; color: #ffd6d6; }
.lane-pill.pop { animation: pill-pop 0.5s cubic-bezier(.2, 1.5, .4, 1); }
@keyframes pill-glow { 50% { box-shadow: 0 0 26px rgba(255, 216, 74, 0.95); } }
@keyframes pill-pop { 40% { transform: scale(1.18); } }

/* the manhole cover in every lane, where the snail stands */
.manhole {
  position: absolute; z-index: 1; pointer-events: auto; padding: 0; margin: 0;
  left: calc(var(--start) + (var(--i) + 0.5) * var(--W)); top: calc(var(--H) * 0.6);
  width: calc(var(--W) * 0.68); height: calc(var(--W) * 0.36); transform: translate(-50%, -50%);
  border-radius: 50%; border: 2px solid #2c333d; cursor: var(--cur-default);
  background:
    repeating-linear-gradient(90deg, transparent 0 6px, rgba(0, 0, 0, 0.22) 6px 8px),
    radial-gradient(ellipse at 50% 40%, #8a97a6, #5b6676 60%, #3c4553);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.25), inset 0 -3px 0 rgba(0, 0, 0, 0.3), 0 3px 0 rgba(60, 50, 30, 0.3);
  transition: box-shadow 0.25s;
}
.manhole:disabled { opacity: 1; cursor: var(--cur-default); }
.manhole.next { box-shadow: 0 0 0 3px #ffd84a, 0 0 22px rgba(255, 216, 74, 0.85); animation: hole-glow 1.3s ease-in-out infinite; }
.manhole.next:not(:disabled) { cursor: var(--cur-click); }
.manhole.done { box-shadow: 0 0 0 3px #5fe3a1, 0 0 14px rgba(95, 227, 161, 0.6); }
.manhole.squish, .manhole.reveal { box-shadow: 0 0 0 3px #ff6b6b, 0 0 16px rgba(255, 107, 107, 0.7); }
.manhole.pop { animation: hole-pop 0.5s ease-out; }
@keyframes hole-glow { 50% { box-shadow: 0 0 0 5px #ffd84a, 0 0 34px rgba(255, 216, 74, 1); } }
@keyframes hole-pop { 40% { box-shadow: 0 0 0 8px #93f2b9, 0 0 40px rgba(147, 242, 185, 1); } }

/* a closed lane: striped barrier across it, above the manhole */
.xing .barrier {
  position: absolute; z-index: 2; display: none;
  left: calc(var(--start) + var(--i) * var(--W) + 8px); width: calc(var(--W) - 16px);
  top: calc(var(--H) * 0.6 - var(--W) * 0.95); height: calc(var(--W) * 0.3);
  transform-origin: 50% 100%;
}
.xing .barrier.up { display: block; animation: barrier-drop 0.45s cubic-bezier(.2, 1.5, .4, 1) both; }
.xing .barrier::before {
  content: ""; position: absolute; left: 0; right: 0; top: 18%; height: 46%; border-radius: 4px; z-index: 1;
  background: repeating-linear-gradient(-45deg, #ff5a3c 0 9px, #fff7ea 9px 18px);
  border: 2px solid #5a1d10; box-shadow: 0 4px 0 rgba(60, 40, 20, 0.35);
}
.xing .barrier::after {
  content: ""; position: absolute; left: 8%; right: 8%; top: 40%; bottom: 0;
  background: linear-gradient(90deg, #6b4423 0 12%, transparent 12% 88%, #6b4423 88%);
}
.xing .barrier .lamp {
  position: absolute; left: 50%; top: 0; width: calc(var(--W) * 0.12); height: calc(var(--W) * 0.12); z-index: 2;
  transform: translate(-50%, -40%); border-radius: 50%; border: 2px solid #5a3a10; background: #ffb800;
  animation: lamp 0.9s steps(1) infinite;
}
@keyframes barrier-drop { from { transform: translateY(-40px) scaleY(0.3); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes lamp { 0%, 100% { background: #ffcf3a; box-shadow: 0 0 12px 3px rgba(255, 190, 40, 0.8); } 50% { background: #a86d00; box-shadow: none; } }

/* ---- start: the harbor dock ---- */
.xing-dock {
  position: absolute; left: 0; top: 0; bottom: 0; width: var(--start);
  background:
    radial-gradient(circle, #3a2210 0 1.6px, transparent 2.2px) 6px 4px / 30px 20px,
    repeating-linear-gradient(180deg, #ad7a46 0 18px, #4a2c14 18px 20px, #9b6a3c 20px 38px, #4a2c14 38px 40px);
  box-shadow: inset -6px 0 8px rgba(0, 0, 0, 0.25);
}
.dock-sea {
  position: absolute; left: 0; top: 0; bottom: 0; width: 24%;
  background:
    repeating-linear-gradient(180deg, transparent 0 14px, rgba(255, 255, 255, 0.35) 14px 16px, transparent 16px 30px) 0 0 / 100% 30px,
    linear-gradient(90deg, #1b6fae, #2c9fd6);
  box-shadow: inset -4px 0 0 #6b4423, inset -8px 0 6px rgba(0, 0, 0, 0.25);
  animation: sea-roll 3s linear infinite;
}
@keyframes sea-roll { to { background-position: 0 30px, 0 0; } }
.dock-prop { position: absolute; pointer-events: none; filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.35)); }
.dock-prop.anchor { left: 30%; top: 4%; width: calc(var(--W) * 0.62); }
.dock-prop.barrel { left: 32%; top: calc(var(--H) * 0.78); width: calc(var(--W) * 0.5); }
.dock-prop.post { width: calc(var(--W) * 0.22); right: 6%; }
.dock-prop.post.p1 { top: calc(var(--H) * 0.08); }
.dock-prop.post.p2 { top: calc(var(--H) * 0.72); }

/* ---- finish: golden checkered line, the grass meadow past it, ribbon, big flags, banner, podium ---- */
.xing-finish {
  position: absolute; top: 0; height: var(--H); width: calc(var(--W) * 3.4); overflow: hidden;
  left: calc(var(--start) + var(--n) * var(--W));
  background: url("/static/img/crossing/lith/road.png") 0 0 / calc(var(--W) * 2.7) calc(var(--W) * 1.2) repeat;
}
.finish-grass {
  /* the snail's goal: a meadow of Victoria Island grass with its flowers and butterflies */
  position: absolute; left: calc(var(--W) * 0.47); right: 0; top: 0; bottom: 0;
  background: url("/static/img/crossing/lith/grass.jpg") 0 0 / calc(var(--W) * 3.6) calc(var(--W) * 1.32) repeat;
  box-shadow: inset 0 12px 14px -8px rgba(20, 50, 10, 0.5);
}
.finish-edge {
  /* grass blades leaning over the edge of the finish line */
  position: absolute; z-index: 1; top: 0; bottom: 0; left: calc(var(--W) * 0.4); width: calc(var(--W) * 0.2);
  background: url("/static/img/crossing/lith/grass-edge.png") 0 0 / 100% auto repeat-y;
  filter: drop-shadow(-2px 0 1px rgba(20, 50, 10, 0.35));
}
.meadow-prop {
  position: absolute; height: auto; transform: translate(-50%, -100%); pointer-events: none;
  filter: drop-shadow(0 3px 2px rgba(20, 50, 10, 0.35));
}
.meadow-fly {
  /* MapleStory butterflies, flapping and drifting over the grass */
  position: absolute; width: calc(var(--W) * 1.47); aspect-ratio: 125 / 68; pointer-events: none;
  background: url("/static/img/crossing/lith/butterfly.png") 0 0 / 900% 100% no-repeat;
  animation: fly-flap 1.1s steps(9) infinite, fly-drift 7s ease-in-out infinite alternate;
}
.meadow-fly.f1 { left: calc(var(--W) * 1.1); top: 26%; }
.meadow-fly.f2 { left: calc(var(--W) * 1.85); top: 62%; background-image: url("/static/img/crossing/lith/butterfly2.png"); aspect-ratio: 124 / 61; animation-delay: -0.5s, -3s; }
@keyframes fly-flap { to { background-position: 112.5% 0; } } /* 9 frames: one frame = 12.5% */
@keyframes fly-drift { 50% { transform: translate(calc(var(--W) * -0.25), -12px); } to { transform: translate(calc(var(--W) * 0.15), 8px); } }
.finish-rays {
  /* a slow golden sunburst behind the podium */
  position: absolute; left: calc(var(--W) * 0.95); top: 60%; width: calc(var(--W) * 4.2); height: calc(var(--W) * 4.2);
  transform: translate(-50%, -50%); border-radius: 50%;
  background: repeating-conic-gradient(rgba(255, 210, 63, 0.42) 0 9deg, transparent 9deg 18deg);
  -webkit-mask: radial-gradient(circle, #000 0 22%, transparent 68%);
  mask: radial-gradient(circle, #000 0 22%, transparent 68%);
  animation: rays-spin 22s linear infinite;
}
.xing.finished .finish-rays { animation-duration: 5s; filter: brightness(1.25) saturate(1.3); }
@keyframes rays-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
.finish-bunting {
  /* pennants strung across the top: Lith blue, white, gold and red */
  position: absolute; left: 0; right: 0; top: 14px; height: 30px; z-index: 2;
  background: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='136' height='30'><path d='M0 3 Q68 11 136 3' stroke='%23e8e0c8' stroke-width='2' fill='none'/><path d='M6 4 L24 4 L15 24 Z' fill='%232f6fb3'/><path d='M40 7 L58 7 L49 27 Z' fill='%23ffffff' stroke='%23c9c0a8'/><path d='M74 7 L92 7 L83 27 Z' fill='%23ffd23f'/><path d='M108 4 L126 4 L117 24 Z' fill='%23e8303a'/></svg>") 0 0 / 136px 30px repeat-x;
  filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.25)); animation: bunting-sway 3s ease-in-out infinite; transform-origin: 50% 0;
}
@keyframes bunting-sway { 50% { transform: translateY(2px) skewX(-2deg); } }
.finish-band {
  /* the finish line itself: two columns of checks between gold rails, with a shine running down it */
  position: absolute; left: calc(var(--W) * 0.1); top: 0; bottom: 0; width: calc(var(--W) * 0.42); z-index: 1;
  background: conic-gradient(#151515 25%, #fff 0 50%, #151515 0 75%, #fff 0) 0 0 / calc(var(--W) * 0.21) calc(var(--W) * 0.21);
  border-left: 5px solid #ffd23f; border-right: 5px solid #ffd23f;
  box-shadow: 0 0 0 2px #8a5a00, 0 0 26px rgba(255, 210, 63, 0.8);
}
.finish-band::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 30%;
  background: linear-gradient(transparent, rgba(255, 255, 255, 0.6), transparent);
  animation: band-shine 2.6s linear infinite;
}
@keyframes band-shine { from { transform: translateY(-100%); } to { transform: translateY(340%); } }
.finish-pole {
  position: absolute; left: calc(var(--W) * 0.31); width: 7px; height: calc(var(--W) * 1.05); z-index: 3;
  transform: translateX(-50%); border-radius: 4px; background: linear-gradient(90deg, #fff3b0, #d4a017 55%, #8a5a00);
  box-shadow: 2px 4px 4px rgba(0, 0, 0, 0.3);
}
.finish-pole::before {
  /* gold knob */
  content: ""; position: absolute; left: 50%; top: -9px; width: 16px; height: 16px; transform: translateX(-50%);
  border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fffbe0, #ffd23f 55%, #a87a00);
}
.finish-pole.top { top: 46px; }
.finish-pole.bottom { bottom: 6px; }
.finish-pole i {
  /* a big checkered flag */
  position: absolute; left: 6px; top: 2px; width: calc(var(--W) * 0.72); height: calc(var(--W) * 0.46);
  background: conic-gradient(#151515 25%, #fff 0 50%, #151515 0 75%, #fff 0) 0 0 / calc(var(--W) * 0.12) calc(var(--W) * 0.115);
  border-radius: 0 4px 4px 0; box-shadow: 2px 3px 4px rgba(0, 0, 0, 0.3);
  transform-origin: 0 50%; animation: flag-wave 1.5s ease-in-out infinite;
}
.finish-pole.bottom i { animation-delay: -0.6s; }
.xing.finished .finish-pole i { animation-duration: 0.5s; }
@keyframes flag-wave { 0%, 100% { transform: skewY(-5deg) scaleX(1); } 50% { transform: skewY(6deg) scaleX(0.88); } }
.finish-banner {
  position: absolute; left: calc(var(--W) * 0.78); top: 56px; width: calc(var(--W) * 2.4); height: calc(var(--W) * 0.52); z-index: 3;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(#2b6196, #173857); border: 3px solid #ffd23f; border-radius: 12px;
  box-shadow: 0 0 0 3px #173857, 0 6px 0 rgba(0, 0, 0, 0.25), 0 0 26px rgba(255, 210, 63, 0.5);
  animation: banner-bob 2.6s ease-in-out infinite;
}
.finish-banner span {
  font: 400 calc(var(--W) * 0.3) / 1 "Bungee", "Lilita One", "Baloo 2", system-ui, sans-serif; letter-spacing: 0.12em;
  color: #ffd23f; text-shadow: 0 3px 0 #7a4b00, 0 0 14px rgba(255, 210, 63, 0.6);
}
.xing.finished .finish-banner { animation: banner-win 0.6s ease-in-out 3; }
@keyframes banner-bob { 50% { transform: translateY(-4px); } }
@keyframes banner-win { 50% { transform: scale(1.1) rotate(-2deg); } }
.finish-podium {
  /* the winner's spot: a golden disc with a star */
  position: absolute; left: calc(var(--W) * 0.95); top: 60%; width: calc(var(--W) * 1.05); height: calc(var(--W) * 0.5); z-index: 1;
  transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(ellipse at 50% 35%, #fff6c4, #ffd23f 45%, #d49a00 72%, #8a5a00);
  box-shadow: 0 0 0 4px #fff1a8, 0 0 0 7px #a87a00, 0 0 36px rgba(255, 210, 63, 0.9), inset 0 -6px 0 rgba(0, 0, 0, 0.18);
}
.finish-podium::after {
  content: ""; position: absolute; left: 50%; top: 46%; width: calc(var(--W) * 0.3); height: calc(var(--W) * 0.2);
  transform: translate(-50%, -50%);
  clip-path: polygon(50% 0, 62% 36%, 100% 38%, 70% 60%, 80% 100%, 50% 76%, 20% 100%, 30% 60%, 0 38%, 38% 36%);
  background: #fffbe8;
}
.xing.finished .finish-podium { animation: podium-glow 0.8s ease-in-out 4; }
@keyframes podium-glow { 50% { box-shadow: 0 0 0 4px #fff1a8, 0 0 0 7px #a87a00, 0 0 70px rgba(255, 230, 120, 1), inset 0 -6px 0 rgba(0, 0, 0, 0.18); } }
.finish-ribbon {
  /* the red tape the snail breaks through */
  position: absolute; z-index: 40; top: 10px; height: calc(var(--H) - 20px); width: 0;
  left: calc(var(--start) + var(--n) * var(--W) + var(--W) * 0.64);
}
.finish-ribbon i {
  position: absolute; left: -4px; width: 8px; height: 50%; border-radius: 3px;
  background: repeating-linear-gradient(180deg, #e8303a 0 16px, #ff6670 16px 32px);
  box-shadow: 0 0 6px rgba(232, 48, 58, 0.6), 2px 0 3px rgba(0, 0, 0, 0.25);
  animation: ribbon-sway 2.2s ease-in-out infinite;
}
.finish-ribbon .rib-a { top: 0; transform-origin: 50% 0; }
.finish-ribbon .rib-b { top: 50%; transform-origin: 50% 100%; animation-delay: -1.1s; }
@keyframes ribbon-sway { 50% { transform: rotate(1.2deg); } }
.xing.finished .finish-ribbon .rib-a { animation: snap-up 0.8s cubic-bezier(.2, .8, .3, 1) forwards; }
.xing.finished .finish-ribbon .rib-b { animation: snap-down 0.8s cubic-bezier(.2, .8, .3, 1) forwards; }
/* the broken ends whip back and hang as short loose ends */
@keyframes snap-up { 40% { transform: rotate(-95deg) scaleY(0.5); } to { transform: rotate(-24deg) scaleY(0.26); } }
@keyframes snap-down { 40% { transform: rotate(90deg) scaleY(0.5); } to { transform: rotate(20deg) scaleY(0.26); } }

/* ---- MapleStory sprites: feet at the actor's origin ---- */
.xing .actor { position: absolute; left: 0; top: 0; width: 0; height: 0; }
.xing .actor::before {
  /* shadow on the ground */
  content: ""; position: absolute; left: calc(var(--W) * -0.24); top: calc(var(--W) * -0.05);
  width: calc(var(--W) * 0.48); height: calc(var(--W) * 0.1); border-radius: 50%; background: rgba(60, 50, 30, 0.28);
}
.xing .face, .xing .hop { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-origin: 0 0; }
.xing .face.flip { transform: scaleX(-1); }
.xing .spr {
  position: absolute;
  left: calc(var(--ax) * var(--px) * -1px); top: calc(var(--ay) * var(--px) * -1px);
  width: calc(var(--cw) * var(--px) * 1px); height: calc(var(--ch) * var(--px) * 1px);
  background-repeat: no-repeat; background-position: 0 0;
  background-size: calc(var(--cw) * var(--n) * var(--px) * 1px) 100%;
  image-rendering: pixelated;
  transform-origin: calc(var(--ax) * var(--px) * 1px) calc(var(--ay) * var(--px) * 1px);
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.2));
}
.xing .spr.loop { animation: spr-loop var(--dur) steps(var(--n)) infinite; }
.xing .spr.once { animation: spr-once var(--dur) steps(var(--n1), jump-none) 1 forwards; }
@keyframes spr-loop { to { background-position: calc(var(--cw) * var(--n) * var(--px) * -1px) 0; } }
@keyframes spr-once { to { background-position: calc(var(--cw) * var(--n1) * var(--px) * -1px) 0; } }

/* traffic: Orange Mushrooms bouncing down every lane, each with its own hop
   (crossing.js moves them and sets --hop-ms / --hop-h per mushroom) */
.xing .actor.traffic { --px: var(--px-traffic, 1.4); transition: opacity 0.3s; }
.xing .actor.traffic.leaving { opacity: 0; }
.xing .actor.traffic .hop { animation: hop var(--hop-ms, 480ms) infinite; }
.xing .actor.traffic .spr { animation: spr-loop var(--dur) steps(var(--n)) infinite, land var(--hop-ms, 480ms) infinite; }
.xing .actor.traffic::before { animation: shadow-hop var(--hop-ms, 480ms) infinite; }
@keyframes hop {
  0% { transform: translateY(0); animation-timing-function: cubic-bezier(.2, .7, .4, 1); }
  50% { transform: translateY(calc(var(--W) * var(--hop-h, 0.3) * -1)); animation-timing-function: cubic-bezier(.6, 0, .85, .4); }
  100% { transform: translateY(0); }
}
@keyframes land { 0%, 100% { transform: scale(1.12, 0.86); } 14%, 86% { transform: scale(1, 1); } }
@keyframes shadow-hop { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(0.6); opacity: 0.55; } }

/* the snail */
.xing .actor.snail { z-index: 50; }
.xing .actor.snail .hop { transition: transform 0.12s ease-in; }
.xing .actor.snail.crawling .hop { animation: crawl 360ms ease-in-out infinite; }
.xing .actor.snail.cheer .hop { animation: cheer 450ms ease-out 2; }
.xing.idle .actor.snail .hop { animation: breathe 2.4s ease-in-out infinite; }
@keyframes crawl { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.09, 0.9); } }
@keyframes breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.03, 0.97); } }
@keyframes cheer {
  0%, 100% { transform: translateY(0) scale(1, 1); }
  20% { transform: translateY(0) scale(1.14, 0.84); }
  55% { transform: translateY(calc(var(--W) * -0.5)) scale(0.94, 1.08); }
}

/* squished: flat as a pancake — still a snail, with goo and dizzy stars */
.xing .actor.snail.squashed .hop { animation: pancake 0.6s cubic-bezier(.2, .8, .3, 1) forwards; }
.xing .actor.snail.squashed .spr { animation: hit-flash 0.12s steps(1) 3; }
@keyframes pancake {
  0% { transform: scale(1, 1); }
  14% { transform: scale(1.85, 0.2); }
  40% { transform: scale(1.3, 0.62); }
  66% { transform: scale(1.62, 0.36); }
  100% { transform: scale(1.55, 0.44); }
}
@keyframes hit-flash { 50% { filter: brightness(2.6) saturate(0.4); } }
.xing .goo {
  position: absolute; z-index: -1; left: calc(var(--W) * -0.62); top: calc(var(--W) * -0.12);
  width: calc(var(--W) * 1.24); height: calc(var(--W) * 0.3); border-radius: 50%;
  background: radial-gradient(ellipse, color-mix(in srgb, var(--goo) 55%, #fff) 0 45%, var(--goo) 70%, color-mix(in srgb, var(--goo) 70%, #000) 100%);
  opacity: 0.9; animation: goo-splash 0.55s cubic-bezier(.2, 1.4, .4, 1) both;
}
.xing .goo i {
  position: absolute; width: calc(var(--W) * 0.12); height: calc(var(--W) * 0.08); border-radius: 50%;
  background: var(--goo); animation: goo-drop 0.6s ease-out both;
}
.xing .goo i:nth-child(1) { left: -8%; top: 20%; --dx: -18px; --dy: -6px; }
.xing .goo i:nth-child(2) { left: 98%; top: 30%; --dx: 16px; --dy: -4px; }
.xing .goo i:nth-child(3) { left: 20%; top: 96%; --dx: -6px; --dy: 10px; width: calc(var(--W) * 0.09); }
.xing .goo i:nth-child(4) { left: 74%; top: -14%; --dx: 8px; --dy: -12px; width: calc(var(--W) * 0.08); }
@keyframes goo-splash { from { transform: scale(0.2, 0.1); opacity: 0; } to { transform: none; opacity: 0.9; } }
@keyframes goo-drop { from { transform: translate(0, 0) scale(0.4); } to { transform: translate(var(--dx), var(--dy)) scale(1); } }
.xing .dizzy {
  position: absolute; left: 0; top: calc(var(--W) * -0.36); width: 0; height: 0;
  transform: scaleY(0.38); animation: dizzy-in 0.3s 0.35s both;
}
.xing .dizzy-ring { position: absolute; left: 0; top: 0; width: 0; height: 0; animation: dizzy-spin 1.1s linear infinite; }
.xing .dizzy-ring i {
  position: absolute; left: -9px; top: -9px; width: 18px; height: 18px; background: #ffd84a;
  clip-path: polygon(50% 0, 62% 36%, 100% 38%, 70% 60%, 80% 100%, 50% 76%, 20% 100%, 30% 60%, 0 38%, 38% 36%);
  filter: drop-shadow(0 0 3px rgba(255, 216, 74, 0.9));
}
.xing .dizzy-ring i:nth-child(1) { transform: rotate(0deg) translateX(calc(var(--W) * 0.34)) scaleY(2.4); }
.xing .dizzy-ring i:nth-child(2) { transform: rotate(120deg) translateX(calc(var(--W) * 0.34)) scaleY(2.4); background: #fff3b0; }
.xing .dizzy-ring i:nth-child(3) { transform: rotate(240deg) translateX(calc(var(--W) * 0.34)) scaleY(2.4); }
@keyframes dizzy-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes dizzy-spin { to { transform: rotate(360deg); } }

.xing .actor.squisher { z-index: 80; --px: var(--px-big, 2.2); }
.xing .actor.squisher .spr { filter: drop-shadow(0 6px 2px rgba(60, 40, 20, 0.35)); }
.xing .actor.ghost { z-index: 60; opacity: 0.9; }
.xing .actor.ghost .spr { filter: saturate(0.85) drop-shadow(0 0 6px rgba(255, 80, 80, 0.7)); }

/* ---- the minimap: how far to the town ---- */
.xing-map {
  position: absolute; z-index: 20; top: 8px; left: 50%; transform: translateX(-50%);
  width: min(74%, 500px); height: 36px; display: flex; align-items: center; gap: 8px; padding: 0 14px;
  border-radius: 999px; background: rgba(13, 34, 56, 0.85); border: 2px solid #c9a46a;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35); color: #fff;
}
.map-end { font-size: 16px; line-height: 1; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.5)); }
.map-track { position: relative; flex: 1; height: 6px; border-radius: 3px; background: #efe8d6; box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35); }
.map-tick {
  position: absolute; top: 50%; width: 3px; height: 10px; transform: translate(-50%, -50%);
  border-radius: 2px; background: #7f97ad; transition: background 0.25s, height 0.25s;
}
.map-tick.done { background: #5fe3a1; }
.map-tick.bad { background: #ff6b6b; height: 16px; width: 4px; }
.map-snail {
  position: absolute; bottom: 1px; left: 0; width: 34px; height: 22px;
  background: center bottom / contain no-repeat; image-rendering: pixelated;
  transform: translateX(-50%) scaleX(-1); transform-origin: 50% 100%;
  transition: left 720ms cubic-bezier(.45, .05, .4, 1), transform 0.3s;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.6));
}
.map-snail.go { animation: map-wiggle 360ms ease-in-out infinite; }
.map-snail.flat { transform: translateX(-50%) scaleX(-1.4) scaleY(0.4); }
@keyframes map-wiggle { 50% { transform: translateX(-50%) scaleX(-1.08) scaleY(0.9); } }
.map-left {
  min-width: 96px; text-align: right; white-space: nowrap;
  font: 800 15px / 1 "Barlow Condensed", var(--cond, system-ui), sans-serif; letter-spacing: 0.02em; color: #fff;
}
.xing-map.made-it .map-finish { animation: flag-bounce 0.6s ease-in-out 3; }
@keyframes flag-bounce { 50% { transform: translateY(-5px) scale(1.25); } }

/* ---- effects ---- */
.xing .confetti { position: absolute; width: 0; height: 0; z-index: 600; pointer-events: none; }
.xing .confetti i {
  position: absolute; left: -5px; top: -8px; width: 10px; height: 16px; border-radius: 2px; background: var(--c);
  animation: confetti-fly var(--t) cubic-bezier(.15, .7, .35, 1) forwards;
}
.xing .confetti i:nth-child(3n) { width: 8px; height: 8px; border-radius: 50%; }
@keyframes confetti-fly {
  0% { transform: rotate(var(--a)) translateX(0) rotate(0deg); opacity: 1; }
  60% { opacity: 1; }
  100% { transform: rotate(var(--a)) translateX(calc(var(--W) * var(--d))) rotate(var(--r)) translateY(60px); opacity: 0; }
}
.xing .splat, .xing .sparkle { position: absolute; width: 0; height: 0; z-index: 600; pointer-events: none; }
.xing .splat::after {
  content: ""; position: absolute; left: calc(var(--W) * -0.7); top: calc(var(--W) * -0.2);
  width: calc(var(--W) * 1.4); height: calc(var(--W) * 0.4); border-radius: 50%;
  border: 4px solid rgba(255, 244, 200, 0.9); animation: ring 0.6s ease-out forwards;
}
.xing .splat b {
  position: absolute; left: 0; bottom: calc(var(--W) * 1.05); white-space: nowrap;
  font: 400 calc(var(--W) * 0.3) / 1 "Bungee", "Lilita One", "Baloo 2", system-ui, sans-serif; color: #fff1a8;
  -webkit-text-stroke: 2px #7a1d10; paint-order: stroke fill; text-shadow: 0 4px 0 #7a1d10, 0 8px 14px rgba(0, 0, 0, 0.45);
  animation: splat-text 1.4s ease-out forwards;
}
.xing .splat i, .xing .sparkle i {
  position: absolute; left: calc(var(--W) * -0.06); top: calc(var(--W) * -0.06);
  width: calc(var(--W) * 0.12); height: calc(var(--W) * 0.12);
  clip-path: polygon(50% 0, 62% 36%, 100% 38%, 70% 60%, 80% 100%, 50% 76%, 20% 100%, 30% 60%, 0 38%, 38% 36%);
  background: #ffd84a; transform: rotate(var(--a)) translateX(0);
  animation: star-out 0.75s cubic-bezier(.2, .8, .4, 1) forwards;
}
.xing .splat i:nth-child(even) { background: #fff6d6; }
.xing .sparkle i { background: #93f2b9; --d: 0.7; animation-duration: 0.6s; }
.xing .sparkle i:nth-child(odd) { background: #ffe27a; }
@keyframes star-out { to { transform: rotate(var(--a)) translateX(calc(var(--W) * var(--d, 1))) scale(0.35); opacity: 0; } }
@keyframes ring { from { transform: scale(0.3); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }
@keyframes splat-text {
  0% { transform: translateX(-50%) rotate(-8deg) scale(0.3); opacity: 0; }
  16% { transform: translateX(-50%) rotate(-8deg) scale(1.18); opacity: 1; }
  28% { transform: translateX(-50%) rotate(-8deg) scale(1); }
  78% { opacity: 1; }
  100% { transform: translateX(-50%) translateY(-18px) rotate(-8deg) scale(1); opacity: 0; }
}

/* ---- lobby card art: the street sideways, a snail and a mushroom ---- */
.art-crossing { background: url("/static/img/maple-lith.jpg") center 30% / cover; position: relative; overflow: hidden; }
.art-crossing .mini-road {
  position: absolute; left: 0; right: 0; bottom: 22%; height: 52%;
  background:
    url("/static/img/crossing/lith/curb-v.png") 34% 0 / 8px auto repeat-y,
    url("/static/img/crossing/lith/curb-v.png") 52% 0 / 8px auto repeat-y,
    url("/static/img/crossing/lith/curb-v.png") 70% 0 / 8px auto repeat-y,
    url("/static/img/crossing/lith/curb-v.png") 88% 0 / 8px auto repeat-y,
    url("/static/img/crossing/lith/road.png") 0 0 / 200px auto;
}
.art-crossing .mini-road::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 18%;
  background: repeating-linear-gradient(180deg, #ad7a46 0 12px, #4a2c14 12px 13px, #9b6a3c 13px 25px, #4a2c14 25px 26px);
}
.art-crossing .mini-pills {
  position: absolute; left: 0; right: 0; bottom: 0; height: 22%; display: flex; gap: 6px; align-items: center; justify-content: flex-end;
  padding: 0 4% 0 18%; background: linear-gradient(#1d4468, #102a43); border-top: 3px solid #c9a46a;
}
.art-crossing .mini-pills span {
  flex: 0 0 15%; text-align: center; padding: 3px 0; border-radius: 999px; background: #22507a; border: 2px solid #3f6f99;
  color: #d7e6f4; font: 800 14px/1 "Barlow Condensed", system-ui, sans-serif;
}
.art-crossing .mini-pills span.done { background: #2f9e66; border-color: #93f2b9; color: #fff; }
.art-crossing .mini-pills span.next { background: #ffd84a; border-color: #fff1a8; color: #2a1d00; }
.art-crossing .mini-snail {
  position: absolute; left: calc(43% - 40px); bottom: 36%; width: 81px; height: 48px;
  background: url("/static/img/crossing/snail-blue-stand.png") 0 0 / 100% 100% no-repeat; image-rendering: pixelated;
  transform: scaleX(-1);
}
.art-crossing .mini-mush {
  position: absolute; left: calc(61% - 38px); top: 6%; width: 76px; height: 75px;
  background: url("/static/img/crossing/mushroom-move.png") 0 0 / 300% 100% no-repeat; image-rendering: pixelated;
  animation: mini-mush-frames 480ms steps(3) infinite, mini-mush-down 2.8s linear infinite;
}
@keyframes mini-mush-frames { to { background-position: -228px 0; } }
@keyframes mini-mush-down {
  0% { transform: translateY(-40px); opacity: 0; }
  10% { opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translateY(70px); opacity: 0; }
}

@media (max-width: 760px) {
  .xing-map { width: calc(100% - 20px); height: 32px; padding: 0 10px; }
  .map-left { min-width: 84px; font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .xing .actor.traffic .hop, .xing .actor.traffic::before, .finish-pole i, .finish-rays, .finish-band::after, .finish-banner, .finish-ribbon i,
  .finish-bunting, .lane-pill.next, .manhole.next, .xing.idle .actor.snail .hop, .dock-sea, .xing .dizzy-ring, .meadow-fly,
  .art-crossing .mini-mush { animation-duration: 0s !important; animation-iteration-count: 1 !important; }
}
