* {
    box-sizing: border-box
}

body {
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background-color: #f8f9fa;
    color: #343a40
}

.container {
    max-width: 960px;
    margin: 1rem auto;
    padding: 1.5rem;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.subtitle {
    margin: 8px 0 16px;
    font-size: 16px;
    color: #666;
    text-align: center;
    font-weight: normal
}

.header-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

@media (min-width: 640px) {
    .header-controls {
        flex-direction: row;
        justify-content: center;
        gap: 24px;
    }
}

/* 头部样式优化 */
.header-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0;
    flex-wrap: wrap;
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 1.5rem;
}

.logo-area {
    flex: 1;
    min-width: 250px;
}

.logo-area h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    color: #3b5998; /* 添加蓝色调 */
    letter-spacing: -0.5px;
    text-shadow: 1px 1px 0px rgba(0,0,0,0.05);
}

.subtitle {
    margin: 0.5rem 0 0;
    color: #7f8c8d;
    font-size: 1rem;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.control-item {
    position: relative;
    display: flex;
    align-items: center;
}

.control-button {
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    border: 1px solid #e9ecef;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 600;
    color: #3b5998; /* 添加蓝色调 */
    transition: all 0.2s ease;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.05);
}

.control-button:hover {
    background: linear-gradient(145deg, #e9ecef, #f8f9fa);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.lang-toggle .current-lang {
    font-size: 0.9rem;
}

.version-tabs {
    display: flex;
    background: #f0f2f5; /* 轻微的蓝灰色背景 */
    border-radius: 8px;
    padding: 4px;
    gap: 4px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.version-tab {
    border: none;
    background: transparent;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #495057;
    transition: all 0.2s ease;
    font-weight: 500;
}

.version-tab:hover {
    background: rgba(59, 89, 152, 0.1); /* 蓝色调的悬停效果 */
    color: #3b5998;
}

.version-tab.active {
    background: #3b5998; /* 蓝色调的激活状态 */
    color: white;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(59, 89, 152, 0.3);
}

.version-hint {
    display: block;
    font-size: 0.75rem;
    color: #868e96;
    margin-top: 6px;
    text-align: center;
}

@media (max-width: 768px) {
    .header-main {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .header-controls {
        width: 100%;
        justify-content: space-between;
        margin-top: 1.5rem;
    }
    
    .version-tabs {
        flex-wrap: wrap;
    }
}

.version-selector,
.language-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    flex: 1;
}

@media (min-width: 640px) {

    .version-selector,
    .language-selector {
        flex: none;
        min-width: 200px;
    }
}

.version-selector label,
.language-selector label {
    font-weight: 500;
    color: #495057;
    white-space: nowrap;
}

.version-select,
.language-select {
    padding: 6px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    color: #495057;
    cursor: pointer;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out
}

.version-select:focus {
    outline: none;
    border-color: #0a58ca;
    box-shadow: 0 0 0 2px rgba(10, 88, 202, 0.25)
}

.version-select:hover {
    border-color: #0a58ca
}

#hint {
    color: #6c757d;
    font-style: italic
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin-top: 8px
}

.card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04)
}

.card h3 {
    margin: 0 0 8px;
    font-size: 18px
}

.card a {
    color: #0a58ca;
    text-decoration: none
}

.card a:hover {
    text-decoration: underline
}

.meta {
    margin-top: 8px;
    font-size: 12px;
    color: #666
}

.hidden {
    display: none
}

/* 旧的 .controls 样式已移至 V3 控件样式部分 */

input,
select,
button {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 14px
}

button {
    cursor: pointer;
    background: #eee
}

button:hover {
    background: #ddd
}

.tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

/* 标签容器标题 */
.tags-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    padding: 0 4px;
}

.tags-title {
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    margin: 0;
}

.tags-clear {
    font-size: 12px;
    color: #6c757d;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.tags-clear:hover {
    background: #e9ecef;
    color: #495057;
    text-decoration: none;
}

/* 筛选状态显示 */
#filter-status {
    font-size: 13px;
    color: #6c757d;
    margin: 8px 0;
    padding: 8px 12px;
    background: #e7f3ff;
    border: 1px solid #b3d9ff;
    border-radius: 8px;
    text-align: center;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .tags {
        gap: 6px;
        padding: 10px;
    }

    .tag {
        font-size: 12px;
        padding: 5px 10px;
    }

    .tag-emoji {
        font-size: 13px;
    }

    .tag-count {
        font-size: 10px;
        padding: 1px 4px;
        min-width: 16px;
    }
}

