/* =============================================
   补全诗词工具 - complete_poetry.css
   三栏布局：历史记录 | 参数配置 | 补全结果
   主题：宣纸羊皮 #faf6ee / 朱砂红 #C0392B / 墨金 #9a7a3c
   ============================================= */

/* ========== 主容器 ========== */
.cp-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 600px;
    background: #faf6ee;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 16px rgba(120, 80, 20, 0.18);
    border: 1px solid #e2d5b0;
    transition: all 0.3s ease;
}

.cp-container.fullscreen {
    position: fixed;
    top: 0; left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999;
    border-radius: 0;
    margin: 0;
    min-height: unset;
    border: none;
}

/* ========== 顶部工具栏 ========== */
.cp-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 12px;
    min-height: 38px;
    background: linear-gradient(135deg, #5c2a0c 0%, #3a1508 100%);
    color: #fff;
    flex-wrap: wrap;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(60, 20, 8, 0.5);
    flex-shrink: 0;
}

.cp-toolbar-group {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-wrap: wrap;
}

.cp-toolbar-title {
    font-size: 14px;
    font-weight: 700;
    color: rgba(255, 240, 200, 0.98);
    letter-spacing: 1px;
}

.cp-toolbar-btn {
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.90);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #5c2a0c;
    transition: all 0.2s;
    white-space: nowrap;
    line-height: 1.5;
}

.cp-toolbar-btn:hover:not(:disabled) {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
}

.cp-toolbar-btn:active:not(:disabled) { transform: translateY(0); }

.cp-toolbar-btn:disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

/* 主操作按钮 */
.cp-btn-primary {
    background: linear-gradient(135deg, #c0862c 0%, #8b5a0a 100%) !important;
    color: #fff !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 6px rgba(139, 90, 10, 0.5) !important;
}

.cp-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #d4993a 0%, #c0862c 100%) !important;
    box-shadow: 0 4px 12px rgba(192, 134, 44, 0.55) !important;
}

.cp-btn-primary.cp-btn-loading {
    background: linear-gradient(90deg, #c0862c 0%, #e4b56a 35%, #c0862c 65%, #8b5a0a 100%) !important;
    background-size: 200% 100% !important;
    animation: cpBtnShimmer 1.4s ease-in-out infinite;
    cursor: not-allowed !important;
}

@keyframes cpBtnShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* 取消按钮 */
.cp-btn-cancel {
    background: rgba(255, 255, 255, 0.15) !important;
    color: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
}

.cp-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.28) !important;
    color: #fff !important;
}

/* ========== 主内容三栏 ========== */
.cp-main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: #faf6ee;
}

/* ========== 左栏：历史记录 ========== */
.cp-history-panel {
    width: 188px;
    flex-shrink: 0;
    background: #fffdf6;
    border-right: 1px solid #e0cfa0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cp-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: linear-gradient(to bottom, #fffaee, #fdf3d0);
    border-bottom: 1px solid #e0cfa0;
    flex-shrink: 0;
}

.cp-history-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #7a4010;
    background: none;
    border: none;
    padding: 0;
}

.cp-history-count {
    font-size: 11px;
    color: #c0862c;
    font-weight: 400;
    margin-left: 3px;
}

.cp-clear-btn {
    background: #fff0f0;
    border: none;
    color: #c0392b;
    font-size: 11px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    transition: background 0.2s;
    white-space: nowrap;
}

.cp-clear-btn:hover { background: #fde8e8; }

.cp-clear-btn:disabled {
    opacity: 0.38;
    cursor: not-allowed;
    pointer-events: none;
}

.cp-clear-btn.cp-clear-confirm {
    background: #fff0c0;
    border: 1px solid #e67e22;
    color: #c0392b;
    font-weight: 700;
    animation: cpClearPulse 0.6s ease;
}

@keyframes cpClearPulse {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.06); }
}

.cp-history-search {
    padding: 8px;
    border-bottom: 1px solid #e8d8a0;
    flex-shrink: 0;
}

