/* ===== 全局变量 & 重置 ===== */
:root {
    --bg: #faf7f2;
    --sidebar-bg: #f3efe8;
    --card-bg: #ffffff;
    --text-primary: #3d3226;
    --text-secondary: #8c8075;
    --text-tertiary: #b0a599;
    --border: #e8e2d8;
    --border-light: #f0ebe1;
    --accent: #b8956a;
    --accent-hover: #a07848;
    --accent-light: #f5efe6;
    --accent-soft: #e8d9c4;
    --shadow-sm: 0 1px 2px rgba(61, 50, 38, 0.06);
    --shadow-md: 0 2px 8px rgba(61, 50, 38, 0.08);
    --shadow-lg: 0 4px 16px rgba(61, 50, 38, 0.1);
    --shadow-btn: 0 1px 3px rgba(61, 50, 38, 0.07);
    --shadow-btn-hover: 0 4px 14px rgba(61, 50, 38, 0.13);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --transition-fast: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    --font-sans: 'Inter', 'PingFang SC', 'Hiragino Sans GB', 'Noto Sans SC',
        'Microsoft YaHei', system-ui, -apple-system, sans-serif;
    --font-mono: 'SF Mono', 'JetBrains Mono', 'Fira Code', 'Consolas',
        'Monaco', 'Courier New', monospace;
    --sidebar-width: 200px;
    --batch-panel-height: 64px;
    --ref-img-margin-x: -14px;
    --ref-img-margin-top: -18px;
    --page-bg: #f5f1ea;
    --page-bg-2: #faf7f2;
    --app-bg-start: #fdfbf7;
    --app-bg-mid: #faf7f2;
    --app-bg-end: #f7f3ec;
    --body-before-bg: radial-gradient(ellipse at 15% 20%, rgba(210, 180, 150, 0.04) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 75%, rgba(190, 160, 130, 0.03) 0%, transparent 55%),
        radial-gradient(ellipse at 50% 50%, rgba(200, 175, 145, 0.025) 0%, transparent 70%);
    --sidebar-bg-image: repeating-linear-gradient(0deg,
            transparent,
            transparent 3px,
            rgba(0, 0, 0, 0.006) 3px,
            rgba(0, 0, 0, 0.006) 4px);
    --sidebar-bg-color: #f3efe8;
    --header-after-bg: linear-gradient(to right,
            transparent,
            rgba(180, 155, 125, 0.25) 15%,
            rgba(180, 155, 125, 0.35) 50%,
            rgba(180, 155, 125, 0.25) 85%,
            transparent);
    --tag-btn-bg-start: #ffffff;
    --tag-btn-bg-end: #fefdfb;
    --tag-btn-hover-bg: #fefdfb;
    --tag-btn-active-bg: #faf7f3;
    --tag-btn-copied-bg: #fdf9f4;
    --batch-checkbox-bg: rgba(255, 255, 255, 0.85);
    --batch-panel-bg: rgba(255, 255, 255, 0.96);
    --toast-bg: #3d3226;
    --toast-color: #f5efe6;
    --scrollbar-thumb: rgba(180, 160, 140, 0.25);
    --scrollbar-thumb-hover: rgba(180, 160, 140, 0.4);
    --sidebar-item-hover: rgba(180, 150, 120, 0.08);
    --sidebar-item-active: rgba(180, 150, 120, 0.12);
    --sidebar-item-active-border: inset 3px 0 0 var(--accent);
    --btn-hover-bg: #fefdfb;
    --btn-hover-border: #d5ccc0;
    --nsfw-toggle-active-bg: #d32f2f;
    --accent-shadow: rgba(184, 149, 106, 0.1);
    --noise-opacity: 0.7;
    --brand-zh-color: #3d3226;
    /* 主题切换相关 */
    --theme-btn-bg: var(--card-bg);
    --theme-btn-border: var(--border);
    --theme-btn-color: var(--text-secondary);
    --theme-btn-hover-bg: var(--btn-hover-bg);
    --theme-btn-hover-border: var(--btn-hover-border);
    --theme-panel-bg: var(--card-bg);
    --theme-panel-border: var(--border);
    --theme-panel-shadow: var(--shadow-lg);
    --theme-option-hover: rgba(180, 150, 120, 0.08);
    --theme-option-active-bg: var(--accent-light);
    --theme-option-active-border: var(--accent-soft);
    --theme-option-check-color: var(--accent);
}

