* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: #f5f7fc;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    color: #1e2f3e;
    padding: 28px 24px 48px;
    line-height: 1.4;
}

/* 主容器 */
.nav-container {
    max-width: 1280px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 36px;
    box-shadow: 0 18px 35px -12px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.02);
    overflow: hidden;
    padding: 28px 32px 40px;
    transition: all 0.2s;
}

/* 头部 */
.hero-section {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid #edf2f7;
}
.logo-area {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #f0f6fe, #e6eef8);
    padding: 8px 24px 8px 20px;
    border-radius: 60px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02), inset 0 0 0 1px rgba(255,255,255,0.8);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.logo-area:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.05), inset 0 0 0 1px rgba(255,255,255,0.9);
}
.logo-icon {
    font-size: 1.8rem;
    line-height: 1;
    background: none;
    padding: 0;
    margin-right: 0;
    box-shadow: none;
}
.logo-area h1 {
    font-size: 1.7rem;
    font-weight: 700;
    background: linear-gradient(135deg, #1f5777, #2f7ba6);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    letter-spacing: -0.5px;
    margin: 0;
}
.search-wrapper {
    flex: 1;
    min-width: 260px;
    max-width: 500px;
}
.search-bar {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid #e2eaf1;
    border-radius: 60px;
    padding: 4px 4px 4px 20px;
    transition: 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
.search-bar:focus-within {
    border-color: #2f7ba6;
    box-shadow: 0 4px 14px rgba(47,123,166,0.1);
}
.search-bar input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px 8px;
    font-size: 0.9rem;
    outline: none;
    font-weight: 450;
}
.search-clear {
    display: none;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #eef2f8;
    color: #6b8eaa;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
    margin: 0 4px;
    user-select: none;
}
.search-clear:hover {
    background: #dee5ef;
    color: #2c6282;
}
.search-clear.show {
    display: inline-flex;
}
.search-bar button {
    background: #2f7ba6;
    border: none;
    color: white;
    padding: 0 28px;
    border-radius: 50px;
    font-weight: 500;
    cursor: pointer;
    font-size: 0.85rem;
    transition: 0.2s;
    letter-spacing: 0.3px;
}
.search-bar button:hover {
    background: #1e6288;
}

/* 工具栏 */
.action-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    margin: 16px 0 28px;
    gap: 12px;
}
.stats-group {
    display: flex;
    align-items: center;
    gap: 18px;
    background: #f8fafd;
    padding: 6px 20px 6px 18px;
    border-radius: 48px;
}
.fav-star {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: #e9a23b;
    cursor: pointer;
    transition: 0.1s;
}
.fav-star span:first-child {
    font-size: 1.3rem;
}
.divider-dot {
    width: 4px;
    height: 4px;
    background: #cbdde9;
    border-radius: 50%;
}
.total-count {
    background: #eef2f8;
    padding: 4px 14px;
    border-radius: 40px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #2c6282;
}
.manage-trigger {
    background: #eef2f8;
    padding: 8px 24px;
    border-radius: 40px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
    color: #2c6282;
    display: flex;
    align-items: center;
    gap: 6px;
}
.manage-trigger:hover {
    background: #e3eaf2;
}

/* 收藏夹胶囊 */
.mini-fav-section {
    background: #fefaf5;
    border-radius: 24px;
    padding: 14px 20px;
    margin-bottom: 36px;
    border: 1px solid #ffedd5;
}
.fav-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.fav-header h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: #b45f2b;
    letter-spacing: -0.2px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.clear-fav-btn {
    background: none;
    border: 1px solid #ffe0c0;
    padding: 4px 14px;
    border-radius: 50px;
    font-size: 0.7rem;
    cursor: pointer;
    color: #c5763a;
    transition: 0.1s;
}
.fav-scroll-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    row-gap: 12px;
}
.fav-capsule {
    background: white;
    border-radius: 40px;
    padding: 6px 14px 6px 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #f7e3cf;
    font-size: 0.8rem;
    transition: 0.1s;
    box-shadow: 0 1px 1px rgba(0,0,0,0.02);
}
.fav-capsule a {
    text-decoration: none;
    color: #3a2c1f;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}
.fav-capsule .fav-icon-img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    border-radius: 4px;
}
.fav-capsule .fav-icon-fallback {
    font-size: 0.9rem;
}
.remove-fav-icon {
    background: none;
    border: none;
    font-size: 0.9rem;
    cursor: pointer;
    color: #bf8a60;
    padding: 0 2px;
    line-height: 1;
}
.empty-fav-tip {
    font-size: 0.75rem;
    color: #bc9a78;
    padding: 6px 0;
}