.cp-history-search input {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid #d4be8a;
    border-radius: 4px;
    font-size: 12px;
    background: #fffef8;
    color: #3a2810;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.cp-history-search input:focus {
    border-color: #c0862c;
    background: #fff;
}

.cp-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}

.cp-history-list::-webkit-scrollbar { width: 4px; }
.cp-history-list::-webkit-scrollbar-track { background: transparent; }
.cp-history-list::-webkit-scrollbar-thumb {
    background: rgba(192, 134, 44, 0.3);
    border-radius: 2px;
}
.cp-history-list::-webkit-scrollbar-thumb:hover {
    background: rgba(196, 26, 26, 0.4);
}

.cp-history-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid rgba(220, 195, 130, 0.3);
    transition: background 0.15s;
    position: relative;
}

.cp-history-item:hover { background: rgba(192, 134, 44, 0.08); }

.cp-history-item.active {
    background: rgba(192, 134, 44, 0.16);
    border-left: 3px solid #c0862c;
    padding-left: 9px;
}

.cp-history-item-preview {
    font-size: 12px;
    color: #3a2810;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
    font-weight: 500;
}

.cp-history-item-meta {
    font-size: 10px;
    color: #9a7a3c;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 4px;
}

.cp-history-item-time {
    font-size: 10px;
    color: #b8966a;
    flex-shrink: 0;
    margin-left: auto;
    margin-right: 4px;
}

.cp-history-item-del {
    background: none;
    border: none;
    color: #b07050;
    cursor: pointer;
    font-size: 11px;
    padding: 0 2px;
    opacity: 0;
    transition: opacity 0.2s, color 0.2s;
    line-height: 1;
}

.cp-history-item:hover .cp-history-item-del { opacity: 1; }
.cp-history-item-del:hover { color: #e05050; }

.cp-history-empty {
    text-align: center;
    color: #b09070;
    font-size: 12px;
    padding: 24px 12px;
    line-height: 1.8;
}

/* ========== 中栏：参数配置 ========== */
.cp-input-panel {
    width: 300px;
    flex-shrink: 0;
    border-right: 1px solid #e0cfa0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fffef9;
}

.cp-panel-header {
    padding: 12px 14px 10px;
    border-bottom: 1px solid #e8d8a0;
    background: linear-gradient(to bottom, #fffaee, #fdf6e3);
    flex-shrink: 0;
}

.cp-panel-header h3 {
    margin: 0 0 3px 0;
    font-size: 14px;
    font-weight: 700;
    color: #5c2a0c;
    background: none;
    border: none;
    padding: 0;
}

.cp-panel-tip {
    font-size: 11px;
    color: #9a7a3c;
}

.cp-input-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px;
}

.cp-input-body::-webkit-scrollbar { width: 4px; }
.cp-input-body::-webkit-scrollbar-track { background: transparent; }
.cp-input-body::-webkit-scrollbar-thumb {
    background: rgba(192, 134, 44, 0.3);
    border-radius: 2px;
}
.cp-input-body::-webkit-scrollbar-thumb:hover {
    background: rgba(196, 26, 26, 0.4);
}

.cp-field-group {
    margin-bottom: 14px;
}

.cp-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #5c2a0c;
    margin-bottom: 6px;
}

.cp-required {
    color: #c0392b;
    margin-left: 2px;
}

.cp-textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d4be8a;
    border-radius: 6px;
    font-size: 13px;
    color: #2c2010;
    background: #fffef8;
    resize: vertical;
    min-height: 90px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    line-height: 1.7;
    font-family: 'KaiTi', 'STKaiti', '楷体', serif;
}

.cp-textarea:focus {
    border-color: #c0862c;
    box-shadow: 0 0 0 2px rgba(192, 134, 44, 0.15);
    background: #fff;
}

.cp-char-count {
    text-align: right;
    font-size: 11px;
    color: #a08050;
    margin-top: 3px;
    transition: color 0.2s;
}

.cp-char-count.cp-char-warning {
    color: #c0392b;
    font-weight: 600;
}

