.achievement {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1000;
    display: flex;
    align-items: center;
    width: 360px;
    max-width: calc(100vw - 40px);
    padding: 16px 12px 20px 16px;
    overflow: hidden;
    border-radius: 10px;
    background-color: #222C37;
    color: #ffffff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.achievement.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.achievement-icon {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    margin-right: 14px;
    border-radius: 50%;
    background-color: #6293B8;
    font-size: 22px;
    line-height: 48px;
    text-align: center;
}

.achievement-text {
    flex: 1 1 auto;
    min-width: 0;
}

.achievement-title {
    margin: 0 0 2px;
    font-size: 17px;
    font-weight: bold;
    line-height: 1.25;
}

.achievement-description {
    margin: 0;
    font-size: 14px;
    font-weight: lighter;
    line-height: 1.35;
    color: #D5E2EC;
}

.achievement .achievement-link {
    display: inline-block;
    margin-top: 6px;
    font-size: 13px;
    font-weight: bold;
    color: #8FBBDA;
    text-decoration: none;
}

.achievement .achievement-link:hover,
.achievement .achievement-link:focus {
    color: #ffffff;
    text-decoration: underline;
}

.achievement-close {
    flex: 0 0 auto;
    align-self: flex-start;
    width: 28px;
    height: 28px;
    margin-left: 8px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #D5E2EC;
    font-size: 22px;
    line-height: 28px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.achievement-close:hover,
.achievement-close:focus {
    background-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    outline: none;
}

.achievement-timer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 4px;
    background-color: rgba(255, 255, 255, 0.12);
}

.achievement-timer-bar {
    width: 100%;
    height: 100%;
    background-color: #6293B8;
    transform-origin: left center;
}

.achievement.is-visible .achievement-timer-bar {
    animation: achievement-timer var(--achievement-duration, 8s) linear forwards;
}

@keyframes achievement-timer {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

@media screen and (max-width: 640px) {
    .achievement {
        top: max(10px, env(safe-area-inset-top));
        right: 10px;
        bottom: auto;
        left: 10px;
        width: auto;
        max-width: none;
        transform: translateY(-130%);
    }

    .achievement.is-visible {
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .achievement {
        transform: none;
        transition: opacity 0.2s ease;
    }
}
