/* ==================== img-view-win 通用弹窗模板 ==================== */
.img-view-win-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(8px);
}

.img-view-win-modal.active {
    display: flex;
}

.img-view-win-content {
    background: linear-gradient(135deg, rgba(30, 30, 60, 0.98), rgba(20, 20, 40, 0.98));
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(15px);
    display: flex;
    flex-direction: column;
    position: relative;
}

.img-view-win-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.img-view-win-header h3 {
    color: #fff;
    font-size: 1.3rem;
    margin: 0;
    font-weight: 600;
}

/* 标题区域：标题 + 历史图标 */
.img-view-win-title-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 历史图片图标按钮 */
.img-view-win-history-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.img-view-win-history-btn:hover {
    color: #00d4ff;
    background: rgba(0, 212, 255, 0.1);
}

/* 历史图片弹窗 */
.img-view-win-history-popup {
    position: absolute;
    top: 60px;
    left: 24px;
    right: 24px;
    max-height: 70vh;
    background: linear-gradient(135deg, rgba(30, 30, 60, 0.99), rgba(20, 20, 40, 0.99));
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 16px;
    z-index: 2100;
    display: flex;
    flex-direction: column;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5);
}

.img-view-win-history-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
}

.img-view-win-history-popup-title-area {
    display: flex;
    align-items: center;
    gap: 16px;
}

.img-view-win-history-local-only {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.7);
    user-select: none;
}

.img-view-win-history-local-only input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: #00d4ff;
    cursor: pointer;
}

.img-view-win-history-local-only:has(input:checked) {
    color: #00d4ff;
}

.img-view-win-history-close {
    background: none;
    border: none;
    color: #888;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}

.img-view-win-history-close:hover {
    color: #fff;
}

.img-view-win-history-grid {
    padding: 16px 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    /* 行高按内容走 + 顶部对齐：容器被压成固定高度时行不被平分压扁导致图片互相叠盖 */
    grid-auto-rows: max-content;
    align-content: start;
    gap: 12px;
    overflow-y: auto;
    max-height: 55vh;
}

.img-view-win-history-grid::-webkit-scrollbar {
    width: 6px;
}

.img-view-win-history-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.img-view-win-history-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s ease, transform 0.2s ease;
    aspect-ratio: 1;
}

.img-view-win-history-item:hover {
    border-color: rgba(0, 212, 255, 0.5);
    transform: scale(1.03);
}

.img-view-win-history-item.active {
    border-color: #00d4ff;
}

.img-view-win-history-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.img-view-win-history-item .history-item-badge {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    color: #ccc;
    font-size: 0.7rem;
    padding: 12px 6px 4px;
    text-align: center;
}

.img-view-win-history-item.active .history-item-badge {
    color: #00d4ff;
}

.img-view-win-history-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #666;
    padding: 40px 0;
    font-size: 0.9rem;
}

.img-view-win-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 上排：预览区 + 选择按钮区 */
.img-view-win-top-row {
    display: flex;
    gap: 16px;
    min-height: 280px;
}

/* 上排左边：预览区 */
.img-view-win-preview-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    /* 历史图弹窗的定位基准（弹窗移入本容器内，铺满预览区对齐） */
    position: relative;
}

/* 历史图弹窗铺满预览区（基类 left/right:24px 的宽弹窗布局保留给角色弹窗同款类使用） */
.img-view-win-preview-area .img-view-win-history-popup {
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    max-height: 100%;
    border-radius: 16px;
}

.img-view-win-preview-area .img-view-win-history-grid {
    max-height: none;
    flex: 1;
    min-height: 0;
}

.img-view-win-preview-wrapper {
    width: 100%;
    height: 280px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.1), rgba(123, 44, 191, 0.1));
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.img-view-win-preview-wrapper img,
.img-view-win-preview-wrapper video {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.img-view-win-preview-wrapper .image-placeholder {
    color: #666;
    font-size: 1rem;
}

/* 上排右边：选择按钮区 */
.img-view-win-select-area {
    width: 160px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.img-view-win-select-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    max-height: 200px;
    padding-right: 4px;
}

.img-view-win-select-list::-webkit-scrollbar {
    width: 4px;
}

.img-view-win-select-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
}

