/* ============================================================
   modal.css · 模态框 + 选择角色列表 + 通用菜单 + 场景事件弹窗
   ------------------------------------------------------------
   含：通用 modal-box / 场景事件弹窗（小事件·大事件两套氛围）/
       通话弹窗（call-modal-box）/ 一键生成 / 记忆整理设置 /
       记忆整理对比 / 时间弹窗提示
   ============================================================ */

/* ===== 模态框 ===== */
.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 10, 20, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 50;
    border-radius: inherit;
    padding: 12px;
}
.modal-overlay.active {
    display: flex;
}
.modal-box {
    background: rgba(30, 20, 45, 0.92);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid rgba(192, 132, 252, 0.22);
    border-radius: 20px;
    padding: 20px 24px;
    width: 100%;
    max-width: 400px;
    max-height: 90%;
    overflow-y: auto;
    color: var(--text);
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.6),
        0 0 40px rgba(192, 132, 252, 0.08);
}
.modal-box h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
    text-align: center;
    text-shadow: 0 0 20px rgba(192, 132, 252, 0.35);
}
.modal-box label {
    display: block;
    font-size: 14px;
    color: var(--text-dim);
    margin: 12px 0 4px;
}
.modal-box input[type="date"],
.modal-box input[type="time"],
.modal-box input[type="text"],
.modal-box input[type="number"],
.modal-box input[type="password"],
.modal-box textarea,
.modal-box select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid rgba(192, 132, 252, 0.22);
    border-radius: 8px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.modal-box input:focus,
.modal-box textarea:focus,
.modal-box select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(192, 132, 252, 0.18);
}
.modal-box textarea {
    resize: vertical;
    min-height: 50px;
}
.modal-box select option {
    background: #1a0e2e;
    color: #fff;
}
.modal-box .avatar-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.modal-box .avatar-preview .circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(192, 132, 252, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 22px;
    font-weight: bold;
    color: var(--text);
    flex-shrink: 0;
    cursor: pointer;
    background-size: cover;
    background-position: center;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.modal-box .avatar-preview .circle:hover {
    border-color: var(--primary);
    box-shadow: 0 0 14px rgba(192, 132, 252, 0.4);
}
.modal-box .avatar-preview .url-input {
    flex: 1;
    min-width: 120px;
    padding: 8px 10px;
    border: 1px solid rgba(192, 132, 252, 0.22);
    border-radius: 8px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    outline: none;
}
.modal-box .checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    font-size: 15px;
    color: var(--text);
}
.modal-box .checkbox-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}
.modal-box .btn-row {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}
.modal-box .btn-row button {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s;
    font-family: inherit;
}
.modal-box .btn-row .btn-cancel {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.12);
}
.modal-box .btn-row .btn-cancel:hover {
    background: rgba(255, 255, 255, 0.14);
}
.modal-box .btn-row .btn-save {
    background: linear-gradient(135deg, #c084fc, #ec4899);
    color: #fff;
    box-shadow: 0 4px 16px rgba(192, 132, 252, 0.35);
}
.modal-box .btn-row .btn-save:hover {
    box-shadow: 0 4px 22px rgba(236, 72, 153, 0.55);
    transform: translateY(-1px);
}
.modal-box .btn-row .btn-inject {
    background: linear-gradient(135deg, #c084fc, #ec4899);
    color: #fff;
    box-shadow: 0 4px 16px rgba(192, 132, 252, 0.35);
}
.modal-box .btn-row .btn-inject:hover {
    box-shadow: 0 4px 22px rgba(236, 72, 153, 0.55);
    transform: translateY(-1px);
}
.modal-box .note {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-dim);
    text-align: center;
    border-top: 1px solid rgba(192, 132, 252, 0.15);
    padding-top: 10px;
}

/* ===== 选择角色列表 ===== */
.character-select-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
}
.character-select-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(192, 132, 252, 0.15);
    border-radius: 12px;
    cursor: pointer;
    transition: all .2s;
}
.character-select-item:hover {
    background: rgba(192, 132, 252, 0.12);
    border-color: rgba(192, 132, 252, 0.4);
}
.character-select-item .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #ccc;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
    color: #333;
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
}
.character-select-item .name {
    font-weight: 600;
    color: var(--primary);
}
.character-select-item .desc {
    font-size: 13px;
    color: #888;
}
.character-select-empty {
    text-align: center;
    color: var(--text-dim);
    padding: 20px 0;
    font-size: 15px;
}

