/* ============================================================
 * Challenge Complete Modal — 챌린지 완료 축하 모달 + 풀스크린 컨페티
 * ============================================================ */

/* --- Confetti Canvas --- */
.ccm-confetti-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    pointer-events: none;
    z-index: 10001;
}

/* --- Overlay --- */
.ccm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
}
.ccm-overlay--visible {
    opacity: 1;
    pointer-events: auto;
}

/* --- Modal Container --- */
.ccm-modal {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(.9);
    z-index: 10000;
    width: 90%;
    max-width: 440px;
    max-height: 85vh;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease, transform .35s cubic-bezier(.34,1.56,.64,1);
    overflow-y: auto;
    overscroll-behavior: contain;
}
.ccm-modal--visible {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

/* --- Close Button --- */
.ccm-close {
    position: absolute;
    top: 14px; right: 14px;
    width: 32px; height: 32px;
    border: none;
    background: rgba(0,0,0,.06);
    border-radius: 50%;
    font-size: 18px;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
    z-index: 1;
}
.ccm-close:hover {
    background: rgba(0,0,0,.12);
}

/* --- Body --- */
.ccm-body {
    padding: 36px 28px 28px;
    text-align: center;
}

/* --- Trophy --- */
.ccm-trophy {
    font-size: 56px;
    line-height: 1;
    margin-bottom: 16px;
    animation: ccm-trophy-bounce .6s ease;
}
@keyframes ccm-trophy-bounce {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

/* --- Title & Subtitle --- */
.ccm-title {
    font-size: 22px;
    font-weight: 800;
    color: #2E2E2E;
    margin: 0 0 8px;
    line-height: 1.3;
}
.ccm-subtitle {
    font-size: 14px;
    color: #777;
    margin: 0 0 24px;
    line-height: 1.5;
}

/* --- Stats Row --- */
.ccm-stats {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-bottom: 24px;
}
.ccm-stat {
    flex: 1;
    max-width: 140px;
    padding: 14px 12px;
    background: #F8FBF8;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.ccm-stat__value {
    font-size: 20px;
    font-weight: 800;
    color: #3E6B4E;
}
.ccm-stat__label {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: .03em;
}

/* --- Next Challenges Section --- */
.ccm-next {
    text-align: left;
    margin-bottom: 24px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}
.ccm-next__title {
    font-size: 14px;
    font-weight: 700;
    color: #2E2E2E;
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.ccm-next__title::before {
    content: '🔗';
    font-size: 16px;
}
.ccm-next__list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* --- Next Challenge Card --- */
.ccm-next-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 10px;
    background: #FAFBF9;
    transition: background .2s;
}
.ccm-next-card:hover {
    background: #F0F4EF;
}
.ccm-next-card__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.ccm-next-card__name {
    font-size: 14px;
    font-weight: 600;
    color: #2E2E2E;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ccm-next-card__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #999;
}
.ccm-next-card__group {
    padding: 1px 7px;
    border-radius: 4px;
    background: #E8F5E9;
    color: #3E6B4E;
    font-size: 11px;
    font-weight: 600;
}
.ccm-next-card__right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.ccm-next-card__status {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
}
.ccm-next-card--recruiting .ccm-next-card__status {
    background: #E8F5E9;
    color: #2E7D32;
}
.ccm-next-card--active .ccm-next-card__status {
    background: #E3F2FD;
    color: #1565C0;
}

/* --- Join Button (in next card) --- */
.ccm-next-card__join {
    padding: 5px 14px;
    border: 2px solid #5B8C6B;
    border-radius: 8px;
    background: #fff;
    font-size: 12px;
    font-weight: 600;
    color: #5B8C6B;
    cursor: pointer;
    white-space: nowrap;
    transition: all .2s;
}
.ccm-next-card__join:hover {
    background: #5B8C6B;
    color: #fff;
}
.ccm-next-card__join:disabled {
    opacity: .6;
    cursor: default;
}
.ccm-next-card__join--done {
    border-color: #5B8C6B;
    background: #E8F5E9;
    color: #3E6B4E;
    cursor: default;
}

/* --- Action Buttons --- */
.ccm-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ccm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: all .2s;
    border: none;
}
.ccm-btn--primary {
    background: linear-gradient(135deg, #5B8C6B, #3E6B4E);
    color: #fff;
}
.ccm-btn--primary:hover {
    box-shadow: 0 4px 14px rgba(91,140,107,.35);
    transform: translateY(-1px);
}
.ccm-btn--secondary {
    background: #F5F5F5;
    color: #555;
}
.ccm-btn--secondary:hover {
    background: #EBEBEB;
}

/* --- Mobile Bottom-Sheet ≤ 600px --- */
@media (max-width: 600px) {
    .ccm-modal {
        top: auto;
        bottom: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        max-height: 90vh;
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
        transition: opacity .3s ease, transform .35s cubic-bezier(.34,1.2,.64,1);
    }
    .ccm-modal--visible {
        transform: translateY(0);
    }
    .ccm-body {
        padding: 32px 20px 24px;
    }
    .ccm-body::before {
        content: '';
        display: block;
        width: 36px; height: 4px;
        border-radius: 2px;
        background: #ddd;
        margin: 0 auto 20px;
    }
    .ccm-trophy {
        font-size: 48px;
    }
    .ccm-title {
        font-size: 20px;
    }
}
