/* ===================================================
   中文拆字工具样式 - chinese_character_segmentation.css
   主题：朱砂红 + 宣纸米白，体现汉字文化气韵
   =================================================== */

/* ===== 主容器 ===== */
.ccs-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 600px;
    background: #fdf8f0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(120, 40, 20, 0.08);
    transition: all 0.3s ease;
}

/* 全屏模式 */
.ccs-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999;
    border-radius: 0;
    margin: 0;
}

/* ===== 顶部工具栏 ===== */
.ccs-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    background: linear-gradient(135deg, #b5241c 0%, #7b1010 100%);
    color: white;
    flex-wrap: wrap;
    gap: 8px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(181, 36, 28, 0.35);
}

.toolbar-group {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.toolbar-title {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    margin-right: 4px;
    letter-spacing: 1px;
}

.toolbar-btn {
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #fff;
    transition: all 0.2s;
    white-space: nowrap;
}

.toolbar-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.28);
    border-color: rgba(255, 255, 255, 0.55);
    transform: translateY(-1px);
}

.toolbar-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.toolbar-btn-primary {
    background: #e8c040 !important;
    border-color: #c8a020 !important;
    color: #6a3000 !important;
    font-weight: 700;
}

.toolbar-btn-primary:hover:not(:disabled) {
    background: #f0d060 !important;
    border-color: #dab030 !important;
    transform: translateY(-1px);
}

.toolbar-btn-cancel {
    background: rgba(255, 100, 80, 0.3) !important;
    border-color: rgba(255, 120, 100, 0.5) !important;
    color: #ffe0d8 !important;
}

/* ===== 主内容区 ===== */
.ccs-main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: #fdf8f0;
}

