
:root {
    --primary-color: #95EC69;
    --button-action-color: #07C160;
    --background-color: #EDEDED;
    --ios-header-bg: rgba(247, 247, 247, 0.85);
    --text-color: #000;
    --bubble-ai-bg: #FFFFFF;
    --bubble-user-bg: var(--primary-color);
    --font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
    --footer-height: 60px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-family); background-color: var(--background-color); color: var(--text-color); overscroll-behavior-y: contain; }
.container { display: flex; flex-direction: column; height: 100vh; width: 100%; margin: 0 auto; background-color: var(--background-color); transition: background-image 0.3s ease; background-size: cover; background-position: center; background-repeat: no-repeat; }
@media (min-width: 768px) { .container { max-width: 768px; box-shadow: 0 0 20px rgba(0,0,0,0.1); } }
.header, .footer { position: fixed; left: 0; right: 0; width: 100%; z-index: 10; }
.header { top: 0; display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; background-color: rgba(247, 247, 247, 0.85); backdrop-filter: blur(50px); -webkit-backdrop-filter: blur(50px); border-bottom: none; }
.footer { bottom: 0; padding: 8px 10px; min-height: var(--footer-height); background-color: #F7F7F7; border-top: 1px solid #E0E0E0; }
@media (min-width: 768px) { .header, .footer { max-width: 768px; left: 50%; transform: translateX(-50%); } }
.header-title { font-size: 17px; font-weight: 600; text-align: center; flex-grow: 1; }
.header-title small { display: block; font-size: 12px; font-weight: 400; color: #A6A6A6; }
.icon-button { background: none; border: none; cursor: pointer; padding: 5px; color: var(--text-color); }
.icon-button svg { display: block; }
.chat-window { flex-grow: 1; overflow-y: auto; padding: 80px 10px; }
.message { display: flex; align-items: flex-start; margin-bottom: 15px; max-width: 80%; }
.message.user { margin-left: auto; flex-direction: row-reverse; }
.message.ai { margin-right: auto; }
.message-avatar { width: 40px; height: 40px; border-radius: 50%; margin: 0 10px; object-fit: cover; flex-shrink: 0; }
.message-content { display: flex; flex-direction: column; }
.message-bubble { padding: 10px 15px; border-radius: 18px; word-wrap: break-word; word-break: break-all; font-size: 16px; line-height: 1.4; }
.message-time { font-size: 12px; color: #8E8E93; margin-top: 5px; }
.message.user .message-bubble { background-color: #95EC69; border-top-right-radius: 5px; }
.message.ai .message-bubble { background-color: #FFFFFF; border-top-left-radius: 5px; }
.message.user .message-time { text-align: right; }
.typing-indicator { display: flex; align-items: center; }
.typing-indicator span { height: 8px; width: 8px; background-color: #B2B2B2; border-radius: 50%; display: inline-block; margin: 0 2px; animation: bounce 1.4s infinite ease-in-out both; }
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1.0); } }
.input-area { display: flex; align-items: center; }
#message-input { flex-grow: 1; border: none; background-color: #FFFFFF; border-radius: 8px; padding: 10px 15px; font-size: 16px; outline: none; }
.send-button { background-color: #95EC69; color: var(--text-color); border: none; border-radius: 8px; padding: 10px 15px; margin-left: 10px; font-size: 16px; font-weight: 500; cursor: pointer; transition: background-color 0.2s ease; }
.send-button:disabled { background-color: #BDBDBD; cursor: not-allowed; }
.settings-panel { position: fixed; top: 0; right: -100%; width: 90%; max-width: 400px; height: 100%; background-color: #F2F2F7; box-shadow: -5px 0 15px rgba(0,0,0,0.1); z-index: 100; transition: right 0.3s ease-in-out; display: flex; flex-direction: column; }
.settings-panel.open { right: 0; }
.settings-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid #E0E0E0; background-color: #F7F7F7; flex-shrink: 0; }
.settings-header h2 { font-size: 17px; font-weight: 600; }
#close-settings-btn { font-size: 24px; font-weight: 300; }
.settings-content { flex-grow: 1; overflow-y: auto; padding: 20px 16px; }
.setting-group { background-color: #FFFFFF; border-radius: 12px; margin-bottom: 20px; overflow: hidden; }
.setting-group h3 { text-align: center; padding: 20px 16px 10px; font-weight: 500; }
.setting-group > p { text-align: center; color: #666; font-size: 14px; padding: 0 16px 20px; }
.setting-group .form-container { padding: 16px; }
.form-container-bottom { margin-bottom: 20px; }
.setting-group .setting-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid #F2F2F7; font-size: 16px; }
.setting-group .setting-item:last-child { border-bottom: none; }
.setting-item label { color: #000; }
.setting-item input[type="text"], .setting-item input[type="password"], .setting-item select { border: none; outline: none; text-align: right; font-size: 16px; color: #8A8A8E; width: 60%; background: transparent; }
.setting-item textarea { width: 100%; padding: 8px; border-radius: 5px; border: 1px solid #E0E0E0; font-size: 14px; margin-top: 5px; resize: vertical; }
.setting-group .textarea-item { flex-direction: column; align-items: flex-start; }
.setting-group .textarea-item label { margin-bottom: 8px; }
.avatar-uploader { display: flex; align-items: center; padding: 10px 16px; justify-content: space-between; border-bottom: 1px solid #F2F2F7; cursor: pointer; }
.avatar-uploader .avatar-preview { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; }
.btn { width: 100%; padding: 12px; border: none; border-radius: 8px; font-size: 16px; font-weight: 500; cursor: pointer; margin-top: 10px; transition: opacity 0.2s ease, background-color 0.2s ease; }
.btn:hover:not(:disabled) { opacity: 0.8; }
.btn-primary { background-color: #07C160; color: white; }
.btn-danger { background-color: #FF3B30; color: white; }
.btn-secondary { background-color: #EFEFF4; color: #007AFF; }
.btn:disabled { background-color: #D1D1D6; color: #8A8A8E; cursor: not-allowed; opacity: 1; }
.expandable-list-container { max-height: 150px; overflow-y: auto; transition: max-height 0.5s ease-in-out; padding: 0 16px 10px; position: relative; }
.expandable-list-container.expanded { max-height: 300px; }
.list-item { background-color: #F7F7F7; padding: 8px 12px; border-radius: 5px; margin-bottom: 8px; font-size: 14px; display: flex; justify-content: space-between; align-items: center; }
.list-item-content { flex-grow: 1; word-break: break-all; }
.list-item-time { font-size: 12px; color: #8E8E93; display: block; margin-top: 4px; }
.delete-btn { background: none; border: none; color: #FF3B30; cursor: pointer; font-size: 18px; margin-left: 10px; padding: 5px; }
.expand-btn-container { text-align: center; padding: 0 16px 10px; }
.expand-btn { background: none; border: none; color: #07C160; cursor: pointer; font-size: 14px; }
.system-info p { font-size: 14px; color: #666; margin-bottom: 5px; display: flex; justify-content: space-between; }
.system-info p span:first-child { font-weight: 500; }
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.5); display: flex; justify-content: center; align-items: center; z-index: 200; }
.modal-content { background-color: white; padding: 20px; border-radius: 12px; text-align: center; position: relative; max-width: 90%; }
.close-modal-btn { position: absolute; top: 10px; right: 15px; font-size: 24px; cursor: pointer; color: #999; }
.story-header { justify-content: space-between; align-items: center; }
.story-header #generate-story-btn { margin-top: 0; width: auto; padding: 5px 10px; font-size: 14px; }

/* v5.2.1基准版修改v6 */
/* 文件: public/style.css */
/* 优化: 彻底重写全屏编辑器样式，采用覆盖式UI，根治iOS键盘问题。 */

/* 当编辑器激活时，隐藏主应用容器 */
body.editor-active .container {
    display: none;
}

/* 编辑器容器 (不再需要遮罩层，自身就是全屏) */
.fullscreen-editor-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%; /* 占满整个屏幕 */
    z-index: 2000; /* 使用一个非常高的z-index */
    background-color: #F2F2F7; /* 使用设置页的背景色 */
    display: flex;
    flex-direction: column;
    padding: 10px;
    /* 为iPhone安全区域预留底部空间 */
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    opacity: 0;
    transform: translateY(100%); /* 从底部滑入 */
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

.fullscreen-editor-container.visible {
    opacity: 1;
    transform: translateY(0);
}

/* 编辑器内的textarea */
.fullscreen-editor-textarea {
    width: 100%;
    flex-grow: 1; /* 占据所有可用垂直空间 */
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 10px;
    font-size: 16px;
    line-height: 1.6;
    resize: none;
    outline: none;
    margin-bottom: 10px; /* 与按钮的间距 */
}
.fullscreen-editor-textarea:focus {
    border-color: #07C160;
}

/* 编辑器内的“完成”按钮 */
.editor-done-btn {
    flex-shrink: 0; /* 防止被压缩 */
    width: 100%;
    background-color: #07C160;
    color: white;
}

/* v5.2.1基准版修改v8 */
/* 文件: public/style.css */
/* 新增: 用于“故事已更新”的Toast提示样式和动画。 */

/* Toast 容器样式 */
.toast-notification {
    position: fixed;
    top: 20px; /* 从顶部滑入 */
    left: 50%;
    transform: translate(-50%, -100%); /* 初始位置在屏幕外上方 */
    background-color: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 12px 24px;
    border-radius: 25px; /* 胶囊形状 */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999; /* 确保在最顶层 */
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Toast 显示时的状态 (入场动画) */
.toast-notification.show {
    transform: translate(-50%, 0);
    opacity: 1;
}

/* v1.0.0.1 新增: 设置项描述文字样式 */
.setting-item-description {
    font-size: 12px;
    color: #8A8A8E;
    padding: 0 16px 12px;
    line-height: 1.4;
    border-bottom: 1px solid #F2F2F7;
}


/* [角色实时状态指示器 v1] 新增样式 */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #cccccc; /* 默认灰色 */
    margin-right: 6px;
    vertical-align: middle;
    transition: background-color 0.5s ease; /* 颜色变化动画 */
}

.status-indicator.idle {
    background-color: #34C759; /* 空闲时为绿色 */
}

.status-indicator.busy {
    background-color: #FF3B30; /* 忙碌时为红色 */
}

/* [聊天记录分页加载 v1] 新增样式 */
.loading-more {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #8A8A8E;
    font-size: 14px;
    gap: 10px;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #E0E0E0;
    border-top: 2px solid #07C160;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}



/* 长按删除消息样式 */
.message {
    user-select: none; /* 防止长按时选中文本 */
    -webkit-user-select: none;
    -webkit-touch-callout: none; /* 禁用iOS长按菜单 */
    -webkit-tap-highlight-color: transparent; /* 禁用点击高亮 */
}

.message.long-press {
    background-color: rgba(255, 59, 48, 0.15);
    border-radius: 12px;
    transition: all 0.2s ease;
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(255, 59, 48, 0.2);
}

.message.long-press .message-bubble {
    background-color: rgba(255, 59, 48, 0.1) !important;
}

/* 长按提示样式 */
.long-press-hint {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    pointer-events: none;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.long-press-hint.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.05);
}

#chat-days {
    display: flex;
    align-items: center;
    justify-content: center;
}
