:root {
    --bg: #f5f5f5;
    --bg-card: #ffffff;
    --bg-card-hover: #ffffff;
    --bg-section: #f5f5f5;
    --border: #e5e6eb;
    --border-light: #ebecee;
    --text: #1d2129;
    --text2: #4e5969;
    --text3: #616a76;
    --accent: #4f6ef7;
    --accent-light: #eef1ff;
    --accent-hover: #3b5de7;
    --free: #00b42a;
    --free-bg: rgba(0,180,42,0.06);
    --intl: #ff7d00;
    --intl-bg: rgba(255,125,0,0.06);
    --radius: 10px;
}

[data-theme="dark"] {
    --bg: #1a1a1d;
    --bg-card: #26262a;
    --bg-card-hover: #26262a;
    --bg-section: #1a1a1d;
    --border: #363639;
    --border-light: #363639;
    --text: #e5e6eb;
    --text2: #a9a9b2;
    --text3: #7a7a84;
    --accent: #7b93f7;
    --accent-light: rgba(123,147,247,0.08);
    --accent-hover: #6078e0;
    --free: #23c343;
    --free-bg: rgba(35,195,67,0.08);
    --intl: #ff9a2e;
    --intl-bg: rgba(255,154,46,0.08);
    --radius: 10px;
}

[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }
.icon-moon { display: none; }

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    transition: background 0.3s, color 0.3s;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ===== Header ===== */
.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 48px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text);
}

.logo-icon {
    width: 30px; height: 30px;
    background: linear-gradient(135deg, #4f6ef7, #7c5cf7);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.logo-text {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-ai-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s;
}

.header-ai-btn:hover { background: var(--accent-hover); }

.theme-btn {
    width: 30px; height: 30px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.theme-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ===== Filter Bar ===== */
.filter-bar {
    padding: 12px 0 8px;
}

.filter-bar.stuck {
    position: sticky;
    top: 48px;
    z-index: 90;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.filter-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 24px;
}

.filter-search {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    max-width: 360px;
    width: 100%;
    transition: border-color 0.2s;
}

.filter-search:focus-within { border-color: var(--accent); }
.filter-search svg { color: var(--text3); flex-shrink: 0; }

.filter-search input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 13px;
    outline: none;
    font-family: inherit;
    min-width: 0;
}

.filter-search input::placeholder { color: var(--text3); }

.filter-clear {
    background: transparent;
    border: none;
    color: var(--text3);
    width: 16px; height: 16px;
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.filter-clear:hover { background: var(--accent); color: #fff; }

.filter-stats { font-size: 12px; color: var(--text3); }

/* ===== Content Sections ===== */
.content {
    max-width: 960px;
    margin: 0 auto;
    padding: 4px 24px 40px;
}

.section {
    margin-bottom: 16px;
}

.section-header {
    background: var(--bg-section);
    border: none;
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 10px 14px 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.section-icon {
    display: flex;
    align-items: center;
    color: var(--accent);
    font-size: 18px;
}

.section-icon svg { width: 18px; height: 18px; }

.section-line {
    width: 1px;
    height: 12px;
    background: var(--border);
}

.section-tabs {
    display: flex;
    gap: 2px;
    flex: 1;
    overflow-x: auto;
    scrollbar-width: none;
}

.section-tabs::-webkit-scrollbar { display: none; }

.section-tab {
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--text2);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.section-tab:hover { color: var(--accent); background: var(--accent-light); }
.section-tab.tab-active { color: #fff; background: var(--accent); }

.section-desc {
    font-size: 12px;
    color: var(--text3);
    font-style: italic;
}

.section-body {
    background: var(--bg-section);
    border: none;
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 4px;
}

/* ===== Site Grid ===== */
.site-grid {
    display: flex;
    flex-wrap: wrap;
}

.site-card {
    width: 20%;
    display: flex;
    align-items: center;
    padding: 4px;
    text-decoration: none;
    color: inherit;
    overflow: hidden;
}

.site-card-inner {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 5px 6px;
    border-radius: 8px;
    background: var(--bg-card);
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    transition: all 0.2s;
    overflow: hidden;
}

.site-card-inner:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.site-icon-wrap {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    margin: 0 8px 0 3px;
    position: relative;
    display: flex;
    align-items: center;
}

.site-card-inner:hover .site-icon-wrap img {
    animation: jumps 1.2s ease 1;
}

@keyframes jumps {
    0% { transform: translate(0) }
    10% { transform: translateY(8px) scaleX(1.2) scaleY(0.8) }
    30% { transform: translateY(-5px) scaleX(1) scaleY(1) rotate(5deg) }
    50% { transform: translateY(3px) scale(1) rotate(0) }
    55% { transform: translateY(0) scaleX(1.1) scaleY(0.9) rotate(0) }
    70% { transform: translateY(-5px) scaleX(1) scaleY(1) rotate(-2deg) }
    80% { transform: translateY(0) scaleX(1) scaleY(1) rotate(0) }
    85% { transform: translateY(0) scaleX(1.05) scaleY(0.95) rotate(0) }
    to { transform: translateY(0) scaleX(1) scaleY(1) }
}

.site-favicon {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    object-fit: contain;
}

.site-emoji {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    background: var(--border-light);
    align-items: center;
    justify-content: center;
    font-size: 13px;
    position: absolute;
    top: 0;
    left: 0;
}

.site-info { flex: 1; min-width: 0; overflow: hidden; }

.site-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 3px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    margin-bottom: 3px;
}

.site-card:hover .site-name { color: var(--accent); }

.site-card:hover .site-card-inner { color: var(--accent); }

.free-tag {
    font-size: 9px;
    font-weight: 600;
    color: var(--free);
    background: var(--free-bg);
    padding: 0 3px;
    border-radius: 2px;
    line-height: 1.4;
    flex-shrink: 0;
}

.intl-tag {
    font-size: 9px;
    font-weight: 600;
    color: var(--intl);
    background: var(--intl-bg);
    padding: 0 3px;
    border-radius: 2px;
    line-height: 1.4;
    flex-shrink: 0;
}

.site-desc {
    font-size: 10px;
    color: var(--text3);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== Back Top ===== */
.back-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 36px; height: 36px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(79,110,247,0.25);
    z-index: 99;
}

.back-top.visible { opacity: 1; visibility: visible; }
.back-top:hover { transform: translateY(-2px); }

/* ===== Footer ===== */
.footer {
    border-top: 1px solid var(--border);
    padding: 16px 0;
    text-align: center;
}

.footer-notice {
    font-size: 12px;
    color: var(--text3);
    margin-bottom: 4px;
}

.footer-copy {
    font-size: 12px;
    color: var(--text3);
    opacity: 0.5;
}

/* ===== Responsive ===== */
@media (max-width: 1000px) {
    .site-card { width: 25%; }
}

@media (max-width: 768px) {
    .site-card { width: 33.33%; }
    .section-desc { display: none; }
    .section-line { display: none; }
}

@media (max-width: 480px) {
    .container { padding: 0 10px; }
    .content { padding: 4px 10px 40px; }
    .site-card { width: 50%; }
    .site-card-inner { padding: 5px 6px; }
    .section-header { padding: 8px 10px 4px; }
    .section-title { font-size: 14px; }
    .filter-inner { padding: 0 10px; }
    .filter-search { max-width: 100%; }
}