/* ===== 左栏：历史记录 ===== */
.ccs-history-panel {
    width: 190px;
    flex-shrink: 0;
    background: #fffcf8;
    border-right: 1px solid #e8d4b8;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.history-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 13px;
    background: linear-gradient(to bottom, #fffaf5, #fdf2e8);
    border-bottom: 1px solid #e8d4b8;
    flex-shrink: 0;
}

.history-panel-header h3 {
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    color: #7a3808;
}

.history-count {
    font-size: 10px;
    color: #a86030;
    font-weight: 400;
}

.history-clear-btn {
    background: #fff0e8;
    border: none;
    color: #b5241c;
    font-size: 10px;
    cursor: pointer;
    padding: 3px 7px;
    border-radius: 3px;
    transition: all 0.2s;
    white-space: nowrap;
}

.history-clear-btn:hover {
    background: #ffe0d0;
}

.history-search {
    padding: 7px 8px;
    border-bottom: 1px solid #e8d4b8;
    flex-shrink: 0;
}

.history-search input {
    width: 100%;
    padding: 5px 9px;
    border: 1px solid #dcc8a8;
    border-radius: 4px;
    font-size: 12px;
    outline: none;
    background: #fffcf8;
    color: #4a2800;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.history-search input:focus {
    border-color: #b5241c;
    box-shadow: 0 0 0 2px rgba(181, 36, 28, 0.1);
}

.history-search input::placeholder {
    color: #c0a880;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 5px;
}

.history-empty {
    padding: 18px 10px;
    text-align: center;
    color: #b09070;
    font-size: 12px;
    line-height: 1.9;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 9px;
    margin: 3px 0;
    background: #fffcf8;
    border: 1px solid #e8d0b8;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.15s;
}

.history-item:hover {
    background: #fff0e5;
    border-color: #b5241c;
    transform: translateX(2px);
}

.history-item.active {
    background: #fde8e0;
    border-color: #b5241c;
    box-shadow: 0 1px 4px rgba(181, 36, 28, 0.15);
}

.history-item-main {
    flex: 1;
    min-width: 0;
}

.history-item-word {
    font-size: 20px;
    font-weight: 900;
    color: #b5241c;
    letter-spacing: 2px;
    line-height: 1.2;
    margin-bottom: 3px;
    font-family: 'STKaiti', 'KaiTi', 'SimKai', '楷体', serif;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-item-meta {
    display: flex;
    gap: 4px;
    align-items: center;
    font-size: 10px;
    color: #a08060;
    flex-wrap: wrap;
}

.history-item-type {
    background: #fde8e0;
    color: #b5241c;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 10px;
    border: 1px solid rgba(181, 36, 28, 0.18);
    white-space: nowrap;
}

.history-item-del {
    width: 18px;
    height: 18px;
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    font-size: 11px;
    padding: 0;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.15s;
    flex-shrink: 0;
}

.history-item:hover .history-item-del {
    opacity: 1;
    color: #b5241c;
}

.history-item-del:hover {
    background: #ffe0d8;
}

/* ===== 中栏：输入区 ===== */
.ccs-input-panel {
    width: 250px;
    flex-shrink: 0;
    background: #fffcf8;
    border-right: 1px solid #e8d4b8;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 14px;
    background: linear-gradient(to bottom, #fffaf5, #fdf2e8);
    border-bottom: 1px solid #e8d4b8;
    flex-shrink: 0;
}

.panel-header h3 {
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    color: #7a3808;
}

.panel-tip {
    font-size: 11px;
    color: #b09070;
}

.ccs-input-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 14px;
}

/* 大字预览 */
.char-preview-box {
    width: 100%;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #fff9f0 0%, #fdf0e4 100%);
    border: 2px solid #e0c8a0;
    border-radius: 8px;
    margin-bottom: 13px;
    position: relative;
    overflow: hidden;
}

.char-preview-box::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border: 1px dashed #e0c0a0;
    border-radius: 5px;
    pointer-events: none;
    opacity: 0.6;
}

/* 米字格辅助线 */
.char-preview-box::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(rgba(181, 36, 28, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(181, 36, 28, 0.06) 1px, transparent 1px);
    background-size: 50% 50%;
    pointer-events: none;
}

.char-preview-text {
    font-size: 52px;
    font-weight: 900;
    color: #b5241c;
    line-height: 1;
    font-family: 'STKaiti', 'KaiTi', 'SimKai', '楷体', 'STXingkai', serif;
    text-shadow: 2px 3px 6px rgba(181, 36, 28, 0.18);
    transition: all 0.15s;
    letter-spacing: 4px;
    position: relative;
    z-index: 1;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 输入包装 */
.ccs-input-wrap {
    display: flex;
    border: 2px solid #dcc8a8;
    border-radius: 6px;
    overflow: hidden;
    transition: border-color 0.2s;
    margin-bottom: 4px;
}

.ccs-input-wrap:focus-within {
    border-color: #b5241c;
    box-shadow: 0 0 0 3px rgba(181, 36, 28, 0.1);
}

.ccs-search-input {
    flex: 1;
    padding: 9px 12px;
    border: none;
    outline: none;
    font-size: 22px;
    font-family: 'STKaiti', 'KaiTi', '楷体', serif;
    font-weight: 700;
    color: #6a3000;
    background: #fffcf8;
    letter-spacing: 5px;
    text-align: center;
}

.ccs-search-input::placeholder {
    font-size: 13px;
    color: #c0a880;
    letter-spacing: 0;
    font-family: inherit;
    font-weight: 400;
}

.ccs-search-btn {
    width: 44px;
    background: #b5241c;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 18px;
    font-weight: 900;
    font-family: 'STKaiti', '楷体', serif;
    transition: background 0.2s;
    flex-shrink: 0;
}

.ccs-search-btn:hover {
    background: #9b1a14;
}

.ccs-search-btn:disabled {
    background: #c88878;
    cursor: not-allowed;
}

.ccs-char-counter {
    text-align: right;
    font-size: 11px;
    color: #b0987a;
    margin-bottom: 13px;
}

/* 分析模式 */
.ccs-mode-group {
    margin-bottom: 13px;
}

.ccs-mode-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #7a3808;
    margin-bottom: 6px;
}

.ccs-mode-options {
    display: flex;
    gap: 8px;
}

.ccs-mode-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 6px;
    border: 1px solid #dcc8a8;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    color: #7a5a38;
    background: #fffcf8;
    transition: all 0.2s;
    text-align: center;
    line-height: 1.3;
}

