/*
 * Shareable result card (9:16, story format). Shared by the site and the admin card designer.
 * Every size is relative to the card width (cqw), positions are percents of the card,
 * so a design renders identically at any scale.
 */
@property --p { syntax: '<number>'; inherits: true; initial-value: 0; }

.am-card {
    --card-text: #fff;
    --card-ring-fill: #fff;
    --card-ring-track: #b99ad6;
    --card-ring-inner: #3b1470;
    --card-overlay: 0;

    position: relative;
    overflow: hidden;
    container-type: inline-size;
    width: 100%;
    aspect-ratio: 9 / 16;
    border-radius: 1.75rem;
    color: var(--card-text);
    background-color: #7c3aed;
    background-image:
        radial-gradient(circle at 15% 0%, rgb(34 199 232 / .55), transparent 55%),
        radial-gradient(circle at 100% 100%, rgb(255 138 61 / .6), transparent 50%),
        linear-gradient(150deg, #ff3d8b, #7c3aed);
    background-size: cover;
    background-position: center;
    box-shadow: 0 24px 60px rgb(124 58 237 / .45);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.am-card.has-cover { background-image: var(--card-cover); }
.am-card__overlay { position: absolute; inset: 0; background: #000; opacity: calc(var(--card-overlay) / 100); pointer-events: none; }

.am-card__el {
    position: absolute;
    left: calc(var(--x) * 1%);
    top: calc(var(--y) * 1%);
    width: calc(var(--w) * 1%);
    margin: 0;
    font-size: calc(var(--size) * 1cqw);
    line-height: 1.15;
    text-align: var(--align);
    overflow-wrap: anywhere;
}
.am-card__test { font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .85; }
.am-card__headline { font-weight: 900; letter-spacing: -.02em; }
.am-card__message { font-weight: 700; line-height: 1.25; }

.am-card__ring {
    --p: 0;
    display: grid;
    place-items: center;
    aspect-ratio: 1;
    border-radius: 50%;
    background:
        radial-gradient(closest-side, var(--card-ring-inner) 78%, transparent 80%),
        conic-gradient(var(--card-ring-fill) calc(var(--p) * 1%), var(--card-ring-track) 0);
    transition: --p 1.1s cubic-bezier(.2, .8, .2, 1);
}
.am-card__percent { font-size: 1em; font-weight: 900; letter-spacing: -.04em; line-height: 1; }
.am-card__percent small { font-size: .43em; margin-left: .1em; }

.am-card__brand { display: block; height: auto; }

@media (prefers-reduced-motion: reduce) { .am-card__ring { transition: none; } }

/* Group result card: everybody's result in one 9:16 picture.
   The card is the size container, so its own padding must not use cqw (that would resolve against the viewport):
   the content sits in .gc__inner, which is a descendant and may use cqw. */
.am-card[hidden] { display: none; }
.gc__inner {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 3cqw;
    box-sizing: border-box;
    height: 100%;
    padding: 11cqw 8cqw 8cqw;
    text-align: center;
}
.gc__test { margin: 0; font-size: 3.4cqw; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .85; }
.gc__title { margin: 0; font-size: 9cqw; font-weight: 900; line-height: 1.05; letter-spacing: -.02em; }
.gc__winner { margin: 0; font-size: 4.6cqw; font-weight: 700; opacity: .95; }
.gc__rows { display: grid; align-content: center; gap: 4cqw; flex: 1; margin: 2cqw 0; padding: 0; list-style: none; }
.gc__row { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4cqw; padding: 3cqw; border-radius: 5cqw; background: rgb(255 255 255 / .12); text-align: left; }
.gc__row.is-leader { background: rgb(255 255 255 / .26); box-shadow: 0 0 0 .6cqw rgb(255 255 255 / .55) inset; }
.gc__avatar { width: 14cqw; height: 14cqw; display: inline-flex; align-items: center; justify-content: center; overflow: hidden; border-radius: 50%; background: rgb(255 255 255 / .2); font-size: 6cqw; font-weight: 800; }
.gc__avatar img { width: 100%; height: 100%; object-fit: cover; }
.gc__main { min-width: 0; }
.gc__line { display: flex; align-items: baseline; justify-content: space-between; gap: 3cqw; }
.gc__name { min-width: 0; font-size: 4.4cqw; font-weight: 800; overflow-wrap: anywhere; }
.gc__percent { flex: none; font-size: 5.6cqw; font-weight: 900; letter-spacing: -.02em; }
.gc__track { height: 2.4cqw; margin-top: 2cqw; border-radius: 999px; background: rgb(255 255 255 / .25); overflow: hidden; }
.gc__track span { display: block; height: 100%; border-radius: inherit; background: var(--gradient-wide, linear-gradient(110deg, #ff8a3d, #ff3d8b 55%, #22c7e8)); transition: width 1.1s cubic-bezier(.2, .8, .2, 1); }
.gc__brand { align-self: center; width: 22cqw; height: auto; }
@media (prefers-reduced-motion: reduce) { .gc__track span { transition: none; } }
