.quests-leaderboard {
    --quests-surface: #ffffff;
    --quests-surface-alt: #f8fafc;
    --quests-border: #e2e8f0;
    --quests-text: #0f172a;
    --quests-text-muted: #64748b;
    --quests-text-secondary: #475569;
    --quests-shadow: 0 10px 24px rgba(15, 23, 42, 0.07);
    max-width: 1080px;
    margin: 0 auto;
    padding: 1.85rem 0.9rem 2.75rem;
    font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
    color: var(--quests-text);
    display: flex;
    flex-direction: column;
}
.quests-hero { order: 1; }
.quests-card--leaderboard { order: 2; }
.quests-card--catalog { order: 3; }
.quests-login-notice { order: 2; }
.quests-login-notice + .quests-card--leaderboard { order: 3; }
.quests-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    padding: 1.1rem;
    border-radius: 10px;
    background: radial-gradient(circle at 20% 20%, rgba(37, 99, 235, 0.15), transparent 45%), #0f172a;
    color: #e2e8f0;
}
.quests-hero h1 {
    margin: 0.2rem 0 0.35rem;
    color: #fff;
}
.quests-hero__badge {
    text-align: center;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    min-width: 120px;
}
.quests-hero__badge strong {
    display: block;
    font-size: 1.8rem;
}
.quests-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.85rem;
    color: #a5b4fc;
    margin: 0;
}
.quests-lead {
    max-width: 720px;
    margin: 0.25rem 0 0.6rem;
    color: #cbd5e1;
}
.quests-cta {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}
.quests-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 0.9rem;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #0f172a;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.quests-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
}
.quests-btn:disabled {
    cursor: default;
    opacity: 0.72;
    transform: none;
    box-shadow: none;
}
.quests-btn--primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    border-color: #1d4ed8;
}
.quests-btn--ghost {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
}
.quests-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    background: #ecfeff;
    color: #0f172a;
    border: 1px solid #bae6fd;
    font-weight: 600;
}
.quests-badge--muted {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #475569;
}
.quests-login-notice {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-top: 1rem;
    padding: 0.9rem 1rem;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    background: #eff6ff;
    color: #1e3a8a;
    box-shadow: var(--quests-shadow);
}
.quests-login-notice i {
    color: #2563eb;
    font-size: 1.15rem;
}
.quests-login-notice div {
    display: grid;
    gap: 0.15rem;
    flex: 1 1 auto;
}
.quests-login-notice strong {
    color: #172554;
}
.quests-login-notice span {
    color: #1e40af;
}
.quests-login-notice a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.25rem;
    padding: 0.45rem 0.85rem;
    border-radius: 8px;
    background: #2563eb;
    color: #fff;
    font-weight: 700;
    text-decoration: none;
}
.quests-login-notice a:hover,
.quests-login-notice a:focus-visible {
    background: #1d4ed8;
}
.quests-card {
    margin-top: 1rem;
    background: var(--quests-surface);
    border: 1px solid var(--quests-border);
    border-radius: 10px;
    padding: 1rem;
    box-shadow: var(--quests-shadow);
}
.quests-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}
.quests-card__header h2 {
    margin: 0 0 0.15rem;
}
.quests-card__meta {
    display: flex;
    gap: 0.4rem;
}
.quests-optin {
    display: grid;
    grid-template-columns: 2fr auto;
    gap: 0.5rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--quests-border);
    border-radius: 8px;
    background: var(--quests-surface-alt);
    align-items: center;
    margin-bottom: 0.75rem;
}
.quests-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    color: #0f172a;
}
.quests-status {
    grid-column: 1 / -1;
    color: var(--quests-text-secondary);
}
.quests-available__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.75rem;
}
.quest-card--mini .quest-card__actions {
    margin-top: 0.5rem;
}
.quests-table {
    border: 1px solid var(--quests-border);
    border-radius: 8px;
    overflow: hidden;
}
.quests-table__head,
.quests-table__row {
    display: grid;
    grid-template-columns: 60px 1.6fr 0.8fr 0.8fr 0.8fr;
    align-items: center;
    gap: 0.5rem;
    padding: 0.62rem 0.8rem;
}
.quests-table__head {
    background: var(--quests-surface-alt);
    font-weight: 700;
    color: var(--quests-text-secondary);
}
.quests-table__row:nth-child(2n) {
    background: var(--quests-surface-alt);
}
.quests-table__row a {
    color: #1d4ed8;
    text-decoration: none;
}
.quests-user strong {
    color: #0f172a;
}
.quests-rank {
    font-weight: 700;
    font-size: 1.1rem;
}
.quests-user {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.quests-user small {
    color: var(--quests-text-muted);
}
.quests-level,
.quests-xp,
.quests-country {
    font-weight: 600;
}
.quests-empty {
    padding: 1rem;
    border: 1px dashed var(--quests-border);
    border-radius: 8px;
    text-align: center;
    color: var(--quests-text-muted);
}
.quests-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.75rem;
}
.quests-group-list {
    display: grid;
    gap: 0.9rem;
}
.quests-group {
    border: 1px solid var(--quests-border);
    border-radius: 8px;
    background: var(--quests-surface);
    overflow: hidden;
}
.quests-group__header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1rem;
    background: var(--quests-surface-alt);
    border-bottom: 1px solid var(--quests-border);
}
.quests-group__title {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}
.quests-group__title h3 {
    margin: 0 0 0.2rem;
}
.quests-group__title p {
    margin: 0;
    color: var(--quests-text-secondary);
}
.quests-group__icon {
    width: 2.25rem;
    height: 2.25rem;
    display: inline-grid;
    place-items: center;
    border-radius: 8px;
    background: #e0f2fe;
    color: #0369a1;
    flex: 0 0 auto;
}
.quests-steps {
    display: grid;
}
.quest-step {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.78rem 1rem;
    border-top: 1px solid var(--quests-border);
}
.quest-step:first-child {
    border-top: 0;
}
.quest-step.is-completed {
    background: linear-gradient(90deg, rgba(22, 163, 74, 0.08), transparent);
}
.quest-step__target {
    min-height: 2.3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    color: #075985;
    font-weight: 750;
    white-space: nowrap;
}
.quest-step__slug {
    margin: 0;
    font-size: 0.78rem;
    color: var(--quests-text-muted);
}
.quest-step h4 {
    margin: 0.1rem 0 0.15rem;
    font-size: 1rem;
}
.quest-step__body p:not(.quest-step__slug),
.quest-step__body small {
    margin: 0;
    color: var(--quests-text-secondary);
}
.quest-step__meta {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}
.quests-card__progress-label {
    margin: 0.25rem 0 0;
    color: var(--quests-text-secondary);
    font-weight: 600;
}
.quest-tile {
    border: 1px solid var(--quests-border);
    border-radius: 10px;
    padding: 0.8rem 0.9rem;
    background: var(--quests-surface);
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.05);
}
.quest-tile__header {
    display: flex;
    justify-content: space-between;
    gap: 0.6rem;
    align-items: center;
}
.quest-tile__slug {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.8rem;
    color: var(--quests-text-secondary);
}
.quest-tile h3 {
    margin: 0.2rem 0 0.25rem;
}
.quest-tile__desc {
    margin: 0 0 0.5rem;
    color: var(--quests-text-secondary);
}
.quest-tile__meta {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    align-items: center;
}
.quests-badge--xp {
    background: #ecfdf3;
    border-color: #bbf7d0;
    color: #166534;
}
.quests-diff--easy { background:#ecfeff; border-color:#bae6fd; color:#0ea5e9; }
.quests-diff--normal { background:#eff6ff; border-color:#bfdbfe; color:#1d4ed8; }
.quests-diff--hard { background:#fef3c7; border-color:#fde68a; color:#d97706; }
.quests-diff--epic { background:#fef2f2; border-color:#fecdd3; color:#dc2626; }
.quests-diff--legendary { background:#f5f3ff; border-color:#ddd6fe; color:#7c3aed; }

@media (max-width: 860px) {
    .quests-hero {
        flex-direction: column;
        align-items: flex-start;
    }
    .quests-login-notice {
        align-items: flex-start;
    }
    .quests-card__header {
        flex-direction: column;
        align-items: flex-start;
    }
    .quests-table__head,
    .quests-table__row {
        grid-template-columns: 50px 1.4fr 0.8fr 0.8fr;
    }
    .quests-table__head span:last-child,
    .quests-table__row span:last-child {
        display: none;
    }
}

@media (max-width: 640px) {
    .quests-leaderboard {
        padding: 1.45rem 0.8rem 2.3rem;
    }

    .quests-hero,
    .quests-login-notice,
    .quests-card {
        padding: 0.9rem;
    }

    .quests-login-notice {
        flex-direction: column;
        align-items: stretch;
    }

    .quests-hero__badge {
        width: 100%;
        min-width: 0;
    }

    .quests-optin {
        grid-template-columns: 1fr;
    }

    .quests-group__header {
        flex-direction: column;
        align-items: flex-start;
    }

    .quest-step {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .quest-step__target {
        justify-content: flex-start;
        padding: 0 0.7rem;
        width: fit-content;
    }

    .quest-step__meta {
        justify-content: flex-start;
    }

    .quests-table__head,
    .quests-table__row {
        grid-template-columns: 46px 1fr 0.9fr;
        padding-inline: 0.75rem;
    }

    .quests-table__head span:nth-child(4),
    .quests-table__row span:nth-child(4),
    .quests-table__head span:nth-child(5),
    .quests-table__row span:nth-child(5) {
        display: none;
    }
}

body.dark-mode .quests-leaderboard {
    --quests-surface: rgba(15, 23, 42, 0.92);
    --quests-surface-alt: rgba(17, 24, 39, 0.88);
    --quests-border: rgba(71, 85, 105, 0.72);
    --quests-text: #f8fafc;
    --quests-text-muted: #94a3b8;
    --quests-text-secondary: #cbd5e1;
    --quests-shadow: 0 16px 36px rgba(2, 6, 23, 0.28);
}

body.dark-mode .quests-btn {
    box-shadow: none;
}

body.dark-mode .quests-btn--ghost {
    background: rgba(15, 23, 42, 0.36);
    border-color: rgba(148, 163, 184, 0.24);
}

body.dark-mode .quests-badge {
    background: rgba(8, 47, 73, 0.58);
    border-color: rgba(56, 189, 248, 0.3);
    color: #bae6fd;
}

body.dark-mode .quests-badge--muted {
    background: rgba(30, 41, 59, 0.92);
    border-color: rgba(71, 85, 105, 0.72);
    color: #cbd5e1;
}

body.dark-mode .quests-switch,
body.dark-mode .quests-level,
body.dark-mode .quests-xp,
body.dark-mode .quests-country {
    color: #f8fafc;
}

body.dark-mode .quests-table__row a {
    color: #93c5fd;
}

body.dark-mode .quests-user strong {
    color: #f8fafc;
}

body.dark-mode .quests-login-notice {
    background: rgba(30, 64, 175, 0.32);
    border-color: rgba(96, 165, 250, 0.42);
    color: #dbeafe;
}

body.dark-mode .quests-login-notice strong {
    color: #eff6ff;
}

body.dark-mode .quests-login-notice span {
    color: #bfdbfe;
}

body.dark-mode .quests-group__icon,
body.dark-mode .quest-step__target {
    background: rgba(8, 47, 73, 0.58);
    border-color: rgba(56, 189, 248, 0.3);
    color: #bae6fd;
}

body.dark-mode .quest-step.is-completed {
    background: linear-gradient(90deg, rgba(22, 101, 52, 0.3), transparent);
}

body.dark-mode .quests-diff--easy { background: rgba(8, 47, 73, 0.62); border-color: rgba(56, 189, 248, 0.28); color: #67e8f9; }
body.dark-mode .quests-diff--normal { background: rgba(30, 64, 175, 0.48); border-color: rgba(96, 165, 250, 0.28); color: #bfdbfe; }
body.dark-mode .quests-diff--hard { background: rgba(120, 53, 15, 0.44); border-color: rgba(245, 158, 11, 0.28); color: #fcd34d; }
body.dark-mode .quests-diff--epic { background: rgba(127, 29, 29, 0.44); border-color: rgba(248, 113, 113, 0.28); color: #fca5a5; }
body.dark-mode .quests-diff--legendary { background: rgba(76, 29, 149, 0.48); border-color: rgba(167, 139, 250, 0.28); color: #ddd6fe; }