.ccs-mode-option:hover {
    border-color: #b5241c;
    background: #fdf0e8;
    color: #b5241c;
}

.ccs-mode-option.selected {
    border-color: #b5241c;
    background: linear-gradient(to bottom, #fde8e0, #fdddd0);
    color: #b5241c;
    font-weight: 700;
    box-shadow: 0 1px 4px rgba(181, 36, 28, 0.1);
}

.ccs-mode-icon {
    font-size: 16px;
}

/* 快捷字 */
.ccs-quick-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #7a3808;
    margin-bottom: 6px;
}

.ccs-quick-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 13px;
}

.ccs-quick-tag {
    padding: 4px 9px;
    background: #fdf0e8;
    border: 1px solid #e0c8a0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 17px;
    color: #b5241c;
    font-family: 'STKaiti', 'KaiTi', '楷体', serif;
    font-weight: 700;
    transition: all 0.15s;
    line-height: 1.3;
}

.ccs-quick-tag:hover {
    background: #b5241c;
    color: white;
    border-color: #b5241c;
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(181, 36, 28, 0.25);
}

/* 提示框 */
.ccs-tips-box {
    padding: 11px 13px;
    background: #fff9f0;
    border: 1px solid #e8d0b0;
    border-radius: 6px;
    font-size: 12px;
    color: #7a5a38;
    line-height: 1.7;
}

.ccs-tips-box p {
    margin: 0 0 5px;
    font-weight: 700;
    color: #a05828;
}

.ccs-tips-box ul {
    margin: 0;
    padding-left: 16px;
}

.ccs-tips-box li {
    margin-bottom: 3px;
}

/* ===== 右栏：结果区 ===== */
.ccs-result-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    overflow: hidden;
    min-width: 300px;
}

.ccs-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 16px;
    background: linear-gradient(to bottom, #fffaf5, #fdf2e8);
    border-bottom: 1px solid #e8d4b8;
    flex-shrink: 0;
}

.ccs-result-header h3 {
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    color: #7a3808;
}

.result-meta-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-char-label {
    font-size: 22px;
    font-weight: 900;
    color: #b5241c;
    font-family: 'STKaiti', 'KaiTi', '楷体', serif;
    letter-spacing: 3px;
    line-height: 1;
}

.result-mode-badge {
    font-size: 11px;
    padding: 2px 8px;
    background: #fde8e0;
    color: #b5241c;
    border: 1px solid rgba(181, 36, 28, 0.2);
    border-radius: 10px;
    font-weight: 600;
}

.ccs-result-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

/* ===== 占位提示 ===== */
.result-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px;
    text-align: center;
}

.placeholder-char {
    font-size: 90px;
    font-weight: 900;
    color: rgba(181, 36, 28, 0.09);
    line-height: 1;
    margin-bottom: 16px;
    font-family: 'STKaiti', 'KaiTi', '楷体', serif;
    user-select: none;
}

.placeholder-title {
    font-size: 16px;
    font-weight: 700;
    color: #b09070;
    margin: 0 0 8px;
}

.placeholder-desc {
    font-size: 13px;
    color: #c0a880;
    margin: 3px 0;
}

/* ===== 加载中 ===== */
.result-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px;
    gap: 0;
}

.loading-brush-spin {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(181, 36, 28, 0.12);
    border-top-color: #b5241c;
    border-radius: 50%;
    animation: ccsSpin 0.85s linear infinite;
    margin-bottom: 16px;
}

@keyframes ccsSpin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 14px;
    color: #a05828;
    margin: 0 0 10px;
    animation: ccsBreathText 1.8s ease-in-out infinite;
}

.loading-tips {
    font-size: 12px;
    color: #c0a880;
    text-align: center;
    min-height: 18px;
    font-style: italic;
    transition: opacity 0.4s;
}

/* ===== 结果内容区 ===== */
.result-content {
    padding: 20px 24px 32px; /* 底部留白防止内容被截断 */
}

/* 错误 */
.result-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px;
    text-align: center;
}

.error-icon {
    font-size: 36px;
    margin-bottom: 12px;
}

