/* ========== 打斗剧情生成 - 容器 ========== */
.csg-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 600px;
    background: #fff7f4;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 16px rgba(185, 28, 28, 0.10);
    transition: all 0.3s ease;
}

/* 全屏模式 */
.csg-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999;
    border-radius: 0;
    margin: 0;
}

/* ========== 顶部工具栏 ========== */
.csg-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    background: linear-gradient(135deg, #7f1d1d 0%, #b91c1c 50%, #d97706 100%);
    color: white;
    flex-wrap: wrap;
    gap: 8px;
    box-shadow: 0 2px 12px rgba(127, 29, 29, 0.45);
    flex-shrink: 0;
}

.toolbar-group {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

/* 全屏按钮右对齐（规范：toolbar-group--right 语义类） */
.toolbar-group--right {
    margin-left: auto;
}

.csg-toolbar-title {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
    margin-right: 4px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.csg-toolbar-btn {
    padding: 6px 11px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #fff;
    transition: all 0.2s;
    white-space: nowrap;
    backdrop-filter: blur(4px);
}

.csg-toolbar-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.28);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

.csg-toolbar-btn:active:not(:disabled) {
    transform: translateY(0);
}

.csg-toolbar-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.csg-toolbar-btn-primary {
    background: rgba(255, 255, 255, 0.95);
    color: #b91c1c;
    border-color: transparent;
    font-weight: 600;
}

.csg-toolbar-btn-primary:hover:not(:disabled) {
    background: #fff;
    color: #991b1b;
}

.csg-toolbar-btn-cancel {
    background: rgba(239, 68, 68, 0.85);
    border-color: rgba(239, 68, 68, 0.5);
}

.csg-toolbar-btn-cancel:hover {
    background: rgba(239, 68, 68, 1);
}

/* ========== 主内容区 ========== */
.csg-main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: #fff7f4;
}

/* ========== 左栏：历史记录 ========== */
.csg-history-panel {
    width: 200px;
    background: #ffffff;
    border-right: 1px solid #fecdd3;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

.csg-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: linear-gradient(to bottom, #fff7f4, #ffe4e6);
    border-bottom: 1px solid #fecdd3;
    flex-shrink: 0;
}

.csg-history-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #b91c1c;
}

.csg-history-count {
    font-size: 11px;
    color: #dc2626;
    margin-left: 4px;
    font-weight: 400;
}

.csg-history-clear-btn {
    background: #fff7f4;
    border: 1px solid #fecdd3;
    color: #dc2626;
    font-size: 11px;
    cursor: pointer;
    padding: 3px 7px;
    border-radius: 4px;
    transition: all 0.2s;
    white-space: nowrap;
}

.csg-history-clear-btn:hover {
    background: #fee2e2;
    border-color: #dc2626;
}

.csg-history-search {
    padding: 8px 10px;
    border-bottom: 1px solid #fecdd3;
    flex-shrink: 0;
}

.csg-history-search input {
    width: 100%;
    padding: 5px 9px;
    border: 1px solid #fca5a5;
    border-radius: 5px;
    font-size: 12px;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
    background: #fff7f4;
    color: #374151;
}

.csg-history-search input:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.10);
}

.csg-history-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 6px;
}

.csg-history-empty {
    text-align: center;
    color: #f87171;
    font-size: 12px;
    padding: 24px 12px;
    line-height: 1.8;
}

.csg-history-item {
    padding: 9px 10px;
    margin: 3px 0;
    background: #fff7f4;
    border: 1px solid #fecdd3;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    animation: csgFadeIn 0.2s ease;
}

@keyframes csgFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.csg-history-item:hover {
    background: #ffe4e6;
    border-color: #fca5a5;
    transform: translateX(2px);
}

.csg-history-item.active {
    background: #fee2e2;
    border-color: #dc2626;
    box-shadow: 0 1px 4px rgba(220, 38, 38, 0.2);
}

.csg-history-item-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 16px;
    height: 16px;
    background: #fee2e2;
    color: #dc2626;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    opacity: 0;
    transition: all 0.2s;
    cursor: pointer;
}

.csg-history-item:hover .csg-history-item-delete {
    opacity: 1;
}