/* 选项格栅 */
.cp-option-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.cp-option-item {
    padding: 4px 10px;
    border: 1px solid #d4be8a;
    border-radius: 20px;
    font-size: 12px;
    color: #6b4020;
    background: #fffcf2;
    cursor: pointer;
    transition: all 0.18s;
    white-space: nowrap;
}

.cp-option-item:hover {
    border-color: #c0862c;
    background: #fdf5e0;
    color: #5c2a0c;
}

.cp-option-item.selected {
    background: linear-gradient(135deg, #c0862c, #8b5a0a);
    border-color: #c0862c;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(192, 134, 44, 0.35);
}

/* 补全模式 */
.cp-mode-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.cp-mode-item {
    padding: 7px 12px;
    border: 1px solid #d4be8a;
    border-radius: 6px;
    font-size: 12px;
    color: #6b4020;
    background: #fffcf2;
    cursor: pointer;
    transition: all 0.18s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cp-mode-item:hover {
    border-color: #c0862c;
    background: #fdf5e0;
}

.cp-mode-item.selected {
    background: linear-gradient(135deg, rgba(192, 134, 44, 0.12), rgba(139, 90, 10, 0.08));
    border-color: #c0862c;
    border-left: 3px solid #c0862c;
    padding-left: 10px;
    color: #5c2a0c;
    font-weight: 600;
}

.cp-mode-icon { font-size: 14px; }
.cp-mode-name { font-weight: 600; }
.cp-mode-desc { font-size: 11px; color: #9a7a3c; margin-left: auto; }

/* 版本数量 */
.cp-count-group {
    display: flex;
    gap: 6px;
}

.cp-count-item {
    flex: 1;
    padding: 5px 0;
    text-align: center;
    border: 1px solid #d4be8a;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #6b4020;
    background: #fffcf2;
    cursor: pointer;
    transition: all 0.18s;
}

.cp-count-item:hover {
    border-color: #c0862c;
    background: #fdf5e0;
}

.cp-count-item.selected {
    background: linear-gradient(135deg, #c0862c, #8b5a0a);
    border-color: #c0862c;
    color: #fff;
    box-shadow: 0 2px 5px rgba(192, 134, 44, 0.4);
}

/* 生成按钮 */
.cp-generate-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #5c2a0c 0%, #3a1508 100%);
    color: #fdf5e0;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 1px;
    transition: all 0.2s;
    margin-top: 4px;
    box-shadow: 0 2px 8px rgba(60, 20, 8, 0.4);
}

.cp-generate-btn:hover {
    background: linear-gradient(135deg, #7a3a10 0%, #5c2a0c 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(60, 20, 8, 0.5);
}

.cp-generate-btn:active { transform: translateY(0); }

.cp-generate-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: 0 1px 4px rgba(60, 20, 8, 0.15) !important;
}

/* 小贴士 */
.cp-tips-box {
    margin-top: 14px;
    padding: 10px 12px;
    background: rgba(192, 134, 44, 0.07);
    border: 1px solid rgba(192, 134, 44, 0.2);
    border-radius: 6px;
    border-left: 3px solid #c0862c;
}

.cp-tips-box p {
    margin: 0 0 6px 0;
    font-size: 12px;
    font-weight: 600;
    color: #8b5a0a;
}

.cp-tips-box ul {
    margin: 0;
    padding-left: 16px;
    list-style: disc;
}

.cp-tips-box ul li {
    font-size: 11px;
    color: #6b4020;
    line-height: 1.8;
}

.cp-tips-box ul li::marker { font-weight: 600; color: #C0392B; }

/* ========== 右栏：结果区 ========== */
.cp-result-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    background: #faf6ee;
}

.cp-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: linear-gradient(to bottom, #fffaee, #fdf3d0);
    border-bottom: 1px solid #e0cfa0;
    flex-shrink: 0;
}

.cp-result-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #5c2a0c;
    background: none;
    border: none;
    padding: 0;
}

.cp-result-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cp-result-meta {
    display: flex;
    gap: 6px;
    align-items: center;
}

.cp-result-version-badge {
    font-size: 11px;
    padding: 2px 8px;
    background: rgba(192, 134, 44, 0.15);
    border: 1px solid rgba(192, 134, 44, 0.4);
    border-radius: 10px;
    color: #8b5a0a;
    font-weight: 600;
}

.cp-result-type-badge {
    font-size: 11px;
    padding: 2px 8px;
    background: rgba(192, 57, 43, 0.1);
    border: 1px solid rgba(192, 57, 43, 0.3);
    border-radius: 10px;
    color: #8b2010;
    font-weight: 600;
}

.cp-regen-btn {
    padding: 4px 10px;
    background: #fffcf0;
    border: 1px solid #d4be8a;
    border-radius: 4px;
    font-size: 12px;
    color: #6b4020;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.cp-regen-btn:hover {
    background: #fdf5e0;
    border-color: #c0862c;
    color: #5c2a0c;
}

/* 结果体 */
.cp-result-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ========== 状态：占位符 ========== */
.cp-result-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    min-height: 300px;
}

.cp-placeholder-icon {
    font-size: 56px;
    margin-bottom: 16px;
    animation: cpFloat 3s ease-in-out infinite;
}

@keyframes cpFloat {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-8px); }
}

