/* ===== Worldbook 全屏布局适配 ===== */
#worldbookApp {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: auto;
    z-index: 10000; /* 确保在最顶层 */
    display: flex;
    flex-direction: column;
    background: #1e1e2e; /* 换成深色背景适配您的弹窗风格 */
    overflow: hidden;
    box-sizing: border-box; /* 防止边距撑破布局 */
}

/* 确保内部所有元素计算尺寸一致 */
#worldbookApp * {
    box-sizing: border-box;
}


.worldbook-app {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* iOS 安全区域适配 */
@supports (padding-top: env(safe-area-inset-top)) {
    #worldbookApp {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Worldbook App Styles */
.wb-header {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #fff;
    border-bottom: 1px solid #eee;
}

.wb-title {
    flex: 1;
    font-size: 18px;
    font-weight: bold;
    text-align: center;
}

.wb-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 15px;
    background: #f4f4f9;
    -webkit-overflow-scrolling: touch; /* 让 iOS 滚动更流畅 */
    padding-bottom: 80px; /* 为右下角悬浮按钮留出空间防止遮挡 */
}


.wb-book-item {
    background: #fff;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    cursor: pointer;
}

.wb-book-icon {
    width: 40px;
    height: 40px;
    background: #8e44ad;
    color: #fff;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 15px;
    font-size: 20px;
}

.wb-book-info {
    flex: 1;
}

.wb-book-name {
    font-weight: bold;
    font-size: 16px;
}

.wb-book-count {
    font-size: 12px;
    color: #999;
}

.wb-entry-item {
    background: #fff;
    padding: 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

.wb-entry-keys {
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 5px;
}

.wb-entry-preview {
    font-size: 12px;
    color: #7f8c8d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wb-fab {
    position: absolute; /* 改为相对于父容器绝对定位 */
    bottom: 30px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: #1890ff; /* 建议改为常用的蓝色或紫色 */
    color: #fff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    cursor: pointer;
    z-index: 10001;
    transition: transform 0.2s;
}


.wb-fab:active {
    transform: scale(0.95);
    background: #7d3c98;
}

@supports (-webkit-touch-callout: none) {
    .wb-fab {
        bottom: calc(40px + env(safe-area-inset-bottom, 0px));
    }
}


.wb-tabs {
    display: flex;
    background: #fff;
    border-bottom: 1px solid #eee;
}

.wb-tab {
    flex: 1;
    text-align: center;
    padding: 10px;
    font-size: 14px;
    color: #999;
    cursor: pointer;
}

.wb-tab.active {
    color: #8e44ad;
    border-bottom: 2px solid #8e44ad;
    font-weight: bold;
}

.wb-bind-item {
    background: #fff;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 10px;
}

.wb-bind-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.wb-bind-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-size: cover;
    margin-right: 10px;
}

.wb-bind-books {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.wb-chip {
    padding: 5px 10px;
    background: #eee;
    border-radius: 15px;
    font-size: 12px;
    cursor: pointer;
}

.wb-chip.selected {
    background: #8e44ad;
    color: #fff;
}