.csg-history-item-delete:hover {
    background: #dc2626;
    color: white;
}

.csg-history-item-title {
    font-size: 12px;
    font-weight: 600;
    color: #7f1d1d;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 3px;
    padding-right: 18px;
}

.csg-history-item-meta {
    font-size: 11px;
    color: #b91c1c;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.csg-history-item-badge {
    background: #fee2e2;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 10px;
}

.csg-history-item-time {
    font-size: 10px;
    color: #f87171;
    margin-top: 3px;
}

.csg-history-item-vs {
    font-size: 11px;
    color: #dc2626;
    margin-bottom: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 18px;
    opacity: 0.85;
}

/* ========== 中栏：输入设置 ========== */
.csg-input-panel {
    width: 360px;
    min-width: 300px;
    background: #ffffff;
    border-right: 1px solid #fecdd3;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

.csg-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(to bottom, #fff7f4, #ffe4e6);
    border-bottom: 1px solid #fecdd3;
    flex-shrink: 0;
}

.csg-panel-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #b91c1c;
}

.csg-panel-tip {
    font-size: 11px;
    color: #f87171;
}

.csg-input-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px;
}

/* 表单组 */
.csg-form-group {
    margin-bottom: 15px;
}

.csg-form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 15px;
}

.csg-form-group-half {
    flex: 1;
    margin-bottom: 0;
}

.csg-form-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 600;
    color: #7f1d1d;
    margin-bottom: 7px;
}

.csg-form-label-icon {
    font-size: 14px;
}

.csg-form-required {
    color: #dc2626;
    font-size: 13px;
}

.csg-form-optional {
    color: #f87171;
    font-size: 11px;
    font-weight: 400;
}

.csg-char-counter-inline {
    margin-left: auto;
    font-size: 11px;
    color: #f87171;
    font-weight: 400;
}

.csg-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #fca5a5;
    border-radius: 7px;
    font-size: 13px;
    line-height: 1.6;
    font-family: inherit;
    resize: vertical;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
    background: #fff7f4;
    color: #374151;
    min-height: 68px;
}

.csg-textarea:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.10);
    background: #fff;
}

.csg-textarea::placeholder {
    color: #fca5a5;
    font-size: 12px;
}

.csg-input {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid #fca5a5;
    border-radius: 7px;
    font-size: 13px;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
    background: #fff7f4;
    color: #374151;
    font-family: inherit;
}

.csg-input:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.10);
    background: #fff;
}

.csg-input::placeholder {
    color: #fca5a5;
    font-size: 12px;
}

/* 字数警告/超限状态 CSS 类（替代内联样式）*/
.count-warning {
    color: #dc2626 !important;
    font-weight: 600;
}

/* shake 校验动画 */
@keyframes csgShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

.csg-textarea.shake {
    animation: csgShake 0.4s ease;
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15) !important;
}

.csg-select {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid #fca5a5;
    border-radius: 7px;
    font-size: 13px;
    outline: none;
    background: #fff7f4;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23dc2626' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.csg-select:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.10);
}

/* 篇幅选项 */
.csg-length-options {
    display: flex;
    gap: 8px;
}

.csg-length-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 6px;
    border: 1.5px solid #fca5a5;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff7f4;
    text-align: center;
}

.csg-length-option:hover {
    border-color: #dc2626;
    background: #ffe4e6;
}

.csg-length-option.selected {
    border-color: #b91c1c;
    background: #fee2e2;
    box-shadow: 0 1px 4px rgba(185, 28, 28, 0.2);
}

.csg-length-icon {
    font-size: 20px;
    margin-bottom: 4px;
    transition: transform 0.2s;
}

.csg-length-option.selected .csg-length-icon {
    transform: scale(1.2);
}

.csg-length-name {
    font-size: 12px;
    font-weight: 600;
    color: #7f1d1d;
}

.csg-length-desc {
    font-size: 10px;
    color: #b91c1c;
    margin-top: 2px;
}

