/* ==========================================================================
   VOAP Toast — game-y card with spring slide-up entrance
   ========================================================================== */

.gamify-toast {
    position: fixed;
    bottom: max(60px, 10vh);
    right: 1.2vw;
    background: #660C1B;
    color: #fff;
    padding: 12px 18px;
    border-radius: var(--gg-radius, 14px);
    font-size: 15px;
    font-weight: 600;
    box-shadow: var(--gg-shadow-lg, 0 16px 40px rgba(0,0,0,.28));
    /* max int32: must outstack LD focus chrome + Elementor overlays */
    z-index: 2147483647;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: voap-toast-in var(--gg-dur, .3s) var(--gg-spring, cubic-bezier(0.34,1.56,0.64,1)) forwards;
    max-width: min(340px, 90vw);
    line-height: 1.35;
}

/* exit: JS removes the element after 4 s — no exit keyframe needed */

@keyframes voap-toast-in {
    from {
        transform: translateY(32px) scale(0.92);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* The gem sprite injected by JS sits next to the message text */
.gamify-toast .gg-gem,
.gamify-toast .gg-fire {
    flex-shrink: 0;
    font-size: 1.25em;
}

@media (prefers-reduced-motion: reduce) {
    .gamify-toast {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

/* ==========================================================================
   Celebration overlay — confetti + ticking counter for point awards
   ========================================================================== */

.gamify-celebrate {
    position: fixed;
    inset: 0;
    /* one above the toast so the celebration renders over it */
    z-index: 2147483647;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

/* One page load can fire both: an H5P solve pays VIP points AND can complete an
   achievement. Both overlays are inset:0, so without this they sit exactly on
   top of each other — the points celebration takes the bottom, the achievement
   keeps the middle. */
.gamify-celebrate:not(.gamify-celebrate--achievement) {
    align-items: flex-end;
}

.gamify-celebrate:not(.gamify-celebrate--achievement) .gamify-celebrate__card {
    /* Margin on the card, not padding on the overlay: the confetti layer is
       inset:0 against the padding box and has to stay full-bleed. */
    margin-bottom: max(24px, 6vh);
}

.gamify-celebrate__card {
    background: #660C1B;
    color: #fff;
    padding: 28px 44px;
    border-radius: var(--gg-radius, 14px);
    box-shadow: var(--gg-shadow-lg, 0 16px 40px rgba(0,0,0,.28));
    text-align: center;
    animation:
        gamify-celebrate-pop .45s var(--gg-spring, cubic-bezier(0.34,1.56,0.64,1)) forwards,
        gamify-celebrate-out .4s ease 3.8s forwards;
}

/* Both element types: a custom VIP icon (voap_vip_icon_id) comes back as an <img>, and it
   carries no gg-* size class, so without this it falls back to .gg-gem's 1em and shows up
   thumbnail-sized next to a 44px number. */
.gamify-celebrate__card svg,
.gamify-celebrate__card img {
    width: 88px;
    height: 88px;
    margin-bottom: 4px;
}

.gamify-celebrate__count {
    font-size: 44px;
    font-weight: 900;
    line-height: 1.1;
    font-family: var(--gg-font-display, inherit);
}

.gamify-celebrate__confetti {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.gamify-celebrate__confetti i {
    position: absolute;
    top: -5vh;
    width: 10px;
    height: 14px;
    border-radius: 2px;
    opacity: .95;
    animation: gamify-confetti-fall linear forwards;
}

@keyframes gamify-confetti-fall {
    to { transform: translateY(110vh) rotate(720deg); }
}

@keyframes gamify-celebrate-pop {
    from { transform: scale(.6); opacity: 0; }
    to   { transform: scale(1);  opacity: 1; }
}

@keyframes gamify-celebrate-out {
    to { transform: scale(.92); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .gamify-celebrate__confetti { display: none; }
    .gamify-celebrate__card { animation: gamify-celebrate-out .3s ease 3.8s forwards; }
}

/* ==========================================================================
   Achievement / milestone popup — same overlay chassis, a stack of cards that
   linger 5 s (JS) or close on click
   ========================================================================== */

.gamify-celebrate--achievement {
    flex-direction: column;
    gap: 12px;
}

.gamify-celebrate--achievement .gamify-celebrate__card {
    /* the overlay stays click-through; only the card itself takes the dismiss click */
    pointer-events: auto;
    cursor: pointer;
    padding: 24px 32px;
    max-width: min(360px, 88vw);
    /* no timed fade-out: JS owns the 5 s linger so a click can cut it short */
    animation: gamify-celebrate-pop .45s var(--gg-spring, cubic-bezier(0.34,1.56,0.64,1)) forwards;
}

/* Sized 88px by the shared .gamify-celebrate__card img rule above. */
.gamify-celebrate--achievement .gamify-achievement__art {
    object-fit: contain;
    margin-bottom: 8px;
}

.gamify-achievement__art--icon {
    display: block;
    width: 88px !important;
    height: 88px !important;
    margin: 0 auto 4px;
    color: var(--gg-gold, #f4a900);
    font-size: 76px !important;
    line-height: 88px;
}

.gamify-achievement__label {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    opacity: .8;
}

.gamify-achievement__title {
    font-size: 24px;
    font-weight: 900;
    line-height: 1.2;
    font-family: var(--gg-font-display, inherit);
}

@media (prefers-reduced-motion: reduce) {
    .gamify-celebrate--achievement .gamify-celebrate__card { animation: none; }
}

/* ==========================================================================
   Rank up — the same card in gold, with rays turning behind the badge
   ========================================================================== */

.gamify-rankup {
    position: relative;
    overflow: hidden;
    border: 2px solid var(--gg-gold, #f4a900);
    box-shadow:
        var(--gg-shadow-lg, 0 16px 40px rgba(0, 0, 0, .28)),
        0 0 60px rgba(244, 169, 0, .35);
}

/* ponytail: no extra DOM for the rays — the art is the card's first child, so a
   pseudo-element pinned to the top centre lands exactly behind it. */
.gamify-rankup::before {
    content: "";
    position: absolute;
    top: -60px;
    left: 50%;
    width: 260px;
    height: 260px;
    margin-left: -130px;
    /* repeating-: a plain conic-gradient draws the wedge once, not a wheel. */
    background: repeating-conic-gradient(from 0deg, rgba(244, 169, 0, .5) 0 5deg, transparent 5deg 30deg);
    -webkit-mask-image: radial-gradient(circle, #000 20%, transparent 68%);
    mask-image: radial-gradient(circle, #000 20%, transparent 68%);
    animation: gamify-rankup-rays 12s linear infinite;
}

.gamify-rankup > * {
    position: relative;
}

.gamify-rankup .gamify-achievement__art {
    animation: gamify-rankup-badge .7s var(--gg-spring, cubic-bezier(0.34, 1.56, 0.64, 1)) both;
}

.gamify-rankup__from {
    font-size: 14px;
    font-weight: 700;
    opacity: .6;
    margin-bottom: 2px;
}

.gamify-rankup .gamify-achievement__title {
    color: var(--gg-gold, #f4a900);
    animation: gamify-rankup-rise .45s ease .35s both;
}

.gamify-rankup__perks {
    margin: 14px 0 0;
    padding: 12px 0 0;
    border-top: 1px solid rgba(255, 255, 255, .18);
    list-style: none;
    text-align: left;
    font-size: 14px;
    line-height: 1.45;
    animation: gamify-rankup-rise .45s ease .55s both;
}

.gamify-rankup__perks li {
    position: relative;
    padding-left: 20px;
}

.gamify-rankup__perks li + li {
    margin-top: 4px;
}

.gamify-rankup__perks li::before {
    content: "★";
    position: absolute;
    left: 0;
    color: var(--gg-gold, #f4a900);
}

@keyframes gamify-rankup-rays {
    to { transform: rotate(360deg); }
}

@keyframes gamify-rankup-badge {
    from { transform: scale(.3) rotate(-25deg); opacity: 0; }
    to   { transform: scale(1) rotate(0); opacity: 1; }
}

@keyframes gamify-rankup-rise {
    from { transform: translateY(10px); opacity: 0; }
    to   { transform: none; opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .gamify-rankup::before,
    .gamify-rankup .gamify-achievement__art,
    .gamify-rankup .gamify-achievement__title,
    .gamify-rankup__perks {
        animation: none;
    }
}
