/* ==========================================================
   ELYXIUM — MEMORY MOTH ACHIEVEMENTS
   Card frame ratio is based on:
   MothCard.svg viewBox = 544.33 x 822.22
   ========================================================== */

.ely-ach-page {
    --ach-gold: #a17449;
    --ach-cream: #e4d1ff;
    --ach-champagne: #d8b38d;

    --ach-purple-dark: #211d34;
    --ach-purple-mid: #342b52;
    --ach-purple-light: #4a3e6b;

    --ach-text: #f4eef7;
    --ach-muted: #c8bdd4;

    --ach-border: rgba(216, 179, 141, 0.34);
    --ach-shadow: rgba(0, 0, 0, 0.24);

    padding-bottom: 55px;
}

/* ----------------------------------------------------------
   HEADER
   ---------------------------------------------------------- */

.ely-ach-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
    margin: 18px 0 28px;
}

.ely-ach-header h1 {
    margin: 0 0 8px;
    font-size: 2rem;
    line-height: 1.25;
}

.ely-ach-subtitle {
    margin: 0;
    color: var(--ach-muted);
    font-size: 0.9rem;
}

.ely-ach-summary {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 22px;
    background: rgba(40, 34, 62, 0.78);
    border: 1px solid var(--ach-border);
    border-radius: 16px;
    box-shadow:
        0 5px 18px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 rgba(255, 255, 209, 0.05);
}

.ely-ach-summary-icon {
    color: var(--ach-champagne);
    font-size: 1.8rem;
}

.ely-ach-summary-number {
    color: var(--ach-cream);
    font-size: 1.65rem;
    font-weight: 700;
    line-height: 1.1;
}

.ely-ach-summary-label {
    color: var(--ach-muted);
    font-size: 0.75rem;
}

/* ----------------------------------------------------------
   FILTERS
   ---------------------------------------------------------- */

.ely-ach-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin: 20px 0 34px;
}

.ely-ach-filter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 15px;
    border: 1px solid rgba(216, 179, 141, 0.28);
    border-radius: 999px;
    background: rgba(45, 38, 67, 0.75);
    color: #d5c7d5;
    font-size: 0.82rem;
    text-decoration: none;
    transition: 0.2s ease;
}

.ely-ach-filter:hover {
    color: var(--ach-cream);
    border-color: var(--ach-champagne);
    background: rgba(78, 66, 106, 0.68);
    text-decoration: none;
}

.ely-ach-filter.active {
    color: white;
    background: linear-gradient(135deg, #8d4897, #4b3c83);
    border-color: var(--ach-cream);
    font-weight: 700;
}

/* ----------------------------------------------------------
   SECTION HEADINGS
   ---------------------------------------------------------- */

.ely-ach-section {
    margin-bottom: 42px;
}

.ely-ach-section-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
}

.ely-ach-section-heading h2 {
    margin: 0;
    color: var(--ach-cream);
    font-size: 1rem;
    white-space: nowrap;
}

.ely-ach-section-heading > i {
    color: var(--ach-champagne);
    font-size: 1rem;
}

.ely-ach-section-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(216, 179, 141, 0.45), transparent);
}

/* ----------------------------------------------------------
   SHARED TEXT, REWARDS & ACTIONS
   ---------------------------------------------------------- */



.ely-ach-tags {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.ely-ach-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 11px;
    border: 1px solid rgba(216, 179, 141, 0.45);
    border-radius: 999px;
    background: rgba(42, 33, 66, 0.74);
    color: #f4eadb;
    font-size: 0.71rem;
    line-height: 1.4;
}

.ely-ach-tag-legacy {
    background: rgba(161, 116, 73, 0.26);
    border-color: var(--ach-champagne);
    color: var(--ach-cream);
}


/* ==========================================
   MEMORY MOTH — UNCLAIMED REWARD CARD
   ========================================== */

/* Use the special card background when rewards await */
.ely-ach-memory-moth
.moth-has-rewards
.ely-moth-front {
    background-image: url('../images/MothCardReward.svg');
}

/* Keep the SVG sized exactly like normal cards */
.ely-ach-memory-moth
.moth-has-rewards
.ely-moth-front {
    background-position: center;
    background-size: 100% 100%;
    background-repeat: no-repeat;
}


/* White achievement names on unclaimed reward cards */
.ely-ach-memory-moth .moth-has-rewards .ely-moth-open .ely-ach-name {
    color: #ffffff !important;
    text-shadow: 0 1px 4px rgba(119, 91, 83, 0.5);
}


/* ----------------------------------------------------------
   DESCRIPTION
   ---------------------------------------------------------- */

