body {
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    overflow: hidden;
    font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f8f9fa;
}

#library-wrapper {
    width: 0; /* Default hidden */
    height: 100%;
    flex-shrink: 0;
    border-right: none;
    background: #fff;
    z-index: 10;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.3s ease;
}

body.library-open #library-wrapper {
    width: 320px;
    border-right: 1px solid #dee2e6;
}

/* Environment Library Wrapper (Right side) */
#env-library-wrapper {
    width: 0; /* Default hidden */
    height: 100%;
    flex-shrink: 0;
    border-left: none;
    background: #fff;
    z-index: 10;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.3s ease;
}

body.env-library-open #env-library-wrapper {
    width: 320px;
    border-left: 1px solid #dee2e6;
}

/* Toggle Button */
#toggle-library-btn {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 60px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-left: none;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    transition: left 0.3s ease;
    font-size: 14px;
    color: #666;
    -webkit-user-select: none;
    user-select: none;
}

#toggle-library-btn:hover {
    background-color: #f8f9fa;
    color: #333;
}

body.library-open #toggle-library-btn {
    left: 320px;
}

/* Toggle Env Library Button (Right side) */
#toggle-env-library-btn {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 60px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-right: none;
    border-radius: 8px 0 0 8px;
    cursor: pointer;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: -2px 0 5px rgba(0,0,0,0.1);
    transition: right 0.3s ease;
    font-size: 14px;
    color: #666;
    -webkit-user-select: none;
    user-select: none;
}

#toggle-env-library-btn:hover {
    background-color: #f8f9fa;
    color: #333;
}

body.env-library-open #toggle-env-library-btn {
    right: 320px;
}

#battle-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

#battle-toolbar {
    min-height: 40px;
    background: #fff;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0px 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    flex-shrink: 0;
    gap: 10px;
    flex-wrap: wrap;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.point-display {
    font-weight: bold;
    color: #495057;
    background: #f1f3f5;
    margin: 6px 0px;
    padding: 2px 2px;
    border-radius: 4px;
}

#battle-area {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    background-color: #e9ecef;
    position: relative;
    transition: background-color 0.2s;
}

#battle-area.drag-over {
    background-color: #e7f5ff;
    box-shadow: inset 0 0 0 2px #339af0;
}

.empty-tip {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #adb5bd;
    font-size: 1.5rem;
    pointer-events: none;
    user-select: none;
}

/* 战斗面板上的卡片容器 */
.battle-card-wrapper {
    position: relative;
    transition: transform 0.2s;
    padding:5px;
    cursor: grab;
}

.battle-card-wrapper.dragging {
    opacity: 0.4;
    cursor: grabbing;
}

.battle-card-wrapper.drag-over-card-left {
    border-left: 3px solid #339af0;
    margin-left: -3px; /* 抵消 border 宽度防止抖动 */
}

.battle-card-wrapper.drag-over-card-right {
    border-right: 3px solid #339af0;
    margin-right: -3px;
}

.battle-card-wrapper:hover {
    transform: translateY(-2px);
    z-index: 5;
}

.card-close-btn {
    position: absolute;
    top: -8px;
    right: 0px;
    width: 24px;
    height: 24px;
    background: #ff6b6b;
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 22px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 10;
    border: 2px solid #fff;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-close-btn:hover {
    background: #fa5252;
    transform: scale(1.1);
}

/* 确保模态框层级正确 */
.modal {
    z-index: 1000;
}

/* 输入框样式微调 */
#pc-count {
    padding: 5px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    width: 30px;
}
