/*
  Hop Prism Power: a magical girl theme for bunnyhop.lol custom CSS (https://bunnyhop.lol/custom-css).
  Twilight plum panels trimmed like a transformation outfit: satin ribbons with stitched edges, lace scallops, gold
  four-point sparkles and a heart that hops from entry to entry. Your speed fills a row of ten hearts that turn gold
  when your sync is high. Players paste a short file that imports this one and sets the options:

    @import url(https://bunnyhop.lol/custom-css/themes/magical.css);
    :root { --magical-accent: #ff8fc8; --magical-panel: #2a1a3e; --magical-art-on: 1; --magical-art: url(https://...gif); }

  Options:
    --magical-accent    the ribbon colour: buttons, ribbons, hearts, the entry to press: #ff8fc8 pink, #c9a6ff lilac, #7fd8e8 aqua
    --magical-panel     the twilight behind the menus: #2a1a3e plum, #1d2244 night blue
    --magical-art-on    1 shows the picture in the corner, 0 hides it
    --magical-art       the picture, any image link: url(https://...gif). Stickers with a see-through background look best:
                        she stands in front of a moon. Nothing shows until one is set.
    --magical-art-size  1 is normal, above 1 makes the picture bigger (1.3)

  Fonts: Mochiy Pop One and M PLUS Rounded 1c (SIL Open Font License,
  https://bunnyhop.lol/custom-css/themes/magical-mochiy-OFL.txt and
  https://bunnyhop.lol/custom-css/themes/magical-rounded-OFL.txt).
  Everything here uses the hooks the guide promises unless a comment says the class names may change.
*/