.ely-ach-description {
    width: 100%;
    margin: 2px auto 12px;
    color: #e1d8ea;
    padding-left: 20px;
padding-right: 20px;
    font-size: 0.84rem;
    line-height: 1.5;
    text-align: center;
    overflow-wrap: anywhere;
}

/* ----------------------------------------------------------
   REWARDS
   ---------------------------------------------------------- */

.ely-ach-rewards {
    width: 100%;
    margin-top: auto;
    margin-bottom: 10px;
    padding: 10px 12px;
    border: 1px solid rgba(216, 179, 141, 0.22);
    border-radius: 16px;
    background: rgba(31, 25, 52, 0.42);
    box-shadow: inset 0 1px 0 rgba(255, 255, 209, 0.04);
    text-align: center;
}

.ely-ach-rewards-title {
    margin-bottom: 7px;
    color: var(--ach-cream);
    font-size: 0.77rem;
    font-weight: 700;
}

.ely-ach-rewards-title i {
    margin-right: 5px;
    color: var(--ach-champagne);
}

.ely-ach-reward-list {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}

.ely-ach-reward {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #f0e6f1;
    font-size: 0.79rem;
    line-height: 1.35;
}

.ely-ach-reward i {
    color: var(--ach-champagne);
}

/* ----------------------------------------------------------
   CLAIM / STATUS
   ---------------------------------------------------------- */

.ely-ach-claim-form {
    width: 100%;
    margin: 0;
}

.ely-ach-claim-btn {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--ach-cream);
    border-radius: 999px;
    background: linear-gradient(135deg, #ffffd1 0%, #d8b38d 60%, #a17449 100%);
    color: #38283e;
    font-size: 0.79rem;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s ease;
}

.ely-ach-claim-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    color: #38283e;
}

.ely-ach-claim-btn:disabled {
    opacity: 0.6;
    cursor: wait;
    transform: none;
}

.ely-ach-claimed,
.ely-ach-unclaimed {
    padding: 8px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    line-height: 1.35;
    font-weight: 600;
}

.ely-ach-claimed {
    color: var(--ach-cream);
    border: 1px solid rgba(216, 179, 141, 0.35);
    background: rgba(161, 116, 73, 0.15);
}

.ely-ach-unclaimed {
    color: #e8dbf1;
    border: 1px solid rgba(174, 147, 204, 0.28);
    background: rgba(92, 72, 128, 0.20);
}

/* ----------------------------------------------------------
   LOWER META AREA
   Compact the earned date + remove button
   ---------------------------------------------------------- */

.ely-ach-footer {
    width: 100%;
    margin-top: 6px;
    padding-top: 9px;
    border-top: 1px solid rgba(216, 179, 141, 0.15);
    color: #d0c3dc;
    font-size: 0.74rem;
    line-height: 1.4;
    text-align: center;
}

.ely-ach-footer i {
    color: var(--ach-champagne);
    margin-right: 4px;
}

.ely-ach-admin {
    width: 100%;
    margin-top: 8px;
    text-align: center;
}

.ely-ach-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 4px 12px;
    border: 1px solid rgba(216, 179, 141, 0.30);
    border-radius: 999px;
    background: rgba(50, 38, 66, 0.65);
    color: #d9c8c4;
    font-size: 0.71rem;
    cursor: pointer;
    transition: 0.2s ease;
}

.ely-ach-remove:hover {
    border-color: #d59dac;
    background: rgba(118, 58, 93, 0.32);
    color: #ffd8de;
}

/* ----------------------------------------------------------
   EMPTY STATE
   ---------------------------------------------------------- */



.ely-ach-empty {
    padding: 55px 24px;
    border: 1px dashed rgba(216, 179, 141, 0.35);
    border-radius: 22px;
    background: rgba(37, 31, 58, 0.62);
    color: var(--ach-muted);
    text-align: center;
}

.ely-ach-empty i {
    display: block;
    margin-bottom: 15px;
    color: var(--ach-champagne);
    font-size: 2.2rem;
}

/* ==========================================
   MEMORY MOTH ACHIEVEMENT PROGRESS
   ========================================== */

.ely-ach-progress {
    width: 100%;
    margin: 10px 0 14px;
    padding: 0 6px;
}

.ely-ach-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;

    margin-bottom: 7px;

    color: #d8b38d;
    font-size: 0.72rem;
    font-weight: 600;
}

.ely-ach-progress-track {
    width: 100%;
    height: 9px;

    overflow: hidden;

    border: 1px solid rgba(216, 179, 141, 0.4);
    border-radius: 999px;

    background: rgba(24, 19, 39, 0.8);
}

