/* MindCare Gamification: premium wellness design system */

:root {
    --gami-teal: #0F766E;
    --gami-teal-soft: #CCFBF1;
    --gami-blue: #2563EB;
    --gami-blue-soft: #DBEAFE;
    --gami-success: #16A34A;
    --gami-warning: #B45309;
    --gami-surface: #FFFFFF;
    --gami-surface-soft: #F8FAFC;
    --gami-border: #E2E8F0;
    --gami-text: #0F172A;
    --gami-text-secondary: #475569;
    --gami-text-muted: #64748B;
    --gami-shadow: 0 12px 28px rgba(15, 23, 42, 0.07);
    --gami-shadow-soft: 0 6px 16px rgba(15, 23, 42, 0.05);
    --xp-color: var(--gami-warning);
}

[data-theme="dark"],
body.theme-charcoal {
    --gami-surface: #111827;
    --gami-surface-soft: #0F172A;
    --gami-border: #263244;
    --gami-text: #F8FAFC;
    --gami-text-secondary: #CBD5E1;
    --gami-text-muted: #94A3B8;
    --gami-shadow: 0 14px 28px rgba(0, 0, 0, 0.25);
    --gami-shadow-soft: 0 8px 18px rgba(0, 0, 0, 0.18);
}

@keyframes gamiSubtleIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.gami-card,
.challenge-banner,
.badge-item,
.timeline-content,
.wellness-score-card {
    background: var(--gami-surface);
    border: 1px solid var(--gami-border);
    border-radius: 8px;
    box-shadow: var(--gami-shadow-soft);
    color: var(--gami-text);
}

.gami-card {
    padding: 20px;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.gami-card:hover,
.badge-item:hover,
.timeline-content:hover {
    border-color: rgba(15, 118, 110, 0.35);
    box-shadow: var(--gami-shadow);
    transform: translateY(-1px);
}

.xp-summary-chip,
.level-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 36px;
    border-radius: 999px;
    border: 1px solid var(--gami-border);
    background: var(--gami-surface-soft);
    color: var(--gami-text);
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1;
    box-shadow: none;
    text-shadow: none;
    white-space: nowrap;
}

.xp-summary-chip {
    padding: 8px 14px;
    color: var(--gami-warning);
    background: #FFF7ED;
    border-color: #FED7AA;
}

.xp-summary-chip i {
    animation: none;
    color: var(--gami-warning);
}

body.theme-charcoal .xp-summary-chip,
[data-theme="dark"] .xp-summary-chip {
    background: rgba(217, 119, 6, 0.14);
    border-color: rgba(217, 119, 6, 0.32);
}

.level-badge {
    padding: 8px 16px;
}

.level-seedling,
.level-explorer,
.level-builder,
.level-warrior,
.level-guardian,
.level-mentor {
    background: var(--gami-teal-soft);
    color: var(--gami-teal);
    border-color: rgba(15, 118, 110, 0.24);
}

.level-explorer { background: var(--gami-blue-soft); color: var(--gami-blue); border-color: rgba(37, 99, 235, 0.2); }
.level-builder { background: #DCFCE7; color: #15803D; border-color: rgba(22, 163, 74, 0.22); }
.level-warrior { background: #FEF3C7; color: var(--gami-warning); border-color: rgba(217, 119, 6, 0.25); }
.level-guardian { background: #E0F2FE; color: #0369A1; border-color: rgba(3, 105, 161, 0.22); }
.level-mentor { background: #F1F5F9; color: var(--gami-text-secondary); border-color: var(--gami-border); }

.challenge-banner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 24px;
    align-items: center;
    padding: 24px;
    overflow: hidden;
    border-left: 5px solid var(--gami-teal);
    box-shadow: var(--gami-shadow-soft);
}

.challenge-banner::after {
    display: none;
}

.challenge-banner-info h3 {
    margin: 0 0 8px;
    color: var(--gami-text);
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0;
}

.challenge-banner-info p {
    margin: 0 0 16px;
    color: var(--gami-text-secondary);
    font-size: 0.92rem;
    line-height: 1.5;
}

.challenge-progress,
.wellness-tree-progress {
    width: 100%;
    height: 10px;
    background: #EAF2F1;
    border-radius: 999px;
    overflow: hidden;
}

.challenge-progress-fill,
.wellness-tree-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--gami-teal), #14B8A6);
    border-radius: inherit;
    transition: width 0.7s ease;
}

.challenge-reward {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 156px;
    padding: 12px 14px;
    border-radius: 16px;
    background: var(--gami-surface-soft);
    border: 1px solid var(--gami-border);
    color: var(--gami-text-secondary);
}

.challenge-reward i {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--gami-teal-soft);
    color: var(--gami-teal);
    font-size: 1rem;
    margin: 0;
}

