/* ===== 角色聊天 - 动画 & 加载 & 图片 & 设置 ===== */
/* 打字动画 */
.typing-indicator { display: flex; gap: 4px; padding: 8px 0; }
.typing-indicator span {
    width: 8px; height: 8px; background: var(--text-dim);
    border-radius: 50%; animation: typing 1.4s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
    0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
    30% { opacity: 1; transform: scale(1); }
}

/* 图片放大 */
.img-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.85); z-index: 200;
    align-items: center; justify-content: center; cursor: zoom-out;
}
.img-overlay.show { display: flex; }
.img-overlay img { max-width: 90vw; max-height: 90vh; border-radius: 8px; }

/* 加载遮罩 */
.loading-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(15,20,25,0.92); z-index: 300;
    align-items: center; justify-content: center; flex-direction: column;
}
.loading-overlay.show { display: flex; }
.loading-spinner {
    width: 48px; height: 48px; border: 4px solid var(--bg3);
    border-top-color: var(--primary); border-radius: 50%;
    animation: spin 0.8s linear infinite; margin-bottom: 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text {
    color: var(--text); font-size: 1rem;
    animation: pulse 1.5s ease-in-out infinite;
}
.loading-sub { color: var(--text-dim); font-size: 0.8rem; margin-top: 6px; }
@keyframes pulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }

/* 生图进度指示器 */
.scene-gen-progress {
    display: none; position: fixed; bottom: 70px; left: 50%;
    transform: translateX(-50%); background: var(--bg3);
    border: 1px solid var(--border); border-radius: 12px;
    padding: 10px 16px; z-index: 100; text-align: center;
    min-width: 200px; box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.scene-gen-progress.show { display: block; }
.scene-gen-progress .progress-bar-bg {
    width: 100%; height: 4px; background: var(--bg);
    border-radius: 2px; margin-top: 8px; overflow: hidden;
}
.scene-gen-progress .progress-bar-fill {
    height: 100%; width: 0%; background: var(--primary); border-radius: 2px;
    animation: progressAnim 2s ease-in-out infinite;
}
@keyframes progressAnim {
    0% { width: 0%; } 50% { width: 60%; } 100% { width: 100%; }
}
.scene-gen-progress .gen-status {
    font-size: 0.82rem; color: var(--text); display: flex;
    align-items: center; gap: 6px;
}
.scene-gen-progress .gen-status .dot {
    width: 6px; height: 6px; background: var(--primary); border-radius: 50%;
    animation: dotBlink 1s ease-in-out infinite;
}
@keyframes dotBlink { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }

/* 设置表单 */
.setting-item { margin-bottom: 16px; }
.setting-item label {
    display: block; font-size: 0.82rem; color: var(--text-dim); margin-bottom: 6px;
}
.setting-item input {
    width: 100%; padding: 8px 10px; background: var(--bg3);
    border: 1px solid var(--border);
}
.setting-item input:focus { border-color: var(--primary); outline: none; }
.setting-hint { font-size: 0.72rem; color: var(--text-dim); margin-top: 4px; }


/* ===== TTS 重播按钮 ===== */
.tts-replay-btn {
    display: none;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    cursor: pointer;
    color: var(--primary);
    padding: 2px 8px;
    border: 1px solid var(--primary);
    border-radius: 10px;
    transition: all 0.2s;
    user-select: none;
}
.tts-replay-btn:hover {
    background: var(--primary);
    color: #fff;
}
/* 响应式 */
@media (max-width: 600px) {
    .setup-card { padding: 20px; }
    .side-panel { width: 100%; right: -100%; }
    .msg { max-width: 95%; }
}

/* ===== TTS 播放状态指示器 ===== */
.tts-play-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--primary);
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
}
.tts-play-indicator:hover {
    opacity: 0.8;
}
.tts-play-indicator .tts-status-icon {
    font-size: 0.85rem;
}
.tts-play-indicator .tts-status-text {
    white-space: nowrap;
}
/* 播放中动画 */
@keyframes ttsPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.tts-playing .tts-status-icon {
    animation: ttsPulse 1s ease-in-out infinite;
}