.ely-ach-progress-fill {
    height: 100%;
    min-width: 0;

    border-radius: inherit;

    background: linear-gradient(
        90deg,
        #a17449 0%,
        #d8b38d 55%,
        #ffffd1 100%
    );

    transition: width 0.35s ease;
}

/* ==========================================================
   FLIP-CARD MEMORY MOTH GALLERY
   SVG is displayed in its original colors, without masks/tint.
   ========================================================== */
.ely-ach-memory-moth .ely-ach-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
    gap: 18px;
    align-items: start;
}

.ely-ach-memory-moth .ely-ach-card {
    position: relative;
    width: 100%;
    height: 290px;
    min-height: 0;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
    perspective: 1200px;
    cursor: pointer;
}
.ely-ach-memory-moth .ely-ach-card::before,
.ely-ach-memory-moth .ely-ach-card::after { display: none; }
.ely-ach-memory-moth .ely-moth-flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform .6s ease;
}
.ely-ach-memory-moth .moth-flipped .ely-moth-flip-inner {
    transform: rotateY(180deg);
}
.ely-ach-memory-moth .ely-moth-face {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    overflow: hidden;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}
.ely-ach-memory-moth .ely-moth-front {
    isolation: isolate;
    background: url('../images/MothCard.svg') center / 100% 100% no-repeat;
}
.ely-ach-memory-moth .ely-moth-front::before,
.ely-ach-memory-moth .ely-moth-front::after {
    content: none;
    display: none;
}
.ely-ach-memory-moth .ely-moth-open {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
}
.ely-ach-memory-moth .ely-moth-open .ely-ach-icon-frame {
    position: absolute;
    top: 2px;
    left: 12px;
    right: 12px;
    width: auto;
    height: 195px;
    min-height: 0;
    max-height: none;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    box-shadow: none;
}
.ely-ach-memory-moth .ely-moth-open .ely-ach-icon {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 3px 4px rgba(0,0,0,.2));
}
.ely-ach-memory-moth .ely-moth-open .ely-ach-name {
    position: absolute;
    left: 50%;
    bottom: 80px;
    transform: translateX(-50%);
    display: block;
    width: calc(100% - 30px);
    min-height: 0;
    padding: 0 3px;
    margin: 0;
    background: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    color: #c8b1eb;
    font-family: inherit;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
    text-shadow: 0 1px 3px rgba(18,13,33,.45);
    overflow-wrap: anywhere;
}

/* Reverse side matches the front's size; long details scroll inside. */
.ely-ach-memory-moth .ely-moth-back {
    transform: rotateY(180deg);
    background: #302b46;
    border: 1px solid #706384;
    border-radius: 12px;
    padding: 18px 14px;
    color: #eee5f1;
    box-shadow: 0 6px 20px rgba(15,10,30,.22);
}
.ely-ach-memory-moth .ely-moth-back-scroll {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
}
.ely-ach-memory-moth .ely-moth-back-title {
    text-align: center;
    font-size: 16px;
    margin: 0 0 12px;
}
.ely-ach-memory-moth .ely-moth-back .ely-ach-tags { margin-bottom: 10px; }
.ely-ach-memory-moth .ely-moth-back .ely-ach-description {
    width: 100%;
    padding: 0;
    font-size: 12px;
    line-height: 1.5;
}
.ely-ach-memory-moth .ely-moth-back .ely-ach-footer {
    margin-top: 12px;
    font-size: 11px;
}
.ely-ach-memory-moth .ely-moth-back a,
.ely-ach-memory-moth .ely-moth-back button { cursor: pointer; }
.ely-ach-memory-moth .ely-moth-back .ely-ach-claim-form {
    width: auto;
    margin: 9px 0 0;
    text-align: center;
}
.ely-ach-memory-moth .ely-moth-back .ely-ach-claim-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: auto;
    min-width: 82px;
    padding: 6px 15px;
    font-size: 12px;
    line-height: 1.25;
    border-radius: 7px;
}

/* Locked achievements display progress on the cover. */
.ely-ach-memory-moth .locked .ely-moth-open .ely-ach-name {
    bottom: 80px;
}
.ely-ach-memory-moth .locked .ely-moth-front .ely-ach-progress {
    position: absolute;
    left: 12%;
    bottom: 48px;
    width: 76%;
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}
.ely-ach-memory-moth .locked .ely-moth-front .ely-ach-progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 10px;
    color: #d7c5f0;
}
.ely-ach-memory-moth .locked .ely-moth-front .ely-ach-progress-track {
    height: 10px;
    border: 1px solid rgba(196,174,228,.35);
    border-radius: 99px;
    overflow: hidden;
    background: #241e38;
}
.ely-ach-memory-moth .locked .ely-moth-front .ely-ach-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #e59e4d, #ffe096);
}
.ely-ach-memory-moth .locked .ely-moth-front .ely-ach-icon {
    opacity: .48;
    filter: grayscale(.7);
}

