:root {
    --fm-bg: rgba(255, 255, 255, 0.96);
    --fm-ink: #1f2326;
    --fm-muted: #60656b;
    --fm-shadow: 0 14px 40px rgba(12, 18, 28, 0.18);
    --fm-radius: 14px;
    --fm-border: rgba(0, 0, 0, 0.06);
    --fm-success: #1b8c5a;
    --fm-error: #d03a3a;
    --fm-warning: #b86b12;
    --fm-info: #2f80ed;
}

.float-messages {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.float-messages__stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.float-message {
    position: relative;
    display: grid;
    grid-template-columns: 36px 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 16px 18px;
    background: var(--fm-bg);
    color: var(--fm-ink);
    border-radius: var(--fm-radius);
    border: 1px solid var(--fm-border);
    box-shadow: var(--fm-shadow);
    min-width: 280px;
    max-width: 380px;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
    animation: fm-in 0.25s ease forwards;
    overflow: hidden;
}

.float-message__icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    background: var(--fm-info);
}

.float-message__body {
    display: grid;
    gap: 4px;
}

.float-message__title {
    font-size: 0.92rem;
    font-weight: 600;
}

.float-message__text {
    font-size: 0.85rem;
    color: var(--fm-muted);
    line-height: 1.4;
}

.float-message__close {
    border: none;
    background: transparent;
    color: var(--fm-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.float-message__close:hover {
    color: var(--fm-ink);
}

.float-message__bar {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 100%;
    background: rgba(0, 0, 0, 0.06);
    transform-origin: left;
    animation: fm-progress linear forwards;
    animation-duration: var(--fm-duration, 5200ms);
}

.float-message--success .float-message__icon {
    background: var(--fm-success);
}

.float-message--error .float-message__icon {
    background: var(--fm-error);
}

.float-message--warning .float-message__icon {
    background: var(--fm-warning);
}

.float-message--info .float-message__icon {
    background: var(--fm-info);
}

.float-message--success .float-message__bar {
    background: rgba(27, 140, 90, 0.25);
}

.float-message--error .float-message__bar {
    background: rgba(208, 58, 58, 0.25);
}

.float-message--warning .float-message__bar {
    background: rgba(184, 107, 18, 0.25);
}

.float-message--info .float-message__bar {
    background: rgba(47, 128, 237, 0.25);
}

.float-message.is-leaving {
    animation: fm-out 0.2s ease forwards;
}

@keyframes fm-in {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes fm-out {
    to {
        opacity: 0;
        transform: translateY(-6px) scale(0.98);
    }
}

@keyframes fm-progress {
    to {
        transform: scaleX(0);
    }
}

@media (max-width: 720px) {
    .float-messages {
        right: 12px;
        left: 12px;
    }

    .float-message {
        width: 100%;
        max-width: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .float-message,
    .float-message__bar {
        animation: none;
    }
}