/* ===== ★ 科技流光 主题 ===== */
.theme-tech-flow {
    --bg: #050508;
    --sidebar-bg: #0a0a0f;
    --card-bg: #0f0f14;
    --text-primary: #e6edf3;
    --text-secondary: #8b98a5;
    --text-tertiary: #586472;
    --border: #1a1a2e;
    --border-light: #12121f;
    --accent: #00d4aa;
    --accent-hover: #00f0c0;
    --accent-light: #0a1a1a;
    --accent-soft: #00b894;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 4px 24px rgba(0, 0, 0, 0.7);
    --shadow-btn: 0 1px 3px rgba(0, 0, 0, 0.5);
    --shadow-btn-hover: 0 4px 14px rgba(0, 212, 170, 0.2);
    --page-bg: #000000;
    --page-bg-2: #050508;
    --app-bg-start: #050508;
    --app-bg-mid: #08080d;
    --app-bg-end: #030306;
    --body-before-bg: radial-gradient(ellipse at 15% 20%, rgba(0, 212, 170, 0.06) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 75%, rgba(0, 150, 255, 0.05) 0%, transparent 55%),
        radial-gradient(ellipse at 50% 50%, rgba(0, 200, 180, 0.03) 0%, transparent 70%);
    --sidebar-bg-image: repeating-linear-gradient(0deg,
            transparent,
            transparent 3px,
            rgba(0, 212, 170, 0.03) 3px,
            rgba(0, 212, 170, 0.03) 4px);
    --sidebar-bg-color: #0a0a0f;
    --header-after-bg: linear-gradient(to right,
            transparent,
            rgba(0, 212, 170, 0.2) 15%,
            rgba(0, 150, 255, 0.3) 50%,
            rgba(0, 212, 170, 0.2) 85%,
            transparent);
    --tag-btn-bg-start: #0f0f14;
    --tag-btn-bg-end: #0a0a0f;
    --tag-btn-hover-bg: #12121a;
    --tag-btn-active-bg: #08080d;
    --tag-btn-copied-bg: #0a1a1a;
    --batch-checkbox-bg: rgba(10, 10, 15, 0.85);
    --batch-panel-bg: rgba(5, 5, 8, 0.96);
    --toast-bg: #00d4aa;
    --toast-color: #050508;
    --scrollbar-thumb: rgba(0, 212, 170, 0.3);
    --scrollbar-thumb-hover: rgba(0, 212, 170, 0.5);
    --sidebar-item-hover: rgba(0, 212, 170, 0.08);
    --sidebar-item-active: rgba(0, 212, 170, 0.12);
    --sidebar-item-active-border: inset 3px 0 0 var(--accent);
    --btn-hover-bg: #12121a;
    --btn-hover-border: #1a1a2e;
    --nsfw-toggle-active-bg: #ff3366;
    --accent-shadow: rgba(0, 212, 170, 0.15);
    --noise-opacity: 0.2;
    --brand-zh-color: #e6edf3;
    /* 主题切换相关 */
    --theme-btn-bg: #0f0f14;
    --theme-btn-border: #1a1a2e;
    --theme-btn-color: #8b98a5;
    --theme-btn-hover-bg: #12121a;
    --theme-btn-hover-border: #00d4aa;
    --theme-panel-bg: #0f0f14;
    --theme-panel-border: #1a1a2e;
    --theme-panel-shadow: 0 4px 24px rgba(0, 0, 0, 0.8), 0 0 40px rgba(0, 212, 170, 0.05);
    --theme-option-hover: rgba(0, 212, 170, 0.08);
    --theme-option-active-bg: rgba(0, 212, 170, 0.1);
    --theme-option-active-border: #00d4aa;
    --theme-option-check-color: #00d4aa;
}

/* 科技流光 - 特殊效果 */
.theme-tech-flow .app-container {
    box-shadow:
        var(--shadow-lg),
        0 20px 50px rgba(0, 0, 0, 0.3);
    background:
        linear-gradient(to bottom,
            #050508 0%,
            #08080d 3%,
            #08080d 97%,
            #030306 100%);
}

/* ★ 移除整个容器的流光边框 */
.theme-tech-flow .app-container::before {
    display: none;
}

.theme-tech-flow .header::after {
    opacity: 1;
}

.theme-tech-flow .brand-zh {
    color: var(--brand-zh-color);
    background: linear-gradient(90deg, #00d4aa, #00a3ff, #00d4aa);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: techFlowText 3s linear infinite;
}

.theme-tech-flow .brand-zh::after {
    display: none;
}

@keyframes techFlowText {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}

.theme-tech-flow .brand-en {
    color: #586472;
}

.theme-tech-flow .sidebar {
    background-image:
        repeating-linear-gradient(0deg,
            transparent,
            transparent 3px,
            rgba(0, 212, 170, 0.03) 3px,
            rgba(0, 212, 170, 0.03) 4px),
        linear-gradient(180deg,
            rgba(0, 212, 170, 0.02) 0%,
            transparent 30%,
            transparent 70%,
            rgba(0, 150, 255, 0.02) 100%);
    background-color: #0a0a0f;
}

.theme-tech-flow .sidebar-item.active {
    background: rgba(0, 212, 170, 0.12);
    color: #e6edf3;
    box-shadow: inset 3px 0 0 #00d4aa;
}

.theme-tech-flow .sidebar-item.active .dot {
    background: #00d4aa;
    box-shadow: 0 0 8px rgba(0, 212, 170, 0.6);
}

.theme-tech-flow .sidebar-item.active .count {
    background: rgba(0, 212, 170, 0.15);
    color: #00d4aa;
}

/* ★ 卡片 - 清除默认边框，准备给 ::after 流光边框让位 */
.theme-tech-flow .tag-btn {
    background-image:
        linear-gradient(to bottom,
            #0f0f14 0%,
            #0a0a0f 100%);
    border-color: transparent;
    position: relative;
    z-index: 0;
}

/* ★ 每个卡片的彩色流光边框（使用 mask 渐变边框技术） */
.theme-tech-flow .tag-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-md);
    padding: 1.5px;
    background: linear-gradient(60deg,
            #00d4aa, #00a3ff, #8b5cf6, #ff6b9d,
            #f59e0b, #00d4aa, #00a3ff, #8b5cf6);
    background-size: 300% 300%;
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: techFlowCardBorder 5s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
    transition: opacity var(--transition-fast);
}

/* 卡片 hover 时流光更亮 */
.theme-tech-flow .tag-btn:hover::after {
    animation-duration: 2.5s;
    background: linear-gradient(60deg,
            #00ffc8, #00b8ff, #a78bfa, #ff85b3,
            #fbbf24, #00ffc8, #00b8ff, #a78bfa);
    background-size: 300% 300%;
}

/* 卡片被选中时保持流光效果 */
.theme-tech-flow .tag-btn.batch-checked::after {
    opacity: 1;
}

@keyframes techFlowCardBorder {
    0% { background-position: 0% 50%; }
    25% { background-position: 100% 0%; }
    50% { background-position: 100% 100%; }
    75% { background-position: 0% 100%; }
    100% { background-position: 0% 50%; }
}

/* 保留原有的 ::before 悬停光晕效果 */
.theme-tech-flow .tag-btn::before {
    background: radial-gradient(circle at center, rgba(0, 212, 170, 0.05) 0%, transparent 70%);
    z-index: 0;
}

.theme-tech-flow .tag-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(0, 212, 170, 0.15), 0 0 20px rgba(0, 212, 170, 0.05);
    border-color: transparent;
    background: #12121a;
}

.theme-tech-flow .tag-btn:active {
    background: #08080d;
    border-color: transparent;
}

.theme-tech-flow .tag-btn.copied-flash {
    border-color: #00d4aa !important;
    background: #0a1a1a !important;
    box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.2) !important;
}

.theme-tech-flow .tag-btn.batch-checked {
    border-color: transparent !important;
    box-shadow: 0 0 0 2px rgba(0, 212, 170, 0.3), var(--shadow-btn) !important;
    background: rgba(0, 212, 170, 0.08) !important;
}

.theme-tech-flow .tag-btn .batch-checkbox {
    border-color: #2a2a4a;
    background: rgba(10, 10, 15, 0.85);
}

.theme-tech-flow .tag-btn .batch-checkbox:hover {
    border-color: #00d4aa;
    background: rgba(10, 10, 15, 0.9);
}

.theme-tech-flow .tag-btn .batch-checkbox.checked {
    background: #00d4aa;
    border-color: #00d4aa;
}

.theme-tech-flow .tag-btn .tag-zh {
    color: #e6edf3;
}

.theme-tech-flow .tag-btn .tag-en-part {
    color: #8b98a5;
}

.theme-tech-flow .tag-btn .tag-en-part:hover {
    color: #00d4aa;
    background: rgba(0, 212, 170, 0.1);
    border-bottom-color: #00d4aa;
}

.theme-tech-flow .tag-btn .tag-en-part.copied-part {
    background: rgba(0, 212, 170, 0.2);
    border-bottom-color: #00d4aa;
    color: #00d4aa;
}

.theme-tech-flow .tag-btn:hover .tag-en-wrapper .tag-en-part {
    color: #8b98a5;
}

.theme-tech-flow .tag-btn:hover .tag-en-wrapper .tag-en-part:hover {
    color: #00d4aa;
}

.theme-tech-flow .tag-btn .tag-group-label {
    color: #00d4aa;
    background: rgba(0, 212, 170, 0.1);
    border-color: rgba(0, 212, 170, 0.3);
}

.theme-tech-flow .tag-btn .copy-hint {
    color: transparent;
}

.theme-tech-flow .tag-btn:hover .copy-hint {
    color: #586472;
}

.theme-tech-flow .tag-btn .nsfw-badge {
    background: #ff3366;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.theme-tech-flow .tag-btn .search-category-label {
    color: #586472;
    background: rgba(0, 0, 0, 0.2);
}

.theme-tech-flow .search-input {
    background: #0f0f14;
    border-color: #1a1a2e;
    color: #e6edf3;
}

.theme-tech-flow .search-input::placeholder {
    color: #586472;
}

.theme-tech-flow .search-input:focus {
    border-color: #00d4aa;
    box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.15);
    background: #12121a;
}