.img-view-win-select-list::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 255, 0.3);
    border-radius: 2px;
}

.img-view-win-select-btn {
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.2), rgba(123, 44, 191, 0.2));
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.img-view-win-select-btn:hover {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.4), rgba(123, 44, 191, 0.4));
    border-color: rgba(0, 212, 255, 0.4);
    transform: translateX(-2px);
}

.img-view-win-select-btn.active {
    background: linear-gradient(135deg, #00d4ff, #7b2cbf);
    border-color: transparent;
    box-shadow: 0 4px 16px rgba(0, 212, 255, 0.3);
    color: #fff;
}

/* 上传下载按钮（放在选项区，与选择按钮样式一致） */
.img-view-win-select-btn.upload-btn {
    margin-top: 4px;
}

.img-view-win-select-btn.upload-btn:hover {
    background: rgba(0, 212, 255, 0.15);
    border-color: rgba(0, 212, 255, 0.4);
    color: #00d4ff;
}

.img-view-win-select-btn.download-btn {
    margin-top: 4px;
}

.img-view-win-select-btn.download-btn:hover {
    background: rgba(123, 44, 191, 0.15);
    border-color: rgba(123, 44, 191, 0.4);
    color: #7b2cbf;
}

/* 下排：文字描述区 + 功能按钮区 */
.img-view-win-bottom-row {
    display: flex;
    gap: 16px;
    min-height: 120px;
}

/* 下排左边：文字描述区 */
.img-view-win-desc-area {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.img-view-win-desc-area textarea {
    width: 100%;
    height: 100%;
    min-height: 120px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px;
    color: #e5e7eb;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
    font-family: inherit;
}

.img-view-win-desc-area textarea:focus {
    outline: none;
    border-color: rgba(0, 212, 255, 0.3);
    background: rgba(255, 255, 255, 0.08);
}

.img-view-win-desc-area textarea::placeholder {
    color: #666;
}

/* 下排右边：功能按钮区 */
.img-view-win-actions-area {
    width: 160px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.img-view-win-func-btn {
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.15), rgba(123, 44, 191, 0.15));
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 10px;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.img-view-win-func-btn:hover {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.3), rgba(123, 44, 191, 0.3));
    border-color: rgba(0, 212, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.2);
}

.img-view-win-func-btn.secondary {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.img-view-win-func-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
}

.img-view-win-func-btn.danger {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.15), rgba(238, 90, 90, 0.15));
    border-color: rgba(255, 107, 107, 0.2);
}

.img-view-win-func-btn.danger:hover {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.3), rgba(238, 90, 90, 0.3));
    border-color: rgba(255, 107, 107, 0.4);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.2);
}

/* 场景名称按钮样式 - 参考角色弹窗的角色名称按钮 */
.img-view-win-scene-name-btn {
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.2), rgba(123, 44, 191, 0.2));
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.img-view-win-scene-name-btn:hover {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.4), rgba(123, 44, 191, 0.4));
    border-color: rgba(0, 212, 255, 0.4);
    transform: translateX(-2px);
}

.img-view-win-scene-name-btn.active {
    background: linear-gradient(135deg, #00d4ff, #7b2cbf);
    border-color: transparent;
    box-shadow: 0 4px 16px rgba(0, 212, 255, 0.3);
}

/* 选择按钮编辑输入框 */
.img-view-win-select-edit-input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-size: inherit;
    font-weight: inherit;
    font-family: inherit;
    text-align: center;
    padding: 0;
    margin: 0;
}

/* 上传下载按钮样式 - 继承场景名称按钮样式但使用次要颜色 */
.img-view-win-action-btn {
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(100, 100, 120, 0.2), rgba(80, 80, 100, 0.2));
    color: #ccc;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.img-view-win-action-btn:hover {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.3), rgba(123, 44, 191, 0.3));
    border-color: rgba(0, 212, 255, 0.3);
    color: #fff;
    transform: translateX(-2px);
}