.error-msg {
    font-size: 14px;
    color: #b5241c;
    margin: 0 0 6px;
    font-weight: 600;
}

.error-tip {
    font-size: 12px;
    color: #a08068;
}

/* ===== AI 生成结果内容样式 ===== */
.result-content .ccs-char-block {
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px dashed #e8d0b8;
}

.result-content .ccs-char-block:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.result-content .ccs-char-title {
    font-size: 40px;
    font-weight: 900;
    color: #b5241c;
    font-family: 'STKaiti', 'KaiTi', '楷体', serif;
    margin-bottom: 8px;
    letter-spacing: 4px;
    line-height: 1.1;
}

.result-content .ccs-structure-badge {
    display: inline-block;
    font-size: 12px;
    padding: 3px 10px;
    background: #fde8e0;
    color: #b5241c;
    border: 1px solid rgba(181, 36, 28, 0.22);
    border-radius: 12px;
    font-weight: 600;
    margin-bottom: 14px;
}

/* 拆字可视化 */
.result-content .ccs-decomp {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 14px 16px;
    background: linear-gradient(135deg, #fff9f0 0%, #fdf3e8 100%);
    border: 1px solid #e8d0b0;
    border-radius: 8px;
    margin-bottom: 16px;
}

.result-content .ccs-decomp-char {
    font-size: 34px;
    font-weight: 900;
    color: #b5241c;
    font-family: 'STKaiti', 'KaiTi', '楷体', serif;
    line-height: 1;
}

.result-content .ccs-decomp-arrow {
    font-size: 20px;
    color: #a09070;
    font-weight: 400;
}

.result-content .ccs-decomp-parts {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.result-content .ccs-part {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 12px;
    background: white;
    border: 1px solid #e0c8a8;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(181, 36, 28, 0.05);
}

.result-content .ccs-part-char {
    font-size: 26px;
    font-weight: 700;
    color: #7b1010;
    font-family: 'STKaiti', 'KaiTi', '楷体', serif;
    transition: color 0.15s;
    line-height: 1.2;
}

.result-content .ccs-part-name {
    font-size: 11px;
    color: #a09070;
    margin-top: 3px;
    text-align: center;
}

.result-content .ccs-plus {
    font-size: 22px;
    color: #c8b090;
    font-weight: 300;
    line-height: 1;
}

/* 可点击的部件标签 */
.result-content .ccs-part-tag {
    display: inline-block;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    color: #b5241c;
    font-family: 'STKaiti', '楷体', serif;
    background: #fdf0e8;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid rgba(181, 36, 28, 0.2);
    transition: all 0.15s;
    text-decoration: none;
}

.result-content .ccs-part-tag:hover,
.result-content .ccs-part-char:hover {
    background: #b5241c;
    color: white;
    cursor: pointer;
}

.result-content .ccs-part-char {
    cursor: pointer;
}

/* 小节 */
.result-content .ccs-section {
    margin-bottom: 16px;
}

.result-content .ccs-section h4 {
    font-size: 13px;
    font-weight: 700;
    color: #7a3808;
    margin: 0 0 8px;
    padding-bottom: 5px;
    border-bottom: 2px solid #e8d0b0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.result-content .ccs-section p {
    font-size: 14px;
    color: #4a3018;
    line-height: 1.85;
    margin: 0 0 6px;
}

.result-content .ccs-section ul,
.result-content .ccs-section ol {
    margin: 0;
    padding-left: 18px;
    font-size: 14px;
    color: #4a3018;
    line-height: 1.85;
}

.result-content .ccs-section li {
    margin-bottom: 4px;
}

/* blockquote 重置 */
.result-content blockquote {
    margin: 0;
    padding: 0;
}

/* ===== 模态框 ===== */
.ccs-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.36);
    z-index: 100000;
    backdrop-filter: blur(2px);
}

.ccs-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(680px, 90vw);
    max-height: 80vh;
    background: white;
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.16);
    z-index: 100001;
    flex-direction: column;
    overflow: hidden;
}

@keyframes meOverlayFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes meModalSlideIn {
    from { opacity: 0; transform: translate(-50%, calc(-50% + 18px)); }
    to { opacity: 1; transform: translate(-50%, -50%); }
}