.theme-tech-flow .search-icon {
    color: #586472;
}

.theme-tech-flow .search-clear {
    color: #586472;
}

.theme-tech-flow .search-clear:hover {
    background: rgba(0, 0, 0, 0.2);
    color: #8b98a5;
}

.theme-tech-flow .ref-toggle,
.theme-tech-flow .nsfw-toggle {
    background: #0f0f14;
    border-color: #1a1a2e;
    color: #8b98a5;
    box-shadow: var(--shadow-sm);
}

.theme-tech-flow .ref-toggle:hover,
.theme-tech-flow .nsfw-toggle:hover {
    border-color: #00d4aa;
    box-shadow: 0 4px 14px rgba(0, 212, 170, 0.15);
    background: #12121a;
}

.theme-tech-flow .ref-toggle .toggle-track {
    background: #2a2a4a;
}

.theme-tech-flow .nsfw-toggle .toggle-track {
    background: #2a2a4a;
}

.theme-tech-flow .ref-toggle.active .toggle-track {
    background: #00d4aa;
}

.theme-tech-flow .nsfw-toggle.active .toggle-track {
    background: #ff3366;
}

.theme-tech-flow .ref-toggle .toggle-track::after,
.theme-tech-flow .nsfw-toggle .toggle-track::after {
    background: #e6edf3;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.theme-tech-flow .footer {
    color: #586472;
    border-top-color: #12121f;
}

.theme-tech-flow .batch-panel {
    background: rgba(5, 5, 8, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-color: #1a1a2e;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
}

.theme-tech-flow .batch-panel .batch-info {
    color: #8b98a5;
}

.theme-tech-flow .batch-panel .batch-info .batch-count {
    background: #00d4aa;
    color: #050508;
}

.theme-tech-flow .batch-panel .batch-btn {
    background: #0f0f14;
    border-color: #1a1a2e;
    color: #e6edf3;
    box-shadow: var(--shadow-sm);
}

.theme-tech-flow .batch-panel .batch-btn:hover {
    box-shadow: 0 4px 14px rgba(0, 212, 170, 0.15);
}

.theme-tech-flow .batch-panel .batch-btn.batch-btn-copy {
    background: #00d4aa;
    color: #050508;
    border-color: #00d4aa;
}

.theme-tech-flow .batch-panel .batch-btn.batch-btn-copy:hover {
    background: #00f0c0;
    border-color: #00f0c0;
}

.theme-tech-flow .batch-panel .batch-btn.batch-btn-clear {
    color: #8b98a5;
}

.theme-tech-flow .batch-panel .batch-btn.batch-btn-clear:hover {
    background: rgba(0, 0, 0, 0.2);
    color: #e6edf3;
}

.theme-tech-flow .category-title {
    color: #586472;
}

.theme-tech-flow .category-title .highlight {
    color: #00d4aa;
}

.theme-tech-flow .category-title .search-stat {
    color: #586472;
}

.theme-tech-flow .no-results {
    color: #586472;
}

.theme-tech-flow .content-area::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 170, 0.3);
}

.theme-tech-flow .content-area::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 212, 170, 0.5);
}