/* ===== 通用弹窗菜单（长按/右键） ===== */
.item-popup-menu {
    position: fixed;
    background: rgba(30, 20, 45, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(192, 132, 252, 0.22);
    border-radius: 14px;
    box-shadow:
        0 8px 30px rgba(0, 0, 0, 0.6),
        0 0 20px rgba(192, 132, 252, 0.1);
    z-index: 200;
    padding: 6px 0;
    min-width: 140px;
    display: none;
    animation: popupFade .15s ease-out;
}
.item-popup-menu.show {
    display: block;
}
@keyframes popupFade {
    from { opacity: 0; transform: scale(.95); }
    to { opacity: 1; transform: scale(1); }
}
.item-popup-item {
    padding: 12px 20px;
    font-size: 15px;
    color: var(--text);
    cursor: pointer;
    transition: background .15s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    display: block;
    white-space: nowrap;
    font-family: inherit;
}
.item-popup-item:hover {
    background: rgba(192, 132, 252, 0.15);
}
.item-popup-item:active {
    background: rgba(192, 132, 252, 0.25);
}
.item-popup-item.danger {
    color: #fca5a5;
}
.item-popup-item:first-child {
    border-radius: 14px 14px 0 0;
}
.item-popup-item:last-child {
    border-radius: 0 0 14px 14px;
}

/* 以下弹窗需要脱离手机壳，铺满整个视口 */
#sceneEventModal,
#callCharacterModal,
#callDialogModal,
#standeeFootprintModal,
#emotionEditorModal {
    position: fixed;
    inset: 0;
    border-radius: 0;
}

/* 情绪编辑要盖在视频通话之上 */
#emotionEditorModal {
    z-index: 9500;
}

/* ===== 通话中弹窗 ===== */
.call-modal-box {
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    min-height: 400px;
}
.call-dialog {
    flex: 1;
    min-height: 200px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(192, 132, 252, 0.15);
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}
.call-line {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    word-break: break-word;
}
.call-line.user {
    text-align: right;
}
.call-line.assistant {
    text-align: left;
}
.call-speaker {
    font-weight: 600;
    color: var(--primary);
    margin-right: 4px;
}
.call-line.user .call-speaker {
    color: var(--accent);
}
.call-empty {
    text-align: center;
    color: var(--text-dim);
    font-size: 14px;
    padding: 30px 0;
}
.call-input-area {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.call-input-area input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid rgba(192, 132, 252, 0.22);
    border-radius: 20px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    outline: none;
    font-family: inherit;
    transition: border-color .2s, box-shadow .2s;
}
.call-input-area input::placeholder {
    color: var(--text-dim);
}
.call-input-area input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(192, 132, 252, 0.18);
}
.call-input-area input:disabled {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-dim);
    cursor: not-allowed;
}
.call-input-area .btn-save {
    padding: 10px 20px;
    border: none;
    border-radius: 20px;
    background: linear-gradient(135deg, #c084fc, #ec4899);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    box-shadow: 0 4px 14px rgba(192, 132, 252, 0.35);
    transition: all .2s;
}
.call-input-area .btn-save:hover {
    box-shadow: 0 4px 20px rgba(236, 72, 153, 0.55);
    transform: translateY(-1px);
}
.call-input-area .btn-save:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 场景事件文本 */
.scene-event-type {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    text-align: center;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}
.scene-event-type.big {
    color: var(--accent);
    text-shadow: 0 0 12px rgba(236, 72, 153, 0.6);
}
.scene-event-type.small {
    color: var(--primary);
    text-shadow: 0 0 12px rgba(192, 132, 252, 0.6);
}
.scene-event-text {
    font-size: 15px;
    color: var(--text);
    line-height: 1.7;
    text-align: center;
    margin: 8px 0 16px;
    white-space: pre-wrap;
    word-break: break-word;
}

/* 场景事件弹窗 · 三层 */
.scene-stage {
    text-align: center;
}
.scene-stage-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
    text-align: center;
    text-shadow: 0 0 20px rgba(192, 132, 252, 0.35);
}
.scene-loading-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 20px 0 8px;
}
.scene-loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 10px rgba(192, 132, 252, 0.7);
    animation: sceneDotPulse 1.2s infinite ease-in-out;
}
.scene-loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.scene-loading-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes sceneDotPulse {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1); }
}

/* ===== 一键生成弹窗 ===== */
.inject-note {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.7;
    margin-bottom: 8px;
}
.inject-list {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.8;
    padding-left: 20px;
    margin-bottom: 12px;
}
.inject-warn {
    font-size: 13px;
    color: var(--accent);
    line-height: 1.6;
    margin-bottom: 12px;
}
.inject-status {
    font-size: 13px;
    color: var(--text-dim);
    text-align: center;
    padding: 10px 0;
    min-height: 20px;
}

/* ===== 记忆总结设置弹窗 ===== */
#settingsPendingInfo {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-dim);
    text-align: center;
}
#settingsRunProgress {
    margin-top: 8px;
    font-size: 13px;
    color: var(--primary);
    text-align: center;
}

/* ===== 时间弹窗底部提示 ===== */
.modal-box .hint {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-dim);
    text-align: center;
    border-top: 1px solid rgba(192, 132, 252, 0.15);
    padding-top: 10px;
}

/* ===== 场景事件弹窗氛围 ===== */
.scene-modal-small {
    border-color: rgba(192, 132, 252, 0.28) !important;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.6),
        0 0 40px rgba(192, 132, 252, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}
.scene-modal-big {
    border-color: rgba(236, 72, 153, 0.45) !important;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.65),
        0 0 60px rgba(236, 72, 153, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}