.challenge-reward span {
    color: var(--gami-text);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.wellness-tree-card {
    position: relative;
    overflow: hidden;
    text-align: left;
    padding: 22px;
}

.wellness-tree-card .section-title {
    color: var(--gami-text);
}

.wellness-tree-visual {
    width: 112px;
    height: 112px;
    margin: 22px auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 32px;
    background: linear-gradient(180deg, #F0FDFA 0%, #FFFFFF 100%);
    border: 1px solid rgba(15, 118, 110, 0.16);
    color: var(--gami-teal);
    box-shadow: inset 0 -10px 22px rgba(15, 118, 110, 0.06);
    font-size: 2.8rem;
    animation: none;
    filter: none;
    transition: transform 0.25s ease, background 0.25s ease;
}

.wellness-tree-visual i {
    color: currentColor;
}

.wellness-tree-visual.level-up-pulse {
    transform: scale(1.03);
    background: #ECFDF5;
}

.mission-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.mission-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 14px;
    background: var(--gami-surface-soft);
    border: 1px solid var(--gami-border);
    border-radius: 18px;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.mission-item.completed {
    opacity: 1;
    background: #F0FDFA;
    border-color: rgba(15, 118, 110, 0.24);
}

.mission-item.completed .mission-title {
    color: var(--gami-teal);
    text-decoration: none;
}

.mission-info {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.mission-icon {
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gami-teal-soft);
    color: var(--gami-teal);
    font-size: 1rem;
}

.mission-title {
    margin: 0 0 4px;
    color: var(--gami-text);
    font-size: 0.94rem;
    font-weight: 750;
}

.mission-reward {
    color: var(--gami-text-muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.mission-item button,
.celebration-btn {
    border: 1px solid rgba(15, 118, 110, 0.2);
    background: var(--gami-teal);
    color: #FFFFFF;
    border-radius: 12px;
    font-weight: 750;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease;
}

.mission-item button:hover,
.celebration-btn:hover {
    background: #115E59;
    transform: translateY(-1px);
    opacity: 1;
}

.badge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.badge-item {
    min-height: 154px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    gap: 8px;
    padding: 16px;
    cursor: default;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.badge-item.locked {
    opacity: 0.64;
    filter: none;
}

.badge-icon {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
    background: var(--gami-blue-soft);
    color: var(--gami-blue);
    font-size: 1.05rem;
    margin: 0;
    filter: none;
}

.badge-item.locked .badge-icon {
    background: #E2E8F0;
    color: var(--gami-text-muted);
}

.badge-title {
    color: var(--gami-text);
    font-size: 0.88rem;
    font-weight: 800;
    line-height: 1.25;
}

.celebration-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
}

.celebration-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.celebration-modal {
    width: min(420px, 100%);
    padding: 28px;
    border-radius: 24px;
    background: var(--gami-surface);
    border: 1px solid var(--gami-border);
    box-shadow: var(--gami-shadow);
    text-align: left;
    transform: translateY(8px);
    transition: transform 0.22s ease;
}

.celebration-overlay.active .celebration-modal {
    transform: translateY(0);
    animation: gamiSubtleIn 0.24s ease both;
}

.celebration-icon {
    width: 54px;
    height: 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 0 18px;
    border-radius: 18px;
    background: var(--gami-teal-soft);
    color: var(--gami-teal);
    font-size: 1.35rem;
    animation: none;
}

.celebration-title {
    margin: 0 0 8px;
    color: var(--gami-text);
    font-size: 1.25rem;
    font-weight: 850;
    background: none;
    -webkit-text-fill-color: currentColor;
}

.celebration-desc {
    margin: 0 0 22px;
    color: var(--gami-text-secondary);
    line-height: 1.55;
}

.celebration-btn {
    width: 100%;
    min-height: 46px;
    padding: 12px 16px;
}

.timeline-container {
    position: relative;
    padding-left: 28px;
}

.timeline-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10px;
    width: 2px;
    height: 100%;
    background: var(--gami-border);
}

.timeline-item {
    position: relative;
    padding-bottom: 22px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: -28px;
    top: 2px;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: var(--gami-surface);
    border: 4px solid var(--gami-teal);
    z-index: 1;
}

.timeline-content {
    padding: 15px;
}

.timeline-date {
    margin-bottom: 5px;
    color: var(--gami-text-muted);
    font-size: 0.75rem;
    font-weight: 750;
}

.timeline-title {
    color: var(--gami-text);
    font-weight: 800;
    margin-bottom: 4px;
}

.wellness-score-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
}

.wellness-score-circle {
    position: relative;
    width: 96px;
    height: 96px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: conic-gradient(var(--gami-teal) 80%, #E2E8F0 80%);
}

.wellness-score-circle::before {
    content: '';
    position: absolute;
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: var(--gami-surface);
}

.wellness-score-value {
    position: relative;
    color: var(--gami-text);
    font-size: 1.7rem;
    font-weight: 850;
}

.wellness-score-info h3 {
    margin: 0 0 6px;
    color: var(--gami-text);
}

.wellness-score-info p {
    margin: 0;
    color: var(--gami-text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

@media (max-width: 768px) {
    .challenge-banner {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 20px;
    }

    .challenge-reward {
        width: 100%;
        justify-content: flex-start;
    }

    .mission-item {
        grid-template-columns: 1fr;
    }

    .mission-item > div:last-child {
        justify-self: stretch;
    }

    .mission-item button {
        width: 100%;
        min-height: 42px;
    }

    .wellness-score-card {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gami-card,
    .badge-item,
    .timeline-content,
    .challenge-progress-fill,
    .wellness-tree-progress-bar,
    .celebration-overlay,
    .celebration-modal,
    .mission-item button,
    .celebration-btn {
        transition: none !important;
        animation: none !important;
    }
}