.theme-tech-flow .toast {
    background: #00d4aa;
    color: #050508;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 20px rgba(0, 212, 170, 0.2);
}

.theme-tech-flow .search-highlight {
    background: rgba(0, 212, 170, 0.25);
}

.theme-tech-flow .tag-btn .ref-image-container {
    background: #050508;
}

/* 科技流光 - 侧边栏流光指示器 */
.theme-tech-flow .sidebar-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 3px;
    background: linear-gradient(180deg, #00d4aa, #00a3ff, #00d4aa);
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(0, 212, 170, 0.4);
}

.theme-tech-flow .sidebar-item.active {
    padding-left: 11px;
}

/* ===== 主题切换按钮 ===== */
.theme-toggle-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
    padding: 6px 12px 6px 10px;
    border-radius: 20px;
    border: 1px solid var(--theme-btn-border);
    background: var(--theme-btn-bg);
    transition: all var(--transition-fast);
    font-size: 0.78rem;
    font-weight: 450;
    color: var(--theme-btn-color);
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
    flex-shrink: 0;
    position: relative;
}

.theme-toggle-btn:hover {
    border-color: var(--theme-btn-hover-border);
    box-shadow: var(--shadow-btn-hover);
    background: var(--theme-btn-hover-bg);
}

.theme-toggle-btn:active {
    transform: scale(0.97);
}

.theme-toggle-btn .theme-btn-icon {
    font-size: 0.9rem;
    line-height: 1;
}

.theme-toggle-btn .theme-btn-label {
    line-height: 1;
}

/* ===== 主题选择面板（下拉菜单） ===== */
.theme-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 1000;
    min-width: 180px;
    background: var(--theme-panel-bg);
    border: 1px solid var(--theme-panel-border);
    border-radius: var(--radius-md);
    box-shadow: var(--theme-panel-shadow);
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px) scale(0.96);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    transform-origin: top right;
}

.theme-panel.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.theme-panel-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 450;
    letter-spacing: 0.02em;
    position: relative;
}

.theme-panel-item:hover {
    background: var(--theme-option-hover);
    color: var(--text-primary);
}

.theme-panel-item.active {
    background: var(--theme-option-active-bg);
    color: var(--text-primary);
    border: 1px solid var(--theme-option-active-border);
    padding: 9px 11px;
}

.theme-panel-item .theme-panel-check {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.theme-panel-item.active .theme-panel-check {
    border-color: var(--theme-option-check-color);
    background: var(--theme-option-check-color);
}

.theme-panel-item .theme-panel-check::after {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: transparent;
    transition: all var(--transition-fast);
}

.theme-panel-item.active .theme-panel-check::after {
    background: #fff;
}

.theme-panel-item .theme-panel-label {
    flex: 1;
}

.theme-panel-item .theme-panel-preview {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-tertiary);
    letter-spacing: 0.03em;
}

.theme-tech-flow .theme-panel-item .theme-panel-preview {
    background: rgba(0, 0, 0, 0.2);
    color: #586472;
}

/* 主题预览色块 */
.theme-panel-item .theme-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid var(--border);
}

.theme-dot-default {
    background: linear-gradient(135deg, #faf7f2, #b8956a);
}

.theme-dot-tech-flow {
    background: linear-gradient(135deg, #050508, #00d4aa);
    box-shadow: 0 0 6px rgba(0, 212, 170, 0.5);
}

/* 主题切换按钮容器（相对定位用于定位面板） */
.theme-toggle-wrapper {
    position: relative;
    flex-shrink: 0;
}

/* ===== 点击外部关闭面板遮罩 ===== */
.theme-panel-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: none;
}

.theme-panel-overlay.active {
    display: block;
}

/* ===== 响应式 - 主题切换 ===== */
@media (max-width: 768px) {
    .theme-toggle-btn {
        padding: 4px 8px 4px 6px;
        font-size: 0.7rem;
    }
    .theme-toggle-btn .theme-btn-icon {
        font-size: 0.75rem;
    }
    .theme-panel {
        min-width: 160px;
        right: 0;
    }
    .theme-panel-item {
        padding: 8px 10px;
        font-size: 0.78rem;
    }
    .theme-panel-item.active {
        padding: 7px 9px;
    }
}

@media (max-width: 420px) {
    .theme-toggle-btn {
        padding: 3px 6px 3px 5px;
        font-size: 0.65rem;
    }
    .theme-toggle-btn .theme-btn-icon {
        font-size: 0.7rem;
    }
    .theme-panel {
        min-width: 140px;
    }
    .theme-panel-item {
        padding: 6px 8px;
        font-size: 0.72rem;
    }
    .theme-panel-item.active {
        padding: 5px 7px;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background-color: var(--page-bg);
    background-image:
        repeating-linear-gradient(0deg,
            transparent,
            transparent 1px,
            rgba(180, 160, 140, 0.015) 1px,
            rgba(180, 160, 140, 0.015) 2px),
        repeating-linear-gradient(90deg,
            transparent,
            transparent 1px,
            rgba(170, 150, 130, 0.01) 1px,
            rgba(170, 150, 130, 0.01) 2px),
        repeating-linear-gradient(45deg,
            transparent,
            transparent 3px,
            rgba(160, 140, 120, 0.006) 3px,
            rgba(160, 140, 120, 0.006) 4px);
    background-color: var(--page-bg-2);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background: var(--body-before-bg);
    opacity: var(--noise-opacity);
}

.app-container {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1100px;
    min-height: 88vh;
    background: var(--bg);
    border-radius: var(--radius-lg);
    box-shadow:
        var(--shadow-lg),
        0 0 0 1px rgba(180, 160, 140, 0.12),
        0 20px 50px rgba(140, 120, 90, 0.08);
    overflow: hidden;
    background:
        linear-gradient(to bottom,
            var(--app-bg-start) 0%,
            var(--app-bg-mid) 3%,
            var(--app-bg-mid) 97%,
            var(--app-bg-end) 100%);
}

/* ===== Header ===== */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 28px 16px 28px;
    border-bottom: 1px solid var(--border-light);
    position: relative;
    flex-shrink: 0;
    background: transparent;
    user-select: none;
    gap: 12px;
}

.header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 28px;
    right: 28px;
    height: 1px;
    background: var(--header-after-bg);
    opacity: 0.7;
}

