/* ================================================
   磁力种子搜索 - 纯净新拟态设计 v5.0
   Pure Neumorphism Design System
   ================================================ */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;600;700&display=swap');

/* ========================================
   CSS 变量 - 浅色模式（新拟态核心）
   ======================================== */
:root {
    /* 新拟态背景色 - 浅灰蓝 */
    --neu-bg: #e0e5ec;
    --neu-bg-light: #e8ecf2;
    --neu-bg-dark: #d1d9e6;

    /* 阴影色 */
    --neu-shadow-dark: #a3b1c6;
    --neu-shadow-light: #ffffff;

    /* 文字色 */
    --neu-text: #4a5568;
    --text-primary: #31344b;
    --text-secondary: #5e6478;
    --text-muted: #8a91a8;

    /* 强调色 */
    --accent-primary: #e74c8d;
    --accent-secondary: #6c5ce7;

    /* 新拟态阴影 - 凸起效果 */
    --neu-shadow-convex:
        8px 8px 16px var(--neu-shadow-dark),
        -8px -8px 16px var(--neu-shadow-light);
    --neu-shadow-convex-sm:
        4px 4px 8px var(--neu-shadow-dark),
        -4px -4px 8px var(--neu-shadow-light);
    --neu-shadow-convex-lg:
        12px 12px 24px var(--neu-shadow-dark),
        -12px -12px 24px var(--neu-shadow-light);
    --neu-shadow-convex-xl:
        20px 20px 40px var(--neu-shadow-dark),
        -20px -20px 40px var(--neu-shadow-light);

    /* 新拟态阴影 - 内凹效果 */
    --neu-shadow-concave:
        inset 4px 4px 8px var(--neu-shadow-dark),
        inset -4px -4px 8px var(--neu-shadow-light);
    --neu-shadow-concave-sm:
        inset 2px 2px 4px var(--neu-shadow-dark),
        inset -2px -2px 4px var(--neu-shadow-light);
    --neu-shadow-concave-lg:
        inset 6px 6px 12px var(--neu-shadow-dark),
        inset -6px -6px 12px var(--neu-shadow-light);

    /* 尺寸 */
    --radius-sm: 10px;
    --radius-md: 15px;
    --radius-lg: 20px;
    --radius-xl: 30px;
    --radius-full: 50px;

    /* 动画 */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

/* ========================================
   深色模式
   ======================================== */
[data-theme="dark"] {
    --neu-bg: #2d3748;
    --neu-bg-light: #3d4a5c;
    --neu-bg-dark: #1a202c;

    --neu-shadow-dark: #1a202c;
    --neu-shadow-light: #3d4a5c;

    --neu-text: #cbd5e0;
    --text-primary: #f7fafc;
    --text-secondary: #cbd5e0;
    --text-muted: #a0aec0;
}

/* ========================================
   重置与基础
   ======================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--neu-bg);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    transition: background 0.5s ease, color 0.3s ease;
}

::selection {
    background: var(--accent-primary);
    color: white;
}

/* 滚动条 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--neu-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--neu-shadow-dark);
    border-radius: var(--radius-full);
}

/* ========================================
   装饰性圆球
   ======================================== */
.bg-decoration {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-circle {
    position: absolute;
    border-radius: 50%;
    background: var(--neu-bg);
    box-shadow: var(--neu-shadow-convex);
}

.circle-1 {
    width: 120px;
    height: 120px;
    top: 10%;
    left: 5%;
    opacity: 0.6;
}

.circle-2 {
    width: 80px;
    height: 80px;
    top: 20%;
    right: 8%;
    opacity: 0.5;
}

.circle-3 {
    width: 60px;
    height: 60px;
    bottom: 15%;
    left: 8%;
    opacity: 0.4;
}

.circle-4 {
    width: 100px;
    height: 100px;
    bottom: 10%;
    right: 5%;
    opacity: 0.5;
}

/* ========================================
   主题切换按钮
   ======================================== */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: var(--neu-bg);
    box-shadow: var(--neu-shadow-convex-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
}

.theme-toggle:hover {
    box-shadow: var(--neu-shadow-convex);
}

.theme-toggle:active {
    box-shadow: var(--neu-shadow-concave-sm);
}

.theme-icon {
    position: absolute;
    font-size: 1.3rem;
    transition: all var(--transition-normal);
}

.light-icon {
    opacity: 1;
    transform: scale(1);
}

.dark-icon {
    opacity: 0;
    transform: scale(0.5);
}

[data-theme="dark"] .light-icon {
    opacity: 0;
    transform: scale(0.5);
}

[data-theme="dark"] .dark-icon {
    opacity: 1;
    transform: scale(1);
}

/* ========================================
   主容器
   ======================================== */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    position: relative;
    z-index: 1;
    max-width: 1000px;
    margin: 0 auto;
}

/* ========================================
   头部搜索区
   ======================================== */
.header-section {
    width: 100%;
    text-align: center;
    margin-bottom: 40px;
}

/* Logo */
.logo-wrapper {
    margin-bottom: 20px;
}

.logo-circle {
    width: 80px;
    height: 80px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--neu-bg);
    border-radius: 50%;
    box-shadow: var(--neu-shadow-convex);
}

