/* =============================================
   周公解梦 - zhou_gong_dream_interpretation.css
   三栏布局：历史 | 输入 | 结果
   主题：深邃夜空 / 月夜神秘
   ============================================= */

/* ========== CSS 变量 ========== */
:root {
    --zgd-purple-dark:   #3b0764;
    --zgd-purple:        #6d28d9;
    --zgd-purple-light:  #8b5cf6;
    --zgd-indigo:        #4338ca;
    --zgd-gold:          #d97706;
    --zgd-gold-light:    #fbbf24;
    --zgd-bg:            #faf5ff;
    --zgd-bg-panel:      #ffffff;
    --zgd-border:        #e9d5ff;
    --zgd-text:          #3b0764;
    --zgd-text-sub:      #7c3aed;
    --zgd-text-muted:    #a78bfa;
    --zgd-shadow:        rgba(109, 40, 217, 0.18);
}

/* ========== 主容器 ========== */
.zgd-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 600px;
    background: var(--zgd-bg);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 12px var(--zgd-shadow);
    transition: all 0.3s ease;
    position: relative;
}

/* 全屏模式 */
.zgd-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;
}

/* ========== 顶部工具栏 ========== */
.zgd-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    min-height: 38px;
    background: linear-gradient(135deg, #3b0764 0%, #6d28d9 60%, #4338ca 100%);
    color: #fff;
    flex-wrap: wrap;
    gap: 6px;
    box-shadow: 0 2px 10px rgba(59, 7, 100, 0.45);
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

/* 星空粒子装饰 */
.zgd-toolbar::before {
    content: '✦ ✧ ✦ ✧ ✦ ✧';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 9px;
    color: rgba(255, 255, 255, 0.2);
    letter-spacing: 4px;
    pointer-events: none;
}

.zgd-toolbar .toolbar-group {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.zgd-toolbar .toolbar-btn {
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.88);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #6d28d9;
    transition: all 0.2s;
    white-space: nowrap;
    line-height: 1.4;
}

.zgd-toolbar .toolbar-btn:hover:not(:disabled) {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

.zgd-toolbar .toolbar-btn:active:not(:disabled) {
    transform: translateY(0);
}

.zgd-toolbar .toolbar-btn:disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

/* 主操作按钮（解梦） */
.zgd-toolbar .toolbar-btn-primary {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.5);
}

.zgd-toolbar .toolbar-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.6);
}

/* 解梦按钮 loading 流光动画 */
.zgd-toolbar .toolbar-btn-primary.zgd-btn-loading {
    background: linear-gradient(90deg, #d97706 0%, #fbbf24 35%, #d97706 65%, #b45309 100%);
    background-size: 200% 100%;
    animation: zgdBtnShimmer 1.4s ease-in-out infinite;
    cursor: not-allowed;
}

@keyframes zgdBtnShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.zgd-toolbar .toolbar-title {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    letter-spacing: 0.5px;
    margin-right: 4px;
}

/* ========== 主内容：三栏 ========== */
.zgd-main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: var(--zgd-bg);
}

/* ========== 左栏：历史记录 ========== */
.zgd-history-panel {
    width: 200px;
    flex-shrink: 0;
    background: var(--zgd-bg-panel);
    border-right: 1px solid var(--zgd-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.history-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: linear-gradient(to bottom, #faf5ff 0%, #f3e8ff 100%);
    border-bottom: 1px solid var(--zgd-border);
    flex-shrink: 0;
}

.history-panel-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--zgd-text);
}

.history-count {
    font-size: 11px;
    color: var(--zgd-text-muted);
    font-weight: 400;
}

.history-clear-btn {
    background: #fdf4ff;
    border: none;
    color: #7c3aed;
    font-size: 11px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    transition: background 0.2s;
    white-space: nowrap;
}