/* ==================== 积分角标（小钻石） ==================== */
/* 功能按钮：相对定位以容纳右上角角标 */
.img-view-win-func-btn {
    position: relative;
}

/* 小钻石角标 - 按钮右上角（按钮内），表示该操作要耗费积分 */
/* 当前隐藏备用，需要时移除 display: none */
.img-view-win-func-btn .points-badge {
    position: absolute;
    top: 2px;
    right: 4px;
    width: 10px;
    height: 10px;
    pointer-events: none;
    display: none;
}

/* 钻石上半部分 - 梯形台面 */
.img-view-win-func-btn .points-badge::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 0;
    border-left: 2px solid transparent;
    border-right: 2px solid transparent;
    border-bottom: 3px solid #00d4ff;
}

/* 钻石下半部分 - 三角形底部 */
.img-view-win-func-btn .points-badge::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #00d4ff;
}

/* 悬停时让小钻石更亮 */
.img-view-win-func-btn:hover .points-badge::before {
    border-bottom-color: #7ee8ff;
}

.img-view-win-func-btn:hover .points-badge::after {
    border-top-color: #7ee8ff;
}

/* 选择按钮（场景名/角色名等）相对定位以容纳右上角角标 */
.img-view-win-select-btn,
.img-view-win-scene-name-btn,
.img-view-win-action-btn {
    position: relative;
}

/* 预览区右下角上传/下载小图标（2026-11-18：替代选择列表末尾的大文字按钮，节省空间） */
.img-view-win-corner-btns {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    gap: 6px;
    z-index: 5;
}

.img-view-win-corner-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.5);
    color: #ccc;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.img-view-win-corner-btn:hover {
    background: rgba(0, 212, 255, 0.25);
    border-color: rgba(0, 212, 255, 0.5);
    color: #fff;
}

/* 功能按钮区：高度对齐左侧描述区，按钮放不下时内部滚动，不撑破布局 */
.img-view-win-actions-area {
    max-height: 156px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

.img-view-win-actions-area::-webkit-scrollbar {
    width: 6px;
}

.img-view-win-actions-area::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 3px;
}

/* ==================== 大屏编辑模式（弹窗双形态切换，2026-11-19） ==================== */
/* 切换方式：弹窗根节点加 .big-screen-mode（toggleBigScreenEdit，见 pop.js），纯 CSS 重排：
   弹窗近全屏、图片居中占满中间区域；描述词等元素排到左边一列，操作按钮留在右边一列。
   DOM 结构不变，普通/大屏两种形态共用同一模板。 */

/* 头部按钮：叉号左侧的大屏切换图标（全屏展开角图标），悬停显示文字提示；
   大屏态用 .active 高亮。状态全项目记忆（localStorage，见 pop.js toggleBigScreenEdit） */
.big-screen-edit-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.big-screen-edit-btn:hover {
    color: #00d4ff;
    background: rgba(0, 212, 255, 0.1);
}

.big-screen-edit-btn.active {
    color: #00d4ff;
    background: rgba(0, 212, 255, 0.18);
}

/* 大屏/小屏双图标切换（2026-12-02 用户定稿）：默认显示扩张角图标（进大屏），
   .active（已在大屏）换成向内收拢图标（退小屏），不用同一个图标猜状态 */
.big-screen-edit-btn svg.bs-icon-collapse { display: none; }
.big-screen-edit-btn.active svg:not(.bs-icon-collapse) { display: none; }
.big-screen-edit-btn.active svg.bs-icon-collapse { display: block; }

/* --- 通用：三种弹窗的大屏形态尺寸（近全屏） --- */
/* margin-right 给右缘留出右键菜单（max-width 120px）的弹出空间，弹窗整体相应左移 */
.img-view-win-modal.big-screen-mode .img-view-win-content,
.character-modal.big-screen-mode .character-content,
.composition-modal.big-screen-mode .composition-content {
    width: calc(96vw - 130px);
    max-width: none;
    height: 94vh;
    max-height: none;
    margin-right: 130px;
}