.logo-icon {
    font-size: 2.5rem;
}

/* 标题 */
.main-title {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: 0.05em;
}

.main-subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 28px;
}

/* ========================================
   搜索框
   ======================================== */
.search-wrapper {
    max-width: 500px;
    margin: 0 auto 24px;
}

.search-box {
    display: flex;
    align-items: stretch;
}

.search-input {
    flex: 1;
    padding: 16px 24px;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--neu-bg);
    border: none;
    border-radius: var(--radius-full) 0 0 var(--radius-full);
    box-shadow: var(--neu-shadow-concave);
    transition: all var(--transition-normal);
}

.search-input:focus {
    outline: none;
    box-shadow: var(--neu-shadow-concave-lg);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-btn {
    padding: 16px 28px;
    font-family: inherit;
    color: var(--text-secondary);
    background: var(--neu-bg);
    border: none;
    border-radius: 0 var(--radius-full) var(--radius-full) 0;
    box-shadow: var(--neu-shadow-convex);
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-btn:hover {
    box-shadow: var(--neu-shadow-convex-lg);
    color: var(--accent-primary);
}

.search-btn:active {
    box-shadow: var(--neu-shadow-concave);
}

.search-btn svg {
    width: 22px;
    height: 22px;
}

/* ========================================
   热门标签
   ======================================== */
.tags-section {
    margin-bottom: 20px;
}

.tags-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.tags-label::before {
    content: '🔥 ';
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.tag-pill {
    padding: 10px 20px;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-secondary);
    background: var(--neu-bg);
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    box-shadow: var(--neu-shadow-convex-sm);
    transition: all var(--transition-normal);
}

.tag-pill:hover {
    box-shadow: var(--neu-shadow-convex);
    color: var(--accent-primary);
}

.tag-pill:active {
    box-shadow: var(--neu-shadow-concave-sm);
}

/* ========================================
   搜索历史
   ======================================== */
.history-section {
    max-width: 500px;
    margin: 0 auto;
    background: var(--neu-bg);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: left;
    box-shadow: var(--neu-shadow-concave);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--neu-shadow-dark);
}

.history-label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.clear-history-btn {
    padding: 6px 12px;
    background: var(--neu-bg);
    border: none;
    color: var(--accent-primary);
    border-radius: var(--radius-full);
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    box-shadow: var(--neu-shadow-convex-sm);
    transition: all var(--transition-fast);
}

.clear-history-btn:hover {
    box-shadow: var(--neu-shadow-convex);
}

.clear-history-btn:active {
    box-shadow: var(--neu-shadow-concave-sm);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--neu-bg);
    border-radius: var(--radius-md);
    cursor: pointer;
    box-shadow: var(--neu-shadow-convex-sm);
    transition: all var(--transition-fast);
}

.history-item:hover {
    box-shadow: var(--neu-shadow-convex);
}

.history-item:active {
    box-shadow: var(--neu-shadow-concave-sm);
}

.history-keyword {
    font-size: 0.95rem;
    color: var(--text-primary);
}

.history-delete {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: color var(--transition-fast);
}

.history-delete:hover {
    color: var(--accent-primary);
}

/* ========================================
   引擎网格区
   ======================================== */
.engines-section {
    width: 100%;
    margin-bottom: 40px;
}

.section-title {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.engines-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
}