.brand {
    display: flex;
    align-items: baseline;
    gap: 10px;
    cursor: default;
    flex-shrink: 0;
}

.brand-zh {
    font-size: 1.55rem;
    font-weight: 620;
    letter-spacing: 0.06em;
    color: var(--brand-zh-color);
    line-height: 1;
    position: relative;
}

.brand-zh::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 1.5px;
    background: var(--accent-soft);
    border-radius: 1px;
    opacity: 0.5;
    transform: scaleX(0.7);
    transform-origin: left center;
}

.brand-en {
    font-size: 0.8rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    color: var(--text-tertiary);
    text-transform: uppercase;
    font-style: italic;
    line-height: 1;
}

.header-subtitle {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    letter-spacing: 0.04em;
    font-weight: 400;
    white-space: nowrap;
}

/* ===== 搜索框 ===== */
.search-container {
    position: relative;
    flex: 1;
    max-width: 320px;
    min-width: 120px;
}

.search-input {
    width: 100%;
    padding: 7px 32px 7px 32px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--card-bg);
    font-size: 0.82rem;
    color: var(--text-primary);
    outline: none;
    transition: all var(--transition-fast);
    font-family: var(--font-sans);
    line-height: 1.4;
}

.search-input::placeholder {
    color: var(--text-tertiary);
    font-size: 0.78rem;
}

.search-input:focus {
    border-color: var(--accent-soft);
    box-shadow: 0 0 0 3px var(--accent-shadow);
    background: var(--card-bg);
}

.search-icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    font-size: 0.75rem;
    pointer-events: none;
    line-height: 1;
}

.search-clear {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 0.7rem;
    padding: 3px 5px;
    display: none;
    border-radius: 50%;
    transition: all var(--transition-fast);
    line-height: 1;
    font-family: var(--font-sans);
}

.search-clear:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-secondary);
}

.search-input:not(:placeholder-shown) ~ .search-clear {
    display: block;
}

/* ===== Header 右侧操作区 ===== */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* ===== 参考图 切换按钮 ===== */
.ref-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    padding: 6px 14px 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    transition: all var(--transition-fast);
    font-size: 0.78rem;
    font-weight: 450;
    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
}

.ref-toggle:hover {
    border-color: var(--btn-hover-border);
    box-shadow: var(--shadow-btn-hover);
    background: var(--btn-hover-bg);
}

.ref-toggle:active {
    transform: scale(0.97);
}

.ref-toggle .toggle-track {
    position: relative;
    width: 34px;
    height: 20px;
    border-radius: 10px;
    background: #d5ccc0;
    transition: background var(--transition-fast);
    flex-shrink: 0;
}

.ref-toggle .toggle-track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    transition: transform var(--transition-fast);
}

.ref-toggle.active .toggle-track {
    background: var(--accent);
}

.ref-toggle.active .toggle-track::after {
    transform: translateX(14px);
}

/* ===== NSFW 切换按钮 ===== */
.nsfw-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    padding: 6px 14px 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    transition: all var(--transition-fast);
    font-size: 0.78rem;
    font-weight: 450;
    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
}

.nsfw-toggle:hover {
    border-color: var(--btn-hover-border);
    box-shadow: var(--shadow-btn-hover);
    background: var(--btn-hover-bg);
}

.nsfw-toggle:active {
    transform: scale(0.97);
}

.nsfw-toggle .toggle-track {
    position: relative;
    width: 34px;
    height: 20px;
    border-radius: 10px;
    background: #d5ccc0;
    transition: background var(--transition-fast);
    flex-shrink: 0;
}

.nsfw-toggle .toggle-track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    transition: transform var(--transition-fast);
}

.nsfw-toggle.active .toggle-track {
    background: var(--nsfw-toggle-active-bg);
}

.nsfw-toggle.active .toggle-track::after {
    transform: translateX(14px);
}

.nsfw-toggle .toggle-label {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nsfw-toggle .toggle-label-icon {
    font-size: 0.85rem;
}

/* ===== 主体布局 ===== */
.main-content {
    display: flex;
    flex: 1;
    min-height: 0;
    position: relative;
}

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--sidebar-bg);
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-right: 1px solid var(--border-light);
    position: relative;
    user-select: none;
    background-image: var(--sidebar-bg-image);
    background-color: var(--sidebar-bg-color);
}

.sidebar-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-tertiary);
    padding: 6px 22px 14px 22px;
    font-weight: 500;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 0 10px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 450;
    letter-spacing: 0.03em;
    position: relative;
    text-decoration: none;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
}

.sidebar-item:hover {
    background: var(--sidebar-item-hover);
    color: var(--text-primary);
}

.sidebar-item:active {
    background: rgba(180, 150, 120, 0.14);
    transform: scale(0.97);
}

.sidebar-item.active {
    background: var(--sidebar-item-active);
    color: var(--text-primary);
    font-weight: 550;
    box-shadow: var(--sidebar-item-active-border);
    border-radius: var(--radius-sm);
    padding-left: 11px;
}

.sidebar-item .dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: transparent;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.sidebar-item.active .dot {
    background: var(--accent);
    box-shadow: 0 0 6px rgba(184, 149, 106, 0.5);
}

.sidebar-item .count {
    margin-left: auto;
    font-size: 0.7rem;
    color: var(--text-tertiary);
    font-weight: 400;
    letter-spacing: 0;
    background: rgba(0, 0, 0, 0.03);
    padding: 2px 7px;
    border-radius: 10px;
    transition: all var(--transition-fast);
}

.sidebar-item.active .count {
    background: rgba(184, 149, 106, 0.15);
    color: var(--accent-hover);
    font-weight: 500;
}