.history-clear-btn:hover { background: #ede9fe; }

.history-search {
    padding: 7px;
    border-bottom: 1px solid var(--zgd-border);
    flex-shrink: 0;
}

.history-search input {
    width: 100%;
    padding: 5px 9px;
    border: 1px solid #ddd6fe;
    border-radius: 4px;
    font-size: 12px;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
    color: var(--zgd-text);
    background: #faf5ff;
}

.history-search input:focus {
    border-color: var(--zgd-purple-light);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.15);
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 5px;
}

.history-list::-webkit-scrollbar { width: 4px; }
.history-list::-webkit-scrollbar-track { background: transparent; }
.history-list::-webkit-scrollbar-thumb { background: #ddd6fe; border-radius: 2px; }
.history-list::-webkit-scrollbar-thumb:hover { background: var(--zgd-purple-light); }

.history-item {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.18s;
    margin-bottom: 3px;
    border: 1px solid transparent;
}

.history-item-main { flex: 1; min-width: 0; }

.history-item:hover {
    background: #f5f3ff;
    border-color: #ddd6fe;
}

.history-item.active {
    background: #ede9fe;
    border-color: #c4b5fd;
    box-shadow: inset 3px 0 0 #3b82f6;
}

.history-item-title {
    font-size: 13px;
    font-weight: 600;
    color: #5b21b6;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-preview {
    font-size: 11px;
    color: #9ca3af;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-meta {
    font-size: 10px;
    color: var(--zgd-text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 3px;
}

.history-item-mode {
    background: #ede9fe;
    color: #7c3aed;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 10px;
}

.history-item-del {
    background: none;
    border: none;
    color: #c4b5fd;
    font-size: 11px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    transition: all 0.15s;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 1px;
    opacity: 0;
}

.history-item:hover .history-item-del { opacity: 1; }
.history-item:hover .history-item-del:hover {
    color: #7c3aed;
    background: #ede9fe;
}

.history-empty {
    text-align: center;
    color: #c4b5fd;
    font-size: 12px;
    padding: 24px 8px;
    line-height: 1.8;
}

/* ========== 中栏：梦境输入 ========== */
.zgd-input-panel {
    width: 300px;
    flex-shrink: 0;
    background: var(--zgd-bg-panel);
    border-right: 1px solid var(--zgd-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    padding: 12px 14px;
    background: linear-gradient(to bottom, #faf5ff 0%, #f3e8ff 100%);
    border-bottom: 1px solid var(--zgd-border);
    flex-shrink: 0;
}

.panel-header h3 {
    margin: 0 0 3px 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--zgd-text);
}

.panel-tip {
    font-size: 11px;
    color: var(--zgd-text-muted);
}

.zgd-input-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
}

.zgd-input-body::-webkit-scrollbar { width: 4px; }
.zgd-input-body::-webkit-scrollbar-track { background: transparent; }
.zgd-input-body::-webkit-scrollbar-thumb { background: #ddd6fe; border-radius: 2px; }
.zgd-input-body::-webkit-scrollbar-thumb:hover { background: var(--zgd-purple-light); }

/* 梦境输入框 */
.zgd-dream-box {
    margin-bottom: 6px;
    position: relative;
}

.zgd-dream-textarea {
    width: 100%;
    padding: 12px;
    border: 1.5px solid #ddd6fe;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.7;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: all 0.25s;
    box-sizing: border-box;
    background: #faf5ff;
    color: #3b0764;
    min-height: 130px;
}

.zgd-dream-textarea::placeholder {
    color: #c4b5fd;
    line-height: 1.6;
}

.zgd-dream-textarea:focus {
    border-color: var(--zgd-purple-light);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.12);
}

/* 输入框 shake 动画（内容为空时触发） */
@keyframes zgdShake {
    0%, 100% { transform: translateX(0); }
    15%       { transform: translateX(-6px); }
    30%       { transform: translateX(5px); }
    45%       { transform: translateX(-4px); }
    60%       { transform: translateX(3px); }
    75%       { transform: translateX(-2px); }
}

.zgd-dream-textarea.shake {
    animation: zgdShake 0.45s ease;
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

/* 中栏嵌入式解梦按钮 */
.zgd-inline-interpret-btn {
    display: block;
    width: 100%;
    padding: 9px 12px;
    margin-top: 4px;
    margin-bottom: 14px;
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    transition: all 0.22s;
    text-align: center;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.4);
}

.zgd-inline-interpret-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(217, 119, 6, 0.5);
}

.zgd-inline-interpret-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(217, 119, 6, 0.3);
}

