/* 全局移动端/平板适配 */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    overflow-x: hidden;
}

img, video, svg {
    max-width: 100%;
    height: auto;
}

pre, code {
    word-break: break-word;
}

pre {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

table {
    max-width: 100%;
}

/* 笔记按钮：安全区域 + 避免与侧边栏按钮重叠 */
#study-notes-fab {
    right: max(16px, env(safe-area-inset-right, 16px));
    bottom: max(20px, env(safe-area-inset-bottom, 20px));
}

#study-notes-panel {
    height: 100dvh;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

@media (max-width: 1024px) {
    body.notes-panel-open {
        margin-right: 0 !important;
    }

    #study-notes-panel {
        width: 100vw;
        max-width: 100vw;
    }

    .notes-toolbar {
        flex-wrap: wrap;
        gap: 6px;
    }

    .notes-tab-dl {
        margin-left: 0;
    }

    #notes-status {
        max-width: 55%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

@media (max-width: 768px) {
    #study-notes-fab {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
}