.ccs-modal-overlay.show {
    animation: meOverlayFadeIn 0.2s ease forwards;
}

.ccs-modal.show {
    animation: meModalSlideIn 0.28s cubic-bezier(.34, 1.4, .64, 1) forwards;
}

.ccs-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 13px 18px;
    background: linear-gradient(to bottom, #fffaf5, #fdf2e8);
    border-bottom: 1px solid #e8d4b8;
    flex-shrink: 0;
}

.ccs-modal-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #7a3808;
}

.ccs-modal-close {
    width: 28px;
    height: 28px;
    background: #fff0e8;
    border: none;
    color: #b5241c;
    border-radius: 50%;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ccs-modal-close:hover {
    background: #b5241c;
    color: white;
}

.ccs-modal-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
}

/* 示例网格 */
.example-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.example-card {
    padding: 14px 12px;
    background: #fffcf8;
    border: 1px solid #e8d4b8;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 5px;
}

.example-card:hover {
    border-color: #b5241c;
    background: #fdf0e8;
    transform: translateY(-2px);
    box-shadow: 0 5px 14px rgba(181, 36, 28, 0.13);
}

.example-char {
    font-size: 36px;
    font-weight: 900;
    color: #b5241c;
    font-family: 'STKaiti', 'KaiTi', '楷体', serif;
    line-height: 1.1;
    letter-spacing: 3px;
}

.example-label {
    font-size: 12px;
    color: #a08868;
    line-height: 1.4;
}

.example-mode-badge {
    font-size: 10px;
    padding: 2px 7px;
    background: #fde8e0;
    color: #b5241c;
    border: 1px solid rgba(181, 36, 28, 0.2);
    border-radius: 8px;
    font-weight: 600;
}

/* ===== 动画 ===== */
@keyframes ccsShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.shake {
    animation: ccsShake 0.4s ease;
}

/* ===== 响应式 ===== */
@media (max-width: 860px) {
    .ccs-history-panel { display: none; }
}

@media (max-width: 600px) {
    .ccs-input-panel { display: none; }
}

/* ==================================================
   暗黑模式 - 所有选择器以 body.dark 为父级前缀
   ================================================== */
body.dark .ccs-container {
    background: #1a1008;
}

body.dark .ccs-main-content {
    background: #1a1008;
}

body.dark .ccs-history-panel,
body.dark .ccs-input-panel,
body.dark .ccs-result-panel {
    background: #120b06;
    border-color: rgba(220, 120, 80, 0.2);
}