/* --- img-view-win 模板（场景/道具/服装）大屏布局 --- */
/* body 由上下两排改为三列网格：描述词 | 图片(通高居中) | 选择列表+功能按钮。
   top-row/bottom-row 用 display:contents 让四个区域直接参与 body 网格定位 */
.img-view-win-modal.big-screen-mode .img-view-win-body {
    display: grid;
    /* 三列平分剩余宽度；两行各 1fr：右列上（选择列表）下（功能按钮）各分一半高度 */
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    overflow: hidden;
}

.img-view-win-modal.big-screen-mode .img-view-win-top-row,
.img-view-win-modal.big-screen-mode .img-view-win-bottom-row {
    display: contents;
}

/* 图片：中间列整列（上下两排合并），高度撑满 */
.img-view-win-modal.big-screen-mode .img-view-win-preview-area {
    grid-column: 2;
    grid-row: 1 / 3;
    min-height: 0;
}

.img-view-win-modal.big-screen-mode .img-view-win-preview-wrapper {
    flex: 1;
    height: auto;
    min-height: 0;
}

/* 描述词：左列整列（flex 容器/溢出裁剪见下方"左侧描述区"统一规则） */
.img-view-win-modal.big-screen-mode .img-view-win-desc-area {
    grid-column: 1;
    grid-row: 1 / 3;
    min-height: 0;
}

/* 选择按钮列表（场景名/角色名等）：右列上半 */
.img-view-win-modal.big-screen-mode .img-view-win-select-area {
    grid-column: 3;
    grid-row: 1;
    width: auto;
    min-height: 0;
}

.img-view-win-modal.big-screen-mode .img-view-win-select-list {
    max-height: none;
}

/* 功能按钮：右列下半（与上半选择列表各半，放开基础态的 156px 限高；
   width:auto 覆盖基础态的 160px 定宽，让按钮区撑满所在列） */
.img-view-win-modal.big-screen-mode .img-view-win-actions-area {
    grid-column: 3;
    grid-row: 2;
    width: auto;
    max-height: none;
    justify-content: flex-end; /* 按钮贴到下半格底部，与中间预览区底部平齐（2026-11-26） */
}

/* --- character 模板（人物角色）大屏布局 --- */
/* 三列网格：角色信息/描述 | 角色图片(通高居中) | 角色名称列表+操作按钮 */
.character-modal.big-screen-mode .character-body {
    overflow: hidden;
}

.character-modal.big-screen-mode .character-layout {
    display: grid;
    /* 三列平分剩余宽度：描述 | 图片 | 名称列表+按钮 */
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: minmax(0, 1fr);
    gap: 16px;
}

.character-modal.big-screen-mode .character-display-area {
    display: contents;
}

/* 图片：中间列整列（外层 wrap 同时挂上传/下载角标按钮，一并放中间列） */
.character-modal.big-screen-mode .character-image-wrap {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    align-items: center;      /* 容器 aspect-ratio 锁定后高度可能小于格子，居中放 */
    justify-content: center;
    min-height: 0;
}

/* 预览容器贴合（2026-11-26，2026-11-28 比例自适应）：容器按 --bs-aspect 锁定宽高比、
   宽度吃满中列，中列宽 = 格子实测高度 × 图片比例（pop.js 实测反推，横版图压到三等分）；
   --bs-aspect 默认 9/16，显示非竖版图（全本场景/道具/构图）时由 pop.js 按图片真实比例
   覆盖——图片 contain 后正好铺满容器，消除两边空隙/估值偏差导致的错位感 */
.character-modal.big-screen-mode .character-image-area {
    flex: 0 1 auto;
    width: 100%;
    height: auto;
    max-height: 100%;
    min-height: 0;
    aspect-ratio: var(--bs-aspect, 9 / 16);
}

/* 角色/描述信息：左列整列 */
.character-modal.big-screen-mode .character-info-area {
    grid-column: 1;
    grid-row: 1;
    min-height: 0;
}

/* 名称列表+操作按钮：右列整列。操作按钮改底部对齐（2026-11-26 用户需求：与中间图片
   预览区底部平齐），名称列表贴顶按内容占高、最多到列的一半；列表多角色占满上半时，
   按钮与列表之间仍有 margin-top:auto 撑开的间距，不再挤在一起 */
