.header-section {
    text-align: center;
    margin-bottom: 3rem;
}

.header-section h1 {
    font-size: 2.5rem;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.header-section p {
    font-size: 1.1rem;
    color: #6b7280;
}

@media (max-width: 600px) {
    .header-section h1 { font-size: 1.8rem; }
    .header-section { margin-bottom: 1.5rem; }
}

#achievements-section {
    padding: 1rem 0;
}

.achievements-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem 3rem;
}

.achievements-loading {
    grid-column: 1 / -1;
    text-align: center;
    color: #6b7280;
    padding: 3rem;
    font-size: 1rem;
}

/* Skeleton loading */
.skeleton-card {
    background: var(--primary-color);
    border-radius: 14px;
    padding: 1.1rem 1.2rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    border: 1.5px solid var(--secondary-color);
}
.skeleton-icon  { width: 44px; height: 44px; border-radius: 10px; flex-shrink: 0; }
.skeleton-body  { flex: 1; display: flex; flex-direction: column; gap: 0.55rem; padding-top: 0.2rem; }
.skeleton-title { height: 14px; width: 55%; }
.skeleton-desc  { height: 11px; width: 80%; }
.skeleton-bar   { height: 8px; width: 100%; border-radius: 99px; margin-top: 0.2rem; }

/* ─── Achievement Card ─── */
.achievement-card {
    background: #fff;
    border-radius: 14px;
    padding: 1.1rem 1.2rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
    border: 2px solid transparent;
    position: relative;
    transition: transform 0.15s, box-shadow 0.15s;
}

.achievement-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
}

.achievement-card.unlocked {
    border-color: #22c55e;
    background: linear-gradient(135deg, #f0fdf4 0%, #fff 60%);
}

/* ─── Icon ─── */
.achievement-icon {
    font-size: 2rem;
    line-height: 1;
    flex-shrink: 0;
    width: 2.5rem;
    text-align: center;
    filter: grayscale(0.6) opacity(0.6);
    transition: filter 0.3s;
}

.achievement-card.unlocked .achievement-icon {
    filter: none;
}

/* ─── Body ─── */
.achievement-body {
    flex: 1;
    min-width: 0;
}

.achievement-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.2rem;
}

.achievement-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #111827;
    line-height: 1.3;
}

.achievement-xp {
    font-weight: 700;
    font-size: 0.78rem;
    color: #1e40af;
    background: #eff6ff;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    white-space: nowrap;
    flex-shrink: 0;
    border: 1px solid transparent;
    transition: color 0.2s, background 0.2s;
}

.achievement-card.unlocked .achievement-xp {
    color: #15803d;
    background: #dcfce7;
}

.achievement-desc {
    font-size: 0.82rem;
    color: #6b7280;
    margin-bottom: 0.7rem;
    line-height: 1.4;
}

/* ─── Progress bar ─── */
.achievement-progress-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.achievement-bar-track {
    flex: 1;
    height: 8px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.achievement-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #1e40af, #3b82f6);
    border-radius: 999px;
    transition: width 0.7s ease;
    min-width: 0;
}

.achievement-card.unlocked .achievement-bar-fill {
    background: linear-gradient(90deg, #16a34a, #22c55e);
}

.achievement-bar-label {
    font-size: 0.72rem;
    color: #9ca3af;
    white-space: nowrap;
    min-width: 2.8rem;
    text-align: right;
}

.achievement-card.unlocked .achievement-bar-label {
    color: #16a34a;
    font-weight: 600;
}

/* ─── Tier dots ─── */
.tier-dots {
    display: flex;
    gap: 5px;
    margin-top: 0.55rem;
}

.tier-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    border: 2px solid #d1d5db;
    background: transparent;
    transition: background 0.2s, border-color 0.2s;
    flex-shrink: 0;
}

.tier-dot.done {
    /* color set inline */
}

/* partial = at least one tier done but not all */
.achievement-card.partial {
    border-color: #e5e7eb;
    background: #fff;
}

/* ─── Unlocked checkmark badge ─── */
.achievement-check {
    position: absolute;
    top: -0.5rem;
    right: -0.5rem;
    width: 1.4rem;
    height: 1.4rem;
    background: #22c55e;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    box-shadow: 0 1px 4px rgba(34,197,94,0.4);
}

/* ─── Dark Mode ─── */
[data-theme="dark"] .header-section p { color: #9ca3af; }
[data-theme="dark"] .achievements-loading { color: #9ca3af; }

[data-theme="dark"] .achievement-card {
    background: #1a1d2e;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
[data-theme="dark"] .achievement-card.unlocked {
    background: linear-gradient(135deg, rgba(21,128,61,0.15) 0%, #1a1d2e 60%);
    border-color: #22c55e;
}
[data-theme="dark"] .achievement-card.partial {
    background: #1a1d2e; border-color: #2d3148;
}
[data-theme="dark"] .achievement-title { color: var(--text-color); }
[data-theme="dark"] .achievement-xp { background: rgba(30,64,175,0.3); color: #93c5fd; }
[data-theme="dark"] .achievement-card.unlocked .achievement-xp { background: rgba(21,128,61,0.3); color: #86efac; }
[data-theme="dark"] .achievement-desc { color: #9ca3af; }
[data-theme="dark"] .achievement-bar-track { background: #2d3148; }
[data-theme="dark"] .achievement-bar-label { color: #6b7280; }
[data-theme="dark"] .tier-dot { border-color: #4b5563; }

[data-theme="dark"] .achievement-icon {
    filter: grayscale(0.2) opacity(0.8);
}
[data-theme="dark"] .achievement-card.unlocked .achievement-icon {
    filter: saturate(1.3) brightness(1.15);
}

@media (max-width: 480px) {
    .achievements-list {
        grid-template-columns: 1fr;
    }
}
