/* =============================================
   历史上的今天工具 - this_day_in_history.css
   三栏布局：历史记录 | 查询设置 | 历史事件
   主题色：羊皮卷褐色 #8b4513 / 金棕 #c0862c / 深红 #7a1c1c
   ============================================= */

/* ========== 主容器 ========== */
.tdh-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 600px;
    background: #fdf6e9;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(139, 69, 19, 0.18);
    transition: all 0.3s ease;
    border: 1px solid #e8d5a3;
}

.tdh-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;
}

/* ========== 顶部工具栏 ========== */
.tdh-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 12px;
    min-height: 36px;
    background: linear-gradient(135deg, #6b2d0e 0%, #3d1a08 100%);
    color: #fff;
    flex-wrap: wrap;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(61, 26, 8, 0.5);
    flex-shrink: 0;
}

.tdh-toolbar .toolbar-group {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-wrap: wrap;
}

.tdh-toolbar .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: #6b2d0e;
    transition: all 0.2s;
    white-space: nowrap;
    line-height: 1.4;
}

.tdh-toolbar .toolbar-btn:hover:not(:disabled) {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
}

.tdh-toolbar .toolbar-btn:active:not(:disabled) {
    transform: translateY(0);
}

.tdh-toolbar .toolbar-btn:disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

/* 主操作按钮 */
.tdh-toolbar .toolbar-btn-primary {
    background: linear-gradient(135deg, #c0862c 0%, #8b5a0a 100%);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(139, 90, 10, 0.5);
}

.tdh-toolbar .toolbar-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #d4993a 0%, #c0862c 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(192, 134, 44, 0.55);
}

/* 生成中流光动画 */
.tdh-toolbar .toolbar-btn-primary.tdh-btn-loading {
    background: linear-gradient(90deg, #c0862c 0%, #e4b56a 35%, #c0862c 65%, #8b5a0a 100%);
    background-size: 200% 100%;
    animation: tdhBtnShimmer 1.4s ease-in-out infinite;
    cursor: not-allowed;
    box-shadow: 0 2px 10px rgba(192, 134, 44, 0.5);
}

@keyframes tdhBtnShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* 取消按钮 */
.tdh-toolbar .toolbar-btn-cancel {
    background: rgba(255, 255, 255, 0.15) !important;
    color: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
}

.tdh-toolbar .toolbar-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.28) !important;
    color: #fff !important;
}

/* 工具栏标题 */
.tdh-toolbar .toolbar-title {
    font-size: 14px;
    font-weight: 700;
    color: rgba(255, 248, 225, 0.98);
    letter-spacing: 0.5px;
}

/* ========== 主内容三栏 ========== */
.tdh-main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: #fdf6e9;
}

/* ========== 左栏：历史记录 ========== */
.tdh-history-panel {
    width: 190px;
    flex-shrink: 0;
    background: #fffdf5;
    border-right: 1px solid #e2c98a;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tdh-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: linear-gradient(to bottom, #fffaee 0%, #fdf3d0 100%);
    border-bottom: 1px solid #e2c98a;
    flex-shrink: 0;
}

.tdh-history-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #7a4010;
}

.tdh-history-count {
    font-size: 11px;
    color: #c4923a;
    font-weight: 400;
}

.tdh-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;
}