@font-face { font-family: "Magical Pop"; src: url(https://bunnyhop.lol/custom-css/themes/magical-mochiy.woff2) format("woff2"); }
@font-face { font-family: "Magical Rounded"; font-weight: 100 599; src: url(https://bunnyhop.lol/custom-css/themes/magical-rounded-500.woff2) format("woff2"); }
@font-face { font-family: "Magical Rounded"; font-weight: 600 749; src: url(https://bunnyhop.lol/custom-css/themes/magical-rounded-700.woff2) format("woff2"); }
@font-face { font-family: "Magical Rounded"; font-weight: 750 1000; src: url(https://bunnyhop.lol/custom-css/themes/magical-rounded-800.woff2) format("woff2"); }

:root {
  /* Options (the pasted file sets these). No picture unless one is set: a transparent pixel. */
  --magical-accent: #ff8fc8;
  --magical-panel: #2a1a3e;
  --magical-art-on: 1;
  --magical-art: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7");
  --magical-art-size: 1;

  --mg-pink: var(--magical-accent);
  --mg-pink-hi: color-mix(in srgb, var(--magical-accent) 72%, #fff);
  --mg-pink-deep: color-mix(in srgb, var(--magical-accent) 62%, #5a1a50);
  --mg-lilac: #cdb6ff;
  --mg-gold: #ffd98a;
  --mg-gold-deep: #d7a24a;
  --mg-plum: var(--magical-panel);
  --mg-deep: color-mix(in srgb, var(--magical-panel) 58%, #07020c);
  --mg-raised: color-mix(in srgb, var(--magical-panel) 86%, #fff);
  --mg-ink: #3b1646;
  --mg-cream: #fff3f8;
  --mg-pop: "Magical Pop", "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
  --mg-round: "Magical Rounded", "Arial Rounded MT Bold", "Segoe UI", sans-serif;

  /* Shapes, as data: URLs. One heart, one four-point sparkle (gold), one ribbon bow (its loops have holes). */
  --mg-heart: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 22'%3E%3Cpath d='M12 21C5.2 15.9 1 12 1 7.4 1 4 3.6 1.4 6.8 1.4c2.1 0 4 1.1 5.2 2.9 1.2-1.8 3.1-2.9 5.2-2.9C20.4 1.4 23 4 23 7.4 23 12 18.8 15.9 12 21z'/%3E%3C/svg%3E");
  --mg-spark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23ffd98a' d='M12 0C12.9 7.6 16.4 11.1 24 12 16.4 12.9 12.9 16.4 12 24 11.1 16.4 7.6 12.9 0 12 7.6 11.1 11.1 7.6 12 0z'/%3E%3C/svg%3E");
  --mg-spark-white: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff3f8' d='M12 0C12.9 7.6 16.4 11.1 24 12 16.4 12.9 12.9 16.4 12 24 11.1 16.4 7.6 12.9 0 12 7.6 11.1 11.1 7.6 12 0z'/%3E%3C/svg%3E");
  --mg-bow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 40'%3E%3Cpath fill-rule='evenodd' d='M30 17C22 5 6 1 4 11c-2 10 14 15 26 9zM25 16C19 9 10 7 9.5 11.5 9 16 18 18 25 16zM34 17C42 5 58 1 60 11c2 10-14 15-26 9zM39 16C45 9 54 7 54.5 11.5 55 16 46 18 39 16zM27 13h10a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H27a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2zM28 22l-8 16 5-2 3 4 4-17zM36 22l8 16-5-2-3 4-4-17z'/%3E%3C/svg%3E");
  /* Magic dust: a tile of small sparkles and dots in gold, cream and pink. */
  --mg-dust: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='320'%3E%3Cdefs%3E%3Cpath id='s' d='M12 0C12.9 7.6 16.4 11.1 24 12 16.4 12.9 12.9 16.4 12 24 11.1 16.4 7.6 12.9 0 12 7.6 11.1 11.1 7.6 12 0z'/%3E%3C/defs%3E%3Cuse href='%23s' transform='translate(40 52) scale(.55)' fill='%23ffd98a' opacity='.7'/%3E%3Cuse href='%23s' transform='translate(212 30) scale(.32)' fill='%23fff3f8' opacity='.55'/%3E%3Cuse href='%23s' transform='translate(150 168) scale(.42)' fill='%23ff9fd0' opacity='.5'/%3E%3Cuse href='%23s' transform='translate(268 236) scale(.6)' fill='%23ffd98a' opacity='.55'/%3E%3Cuse href='%23s' transform='translate(70 262) scale(.3)' fill='%23fff3f8' opacity='.5'/%3E%3Ccircle cx='118' cy='92' r='1.6' fill='%23fff3f8' opacity='.5'/%3E%3Ccircle cx='250' cy='120' r='1.2' fill='%23ffd98a' opacity='.6'/%3E%3Ccircle cx='30' cy='180' r='1.4' fill='%23ff9fd0' opacity='.5'/%3E%3Ccircle cx='190' cy='292' r='1.6' fill='%23fff3f8' opacity='.45'/%3E%3Ccircle cx='300' cy='70' r='1' fill='%23fff3f8' opacity='.5'/%3E%3C/svg%3E");
  /* A satin ribbon: the accent with a stitched line along each edge. */
  --mg-stitch: color-mix(in srgb, var(--mg-cream) 70%, transparent);
  --mg-ribbon:
    linear-gradient(90deg, var(--mg-stitch) 0 55%, transparent 0) 0 0.22em / 0.55em 0.09em repeat-x,
    linear-gradient(90deg, var(--mg-stitch) 0 55%, transparent 0) 0 calc(100% - 0.22em) / 0.55em 0.09em repeat-x,
    var(--mg-pink);
  /* Swallowtail ends for ribbons. */
  --mg-tails: polygon(0 0, 100% 0, calc(100% - 0.55em) 50%, 100% 100%, 0 100%, 0.55em 50%);

  /* The game's palette, in the theme's colours. */
  --ink-0: var(--mg-deep);
  --ink-1: var(--mg-plum);
  --ink-2: color-mix(in srgb, var(--magical-panel) 90%, #fff);
  --ink-3: color-mix(in srgb, var(--magical-panel) 82%, #fff);
  --ink-4: color-mix(in srgb, var(--magical-panel) 72%, #fff);
  --cream: var(--mg-cream);
  --cream-2: color-mix(in srgb, var(--mg-lilac) 72%, var(--mg-cream));
  --cream-3: color-mix(in srgb, var(--mg-lilac) 55%, var(--magical-panel));
  --amber: var(--mg-pink);
  --amber-hi: var(--mg-pink-hi);
  --amber-deep: var(--mg-pink-deep);
  --amber-ink: var(--mg-ink);
  --amber-wash: color-mix(in srgb, var(--magical-accent) 14%, transparent);
  --accent: var(--mg-pink);
  --carrot: #ffab8a;
  --wr: var(--mg-gold);
  --gain: #7ff0b8;
  --loss: #ff6f93;
  --sync-ok: var(--mg-gold);
  --zone-start: #7ff0b8;
  --ghost: #a9c8ff;
  --tier-1: #9ff0c4; --tier-2: #8fe6f2; --tier-3: #ffe58a; --tier-4: #ffbf8f; --tier-5: #ff96ad; --tier-6: #d6adff; --tier-7: #aab3ff;
  --scrim: color-mix(in srgb, var(--mg-deep) 80%, transparent);
  --font-ui: var(--mg-round);
  --font-text: var(--mg-round);
  --hud-font: var(--mg-round);
  --r-1: 0.4rem; --r-2: 0.75rem; --r-3: 1.15rem;

  /* Variables that aren't in the reference (they may change). */
  --panel: color-mix(in srgb, var(--magical-panel) 95%, transparent);
  --panel-solid: var(--magical-panel);
  --line: color-mix(in srgb, var(--mg-lilac) 13%, transparent);
  --line-2: color-mix(in srgb, var(--mg-lilac) 26%, transparent);
  --raise: color-mix(in srgb, var(--mg-lilac) 7%, transparent);
  --raise-2: color-mix(in srgb, var(--mg-lilac) 12%, transparent);
  --raise-3: color-mix(in srgb, var(--mg-lilac) 18%, transparent);
  --dot: var(--mg-pink);
  --ring: 0 0 0 2px var(--mg-deep), 0 0 0 4px var(--mg-pink);
  --lean: 0px;
}

/* ------------------------------------------------------------------ the heart that hops between entries */

/* The game's hop indicator (a dot that hops to the entry you point at) becomes a heart. (.hop-ind, .hop-dot: class
   names that may change.) */
.hop-ind { width: 0.95rem; height: 0.88rem; margin: -0.44rem 0 0 -0.48rem; }
.hop-dot {
  border-radius: 0; box-shadow: none; background: var(--mg-pink);
  -webkit-mask: var(--mg-heart) center / contain no-repeat; mask: var(--mg-heart) center / contain no-repeat;
}

/* ------------------------------------------------------------------ main menu: ribbons on a twilight sky */

body[data-screen="home"] #grid-bg { display: none; }
/* Twilight over the left of the scene, with magic dust. (#overlay and its ::after are not in the reference; they may
   change.) */
body[data-screen="home"] #overlay::after {
  opacity: 1 !important;
  background:
    var(--mg-dust) 0 0 / 27rem 27rem,
    var(--mg-dust) 11rem 7rem / 17rem 17rem,
    linear-gradient(90deg, var(--mg-deep) 0, color-mix(in srgb, var(--mg-plum) 88%, transparent) 30%, color-mix(in srgb, var(--mg-plum) 35%, transparent) 62%, color-mix(in srgb, var(--mg-deep) 55%, transparent)) !important;
}

/* The name in the round pop type with a flat two-step shadow, sparkles where the hop trail was, and the tagline on a
   ribbon. (.home-brand, .brand-row, .wordmark, .tagline, .hop-trail: class names that may change.) */
body[data-screen="home"] .hop-trail { display: none; }
body[data-screen="home"] .brand-row { position: relative; }
body[data-screen="home"] .wordmark { font-size: 3.1rem; gap: 0.18em; }
body[data-screen="home"] .wordmark .wm-text {
  font-family: var(--mg-pop); font-weight: 400; letter-spacing: 0.01em;
  text-shadow: 0.045em 0.055em 0 var(--mg-pink-deep), 0.09em 0.11em 0 var(--mg-deep);
}
body[data-screen="home"] .wordmark .wm-name { color: var(--mg-cream); }
body[data-screen="home"] .wordmark .wm-tld { color: var(--mg-pink); text-shadow: 0.045em 0.055em 0 var(--mg-ink), 0.09em 0.11em 0 var(--mg-deep); }
body[data-screen="home"] .wordmark .logo-mark { width: 0.95em; height: 0.95em; filter: drop-shadow(0.05em 0.06em 0 var(--mg-deep)); }
body[data-screen="home"] .brand-row::after {
  content: ""; position: absolute; left: calc(100% + 0.6rem); top: -0.4rem; width: 4.2rem; height: 3.6rem; pointer-events: none;
  background: var(--mg-spark) 0.3rem 0.5rem / 1.9rem no-repeat, var(--mg-spark-white) 2.5rem 0 / 0.9rem no-repeat, var(--mg-spark) 2.7rem 2.3rem / 1.1rem no-repeat;
}
body[data-screen="home"] .tagline {
  margin-top: 1.1rem; padding: 0.42em 1.5em 0.46em; width: max-content; max-width: 100%;
  font: 800 0.98rem var(--mg-round); color: var(--mg-ink); text-shadow: none;
  background: var(--mg-ribbon); clip-path: var(--mg-tails);
}

/* Menu entries: rounded capitals in cream; the one you point at turns pink (the heart hops to it). */
body[data-screen="home"] .home-menu { margin-top: 1.9rem; gap: 0.05rem; }
body[data-screen="home"] [data-item] { padding: 0.18rem 0.75rem; color: var(--mg-cream); border-radius: 99rem; transform: none; transition: color 0.12s, background 0.12s; }
body[data-screen="home"] [data-item] .mb-title { font: 800 1.42rem/1.2 var(--mg-round); letter-spacing: 0.02em; text-shadow: 0 0.08em 0 var(--mg-deep); }
body[data-screen="home"] [data-item] small, body[data-screen="home"] [data-item] small b { font: 700 0.85rem var(--mg-round); color: var(--cream-2); }
body[data-screen="home"] [data-item]:hover:not(:disabled), body[data-screen="home"] [data-item]:focus-visible {
  color: var(--mg-pink); background: color-mix(in srgb, var(--mg-lilac) 9%, transparent); transform: none;
}
body[data-screen="home"] [data-item]:hover small b { color: var(--mg-gold); }
/* Play: a stitched satin capsule with a sparkle pinned to it. */
body[data-screen="home"] :is([data-item="play"], [data-item="play-online"]) {
  position: relative; margin: 0 0 0.85rem; padding: 0.5rem 1.6rem 0.55rem; color: var(--mg-ink); background: var(--mg-pink);
  border-radius: 99rem; clip-path: none; box-shadow: 0 0.28rem 0 var(--mg-pink-deep), 0 0.55rem 0 color-mix(in srgb, var(--mg-deep) 70%, transparent);
}
body[data-screen="home"] :is([data-item="play"], [data-item="play-online"])::before {
  content: ""; position: absolute; inset: 0.3rem; border-radius: 99rem; pointer-events: none;
  border: 0.13rem dashed color-mix(in srgb, var(--mg-cream) 75%, transparent);
}
body[data-screen="home"] :is([data-item="play"], [data-item="play-online"])::after {
  content: ""; position: absolute; right: -0.65rem; top: -0.95rem; width: 2.2rem; height: 2.2rem; pointer-events: none;
  background: var(--mg-spark) center / contain no-repeat; filter: drop-shadow(0.1rem 0.12rem 0 var(--mg-deep));
  animation: mg-twinkle 2.6s ease-in-out infinite;
}
body[data-screen="home"] :is([data-item="play"], [data-item="play-online"]) .mb-title { font: 400 2.25rem/1.1 var(--mg-pop); letter-spacing: 0.04em; text-shadow: none; }
body[data-screen="home"] :is([data-item="play"], [data-item="play-online"]) .mb-hint {
  padding: 0.1rem 0.55rem; border-radius: 99rem; color: var(--mg-pink-hi); background: var(--mg-ink);
  font: 800 0.78rem var(--mg-round); letter-spacing: 0.04em;
}
body[data-screen="home"] :is([data-item="play"], [data-item="play-online"]):hover:not(:disabled), body[data-screen="home"] :is([data-item="play"], [data-item="play-online"]):focus-visible { color: var(--mg-ink); background: var(--mg-pink-hi); }
body[data-screen="home"] :is([data-item="play"], [data-item="play-online"]):active { transform: translateY(0.2rem); box-shadow: 0 0.08rem 0 var(--mg-pink-deep), 0 0.3rem 0 color-mix(in srgb, var(--mg-deep) 70%, transparent); }
/* Two play buttons, the longer label sets the size. Play online carries the player count (in the button's ink), so no
   key beside it. */
body[data-screen="home"] :is([data-item="play"], [data-item="play-online"]) .mb-title { font-size: 2rem; }
body[data-screen="home"] [data-item="play-online"] small { color: color-mix(in srgb, var(--mg-ink) 72%, transparent); }
body[data-screen="home"] [data-item="play-online"] .mb-hint { display: none; }
@keyframes mg-twinkle { 0%, 100% { transform: scale(1) rotate(0deg); } 50% { transform: scale(0.72) rotate(20deg); } }
body.potato :is([data-item="play"], [data-item="play-online"])::after { animation: none; }
@media (prefers-reduced-motion: reduce) { body :is([data-item="play"], [data-item="play-online"])::after { animation: none; } }

/* Footer: plum capsules with a lilac rim, pink when pointed at. (.home-foot, .home-act, .home-link, .account: class
   names that may change.) */
body[data-screen="home"] .home-act {
  height: 2.5rem; padding: 0 1.15rem; border-radius: 99rem; color: var(--mg-cream);
  background: color-mix(in srgb, var(--mg-deep) 80%, transparent); box-shadow: inset 0 0 0 0.13rem color-mix(in srgb, var(--mg-lilac) 45%, transparent);
  font: 800 1rem var(--mg-round);
}
body[data-screen="home"] .home-act:hover, body[data-screen="home"] .home-act:focus-visible { color: var(--mg-ink); background: var(--mg-pink); box-shadow: inset 0 0 0 0.13rem var(--mg-pink); }
body[data-screen="home"] :is(.act-support svg path:last-child, .act-discord svg) { color: currentColor; fill: currentColor; }
body[data-screen="home"] .home-link { font: 700 0.88rem var(--mg-round); color: var(--cream-2); }
body[data-screen="home"] .home-link:hover { color: var(--mg-pink); }
body[data-screen="home"] .account .name-btn { font: 800 1rem var(--mg-round); }
/* The footer's buttons wrap under the name before they reach the picture in the corner (a guest's name with Save
   progress is long), so the picture never covers one. */
body[data-screen="home"] .home-foot { max-width: calc(39.5vw - 0.6rem); }
body[data-screen="home"] .account .save-progress { font: 800 0.95rem var(--mg-round); color: var(--mg-gold); }

/* Map tiles: photocards with a lace edge. The tier is a heart in the tier's colour. (.home-right, .home-grid,
   .home-tile*: class names that may change.) */
body[data-screen="home"] .home-right::before { display: none; }
body[data-screen="home"] .home-grid { gap: 1.1rem 0.9rem; }
body[data-screen="home"] .home-tile {
  position: relative; gap: 0.3rem; padding: 0.4rem 0.4rem 0.95rem; border-radius: 0.95rem 0.95rem 0 0;
  background: var(--mg-raised); transition: transform 0.15s var(--ease-land), background 0.15s;
  -webkit-mask: linear-gradient(#000 0 0) top / 100% calc(100% - 0.45rem) no-repeat, radial-gradient(circle at 50% 0, #000 0.45rem, #0000 0.47rem) bottom / 0.9rem 0.45rem repeat-x;
  mask: linear-gradient(#000 0 0) top / 100% calc(100% - 0.45rem) no-repeat, radial-gradient(circle at 50% 0, #000 0.45rem, #0000 0.47rem) bottom / 0.9rem 0.45rem repeat-x;
}
body[data-screen="home"] .home-tile-art { border-radius: 0.65rem; box-shadow: none; }
body[data-screen="home"] .home-tile:hover, body[data-screen="home"] .home-tile:focus-visible { transform: translateY(-0.3rem) rotate(-0.6deg); background: var(--mg-pink); }
body[data-screen="home"] .home-tile:hover .home-tile-art, body[data-screen="home"] .home-tile:focus-visible .home-tile-art { transform: none; box-shadow: none; }
body[data-screen="home"] .home-tile-text { padding: 0 0.3rem; text-shadow: none; }
body[data-screen="home"] .home-tile-name b { font: 800 0.98rem/1.25 var(--mg-round); color: var(--mg-cream); }
body[data-screen="home"] .home-tile-times { font: 700 0.84rem var(--mg-round); }
body[data-screen="home"] .home-tile-times small { font: 800 0.7rem var(--mg-round); color: var(--cream-3); letter-spacing: 0.04em; }
body[data-screen="home"] .home-tile-times b, body[data-screen="home"] .home-tile-times b.wr { color: var(--mg-gold); font-weight: 800; }
body[data-screen="home"] .home-tile:is(:hover, :focus-visible) :is(.home-tile-name b, .home-tile-times b, .home-tile-times b.wr, .home-tile-times small) { color: var(--mg-ink); }
body[data-screen="home"] .home-tile .home-tile-tier {
  --mg-tc: var(--tier-x);
  position: absolute; left: 0.7rem; top: 0.65rem; display: grid; place-items: center; width: 2.1rem; height: 1.95rem; padding-bottom: 0.25rem;
  color: var(--mg-ink); background: var(--mg-tc); font: 800 0.72rem var(--mg-round);
  -webkit-mask: var(--mg-heart) center / contain no-repeat; mask: var(--mg-heart) center / contain no-repeat;
}
body[data-screen="home"] .home-tile .home-tile-tier.t1 { --mg-tc: var(--tier-1); }
body[data-screen="home"] .home-tile .home-tile-tier.t2 { --mg-tc: var(--tier-2); }
body[data-screen="home"] .home-tile .home-tile-tier.t3 { --mg-tc: var(--tier-3); }
body[data-screen="home"] .home-tile .home-tile-tier.t4 { --mg-tc: var(--tier-4); }
body[data-screen="home"] .home-tile .home-tile-tier.t5 { --mg-tc: var(--tier-5); }
body[data-screen="home"] .home-tile .home-tile-tier.t6 { --mg-tc: var(--tier-6); }
body[data-screen="home"] .home-tile .home-tile-tier.t7 { --mg-tc: var(--tier-7); }

/* A record's tier stays a plain label beside the map (it shares the tiles' class). */
#home-records .home-tile-tier { font: 800 0.8rem var(--mg-round); }

/* The Daily Challenge on the main menu (#home-daily): today's map is a photocard, Play a small ribbon on it, the
   fastest today in gold. (.home-daily-*: class names that may change.) */
#home-daily [data-part="left"] { font: 800 0.82rem var(--mg-round); color: var(--mg-gold); }
#home-daily [data-part="style"] { color: var(--mg-pink-hi); }
#home-daily [data-part="map"] .home-daily-play { padding: 0.05rem 0.55rem 0.05rem 0.7rem; border-radius: 99rem; color: var(--mg-ink); background: var(--mg-pink); font: 800 0.78rem var(--mg-round); }
#home-daily [data-part="map"]:is(:hover, :focus-visible) .home-daily-play { color: var(--mg-pink-hi); background: var(--mg-ink); }
#home-daily [data-part="top"] .home-daily-rank { font: 400 1rem var(--mg-pop); color: var(--mg-lilac); }
#home-daily [data-part="top"] li:first-child .home-daily-rank { color: var(--mg-gold); }
#home-daily :is([data-part="player"] b, [data-part="you"] span) { font-weight: 800; }

/* ------------------------------------------------------------------ the picture: in front of a moon, with sparkles */

/* #custom-art itself carries the sparkles, ::before the moon (a pale disc in a gold ring), ::after the picture.
   --mg-w is the moon's size; the picture stands on its lower half and over its top. */
#custom-art {
  --mg-on: clamp(0, var(--magical-art-on), 1);
  --mg-w: calc(13vw * var(--magical-art-size) * var(--mg-on)); --mg-x: 47vw; --mg-y: 9vh;
  z-index: 30; opacity: var(--mg-on);
  background:
    var(--mg-spark) calc(var(--mg-x) - var(--mg-w) * 0.12) calc(100% - var(--mg-y) - var(--mg-w) * 0.86) / calc(var(--mg-w) * 0.16) no-repeat,
    var(--mg-spark-white) calc(var(--mg-x) + var(--mg-w) * 1.02) calc(100% - var(--mg-y) - var(--mg-w) * 1.02) / calc(var(--mg-w) * 0.08) no-repeat,
    var(--mg-spark) calc(var(--mg-x) + var(--mg-w) * 1.08) calc(100% - var(--mg-y) - var(--mg-w) * 0.3) / calc(var(--mg-w) * 0.11) no-repeat;
}
body.in-game:not(.menu-open) #custom-art { --mg-w: calc(8vw * var(--magical-art-size) * var(--mg-on)); --mg-x: calc(100vw - var(--mg-w) - 3vw); --mg-y: 4vh; }
#custom-art::before, #custom-art::after { content: ""; position: absolute; pointer-events: none; }
#custom-art::before {
  left: var(--mg-x); bottom: var(--mg-y); width: var(--mg-w); height: var(--mg-w); border-radius: 50%;
  background: radial-gradient(circle at 36% 32%, #fff7fb, color-mix(in srgb, var(--mg-pink) 30%, #f4e9ff) 70%);
  box-shadow: 0 0 0 calc(var(--mg-w) * 0.025) var(--mg-deep), 0 0 0 calc(var(--mg-w) * 0.045) var(--mg-gold), 0 0 0 calc(var(--mg-w) * 0.06) var(--mg-deep);
  opacity: 0.92;
}
#custom-art::after {
  left: calc(var(--mg-x) - var(--mg-w) * 0.2); bottom: calc(var(--mg-y) - var(--mg-w) * 0.06); width: calc(var(--mg-w) * 1.4); height: calc(var(--mg-w) * 1.4);
  background: var(--magical-art) bottom center / contain no-repeat;
}
body:not([data-screen="home"]).menu-open #custom-art { display: none; }

/* ------------------------------------------------------------------ panels: the pause menu, settings, leaderboards */

/* Full-screen menus: twilight in the middle instead of the grey scrim. (The #overlay background is not in the
   reference; it may change.) */
body:not([data-screen="home"]) #grid-bg { opacity: 0.35; }
body:not(.in-game):not([data-screen="home"]):not([data-screen="loading"]) #overlay::after,
body.in-game:not([data-screen="pause"]):not([data-screen="loading"]) #overlay {
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--mg-deep) 55%, transparent), color-mix(in srgb, var(--mg-deep) 92%, transparent) max(0%, 50% - 44rem), color-mix(in srgb, var(--mg-deep) 95%, transparent) 50%, color-mix(in srgb, var(--mg-deep) 92%, transparent) min(100%, 50% + 44rem), color-mix(in srgb, var(--mg-deep) 55%, transparent)) !important;
}
/* Titles of the full-screen menus (settings, maps, profile...) on a ribbon. (.screen-title: may change.) */
#overlay .screen-title h2 {
  padding: 0.12em 1.05em 0.2em; color: var(--mg-ink); background: var(--mg-ribbon); clip-path: var(--mg-tails);
  font: 400 2rem/1.2 var(--mg-pop); letter-spacing: 0.02em;
}

/* The pause menu: a rail and a panel, each with a stitched seam inside its edge and a bow on top. (.pause-rail,
   .pause-panel, .pause-map, .rail-item: class names that may change.) */
body[data-screen="pause"] :is(.pause-rail, .pause-panel) {
  position: relative; border-radius: 1.15rem; background: color-mix(in srgb, var(--mg-plum) 96%, transparent);
  box-shadow: inset 0 0 0 0.14rem color-mix(in srgb, var(--mg-lilac) 30%, transparent), 0 0.5rem 0 color-mix(in srgb, var(--mg-deep) 75%, transparent);
  outline: 0.12rem dashed color-mix(in srgb, var(--mg-pink) 45%, transparent); outline-offset: -0.5rem;
}
body[data-screen="pause"] .pause-rail::before {
  content: ""; position: absolute; left: 50%; top: -0.15rem; width: 3.6rem; height: 2.25rem; translate: -50% 0; z-index: 2; pointer-events: none;
  background: var(--mg-pink); -webkit-mask: var(--mg-bow) center / contain no-repeat; mask: var(--mg-bow) center / contain no-repeat;
}
body[data-screen="pause"] .pause-head { padding-top: 1.35rem; }
body[data-screen="pause"] .pause-map { font: 400 1.2rem/1.3 var(--mg-pop); color: var(--mg-cream); }
body[data-screen="pause"] [data-item] { border-radius: 99rem; font: 700 1rem var(--mg-round); }
body[data-screen="pause"] [data-item]:hover:not(:disabled), body[data-screen="pause"] [data-item]:focus-visible { color: var(--mg-pink); background: color-mix(in srgb, var(--mg-lilac) 10%, transparent); box-shadow: none; }
body[data-screen="pause"] [data-item]:hover .ri-icon { color: var(--mg-pink); }
body[data-screen="pause"] [data-item].primary {
  position: relative; clip-path: none; color: var(--mg-ink); background: var(--mg-pink); font: 400 1.25rem var(--mg-pop);
  box-shadow: 0 0.2rem 0 var(--mg-pink-deep);
}
body[data-screen="pause"] [data-item].primary::after { content: ""; position: absolute; inset: 0.22rem; border-radius: 99rem; border: 0.11rem dashed color-mix(in srgb, var(--mg-cream) 70%, transparent); pointer-events: none; }
body[data-screen="pause"] [data-item].primary :is(.ri-icon, kbd) { color: var(--mg-ink); }
body[data-screen="pause"] [data-item].primary:hover:not(:disabled) { color: var(--mg-ink); background: var(--mg-pink-hi); box-shadow: 0 0.2rem 0 var(--mg-pink-deep); }
body[data-screen="pause"] [data-item="main-menu"] { border: 0; color: var(--mg-cream); background: none; box-shadow: inset 0 0 0 0.13rem color-mix(in srgb, var(--mg-lilac) 40%, transparent); }
body[data-screen="pause"] [data-item="main-menu"]:hover:not(:disabled) { color: var(--mg-ink); background: var(--loss); box-shadow: none; }
body[data-screen="pause"] [data-item="main-menu"]:hover .ri-icon { color: var(--mg-ink); }

/* Leaderboards (the pause panel's board and the map board): the top three get a gold, a cream and a pink heart
   by the place. (.rb-row, .top1 ... .top3: class names that may change.) */
.rb-row:is(.top1, .top2, .top3) > td:first-child { position: relative; }
.rb-row:is(.top1, .top2, .top3) > td:first-child::after {
  content: ""; position: absolute; left: 0.15rem; top: 50%; width: 0.62rem; height: 0.58rem; translate: 0 -50%;
  background: var(--mg-gold); -webkit-mask: var(--mg-heart) center / contain no-repeat; mask: var(--mg-heart) center / contain no-repeat;
}
.rb-row.top2 > td:first-child::after { background: var(--mg-cream); }
.rb-row.top3 > td:first-child::after { background: var(--mg-pink); }
/* Ranks already sets its top three apart (big numbers, coloured bars): no hearts there. (.ranks: may change.) */
.ranks .rb-row:is(.top1, .top2, .top3) > td:first-child::after { display: none; }

/* ------------------------------------------------------------------ HUD: ten hearts of speed */

#hud [data-el] { --shadow-text: 0 0.07em 0 var(--mg-deep), 0 0 0.18em color-mix(in srgb, var(--mg-deep) 80%, transparent); color: var(--mg-cream); }
/* Speed: big round numbers, and over them ten hearts that fill to 1000 u/s (the live number --hud-speed). With the
   run's sync (--hud-sync) above 70% they warm from pink to gold. */
#hud [data-el="speed"] { --shadow-text: 0.04em 0.05em 0 var(--mg-pink-deep), 0.07em 0.09em 0 var(--mg-deep); font-family: var(--mg-pop); }
#hud [data-el="speed"] * { font-weight: 400 !important; }
#hud [data-el="speed"] .unit { font-family: var(--mg-round); font-weight: 800 !important; color: var(--mg-lilac); opacity: 1; }
#hud [data-el="speed"]::after {
  content: ""; position: absolute; left: 50%; bottom: 100%; width: 10.5em; height: 0.92em; margin-bottom: 0.3em; translate: -50% 0; pointer-events: none;
  --mg-fill: color-mix(in srgb, var(--mg-gold) calc(clamp(0, (var(--hud-sync, 0) - 70) * 4, 100) * 1%), var(--mg-pink));
  background:
    linear-gradient(var(--mg-fill), var(--mg-fill)) left / calc(min(var(--hud-speed, 0), 1000) * 0.1%) 100% no-repeat,
    color-mix(in srgb, var(--mg-deep) 72%, transparent);
  -webkit-mask: var(--mg-heart) left / 1.05em 0.92em repeat-x; mask: var(--mg-heart) left / 1.05em 0.92em repeat-x;
}
/* Timer: cream numbers in a plum capsule with a gold rim and a bow tied on its left end. */
#hud [data-el="timer"] { font-family: var(--mg-round); }
#hud [data-el="timer"] * { font-weight: 800; }
#hud [data-el="timer"] .t-lead { color: var(--mg-lilac); opacity: 0.9; }
#hud [data-el="timer"]::before {
  content: ""; position: absolute; inset: -0.2em -0.85em -0.25em; z-index: -1; border-radius: 99em;
  background: color-mix(in srgb, var(--mg-deep) 82%, transparent); box-shadow: inset 0 0 0 0.11em var(--mg-gold);
}
#hud [data-el="timer"]::after {
  content: ""; position: absolute; right: calc(100% + 0.4em); top: 50%; width: 2.1em; height: 1.3em; translate: 0 -50%; rotate: -14deg; pointer-events: none;
  background: var(--mg-pink); -webkit-mask: var(--mg-bow) center / contain no-repeat; mask: var(--mg-bow) center / contain no-repeat;
}
/* Map line: a ribbon with swallowtail ends. (The parts inside may change.) */
#hud [data-el="map"]::before { content: ""; position: absolute; inset: -0.4em -1.15em -0.42em; z-index: -1; background: var(--mg-ribbon); clip-path: var(--mg-tails); }
#hud [data-el="map"] { --shadow-text: none; color: var(--mg-ink); font-family: var(--mg-round); font-weight: 800; }
#hud [data-el="map"] * { color: inherit !important; opacity: 1 !important; text-shadow: none !important; }
#hud [data-el="pb"]::before { content: ""; position: absolute; inset: -0.32em -0.75em; z-index: -1; border-radius: 99em; background: color-mix(in srgb, var(--mg-deep) 82%, transparent); box-shadow: inset 0 0 0 0.1em color-mix(in srgb, var(--mg-lilac) 45%, transparent); }
#hud [data-el="pb"] { font-family: var(--mg-round); font-weight: 800; }
#hud [data-el="pb"] small { color: var(--mg-gold) !important; opacity: 1 !important; }
#hud :is([data-el="split"], [data-el="stats"], [data-el="track"], [data-el="stage"]) { font-family: var(--mg-round); font-weight: 800; }
#hud [data-el="stats"] * { color: var(--cream-2) !important; }
#hud [data-el="stats"] b { color: var(--mg-cream) !important; }
/* The keys overlay sets its colours from Settings on .keys itself (a class that may change); the theme wins with !important. */
#hud [data-el="keys"] .keys { --k-on: var(--mg-pink) !important; --k-idle: var(--mg-cream) !important; }
#hud [data-el="keys"] { font-family: var(--mg-round); font-weight: 800; }
/* (.keys .k: class names that may change.) */
#hud [data-el="keys"] .k { background: color-mix(in srgb, var(--mg-deep) 70%, transparent); border: 0.1em solid color-mix(in srgb, var(--mg-lilac) 45%, transparent); border-radius: 0.6em; }
#hud [data-el="keys"] .k.on { background: var(--mg-pink); border-color: var(--mg-pink-hi); color: var(--mg-ink); }

/* Chat: each line on a small plum capsule. (.chat-line and its kinds: class names that may change.) */
#hud [data-el="chat"] { font-family: var(--mg-round); font-weight: 700; }
#hud .chat-line { width: max-content; max-width: 100%; padding: 0.12em 0.65em; border-radius: 0.8em; background: color-mix(in srgb, var(--mg-deep) 72%, transparent); text-shadow: none; }
#hud .chat-line.server { color: var(--mg-gold); }
#hud .chat-line.local { color: var(--mg-lilac); }
#hud .chat-line.announce { background: color-mix(in srgb, var(--mg-deep) 80%, transparent); box-shadow: inset 0 0 0 0.1em var(--tone, var(--mg-pink)); }
#hud .chat-line.tone-pb { --tone: var(--mg-pink); color: var(--mg-pink-hi); }
#hud .chat-form { border-radius: 99em; }

/* The map vote (#mp-menu[data-menu="vote"]) and the other numbered menus: a plum plate with a stitched seam, the
   numbers in the pop type, your vote a pink capsule. (.mm-title, .mm-label, .mm-detail: class names that may change.) */
#hud #mp-menu {
  border: 0; border-radius: 1.1em; padding: 0.85em 1.1em; color: var(--mg-cream); font-family: var(--mg-round); font-weight: 700;
  background: color-mix(in srgb, var(--mg-plum) 92%, transparent);
  box-shadow: inset 0 0 0 0.14em color-mix(in srgb, var(--mg-lilac) 30%, transparent), 0 0.4em 0 color-mix(in srgb, var(--mg-deep) 75%, transparent);
  outline: 0.1em dashed color-mix(in srgb, var(--mg-pink) 45%, transparent); outline-offset: -0.42em;
}
#hud #mp-menu .mm-title { font: 400 1.15em var(--mg-pop); color: var(--mg-pink-hi); }
#hud #mp-menu .mm-key { font: 400 1em var(--mg-pop); color: var(--mg-gold); }
#hud #mp-menu .mm-item { border-radius: 99em; padding: 0.1em 0.6em; margin: 0 -0.4em; }
#hud #mp-menu .mm-item.sel { color: var(--mg-ink); background: var(--mg-pink); }
#hud #mp-menu .mm-item.sel :is(.mm-key, .mm-detail) { color: var(--mg-ink); }
#hud #mp-menu :is(.mm-detail, .mm-footer) { color: var(--cream-2); }

/* The Tab scoreboard, in a server: the pause panel's look. (#mp-scoreboard and .sb-*: names that may change.) */
#mp-scoreboard {
  border: 0; border-radius: 1.15em; background: color-mix(in srgb, var(--mg-plum) 94%, transparent); font-family: var(--mg-round);
  box-shadow: inset 0 0 0 0.14em color-mix(in srgb, var(--mg-lilac) 30%, transparent), 0 0.45em 0 color-mix(in srgb, var(--mg-deep) 75%, transparent);
  outline: 0.12em dashed color-mix(in srgb, var(--mg-pink) 45%, transparent); outline-offset: -0.5em;
}
#mp-scoreboard .sb-room b { font: 400 1.25em var(--mg-pop); }
#mp-scoreboard .sb-map b { font-weight: 800; }
#mp-scoreboard .sb-table th { font-weight: 800; color: var(--cream-3); }
#mp-scoreboard .sb-table td { border-top-color: var(--line); font-weight: 700; }
#mp-scoreboard .sb-table tr.you td { background: color-mix(in srgb, var(--mg-pink) 13%, transparent); }
#mp-scoreboard .sb-table tr.you td:first-child { box-shadow: inset 0.22em 0 0 var(--mg-pink); }
#mp-scoreboard .sb-dot { width: 0.75em; height: 0.68em; border-radius: 0; -webkit-mask: var(--mg-heart) center / contain no-repeat; mask: var(--mg-heart) center / contain no-repeat; }
#mp-scoreboard .sb-pb { color: var(--mg-gold); }

/* ------------------------------------------------------------------ the finish: the time, a gold stamp, sparkles */

/* (#hud-endcard and .ec-*: names that may change.) */
#hud-endcard { font-family: var(--mg-round); }
#hud-endcard .ec-time {
  font-family: var(--mg-pop); font-weight: 400; color: var(--mg-cream); letter-spacing: 0;
  text-shadow: 0.04em 0.05em 0 var(--mg-pink-deep), 0.08em 0.1em 0 var(--mg-deep) !important;
}
#hud-endcard .ec-time .t-lead { opacity: 1; color: var(--mg-lilac); }
#hud-endcard.slow .ec-time { color: color-mix(in srgb, var(--mg-cream) 85%, var(--mg-lilac)); }
#hud-endcard .ec-time::before, #hud-endcard .ec-time::after { content: ""; position: absolute; pointer-events: none; background: var(--mg-spark) center / contain no-repeat; filter: drop-shadow(0.03em 0.04em 0 var(--mg-deep)); }
#hud-endcard .ec-time::before { left: -0.42em; top: -0.12em; width: 0.42em; height: 0.42em; }
#hud-endcard .ec-time::after { right: -0.34em; bottom: 0.02em; width: 0.26em; height: 0.26em; background-image: var(--mg-spark-white); }
#hud-endcard.slow .ec-time::before, #hud-endcard.slow .ec-time::after { display: none; }
#hud-endcard .ec-delta { margin-top: 0.3em; font-weight: 800; }
#hud-endcard .ec-word {
  padding: 0.1em 0.75em 0.14em; border-radius: 99em; color: var(--mg-ink); background: var(--mg-gold); text-shadow: none;
  font-family: var(--mg-pop); font-weight: 400; rotate: -4deg; box-shadow: 0 0.12em 0 var(--mg-gold-deep), 0 0.24em 0 var(--mg-deep);
}
#hud-endcard .ec-card {
  border-radius: 1.1em; background: color-mix(in srgb, var(--mg-plum) 90%, transparent);
  box-shadow: inset 0 0 0 0.12em color-mix(in srgb, var(--mg-lilac) 28%, transparent);
  outline: 0.1em dashed color-mix(in srgb, var(--mg-pink) 45%, transparent); outline-offset: -0.4em;
}
#hud-endcard .ec-stats { color: var(--cream-2); font-weight: 700; }
#hud-endcard .ec-stats b { color: var(--mg-cream); font-weight: 800; }
#hud-endcard .ec-hint { color: var(--cream-2); font-weight: 700; text-shadow: 0 0.07em 0 var(--mg-deep), 0 0 0.25em var(--mg-deep); }

/* ------------------------------------------------------------------ the loadout stage: a dressing room */

/* (.lo-stage, .lo-tile, .lo-thumb: class names that may change.) */
.lo-stage, .lo-stage[data-view] {
  background:
    var(--mg-dust) 4rem 9rem / 26rem 26rem,
    radial-gradient(55% 50% at 50% 60%, color-mix(in srgb, var(--mg-pink) 16%, transparent), transparent 72%),
    linear-gradient(180deg, var(--mg-raised), var(--mg-deep));
}
.lo-stage { outline: 0.12rem dashed color-mix(in srgb, var(--mg-pink) 40%, transparent); outline-offset: -0.5rem; }
.lo-tile.on .lo-thumb { box-shadow: inset 0 0 0 0.16rem var(--mg-pink); }
.lo-thumb { background: radial-gradient(70% 70% at 50% 45%, color-mix(in srgb, var(--mg-lilac) 14%, transparent), transparent 75%), color-mix(in srgb, var(--mg-lilac) 6%, transparent); }