.cp-placeholder-title {
    font-size: 17px;
    font-weight: 700;
    color: #8b5a20;
    margin: 0 0 8px;
    font-family: 'KaiTi', 'STKaiti', '楷体', serif;
}

.cp-placeholder-desc {
    font-size: 13px;
    color: #a08050;
    margin: 3px 0;
}

.cp-placeholder-shortcut {
    margin-top: 14px;
    font-size: 12px;
    color: #b09070;
}

.cp-placeholder-shortcut kbd {
    background: #e8dcc0;
    border: 1px solid #c0a870;
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 11px;
    color: #5c3a10;
    font-family: monospace;
}

/* ========== 状态：加载中 ========== */
.cp-result-loading {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    min-height: 300px;
}

.cp-loading-icon {
    font-size: 48px;
    margin-bottom: 16px;
    animation: cpPen 1.2s ease-in-out infinite;
}

@keyframes cpPen {
    0%, 100% { transform: rotate(-10deg) translateY(0); }
    50%       { transform: rotate(10deg) translateY(-6px); }
}

.cp-loading-dots {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.cp-loading-dots span {
    width: 8px;
    height: 8px;
    background: #c0862c;
    border-radius: 50%;
    animation: cpDot 1.2s ease-in-out infinite;
}

.cp-loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.cp-loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes cpDot {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40%           { transform: scale(1); opacity: 1; }
}

.cp-loading-text {
    font-size: 13px;
    color: #8b5a0a;
    margin: 0;
    font-style: italic;
}

/* ========== 状态：结果内容 ========== */
.cp-result-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.cp-result-content::-webkit-scrollbar { width: 5px; }
.cp-result-content::-webkit-scrollbar-track { background: rgba(220, 195, 130, 0.15); }
.cp-result-content::-webkit-scrollbar-thumb {
    background: rgba(192, 134, 44, 0.35);
    border-radius: 3px;
}
.cp-result-content::-webkit-scrollbar-thumb:hover {
    background: rgba(196, 26, 26, 0.4);
}

/* ========== 状态：错误 ========== */
.cp-result-error {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    min-height: 300px;
    color: #c0392b;
    font-size: 13px;
    text-align: center;
    background: rgba(192, 57, 43, 0.04);
    border-radius: 6px;
    margin: 16px;
}

/* ========== 诗词结果卡片（AI输出）========== */
.cp-result-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

/* 诗词卡片入场动画 */
@keyframes cpFadeInUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

.cp-poem-card {
    background: #fffef8;
    border: 1px solid #e0cfa0;
    border-radius: 8px;
    padding: 18px 20px;
    box-shadow: 0 2px 10px rgba(140, 100, 30, 0.1);
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.2s;
    animation: cpFadeInUp 0.38s ease both;
}

.cp-poem-card:nth-child(2) { animation-delay: 0.12s; }
.cp-poem-card:nth-child(3) { animation-delay: 0.24s; }

.cp-poem-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    background: linear-gradient(to bottom, #c0862c, #8b5a0a);
    border-radius: 8px 0 0 8px;
}

.cp-poem-card:hover {
    box-shadow: 0 4px 16px rgba(140, 100, 30, 0.2);
}

.cp-poem-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px dashed #e0cfa0;
    flex-wrap: wrap;
}