.tdh-clear-btn:hover { background: #fde8e8; }

.tdh-clear-btn:disabled {
    opacity: 0.38;
    cursor: not-allowed;
    pointer-events: none;
}

/* 清空确认态：二次点击确认 */
.tdh-clear-btn.tdh-clear-confirm {
    background: #fff0c0;
    border: 1px solid #e67e22;
    color: #c0392b;
    font-weight: 700;
    animation: tdhConfirmPulse 0.8s ease-in-out infinite alternate;
}

@keyframes tdhConfirmPulse {
    from { background: #fff0c0; }
    to   { background: #fde8d0; }
}

.tdh-history-search {
    padding: 7px;
    border-bottom: 1px solid #e2c98a;
    flex-shrink: 0;
}

.tdh-history-search input {
    width: 100%;
    padding: 5px 9px;
    border: 1px solid #d4a855;
    border-radius: 4px;
    font-size: 12px;
    outline: none;
    background: #fffef8;
    color: #4a2a0a;
    transition: all 0.2s;
    box-sizing: border-box;
}

.tdh-history-search input:focus {
    border-color: #c0862c;
    box-shadow: 0 0 0 2px rgba(192, 134, 44, 0.2);
}

.tdh-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}

.tdh-history-list::-webkit-scrollbar { width: 4px; }
.tdh-history-list::-webkit-scrollbar-track { background: transparent; }
.tdh-history-list::-webkit-scrollbar-thumb { background: #d4a855; border-radius: 2px; }
.tdh-history-list::-webkit-scrollbar-thumb:hover { background: #c0862c; }

/* 历史记录项 */
.tdh-history-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0e4c0;
    transition: background 0.15s;
    position: relative;
}

.tdh-history-item:hover { background: #fef3d0; }

.tdh-history-item.active {
    background: linear-gradient(90deg, #fde8c0 0%, #fdf3d8 100%);
    border-left: 3px solid #c0862c;
}

.tdh-history-item-date {
    font-size: 13px;
    font-weight: 700;
    color: #7a4010;
    display: block;
}

.tdh-history-item-cat {
    font-size: 11px;
    color: #a0631a;
    display: block;
    margin-top: 2px;
}

.tdh-history-item-time {
    font-size: 10px;
    color: #c4923a;
    display: block;
    margin-top: 3px;
}

.tdh-history-item-del {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #ccc;
    font-size: 13px;
    cursor: pointer;
    display: none;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 3px;
    transition: all 0.15s;
}

.tdh-history-item:hover .tdh-history-item-del { display: block; }
.tdh-history-item-del:hover { background: #fde8e8; color: #e53935; }

.tdh-history-empty {
    text-align: center;
    color: #c4923a;
    font-size: 12px;
    padding: 28px 12px;
}

/* ========== 中栏：参数配置 ========== */
.tdh-input-panel {
    width: 270px;
    flex-shrink: 0;
    background: #fff9ef;
    border-right: 1px solid #e2c98a;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tdh-panel-header {
    padding: 12px 16px 8px;
    background: linear-gradient(to bottom, #fff5dc 0%, #fff0c8 100%);
    border-bottom: 1px solid #e2c98a;
    flex-shrink: 0;
}

.tdh-panel-header h3 {
    margin: 0 0 3px;
    font-size: 14px;
    font-weight: 700;
    color: #6b2d0e;
}

.tdh-panel-tip {
    font-size: 11px;
    color: #a07030;
}

.tdh-input-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
}

.tdh-input-body::-webkit-scrollbar { width: 4px; }
.tdh-input-body::-webkit-scrollbar-track { background: transparent; }
.tdh-input-body::-webkit-scrollbar-thumb { background: #d4a855; border-radius: 2px; }
.tdh-input-body::-webkit-scrollbar-thumb:hover { background: #c0862c; }

.tdh-field-group {
    margin-bottom: 16px;
}

.tdh-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #7a4010;
    margin-bottom: 8px;
    letter-spacing: 0.3px;
}

/* 日期选择区 */
.tdh-date-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tdh-date-display {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #fdf0d0 0%, #fae8b0 100%);
    border: 2px solid #d4a855;
    border-radius: 10px;
    padding: 12px 16px;
    box-shadow: inset 0 2px 6px rgba(139, 69, 19, 0.08);
    cursor: pointer;
    transition: border-color 0.2s;
    justify-content: center;
}

.tdh-date-display:hover { border-color: #c0862c; }

.tdh-date-segment {
    display: flex;
    align-items: baseline;
    gap: 2px;
}

.tdh-date-unit {
    font-size: 13px;
    color: #a07030;
    font-weight: 500;
}

.tdh-date-sep {
    font-size: 20px;
    color: #c4a060;
    font-weight: 300;
    line-height: 1;
}

.tdh-date-month {
    font-size: 28px;
    font-weight: 700;
    color: #8b4513;
    line-height: 1;
    min-width: 32px;
    text-align: center;
}

.tdh-date-day {
    font-size: 28px;
    font-weight: 700;
    color: #8b4513;
    line-height: 1;
    min-width: 28px;
    text-align: center;
}

.tdh-date-input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #d4a855;
    border-radius: 6px;
    font-size: 13px;
    background: #fffef8;
    color: #4a2a0a;
    outline: none;
    cursor: pointer;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.tdh-date-input:focus { border-color: #c0862c; box-shadow: 0 0 0 2px rgba(192, 134, 44, 0.2); }

.tdh-date-hint {
    font-size: 11px;
    color: #b08040;
    text-align: center;
}

/* 分类选项 */
.tdh-cat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.tdh-cat-item {
    padding: 7px 8px;
    border: 1.5px solid #e2c98a;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    font-size: 12px;
    font-weight: 500;
    color: #7a4010;
    background: #fffdf5;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: center;
}

.tdh-cat-item:hover { border-color: #c0862c; background: #fef3d8; }

.tdh-cat-item.selected {
    border-color: #c0862c;
    background: linear-gradient(135deg, #fde8c0 0%, #fad498 100%);
    color: #6b2d0e;
    box-shadow: 0 2px 6px rgba(192, 134, 44, 0.25);
}

/* 数量选项 */
.tdh-count-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tdh-count-item {
    padding: 5px 12px;
    border: 1.5px solid #e2c98a;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #7a4010;
    background: #fffdf5;
    transition: all 0.2s;
}

.tdh-count-item:hover { border-color: #c0862c; background: #fef3d8; }

.tdh-count-item.selected {
    border-color: #c0862c;
    background: linear-gradient(135deg, #fde8c0 0%, #fad498 100%);
    color: #6b2d0e;
    box-shadow: 0 2px 5px rgba(192, 134, 44, 0.25);
}

/* 详细程度 */
.tdh-depth-group {
    display: flex;
    gap: 6px;
}

.tdh-depth-item {
    flex: 1;
    padding: 6px 4px;
    border: 1.5px solid #e2c98a;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    font-size: 12px;
    font-weight: 500;
    color: #7a4010;
    background: #fffdf5;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.tdh-depth-item:hover { border-color: #c0862c; background: #fef3d8; }

.tdh-depth-item.selected {
    border-color: #c0862c;
    background: linear-gradient(135deg, #fde8c0 0%, #fad498 100%);
    color: #6b2d0e;
    box-shadow: 0 2px 5px rgba(192, 134, 44, 0.25);
}

.tdh-depth-icon { font-size: 16px; }

/* 内嵌生成按钮 */
.tdh-generate-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #c0862c 0%, #8b5a0a 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s;
    letter-spacing: 0.5px;
    box-shadow: 0 3px 8px rgba(139, 90, 10, 0.4);
    margin-bottom: 14px;
}

.tdh-generate-btn:hover {
    background: linear-gradient(135deg, #d4993a 0%, #c0862c 100%);
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(192, 134, 44, 0.5);
}

.tdh-generate-btn:active { transform: translateY(0); }

.tdh-generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* 中栏生成按钮加载态流光 */
.tdh-generate-btn.tdh-btn-loading {
    background: linear-gradient(90deg, #c0862c 0%, #e4b56a 35%, #c0862c 65%, #8b5a0a 100%);
    background-size: 200% 100%;
    animation: tdhBtnShimmer 1.4s ease-in-out infinite;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: 0 3px 8px rgba(192, 134, 44, 0.4);
}

/* 使用提示 */
.tdh-tips-box {
    background: linear-gradient(135deg, #fdf0d0 0%, #fae8b0 100%);
    border: 1px solid #e2c98a;
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 12px;
}

.tdh-tips-box p {
    margin: 0 0 8px;
    font-weight: 600;
    color: #7a4010;
}

.tdh-tips-box ul {
    margin: 0;
    padding-left: 16px;
    color: #a07030;
    line-height: 1.9;
}

.tdh-tips-box ul li::marker {
    color: #C0392B;
    font-weight: 600;
}

/* ========== 右栏：历史事件结果 ========== */
.tdh-result-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
}

.tdh-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: linear-gradient(to bottom, #fffaee 0%, #fdf3d0 100%);
    border-bottom: 1px solid #e2c98a;
    flex-shrink: 0;
}

.tdh-result-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #6b2d0e;
}

.tdh-result-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tdh-result-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.tdh-regen-btn {
    padding: 3px 10px;
    background: #fff8e8;
    border: 1px solid #d4a855;
    border-radius: 4px;
    color: #7a4010;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.tdh-regen-btn:hover { background: #fde8c0; border-color: #c0862c; }

.tdh-result-count-badge {
    background: linear-gradient(135deg, #c0862c, #8b5a0a);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}

.tdh-result-date {
    font-size: 12px;
    color: #7a4010;
    font-weight: 600;
    background: #fdf0d0;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #d4a855;
}

.tdh-result-cat-badge {
    font-size: 11px;
    color: #8b4513;
    background: #fde8c0;
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid #d4a855;
}

/* 结果滚动区域 */
.tdh-result-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.tdh-result-body::-webkit-scrollbar { width: 6px; }
.tdh-result-body::-webkit-scrollbar-track { background: #fffdf5; }
.tdh-result-body::-webkit-scrollbar-thumb { background: #d4a855; border-radius: 3px; }
.tdh-result-body::-webkit-scrollbar-thumb:hover { background: #c0862c; }

/* 占位符 */
.tdh-result-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: #c4923a;
    text-align: center;
    padding: 30px;
}

.tdh-placeholder-icon {
    font-size: 52px;
    margin-bottom: 14px;
    opacity: 0.7;
    filter: sepia(30%);
    animation: tdhFloat 3s ease-in-out infinite;
}

@keyframes tdhFloat {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-8px); }
}

.tdh-placeholder-title {
    font-size: 16px;
    font-weight: 600;
    color: #8b5a0a;
    margin: 0 0 8px;
}

.tdh-placeholder-desc {
    font-size: 13px;
    color: #b08040;
    margin: 4px 0;
}

.tdh-placeholder-shortcut {
    font-size: 12px;
    color: #c4923a;
    margin-top: 12px;
}

.tdh-placeholder-shortcut kbd {
    background: #f5e8c0;
    border: 1px solid #d4a855;
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 11px;
    color: #7a4010;
}

/* 加载中 */
.tdh-result-loading {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    text-align: center;
    padding: 30px;
}

.tdh-loading-icon {
    font-size: 52px;
    margin-bottom: 14px;
    animation: tdhScrollBounce 1.6s ease-in-out infinite;
}

@keyframes tdhScrollBounce {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25%       { transform: translateY(-8px) rotate(-5deg); }
    75%       { transform: translateY(-4px) rotate(5deg); }
}

.tdh-loading-dots {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.tdh-loading-dots span {
    width: 8px;
    height: 8px;
    background: #c0862c;
    border-radius: 50%;
    animation: tdhDotPulse 1.2s ease-in-out infinite;
}

.tdh-loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.tdh-loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes tdhDotPulse {
    0%, 100% { transform: scale(0.6); opacity: 0.5; }
    50%       { transform: scale(1.1); opacity: 1; }
}

.tdh-loading-text {
    font-size: 14px;
    color: #8b5a0a;
    margin: 0;
}

/* 错误提示 */
.tdh-result-error {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    flex-direction: column;
    gap: 12px;
    padding: 30px;
    text-align: center;
}

.tdh-error-icon { font-size: 40px; }
.tdh-error-msg  { font-size: 14px; color: #c0392b; }

.error-retry-btn {
    padding: 7px 20px;
    background: linear-gradient(135deg, #c0862c 0%, #8b5a0a 100%);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.error-retry-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(192, 134, 44, 0.4);
}

/* ========== 结果内容：历史事件卡片 ========== */
.tdh-result-content {
    padding: 20px;
    border-left: 3px solid #e67e22;
}

.tdh-event-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
}

/* 时间轴竖线 */
.tdh-event-list::before {
    content: '';
    position: absolute;
    left: 52px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, #d4a855, #e2c98a, #d4a855);
    border-radius: 1px;
}

.tdh-event-card {
    display: flex;
    gap: 0;
    padding: 0 0 24px;
    position: relative;
    animation: tdhCardIn 0.4s ease both;
}

/* 交错入场动画 */
@keyframes tdhCardIn {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

.tdh-event-card:nth-child(1)  { animation-delay: 0ms; }
.tdh-event-card:nth-child(2)  { animation-delay: 50ms; }
.tdh-event-card:nth-child(3)  { animation-delay: 100ms; }
.tdh-event-card:nth-child(4)  { animation-delay: 150ms; }
.tdh-event-card:nth-child(5)  { animation-delay: 200ms; }
.tdh-event-card:nth-child(6)  { animation-delay: 250ms; }
.tdh-event-card:nth-child(7)  { animation-delay: 300ms; }
.tdh-event-card:nth-child(8)  { animation-delay: 350ms; }
.tdh-event-card:nth-child(9)  { animation-delay: 400ms; }
.tdh-event-card:nth-child(10) { animation-delay: 450ms; }
.tdh-event-card:nth-child(11) { animation-delay: 500ms; }
.tdh-event-card:nth-child(12) { animation-delay: 550ms; }

/* 年份左侧区域 */
.tdh-event-meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 106px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

/* 时间轴圆点 */
.tdh-event-meta::after {
    content: '';
    position: absolute;
    right: 0;
    top: 8px;
    width: 10px;
    height: 10px;
    background: #c0862c;
    border: 2px solid #fdf6e9;
    border-radius: 50%;
    box-shadow: 0 0 0 2px #d4a855;
    transform: translateX(50%);
}

.tdh-event-year {
    background: linear-gradient(135deg, #6b2d0e 0%, #3d1a08 100%);
    color: #fde8c0;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 10px;
    white-space: nowrap;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 4px rgba(61, 26, 8, 0.35);
    margin-top: 4px;
}

.tdh-event-cat-badge {
    background: #fde8c0;
    color: #8b4513;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 8px;
    margin-top: 5px;
    border: 1px solid #d4a855;
    white-space: nowrap;
}

/* 事件正文区域 */
.tdh-event-content {
    flex: 1;
    background: #fffdf5;
    border: 1px solid #e2c98a;
    border-radius: 8px;
    padding: 12px 14px;
    margin-left: 14px;
    position: relative;
    box-shadow: 0 2px 6px rgba(139, 69, 19, 0.06);
    transition: all 0.2s;
}

.tdh-event-content:hover {
    border-color: #c0862c;
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.12);
    transform: translateX(2px);
}

/* 气泡小箭头 */
.tdh-event-content::before {
    content: '';
    position: absolute;
    left: -7px;
    top: 14px;
    border: 7px solid transparent;
    border-right-color: #e2c98a;
    border-left: none;
}

.tdh-event-content::after {
    content: '';
    position: absolute;
    left: -5px;
    top: 15px;
    border: 6px solid transparent;
    border-right-color: #fffdf5;
    border-left: none;
}

.tdh-event-title {
    font-size: 14px;
    font-weight: 700;
    color: #3d1a08;
    margin-bottom: 6px;
    line-height: 1.4;
    border-left: 3px solid #e67e22;
    padding-left: 8px;
}

.tdh-event-body {
    font-size: 13px;
    color: #5a3010;
    line-height: 1.75;
}

.tdh-event-body a {
    color: #8b1a1a;
    text-decoration: underline;
    text-decoration-color: #8b1a1a;
}

.tdh-event-body a:hover {
    color: #5a0f0f;
    text-decoration-color: #5a0f0f;
}

.tdh-event-body strong { color: #8b1a1a; }

.tdh-event-body ul li::marker {
    color: #C0392B;
    font-weight: 600;
}

/* ========== Toast 通知 ========== */
.tdh-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(61, 26, 8, 0.9);
    color: #fde8c0;
    padding: 9px 22px;
    border-radius: 22px;
    font-size: 13px;
    z-index: 99999;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s;
    white-space: nowrap;
}

.tdh-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ========== 示例导入模态框 ========== */
.tdh-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 10000;
    display: none;
    backdrop-filter: blur(2px);
}

.tdh-modal-overlay.show { display: block; }

.tdh-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: min(580px, 92vw);
    background: #fffdf5;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(61, 26, 8, 0.4);
    z-index: 10001;
    display: none;
    flex-direction: column;
    max-height: 80vh;
    overflow: hidden;
    border: 2px solid #d4a855;
    transition: all 0.25s;
}

.tdh-modal.show {
    display: flex;
    transform: translate(-50%, -50%) scale(1);
}

.tdh-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: linear-gradient(135deg, #6b2d0e 0%, #3d1a08 100%);
    border-radius: 10px 10px 0 0;
}

.tdh-modal-header h3 { margin: 0; font-size: 15px; color: #fde8c0; }

.tdh-modal-close {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fde8c0;
    font-size: 15px;
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.tdh-modal-close:hover { background: rgba(255,255,255,0.3); }

.tdh-modal-body {
    overflow-y: auto;
    padding: 16px;
}

.tdh-modal-body::-webkit-scrollbar { width: 4px; }
.tdh-modal-body::-webkit-scrollbar-thumb { background: #d4a855; border-radius: 2px; }

.tdh-example-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.tdh-example-item {
    background: linear-gradient(135deg, #fff9ef 0%, #fdf0d0 100%);
    border: 1.5px solid #e2c98a;
    border-radius: 8px;
    padding: 12px 14px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.tdh-example-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(to bottom, #c0862c, #8b5a0a);
    border-radius: 3px 0 0 3px;
}

.tdh-example-item:hover {
    border-color: #c0862c;
    box-shadow: 0 4px 12px rgba(192, 134, 44, 0.25);
    transform: translateY(-2px);
}

.tdh-example-desc {
    font-size: 12px;
    font-weight: 700;
    color: #6b2d0e;
    margin-bottom: 6px;
}

.tdh-example-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.tdh-example-tag {
    font-size: 10px;
    padding: 1px 6px;
    background: #fde8c0;
    border-radius: 8px;
    color: #8b4513;
    border: 1px solid #d4a855;
}

/* ========== 思考气泡 (AI等待动画) ========== */
.tdh-thinking-bubble {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: linear-gradient(135deg, #fff8e8 0%, #fdf0d0 100%);
    border: 1px solid #d4a855;
    border-radius: 18px;
    font-size: 13px;
    color: #8b5a0a;
    margin: 12px auto 0;
    width: fit-content;
    box-shadow: 0 2px 8px rgba(192, 134, 44, 0.15);
    animation: tdhBubbleIn 0.3s ease;
}

@keyframes tdhBubbleIn {
    from { opacity: 0; transform: scale(0.8); }
    to   { opacity: 1; transform: scale(1); }
}

.tdh-thinking-bubble .bubble-dot {
    width: 6px;
    height: 6px;
    background: #c0862c;
    border-radius: 50%;
    animation: tdhDotPulse 1.2s ease-in-out infinite;
}

.tdh-thinking-bubble .bubble-dot:nth-child(2) { animation-delay: 0.2s; }
.tdh-thinking-bubble .bubble-dot:nth-child(3) { animation-delay: 0.4s; }

/* ========== 暗黑模式 ========== */
body.dark .tdh-container {
    background: #1a1008;
    border-color: #4a3010;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

body.dark .tdh-main-content { background: #1a1008; }

/* 工具栏暗色（保持原色，仅微调） */
body.dark .tdh-toolbar {
    background: linear-gradient(135deg, #4a1e06 0%, #2a0f02 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

/* 历史面板暗色 */
body.dark .tdh-history-panel {
    background: #1f1006;
    border-right-color: #4a3010;
}

body.dark .tdh-history-header {
    background: linear-gradient(to bottom, #231208 0%, #1f1006 100%);
    border-bottom-color: #4a3010;
}

body.dark .tdh-history-header h3 { color: #e8b870; }
body.dark .tdh-history-count { color: #c4923a; }

body.dark .tdh-clear-btn {
    background: #2a1508;
    color: #e07070;
}
body.dark .tdh-clear-btn:hover { background: #3d1010; }
body.dark .tdh-clear-btn.tdh-clear-confirm {
    background: #3d2808;
    border-color: #e67e22;
    color: #ffaa60;
}

body.dark .tdh-history-search { border-bottom-color: #4a3010; }
body.dark .tdh-history-search input {
    background: #2a1508;
    border-color: #6a4020;
    color: #e8d0a8;
}

body.dark .tdh-history-search input:focus { border-color: #c0862c; }
body.dark .tdh-history-search input::placeholder { color: #8a6040; }

body.dark .tdh-history-list::-webkit-scrollbar-thumb { background: #6a4020; }
body.dark .tdh-history-list::-webkit-scrollbar-thumb:hover { background: #c0862c; }

body.dark .tdh-history-item { border-bottom-color: #3a2010; }
body.dark .tdh-history-item:hover { background: #2a1508; }
body.dark .tdh-history-item.active {
    background: linear-gradient(90deg, #3a1e08 0%, #2a1508 100%);
    border-left-color: #c0862c;
}

body.dark .tdh-history-item-date { color: #e8b870; }
body.dark .tdh-history-item-cat  { color: #c4923a; }
body.dark .tdh-history-item-time { color: #8a6040; }
body.dark .tdh-history-empty { color: #8a6040; }

/* 配置面板暗色 */
body.dark .tdh-input-panel {
    background: #1f1006;
    border-right-color: #4a3010;
}

body.dark .tdh-panel-header {
    background: linear-gradient(to bottom, #231208 0%, #1f1006 100%);
    border-bottom-color: #4a3010;
}

body.dark .tdh-panel-header h3 { color: #e8b870; }
body.dark .tdh-panel-tip { color: #a07030; }

body.dark .tdh-label { color: #e8b870; }

body.dark .tdh-date-display {
    background: linear-gradient(135deg, #2a1508 0%, #1f1006 100%);
    border-color: #6a4020;
}

body.dark .tdh-date-month,
body.dark .tdh-date-day { color: #e8b870; }

body.dark .tdh-date-unit { color: #a07030; }
body.dark .tdh-date-sep  { color: #7a5030; }

body.dark .tdh-date-input {
    background: #2a1508;
    border-color: #6a4020;
    color: #e8d0a8;
    color-scheme: dark;
}

body.dark .tdh-date-hint { color: #a07030; }

body.dark .tdh-cat-item {
    background: #2a1508;
    border-color: #5a3018;
    color: #e8b870;
}

body.dark .tdh-cat-item:hover { background: #3a1e08; border-color: #c0862c; }

body.dark .tdh-cat-item.selected {
    background: linear-gradient(135deg, #3d1e08 0%, #2a1508 100%);
    color: #fde8c0;
    border-color: #c0862c;
}

body.dark .tdh-count-item {
    background: #2a1508;
    border-color: #5a3018;
    color: #e8b870;
}

body.dark .tdh-count-item:hover { background: #3a1e08; border-color: #c0862c; }
body.dark .tdh-count-item.selected {
    background: linear-gradient(135deg, #3d1e08 0%, #2a1508 100%);
    color: #fde8c0;
    border-color: #c0862c;
}

body.dark .tdh-depth-item {
    background: #2a1508;
    border-color: #5a3018;
    color: #e8b870;
}

body.dark .tdh-depth-item:hover { background: #3a1e08; border-color: #c0862c; }
body.dark .tdh-depth-item.selected {
    background: linear-gradient(135deg, #3d1e08 0%, #2a1508 100%);
    color: #fde8c0;
    border-color: #c0862c;
}

body.dark .tdh-tips-box {
    background: linear-gradient(135deg, #2a1508 0%, #1f1006 100%);
    border-color: #5a3018;
}

body.dark .tdh-tips-box p { color: #e8b870; }
body.dark .tdh-tips-box ul { color: #a07030; }

body.dark .tdh-input-body::-webkit-scrollbar-thumb { background: #6a4020; }
body.dark .tdh-input-body::-webkit-scrollbar-thumb:hover { background: #c0862c; }

/* 结果面板暗色 */
body.dark .tdh-result-panel { background: #1a1008; }

body.dark .tdh-result-header {
    background: linear-gradient(to bottom, #231208 0%, #1f1006 100%);
    border-bottom-color: #4a3010;
}

body.dark .tdh-result-header h3 { color: #e8b870; }

body.dark .tdh-regen-btn {
    background: #2a1508;
    border-color: #6a4020;
    color: #e8b870;
}

body.dark .tdh-regen-btn:hover { background: #3a1e08; border-color: #c0862c; }

body.dark .tdh-result-body { background: #1a1008; }
body.dark .tdh-result-body::-webkit-scrollbar-track { background: #1a1008; }
body.dark .tdh-result-body::-webkit-scrollbar-thumb { background: #6a4020; }
body.dark .tdh-result-body::-webkit-scrollbar-thumb:hover { background: #c0862c; }

body.dark .tdh-result-placeholder { color: #8a6040; }
body.dark .tdh-placeholder-title { color: #c4923a; }
body.dark .tdh-placeholder-desc { color: #8a6040; }
body.dark .tdh-placeholder-shortcut { color: #8a6040; }
body.dark .tdh-placeholder-shortcut kbd {
    background: #2a1508;
    border-color: #6a4020;
    color: #e8b870;
}

body.dark .tdh-loading-text { color: #c4923a; }

body.dark .tdh-result-content { background: #1a1008; border-left-color: #c05a10; }

/* 事件卡片暗色 */
body.dark .tdh-event-list::before {
    background: linear-gradient(to bottom, #6a4020, #4a3010, #6a4020);
}

body.dark .tdh-event-meta::after {
    background: #c0862c;
    border-color: #1a1008;
    box-shadow: 0 0 0 2px #6a4020;
}

body.dark .tdh-event-content {
    background: #221408;
    border-color: #5a3018;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

body.dark .tdh-event-content:hover {
    border-color: #c0862c;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

body.dark .tdh-event-content::before { border-right-color: #5a3018; }
body.dark .tdh-event-content::after  { border-right-color: #221408; }

body.dark .tdh-event-title { color: #fde8c0; }
body.dark .tdh-event-body  { color: #d4b07a; }

body.dark .tdh-event-body a {
    color: #f1948a;
    text-decoration-color: #f1948a;
}

body.dark .tdh-event-body a:hover {
    color: #e07070;
    text-decoration-color: #e07070;
}

body.dark .tdh-event-body strong { color: #f1948a; }

/* Toast 暗色 */
body.dark .tdh-toast {
    background: rgba(250, 230, 180, 0.95);
    color: #3d1a08;
}

/* 模态框暗色 */
body.dark .tdh-modal {
    background: #221408;
    border-color: #6a4020;
}

body.dark .tdh-modal-body { background: #221408; }

body.dark .tdh-example-item {
    background: linear-gradient(135deg, #2a1508 0%, #1f1006 100%);
    border-color: #5a3018;
}

body.dark .tdh-example-item:hover { border-color: #c0862c; }
body.dark .tdh-example-desc { color: #e8b870; }
body.dark .tdh-example-tag {
    background: #3d1e08;
    color: #c4923a;
    border-color: #6a4020;
}

body.dark .tdh-modal-body::-webkit-scrollbar-thumb { background: #6a4020; }
body.dark .tdh-modal-body::-webkit-scrollbar-thumb:hover { background: #c0862c; }

/* 暗黑模式工具栏按鈕颜色适配 */
body.dark .tdh-toolbar .toolbar-btn { color: #6b2d0e; }

/* 暗黑模式思考气泡 */
body.dark .tdh-thinking-bubble {
    background: linear-gradient(135deg, #2a1508 0%, #1f1006 100%);
    border-color: #6a4020;
    color: #e8b870;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
body.dark .tdh-thinking-bubble .bubble-dot { background: #c0862c; }

/* ========== 打印样式 ========== */
@media print {
    #tdhResultPlaceholder,
    #tdhResultLoading,
    #tdhResultError { display: none !important; }

    .tdh-toolbar,
    .tdh-history-panel,
    .tdh-input-panel { display: none !important; }

    .tdh-container { height: auto !important; box-shadow: none !important; }
    .tdh-main-content { display: block !important; }
    .tdh-result-panel { width: 100% !important; }
    .tdh-result-body { overflow: visible !important; }
}

/* ========== 响应式 ========== */
@media (max-width: 900px) {
    .tdh-history-panel { width: 160px; }
    .tdh-input-panel { width: 230px; }
}

@media (max-width: 680px) {
    .tdh-main-content { flex-direction: column; overflow-y: auto; }
    .tdh-history-panel { width: 100%; height: 140px; border-right: none; border-bottom: 1px solid #e2c98a; }
    .tdh-history-list { display: flex; flex-direction: row; overflow-x: auto; overflow-y: hidden; }
    .tdh-history-item { min-width: 120px; border-bottom: none; border-right: 1px solid #f0e4c0; }
    .tdh-input-panel { width: 100%; border-right: none; border-bottom: 1px solid #e2c98a; max-height: 320px; }
    .tdh-result-panel { min-height: 300px; }
    .tdh-event-list::before { left: 40px; }
    .tdh-event-meta { width: 82px; }
    .tdh-example-grid { grid-template-columns: 1fr; }
}