/* Unclaimed rewards give the moth a gentle, occasional wiggle. */
.ely-ach-memory-moth .moth-has-rewards .ely-ach-icon {
    animation: elyMothRewardWiggle 5s ease-in-out infinite;
}
@keyframes elyMothRewardWiggle {
    0%, 76%, 100% { transform: rotate(0); }
    81% { transform: rotate(-3deg); }
    86% { transform: rotate(3deg); }
    91% { transform: rotate(-1deg); }
}
.ely-ach-memory-moth .ely-ach-card:focus-visible {
    outline: 2px solid #b8a1d8;
    outline-offset: 4px;
}

/* Layout at narrow widths, preserving space for the title and bar. */
@media (max-width: 560px) {
    .ely-ach-memory-moth .ely-ach-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }
    .ely-ach-memory-moth .ely-ach-card { height: 270px; }
    .ely-ach-memory-moth .ely-moth-open .ely-ach-icon-frame {
        top: 30px;
        height: 175px;
    }
    .ely-ach-memory-moth .ely-moth-open .ely-ach-name {
        bottom: 33px;
        font-size: 12px;
    }
    .ely-ach-memory-moth .locked .ely-moth-open .ely-ach-icon-frame {
        top: 15px;
        height: 125px;
    }
    .ely-ach-memory-moth .locked .ely-moth-open .ely-ach-name { bottom: 70px; }
    .ely-ach-memory-moth .locked .ely-moth-front .ely-ach-progress {
        bottom: 24px;
        left: 12px;
        right: 12px;
        width: auto;
    }
}
@media (prefers-reduced-motion: reduce) {
    .ely-ach-memory-moth .ely-moth-flip-inner { transition: none; }
    .ely-ach-memory-moth .moth-has-rewards .ely-ach-icon { animation: none; }
}


/* ==========================================
   MEMORY MOTH — ENAMEL PIN EFFECT
   ========================================== */

/* Container for both moth artwork layers */
.ely-ach-memory-moth .ely-pin-layers {
    position: relative;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
}

/* Keep artwork, lineart and shine aligned */
.ely-ach-memory-moth .ely-pin-base,
.ely-ach-memory-moth .ely-pin-lineart,
.ely-ach-memory-moth .ely-pin-shine {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

/* Original colored moth and gold lineart */
.ely-ach-memory-moth .ely-pin-base,
.ely-ach-memory-moth .ely-pin-lineart {
    display: block;
    object-fit: contain;
    object-position: center;
    pointer-events: none;
}

/* Give the gold outline a little depth */
.ely-ach-memory-moth .ely-pin-lineart {
    filter: drop-shadow(0 1px 1px rgba(20, 13, 33, 0.45));
}

/* Animated reflection across gold lineart only */
.ely-ach-memory-moth .ely-pin-shine {
    pointer-events: none;

    background: linear-gradient(
        110deg,
        transparent 30%,
        rgba(255, 237, 181, 0.05) 43%,
        rgba(255, 252, 223, 0.95) 50%,
        rgba(255, 225, 151, 0.16) 56%,
        transparent 68%
    );

    background-size: 270% 100%;
    background-position: 130% 0;

    /* Mask shine to the gold lineart */
    -webkit-mask-image: var(--pin-mask);
    mask-image: var(--pin-mask);

    -webkit-mask-size: contain;
    mask-size: contain;

    -webkit-mask-position: center;
    mask-position: center;

    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;

    animation: elyGoldPinSweep 4s ease-in-out infinite;
}

/* Metallic shine movement */
@keyframes elyGoldPinSweep {
    0%, 12% {
        background-position: 130% 0;
        opacity: 0;
    }

    19% {
        opacity: 1;
    }

    46% {
        background-position: -65% 0;
        opacity: 1;
    }

    57%, 100% {
        background-position: -65% 0;
        opacity: 0;
    }
}

/* Unclaimed rewards: wiggle the whole pin */
.ely-ach-memory-moth .moth-has-rewards .ely-pin-layers {
    animation: elyMothRewardWiggle 5s ease-in-out infinite;
}

/* Locked achievements remain muted */
.ely-ach-memory-moth .locked .ely-pin-layers {
    opacity: 0.48;
    filter: grayscale(0.7);
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .ely-ach-memory-moth .ely-pin-shine,
    .ely-ach-memory-moth .moth-has-rewards .ely-pin-layers {
        animation: none;
    }

    .ely-ach-memory-moth .ely-pin-shine {
        opacity: 0;
    }
}