.zgd-inline-interpret-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* 中栏示例弹窗加载占位 */
.example-loading {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    width: 100%;
}

/* 字数统计 */
.zgd-char-counter {
    text-align: right;
    font-size: 11px;
    color: var(--zgd-text-muted);
    margin-bottom: 12px;
}

.zgd-char-counter.warning { color: #d97706; }
.zgd-char-counter.limit   { color: #dc2626; font-weight: 600; }

/* 解析深度选项 */
.zgd-mode-group {
    margin-bottom: 10px;
}

.zgd-mode-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #5b21b6;
    margin-bottom: 7px;
}

.zgd-mode-options {
    display: flex;
    gap: 8px;
}

.zgd-mode-option {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 7px 10px;
    border: 1.5px solid #ddd6fe;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #6d28d9;
    background: #faf5ff;
    transition: all 0.2s;
    user-select: none;
}

.zgd-mode-option:hover { border-color: var(--zgd-purple-light); background: #f5f3ff; }

.zgd-mode-option.selected {
    border-color: var(--zgd-purple);
    background: linear-gradient(135deg, #ede9fe 0%, #f3e8ff 100%);
    color: #5b21b6;
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(109, 40, 217, 0.18);
}

.zgd-mode-icon { font-size: 14px; }

/* 模式切换提示 */
.zgd-mode-hint {
    display: block;
    font-size: 11px;
    color: #7c3aed;
    background: #f5f3ff;
    padding: 4px 8px;
    border-radius: 4px;
    margin-bottom: 10px;
    opacity: 0;
    transition: opacity 0.3s;
    min-height: 22px;
}

.zgd-mode-hint.visible { opacity: 1; }

/* 快捷梦境标签 */
.zgd-quick-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #5b21b6;
    margin-bottom: 7px;
}

.zgd-quick-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.zgd-quick-tag {
    padding: 4px 9px;
    background: #f3e8ff;
    border: 1px solid #ddd6fe;
    border-radius: 12px;
    font-size: 11px;
    color: #6d28d9;
    cursor: pointer;
    transition: all 0.18s;
    white-space: nowrap;
}

.zgd-quick-tag:hover {
    background: #ede9fe;
    border-color: #c4b5fd;
    transform: translateY(-1px);
}

/* 使用提示框 */
.zgd-tips-box {
    padding: 12px;
    background: linear-gradient(135deg, #f5f3ff 0%, #faf5ff 100%);
    border-radius: 8px;
    border: 1px solid #ede9fe;
    font-size: 12px;
    color: #6d28d9;
    line-height: 1.65;
}

.zgd-tips-box p {
    margin: 0 0 7px 0;
    font-weight: 600;
    color: #5b21b6;
}

.zgd-tips-box ul {
    margin: 0;
    padding-left: 16px;
}

.zgd-tips-box li { margin-bottom: 3px; }

/* ========== 右栏：解析结果 ========== */
.zgd-result-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--zgd-bg-panel);
    overflow: hidden;
    min-width: 300px;
}

.zgd-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(to bottom, #faf5ff 0%, #f3e8ff 100%);
    border-bottom: 1px solid var(--zgd-border);
    flex-shrink: 0;
}

.zgd-result-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--zgd-text);
}