/* 卡片内单独复制按钮 */
.cp-poem-copy-btn {
    margin-left: auto;
    background: rgba(192, 134, 44, 0.1);
    border: 1px solid rgba(192, 134, 44, 0.3);
    border-radius: 4px;
    color: #8b5a0a;
    font-size: 11px;
    padding: 2px 8px;
    cursor: pointer;
    transition: all 0.18s;
    white-space: nowrap;
    flex-shrink: 0;
}

.cp-poem-copy-btn:hover {
    background: rgba(192, 134, 44, 0.22);
    border-color: #c0862c;
    color: #5c2a0c;
    transform: translateY(-1px);
}

.cp-poem-copy-btn.cp-copied {
    background: rgba(46, 160, 67, 0.12);
    border-color: rgba(46, 160, 67, 0.4);
    color: #1a7a30;
}

.cp-poem-version {
    font-size: 11px;
    padding: 2px 8px;
    background: linear-gradient(135deg, #c0862c, #8b5a0a);
    color: #fff;
    border-radius: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.cp-poem-type-tag {
    font-size: 11px;
    padding: 2px 8px;
    background: rgba(192, 57, 43, 0.1);
    border: 1px solid rgba(192, 57, 43, 0.25);
    color: #8b2010;
    border-radius: 10px;
    font-weight: 500;
}

.cp-poem-title {
    font-size: 15px;
    font-weight: 700;
    color: #3a1508;
    margin-bottom: 14px;
    font-family: 'KaiTi', 'STKaiti', '楷体', serif;
    letter-spacing: 1px;
    text-align: center;
    text-shadow: 0 1px 3px rgba(60, 20, 8, 0.08);
}

.cp-poem-body {
    padding: 10px 16px;
    background: rgba(250, 246, 238, 0.6);
    border-radius: 6px;
    margin-bottom: 12px;
}

.cp-poem-line {
    margin: 0 0 4px 0;
    font-size: 15px;
    line-height: 2;
    font-family: 'KaiTi', 'STKaiti', '楷体', serif;
    letter-spacing: 1px;
    color: #2c2010;
}

/* 原有诗句 */
.cp-poem-origin {
    color: #3a2810;
    border-bottom: 1px solid rgba(192, 134, 44, 0.3);
    padding-bottom: 1px;
}

/* AI续写部分 */
.cp-poem-ai {
    color: #8b2010;
    font-weight: 500;
    position: relative;
}

.cp-poem-note {
    font-size: 12px;
    color: #7a5a30;
    line-height: 1.7;
    padding: 8px 12px;
    background: rgba(192, 134, 44, 0.06);
    border-radius: 4px;
    border-left: 2px solid rgba(192, 134, 44, 0.4);
    font-style: italic;
}

/* 仿创标记 */
.cp-poem-card.cp-card-new::before {
    background: linear-gradient(to bottom, #c0392b, #8b1a08);
}

/* 全屏时锁定背景滚动 */
body.cp-fullscreen-active {
    overflow: hidden;
}

/* ========== Toast 通知 ========== */
.cp-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(60, 20, 8, 0.92);
    color: #fdf5e0;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 13px;
    pointer-events: none;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 99999;
    white-space: nowrap;
    max-width: 80vw;
    text-align: center;
}

.cp-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ========== 示例模态框 ========== */
.cp-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(30, 15, 5, 0.55);
    z-index: 10000;
    backdrop-filter: blur(2px);
}

.cp-modal-overlay.active { display: block; }

.cp-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fffef8;
    border-radius: 10px;
    box-shadow: 0 8px 40px rgba(60, 20, 8, 0.3);
    z-index: 10001;
    width: 560px;
    max-width: 92vw;
    max-height: 80vh;
    flex-direction: column;
    border: 1px solid #e0cfa0;
    overflow: hidden;
}