.character-modal.big-screen-mode .character-list-area {
    grid-column: 3;
    grid-row: 1;
    width: auto;
}

.character-modal.big-screen-mode #characterList {
    flex: 0 1 auto !important; /* !important 覆盖元素 inline 的 flex:1；内容多时收缩、限高一半 */
    max-height: 50%;
}

.character-modal.big-screen-mode .character-actions {
    flex: 0 0 auto;
    margin-top: auto; /* 吃掉上方剩余空间，把按钮钉到底部 */
    max-height: none;
}

/* --- composition 模板（构图）大屏布局 --- */
/* 三列网格：描述词 | 构图图片(通高居中) | 视图切换+场景角色图+操作按钮 */
.composition-modal.big-screen-mode .composition-body {
    overflow: hidden;
}

.composition-modal.big-screen-mode .composition-layout {
    display: grid;
    /* 三列平分剩余宽度：描述词 | 构图图 | 视图切换+缩略图+按钮 */
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: minmax(0, 1fr);
    gap: 16px;
}

.composition-modal.big-screen-mode .composition-display-area {
    display: contents;
}

/* 图片：中间列整列（wrap 挂角标按钮组并做网格定位，imageArea 顶部对齐——与左右两栏齐平，
   列宽由 pop.js 实测格子高度反推，容器高度正好占满格子，无需垂直居中） */
.composition-modal.big-screen-mode .composition-image-wrap {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: 0;
}

.composition-modal.big-screen-mode .composition-image-area {
    width: 100%;
    height: auto;
    max-height: 100%;
    min-height: 0;
}

/* 描述词：左列整列（flex 容器/溢出裁剪见下方"左侧描述区"统一规则） */
.composition-modal.big-screen-mode .composition-info-area {
    grid-column: 1;
    grid-row: 1;
}

/* 视图切换/场景角色图/操作按钮：右列整列（沿用原有 flex 纵排结构） */
.composition-modal.big-screen-mode .composition-list-area {
    grid-column: 3;
    grid-row: 1;
    width: auto;
}

/* 操作按钮区：固定占右列一半高度（上方视图切换+缩略图合计另一半），不再贴底挤成一坨 */
.composition-modal.big-screen-mode .composition-actions {
    flex: 0 0 50%;
    max-height: none;
}

/* --- 大屏编辑·竖屏画幅变体（big-screen-portrait，2026-11-19） --- */
/* 项目画幅为竖屏（如 9:16）时：预览列收窄为画幅比例（宽度由 pop.js 经 --bs-mid-w 计算，
   = 内容可用高度 × 宽/高），左右描述/按钮两列与预览列等宽（三列等宽，视觉整齐不乱）；
   弹窗宽度随内容收缩，margin-right 同样给右键菜单留弹出空间。
   横屏 16:9 走默认大屏布局（三列平分）不受影响。 */
.img-view-win-modal.big-screen-mode.big-screen-portrait .img-view-win-content,
.character-modal.big-screen-mode.big-screen-portrait .character-content,
.composition-modal.big-screen-mode.big-screen-portrait .composition-content {
    width: auto;
    max-width: calc(96vw - 130px);
    margin-right: 130px;
}

.img-view-win-modal.big-screen-mode.big-screen-portrait .img-view-win-body,
.composition-modal.big-screen-mode.big-screen-portrait .composition-layout {
    /* 三列与预览区等宽；minmax(0,…) 允许小屏装不下时等比压缩，不撑破弹窗 */
    grid-template-columns: repeat(3, minmax(0, var(--bs-mid-w, 42vh)));
}

/* 角色弹窗贴合布局（2026-11-28 用户定稿三列同宽）：三列各 = 中列图宽（--bs-mid-w，
   pop.js 实测格子高度 × 图片比例反推，横版图压到可用宽三等分），左右描述/按钮列与
   中间图片区等宽；与 img-view-win 竖屏变体同款做法。弹窗宽度随内容收缩
   （big-screen-portrait 的 width:auto），不留空隙。 */