.result-meta-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-mode-badge {
    font-size: 11px;
    color: #7c3aed;
    background: #ede9fe;
    padding: 2px 8px;
    border-radius: 8px;
    font-weight: 500;
}

.zgd-result-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #faf5ff;
    display: flex;
    flex-direction: column;
}

.zgd-result-body::-webkit-scrollbar { width: 5px; }
.zgd-result-body::-webkit-scrollbar-track { background: transparent; }
.zgd-result-body::-webkit-scrollbar-thumb { background: #ddd6fe; border-radius: 3px; }
.zgd-result-body::-webkit-scrollbar-thumb:hover { background: var(--zgd-purple-light); }

/* 占位提示 */
.result-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 280px;
    text-align: center;
    padding: 40px 20px;
}

.placeholder-moon {
    font-size: 60px;
    margin-bottom: 12px;
    animation: moonFloat 4s ease-in-out infinite;
}

@keyframes moonFloat {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-8px); }
}

.placeholder-stars {
    font-size: 14px;
    color: #c4b5fd;
    letter-spacing: 6px;
    margin-bottom: 16px;
    animation: starTwinkle 3s ease-in-out infinite;
}

@keyframes starTwinkle {
    0%, 100% { opacity: 0.5; }
    50%       { opacity: 1; }
}

.placeholder-title {
    font-size: 18px;
    font-weight: 700;
    color: #5b21b6;
    margin: 0 0 10px 0;
}

.placeholder-desc {
    font-size: 13px;
    color: #a78bfa;
    margin: 0 0 5px 0;
    line-height: 1.6;
}

.placeholder-verse {
    margin-top: 18px;
    font-size: 12px;
    color: #c4b5fd;
    font-style: italic;
    border-top: 1px solid #ede9fe;
    padding-top: 14px;
}

/* 加载状态 */
.result-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 280px;
    padding: 40px 20px;
}

.loading-moon {
    font-size: 48px;
    margin-bottom: 16px;
    animation: moonSpin 3s ease-in-out infinite;
}

@keyframes moonSpin {
    0%, 100% { transform: rotate(-10deg) scale(1); }
    50%       { transform: rotate(10deg) scale(1.1); }
}

.loading-dots {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--zgd-purple-light);
    animation: dotBounce 1.2s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotBounce {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
    40%           { transform: scale(1.1); opacity: 1; }
}

.loading-text {
    font-size: 14px;
    color: #7c3aed;
    margin: 0;
    font-weight: 500;
    transition: opacity 0.2s ease;
}

/* 结果内容淡入动画 */
@keyframes resultFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.hfi-result-enter {
    animation: resultFadeIn 0.35s ease-out forwards;
}

/* 结果内容样式（AI生成的HTML） */
.result-content {
    line-height: 1.75;
    color: #3b0764;
}

.result-content .dream-result {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(109, 40, 217, 0.1);
    border: 1px solid #ede9fe;
}

.result-content .dream-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 17px;
    font-weight: 700;
    color: #5b21b6;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #ede9fe;
}

.result-content .dream-icon { font-size: 22px; }

.result-content .dream-section {
    margin-bottom: 16px;
}