body.dark .history-panel-header,
body.dark .panel-header,
body.dark .ccs-result-header {
    background: linear-gradient(to bottom, #1e1208, #180d06);
    border-color: rgba(220, 120, 80, 0.18);
}

body.dark .history-panel-header h3,
body.dark .panel-header h3,
body.dark .ccs-result-header h3 {
    color: #e0a860;
}

body.dark .history-count {
    color: #a06030;
}

body.dark .history-clear-btn {
    background: rgba(181, 36, 28, 0.22);
    color: #e08068;
    border: none;
}

body.dark .history-clear-btn:hover {
    background: rgba(181, 36, 28, 0.38);
}

body.dark .history-search input {
    background: #1e1208;
    border-color: rgba(220, 120, 80, 0.28);
    color: #e0c090;
}

body.dark .history-search input::placeholder {
    color: #786040;
}

body.dark .history-search input:focus {
    border-color: #b5241c;
}

body.dark .history-empty {
    color: #786040;
}

body.dark .history-item {
    background: #1e1208;
    border-color: rgba(220, 120, 80, 0.18);
}

body.dark .history-item:hover {
    background: #281808;
    border-color: #b5241c;
}

body.dark .history-item.active {
    background: #281408;
    border-color: #b5241c;
}

body.dark .history-item-word {
    color: #e07860;
}

body.dark .history-item-meta {
    color: #886048;
}

body.dark .history-item-type {
    background: rgba(181, 36, 28, 0.22);
    color: #e07860;
    border-color: rgba(181, 36, 28, 0.3);
}

body.dark .char-preview-box {
    background: linear-gradient(135deg, #1e1208 0%, #180d06 100%);
    border-color: rgba(220, 120, 80, 0.28);
}

body.dark .char-preview-text {
    color: #e07860;
    text-shadow: 2px 3px 6px rgba(181, 36, 28, 0.35);
}

body.dark .ccs-input-wrap {
    border-color: rgba(220, 120, 80, 0.32);
}

body.dark .ccs-input-wrap:focus-within {
    border-color: #b5241c;
    box-shadow: 0 0 0 3px rgba(181, 36, 28, 0.18);
}

body.dark .ccs-search-input {
    background: #1e1208;
    color: #e0c090;
}

body.dark .ccs-search-input::placeholder {
    color: #786040;
}

body.dark .ccs-char-counter {
    color: #786040;
}

body.dark .ccs-mode-label,
body.dark .ccs-quick-label {
    color: #e0a860;
}

body.dark .ccs-mode-option {
    background: #1e1208;
    border-color: rgba(220, 120, 80, 0.22);
    color: #c09870;
}

body.dark .ccs-mode-option:hover {
    background: #281808;
    border-color: #b5241c;
    color: #e07860;
}

body.dark .ccs-mode-option.selected {
    background: rgba(181, 36, 28, 0.22);
    border-color: #b5241c;
    color: #e07860;
}

body.dark .ccs-quick-tag {
    background: rgba(181, 36, 28, 0.16);
    border-color: rgba(220, 120, 80, 0.28);
    color: #e07860;
}

body.dark .ccs-quick-tag:hover {
    background: #b5241c;
    color: white;
    border-color: #b5241c;
}

body.dark .ccs-tips-box {
    background: #1e1208;
    border-color: rgba(220, 120, 80, 0.18);
    color: #a08860;
}

body.dark .ccs-tips-box p {
    color: #c09060;
}

body.dark .panel-tip {
    color: #786040;
}

body.dark .placeholder-char {
    color: rgba(181, 36, 28, 0.12);
}

body.dark .placeholder-title {
    color: #786040;
}

body.dark .placeholder-desc {
    color: #584030;
}

body.dark .result-char-label {
    color: #e07860;
}

body.dark .result-mode-badge {
    background: rgba(181, 36, 28, 0.22);
    color: #e07860;
    border-color: rgba(181, 36, 28, 0.3);
}

body.dark .loading-text {
    color: #c09060;
}

body.dark .loading-tips {
    color: #786040;
}

body.dark .result-content {
    color: #e0c090;
}

body.dark .result-content .ccs-char-title {
    color: #e07860;
}

body.dark .result-content .ccs-structure-badge {
    background: rgba(181, 36, 28, 0.22);
    color: #e07860;
    border-color: rgba(181, 36, 28, 0.3);
}

body.dark .result-content .ccs-decomp {
    background: linear-gradient(135deg, #1e1208, #180d06);
    border-color: rgba(220, 120, 80, 0.22);
}

body.dark .result-content .ccs-decomp-char {
    color: #e07860;
}

body.dark .result-content .ccs-decomp-arrow {
    color: #887060;
}

body.dark .result-content .ccs-part {
    background: #281808;
    border-color: rgba(220, 120, 80, 0.18);
}

body.dark .result-content .ccs-part-char {
    color: #e08868;
}

body.dark .result-content .ccs-part-name {
    color: #786040;
}

body.dark .result-content .ccs-plus {
    color: #786040;
}

body.dark .result-content .ccs-section h4 {
    color: #e0a860;
    border-color: rgba(220, 120, 80, 0.22);
}

body.dark .result-content .ccs-section p,
body.dark .result-content .ccs-section li {
    color: #c09870;
}

body.dark .result-content .ccs-part-tag {
    background: rgba(181, 36, 28, 0.2);
    border-color: rgba(181, 36, 28, 0.3);
    color: #e07860;
}

body.dark .result-content .ccs-part-tag:hover,
body.dark .result-content .ccs-part-char:hover {
    background: #b5241c;
    color: white;
}

body.dark .result-content .ccs-char-block {
    border-color: rgba(220, 120, 80, 0.18);
}

body.dark .ccs-modal {
    background: #1e1208;
}

body.dark .ccs-modal-header {
    background: linear-gradient(to bottom, #241808, #1e1008);
    border-color: rgba(220, 120, 80, 0.18);
}

body.dark .ccs-modal-header h3 {
    color: #e0a860;
}

body.dark .ccs-modal-close {
    background: rgba(181, 36, 28, 0.22);
    color: #e07860;
}

body.dark .ccs-modal-close:hover {
    background: #b5241c;
    color: white;
}

body.dark .example-card {
    background: #1e1208;
    border-color: rgba(220, 120, 80, 0.2);
}

body.dark .example-card:hover {
    background: #281808;
    border-color: #b5241c;
}

body.dark .example-char {
    color: #e07860;
}

body.dark .example-label {
    color: #786040;
}

body.dark .example-mode-badge {
    background: rgba(181, 36, 28, 0.22);
    color: #e07860;
    border-color: rgba(181, 36, 28, 0.3);
}

body.dark .result-error .error-msg {
    color: #e07860;
}

body.dark .result-error .error-tip {
    color: #886848;
}

body.dark .ccs-search-btn {
    background: #b5241c;
}

body.dark .ccs-search-btn:hover {
    background: #9b1a14;
}

body.dark .ccs-search-btn:disabled {
    background: #5a2820;
}

/* select option 暗默模式 */
body.dark .ccs-container select option {
    background: #1e1208;
    color: #e0c090;
}

/* ==================================================
   Toast 统一提示
   ================================================== */
.ccs-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    padding: 10px 22px;
    border-radius: 22px;
    font-size: 13px;
    font-weight: 600;
    color: white;
    z-index: 200000;
    opacity: 0;
    transition: all 0.3s cubic-bezier(.34, 1.4, .64, 1);
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    max-width: 90vw;
    text-overflow: ellipsis;
    overflow: hidden;
}

.ccs-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.ccs-toast.success { background: linear-gradient(135deg, #4caf50, #388e3c); }
.ccs-toast.warn    { background: linear-gradient(135deg, #ff9800, #e65100); }
.ccs-toast.info    { background: linear-gradient(135deg, #607d8b, #455a64); }

body.dark .ccs-toast.success { background: linear-gradient(135deg, #2e7d32, #1b5e20); }
body.dark .ccs-toast.warn    { background: linear-gradient(135deg, #e65100, #bf360c); }
body.dark .ccs-toast.info    { background: linear-gradient(135deg, #37474f, #263238); }

/* ==================================================
   进度条
   ================================================== */
.ccs-progress-bar-wrap {
    height: 3px;
    background: rgba(181, 36, 28, 0.1);
    flex-shrink: 0;
    overflow: hidden;
}

.ccs-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #e8c040 0%, #f8d860 40%, #b5241c 80%, #e8c040 100%);
    background-size: 300% 100%;
    transition: width 0.35s linear;
    animation: ccsProgressShimmer 2s linear infinite;
}

@keyframes ccsProgressShimmer {
    0%   { background-position: 300% 0; }
    100% { background-position: -300% 0; }
}

body.dark .ccs-progress-bar-wrap {
    background: rgba(220, 120, 80, 0.15);
}

/* ==================================================
   错误提示区块（语义化 CSS 类）
   ================================================== */
.ccs-result-error-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 44px 30px;
    text-align: center;
}

.ccs-result-error-block .error-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.ccs-result-error-block .error-title {
    font-size: 15px;
    font-weight: 700;
    color: #b5241c;
    margin: 0 0 6px;
}

.ccs-result-error-block .error-tip {
    font-size: 13px;
    color: #a08068;
    margin: 0 0 20px;
    line-height: 1.6;
}

.ccs-retry-btn {
    padding: 8px 24px;
    background: #b5241c;
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(181, 36, 28, 0.25);
}

.ccs-retry-btn:hover {
    background: #9b1a14;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(181, 36, 28, 0.35);
}

body.dark .ccs-result-error-block .error-title {
    color: #e07860;
}

body.dark .ccs-result-error-block .error-tip {
    color: #886848;
}

body.dark .ccs-retry-btn {
    background: linear-gradient(135deg, #7b2020 0%, #4a1010 100%);
    box-shadow: 0 2px 8px rgba(100, 20, 10, 0.5);
}

body.dark .ccs-retry-btn:hover {
    background: linear-gradient(135deg, #9b2828 0%, #5a1818 100%);
    box-shadow: 0 4px 14px rgba(100, 20, 10, 0.6);
}

/* ==================================================
   移动端复制按鈕强制可见
   ================================================== */
@media (max-width: 768px) {
    #ccsCopyBtn {
        opacity: 1 !important;
    }
}

/* ==================================================
   进度条完成态（100%时切换绿色渐变 + 亮度脉冲）
   ================================================== */
.ccs-progress-bar.ccs-progress-done {
    background: linear-gradient(90deg, #4caf50 0%, #00bcd4 50%, #4caf50 100%);
    background-size: 200% 100%;
    animation: ccsProgressPulse 0.55s ease-in-out infinite;
    transition: width 0.2s linear;
}

@keyframes ccsProgressPulse {
    0%, 100% { filter: brightness(1); }
    50%       { filter: brightness(1.35); }
}

body.dark .ccs-progress-bar.ccs-progress-done {
    background: linear-gradient(90deg, #388e3c 0%, #0097a7 50%, #388e3c 100%);
}

/* ==================================================
   自定义滚动条（纤简，汉字文化主题色）
   ================================================== */
.history-list::-webkit-scrollbar,
.ccs-input-body::-webkit-scrollbar,
.ccs-result-body::-webkit-scrollbar,
.ccs-modal-body::-webkit-scrollbar {
    width: 4px;
}

.history-list::-webkit-scrollbar-track,
.ccs-input-body::-webkit-scrollbar-track,
.ccs-result-body::-webkit-scrollbar-track,
.ccs-modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.history-list::-webkit-scrollbar-thumb,
.ccs-input-body::-webkit-scrollbar-thumb,
.ccs-result-body::-webkit-scrollbar-thumb,
.ccs-modal-body::-webkit-scrollbar-thumb {
    background: rgba(181, 36, 28, 0.22);
    border-radius: 2px;
    transition: background 0.2s;
}

.history-list::-webkit-scrollbar-thumb:hover,
.ccs-input-body::-webkit-scrollbar-thumb:hover,
.ccs-result-body::-webkit-scrollbar-thumb:hover,
.ccs-modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(181, 36, 28, 0.45);
}

body.dark .history-list::-webkit-scrollbar-thumb,
body.dark .ccs-input-body::-webkit-scrollbar-thumb,
body.dark .ccs-result-body::-webkit-scrollbar-thumb,
body.dark .ccs-modal-body::-webkit-scrollbar-thumb {
    background: rgba(220, 120, 80, 0.28);
}

body.dark .history-list::-webkit-scrollbar-thumb:hover,
body.dark .ccs-input-body::-webkit-scrollbar-thumb:hover,
body.dark .ccs-result-body::-webkit-scrollbar-thumb:hover,
body.dark .ccs-modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(220, 120, 80, 0.5);
}

/* ==================================================
   加载文字呼吸闪烁动画（内存规范）
   ================================================== */
@keyframes ccsBreathText {
    0%, 100% { opacity: 0.55; }
    50%       { opacity: 1; }
}

/* ==================================================
   结果内容入场动效（每次切换结果时触发）
   ================================================== */
@keyframes ccsEnterAnim {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.result-content.ccs-enter-anim {
    animation: ccsEnterAnim 0.28s cubic-bezier(.34, 1.4, .64, 1) forwards;
}

/* ==================================================
   汉字预览弹出动画（输入时触发）
   ================================================== */
@keyframes ccsCharPop {
    0%   { transform: scale(0.82); opacity: 0.5; }
    65%  { transform: scale(1.1); }
    100% { transform: scale(1);   opacity: 1; }
}

.char-preview-text.ccs-char-pop {
    animation: ccsCharPop 0.22s cubic-bezier(.34, 1.4, .64, 1) forwards;
}
