/**
 * Mutation effects (Shiny, Iridescent, Golden). Colors and icons can be
 * themed per game; see js/mutation-effects.js.
 */
@keyframes sparkle {
    0% {
        opacity: 0;
        transform: scale(0.5) translate(-50%, -50%);
    }
    50% {
        opacity: 1;
        transform: scale(1.5) translate(-50%, -50%);
    }
    100% {
        opacity: 0;
        transform: scale(0.5) translate(-50%, -50%);
    }
}

.sparkle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: radial-gradient(circle, #ffd700, rgba(255, 215, 0, 0));
    border-radius: 50%;
    pointer-events: none;
    animation: sparkle 1s ease-out infinite;
    z-index: 10;
}

.reward-card-sparkle {
    position: relative;
    overflow: hidden;
}

@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.iridescent-effect {
    background: var(--lsx-mut-gradient, linear-gradient(270deg, red, blue, green, yellow, red));
    background-size: 800% 800%;
    animation: gradientMove var(--lsx-mut-duration, 6s) ease infinite;
    display: inline-block;
}

/* For text elements */
.iridescent-effect.text {
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

/* AI-made icons (css/lsx-icons.css) are SVG masks filled with the text
 * color, not text, so clipping to text leaves them invisible. Fill the
 * icon's own shape with the moving gradient instead. */
.iridescent-effect .lsx,
.lsx.iridescent-effect {
    background: var(--lsx-mut-gradient, linear-gradient(270deg, red, blue, green, yellow, red));
    background-size: 800% 800%;
    -webkit-background-clip: border-box;
    background-clip: border-box;
    animation: gradientMove var(--lsx-mut-duration, 6s) ease infinite;
}

/* For images (overlaid with gradient via pseudo-element) */
.iridescent-effect.image {
    position: relative;
}
.iridescent-effect.image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--lsx-mut-gradient, linear-gradient(270deg, red, blue, green, yellow, red));
    background-size: 800% 800%;
    animation: gradientMove var(--lsx-mut-duration, 6s) ease infinite;
    mix-blend-mode: screen;
    pointer-events: none;
    z-index: 2;
}
@keyframes gradientMove {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 100% 50%;
    }
}

/* Sparkles that use an icon instead of a dot. */
.sparkle.sparkle--icon {
    /* 1em, not auto: AI-made lsx icons are empty boxes with a mask. */
    width: 1em;
    height: 1em;
    text-align: center;
    background: none;
    border-radius: 0;
    font-size: 18px;
    line-height: 1;
}

/* Preview cards on the mutation theme form. */
.lsx-mutation-preview {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 240px;
    height: 150px;
    margin: 0 0 1rem;
    border: 1px solid #d8dce8;
    border-radius: 14px;
    /* background-color only, so the Iridescent gradient is not replaced. */
    background-color: #fff;
    color: #1e1b4b;
    cursor: pointer;
}

.lsx-mutation-preview__label {
    font-weight: 700;
}

.lsx-mutation-colors .form-item {
    margin-right: 1rem;
}

/* AI-made lsx icons are drawn with background-color through a mask. */
.sparkle.sparkle--icon.lsx {
    background-color: currentColor;
}

/* Limited Mutations tab on the game edit form. */
.lsx-limited-status {
  display: inline-block;
  margin: 0 0 0.5rem;
  padding: 0.15rem 0.7rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
}

.lsx-limited-status--success { background: #dcfce7; color: #14532d; }
.lsx-limited-status--info { background: #cffafe; color: #164e63; }
.lsx-limited-status--dark { background: #e5e7eb; color: #1f2937; }
.lsx-limited-status--secondary { background: #f1f5f9; color: #334155; }

/* Mutations tab on the game edit form: blank rows wait for "Add mutation". */
.lsx-mutations-editor details.lsx-mutation.is-unused { display: none !important; }
.lsx-mutations-editor .lsx-mutation-add { margin: 0 0 1rem; }

/* Mutations tab: the path pad (draw a loop for the rarity to move round). */
.lsx-mutation-motion { margin-top: 1rem; }
.lsx-path-pad { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 4px 12px; align-items: start; margin-bottom: .75rem; }
.lsx-path-pad canvas { grid-row: span 2; width: 220px; height: 220px; border: 2px dashed #a78bfa; border-radius: 12px; background: #faf5ff; cursor: crosshair; touch-action: none; }
.lsx-path-pad__help { font-size: .85rem; color: #475569; }
.lsx-path-pad .lsx-path-clear { justify-self: start; }
@media (max-width: 600px) { .lsx-path-pad { grid-template-columns: 1fr; } }