.cp-modal.active {
    display: flex;
    animation: cpModalIn 0.25s ease;
}

@keyframes cpModalIn {
    from { opacity: 0; transform: translate(-50%, -52%); }
    to   { opacity: 1; transform: translate(-50%, -50%); }
}

.cp-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: linear-gradient(135deg, #5c2a0c, #3a1508);
    flex-shrink: 0;
}

.cp-modal-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #fdf5e0;
    background: none;
    border: none;
    padding: 0;
}

.cp-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fdf5e0;
    width: 26px; height: 26px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cp-modal-close:hover { background: rgba(255, 255, 255, 0.35); }

.cp-modal-body {
    overflow-y: auto;
    padding: 16px;
    flex: 1;
}

.cp-modal-body::-webkit-scrollbar { width: 5px; }
.cp-modal-body::-webkit-scrollbar-track { background: transparent; }
.cp-modal-body::-webkit-scrollbar-thumb {
    background: rgba(192, 134, 44, 0.3);
    border-radius: 3px;
}
.cp-modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(196, 26, 26, 0.4);
}

.cp-example-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.cp-example-card {
    padding: 10px 13px;
    border: 1px solid #e0cfa0;
    border-radius: 7px;
    cursor: pointer;
    background: #fffcf5;
    transition: all 0.18s;
}

.cp-example-card:hover {
    border-color: #c0862c;
    background: #fdf5e0;
    box-shadow: 0 3px 10px rgba(192, 134, 44, 0.2);
    transform: translateY(-2px);
}

.cp-example-card-title {
    font-size: 12px;
    font-weight: 700;
    color: #5c2a0c;
    margin-bottom: 5px;
}

