/* ========== CSS 变量 ========== */
:root {
    --bg: #f9fafb;
    --surface: #ffffff;
    --text: #1a1a2e;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.09), 0 4px 8px rgba(0, 0, 0, 0.04);
    --accent: #374151;
    --accent-hover: #1f2937;
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --transition: 0.2s ease;
    --max-width: 1100px;
}

/* ========== 全局重置 ========== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial,
        sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ========== 容器 ========== */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem 1.25rem 3rem;
}

/* ========== 头部 ========== */
.header {
    text-align: center;
    padding: 2rem 0 1.5rem;
}

.site-title {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    margin-bottom: 0.35rem;
}

.site-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

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

.search-input {
    width: 100%;
    padding: 0.7rem 1rem 0.7rem 2.6rem;
    font-size: 0.95rem;
    border: 1.5px solid var(--border);
    border-radius: 50px;
    background: var(--surface);
    color: var(--text);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

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

.search-input:focus {
    border-color: #9ca3af;
    box-shadow: 0 0 0 3px rgba(156, 163, 175, 0.15);
}

.search-icon {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* ========== 卡片网格 ========== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

/* ========== 卡片 ========== */
.card {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 1.15rem 1.2rem;
    background: var(--surface);
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius);
    text-decoration: none;
    color: inherit;
    transition: all var(--transition);
    position: relative;
    cursor: pointer;
}

.card:hover {
    border-color: #d1d5db;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

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

.card-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: var(--border-light);
    border-radius: var(--radius-sm);
    line-height: 1;
}

.card-body {
    flex: 1;
    min-width: 0;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ========== 空状态 & 错误 ========== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    gap: 0.75rem;
    font-size: 0.95rem;
    text-align: center;
}

.error-msg {
    text-align: center;
    padding: 2rem;
    color: #b91c1c;
    background: #fef2f2;
    border-radius: var(--radius);
    font-size: 0.9rem;
    grid-column: 1 / -1;
}

/* ========== 底部 ========== */
.footer {
    text-align: center;
    margin-top: 2.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .container {
        padding: 1.25rem 0.85rem 2rem;
    }
    .site-title {
        font-size: 1.5rem;
    }
    .site-subtitle {
        font-size: 0.85rem;
    }
    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 0.75rem;
    }
    .card {
        padding: 1rem;
        gap: 0.7rem;
    }
    .card-icon {
        width: 38px;
        height: 38px;
        font-size: 1.25rem;
    }
    .card-title {
        font-size: 0.88rem;
    }
    .card-desc {
        font-size: 0.78rem;
    }
}

@media (max-width: 480px) {
    .card-grid {
        grid-template-columns: 1fr;
    }
    .header {
        padding: 1rem 0 1rem;
    }
    .search-input {
        font-size: 0.88rem;
        padding: 0.6rem 0.9rem 0.6rem 2.4rem;
    }
    .site-title {
        font-size: 1.3rem;
    }
}