/*
 * [Elysium] Marketplace — the product card, the cart, the Elysium mark and the "owned" marks.
 *
 * Layered on top of marketplace-store.css and loaded with it (MarketplaceStorefrontAssets::css()). Colours come
 * from the store palette (--em-accent and friends), so every theme and card palette keeps its look; only the
 * Elysium mark keeps the brand gold and mint of the navbar logo. Motion is decoration: everything is readable
 * without it, and it stops for prefers-reduced-motion and the theme's "animations off".
 */

@property --em-fx-angle {
    syntax: '<angle>';
    inherits: false;
    initial-value: 0deg;
}

@property --em-fx-left {
    syntax: '<percentage>';
    inherits: false;
    initial-value: 100%;
}

:root {
    --em-fx-ease: cubic-bezier(.16, .84, .24, 1);
    --em-fx-spring: cubic-bezier(.34, 1.56, .64, 1);
    --em-fx-owned: var(--elysium-color-success, #46d27e);
    --em-fx-danger: var(--elysium-color-error, #ef6a6a);
}

/* ================================================================ Elysium mark */

.em-emblem {
    --em-emblem-gold: #d7bc82;
    --em-emblem-mint: #83cdab;
    position: relative;
    display: block;
    flex: none;
    width: var(--em-emblem-size, clamp(40px, 32%, 112px));
    aspect-ratio: 1;
    pointer-events: none;
}

.em-emblem > svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.em-emblem__ring circle {
    fill: none;
    stroke: var(--em-emblem-mint);
    stroke-width: 24;
    stroke-dasharray: 157.6 172.3;
    stroke-dashoffset: -86;
}

.em-emblem__piece {
    fill: var(--em-emblem-gold);
    transform-box: fill-box;
    transform-origin: center;
}

.em-emblem__ring,
.em-emblem__star {
    transform-origin: 50% 50%;
}

/* Stars, sparks and the glow live around the mark, a little wider than it. */
.em-emblem__sky {
    position: absolute;
    inset: -30%;
    pointer-events: none;
}

.em-emblem__sky::before {
    position: absolute;
    inset: 18%;
    border-radius: 50%;
    background: radial-gradient(closest-side, color-mix(in srgb, var(--em-emblem-gold) 34%, transparent), transparent 72%);
    opacity: .45;
    content: '';
}

.em-emblem__sky i {
    position: absolute;
    width: 9%;
    aspect-ratio: 1;
    background: radial-gradient(circle, #fff 0 16%, #ffeab0 40%, var(--em-emblem-gold) 72%);
    clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
    opacity: 0;
}

.em-emblem__sky i:nth-child(1) { top: 16%; left: 8%; }
.em-emblem__sky i:nth-child(2) { top: 8%; right: 10%; width: 7%; }
.em-emblem__sky i:nth-child(3) { right: 6%; bottom: 22%; width: 11%; }
.em-emblem__sky i:nth-child(4) { bottom: 9%; left: 18%; width: 6%; }
.em-emblem__sky i:nth-child(5) { top: 2%; left: 46%; width: 6%; }
.em-emblem__sky i:nth-child(6) { top: 50%; left: 1%; width: 8%; }

/* The sparks of "orbit" and the light of "flash" and "dust". */
.em-emblem::before,
.em-emblem::after {
    position: absolute;
    pointer-events: none;
    content: none;
}

/* Twinkle: stars flash around the mark, the mark breathes and floats. */
[data-em-emblem="twinkle"] .em-emblem__sky i { animation: em-emb-twinkle 2.8s ease-in-out infinite; }
[data-em-emblem="twinkle"] .em-emblem__sky i:nth-child(2) { animation-delay: .45s; }
[data-em-emblem="twinkle"] .em-emblem__sky i:nth-child(3) { animation-delay: .95s; }
[data-em-emblem="twinkle"] .em-emblem__sky i:nth-child(4) { animation-delay: 1.4s; }
[data-em-emblem="twinkle"] .em-emblem__sky i:nth-child(5) { animation-delay: 1.85s; }
[data-em-emblem="twinkle"] .em-emblem__sky i:nth-child(6) { animation-delay: 2.3s; }
[data-em-emblem="twinkle"] .em-emblem__sky::before { animation: em-emb-breathe 3.2s ease-in-out infinite; }
[data-em-emblem="twinkle"] .em-emblem__star { animation: em-emb-float 4s ease-in-out infinite; }

/* Orbit: the ring turns slowly, a gold and a mint spark run around it. */
[data-em-emblem="orbit"] .em-emblem__ring { animation: em-emb-spin 14s linear infinite; }
[data-em-emblem="orbit"]::before {
    inset: 1%;
    border-radius: 50%;
    background:
        radial-gradient(circle at 50% 3%, #fff 0 2.4%, color-mix(in srgb, var(--em-emblem-gold) 90%, transparent) 3.6%, transparent 6.5%),
        radial-gradient(circle at 50% 97%, #fff 0 1.6%, color-mix(in srgb, var(--em-emblem-mint) 90%, transparent) 2.8%, transparent 5.2%);
    content: '';
    animation: em-emb-spin 3.6s linear infinite;
}
[data-em-emblem="orbit"] .em-emblem__sky::before { animation: em-emb-breathe 3.6s ease-in-out infinite; }

/* Assemble: the diamonds fly in one by one, the ring closes, a flash. */
[data-em-emblem="assemble"] .em-emblem__piece { animation: em-emb-assemble 3.8s var(--em-fx-ease) infinite; }
[data-em-emblem="assemble"] .em-emblem__piece--t { --em-mx: 0; --em-my: -300px; --em-rz: 30deg; }
[data-em-emblem="assemble"] .em-emblem__piece--l { --em-mx: -260px; --em-my: -60px; --em-rz: -40deg; animation-delay: .12s; }
[data-em-emblem="assemble"] .em-emblem__piece--r { --em-mx: 260px; --em-my: -60px; --em-rz: 40deg; animation-delay: .24s; }
[data-em-emblem="assemble"] .em-emblem__piece--br { --em-mx: 180px; --em-my: 260px; --em-rz: -30deg; animation-delay: .36s; }
[data-em-emblem="assemble"] .em-emblem__piece--bl { --em-mx: -180px; --em-my: 260px; --em-rz: 30deg; animation-delay: .48s; }
[data-em-emblem="assemble"] .em-emblem__ring { animation: em-emb-ring-in 3.8s var(--em-fx-ease) infinite; }
[data-em-emblem="assemble"] .em-emblem__sky i:nth-child(odd) { animation: em-emb-ping 3.8s ease-out infinite; }

/* Flash: the star gathers and opens, rays in the middle, sparks fly out. */
[data-em-emblem="flash"] .em-emblem__star { animation: em-emb-pulse 2.8s var(--em-fx-ease) infinite; }
[data-em-emblem="flash"] .em-emblem__ring { animation: em-emb-ring-glow 2.8s ease-out infinite; }
[data-em-emblem="flash"]::after {
    inset: -25%;
    background:
        radial-gradient(closest-side, rgba(255, 244, 214, .95), color-mix(in srgb, var(--em-emblem-gold) 35%, transparent) 32%, transparent 62%),
        linear-gradient(90deg, transparent 28%, rgba(255, 240, 200, .9) 50%, transparent 72%) center / 100% 3px no-repeat,
        linear-gradient(0deg, transparent 28%, rgba(255, 240, 200, .9) 50%, transparent 72%) center / 3px 100% no-repeat;
    opacity: 0;
    mix-blend-mode: screen;
    content: '';
    animation: em-emb-flare 2.8s ease-out infinite;
}
[data-em-emblem="flash"] .em-emblem__sky i { animation: em-emb-burst 2.8s var(--em-fx-ease) infinite; }
[data-em-emblem="flash"] .em-emblem__sky i:nth-child(1) { --em-dx: -40%; --em-dy: -30%; }
[data-em-emblem="flash"] .em-emblem__sky i:nth-child(2) { --em-dx: 36%; --em-dy: -40%; }
[data-em-emblem="flash"] .em-emblem__sky i:nth-child(3) { --em-dx: 40%; --em-dy: 34%; }
[data-em-emblem="flash"] .em-emblem__sky i:nth-child(4) { --em-dx: -30%; --em-dy: 40%; }
[data-em-emblem="flash"] .em-emblem__sky i:nth-child(5) { --em-dx: 0%; --em-dy: -48%; }
[data-em-emblem="flash"] .em-emblem__sky i:nth-child(6) { --em-dx: -48%; --em-dy: 0%; }

/* Stardust: a glint runs over the gold, shimmering dust rises from below. */
[data-em-emblem="dust"]::after {
    inset: 0;
    background: linear-gradient(105deg, transparent 38%, rgba(255, 249, 230, .95) 50%, transparent 62%) -160% 0 / 250% 100% no-repeat;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpath d='M257 18 318 150 257 240 195 150ZM45 258 160 190 244 251 160 322ZM269 251 354 190 468 258 354 322ZM248 282 188 398 246 492ZM264 282 325 398 266 492Z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpath d='M257 18 318 150 257 240 195 150ZM45 258 160 190 244 251 160 322ZM269 251 354 190 468 258 354 322ZM248 282 188 398 246 492ZM264 282 325 398 266 492Z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
    content: '';
    animation: em-emb-glint 2.8s ease-in-out infinite;
}
[data-em-emblem="dust"] .em-emblem__sky i {
    top: auto;
    bottom: 12%;
    width: 2.6%;
    border-radius: 50%;
    background: #ffe7a6;
    box-shadow: 0 0 6px var(--em-emblem-gold);
    clip-path: none;
    animation: em-emb-dust 3.4s linear infinite;
}
[data-em-emblem="dust"] .em-emblem__sky i:nth-child(1) { left: 22%; }
[data-em-emblem="dust"] .em-emblem__sky i:nth-child(2) { right: auto; left: 36%; animation-delay: .6s; animation-duration: 4s; }
[data-em-emblem="dust"] .em-emblem__sky i:nth-child(3) { right: auto; left: 50%; width: 3.4%; animation-delay: 1.2s; }
[data-em-emblem="dust"] .em-emblem__sky i:nth-child(4) { left: 62%; animation-delay: 1.8s; animation-duration: 3s; }
[data-em-emblem="dust"] .em-emblem__sky i:nth-child(5) { top: auto; left: 74%; animation-delay: 2.3s; }
[data-em-emblem="dust"] .em-emblem__sky i:nth-child(6) { top: auto; left: 44%; animation-delay: .3s; animation-duration: 4.2s; }
[data-em-emblem="dust"] .em-emblem__sky::before { animation: em-emb-breathe 4s ease-in-out infinite; }

/* Coin: the star turns like a coin and glows on the turn. */
[data-em-emblem="coin"] { perspective: 400px; }
[data-em-emblem="coin"] .em-emblem__star { animation: em-emb-coin 3.4s cubic-bezier(.55, 0, .25, 1) infinite; }
[data-em-emblem="coin"] .em-emblem__sky::before { animation: em-emb-coin-glow 3.4s ease-in-out infinite; }
[data-em-emblem="coin"] .em-emblem__sky i:nth-child(2),
[data-em-emblem="coin"] .em-emblem__sky i:nth-child(4) { animation: em-emb-ping 3.4s ease-out .9s infinite; }

@keyframes em-emb-twinkle {
    0%, 100% { opacity: 0; transform: scale(.3) rotate(0deg); }
    45%, 55% { opacity: 1; transform: scale(1) rotate(45deg); }
}
@keyframes em-emb-breathe {
    0%, 100% { opacity: .35; transform: scale(.92); }
    50% { opacity: .8; transform: scale(1.06); }
}
@keyframes em-emb-float { 50% { transform: translateY(-5%); } }
@keyframes em-emb-spin { to { transform: rotate(360deg); } }
@keyframes em-emb-assemble {
    0% { opacity: 0; transform: translate(var(--em-mx), var(--em-my)) rotate(var(--em-rz)) scale(.6); }
    22% { opacity: 1; transform: none; filter: brightness(1.8); }
    32% { filter: none; }
    82% { opacity: 1; transform: none; }
    100% { opacity: 0; transform: scale(.9); }
}
@keyframes em-emb-ring-in {
    0%, 10% { opacity: 0; transform: rotate(-90deg) scale(.8); }
    36%, 82% { opacity: 1; transform: none; }
    100% { opacity: 0; }
}
@keyframes em-emb-ping {
    0%, 26% { opacity: 0; transform: scale(.2); }
    34% { opacity: 1; transform: scale(1.1) rotate(45deg); }
    52%, 100% { opacity: 0; transform: scale(.4) rotate(90deg); }
}
@keyframes em-emb-pulse {
    0%, 30% { transform: scale(1); }
    40% { transform: scale(.86); }
    52% { transform: scale(1.12); }
    66%, 100% { transform: scale(1); }
}
@keyframes em-emb-flare {
    0%, 44% { opacity: 0; transform: scale(.2) rotate(0deg); }
    52% { opacity: 1; transform: scale(1) rotate(20deg); }
    80%, 100% { opacity: 0; transform: scale(1.3) rotate(40deg); }
}
@keyframes em-emb-ring-glow {
    0%, 46% { filter: none; }
    54% { filter: drop-shadow(0 0 8px rgba(131, 205, 171, .9)) brightness(1.4); }
    90%, 100% { filter: none; }
}
@keyframes em-emb-burst {
    0%, 48% { opacity: 0; transform: translate(0, 0) scale(.3); }
    56% { opacity: 1; }
    92%, 100% { opacity: 0; transform: translate(var(--em-dx), var(--em-dy)) scale(1) rotate(120deg); }
}
@keyframes em-emb-glint {
    0%, 30% { background-position: -160% 0; }
    80%, 100% { background-position: 260% 0; }
}
@keyframes em-emb-dust {
    0% { opacity: 0; transform: translateY(0); }
    15% { opacity: 1; }
    100% { opacity: 0; transform: translate(14px, -170%); }
}
@keyframes em-emb-coin {
    0%, 15% { transform: rotateY(0deg); }
    60%, 100% { transform: rotateY(360deg); }
}
@keyframes em-emb-coin-glow {
    0%, 20%, 70%, 100% { opacity: .3; }
    38% { opacity: .95; }
}

/* ========================================================= Pictures and frames */

/* The picture's own blurred copy fills whatever room a whole picture leaves in its frame. */
.em-store-picture__backdrop {
    position: absolute;
    z-index: 0;
    inset: -14%;
    background: var(--em-picture-backdrop, none) center / cover no-repeat;
    filter: blur(22px) saturate(1.3) brightness(.62);
    transform: translateZ(0);
    pointer-events: none;
}

.em-store-picture.is-failed .em-store-picture__backdrop { display: none; }

/* The LQIP fades out once the picture is in; the copy under it stays and is darker. */
.em-store-picture.has-lqip .em-store-picture__backdrop { opacity: 1; }

/* The mark plays while the picture is on its way. */
.em-store-picture__wait {
    position: absolute;
    z-index: 0;
    inset: 0;
    display: grid;
    place-items: center;
    --em-emblem-size: clamp(36px, 28%, 92px);
    opacity: .75;
}

.em-store-picture.is-loaded .em-store-picture__wait,
.em-store-picture.is-failed .em-store-picture__wait { display: none; }

/* No picture at all: the mark on a soft glow instead of a grey symbol. */
.em-store-media__placeholder {
    position: relative;
    z-index: 1;
    opacity: 1;
    background: radial-gradient(70% 70% at 50% 45%, color-mix(in srgb, var(--em-accent, #d7bc82) 10%, transparent), transparent 70%);
}

.em-store-media__placeholder .em-emblem { opacity: .92; }

/* The empty state of a list: the static mark instead of the ◈ glyph. */
.em-store-empty::before {
    color: transparent;
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Ccircle cx='256' cy='256' r='210' fill='none' stroke='%2383cdab' stroke-width='24' stroke-dasharray='157.6 172.3' stroke-dashoffset='-86'/%3E%3Cpath fill='%23d7bc82' d='M257 18 318 150 257 240 195 150ZM45 258 160 190 244 251 160 322ZM269 251 354 190 468 258 354 322ZM248 282 188 398 246 492ZM264 282 325 398 266 492Z'/%3E%3C/svg%3E") center / 62% no-repeat,
        color-mix(in srgb, var(--em-accent) 6%, transparent);
}

/* ===================================================================== Owned */

.em-owned-seal {
    position: absolute;
    z-index: 4;
    left: 12px;
    bottom: 12px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: calc(100% - 24px);
    padding: 4px 11px 4px 4px;
    border: 1px solid color-mix(in srgb, var(--em-fx-owned) 55%, transparent);
    border-radius: 999px;
    color: color-mix(in srgb, var(--em-fx-owned) 55%, #fff);
    background: color-mix(in srgb, #06120b 82%, transparent);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    font-size: 11.5px;
    font-weight: 800;
    line-height: 1.2;
    pointer-events: none;
    animation: em-fx-seal-in .55s var(--em-fx-spring) .25s backwards;
}

.em-owned-seal i {
    display: grid;
    flex: none;
    width: 20px;
    height: 20px;
    place-items: center;
    border-radius: 50%;
    color: #06150d;
    background: var(--em-fx-owned);
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--em-fx-owned) 55%, transparent);
    animation: em-fx-ping 2.4s ease-out 1s infinite;
}

.em-owned-seal svg { width: 12px; height: 12px; }
.em-owned-seal > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.em-owned-seal.is-forever {
    border-color: color-mix(in srgb, var(--em-accent) 55%, transparent);
    color: color-mix(in srgb, var(--em-accent) 55%, #fff);
    background: color-mix(in srgb, #140f05 82%, transparent);
}

.em-owned-seal.is-forever i { color: var(--em-on-accent, #0b0f14); background: var(--em-accent); animation: none; }

/* Bought right now: the seal is stamped on. */
.em-owned-seal.is-new { animation: em-fx-stamp .7s var(--em-fx-ease) both; }

/* The time left: a ring in the product card and on arsenal tiles, a bar on catalog cards. */
.em-owned-ring {
    position: relative;
    display: grid;
    flex: none;
    width: 46px;
    height: 46px;
    place-items: center;
    color: var(--em-fx-owned);
}

.em-owned-ring svg,
.em-tile__owned svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.em-owned-ring__track,
.em-owned-ring__fill {
    fill: none;
    stroke-width: 4;
}

.em-owned-ring__track { stroke: color-mix(in srgb, var(--em-fx-owned) 18%, transparent); }

.em-owned-ring__fill {
    stroke: var(--em-fx-owned);
    stroke-linecap: round;
    stroke-dasharray: 100;
    stroke-dashoffset: calc(100 - var(--em-owned-progress, 1) * 100);
    animation: em-fx-ring-fill 1.2s var(--em-fx-ease) .35s backwards;
}

.em-owned-ring b { font-size: 14px; font-weight: 850; font-variant-numeric: tabular-nums; }
.em-owned-ring.is-forever { border-radius: 50%; color: var(--em-accent); background: color-mix(in srgb, var(--em-accent) 14%, transparent); }
.em-owned-ring.is-forever svg { position: static; width: 22px; height: 22px; transform: none; }

.em-owned-bar {
    position: relative;
    display: block;
    height: 5px;
    overflow: hidden;
    border-radius: 999px;
    background: color-mix(in srgb, var(--em-fx-owned) 15%, transparent);
}

.em-owned-bar i {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, color-mix(in srgb, var(--em-fx-owned) 65%, #000), var(--em-fx-owned));
    transform: scaleX(var(--em-owned-progress, 1));
    transform-origin: left;
    animation: em-fx-grow 1.1s var(--em-fx-ease) .4s backwards;
}

/* Catalog card. */
.em-store-card.is-owned {
    border-color: color-mix(in srgb, var(--em-fx-owned) 38%, var(--em-border));
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--em-fx-owned) 8%, transparent);
}

.em-store-card__owned.is-term,
.em-store-card__owned.is-forever {
    display: grid;
    gap: 6px;
    font-weight: 700;
}

.em-store-card__owned.is-term { color: color-mix(in srgb, var(--em-fx-owned) 70%, var(--em-text)); }
.em-store-card__owned.is-forever { color: color-mix(in srgb, var(--em-accent) 75%, var(--em-text)); }

.em-store-button.is-renew {
    border: 1px solid color-mix(in srgb, var(--em-fx-owned) 55%, transparent);
    color: color-mix(in srgb, var(--em-fx-owned) 60%, var(--em-text));
    background: color-mix(in srgb, var(--em-fx-owned) 12%, transparent);
}

.em-store-button.is-renew:hover { background: color-mix(in srgb, var(--em-fx-owned) 20%, transparent); }

/* The card of a product bought right now: a light sweeps over it once. */
.em-store-card.is-just-owned::after,
.em-room__frame:has(.em-owned-seal.is-new)::after {
    position: absolute;
    z-index: 6;
    inset: 0;
    background: linear-gradient(115deg, transparent 30%, color-mix(in srgb, var(--em-fx-owned) 35%, transparent) 47%, rgba(255, 255, 255, .4) 50%, transparent 66%);
    transform: translateX(-120%);
    pointer-events: none;
    content: '';
    animation: em-fx-sweep 1.1s var(--em-fx-ease) .1s forwards;
}

/* Arsenal tile: a check in the ring of the time left, low on the left — the top right is the picked mark, the
   top left is where artwork usually has its title. */
.em-tile__owned {
    position: absolute;
    z-index: 2;
    bottom: 7px;
    left: 7px;
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 50%;
    color: #06150d;
    background: color-mix(in srgb, #06120b 72%, transparent);
    animation: em-fx-pop .4s var(--em-fx-spring) .3s backwards;
}

.em-tile__owned::before {
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    background: var(--em-fx-owned);
    content: '';
}

.em-tile__owned > svg:not(:first-child) { position: relative; z-index: 1; width: 10px; height: 10px; transform: none; }
.em-tile__owned .em-owned-ring__track { stroke: rgba(5, 8, 11, .6); stroke-width: 3; }
.em-tile__owned .em-owned-ring__fill { stroke-width: 3; }
.em-tile__owned.is-forever::before { background: var(--em-accent); }
.em-tile__owned.is-forever .em-owned-ring__fill { stroke: var(--em-accent); }
.em-tile.is-owned { border-color: color-mix(in srgb, var(--em-fx-owned) 42%, var(--em-border, transparent)); }
.em-room__owned { color: color-mix(in srgb, var(--em-fx-owned) 70%, var(--em-text, #e8eef5)); }
.em-room__panel.is-owned .em-room__owned svg { color: var(--em-fx-owned); }

@keyframes em-fx-seal-in { from { opacity: 0; transform: translateX(-14px) scale(.85); } }
@keyframes em-fx-stamp {
    0% { opacity: 0; transform: scale(1.9) rotate(-12deg); }
    60% { opacity: 1; transform: scale(.94) rotate(2deg); }
    100% { transform: none; }
}
@keyframes em-fx-ping {
    0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--em-fx-owned) 55%, transparent); }
    70%, 100% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--em-fx-owned) 0%, transparent); }
}
@keyframes em-fx-ring-fill { from { stroke-dashoffset: 100; } }
@keyframes em-fx-grow { from { transform: scaleX(0); } }
@keyframes em-fx-sweep { to { transform: translateX(120%); } }
@keyframes em-fx-pop { from { opacity: 0; transform: scale(.3); } }

/* ============================================================== Product card */

.em-modal--product .em-modal__backdrop {
    background: color-mix(in srgb, #000 64%, transparent);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.em-modal--product .em-modal__dialog {
    border-color: color-mix(in srgb, var(--em-accent) 30%, var(--em-border));
    box-shadow:
        0 40px 120px -30px rgba(0, 0, 0, .85),
        0 30px 90px -50px var(--em-accent);
    animation: em-fx-dialog-in .55s var(--em-fx-ease);
}

/* A light runs round the frame of the product card. */
.em-modal--product .em-modal__dialog::before {
    position: absolute;
    z-index: 6;
    inset: -1px;
    padding: 1.5px;
    border-radius: inherit;
    background: conic-gradient(from var(--em-fx-angle), transparent 0 64%, color-mix(in srgb, var(--em-accent) 90%, transparent) 77%, #fff6d6 80%, transparent 92%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
    pointer-events: none;
    content: '';
    animation: em-fx-orbit 7s linear infinite;
}

.em-modal--product.is-closing .em-modal__dialog { animation: em-fx-dialog-out .28s cubic-bezier(.55, 0, .8, .2) forwards; }

.em-modal--product .em-modal__close { transition: transform .3s var(--em-fx-spring), color .2s ease, border-color .2s ease; }
.em-modal--product .em-modal__close:hover { transform: rotate(90deg); }

/* The picture comes in from the left, the rest rises after it. */
.em-detail--modal .em-detail__media { animation: em-fx-from-left .6s var(--em-fx-ease) .05s backwards; }
.em-detail--modal .em-detail__content > * { animation: em-fx-rise .5s var(--em-fx-ease) backwards; }
.em-detail--modal .em-detail__content > :nth-child(1) { animation-delay: .1s; }
.em-detail--modal .em-detail__content > :nth-child(2) { animation-delay: .15s; }
.em-detail--modal .em-detail__content > :nth-child(3) { animation-delay: .2s; }
.em-detail--modal .em-detail__content > :nth-child(4) { animation-delay: .25s; }
.em-detail--modal .em-detail__content > :nth-child(n + 5) { animation-delay: .3s; }

/* What the picture does under the pointer is the owner's choice (MarketplaceCardHover, data-em-card-hover):
   a tilt aside, a tilt toward the pointer, a lift, a glow in the card colour, a gleam alone or nothing; a shine
   crosses it in all but the last. No effect scales the picture: it would be resampled and stay soft after the
   pointer left. */
.em-detail__stage { perspective: 900px; }
.em-detail__stage .em-store-media { transition: transform .7s var(--em-fx-ease), box-shadow .5s ease, filter .5s ease; }
.em-detail[data-em-card-hover="tilt"] .em-detail__stage:hover .em-store-media { transform: rotateY(-4deg) rotateX(2.5deg); }
/* marketplace-fx.js writes where the pointer is, from -1 to 1 across the stage. */
.em-detail[data-em-card-hover="follow"] .em-detail__stage .em-store-media { transition: transform .2s ease-out; }
.em-detail[data-em-card-hover="follow"] .em-detail__stage:hover .em-store-media {
    transform: rotateY(calc(var(--em-tilt-x, 0) * 6deg)) rotateX(calc(var(--em-tilt-y, 0) * -4deg));
}
.em-detail[data-em-card-hover="lift"] .em-detail__stage:hover .em-store-media {
    transform: translateY(-6px);
    box-shadow: 0 24px 40px -22px rgba(0, 0, 0, .85);
}
.em-detail[data-em-card-hover="glow"] .em-detail__stage:hover .em-store-media {
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--em-card-glow, var(--em-accent)) 55%, transparent), 0 0 46px -10px var(--em-card-glow, var(--em-accent));
    filter: brightness(1.06);
}
.em-detail[data-em-card-hover="none"] .em-detail__stage::after { display: none; }
.em-detail__stage::after {
    position: absolute;
    z-index: 3;
    inset: 0;
    background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .14) 48%, transparent 60%);
    transform: translateX(-120%);
    pointer-events: none;
    content: '';
}
.em-detail__stage:hover::after { transform: translateX(120%); transition: transform 1s var(--em-fx-ease); }

/* The open picture settles in slowly once it has loaded. */
.em-detail__media .em-store-picture.is-loaded img[data-em-img] { animation: em-fx-kenburns 9s ease-out both; }

.em-detail__badges .em-flag { animation: em-fx-pop .45s var(--em-fx-spring) .45s backwards; }
.em-detail__badges .em-flag:nth-child(2) { animation-delay: .55s; }
.em-detail__badges .em-flag:nth-child(3) { animation-delay: .65s; }

.em-detail__thumb {
    transition: transform .25s var(--em-fx-spring), border-color .2s ease, box-shadow .2s ease;
}
.em-detail__thumb:hover { transform: translateY(-2px); }
.em-detail__thumb img { object-fit: cover; }

/* The seal sits on the stage like on a card, a little larger. */
.em-detail__stage .em-owned-seal { left: 16px; bottom: 16px; font-size: 12.5px; }

/* The name catches the light now and then. */
.em-detail--modal .em-detail__name {
    background: linear-gradient(100deg, var(--em-text) 0 42%, color-mix(in srgb, var(--em-accent) 70%, #fff) 50%, var(--em-text) 58% 100%) 100% 0 / 260% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: em-fx-name 6s ease-in-out 1s infinite;
}

/* A heart that turns on throws a ring of sparks. */
.em-detail__favourite::before {
    position: absolute;
    inset: 50%;
    width: 4px;
    height: 4px;
    margin: -2px;
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    content: '';
}
.em-detail__favourite.is-on.is-toggling::before { animation: em-fx-sparks .6s ease-out; }

/* What the player already has, and for how long. */
.em-detail__owned {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px 10px 10px;
    border: 1px solid color-mix(in srgb, var(--em-fx-owned) 35%, transparent);
    border-radius: var(--em-radius-sm, 12px);
    background: linear-gradient(90deg, color-mix(in srgb, var(--em-fx-owned) 12%, transparent), color-mix(in srgb, var(--em-fx-owned) 3%, transparent));
}
.em-detail__owned.is-forever {
    border-color: color-mix(in srgb, var(--em-accent) 35%, transparent);
    background: linear-gradient(90deg, color-mix(in srgb, var(--em-accent) 12%, transparent), color-mix(in srgb, var(--em-accent) 3%, transparent));
}
.em-detail__owned-copy { display: grid; gap: 2px; min-width: 0; }
.em-detail__owned-copy strong { color: var(--em-text); font-size: 14px; font-weight: 800; }
.em-detail__owned-copy small { color: var(--em-muted); font-size: 12px; font-weight: 600; line-height: 1.45; }

/* Options: cards that lift, the chosen one with a check that pops in. */
.em-detail .em-choice:not(.is-static) {
    position: relative;
    transition: transform .25s var(--em-fx-ease), border-color .2s ease, background-color .2s ease, box-shadow .2s ease;
}
.em-detail .em-choice:not(.is-static):hover { transform: translateY(-2px); }
.em-detail .em-choice.is-on:not(.is-static) { box-shadow: 0 10px 26px -16px var(--em-accent); }
.em-detail .em-choice.is-on:not(.is-static)::after {
    position: absolute;
    top: -7px;
    right: -7px;
    width: 18px;
    height: 18px;
    border: 2px solid var(--em-card, #121a22);
    border-radius: 50%;
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 10px no-repeat,
        var(--em-accent);
    content: '';
    animation: em-fx-pop .35s var(--em-fx-spring);
}

/* A new price rolls in from below instead of blinking. */
.em-detail [data-em-selected-price].is-changing { display: inline-block; animation: em-fx-roll .42s var(--em-fx-spring); }

/* The buy button: a glint now and then, a fill while paying, green once paid. */
.em-detail__primary[data-em-buy] { position: relative; overflow: hidden; isolation: isolate; }
.em-detail__primary[data-em-buy]:not(:disabled)::before {
    position: absolute;
    z-index: -1;
    inset: 0;
    background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .5) 50%, transparent 65%);
    transform: translateX(-130%);
    content: '';
    animation: em-fx-glint 3.4s ease-in-out 1.2s infinite;
}
.em-detail__primary[data-em-buy][aria-busy="true"] {
    background-image: linear-gradient(90deg, rgba(255, 255, 255, .35), rgba(255, 255, 255, .35));
    background-repeat: no-repeat;
    background-size: 0% 100%;
    animation: em-fx-fill 1.2s var(--em-fx-ease) forwards;
}
:is(.em-detail__primary, .em-room__cta, .em-store-card__actions .em-store-button).is-purchased {
    gap: 8px;
    color: #06150d;
    border-color: transparent;
    background: linear-gradient(180deg, color-mix(in srgb, var(--em-fx-owned) 80%, #fff), var(--em-fx-owned));
    animation: em-fx-pop .4s var(--em-fx-spring);
}
.is-purchased svg { width: 14px; height: 14px; }

/* «В корзину» answers with a short press. */
[data-em-cart-add].is-added { animation: elysium-press-pop 420ms var(--em-fx-spring); }

/* What the product gives comes in line by line. */
.em-detail .em-perk { animation: em-fx-rise .45s var(--em-fx-ease) backwards; }
.em-detail .em-perk:nth-child(1) { animation-delay: .35s; }
.em-detail .em-perk:nth-child(2) { animation-delay: .4s; }
.em-detail .em-perk:nth-child(3) { animation-delay: .45s; }
.em-detail .em-perk:nth-child(4) { animation-delay: .5s; }
.em-detail .em-perk:nth-child(5) { animation-delay: .55s; }
.em-detail .em-perk:nth-child(n + 6) { animation-delay: .6s; }
.em-detail .em-perk.is-highlight .em-perk__mark { box-shadow: 0 0 14px -2px var(--em-accent); }

.em-detail__delivery svg { animation: em-fx-zap 3s ease-in-out 1.5s infinite; }

@keyframes em-fx-orbit { to { --em-fx-angle: 360deg; } }
@keyframes em-fx-dialog-in { from { opacity: 0; filter: blur(8px); transform: translateY(26px) scale(.94); } }
@keyframes em-fx-dialog-out { to { opacity: 0; filter: blur(6px); transform: translateY(16px) scale(.96); } }
@keyframes em-fx-from-left { from { opacity: 0; transform: translateX(-30px); } }
@keyframes em-fx-rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes em-fx-kenburns { from { transform: scale(1.06); } to { transform: scale(1); } }
@keyframes em-fx-name { 0%, 55% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@keyframes em-fx-sparks {
    0% {
        opacity: 1;
        box-shadow: 0 0 0 0 var(--em-accent), 0 0 0 0 var(--em-accent), 0 0 0 0 var(--em-accent), 0 0 0 0 var(--em-accent), 0 0 0 0 var(--em-accent), 0 0 0 0 var(--em-accent);
    }
    100% {
        opacity: 0;
        box-shadow: 0 -22px 0 1px var(--em-accent), 19px -11px 0 1px var(--em-accent), 19px 11px 0 1px var(--em-accent), 0 22px 0 1px var(--em-accent), -19px 11px 0 1px var(--em-accent), -19px -11px 0 1px var(--em-accent);
    }
}
@keyframes em-fx-roll { from { opacity: 0; transform: translateY(60%); filter: blur(3px); } }
@keyframes em-fx-glint { 0%, 70% { transform: translateX(-130%); } 100% { transform: translateX(130%); } }
@keyframes em-fx-fill { to { background-size: 100% 100%; } }
@keyframes em-fx-zap { 0%, 88%, 100% { transform: none; } 92% { transform: scale(1.25) rotate(-8deg); } 96% { transform: scale(1.1); } }

/* ===================================================================== Cart */

.em-drawer__backdrop {
    background: rgba(5, 8, 11, .6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.em-drawer__panel {
    top: 12px;
    right: 12px;
    width: min(460px, calc(100% - 24px));
    height: calc(100% - 24px);
    padding: 0;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--em-accent) 26%, var(--em-border));
    border-radius: var(--em-radius, 18px);
    background: linear-gradient(180deg, color-mix(in srgb, var(--em-card) 92%, var(--em-accent)), var(--em-surface) 70%);
    box-shadow: -40px 0 120px -30px rgba(0, 0, 0, .85);
    animation: em-fx-drawer-in .55s var(--em-fx-ease);
}

.em-drawer.is-closing .em-drawer__panel { animation: em-fx-drawer-out .3s cubic-bezier(.55, 0, .8, .2) forwards; }

.em-drawer__head {
    gap: 12px;
    margin: 0;
    padding: 18px 18px 12px;
}

.em-drawer__icon {
    position: relative;
    display: grid;
    flex: none;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 13px;
    color: var(--em-accent);
    background: color-mix(in srgb, var(--em-accent) 13%, transparent);
}

.em-drawer__icon.is-catching { animation: elysium-press-pop 420ms var(--em-fx-spring); }

.em-drawer__count {
    position: absolute;
    top: -6px;
    right: -6px;
    display: grid;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    place-items: center;
    border: 2px solid var(--em-card, #141d26);
    border-radius: 10px;
    color: var(--em-on-accent, #0b0f14);
    background: var(--em-accent);
    font-size: 10.5px;
    font-weight: 900;
}

.em-drawer__count[hidden] { display: none; }
.em-drawer__title { flex: 1; font-size: 19px; font-weight: 900; }
.em-drawer__head .em-modal__close { transition: transform .3s var(--em-fx-spring), color .2s ease, border-color .2s ease; }
.em-drawer__head .em-modal__close:hover { transform: rotate(90deg); }

.em-drawer__body {
    display: flex;
    min-height: 0;
    flex: 1;
    flex-direction: column;
}

.em-cart {
    display: flex;
    min-height: 0;
    flex: 1;
    flex-direction: column;
}

.em-cart__list {
    flex: 1;
    min-height: 0;
    align-content: start;
    gap: 10px;
    padding: 4px 14px 12px;
    overflow: auto;
    scrollbar-width: thin;
}

.em-cart__item {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) auto;
    align-items: start;
    gap: 12px;
    max-height: 240px;
    padding: 10px;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--em-text) 7%, transparent);
    border-radius: 16px;
    background: color-mix(in srgb, var(--em-surface-raised) 70%, transparent);
    animation: em-fx-item-in .5s var(--em-fx-ease) calc(min(var(--em-cart-index, 0), 8) * 70ms + .15s) backwards;
    transition: border-color .25s ease;
}

.em-cart__item:hover { border-color: color-mix(in srgb, var(--em-accent) 32%, transparent); }
.em-cart__item.is-renew { border-color: color-mix(in srgb, var(--em-fx-owned) 28%, transparent); }

/* A change inside an open cart redraws it; the lines and the balance stay where they were. */
.em-cart.is-refresh .em-cart__item,
.em-cart.is-refresh .em-cart__balance-line i { animation: none; }

/* A removed line folds away while the request runs. */
.em-cart__item.is-leaving {
    pointer-events: none;
    animation: em-fx-leave .38s var(--em-fx-ease) forwards;
}

.em-cart__thumb {
    position: relative;
    display: grid;
    width: 72px;
    height: 72px;
    place-items: center;
    overflow: hidden;
    border-radius: 12px;
    background: color-mix(in srgb, var(--em-surface) 70%, #000);
    --em-emblem-size: 46px;
}

.em-cart__thumb-blur {
    position: absolute;
    inset: -14%;
    background: var(--em-picture-backdrop, none) center / cover no-repeat;
    filter: blur(12px) saturate(1.3) brightness(.6);
}

.em-cart__thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform .5s var(--em-fx-ease);
}

.em-cart__item:hover .em-cart__thumb img { transform: scale(1.07); }

.em-cart__owned {
    position: absolute;
    z-index: 1;
    left: 5px;
    bottom: 5px;
    display: grid;
    width: 20px;
    height: 20px;
    place-items: center;
    border-radius: 50%;
    color: #06150d;
    background: var(--em-fx-owned);
    box-shadow: 0 0 0 3px color-mix(in srgb, #000 55%, transparent);
}

.em-cart__owned svg { width: 11px; height: 11px; }

.em-cart__copy { display: flex; min-width: 0; flex-direction: column; gap: 6px; padding-top: 2px; }
.em-cart__name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14.5px; font-weight: 800; overflow-wrap: anywhere; }

.em-cart__tag {
    padding: 2px 8px;
    border: 1px solid color-mix(in srgb, var(--em-fx-owned) 45%, transparent);
    border-radius: 999px;
    color: color-mix(in srgb, var(--em-fx-owned) 60%, var(--em-text));
    background: color-mix(in srgb, var(--em-fx-owned) 12%, transparent);
    font-size: 10px;
    font-weight: 800;
}

.em-cart__meta { display: flex; flex-wrap: wrap; gap: 5px; }

.em-cart__meta span {
    padding: 2px 7px;
    border: 1px solid color-mix(in srgb, var(--em-text) 8%, transparent);
    border-radius: 7px;
    color: var(--em-muted);
    font-size: 11.5px;
    font-weight: 600;
}

.em-cart__stepper {
    display: inline-flex;
    width: max-content;
    align-items: center;
    gap: 2px;
    margin-top: auto;
    padding: 3px;
    border: 1px solid var(--em-border);
    border-radius: 11px;
    background: color-mix(in srgb, var(--em-surface) 80%, #000);
}

.em-cart__stepper button {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 8px;
    color: var(--em-text);
    background: transparent;
    cursor: pointer;
    transition: background-color .2s ease, transform .2s var(--em-fx-spring);
}

.em-cart__stepper button svg { width: 13px; height: 13px; }
.em-cart__stepper button:hover:not(:disabled) { background: color-mix(in srgb, var(--em-accent) 16%, transparent); }
.em-cart__stepper button:active:not(:disabled) { transform: scale(.85); }
.em-cart__stepper button:disabled { opacity: .35; cursor: default; }

.em-drawer .em-cart__qty {
    width: 32px;
    min-height: 0;
    height: 28px;
    padding: 0;
    border: 0;
    color: var(--em-text);
    background: transparent;
    font: inherit;
    font-size: 14px;
    font-weight: 800;
    text-align: center;
    -moz-appearance: textfield;
}

.em-drawer .em-cart__qty::-webkit-inner-spin-button,
.em-drawer .em-cart__qty::-webkit-outer-spin-button { margin: 0; -webkit-appearance: none; }
.em-cart__qty.is-up { animation: em-fx-roll-up .35s var(--em-fx-spring); }
.em-cart__qty.is-down { animation: em-fx-roll-down .35s var(--em-fx-spring); }

.em-cart__side {
    display: flex;
    min-height: 100%;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px;
}

.em-cart__price { display: grid; justify-items: end; font-size: 15px; font-weight: 850; white-space: nowrap; }
.em-cart__price s { color: var(--em-muted); font-size: 11px; font-weight: 700; }

.em-cart__remove {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 10px;
    color: var(--em-muted);
    background: transparent;
    cursor: pointer;
    transition: color .2s ease, border-color .2s ease, background-color .2s ease;
}

.em-cart__remove svg { width: 16px; height: 16px; }

.em-cart__remove:hover {
    border-color: color-mix(in srgb, var(--em-fx-danger) 45%, transparent);
    color: var(--em-fx-danger);
    background: color-mix(in srgb, var(--em-fx-danger) 10%, transparent);
}

.em-cart__remove:hover svg { animation: em-fx-wiggle .4s ease; }

/* Undo: five seconds, counted down by the ring. */
.em-cart__undo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 14px 10px;
    padding: 9px 10px 9px 12px;
    border: 1px dashed color-mix(in srgb, var(--em-text) 16%, transparent);
    border-radius: 13px;
    color: var(--em-muted);
    font-size: 12.5px;
    font-weight: 700;
    animation: em-fx-rise .35s var(--em-fx-ease);
}

.em-cart__undo span { flex: 1; min-width: 0; }

.em-cart__undo button {
    flex: none;
    min-height: 32px;
    padding: 0 12px;
    border: 1px solid color-mix(in srgb, var(--em-accent) 45%, transparent);
    border-radius: 10px;
    color: var(--em-accent);
    background: color-mix(in srgb, var(--em-accent) 10%, transparent);
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.em-cart__undo-clock {
    position: relative;
    flex: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: conic-gradient(var(--em-accent) var(--em-fx-left), color-mix(in srgb, var(--em-text) 12%, transparent) 0);
    animation: em-fx-countdown 5s linear forwards;
}

.em-cart__undo-clock::after {
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: var(--em-surface);
    content: '';
}

.em-cart__summary {
    display: grid;
    gap: 10px;
    padding: 14px 18px 18px;
    border-top: 1px solid var(--em-border);
    background: color-mix(in srgb, var(--em-surface) 70%, transparent);
}

.em-cart__coupon {
    display: flex;
    gap: 8px;
    margin: 0;
}

.em-cart__coupon-field {
    position: relative;
    display: block;
    flex: 1;
    min-width: 0;
}

.em-cart__coupon-field > svg {
    position: absolute;
    top: 50%;
    left: 12px;
    width: 16px;
    height: 16px;
    color: var(--em-muted);
    transform: translateY(-50%);
    pointer-events: none;
}

.em-drawer .em-cart__coupon input {
    min-height: 42px;
    padding-left: 36px;
    border-radius: 12px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.em-drawer .em-cart__coupon input::placeholder { letter-spacing: 0; text-transform: none; }
.em-drawer .em-cart__coupon input:focus { border-color: color-mix(in srgb, var(--em-accent) 60%, transparent); box-shadow: none; outline: none; }
.em-cart__coupon .em-store-button { min-height: 42px; flex: none; }
.em-drawer .em-cart__coupon.is-applied input { border-color: color-mix(in srgb, var(--em-fx-owned) 60%, transparent); }
.em-cart__coupon.is-wrong .em-cart__coupon-field { animation: em-fx-shake .45s; }
.em-drawer .em-cart__coupon.is-wrong input { border-color: color-mix(in srgb, var(--em-fx-danger) 65%, transparent); }

.em-cart__coupon-note {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: -4px 2px 0;
    color: color-mix(in srgb, var(--em-fx-owned) 70%, var(--em-text));
    font-size: 12px;
    font-weight: 700;
    animation: em-fx-rise .35s var(--em-fx-ease);
}

.em-cart__coupon-note svg { width: 13px; height: 13px; }

.em-drawer .em-cart__totals { gap: 6px; margin: 0; font-size: 13px; }
.em-drawer .em-cart__totals > div { align-items: baseline; color: var(--em-muted); }
.em-drawer .em-cart__totals > div strong { color: var(--em-text); }
.em-cart__discount { animation: em-fx-rise .4s var(--em-fx-ease); }
.em-cart__discount strong { color: color-mix(in srgb, var(--em-fx-owned) 70%, var(--em-text)) !important; }
.em-drawer .em-cart__total { margin-top: 2px; }
.em-drawer .em-cart__total strong { font-size: 26px; font-weight: 900; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* How much of the balance the order takes, or how much is missing. */
.em-cart__balance { display: grid; gap: 6px; }

.em-cart__balance-line {
    position: relative;
    display: block;
    height: 7px;
    overflow: hidden;
    border-radius: 999px;
    background: color-mix(in srgb, var(--em-text) 8%, transparent);
}

.em-cart__balance-line i {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, color-mix(in srgb, var(--em-accent) 60%, #000), var(--em-accent));
    transform: scaleX(var(--em-cart-balance, 0));
    transform-origin: left;
    transition: transform .6s var(--em-fx-ease);
    animation: em-fx-grow 1s var(--em-fx-ease) .35s backwards;
}

.em-cart__balance.is-short .em-cart__balance-line i { background: linear-gradient(90deg, color-mix(in srgb, var(--em-fx-danger) 60%, #000), var(--em-fx-danger)); }

.em-cart__balance-text {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 12px;
    color: var(--em-muted);
    font-size: 11.5px;
    font-weight: 700;
}

.em-cart__balance-text b { color: var(--em-fx-danger); }

.em-cart__topup { width: 100%; }

.em-cart__pay {
    position: relative;
    width: 100%;
    min-height: 52px;
    overflow: hidden;
    border-radius: 15px;
    font-size: 14.5px;
    font-weight: 900;
    isolation: isolate;
    box-shadow: 0 18px 40px -22px var(--em-accent);
    transition: transform .25s var(--em-fx-spring), box-shadow .25s ease;
}

.em-cart__pay:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 22px 46px -18px var(--em-accent); }

.em-cart__pay::before {
    position: absolute;
    z-index: -1;
    inset: 0;
    background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .5) 50%, transparent 65%);
    transform: translateX(-130%);
    content: '';
    animation: em-fx-glint 3.2s ease-in-out 1s infinite;
}

.em-cart__pay-fill {
    position: absolute;
    z-index: -1;
    inset: 0;
    background: rgba(255, 255, 255, .35);
    transform: scaleX(0);
    transform-origin: left;
}

.em-cart__pay.is-busy { cursor: progress; }
.em-cart__pay.is-busy::before { animation: none; }
.em-cart__pay.is-busy .em-cart__pay-fill { animation: em-fx-fill-x 1.6s var(--em-fx-ease) forwards; }

.em-cart__secure {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0;
    color: var(--em-muted);
    font-size: 11.5px;
    font-weight: 600;
    text-align: center;
}

.em-cart__secure svg { width: 14px; height: 14px; color: color-mix(in srgb, var(--em-fx-owned) 70%, var(--em-muted)); }
.em-drawer .em-cart .em-store-status:empty { display: none; }

/* An empty cart: the mark and where to go next. */
.em-cart__empty,
.em-cart__paid {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 28px 30px 40px;
    text-align: center;
}

.em-cart__empty strong,
.em-cart__paid strong { margin-top: 14px; font-size: 20px; font-weight: 900; animation: em-fx-rise .5s var(--em-fx-ease) .2s backwards; }
.em-cart__empty p,
.em-cart__paid p { max-width: 300px; margin: 0 0 10px; color: var(--em-muted); font-size: 13.5px; line-height: 1.5; animation: em-fx-rise .5s var(--em-fx-ease) .3s backwards; }
.em-cart__empty .em-store-button,
.em-cart__paid > .em-store-button { animation: em-fx-rise .5s var(--em-fx-ease) .4s backwards; }

.em-cart__emblem,
.em-cart__burst {
    position: relative;
    display: grid;
    width: 130px;
    height: 130px;
    place-items: center;
    --em-emblem-size: 76px;
}

.em-cart__emblem::before,
.em-cart__burst::before {
    position: absolute;
    inset: 0;
    border: 1px dashed color-mix(in srgb, var(--em-accent) 38%, transparent);
    border-radius: 50%;
    content: '';
    animation: em-emb-spin 18s linear infinite;
}

.em-cart__burst { --em-emblem-size: 92px; width: 160px; height: 160px; }
.em-cart__burst .em-emblem { animation: em-fx-mark-in .9s var(--em-fx-spring) both; }

.em-cart__stars,
.em-fx-celebrate__stars {
    position: absolute;
    inset: 50%;
}

.em-cart__stars i,
.em-fx-celebrate__stars i {
    position: absolute;
    width: 16px;
    height: 16px;
    margin: -8px;
    background: radial-gradient(circle, #fff 0 16%, #ffeab0 40%, var(--em-accent) 72%);
    clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
    opacity: 0;
    animation: em-fx-star-out 1.3s var(--em-fx-ease) var(--em-delay, .3s) both;
}

.em-cart__got {
    display: grid;
    width: 100%;
    gap: 8px;
    margin: 6px 0 14px;
    padding: 0;
    list-style: none;
}

.em-cart__got li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid color-mix(in srgb, var(--em-fx-owned) 28%, transparent);
    border-radius: 13px;
    background: color-mix(in srgb, var(--em-fx-owned) 6%, transparent);
    font-size: 13.5px;
    font-weight: 800;
    text-align: left;
    animation: em-fx-rise .5s var(--em-fx-ease) calc(var(--em-cart-index, 0) * 140ms + .7s) backwards;
}

.em-cart__got li > i {
    display: grid;
    flex: none;
    width: 24px;
    height: 24px;
    place-items: center;
    border-radius: 50%;
    color: #06150d;
    background: var(--em-fx-owned);
    animation: em-fx-pop .45s var(--em-fx-spring) calc(var(--em-cart-index, 0) * 140ms + .9s) backwards;
}

.em-cart__got li > span { flex: 1; min-width: 0; }
.em-cart__got small { color: var(--em-muted); font-size: 11.5px; font-weight: 700; }

@keyframes em-fx-drawer-in { from { opacity: .4; transform: translateX(110%); } }
@keyframes em-fx-drawer-out { to { opacity: .4; transform: translateX(110%); } }
@keyframes em-fx-item-in { from { opacity: 0; transform: translateX(36px); } }
@keyframes em-fx-leave {
    0% { max-height: 240px; opacity: 1; }
    40% { opacity: 0; transform: translateX(50px); }
    100% { max-height: 0; margin-block: -5px; padding-block: 0; border-width: 0; opacity: 0; transform: translateX(50px); }
}
@keyframes em-fx-roll-up { from { transform: translateY(100%); opacity: 0; } }
@keyframes em-fx-roll-down { from { transform: translateY(-100%); opacity: 0; } }
@keyframes em-fx-wiggle { 25% { transform: rotate(-14deg); } 75% { transform: rotate(14deg); } }
@keyframes em-fx-countdown { to { --em-fx-left: 0%; } }
@keyframes em-fx-shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
@keyframes em-fx-fill-x { to { transform: scaleX(1); } }
@keyframes em-fx-mark-in { from { opacity: 0; transform: scale(.3) rotate(-40deg); } }
@keyframes em-fx-star-out {
    0% { opacity: 0; transform: translate(0, 0) scale(.2); }
    25% { opacity: 1; }
    100% { opacity: 0; transform: translate(var(--em-dx), var(--em-dy)) scale(1) rotate(160deg); }
}

/* ========================================================= Flight and landing */

.em-fx-fly {
    position: fixed;
    z-index: 1400;
    overflow: hidden;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, .5);
    pointer-events: none;
}

.em-fx-fly img { display: block; width: 100%; height: 100%; object-fit: cover; }

[data-em-cart-open].is-catching { animation: elysium-press-pop 420ms var(--em-fx-spring); }

/* A purchase lands over the picture: the mark with stars flying out. */
.em-fx-celebrate {
    position: absolute;
    z-index: 7;
    inset: 0;
    display: grid;
    place-items: center;
    background: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--em-accent) 32%, transparent), transparent 62%);
    pointer-events: none;
    animation: em-fx-fade .3s ease;
}

.em-fx-celebrate .em-emblem { --em-emblem-size: clamp(80px, 34%, 150px); animation: em-fx-mark-in .8s var(--em-fx-spring) both; }
.em-fx-celebrate.is-leaving { animation: em-fx-fade-out .3s ease forwards; }

@keyframes em-fx-fade { from { opacity: 0; } }
@keyframes em-fx-fade-out { to { opacity: 0; } }

/* ============================================================ Availability dot */

/* One honest dot on every surface: green and pulsing when the product can be bought, red and still when it is sold
   out or not sold here, quiet when the player already has it. Missing money has no dot at all: the line already
   says how much is missing, and a red dot beside a price read as an alarm. The ping is a copy of the dot that
   grows and fades (::after), so only transform and opacity move. */
:is(.em-store-card__stock, .em-store-product__stock, .em-detail__stock, .em-room__stock, .em-product-stock)[data-em-availability] {
    --em-dot-color: var(--em-fx-owned);
    position: relative;
}
:is(.em-store-card__stock, .em-store-product__stock, .em-detail__stock, .em-room__stock, .em-product-stock):is([data-em-availability="insufficient"], [data-em-availability="sold_out"], [data-em-availability="unavailable"]) {
    --em-dot-color: var(--em-fx-danger);
}
:is(.em-store-card__stock, .em-store-product__stock, .em-detail__stock, .em-room__stock, .em-product-stock)[data-em-availability="owned"] { --em-dot-color: var(--em-accent); }
:is(.em-store-card__stock, .em-store-product__stock, .em-detail__stock, .em-room__stock, .em-product-stock)[data-em-availability="unknown"] { --em-dot-color: var(--em-muted); }
:is(.em-store-card__stock, .em-store-product__stock, .em-detail__stock, .em-room__stock, .em-product-stock)[data-em-availability]::before {
    background: var(--em-dot-color);
    box-shadow: 0 0 8px color-mix(in srgb, var(--em-dot-color) 60%, transparent);
}
:is(.em-store-card__stock, .em-store-product__stock, .em-detail__stock, .em-room__stock, .em-product-stock)[data-em-availability]::after {
    position: absolute;
    top: 50%;
    left: var(--em-dot-x, 0px);
    width: var(--em-dot, 8px);
    height: var(--em-dot, 8px);
    margin-top: calc(var(--em-dot, 8px) / -2);
    border-radius: 50%;
    background: var(--em-dot-color);
    opacity: 0;
    pointer-events: none;
    content: '';
}
:is(.em-store-card__stock, .em-store-product__stock, .em-detail__stock, .em-room__stock, .em-product-stock)[data-em-availability="ok"]::after {
    animation: em-fx-ping 1.8s ease-out infinite;
}
:is(.em-store-card__stock, .em-store-product__stock, .em-detail__stock, .em-room__stock, .em-product-stock)[data-em-availability="insufficient"]::before,
:is(.em-store-card__stock, .em-store-product__stock, .em-detail__stock, .em-room__stock, .em-product-stock)[data-em-availability="insufficient"]::after {
    content: none;
    animation: none;
}
.em-room__stock[data-em-availability="insufficient"] { padding-left: 12px; }
/* Where each surface draws its dot. */
:is(.em-store-card__stock, .em-store-product__stock) { --em-dot: 6px; --em-dot-x: var(--elysium-space-sm, 8px); }

@keyframes em-fx-ping {
    0% { opacity: .7; transform: scale(1); }
    80%, 100% { opacity: 0; transform: scale(2.8); }
}

/* ============================================================= Narrow screens */

@media (max-width: 599px) {
    .em-drawer__panel { top: 0; right: 0; width: 100%; height: 100%; border-width: 0; border-radius: 0; }
    .em-cart__item { grid-template-columns: 60px minmax(0, 1fr) auto; gap: 10px; }
    .em-cart__thumb { width: 60px; height: 60px; --em-emblem-size: 38px; }
    .em-cart__coupon { flex-wrap: wrap; }
    .em-cart__coupon .em-store-button { flex: 1 1 100%; }
}

/* ================================================================= Motion off */

html[data-animations="false"] :is(.em-emblem, .em-emblem *, .em-store-picture__wait, .em-owned-seal, .em-owned-seal *, .em-owned-ring *, .em-owned-bar *, .em-tile__owned, .em-modal--product *, .em-drawer, .em-drawer *, .em-fx-celebrate, .em-fx-celebrate *),
html[data-animations="false"] :is(.em-emblem, .em-modal--product .em-modal__dialog, .em-store-card.is-just-owned)::before,
html[data-animations="false"] :is(.em-emblem, .em-store-card.is-just-owned, .em-detail__stage)::after,
html[data-animations="false"] [data-em-availability]::before,
html[data-animations="false"] [data-em-availability]::after {
    animation: none !important;
    transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
    :is(.em-emblem, .em-emblem *, .em-store-picture__wait, .em-owned-seal, .em-owned-seal *, .em-owned-ring *, .em-owned-bar *, .em-tile__owned, .em-modal--product *, .em-drawer, .em-drawer *, .em-fx-celebrate, .em-fx-celebrate *),
    :is(.em-emblem, .em-modal--product .em-modal__dialog, .em-store-card.is-just-owned)::before,
    :is(.em-emblem, .em-store-card.is-just-owned, .em-detail__stage)::after,
    [data-em-availability]::before,
    [data-em-availability]::after {
        animation: none !important;
        transition: none !important;
    }

    .em-detail--modal .em-detail__name { color: var(--em-text); background: none; }
}

html[data-animations="false"] .em-detail--modal .em-detail__name { color: var(--em-text); background: none; }

/* Still for reduced motion and "animations off": no hover effect moves the picture. */
html[data-animations="false"] .em-detail__stage:hover .em-store-media { transform: none !important; }
@media (prefers-reduced-motion: reduce) {
    .em-detail__stage:hover .em-store-media { transform: none !important; }
}
