/* ============================================================
   全站浮层提示（toast）
   顶部居中偏上，自适应设备，自动消失，不占据页面布局空间。
   与 Bootstrap 的 .alert 独立，避免被页面样式覆盖。
   ============================================================ */

.n1-toast-stack {
    position: fixed;
    top: 8vh;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: min(92vw, 520px);
    pointer-events: none;
}

.n1-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: #ffffff;
    color: #1f2937;
    font-size: 14px;
    line-height: 1.55;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.16), 0 2px 6px rgba(15, 23, 42, 0.08);
    opacity: 0;
    transform: translateY(-12px) scale(0.98);
    transition: opacity 0.22s ease, transform 0.22s ease;
    word-break: break-word;
}

.n1-toast.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.n1-toast.is-leaving {
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
}

.n1-toast__icon {
    flex: 0 0 auto;
    margin-top: 1px;
    font-size: 15px;
    line-height: 1;
}

.n1-toast__body {
    flex: 1 1 auto;
    min-width: 0;
}

.n1-toast__close {
    flex: 0 0 auto;
    border: 0;
    background: transparent;
    color: inherit;
    opacity: 0.45;
    font-size: 18px;
    line-height: 1;
    padding: 0 2px;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.n1-toast__close:hover,
.n1-toast__close:focus-visible {
    opacity: 0.85;
}

/* 四种语义色 */
.n1-toast--success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #14532d;
}

.n1-toast--success .n1-toast__icon {
    color: #16a34a;
}

.n1-toast--error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #7f1d1d;
}

.n1-toast--error .n1-toast__icon {
    color: #dc2626;
}

.n1-toast--warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #78350f;
}

.n1-toast--warning .n1-toast__icon {
    color: #d97706;
}

.n1-toast--info {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e3a8a;
}

.n1-toast--info .n1-toast__icon {
    color: #2563eb;
}

/* 存在吸顶导航时（含手机汉堡菜单）把提示压到导航下方，
   避免盖住菜单按钮。--n1-toast-top 由 toast.js 实测量取。 */
@media (max-width: 991.98px) {
    .n1-toast-stack {
        top: var(--n1-toast-top, calc(env(safe-area-inset-top, 0px) + 12px));
    }
}

/* 小屏贴近顶部，避免遮挡输入框 */
@media (max-width: 575.98px) {
    .n1-toast-stack {
        width: calc(100vw - 24px);
        gap: 8px;
    }

    .n1-toast {
        padding: 11px 12px;
        font-size: 13.5px;
        border-radius: 9px;
    }
}

/* ============================================================
   顶部横幅（剩余额度 / 邮箱验证）
   与页面内容同宽显示并整体居中，避免长条提示从左侧开始
   ============================================================ */

.n1-top-banners .alert {
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
    justify-content: center;
}

.n1-top-banners .alert a {
    white-space: nowrap;
}

/* 尊重系统的减少动效设置 */
@media (prefers-reduced-motion: reduce) {
    .n1-toast {
        transition: opacity 0.01ms linear;
        transform: none;
    }

    .n1-toast.is-visible {
        transform: none;
    }

    .n1-toast.is-leaving {
        transform: none;
    }
}