.tag {
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--tag-bg, #eee);
    color: var(--tag-color, #666);
    border: 1px solid var(--tag-color, #ddd);
    cursor: pointer;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.tag:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background: var(--tag-color, #ddd);
    color: white;
}

.tag.active {
    background: var(--tag-color, #222);
    color: white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.tag.selected {
    background: #17a2b8;
    color: white;
    border-color: #138496;
}

.tag-emoji {
    font-size: 14px;
    line-height: 1;
}

.tag-text {
    line-height: 1;
    text-transform: capitalize;
}

.tag-count {
    opacity: 0.7;
    font-size: 0.75em;
    margin-left: 0.25rem;
    font-weight: normal;
}

.tag.active .tag-count,
.tag.selected .tag-count {
    opacity: 0.8;
    font-weight: 600;
    min-width: 18px;
    text-align: center;
    line-height: 1.2;
}

.tag.active .tag-count {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

.tag:hover .tag-count {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

.ai-label {
    font-weight: 600;
    color: #0066cc;
    margin-right: 4px;
    font-size: 13px;
}

/* V3 控件样式 */
.controls {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-start;
}

.search-section {
    display: flex;
    gap: 8px;
    align-items: center;
    flex: 1;
    min-width: 300px;
    flex-wrap: wrap;
}

.filter-section {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: flex-start;
    width: 100%;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 200px;
}

.filter-label {
    font-size: 12px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 2px;
}

.random-btn,
.clear-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 13px;
    transition: all 0.3s ease;
    cursor: pointer;
    white-space: nowrap;
}

.random-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.clear-btn {
    background: linear-gradient(135deg, #a25e57 0%, #e47164 100%) !important;
}

.clear-btn:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, #c49893 0%, #a93226 100%) !important;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
}

/* V4 控件样式 */
.refresh-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.refresh-btn:hover {
    background: #f5f5f5;
}

.refresh-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.search-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 12px;
    color: #666;
}

.loading-status {
    color: #007bff;
}

.source-status {
    margin: 10px 0;
    display: grid;
    gap: 8px;
}

.source-status-item {
    padding: 8px;
    border-radius: 4px;
    border-left: 4px solid;
}

.source-active {
    border-left-color: #28a745;
    background: #f8fff9;
}

.source-moderate {
    border-left-color: #ffc107;
    background: #fffef8;
}

.source-inactive {
    border-left-color: #dc3545;
    background: #fff8f8;
}

.source-name {
    font-weight: bold;
    margin-bottom: 4px;
}

.source-info {
    font-size: 12px;
    color: #666;
    display: flex;
    gap: 10px;
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 16px;
    border-radius: 4px;
    color: white;
    font-weight: bold;
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.notification-success {
    background: #28a745;
}

.notification-error {
    background: #dc3545;
}

.notification-info {
    background: #007bff;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 新手友好的提示样式 */
.hint {
    display: block;
    font-size: 12px;
    color: #6c757d;
    margin-top: 4px;
    font-style: italic;
    line-height: 1.4;
}

.search-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.action-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.results-info {
    margin: 8px 0;
    padding: 8px 12px;
    background: #e3f2fd;
    border-radius: 6px;
    border-left: 4px solid #9fb1c0;
}

.item-count {
    font-size: 14px;
    font-weight: 500;
    color: #7c8a98;
}

.filter-group .hint {
    margin-top: 8px;
    margin-left: 0;
}

/* 响应式调整 */
@media (max-width: 640px) {
    .search-section {
        flex-direction: column;
        gap: 12px;
    }

    .action-buttons {
        justify-content: center;
    }

    .hint {
        text-align: center;
    }
}

/* 欢迎引导弹窗样式 */
.welcome-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.welcome-content {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.welcome-content h3 {
    margin: 0 0 16px 0;
    color: #2c3e50;
    font-size: 20px;
    text-align: center;
}

.welcome-body {
    margin-bottom: 20px;
    line-height: 1.6;
    color: #555;
}

.welcome-body strong {
    color: #2c3e50;
}

.welcome-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.welcome-btn {
    background: #5c636a;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.welcome-btn:hover {
    background: #0056b3;
}

.task-link {
    background: #28a745;
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.task-link:hover {
    background: #1e7e34;
}

/* 标签统计弹窗样式 */
.stats-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.stats-modal.hidden {
    display: none;
}

.stats-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    animation: slideInUp 0.3s ease-out;
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.stats-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.5rem;
}

.close-stats-btn {
    background: #988988;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.close-stats-btn:hover {
    background: #796a68;
}

.stats-hint {
    background: #e8f4fd;
    border: 1px solid #bee5eb;
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 1.5rem;
    color: #0c5460;
    font-size: 0.9rem;
}

.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-item {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #e9ecef;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: #2c3e50;
}

.stats-section {
    margin-bottom: 2rem;
}

.stats-section h4 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    border-bottom: 2px solid #3498db;
    padding-bottom: 0.5rem;
}

.stats-table {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e9ecef;
}

.stats-header-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    background: #f8f9fa;
    padding: 0.75rem;
    font-weight: bold;
    color: #2c3e50;
    border-bottom: 1px solid #e9ecef;
}

.stats-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    padding: 0.75rem;
    border-bottom: 1px solid #f1f3f4;
    transition: background-color 0.2s;
}

.stats-row:hover {
    background: #f8f9fa;
}

.stats-row:last-child {
    border-bottom: none;
}

.tag-name,
.combo-name {
    font-weight: 500;
    color: #2c3e50;
}

.tag-count,
.combo-count {
    text-align: center;
    color: #666;
}

.tag-percentage,
.combo-percentage {
    text-align: center;
    color: #27ae60;
    font-weight: 500;
}

.stats-btn {
    background: #907d97;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    margin-left: 0.5rem;
}

.stats-btn:hover {
    background: #917d99;
    transform: translateY(-1px);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@media (max-width: 480px) {
    .welcome-content {
        padding: 20px;
        margin: 20px;
    }

    .welcome-actions {
        flex-direction: column;
    }

    .welcome-btn,
    .task-link {
        text-align: center;
    }

    .stats-content {
        padding: 1.5rem;
        margin: 1rem;
        max-height: 85vh;
    }

    .stats-overview {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .stats-header-row,
    .stats-row {
        grid-template-columns: 1.5fr 1fr 1fr;
        padding: 0.5rem;
        font-size: 0.9rem;
    }

    .stats-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
        margin-left: 0.25rem;
        margin-top: 0.25rem;
    }
}

.error-message {
    text-align: center;
    padding: 20px;
}

.retry-btn {
    padding: 8px 16px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 10px;
}

.retry-btn:hover {
    background: #0056b3;
}

.source-status-header {
    font-weight: bold;
    margin: 15px 0 5px 0;
    color: #333;
}

/* V3 特定样式 */
.tag-category {
    margin-bottom: 16px;
}

.category-title {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    padding: 0 4px;
}

.tag-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    margin: 2px 4px 2px 0;
    border-radius: 20px;
    background: var(--tag-bg, #f3f4f6);
    color: var(--tag-color, #374151);
    border: 1px solid var(--tag-color, #d1d5db);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.tag-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background: var(--tag-color, #374151);
    color: white;
}

.tag-item.active {
    background: var(--tag-color, #374151);
    color: white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* V3 数据源筛选样式 */
.filter-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    margin: 3px;
    border-radius: 20px;
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.filter-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background: #374151;
    color: white;
}

.filter-item.active {
    background: #374151;
    color: white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.tag-emoji {
    font-size: 14px;
    line-height: 1;
}

.tag-label {
    line-height: 1;
}

.tag-count {
    background: rgba(255, 255, 255, 0.3);
    color: inherit;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    min-width: 18px;
    text-align: center;
    line-height: 1.2;
}

.tag-item.active .tag-count {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

.tag-item:hover .tag-count {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .controls {
        padding: 10px;
        gap: 10px;
        flex-direction: column;
    }

    .search-section {
        min-width: auto;
        width: 100%;
        flex-wrap: wrap;
        gap: 6px;
    }

    .filter-section {
        width: 100%;
        gap: 12px;
    }

    .filter-group {
        min-width: auto;
        flex: 1;
    }

    .random-btn,
    .clear-btn {
        flex: 1;
        min-width: 70px;
        font-size: 12px;
    }

    #sort {
        flex: 1;
        min-width: 80px;
    }

    .tag-category {
        margin-bottom: 12px;
    }

    .tag-item {
        font-size: 12px;
        padding: 5px 10px;
    }
}