.character-modal.big-screen-mode.big-screen-portrait .character-layout {
    grid-template-columns: repeat(3, minmax(0, var(--bs-mid-w, 42vh)));
}

/* 大屏模式下右列按钮一律撑满所在列宽 */
.img-view-win-modal.big-screen-mode .img-view-win-select-btn,
.img-view-win-modal.big-screen-mode .img-view-win-scene-name-btn,
.img-view-win-modal.big-screen-mode .img-view-win-action-btn,
.img-view-win-modal.big-screen-mode .img-view-win-func-btn,
.character-modal.big-screen-mode .character-action-btn,
.character-modal.big-screen-mode .img-view-win-select-btn,
.composition-modal.big-screen-mode .composition-tab-btn,
.composition-modal.big-screen-mode .composition-action-btn {
    width: 100%;
}

/* --- 大屏编辑：上传拖放区占据预览区位置 --- */
/* 上传区显示时预览图已被 JS 隐藏（showImageUploadArea/showImgViewWinUploadArea），
   大屏下让上传区铺到中列预览位置，而不是缩在底部/掉到隐式网格行 */
/* img-view-win（场景/道具/服装）：上传区是预览列的 flex 子项，撑满整列 */
.img-view-win-modal.big-screen-mode #imgViewWinUploadArea:not([style*="display: none"]) {
    flex: 1;
    min-height: 0;
    margin-bottom: 0;
}

/* character/composition：display:contents 容器里的上传区显式放到中列预览格子 */
.character-modal.big-screen-mode #characterUploadArea:not([style*="display: none"]),
.composition-modal.big-screen-mode #compositionUploadArea:not([style*="display: none"]) {
    grid-column: 2;
    grid-row: 1;
    min-height: 0;
}

/* 角色弹窗：上传区可见时，让位隐藏空的外层图片 wrap */
.character-modal.big-screen-mode .character-image-wrap:has(~ #characterUploadArea:not([style*="display: none"])) {
    display: none;
}

/* --- 大屏编辑：左侧描述区统一规则（三类弹窗共用） ---
   覆盖：img-view-win（场景/服装/道具）、composition（构图）、character（角色）。
   容器：flex 纵排 + overflow hidden（grid 定位在各弹窗自己的布局段）；
   textarea：flex:1 占满整列余高，box-sizing + 清 margin/min-height，
   保证文字不多时默认不出滚动条（此前构造性溢出约 36px 导致常显滚动条），
   文字超出时由 textarea 自身 overflow-y:auto 按需出现滚动条。 */