/* ===== 内容区 ===== */
.content-area {
    flex: 1;
    padding: 24px 28px 32px 28px;
    overflow-y: auto;
    position: relative;
    background: transparent;
    min-height: 400px;
}

.content-area::-webkit-scrollbar {
    width: 5px;
}
.content-area::-webkit-scrollbar-track {
    background: transparent;
}
.content-area::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 10px;
}
.content-area::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

.category-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-tertiary);
    margin-bottom: 18px;
    font-weight: 500;
    padding-left: 2px;
    transition: all var(--transition-smooth);
}

.category-title .highlight {
    color: var(--accent);
    font-weight: 600;
}

.category-title .search-stat {
    color: var(--text-tertiary);
    font-weight: 400;
    font-size: 0.7rem;
    letter-spacing: 0;
}

/* ===== TAG 网格 ===== */
.tag-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 12px;
    transition: opacity var(--transition-smooth);
}

.tag-grid.fade-out {
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.tag-grid.fade-in {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

/* ===== 单个 TAG 按钮 ===== */
.tag-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 18px 14px 16px 14px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-btn);
    position: relative;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    outline: none;
    text-align: center;
    min-height: 80px;
    background-image:
        linear-gradient(to bottom,
            var(--tag-btn-bg-start) 0%,
            var(--tag-btn-bg-end) 100%);
    overflow: hidden;
}

.tag-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-md);
    opacity: 0;
    background: radial-gradient(circle at center, rgba(184, 149, 106, 0.06) 0%, transparent 70%);
    transition: opacity var(--transition-fast);
    pointer-events: none;
}

.tag-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-btn-hover);
    border-color: var(--btn-hover-border);
    background: var(--tag-btn-hover-bg);
}

.tag-btn:hover::before {
    opacity: 1;
}

.tag-btn:active {
    transform: translateY(0) scale(0.97);
    box-shadow: var(--shadow-sm);
    transition: all 0.08s ease;
    background: var(--tag-btn-active-bg);
    border-color: #d0c8bb;
}

.tag-btn.copied-flash {
    border-color: var(--accent-soft) !important;
    background: var(--tag-btn-copied-bg) !important;
    box-shadow: 0 0 0 3px rgba(184, 149, 106, 0.12) !important;
    transition: all 0.12s ease !important;
}

/* ----- 批量勾选状态 ----- */
.tag-btn.batch-checked {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 2px rgba(184, 149, 106, 0.25), var(--shadow-btn) !important;
    background: #fdfaf5 !important;
}

/* ----- 批量勾选框（左下角圆角） ----- */
.tag-btn .batch-checkbox {
    position: absolute;
    left: 6px;
    bottom: 6px;
    z-index: 5;
    width: 20px;
    height: 20px;
    border-radius: 5px;
    border: 1.5px solid var(--border);
    background: var(--batch-checkbox-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    pointer-events: auto;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    flex-shrink: 0;
}

.tag-btn .batch-checkbox:hover {
    border-color: var(--accent-soft);
    background: var(--batch-checkbox-bg);
    box-shadow: 0 1px 6px rgba(184, 149, 106, 0.15);
}

.tag-btn .batch-checkbox svg {
    width: 12px;
    height: 12px;
    opacity: 0;
    transition: opacity var(--transition-fast);
    color: #fff;
    display: block;
}

.tag-btn .batch-checkbox.checked {
    background: var(--accent);
    border-color: var(--accent);
}

.tag-btn .batch-checkbox.checked svg {
    opacity: 1;
}

/* ----- NSFW 角标 ----- */
.tag-btn .nsfw-badge {
    position: absolute;
    top: -1px;
    left: -1px;
    background: #d32f2f;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 2px 7px 2px 6px;
    border-radius: var(--radius-md) 0 var(--radius-md) 0;
    line-height: 1.3;
    pointer-events: none;
    user-select: none;
    z-index: 2;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* ----- NSFW 隐藏态 ----- */
.tag-btn.nsfw-hidden {
    display: none !important;
}

/* ----- 分类标签（搜索结果中的卡片） ----- */
.tag-btn .search-category-label {
    position: absolute;
    bottom: 4px;
    right: 6px;
    font-size: 0.55rem;
    color: var(--text-tertiary);
    background: rgba(0,0,0,0.035);
    padding: 1px 6px;
    border-radius: 8px;
    letter-spacing: 0.04em;
    pointer-events: none;
    opacity: 0.7;
    line-height: 1.4;
}

/* ----- 中文标签 ----- */
.tag-btn .tag-zh {
    font-size: 0.95rem;
    font-weight: 520;
    color: var(--text-primary);
    letter-spacing: 0.03em;
    line-height: 1.3;
    transition: color var(--transition-fast);
    pointer-events: none;
}

/* ----- 英文部分：多个可点击词汇 ----- */
.tag-btn .tag-en-wrapper {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 2px 4px;
    font-size: 0.72rem;
    font-family: var(--font-mono);
    color: var(--text-tertiary);
    letter-spacing: 0.02em;
    line-height: 1.4;
    max-width: 100%;
    pointer-events: none;
}

.tag-btn .tag-en-sep {
    color: var(--text-tertiary);
    opacity: 0.4;
    font-size: 0.6rem;
    pointer-events: none;
    user-select: none;
}

.tag-btn .tag-en-part {
    display: inline-block;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.72rem;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    background: transparent;
    cursor: pointer;
    pointer-events: auto;
    transition: all var(--transition-fast);
    border-bottom: 1.5px solid transparent;
    line-height: 1.4;
    position: relative;
}

.tag-btn .tag-en-part:hover {
    color: var(--accent-hover);
    background: rgba(184, 149, 106, 0.07);
    border-bottom-color: var(--accent-soft);
    transform: translateY(-0.5px);
}

.tag-btn .tag-en-part:active {
    transform: scale(0.94);
    background: rgba(184, 149, 106, 0.15);
    transition: all 0.06s ease;
}

.tag-btn .tag-en-part.copied-part {
    background: rgba(184, 149, 106, 0.18);
    border-bottom-color: var(--accent);
    color: var(--accent-hover);
    transition: all 0.12s ease;
}

.tag-btn:hover .tag-en-wrapper .tag-en-part {
    color: #8c7d6e;
}

.tag-btn:hover .tag-en-wrapper .tag-en-part:hover {
    color: var(--accent-hover);
}

/* ========== 提示词组标签样式 ========== */
.tag-btn .tag-group-label {
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 500;
    letter-spacing: 0.04em;
    line-height: 1.4;
    pointer-events: none;
    padding: 2px 12px;
    background: rgba(184, 149, 106, 0.3);
    border-radius: 12px;
    border: 1px dashed rgba(184, 149, 106, 0.5);
    display: inline-block;
}

/* ----- 复制提示（右上角） ----- */
.tag-btn .copy-hint {
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 0.6rem;
    color: transparent;
    transition: color var(--transition-fast);
    letter-spacing: 0.05em;
    pointer-events: none;
    font-weight: 400;
    z-index: 2;
}

.tag-btn:hover .copy-hint {
    color: #c4b49e;
}

/* ===== 参考图容器 ===== */
.tag-btn .ref-image-container {
    width: calc(100% + 28px);
    margin: -18px -14px 8px -14px;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    background: #f5f1ea;
    line-height: 0;
}
.tag-btn .ref-image-container img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    max-height: 130px;
}
.tag-btn .ref-image-container.hide {
    display: none;
}

/* ----- 搜索无结果 ----- */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px 20px;
    color: var(--text-tertiary);
    font-size: 0.9rem;
    letter-spacing: 0.04em;
}