/* 引擎卡片 */
.engine-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 16px;
    background: var(--neu-bg);
    border-radius: var(--radius-lg);
    text-decoration: none;
    box-shadow: var(--neu-shadow-convex-sm);
    transition: all var(--transition-normal);
    cursor: pointer;
    position: relative;
    z-index: 2;
}

.engine-card:hover {
    box-shadow: var(--neu-shadow-convex);
    transform: translateY(-4px);
}

.engine-card:active {
    box-shadow: var(--neu-shadow-concave-sm);
    transform: translateY(0);
}

.engine-card .engine-icon {
    font-size: 2rem;
    margin-bottom: 12px;
}

.engine-info {
    text-align: center;
}

.engine-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.engine-tag {
    display: inline-block;
    padding: 3px 10px;
    font-size: 0.7rem;
    color: var(--accent-primary);
    background: var(--neu-bg);
    border-radius: var(--radius-full);
    box-shadow: var(--neu-shadow-concave-sm);
}

/* ========================================
   功能特性条
   ======================================== */
.features-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    margin-bottom: 20px;
}

.feature-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--neu-bg);
    border-radius: var(--radius-full);
    box-shadow: var(--neu-shadow-convex-sm);
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: all var(--transition-normal);
}

.feature-badge:hover {
    box-shadow: var(--neu-shadow-convex);
}

.feature-icon {
    font-size: 1rem;
}

/* ========================================
   页脚
   ======================================== */
.footer {
    margin-top: auto;
    padding: 30px 20px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.copyright {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

.footer-links a {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: var(--accent-primary);
}

.footer-links .divider {
    color: var(--text-muted);
    opacity: 0.5;
}

/* ========================================
   模态框
   ======================================== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    position: relative;
    max-width: 600px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 40px;
    background: var(--neu-bg);
    border-radius: var(--radius-xl);
    box-shadow: var(--neu-shadow-convex-xl);
    animation: slideUp 0.3s ease;
    z-index: 1;
}

.modal-content.modal-sm {
    max-width: 450px;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: var(--neu-bg);
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--neu-shadow-convex-sm);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    color: var(--accent-primary);
    box-shadow: var(--neu-shadow-convex);
}

.modal-close:active {
    box-shadow: var(--neu-shadow-concave-sm);
}

/* 文本模态框样式 */
.modal-text h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent-secondary);
    margin: 20px 0 10px;
}

.modal-text h3:first-child {
    margin-top: 0;
}

.modal-text p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* ========================================
   响应式
   ======================================== */
@media (max-width: 900px) {
    .engines-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .engines-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 14px;
    }

    .engine-card {
        padding: 20px 12px;
    }

    .engine-card .engine-icon {
        font-size: 1.6rem;
    }

    .engine-name {
        font-size: 0.8rem;
    }

    .bg-circle {
        display: none;
    }
}

@media (max-width: 480px) {
    .app-container {
        padding: 30px 16px;
    }

    .logo-circle {
        width: 60px;
        height: 60px;
    }

    .logo-icon {
        font-size: 2rem;
    }

    .main-title {
        font-size: 1.4rem;
    }

    .main-subtitle {
        font-size: 0.85rem;
    }

    .search-box {
        flex-direction: column;
        gap: 12px;
    }

    .search-input {
        border-radius: var(--radius-full);
        padding: 14px 20px;
    }

    .search-btn {
        border-radius: var(--radius-full);
        padding: 14px 24px;
    }

    .tags-container {
        gap: 8px;
    }

    .tag-pill {
        padding: 8px 16px;
        font-size: 0.85rem;
    }

    .engines-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .engine-card {
        padding: 16px 8px;
    }

    .engine-card .engine-icon {
        font-size: 1.4rem;
        margin-bottom: 8px;
    }

    .engine-name {
        font-size: 0.75rem;
    }

    .engine-tag {
        font-size: 0.6rem;
        padding: 2px 8px;
    }

    .features-bar {
        flex-direction: column;
        align-items: center;
    }

    .modal-content {
        padding: 28px 20px;
    }
}

/* ========================================
   减少动画
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========================================
   打印
   ======================================== */
@media print {
    .bg-decoration,
    .theme-toggle,
    .modal {
        display: none !important;
    }

    body {
        background: white !important;
    }

    .engine-card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}