.img-view-win-modal.big-screen-mode .img-view-win-desc-area,
.composition-modal.big-screen-mode .composition-info-area,
.character-modal.big-screen-mode .character-info-area {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.img-view-win-modal.big-screen-mode .img-view-win-desc-area textarea,
.composition-modal.big-screen-mode .composition-info-area textarea.composition-description,
.character-modal.big-screen-mode .character-info-area .character-description {
    flex: 1 1 0;
    height: auto;
    /* !important：压过构图弹窗 textarea 在 index.html 里的 inline min-height:180px */
    min-height: 0 !important;
    margin-bottom: 0;
    box-sizing: border-box;
    overflow-y: auto;
}

/* 未选角色时的占位 <p>（同 class）：清掉默认 margin，避免把容器撑出滚动条 */
.character-modal.big-screen-mode .character-info-area p.character-description {
    margin: 0;
}

/* --- 大屏编辑·修正（2026-11-19） --- */
/* 1) 构图描述框被 entity_highlight 包了一层 .entity-hl-wrap（普通块级），截断了 flex 链路；
      大屏下让 wrap 在 info-area 的 flex 列里撑满，textarea 再在 wrap 内撑满 */
.composition-modal.big-screen-mode .composition-info-area .entity-hl-wrap {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.composition-modal.big-screen-mode .composition-info-area .entity-hl-wrap > textarea.composition-description {
    flex: 1 1 0;
    height: auto;
    min-height: 0;
}

/* 1a) 角色描述框同理：entity_highlight 的动态扫描（每秒轮询 #characterPromptText）也会把它
      包进 .entity-hl-wrap，截断 flex 链路导致大屏下描述框撑不满左列。与构图同一修法 */
.character-modal.big-screen-mode .character-info-area .entity-hl-wrap {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.character-modal.big-screen-mode .character-info-area .entity-hl-wrap > textarea.character-description {
    flex: 1 1 0;
    height: auto;
    min-height: 0;
}

/* 角色描述"重新生成中"转圈提示：大屏下描述框是通顶长列，基础样式的右上角定位
   （style.css top:8px right:12px）看着偏，改为在描述区内居中显示（2026-11-30） */
.character-modal.big-screen-mode .character-info-area .desc-regen-spinner {
    top: 50%;
    right: auto;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* 1b) imgViewWin 描述框（场景/道具/服装共用 #imgViewWinDescription）同理：
      entity_highlight.js 静态挂载时也把它包进了 .entity-hl-wrap，截断 flex 链路，
      大屏下左列描述框撑不满。与构图/角色同一修法 */
.img-view-win-modal.big-screen-mode .img-view-win-desc-area .entity-hl-wrap {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.img-view-win-modal.big-screen-mode .img-view-win-desc-area .entity-hl-wrap > textarea {
    flex: 1 1 0;
    height: auto;
    min-height: 0;
}

/* 2) 构图操作按钮区：钉在右列整体高度的一半处开始（margin-top:auto 吃掉上方剩余空间），
    上方视图切换/缩略图有多少都只占上半，不再把按钮挤到贴底 */
.composition-modal.big-screen-mode .composition-actions {
    margin-top: auto;
}

/* 3) 构图弹窗彩排/实拍视图：视频由 JS 注入且 inline 写死 max-height:300px，
      大屏下用 !important 覆盖 inline 样式，让视频撑满中间预览区（contain 自适应横竖屏） */
.composition-modal.big-screen-mode .composition-image-area video {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
}

/* 5) 构图预览容器按画幅比例锁定宽高比（--bs-aspect 由 pop.js 传入）：
      图片/视频 contain 后正好铺满容器，不再露出容器自己的边框；
      容器在 wrap 内居中，列多余高度落在容器上下方（无边框区域，视觉干净） */
.composition-modal.big-screen-mode .composition-image-area {
    aspect-ratio: var(--bs-aspect, 16 / 9);
}

/* 6) 构图上传区可见时隐藏同格叠放的预览 wrap（大屏网格里两者共用中列格子，
      wrap 会盖住上传区拦截点击；显示上传区时让位，与角色弹窗 :has 方案一致） */
.composition-modal.big-screen-mode .composition-image-wrap:has(~ #compositionUploadArea:not([style*="display: none"])) {
    display: none;
}

/* ==================== 构图弹窗前后分镜翻页（类似大图弹窗翻页箭头） ==================== */
/* 挂在弹窗内容容器内 absolute 定位（2026-11-28 用户定稿：箭头在窗体【外侧】两边、
   靠近窗体留合适间距（-44px = 三角宽+约8px 间隙），不再用圆圈底——统一纯三角符号
   +黑色投影保证在深浅背景上都可见；旧版圆圈小箭头缩在窗体内侧已废弃。
   .modal-node-nav 系列为通用类：角色弹窗（characterModal，含全本分析复用形态）与
   img-view-win 弹窗（道具/场景/服装）的弹窗内前后翻页共用同款式 */
.composition-node-nav,
.modal-node-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.85);
    font-size: 42px;
    line-height: 1;
    cursor: pointer;
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    user-select: none;
    padding: 0 4px;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.9), 0 1px 3px rgba(0, 0, 0, 0.8);
}

.composition-node-nav:hover,
.modal-node-nav:hover {
    color: #00d4ff;
    transform: translateY(-50%) scale(1.15);
}

.composition-node-nav-prev,
.modal-node-nav-prev { left: -44px; }

.composition-node-nav-next,
.modal-node-nav-next { right: -44px; }

.composition-node-counter,
.modal-node-counter {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 12px;
    border-radius: 12px;
    z-index: 2100;
    pointer-events: none;
    white-space: nowrap;
}