.no-results .no-results-icon {
    font-size: 2rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.no-results .no-results-hint {
    font-size: 0.75rem;
    margin-top: 8px;
    opacity: 0.6;
}

/* ===== Toast ===== */
.toast-container {
    position: fixed;
    top: 28px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.toast {
    padding: 10px 20px;
    background: var(--toast-bg);
    color: var(--toast-color);
    border-radius: 20px;
    font-size: 0.82rem;
    letter-spacing: 0.03em;
    font-weight: 450;
    box-shadow: 0 8px 24px rgba(61, 50, 38, 0.3);
    animation: toastIn 0.35s cubic-bezier(0.22, 0.61, 0.36, 1) forwards,
        toastOut 0.3s cubic-bezier(0.55, 0.06, 0.68, 0.19) 1.6s forwards;
    white-space: nowrap;
    pointer-events: auto;
    cursor: default;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast .toast-icon {
    font-size: 0.9rem;
}
.toast .toast-tag {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    opacity: 0.85;
    letter-spacing: 0.04em;
}

@keyframes toastIn {
    0% {
        opacity: 0;
        transform: translateY(-18px) scale(0.92);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toastOut {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-10px) scale(0.94);
    }
}

/* ===== 批量操作悬浮面板 ===== */
.batch-panel {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    z-index: 9998;
    background: var(--batch-panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 24px rgba(61, 50, 38, 0.12);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    transition: transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
    min-width: 320px;
    max-width: 500px;
    pointer-events: auto;
}

.batch-panel.visible {
    transform: translateX(-50%) translateY(0);
}

.batch-panel .batch-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 450;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.batch-panel .batch-info .batch-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 11px;
    line-height: 1;
}

.batch-panel .batch-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.batch-panel .batch-btn {
    padding: 8px 18px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-sans);
    letter-spacing: 0.02em;
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
    line-height: 1.3;
}

.batch-panel .batch-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-btn-hover);
}

.batch-panel .batch-btn:active {
    transform: scale(0.96);
}