.result-content .dream-section h4 {
    font-size: 14px;
    font-weight: 700;
    color: #6d28d9;
    margin: 0 0 8px 0;
    padding: 6px 10px;
    background: linear-gradient(135deg, #f5f3ff 0%, #faf5ff 100%);
    border-left: 3px solid #8b5cf6;
    border-radius: 0 6px 6px 0;
}

.result-content .dream-symbols {
    margin: 0;
    padding-left: 18px;
    list-style: none;
}

.result-content .dream-symbols li {
    padding: 6px 0;
    border-bottom: 1px solid #f3e8ff;
    font-size: 13px;
    color: #4c1d95;
    position: relative;
}

.result-content .dream-symbols li::before {
    content: '✦';
    position: absolute;
    left: -16px;
    color: var(--zgd-gold-light);
    font-size: 11px;
}

.result-content .dream-symbols li:last-child { border-bottom: none; }

.result-content .dream-omen {
    padding: 12px 14px;
    background: linear-gradient(135deg, #faf5ff 0%, #f5f3ff 100%);
    border-radius: 8px;
    font-size: 13px;
    color: #4c1d95;
    border: 1px solid #ede9fe;
    line-height: 1.8;
}

.result-content .dream-advice {
    margin: 0;
    padding-left: 18px;
    list-style: none;
}

.result-content .dream-advice li {
    padding: 5px 0;
    font-size: 13px;
    color: #4c1d95;
    position: relative;
}

.result-content .dream-advice li::before {
    content: '💫';
    position: absolute;
    left: -18px;
    font-size: 11px;
}

.result-content p { font-size: 13px; color: #4c1d95; margin: 6px 0; }

.result-content ul {
    padding-left: 20px;
    margin: 6px 0;
}

.result-content ul li {
    font-size: 13px;
    color: #4c1d95;
    margin-bottom: 5px;
}

/* Markdown 常用标签基础样式 */
.result-content strong {
    font-weight: 700;
    color: #5b21b6;
}

.result-content em {
    font-style: italic;
    color: #6d28d9;
}

.result-content h3 {
    font-size: 15px;
    font-weight: 700;
    color: #5b21b6;
    margin: 14px 0 8px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid #ede9fe;
}

.result-content h4 {
    font-size: 13px;
    font-weight: 700;
    color: #6d28d9;
    margin: 10px 0 6px 0;
}

.result-content h5 {
    font-size: 12px;
    font-weight: 600;
    color: #7c3aed;
    margin: 8px 0 4px 0;
}

.result-content pre {
    background: #f5f3ff;
    border: 1px solid #ede9fe;
    border-radius: 6px;
    padding: 10px 12px;
    overflow-x: auto;
    margin: 8px 0;
    font-size: 12px;
}

.result-content code {
    background: #f3e8ff;
    color: #6d28d9;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 12px;
    font-family: 'Courier New', monospace;
}

.result-content pre code {
    background: none;
    padding: 0;
    color: #4c1d95;
}

.result-content blockquote {
    margin: 8px 0;
    padding: 8px 14px;
    border-left: 3px solid #a78bfa;
    background: #faf5ff;
    color: #6d28d9;
    font-style: italic;
    font-size: 13px;
    border-radius: 0 6px 6px 0;
}

/* 错误提示 */
#zgdResultError {
    flex: 1;
    flex-direction: column;
    min-height: 260px;
}

.result-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 260px;
    text-align: center;
    padding: 40px 20px;
}

.error-icon { font-size: 36px; margin-bottom: 12px; }
.error-msg  { font-size: 14px; color: #dc2626; margin-bottom: 8px; font-weight: 600; }
.error-tip  { font-size: 12px; color: #9ca3af; margin-bottom: 18px; }

.retry-btn {
    padding: 8px 22px;
    background: linear-gradient(135deg, #6d28d9 0%, #4338ca 100%);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(109, 40, 217, 0.35);
}

.retry-btn:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(109, 40, 217, 0.45);
}

/* ========== 模态框 ========== */
.zgd-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(59, 7, 100, 0.45);
    z-index: 10000;
    backdrop-filter: blur(3px);
}

.zgd-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(620px, 92vw);
    max-height: 80vh;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(59, 7, 100, 0.3);
    z-index: 10001;
    flex-direction: column;
    overflow: hidden;
    animation: modalIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalIn {
    from { opacity: 0; transform: translate(-50%, -48%) scale(0.96); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.zgd-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: linear-gradient(135deg, #3b0764 0%, #6d28d9 100%);
    flex-shrink: 0;
}

.zgd-modal-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
}

.zgd-modal-close {
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zgd-modal-close:hover { background: rgba(255, 255, 255, 0.35); }

.zgd-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
    align-content: start;
}

.zgd-modal-body::-webkit-scrollbar { width: 5px; }
.zgd-modal-body::-webkit-scrollbar-track { background: transparent; }
.zgd-modal-body::-webkit-scrollbar-thumb { background: #ddd6fe; border-radius: 3px; }

/* 示例卡片 */
.example-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: #faf5ff;
    border: 1.5px solid #ede9fe;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.18s;
}

.example-card:hover {
    border-color: #a78bfa;
    background: #f5f3ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(109, 40, 217, 0.15);
}

.example-icon {
    font-size: 26px;
    flex-shrink: 0;
    line-height: 1;
}

.example-info { flex: 1; min-width: 0; }

.example-title {
    font-size: 13px;
    font-weight: 700;
    color: #5b21b6;
    margin-bottom: 4px;
}

.example-desc {
    font-size: 11px;
    color: #7c3aed;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* =============================================
   暗黑模式（body.dark 前缀）
   ============================================= */
body.dark .zgd-container {
    background: #0f0a1a;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}

body.dark .zgd-toolbar {
    background: linear-gradient(135deg, #1a0530 0%, #2d1b69 60%, #1e1b4b 100%);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

body.dark .zgd-toolbar .toolbar-btn {
    background: rgba(255, 255, 255, 0.12);
    color: #c4b5fd;
    border: 1px solid rgba(196, 181, 253, 0.2);
}

body.dark .zgd-toolbar .toolbar-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
    color: #e9d5ff;
}

body.dark .zgd-toolbar .toolbar-btn-primary {
    background: linear-gradient(135deg, #b45309 0%, #92400e 100%);
    border: none;
    color: #fff;
}

body.dark .zgd-toolbar .toolbar-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

body.dark .zgd-main-content {
    background: #0f0a1a;
}

/* 暗黑-左栏历史 */
body.dark .zgd-history-panel {
    background: #1a0f2e;
    border-right-color: rgba(196, 181, 253, 0.15);
}

body.dark .history-panel-header {
    background: linear-gradient(to bottom, #1a0f2e 0%, #130b24 100%);
    border-bottom-color: rgba(196, 181, 253, 0.15);
}

body.dark .history-panel-header h3 { color: #e9d5ff; }

body.dark .history-clear-btn {
    background: rgba(139, 92, 246, 0.15);
    color: #c4b5fd;
}

body.dark .history-clear-btn:hover { background: rgba(139, 92, 246, 0.25); }

body.dark .history-search { border-bottom-color: rgba(196, 181, 253, 0.15); }

body.dark .history-search input {
    background: #0f0a1a;
    border-color: rgba(196, 181, 253, 0.25);
    color: #e9d5ff;
}

body.dark .history-search input::placeholder { color: #6d28d9; }

body.dark .history-search input:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

body.dark .history-list::-webkit-scrollbar-thumb { background: rgba(196, 181, 253, 0.3); }
body.dark .history-list::-webkit-scrollbar-thumb:hover { background: #8b5cf6; }

body.dark .history-item:hover {
    background: rgba(139, 92, 246, 0.12);
    border-color: rgba(196, 181, 253, 0.25);
}

body.dark .history-item.active {
    background: rgba(139, 92, 246, 0.2);
    border-color: #7c3aed;
    box-shadow: inset 3px 0 0 #3b82f6;
}

body.dark .history-item-title { color: #c4b5fd; }
body.dark .history-item-preview { color: #6b7280; }
body.dark .history-item-meta { color: #7c3aed; }

body.dark .history-item-mode {
    background: rgba(109, 40, 217, 0.25);
    color: #c4b5fd;
}

body.dark .history-empty { color: #4c1d95; }

/* 暗黑-中栏输入 */
body.dark .zgd-input-panel {
    background: #130b24;
    border-right-color: rgba(196, 181, 253, 0.15);
}

body.dark .panel-header {
    background: linear-gradient(to bottom, #1a0f2e 0%, #130b24 100%);
    border-bottom-color: rgba(196, 181, 253, 0.15);
}

body.dark .panel-header h3 { color: #e9d5ff; }
body.dark .panel-tip { color: #7c3aed; }

body.dark .zgd-input-body::-webkit-scrollbar-thumb { background: rgba(196, 181, 253, 0.3); }
body.dark .zgd-input-body::-webkit-scrollbar-thumb:hover { background: #8b5cf6; }

body.dark .zgd-dream-textarea {
    background: #0f0a1a;
    border-color: rgba(196, 181, 253, 0.25);
    color: #e9d5ff;
}

body.dark .zgd-dream-textarea::placeholder { color: #4c1d95; }

body.dark .zgd-dream-textarea:focus {
    border-color: #8b5cf6;
    background: #0f0a1a;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

body.dark .zgd-char-counter { color: #7c3aed; }
body.dark .zgd-char-counter.warning { color: #d97706; }
body.dark .zgd-char-counter.limit { color: #ef4444; }

body.dark .zgd-mode-label { color: #c4b5fd; }

body.dark .zgd-mode-option {
    background: #0f0a1a;
    border-color: rgba(196, 181, 253, 0.2);
    color: #a78bfa;
}

body.dark .zgd-mode-option:hover {
    border-color: #8b5cf6;
    background: rgba(139, 92, 246, 0.1);
}

body.dark .zgd-mode-option.selected {
    background: rgba(109, 40, 217, 0.25);
    border-color: #8b5cf6;
    color: #e9d5ff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

body.dark .zgd-mode-hint { background: rgba(109, 40, 217, 0.2); color: #c4b5fd; }

body.dark .zgd-quick-label { color: #c4b5fd; }

body.dark .zgd-quick-tag {
    background: rgba(109, 40, 217, 0.15);
    border-color: rgba(196, 181, 253, 0.2);
    color: #a78bfa;
}

body.dark .zgd-quick-tag:hover {
    background: rgba(109, 40, 217, 0.25);
    border-color: #8b5cf6;
}

body.dark .zgd-tips-box {
    background: rgba(109, 40, 217, 0.1);
    border-color: rgba(196, 181, 253, 0.15);
    color: #a78bfa;
}

body.dark .zgd-tips-box p { color: #c4b5fd; }

/* 暗黑-右栏结果 */
body.dark .zgd-result-panel { background: #0f0a1a; }

body.dark .zgd-result-header {
    background: linear-gradient(to bottom, #1a0f2e 0%, #130b24 100%);
    border-bottom-color: rgba(196, 181, 253, 0.15);
}

body.dark .zgd-result-header h3 { color: #e9d5ff; }

body.dark .result-mode-badge {
    background: rgba(109, 40, 217, 0.25);
    color: #c4b5fd;
}

body.dark .zgd-result-body {
    background: #0f0a1a;
}

body.dark .zgd-result-body::-webkit-scrollbar-thumb { background: rgba(196, 181, 253, 0.3); }
body.dark .zgd-result-body::-webkit-scrollbar-thumb:hover { background: #8b5cf6; }

body.dark .placeholder-title { color: #a78bfa; }
body.dark .placeholder-desc  { color: #6d28d9; }
body.dark .placeholder-verse { color: #4c1d95; border-top-color: rgba(196, 181, 253, 0.15); }
body.dark .placeholder-stars { color: #4c1d95; }

body.dark .loading-text { color: #a78bfa; }
body.dark .loading-dots span { background: #8b5cf6; }

body.dark .result-content { color: #e9d5ff; }

body.dark .result-content .dream-result {
    background: #1a0f2e;
    border-color: rgba(196, 181, 253, 0.2);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

body.dark .result-content .dream-title { color: #c4b5fd; border-bottom-color: rgba(196, 181, 253, 0.2); }

body.dark .result-content .dream-section h4 {
    color: #a78bfa;
    background: rgba(109, 40, 217, 0.15);
    border-left-color: #6d28d9;
}

body.dark .result-content .dream-symbols li { color: #c4b5fd; border-bottom-color: rgba(196, 181, 253, 0.1); }
body.dark .result-content .dream-symbols li::before { color: #d97706; }

body.dark .result-content .dream-omen {
    background: rgba(109, 40, 217, 0.12);
    border-color: rgba(196, 181, 253, 0.15);
    color: #c4b5fd;
}

body.dark .result-content .dream-advice li { color: #c4b5fd; }
body.dark .result-content p { color: #c4b5fd; }
body.dark .result-content ul li { color: #c4b5fd; }

/* 暗黑模式 - Markdown 标签 */
body.dark .result-content strong { color: #e9d5ff; }
body.dark .result-content em { color: #c4b5fd; }
body.dark .result-content h3 {
    color: #c4b5fd;
    border-bottom-color: rgba(196, 181, 253, 0.2);
}
body.dark .result-content h4 { color: #a78bfa; }
body.dark .result-content h5 { color: #9ca3af; }
body.dark .result-content pre {
    background: #0f0a1a;
    border-color: rgba(196, 181, 253, 0.2);
}
body.dark .result-content code {
    background: rgba(109, 40, 217, 0.2);
    color: #c4b5fd;
}
body.dark .result-content pre code { background: none; color: #e9d5ff; }
body.dark .result-content blockquote {
    border-left-color: #6d28d9;
    background: rgba(109, 40, 217, 0.1);
    color: #a78bfa;
}

body.dark .error-msg { color: #f87171; }
body.dark .error-tip { color: #6b7280; }

body.dark .retry-btn {
    background: linear-gradient(135deg, #5b21b6 0%, #3730a3 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

body.dark .retry-btn:hover {
    background: linear-gradient(135deg, #6d28d9 0%, #4338ca 100%);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

/* 暗黑-模态框 */
body.dark .zgd-modal-overlay { background: rgba(0, 0, 0, 0.7); }

body.dark .zgd-modal {
    background: #1a0f2e;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.7);
}

body.dark .zgd-modal-header {
    background: linear-gradient(135deg, #0f0722 0%, #2d1b69 100%);
}

body.dark .zgd-modal-body { background: #1a0f2e; }
body.dark .zgd-modal-body::-webkit-scrollbar-thumb { background: rgba(196, 181, 253, 0.3); }

body.dark .example-card {
    background: #0f0a1a;
    border-color: rgba(196, 181, 253, 0.15);
}

body.dark .example-card:hover {
    border-color: #7c3aed;
    background: rgba(109, 40, 217, 0.12);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

body.dark .example-title { color: #c4b5fd; }
body.dark .example-desc  { color: #9ca3af; }

body.dark .zgd-inline-interpret-btn {
    background: linear-gradient(135deg, #b45309 0%, #92400e 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

body.dark .zgd-inline-interpret-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

/* =============================================
   响应式布局
   ============================================= */
@media (max-width: 900px) {
    .zgd-history-panel { width: 160px; }
    .zgd-input-panel { width: 240px; }
}

@media (max-width: 700px) {
    .zgd-main-content { flex-direction: column; }
    .zgd-history-panel {
        width: 100%;
        height: 140px;
        border-right: none;
        border-bottom: 1px solid var(--zgd-border);
        flex-shrink: 0;
    }
    .zgd-input-panel {
        width: 100%;
        height: 260px;
        border-right: none;
        border-bottom: 1px solid var(--zgd-border);
        flex-shrink: 0;
    }
    .zgd-result-panel { flex: 1; min-width: unset; }
    .zgd-container { height: 100vh; }
    .zgd-modal-body { grid-template-columns: 1fr; }
}