/* 分类区域 */
.categories-area {
    display: flex;
    flex-direction: column;
    gap: 32px;
}
.category-block {
    background: #ffffff;
    border-radius: 28px;
}
.category-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-bottom: 18px;
    padding-bottom: 8px;
    border-bottom: 2px solid #eef2f8;
}
.category-title h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e2f3e;
    display: flex;
    align-items: center;
    gap: 8px;
}
.cat-count {
    background: #eef2fa;
    padding: 2px 12px;
    border-radius: 30px;
    font-size: 0.7rem;
    font-weight: 500;
}
.add-site-mini {
    background: #f4f8fe;
    border: none;
    padding: 5px 18px;
    border-radius: 30px;
    font-size: 0.7rem;
    font-weight: 500;
    cursor: pointer;
    color: #2f7ba6;
    transition: 0.2s;
}
.site-grid-modern {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 12px;
}
.site-card-new {
    background: #fbfdff;
    border: 1px solid #eef2fa;
    border-radius: 24px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
    cursor: pointer;
}
.site-card-new:hover {
    background: white;
    border-color: #cfdfec;
    transform: translateY(-2px);
    box-shadow: 0 10px 18px -8px rgba(0, 0, 0, 0.05);
}
.site-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    overflow: hidden;
}
.site-icon-badge {
    width: 34px;
    height: 34px;
    background: #ecf3f9;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    overflow: hidden;
}
.real-favicon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border-radius: 6px;
}
.site-name-text {
    font-weight: 500;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #2a3e4e;
}
.star-small {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    color: #cfdee9;
    padding: 5px;
    transition: 0.1s;
}
.star-small.active-star {
    color: #f4b642;
    text-shadow: 0 0 2px #ffd9a3;
}

/* 底部链接（电脑端默认） */
.footer-links {
    margin-top: 52px;
    padding-top: 22px;
    border-top: 1px solid #ecf3f8;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 32px;
    font-size: 0.7rem;
}
.footer-links a {
    text-decoration: none;
    color: #6d8eaa;
}
.copyright {
    text-align: center;
    margin-top: 18px;
    font-size: 0.7rem;
    color: #9bb7cf;
}

/* 模态窗 */
.modal-mask {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    visibility: hidden;
    opacity: 0;
    transition: 0.2s;
}
.modal-mask.show {
    visibility: visible;
    opacity: 1;
}
.modal-panel {
    background: #ffffff;
    width: 92%;
    max-width: 600px;
    border-radius: 40px;
    padding: 28px;
    max-height: 85vh;
    overflow-y: auto;
}
.modal-panel input, .modal-panel select {
    width: 100%;
    padding: 10px 16px;
    margin: 6px 0 14px;
    border: 1px solid #e2eaf1;
    border-radius: 32px;
    font-size: 0.9rem;
}
.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 14px;
    margin-top: 24px;
}
.btn-primary {
    background: #2f7ba6;
    color: white;
    border: none;
    padding: 8px 28px;
    border-radius: 40px;
    cursor: pointer;
}
.manage-list {
    max-height: 260px;
    overflow-y: auto;
    margin: 20px 0;
}
.manage-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eff3f8;
    font-size: 0.8rem;
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #2f7ba6, #1f5777);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    z-index: 999;
    backdrop-filter: blur(4px);
    text-decoration: none;
    user-select: none;
}
.back-to-top:hover {
    transform: translateY(-4px);
    background: linear-gradient(135deg, #1e6288, #154a6b);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}
.back-to-top.show {
    opacity: 1;
    visibility: visible;
}
@media (max-width: 768px) {
    .back-to-top {
        display: none;
    }
}

/* ========== 移动端样式 ========== */
@media (max-width: 720px) {
    body {
        padding: 18px;
    }
    .nav-container {
        padding: 20px;
    }
    .site-grid-modern {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
    .category-title h2 {
        font-size: 1.1rem;
    }
    .logo-area {
        padding: 6px 18px 6px 16px;
        gap: 8px;
    }
    .logo-icon {
        font-size: 1.4rem;
    }
    .logo-area h1 {
        font-size: 1.3rem;
    }
    .search-clear {
        width: 24px;
        height: 24px;
        font-size: 0.8rem;
    }
    .search-bar button {
        padding: 0 16px;
        font-size: 0.75rem;
        letter-spacing: normal;
        white-space: nowrap;
    }
    .site-icon-badge {
        width: 28px;
        height: 28px;
        font-size: 1rem;
    }
    .real-favicon {
        width: 20px;
        height: 20px;
    }
    /* 移动端底部链接：两行两列布局 */
    .footer-links {
        display: grid;
        grid-template-columns: repeat(2, auto);
        justify-content: center;
        gap: 8px 20px;
        font-size: 0.65rem;
        white-space: nowrap;
        margin-top: 32px;
        padding-top: 16px;
    }
    .footer-links a {
        white-space: nowrap;
    }
}