/* 提示框 */
.csg-tips-box {
    background: linear-gradient(135deg, #fff5f5, #fff7f4);
    border: 1px solid #fecdd3;
    border-left: 4px solid #dc2626;
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 12px;
    color: #7f1d1d;
    margin-top: 4px;
}

.csg-tips-box p {
    margin: 0 0 8px;
    font-weight: 600;
    color: #991b1b;
}

.csg-tips-box ul {
    margin: 0;
    padding-left: 16px;
    line-height: 1.9;
}

.csg-tips-box kbd {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    border-radius: 3px;
    padding: 0 5px;
    font-size: 11px;
    color: #991b1b;
    font-family: inherit;
}

.csg-tips-box li::marker {
    color: #dc2626;
}

/* ========== 右栏：生成结果 ========== */
.csg-result-panel {
    flex: 1;
    min-width: 300px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.csg-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(to bottom, #fff7f4, #ffe4e6);
    border-bottom: 1px solid #fecdd3;
    flex-shrink: 0;
}

.csg-result-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #b91c1c;
}

.csg-result-meta {
    display: flex;
    gap: 6px;
    align-items: center;
}

.csg-style-badge,
.csg-atmo-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.csg-style-badge {
    background: #fee2e2;
    color: #b91c1c;
}

.csg-atmo-badge {
    background: #fff7ed;
    color: #92400e;
}

.csg-result-body {
    flex: 1;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* 占位提示 */
.csg-result-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: #f87171;
    min-height: 200px;
}

.csg-placeholder-icon {
    font-size: 52px;
    margin-bottom: 16px;
    animation: csgFloat 3s ease-in-out infinite;
}

@keyframes csgFloat {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50%       { transform: translateY(-10px) rotate(5deg); }
}

.csg-placeholder-title {
    font-size: 16px;
    font-weight: 600;
    color: #b91c1c;
    margin: 0 0 8px;
}

.csg-placeholder-desc {
    font-size: 13px;
    color: #f87171;
    margin: 3px 0;
}

/* 加载动画（刀光剑影波形） */
.csg-result-loading {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.csg-sword-wave {
    display: flex;
    align-items: flex-end;
    gap: 5px;
    height: 44px;
    margin-bottom: 16px;
}

.csg-sword-wave span {
    display: block;
    width: 6px;
    border-radius: 3px;
    background: linear-gradient(to top, #b91c1c, #d97706);
    animation: csgSwordWave 1.1s ease-in-out infinite;
}

.csg-sword-wave span:nth-child(1) { height: 18px; animation-delay: 0s; }
.csg-sword-wave span:nth-child(2) { height: 34px; animation-delay: 0.12s; }
.csg-sword-wave span:nth-child(3) { height: 24px; animation-delay: 0.24s; }
.csg-sword-wave span:nth-child(4) { height: 40px; animation-delay: 0.36s; }
.csg-sword-wave span:nth-child(5) { height: 20px; animation-delay: 0.48s; }

@keyframes csgSwordWave {
    0%, 100% { transform: scaleY(0.5); opacity: 0.6; }
    50%       { transform: scaleY(1.2); opacity: 1; }
}

.csg-loading-text {
    font-size: 14px;
    color: #b91c1c;
    font-weight: 500;
    margin: 0;
}

/* 结果内容 */
.csg-result-content {
    flex: 1;
    min-height: 0;
    padding: 20px 24px;
    overflow-y: auto;
    line-height: 1.9;
    animation: csgResultFadeIn 0.35s ease;
}

@keyframes csgResultFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 剧情内容样式（由 AI 返回 HTML） */
.csg-result-content .combat-result {
    max-width: 680px;
    margin: 0 auto;
}

.csg-result-content .combat-title {
    font-size: 22px;
    font-weight: 800;
    color: #7f1d1d;
    background: linear-gradient(135deg, #7f1d1d, #b91c1c 50%, #d97706);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    margin-bottom: 16px;
    letter-spacing: 2px;
    padding-bottom: 14px;
    position: relative;
}

.csg-result-content .combat-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #b91c1c, #d97706);
    border-radius: 3px;
}

.csg-result-content .combat-meta {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}

.csg-result-content .combat-style-tag {
    background: #fee2e2;
    color: #b91c1c;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 10px;
    font-weight: 500;
}

.csg-result-content .combat-atmo-tag {
    background: #fff7ed;
    color: #92400e;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 10px;
    font-weight: 500;
}

.csg-result-content .combat-background {
    margin-bottom: 18px;
    padding: 14px 18px;
    background: linear-gradient(135deg, #fff7f4, #fff5f5);
    border-radius: 10px;
    border-left: 4px solid #d97706;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
}

.csg-result-content .combat-background:hover {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
    transform: translateX(2px);
}

.csg-result-content .combat-round {
    margin-bottom: 16px;
    padding: 14px 18px;
    background: #fff7f4;
    border-radius: 10px;
    border-left: 4px solid #b91c1c;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
}

.csg-result-content .combat-round:hover {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
    transform: translateX(2px);
}

.csg-result-content .combat-ending {
    margin-bottom: 18px;
    padding: 14px 18px;
    background: linear-gradient(135deg, #fffbeb, #fff7f4);
    border-radius: 10px;
    border-left: 4px solid #92400e;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
}

.csg-result-content .combat-ending:hover {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
    transform: translateX(2px);
}

.csg-result-content .combat-section-label {
    font-size: 12px;
    font-weight: 700;
    color: #92400e;
    letter-spacing: 1px;
    margin-bottom: 10px;
    background: #fed7aa;
    display: inline-block;
    padding: 2px 10px;
    border-radius: 4px;
}

.csg-result-content .combat-round-label {
    font-size: 12px;
    font-weight: 700;
    color: #b91c1c;
    letter-spacing: 1px;
    margin-bottom: 10px;
    background: #fee2e2;
    display: inline-block;
    padding: 2px 10px;
    border-radius: 4px;
}

.csg-result-content p {
    margin: 0 0 8px;
    font-size: 14px;
    color: #1f2937;
    line-height: 2;
    letter-spacing: 0.3px;
}

.csg-result-content p:last-child {
    margin-bottom: 0;
}

.csg-result-content li::marker {
    color: #b91c1c;
}

.csg-result-content .combat-note {
    font-size: 12px;
    color: #b91c1c;
    border-top: 1px dashed #fecdd3;
    padding-top: 14px;
    margin-top: 8px;
    font-style: italic;
    text-align: right;
}

/* 错误提示 */
.csg-result-error {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: #dc2626;
    min-height: 200px;
    font-size: 14px;
    gap: 10px;
}

.csg-result-error::before {
    content: '⚠️';
    font-size: 36px;
}

.csg-result-error-retry {
    margin-top: 6px;
    padding: 8px 22px;
    background: linear-gradient(135deg, #b91c1c, #d97706);
    color: #fff;
    border: none;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.csg-result-error-retry:hover {
    background: linear-gradient(135deg, #991b1b, #b45309);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(185, 28, 28, 0.3);
}

/* ========== 示例模态框 ========== */
.csg-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(127, 29, 29, 0.30);
    z-index: 100001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s;
    backdrop-filter: blur(2px);
}

.csg-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.csg-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.92);
    background: #fff;
    border-radius: 12px;
    z-index: 100002;
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 16px 48px rgba(127, 29, 29, 0.22);
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.csg-modal.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.csg-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: linear-gradient(135deg, #7f1d1d, #b91c1c, #d97706);
    color: #fff;
    flex-shrink: 0;
}

.csg-modal-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
}

.csg-modal-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.csg-modal-close:hover {
    background: rgba(255,255,255,0.35);
}

.csg-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.csg-example-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 12px;
}

.csg-example-card {
    padding: 14px 16px;
    background: #fff7f4;
    border: 1.5px solid #fecdd3;
    border-radius: 9px;
    cursor: pointer;
    transition: all 0.2s;
}

.csg-example-card:hover {
    border-color: #dc2626;
    background: #ffe4e6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.14);
}

.csg-example-card-label {
    font-size: 14px;
    font-weight: 700;
    color: #7f1d1d;
    margin-bottom: 5px;
}

.csg-example-card-roles {
    font-size: 12px;
    color: #374151;
    margin-bottom: 8px;
    line-height: 1.5;
}

.csg-example-card-scene {
    font-size: 11px;
    color: #6b7280;
    margin-bottom: 8px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.csg-example-card-tags {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.csg-example-card-tag {
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 8px;
    font-weight: 500;
}

.csg-example-card-tag.style-tag {
    background: #fee2e2;
    color: #b91c1c;
}

.csg-example-card-tag.atmo-tag {
    background: #fff7ed;
    color: #92400e;
}

.csg-example-card-tag.length-tag {
    background: #f0fdf4;
    color: #15803d;
}

/* 示例弹窗加载/空提示 */
.csg-example-loading {
    text-align: center;
    padding: 32px;
    color: #f87171;
    font-size: 13px;
}

.csg-example-empty {
    text-align: center;
    color: #f87171;
    padding: 20px;
    font-size: 13px;
}

/* ========== 浮动提示（showTip） ========== */
.csg-tip-toast {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(127, 29, 29, 0.92);
    color: #fff;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 13px;
    z-index: 200000;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* ========== 自定义滚动条 ========== */
.csg-history-list::-webkit-scrollbar,
.csg-input-body::-webkit-scrollbar,
.csg-result-content::-webkit-scrollbar,
.csg-modal-body::-webkit-scrollbar {
    width: 4px;
}

.csg-history-list::-webkit-scrollbar-track,
.csg-input-body::-webkit-scrollbar-track,
.csg-result-content::-webkit-scrollbar-track,
.csg-modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.csg-history-list::-webkit-scrollbar-thumb,
.csg-input-body::-webkit-scrollbar-thumb,
.csg-result-content::-webkit-scrollbar-thumb,
.csg-modal-body::-webkit-scrollbar-thumb {
    background: #fca5a5;
    border-radius: 4px;
}

.csg-history-list::-webkit-scrollbar-thumb:hover,
.csg-input-body::-webkit-scrollbar-thumb:hover,
.csg-result-content::-webkit-scrollbar-thumb:hover,
.csg-modal-body::-webkit-scrollbar-thumb:hover {
    background: #dc2626;
}

/* ========== 响应式布局 ========== */
@media (min-width: 640px) and (max-width: 899px) {
    .csg-history-panel { display: none; }
    .csg-input-panel { width: 320px; }
}

@media (max-width: 639px) {
    .csg-main-content { flex-direction: column; }
    .csg-history-panel { display: none; }
    .csg-input-panel { width: 100%; min-width: unset; border-right: none; border-bottom: 1px solid #fecdd3; max-height: 55%; }
    .csg-result-panel { min-width: unset; }
    .csg-form-row { flex-direction: column; gap: 8px; }
}

/* ========== 暗黑模式 ========== */
body.dark .csg-container {
    background: #1a0808;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
}

body.dark .csg-toolbar {
    background: linear-gradient(135deg, #450a0a 0%, #7f1d1d 50%, #92400e 100%);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

body.dark .csg-main-content {
    background: #1a0808;
}

body.dark .csg-history-panel,
body.dark .csg-input-panel,
body.dark .csg-result-panel {
    background: #120505;
    border-color: #7f1d1d;
}

body.dark .csg-history-header,
body.dark .csg-panel-header,
body.dark .csg-result-header {
    background: linear-gradient(to bottom, #200808, #180606);
    border-color: #7f1d1d;
}

body.dark .csg-history-header h3,
body.dark .csg-panel-header h3,
body.dark .csg-result-header h3 {
    color: #fca5a5;
}

body.dark .csg-panel-tip {
    color: #ef4444;
}

body.dark .csg-history-search input {
    background: #1a0808;
    border-color: #991b1b;
    color: #e5e7eb;
}

body.dark .csg-history-search input::placeholder {
    color: #ef4444;
}

body.dark .csg-history-list {
    background: #120505;
}

body.dark .csg-history-empty {
    color: #ef4444;
}

body.dark .csg-history-item {
    background: #200a0a;
    border-color: #7f1d1d;
    color: #e5e7eb;
}

body.dark .csg-history-item:hover {
    background: #2d0f0f;
    border-color: #b91c1c;
}

body.dark .csg-history-item.active {
    background: #2d0f0f;
    border-color: #dc2626;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.45);
}

body.dark .csg-history-item-title {
    color: #fca5a5;
}

body.dark .csg-history-item-meta {
    color: #f87171;
}

body.dark .csg-history-item-badge {
    background: #2d0f0f;
}

body.dark .csg-history-item-time {
    color: #ef4444;
}

body.dark .csg-history-clear-btn {
    background: #200a0a;
    border-color: #991b1b;
    color: #f87171;
}

body.dark .csg-history-clear-btn:hover {
    background: #2d0f0f;
}

body.dark .csg-input-body {
    background: #120505;
}

body.dark .csg-form-label {
    color: #fca5a5;
}

body.dark .csg-textarea {
    background: #200a0a;
    border-color: #991b1b;
    color: #e5e7eb;
}

body.dark .csg-textarea:focus {
    border-color: #dc2626;
    background: #200a0a;
}

body.dark .csg-textarea::placeholder {
    color: #ef4444;
}

body.dark .csg-input {
    background: #200a0a;
    border-color: #991b1b;
    color: #e5e7eb;
}

body.dark .csg-input:focus {
    border-color: #dc2626;
    background: #200a0a;
}

body.dark .csg-input::placeholder {
    color: #ef4444;
}

body.dark .csg-select {
    background-color: #200a0a;
    border-color: #991b1b;
    color: #e5e7eb;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23fca5a5' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}

body.dark .csg-select option {
    background: #200a0a;
}

body.dark .csg-length-option {
    background: #200a0a;
    border-color: #991b1b;
}

body.dark .csg-length-option:hover {
    background: #2d0f0f;
    border-color: #b91c1c;
}

body.dark .csg-length-option.selected {
    background: #2d0f0f;
    border-color: #dc2626;
    box-shadow: 0 1px 4px rgba(220, 38, 38, 0.3);
}

body.dark .csg-length-name {
    color: #fca5a5;
}

body.dark .csg-length-desc {
    color: #ef4444;
}

body.dark .csg-tips-box {
    background: linear-gradient(135deg, #200a0a, #1a0808);
    border-color: #7f1d1d;
    border-left-color: #b91c1c;
    color: #fca5a5;
}

body.dark .csg-tips-box p {
    color: #fca5a5;
}

body.dark .csg-tips-box kbd {
    background: #2d0f0f;
    border-color: #b91c1c;
    color: #fca5a5;
}

body.dark .csg-char-counter-inline {
    color: #ef4444;
}

body.dark .csg-result-placeholder {
    color: #ef4444;
}

body.dark .csg-placeholder-title {
    color: #f87171;
}

body.dark .csg-placeholder-desc {
    color: #ef4444;
}

body.dark .csg-loading-text {
    color: #f87171;
}

body.dark .csg-result-content {
    background: #120505;
}

body.dark .csg-result-content .combat-title {
    color: #fecdd3;
    background: linear-gradient(135deg, #fca5a5, #fecdd3 50%, #fcd34d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

body.dark .csg-result-content .combat-title::after {
    background: linear-gradient(90deg, #dc2626, #d97706);
}

body.dark .csg-result-content .combat-style-tag {
    background: #2d0f0f;
    color: #fca5a5;
}

body.dark .csg-result-content .combat-atmo-tag {
    background: #1c1200;
    color: #fcd34d;
}

body.dark .csg-result-content .combat-background {
    background: linear-gradient(135deg, #1c0c00, #1a0808);
    border-left-color: #d97706;
}

body.dark .csg-result-content .combat-background:hover {
    background: linear-gradient(135deg, #271000, #200a0a);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}

body.dark .csg-result-content .combat-round {
    background: #200a0a;
    border-left-color: #b91c1c;
}

body.dark .csg-result-content .combat-ending {
    background: linear-gradient(135deg, #1c1200, #1a0808);
    border-left-color: #92400e;
}

body.dark .csg-result-content .combat-ending:hover {
    background: linear-gradient(135deg, #261800, #200a0a);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}

body.dark .csg-result-content .combat-section-label {
    background: #2d1c00;
    color: #fcd34d;
}

body.dark .csg-result-content .combat-round-label {
    background: #2d0f0f;
    color: #fca5a5;
}

body.dark .csg-result-content p {
    color: #e5e7eb;
}

body.dark .csg-result-content .combat-note {
    color: #f87171;
    border-top-color: #7f1d1d;
}

body.dark .csg-result-error {
    background: #120505;
    color: #fca5a5;
}

body.dark .csg-result-error-retry {
    background: linear-gradient(135deg, #991b1b, #b45309);
}

body.dark .csg-result-error-retry:hover {
    background: linear-gradient(135deg, #7f1d1d, #92400e);
}

body.dark .csg-modal {
    background: #1a0808;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.7);
}

body.dark .csg-modal-header {
    background: linear-gradient(135deg, #450a0a, #7f1d1d, #92400e);
}

body.dark .csg-modal-body {
    background: #1a0808;
}

body.dark .csg-example-card {
    background: #200a0a;
    border-color: #7f1d1d;
}

body.dark .csg-example-card:hover {
    border-color: #b91c1c;
    background: #2d0f0f;
}

body.dark .csg-example-card-label {
    color: #fca5a5;
}

body.dark .csg-example-card-roles {
    color: #d1d5db;
}

body.dark .csg-example-card-scene {
    color: #9ca3af;
}

body.dark .csg-example-card-tag.style-tag {
    background: #2d0f0f;
    color: #fca5a5;
}

body.dark .csg-example-card-tag.atmo-tag {
    background: #1c1200;
    color: #fcd34d;
}

body.dark .csg-example-card-tag.length-tag {
    background: #052e16;
    color: #6ee7b7;
}

body.dark .csg-example-loading {
    color: #ef4444;
}

body.dark .csg-style-badge {
    background: #2d0f0f;
    color: #fca5a5;
}

body.dark .csg-atmo-badge {
    background: #1c1200;
    color: #fcd34d;
}

/* 暗黑模式字数警告 */
body.dark .count-warning {
    color: #fca5a5 !important;
}

/* 暗黑模式自定义滚动条 */
body.dark .csg-history-list::-webkit-scrollbar-thumb,
body.dark .csg-input-body::-webkit-scrollbar-thumb,
body.dark .csg-result-content::-webkit-scrollbar-thumb,
body.dark .csg-modal-body::-webkit-scrollbar-thumb {
    background: #991b1b;
}

body.dark .csg-history-list::-webkit-scrollbar-thumb:hover,
body.dark .csg-input-body::-webkit-scrollbar-thumb:hover,
body.dark .csg-result-content::-webkit-scrollbar-thumb:hover,
body.dark .csg-modal-body::-webkit-scrollbar-thumb:hover {
    background: #dc2626;
}

/* 暗黑模式滚动条轨道显式覆盖（规范要求不可依赖默认值）*/
body.dark .csg-history-list::-webkit-scrollbar-track,
body.dark .csg-input-body::-webkit-scrollbar-track,
body.dark .csg-result-content::-webkit-scrollbar-track,
body.dark .csg-modal-body::-webkit-scrollbar-track {
    background: #120505;
}

/* 暗黑模式：历史记录 vs 对手行 */
body.dark .csg-history-item-vs {
    color: #f87171;
}

/* 暗黑模式：表单辅助文字 */
body.dark .csg-form-optional {
    color: #ef4444;
}

body.dark .csg-form-required {
    color: #f87171;
}

body.dark .csg-history-count {
    color: #f87171;
}

/* 暗黑模式：内容卡片静态阴影 */
body.dark .csg-result-content .combat-background,
body.dark .csg-result-content .combat-round,
body.dark .csg-result-content .combat-ending {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* 暗黑模式：回合卡片 hover */
body.dark .csg-result-content .combat-round:hover {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
    background: #2d0f0f;
}

/* 暗黑模式：li 列表标记颜色 */
body.dark .csg-tips-box li::marker {
    color: #fca5a5;
}

body.dark .csg-result-content li::marker {
    color: #fca5a5;
}

/* 暗黑模式：示例空提示 */
body.dark .csg-example-empty {
    color: #ef4444;
}

/* 暗黑模式：浮动提示 */
body.dark .csg-tip-toast {
    background: rgba(69, 10, 10, 0.96);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}
