body {
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    overscroll-behavior: none;
    position: fixed;
    top: 0;
    left: 0;
}

.content-wrapper {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: none;
}

/* ===================== 视图切换 ===================== */

.org-view {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    padding: 16px 20px;
    overflow-y: auto;
    overscroll-behavior-y: none;
    flex: 1;
    min-height: 0;
}

/* ===================== 题包返回栏 ===================== */

.pack-back-bar {
    margin-bottom: 8px;
}

.pack-back-bar button {
    font-size: 0.95em;
    padding: 6px 12px;
}

/* ===================== 题库树 ===================== */

.lib-item {
    margin-bottom: 8px;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.lib-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--opt-bg);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: 0.1s;
}

.lib-header span:first-child {
    font-weight: 600;
}

.lib-header-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.lib-header-actions button {
    padding: 4px 8px;
    font-size: 0.8em;
    border-radius: 6px;
}

.lib-body {
    padding: 6px 8px;
}

.lib-body:empty::after {
    content: '空题库';
    display: block;
    text-align: center;
    color: var(--text-sec);
    font-size: 0.9em;
    padding: 8px;
}

.pack-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.1s;
    margin-bottom: 2px;
    border: 1px solid transparent;
}

.pack-item .pack-count {
    font-size: 0.85em;
    color: var(--text-sec);
    flex-shrink: 0;
}

.pack-item-actions {
    display: flex;
    gap: 4px;
    margin-left: auto;
    flex-shrink: 0;
}

.pack-item-actions button {
    padding: 4px 8px;
    font-size: 0.8em;
    border-radius: 6px;
}

.sub-lib-item {
    margin: 4px 0 4px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.sub-lib-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: var(--opt-bg);
    cursor: pointer;
    font-size: 0.9em;
    transition: 0.1s;
}

.sub-lib-body {
    padding: 4px 6px;
}

.sub-lib-body:empty::after {
    content: '空';
    display: block;
    text-align: center;
    color: var(--text-sec);
    font-size: 0.85em;
    padding: 4px;
}

/* ===================== 题包名栏 ===================== */

.pack-name-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

/* ===================== 题目列表 ===================== */

.q-list-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    margin-bottom: 6px;
    cursor: pointer;
    transition: 0.1s;
    background: var(--opt-bg);
}

.q-list-item.dragging {
    opacity: 0.4;
}

.q-list-idx {
    font-size: 0.85em;
    color: var(--text-sec);
    min-width: 24px;
    text-align: center;
}

.q-list-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.q-list-actions {
    display: flex;
    gap: 4px;
}

/* ===================== 插入区域 ===================== */

.insert-zone {
    height: 6px;
    border-radius: 3px;
    margin: 4px 0;
    transition: 0.15s;
    cursor: pointer;
    position: relative;
}

.insert-zone-active,
.insert-zone.insert-zone-active {
    height: 24px;
    background: var(--opt-hover);
    border: 2px dashed var(--primary);
}

.insert-zone-active::after,
.insert-zone.insert-zone-active::after {
    content: "+";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: var(--primary);
    font-weight: 700;
}

/* ===================== 选项行 ===================== */

.opt-row {
    display: flex;
    gap: 5px;
    margin-bottom: 5px;
    align-items: center;
}

.stat-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.stat-row label {
    font-size: 0.9em;
    color: var(--text-sec);
}

/* ===================== 徽章 ===================== */

.badge {
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    flex-shrink: 0;
}

.badge-single { background: var(--primary); }
.badge-multiple { background: #e67e22; }
.badge-judg { background: #27ae60; }

.type-badge-single { opacity: 0.7; }
.type-badge-multiple { opacity: 0.7; }
.type-badge-judg { opacity: 0.7; }

/* ===================== 拖拽高亮 ===================== */

.drag-over {
    border-color: var(--primary) !important;
    background: var(--opt-hover) !important;
}

.lib-header.drag-over,
.sub-lib-header.drag-over {
    outline: 2px dashed var(--primary);
    outline-offset: -2px;
}

.lib-body.drag-over,
.sub-lib-body.drag-over {
    background: var(--opt-hover) !important;
    outline: 2px dashed var(--primary);
    outline-offset: -2px;
    border-radius: 6px;
}

/* ===================== 仅指针设备 hover ===================== */

@media (hover: hover) {
    .lib-header:hover {
        background: var(--opt-hover);
    }

    .pack-item:hover {
        background: var(--opt-hover);
    }

    .sub-lib-header:hover {
        background: var(--opt-hover);
    }

    .q-list-item:hover {
        border-color: var(--primary);
        background: var(--opt-hover);
    }

    .insert-zone:hover {
        height: 24px;
        background: var(--opt-hover);
        border: 2px dashed var(--primary);
    }

    .insert-zone:hover::after {
        content: "+";
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        color: var(--primary);
        font-weight: 700;
    }
}