.cp-example-card-preview {
    font-size: 11px;
    color: #8b6030;
    font-family: 'KaiTi', 'STKaiti', '楷体', serif;
    line-height: 1.6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cp-example-card-tags {
    margin-top: 5px;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.cp-example-tag {
    font-size: 10px;
    padding: 1px 6px;
    background: rgba(192, 134, 44, 0.12);
    border-radius: 8px;
    color: #7a5010;
}

/* ========== 键盘焦点样式 (:focus-visible) ========== */
.cp-option-item:focus-visible,
.cp-mode-item:focus-visible,
.cp-count-item:focus-visible {
    outline: 2px solid #c0862c;
    outline-offset: 1px;
}

.cp-history-item:focus-visible {
    outline: 2px solid rgba(192, 134, 44, 0.7);
    outline-offset: -2px;
}

.cp-example-card:focus-visible {
    outline: 2px solid #c0862c;
    outline-offset: 2px;
}

/* ========== 暗黑模式 body.dark ========== */
body.dark .cp-container {
    background: #1a1310;
    border-color: #3a2a18;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
}

body.dark .cp-toolbar {
    background: linear-gradient(135deg, #3a1a08 0%, #1e0d04 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

body.dark .cp-toolbar-title { color: rgba(255, 235, 180, 0.95); }

body.dark .cp-toolbar-btn {
    background: rgba(255, 240, 200, 0.12);
    color: #f0d090;
}

body.dark .cp-toolbar-btn:hover:not(:disabled) {
    background: rgba(255, 240, 200, 0.22);
    color: #fae8b0;
}

body.dark .cp-btn-primary {
    background: linear-gradient(135deg, #b07828 0%, #7a4e08 100%) !important;
    color: #fff !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5) !important;
}

body.dark .cp-btn-cancel {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #f0d090 !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
}

body.dark .cp-main-content { background: #1a1310; }

/* dark - 历史面板 */
body.dark .cp-history-panel {
    background: #1e1610;
    border-right-color: #3a2a18;
}

body.dark .cp-history-header {
    background: linear-gradient(to bottom, #231a10, #1e1610);
    border-bottom-color: #3a2a18;
}

body.dark .cp-history-header h3 { color: #d4a060; }

body.dark .cp-history-count { color: #b07830; }

body.dark .cp-clear-btn {
    background: rgba(192, 57, 43, 0.15);
    color: #e06050;
}

body.dark .cp-clear-btn.cp-clear-confirm {
    background: rgba(192, 134, 44, 0.2);
    border-color: #c0862c;
    color: #e08050;
}

body.dark .cp-clear-btn:hover { background: rgba(192, 57, 43, 0.28); }

body.dark .cp-history-search { border-bottom-color: #3a2a18; }

body.dark .cp-history-search input {
    background: #231a10;
    border-color: #4a3020;
    color: #d4a060;
}

body.dark .cp-history-search input:focus {
    border-color: #c0862c;
    background: #2a1e12;
}

body.dark .cp-history-item-preview { color: #d4a060; }
body.dark .cp-history-item-meta { color: #8a6030; }
body.dark .cp-history-item:hover { background: rgba(192, 134, 44, 0.1); }
body.dark .cp-history-item.active { background: rgba(192, 134, 44, 0.2); }
body.dark .cp-history-item-time { color: #7a5030; }
body.dark .cp-history-item-del { color: #7a4a4a; }
body.dark .cp-history-item-del:hover { color: #ff8080; }

/* dark - 输入面板 */
body.dark .cp-input-panel {
    background: #1e1610;
    border-right-color: #3a2a18;
}

body.dark .cp-panel-header {
    background: linear-gradient(to bottom, #251c12, #1e1610);
    border-bottom-color: #3a2a18;
}

body.dark .cp-panel-header h3 { color: #d4a060; }
body.dark .cp-panel-tip { color: #8a6030; }

body.dark .cp-label { color: #c08840; }

body.dark .cp-textarea {
    background: #251c12;
    border-color: #4a3020;
    color: #e0c080;
}

body.dark .cp-textarea:focus {
    border-color: #c0862c;
    background: #2c2016;
    box-shadow: 0 0 0 2px rgba(192, 134, 44, 0.2);
}

body.dark .cp-char-count { color: #7a5a30; }
body.dark .cp-char-count.cp-char-warning { color: #e06050; }

body.dark .cp-option-item {
    background: #251c12;
    border-color: #4a3020;
    color: #c08840;
}

body.dark .cp-option-item:hover {
    border-color: #c0862c;
    background: #2c2016;
}

body.dark .cp-option-item.selected {
    background: linear-gradient(135deg, #b07828, #7a4e08);
    border-color: #b07828;
    color: #fff;
}

body.dark .cp-mode-item {
    background: #251c12;
    border-color: #4a3020;
    color: #c08840;
}

body.dark .cp-mode-item:hover {
    border-color: #c0862c;
    background: #2c2016;
}

body.dark .cp-mode-item.selected {
    background: rgba(192, 134, 44, 0.15);
    border-color: #c0862c;
    color: #d4a060;
}

body.dark .cp-mode-desc { color: #7a5a30; }

body.dark .cp-count-item {
    background: #251c12;
    border-color: #4a3020;
    color: #c08840;
}

body.dark .cp-count-item:hover {
    border-color: #c0862c;
    background: #2c2016;
}

body.dark .cp-count-item.selected {
    background: linear-gradient(135deg, #b07828, #7a4e08);
    border-color: #b07828;
    color: #fff;
}

body.dark .cp-generate-btn {
    background: linear-gradient(135deg, #3a1a08 0%, #251008 100%);
    color: #f0d090;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

body.dark .cp-generate-btn:hover {
    background: linear-gradient(135deg, #4a2010 0%, #3a1a08 100%);
}

body.dark .cp-generate-btn:disabled {
    opacity: 0.45;
}

body.dark .cp-tips-box {
    background: rgba(192, 134, 44, 0.08);
    border-color: rgba(192, 134, 44, 0.2);
}

body.dark .cp-tips-box p { color: #c08840; }
body.dark .cp-tips-box ul li { color: #a07030; }

/* dark - 结果面板 */
body.dark .cp-result-panel { background: #1a1310; }

body.dark .cp-result-header {
    background: linear-gradient(to bottom, #231a10, #1a1310);
    border-bottom-color: #3a2a18;
}

body.dark .cp-result-header h3 { color: #d4a060; }

body.dark .cp-regen-btn {
    background: #251c12;
    border-color: #4a3020;
    color: #c08840;
}

body.dark .cp-regen-btn:hover {
    background: #2c2016;
    border-color: #c0862c;
}

body.dark .cp-result-version-badge {
    background: rgba(192, 134, 44, 0.18);
    border-color: rgba(192, 134, 44, 0.35);
    color: #c08840;
}

body.dark .cp-result-type-badge {
    background: rgba(192, 57, 43, 0.15);
    border-color: rgba(192, 57, 43, 0.3);
    color: #d06050;
}

body.dark .cp-result-placeholder { background: transparent; }
body.dark .cp-placeholder-title { color: #c08840; }
body.dark .cp-placeholder-desc { color: #7a5a30; }
body.dark .cp-placeholder-shortcut { color: #6a4a28; }

body.dark .cp-placeholder-shortcut kbd {
    background: #3a2810;
    border-color: #5a3820;
    color: #d4a060;
}

body.dark .cp-loading-text { color: #c08840; }
body.dark .cp-loading-dots span { background: #c0862c; }

body.dark .cp-history-empty { color: #7a5a30; }

body.dark .cp-result-error {
    color: #e06050;
    background: rgba(192, 57, 43, 0.08);
}

/* dark - 诗词卡片 */
body.dark .cp-poem-card {
    background: #231a10;
    border-color: #3a2a18;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

body.dark .cp-poem-header { border-bottom-color: #3a2a18; }

body.dark .cp-poem-title { color: #e0c090; }

body.dark .cp-poem-body { background: rgba(192, 134, 44, 0.06); }

body.dark .cp-poem-line { color: #d4b870; }

body.dark .cp-poem-origin {
    color: #c0a060;
    border-bottom-color: rgba(192, 134, 44, 0.25);
}

body.dark .cp-poem-ai { color: #e08060; }

body.dark .cp-poem-note {
    color: #9a7040;
    background: rgba(192, 134, 44, 0.08);
    border-left-color: rgba(192, 134, 44, 0.3);
}

body.dark .cp-poem-copy-btn {
    background: rgba(192, 134, 44, 0.1);
    border-color: rgba(192, 134, 44, 0.22);
    color: #c0862c;
}

body.dark .cp-poem-copy-btn:hover {
    background: rgba(192, 134, 44, 0.2);
    border-color: #c0862c;
    color: #d4a060;
}

body.dark .cp-poem-copy-btn.cp-copied {
    background: rgba(46, 160, 67, 0.1);
    border-color: rgba(46, 160, 67, 0.3);
    color: #5aad6a;
}

/* dark - Toast */
body.dark .cp-toast {
    background: rgba(20, 10, 5, 0.95);
    color: #f0d090;
}

/* dark - 模态框 */
body.dark .cp-modal {
    background: #231a10;
    border-color: #3a2a18;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

body.dark .cp-modal-header {
    background: linear-gradient(135deg, #3a1a08, #1e0d04);
}

body.dark .cp-example-card {
    background: #2a1e12;
    border-color: #3a2a18;
}

body.dark .cp-example-card:hover {
    border-color: #c0862c;
    background: #321e10;
}

body.dark .cp-example-card-title { color: #d4a060; }
body.dark .cp-example-card-preview { color: #9a6a30; }
body.dark .cp-example-tag {
    background: rgba(192, 134, 44, 0.15);
    color: #a07030;
}

body.dark .cp-option-item:focus-visible,
body.dark .cp-mode-item:focus-visible,
body.dark .cp-count-item:focus-visible,
body.dark .cp-history-item:focus-visible,
body.dark .cp-example-card:focus-visible {
    outline-color: #d4a060;
}