.batch-panel .batch-btn.batch-btn-copy {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.batch-panel .batch-btn.batch-btn-copy:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.batch-panel .batch-btn.batch-btn-clear {
    color: var(--text-secondary);
    background: transparent;
    border-color: transparent;
}

.batch-panel .batch-btn.batch-btn-clear:hover {
    background: rgba(0,0,0,0.04);
    color: var(--text-primary);
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 12px 28px 16px 28px;
    font-size: 0.68rem;
    color: var(--text-tertiary);
    letter-spacing: 0.05em;
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
    user-select: none;
    opacity: 0.7;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    body {
        padding: 8px;
    }

    .app-container {
        border-radius: var(--radius-md);
        max-width: 100%;
    }

    .header {
        padding: 14px 16px 12px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }
    .header::after {
        left: 16px;
        right: 16px;
    }

    .brand-zh {
        font-size: 1.3rem;
    }
    .brand-en {
        font-size: 0.7rem;
    }
    .header-subtitle {
        display: none;
    }

    .search-container {
        order: 10;
        max-width: 100%;
        flex-basis: 100%;
    }

    .header-actions {
        margin-left: auto;
    }

    .ref-toggle,
    .nsfw-toggle {
        padding: 4px 10px 4px 8px;
        font-size: 0.7rem;
    }
    .ref-toggle .toggle-track,
    .nsfw-toggle .toggle-track {
        width: 28px;
        height: 16px;
    }
    .ref-toggle .toggle-track::after,
    .nsfw-toggle .toggle-track::after {
        width: 10px;
        height: 10px;
        top: 3px;
        left: 3px;
    }
    .ref-toggle.active .toggle-track::after,
    .nsfw-toggle.active .toggle-track::after {
        transform: translateX(12px);
    }

    .main-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        padding: 10px 12px;
        gap: 6px;
        border-right: none;
        border-bottom: 1px solid var(--border-light);
        flex-shrink: 0;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        background: var(--sidebar-bg-color);
    }

    .sidebar::-webkit-scrollbar {
        display: none;
    }

    .sidebar-label {
        display: none;
    }

    .sidebar-nav {
        flex-direction: row;
        gap: 4px;
        padding: 0;
        flex-wrap: nowrap;
    }

    .sidebar-item {
        padding: 9px 14px;
        font-size: 0.8rem;
        white-space: nowrap;
        flex-shrink: 0;
        gap: 5px;
        border-radius: 20px;
        box-shadow: none;
    }

    .sidebar-item.active {
        box-shadow: none;
        border-radius: 20px;
        padding-left: 14px;
        background: rgba(180, 150, 120, 0.16);
    }

    .sidebar-item .dot {
        display: none;
    }
    .sidebar-item .count {
        font-size: 0.65rem;
        padding: 1px 6px;
    }

    .content-area {
        padding: 16px 14px 20px 14px;
    }

    .tag-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 8px;
    }

    .tag-btn {
        padding: 13px 10px 11px 10px;
        min-height: 64px;
        gap: 4px;
        border-radius: var(--radius-sm);
    }
    .tag-btn .tag-zh {
        font-size: 0.82rem;
    }
    .tag-btn .tag-en-wrapper {
        font-size: 0.65rem;
    }
    .tag-btn .tag-en-part {
        font-size: 0.65rem;
        padding: 0 3px;
    }
    .tag-btn .tag-en-sep {
        font-size: 0.55rem;
    }
    .tag-btn .tag-group-label {
        font-size: 0.65rem;
        padding: 1px 10px;
    }
    .tag-btn .copy-hint {
        display: none;
    }
    .tag-btn .nsfw-badge {
        font-size: 0.5rem;
        padding: 1px 5px 1px 4px;
    }
    .tag-btn .search-category-label {
        font-size: 0.5rem;
        bottom: 3px;
        right: 4px;
        padding: 0 4px;
    }
    .tag-btn .batch-checkbox {
        left: 4px;
        bottom: 4px;
        width: 18px;
        height: 18px;
        border-radius: 4px;
    }
    .tag-btn .batch-checkbox svg {
        width: 10px;
        height: 10px;
    }
    /* 参考图（768px） */
    .tag-btn .ref-image-container {
        width: calc(100% + 20px);
        margin: -13px -10px 6px -10px;
        border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    }
    .tag-btn .ref-image-container img {
        max-height: 100px;
    }

    .category-title {
        font-size: 0.7rem;
        margin-bottom: 12px;
    }

    .toast-container {
        top: 16px;
    }
    .toast {
        padding: 8px 16px;
        font-size: 0.75rem;
        border-radius: 16px;
    }

    .batch-panel {
        padding: 12px 16px;
        min-width: 0;
        width: calc(100% - 16px);
        max-width: calc(100% - 16px);
        border-radius: 14px 14px 0 0;
        gap: 10px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .batch-panel .batch-info {
        font-size: 0.78rem;
    }

    .batch-panel .batch-btn {
        padding: 6px 14px;
        font-size: 0.76rem;
    }

    /* 科技流光 响应式 sidebar active 调整 */
    .theme-tech-flow .sidebar-item.active {
        box-shadow: none;
        border-radius: 20px;
        padding-left: 14px;
        background: rgba(0, 212, 170, 0.12);
    }
    .theme-tech-flow .sidebar-item.active::before {
        display: none;
    }
}

@media (max-width: 420px) {
    .tag-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 7px;
    }
    .tag-btn {
        padding: 11px 8px 10px 8px;
        min-height: 56px;
        gap: 3px;
    }
    .tag-btn .tag-zh {
        font-size: 0.76rem;
    }
    .tag-btn .tag-en-wrapper {
        font-size: 0.6rem;
    }
    .tag-btn .tag-en-part {
        font-size: 0.6rem;
        padding: 0 2px;
    }
    .tag-btn .tag-en-sep {
        font-size: 0.5rem;
    }
    .tag-btn .tag-group-label {
        font-size: 0.6rem;
        padding: 1px 8px;
    }
    .tag-btn .nsfw-badge {
        font-size: 0.45rem;
        padding: 1px 4px 1px 3px;
        border-radius: var(--radius-sm) 0 var(--radius-sm) 0;
    }
    .tag-btn .search-category-label {
        font-size: 0.45rem;
    }
    .tag-btn .batch-checkbox {
        left: 3px;
        bottom: 3px;
        width: 16px;
        height: 16px;
        border-radius: 3px;
    }
    .tag-btn .batch-checkbox svg {
        width: 9px;
        height: 9px;
    }
    /* 参考图（420px） */
    .tag-btn .ref-image-container {
        width: calc(100% + 16px);
        margin: -11px -8px 5px -8px;
        border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    }
    .tag-btn .ref-image-container img {
        max-height: 80px;
    }
    .sidebar-item {
        padding: 7px 11px;
        font-size: 0.73rem;
    }
    .content-area {
        padding: 12px 8px 16px 8px;
    }
    .header {
        padding: 10px 12px 10px 12px;
    }
    .brand-zh {
        font-size: 1.15rem;
    }
    .brand-en {
        font-size: 0.65rem;
    }
    .ref-toggle,
    .nsfw-toggle {
        padding: 3px 8px 3px 6px;
        font-size: 0.65rem;
    }
    .ref-toggle .toggle-track,
    .nsfw-toggle .toggle-track {
        width: 24px;
        height: 14px;
    }
    .ref-toggle .toggle-track::after,
    .nsfw-toggle .toggle-track::after {
        width: 8px;
        height: 8px;
        top: 3px;
        left: 3px;
    }
    .ref-toggle.active .toggle-track::after,
    .nsfw-toggle.active .toggle-track::after {
        transform: translateX(10px);
    }

    .batch-panel {
        padding: 10px 12px;
        width: calc(100% - 8px);
        max-width: calc(100% - 8px);
        gap: 8px;
    }
    .batch-panel .batch-info {
        font-size: 0.72rem;
    }
    .batch-panel .batch-btn {
        padding: 5px 12px;
        font-size: 0.72rem;
    }
}

/* ===== 搜索结果高亮 ===== */
.search-highlight {
    background: rgba(184, 149, 106, 0.18);
    border-radius: 2px;
    padding: 0 1px;
}
