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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: linear-gradient(180deg, #f0ede8 0%, #e8e4dd 50%, #ddd8d0 100%);
    min-height: 100vh;
    color: #4a4540;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 60px;
    height: 100vh;
    background: rgba(242, 239, 234, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 15px;
    z-index: 1000;
    border-right: 1px solid #d5d0c8;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.04);
}

.sidebar-logo {
    margin-bottom: 20px;
}

.sidebar-logo a {
    display: block;
}

.sidebar-logo img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
    padding-bottom: 15px;
}

.nav-top {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nav-bottom-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #7a7570;
    text-decoration: none;
    font-size: 11px;
    transition: all 0.3s ease;
    padding: 6px 4px;
    border-radius: 6px;
    width: 40px;
}

.nav-item:hover,
.nav-item.active {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
}

.nav-icon {
    font-size: 18px;
    margin-bottom: 3px;
}

.nav-text {
    font-size: 10px;
}

.main-content {
    margin-left: 60px;
}

.header {
    background: transparent;
    backdrop-filter: none;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: none;
    box-shadow: none;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.menu-btn {
    background: none;
    border: none;
    color: #7a7570;
    font-size: 18px;
    cursor: pointer;
    display: none;
}

.logo-text {
    color: #5a7fa5;
    font-size: 28px;
    font-weight: 700;
    text-decoration: none;
}

.header-nav {
    display: flex;
    gap: 15px;
}

.header-nav a {
    color: #7a7570;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.3s ease;
    padding: 4px 8px;
    border-radius: 4px;
}

.header-nav a:hover {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
}

.theme-toggle {
    background: rgba(155, 150, 140, 0.15);
    border: 1px solid rgba(155, 150, 140, 0.3);
    color: #7a7570;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 6px 10px;
    border-radius: 6px;
}

.theme-toggle:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    color: #3b82f6;
}

/* 首页右上角操作区：主题切换在上，快速切换图标在其下方竖向排列 */
.header-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

/* 快速切换按钮：纯图标显示，后台配置地址后才出现；尺寸与主题切换按钮保持一致 */
.quick-switch {
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 18px;
    line-height: 1;
    color: #7a7570;
}

.quick-switch img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    display: block;
}

.quick-switch:hover {
    background: rgba(59, 130, 246, 0.1);
}

/* 暗色模式样式 */
body.dark-mode {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #f0f0f0;
}

body.dark-mode .sidebar {
    background: rgba(35, 35, 60, 0.7);
    border-right-color: rgba(255, 255, 255, 0.06);
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.2);
}

body.dark-mode .nav-item {
    color: rgba(255, 255, 255, 0.75);
}

body.dark-mode .nav-item:hover,
body.dark-mode .nav-item.active {
    color: #60a5fa;
    background: rgba(59, 130, 246, 0.3);
}

body.dark-mode .header {
    background: transparent;
    border-bottom: none;
    box-shadow: none;
}

body.dark-mode .logo-text {
    color: #fff;
}

body.dark-mode .menu-btn {
    color: rgba(255, 255, 255, 0.8);
}

body.dark-mode .header-nav a {
    color: rgba(255, 255, 255, 0.8);
}

body.dark-mode .header-nav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

body.dark-mode .theme-toggle {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.9);
}

body.dark-mode .theme-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
    color: #fff;
}

body.dark-mode .quick-switch {
    color: rgba(255, 255, 255, 0.9);
}

body.dark-mode .quick-switch:hover {
    background: rgba(255, 255, 255, 0.12);
}

body.dark-mode .site-card {
    background: rgba(45, 45, 75, 0.5);
    color: #f0f0f0;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

body.dark-mode .site-card:hover {
    background: rgba(55, 55, 90, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

body.dark-mode .site-card .site-name {
    color: #fff;
}

body.dark-mode .site-card .site-desc {
    color: #b0b0b0;
}

body.dark-mode .category-title {
    color: #fff;
}

body.dark-mode .footer {
    background: transparent;
    color: #f0f0f0;
    border-top: none;
}

body.dark-mode .footer a {
    color: #a0a0ff;
}

body.dark-mode .quick-tabs {
}

body.dark-mode .quick-tabs .tab {
    color: rgba(255, 255, 255, 0.85);
    background: rgba(40, 40, 70, 0.5);
    border-color: rgba(255, 255, 255, 0.08);
}

body.dark-mode .quick-tabs .tab:hover,
body.dark-mode .quick-tabs .tab.active {
    color: #fff;
    background: rgba(59, 130, 246, 0.4);
    border-color: rgba(59, 130, 246, 0.3);
}

body.dark-mode .banner {
    color: #f0f0f0;
    border-color: rgba(59, 130, 246, 0.2);
}

body.dark-mode .quick-links {
}

body.dark-mode .quick-links a {
    color: rgba(255, 255, 255, 0.85);
    background: rgba(40, 40, 70, 0.5);
    border-color: rgba(255, 255, 255, 0.08);
}

body.dark-mode .quick-links a:hover {
    color: #fff;
    background: rgba(59, 130, 246, 0.4);
    border-color: rgba(59, 130, 246, 0.3);
}

body.dark-mode .quick-links span {
    color: rgba(255, 255, 255, 0.3);
}

body.dark-mode .search-box {
}

body.dark-mode .search-input {
    background: rgba(40, 40, 70, 0.6);
    color: #f0f0f0;
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

body.dark-mode .form-input {
    background: rgba(50, 50, 75, 0.9);
    color: #f0f0f0;
    border-color: rgba(255, 255, 255, 0.2);
}

body.dark-mode .form-input:focus {
    border-color: rgba(102, 126, 234, 0.8);
}

body.dark-mode .page-section {
    background: rgba(35, 35, 60, 0.6);
    color: #f0f0f0;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

body.dark-mode .page-section-title {
    color: #fff;
    border-bottom-color: rgba(102, 126, 234, 0.6);
}

body.dark-mode .page-section-content {
    color: #e0e0e0;
}

body.dark-mode .page-title {
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

body.dark-mode .page-subtitle {
    color: rgba(255, 255, 255, 0.85);
}

body.dark-mode .friend-links {
    background: rgba(35, 35, 60, 0.6);
    color: #f0f0f0;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

body.dark-mode .friend-links h3 {
    color: #fff;
}

body.dark-mode .friend-links a {
    color: #a0a0ff;
}

.hero-section {
    padding: 20px 25px;
    text-align: center;
}

.quick-tabs {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.quick-tabs .tab {
    color: #7a7570;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 8px 16px;
    border-radius: 20px;
    background: rgba(245, 241, 235, 0.9);
    border: 1px solid #e0dbd3;
}

.quick-tabs .tab:hover,
.quick-tabs .tab.active {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.3);
}

.search-box {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
}

.search-input {
    width: 550px;
    height: 44px;
    padding: 0 20px;
    border: none;
    border-radius: 22px 0 0 22px;
    font-size: 15px;
    outline: none;
    background: rgba(245, 241, 235, 0.95);
    color: #4a4540;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    line-height: 44px;
    box-sizing: border-box;
}

.search-input::placeholder {
    color: #b5b0a8;
}

.search-btn {
    height: 44px;
    padding: 0 22px;
    border: none;
    border-radius: 0 22px 22px 0;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    line-height: 44px;
    box-sizing: border-box;
}

.search-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.quick-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.quick-links a {
    color: #7a7570;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 15px;
    background: rgba(245, 241, 235, 0.9);
    border: 1px solid #e0dbd3;
    transition: all 0.3s ease;
}

.quick-links a:hover,
.quick-links a.active {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.3);
}

.quick-links span {
    color: #d0cbc3;
}

.banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(59, 130, 246, 0.08);
    padding: 10px 20px;
    border-radius: 25px;
    color: #3b82f6;
    font-size: 14px;
    max-width: 500px;
    margin: 0 auto 15px;
    border: 1px solid rgba(59, 130, 246, 0.2);
    position: relative;
    overflow: hidden;
}

.banner-list {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.banner-item {
    display: none;
    align-items: center;
    gap: 10px;
}

.banner-item:first-child {
    display: flex;
}

.banner-fade-in {
    animation: bannerFadeIn 0.5s ease-out;
}

@keyframes bannerFadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close-banner {
    background: none;
    border: none;
    color: rgba(59, 130, 246, 0.5);
    font-size: 12px;
    cursor: pointer;
    margin-left: 8px;
    transition: all 0.3s ease;
}

.close-banner:hover {
    color: #3b82f6;
}

.content {
    padding: 0 25px 30px;
}

.category-section {
    background: rgba(242, 238, 232, 0.85);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid #d5d0c8;
}

body.dark-mode .category-section {
    background: rgba(35, 35, 60, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e0dbd3;
}

body.dark-mode .section-header {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.category-title {
    font-size: 15px;
    font-weight: 600;
    color: #3a3530;
    display: flex;
    align-items: center;
    gap: 8px;
}

.more-link {
    color: #3b82f6;
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
}

body.dark-mode .more-link {
    color: #60a5fa;
}

.more-link:hover {
    text-decoration: underline;
    color: #2563eb;
}

.sites-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.site-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 16px 18px;
    background: rgba(240, 236, 228, 0.85);
    border-radius: 10px;
    text-decoration: none;
    color: #4a4540;
    transition: all 0.25s ease;
    border: 1px solid #d5d0c8;
    width: calc(100% / 6 - 12px);
    min-width: 160px;
}

.site-card:hover {
    background: rgba(248, 244, 236, 0.95);
    border-color: #c5c0b8;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

body.dark-mode .site-card {
    background: rgba(45, 45, 75, 0.5);
    color: #f0f0f0;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

body.dark-mode .site-card:hover {
    background: rgba(55, 55, 90, 0.6);
    border-color: rgba(255, 255, 255, 0.1);
}

.site-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    flex-shrink: 0;
    object-fit: cover;
}

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

.site-name {
    font-size: 15px;
    font-weight: 600;
    color: #334155;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-desc {
    font-size: 13px;
    color: #9a9590;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 1px;
}

.card-action {
    display: none;
}

.friend-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.friend-links a {
    color: #3b82f6;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.3s ease;
}

.friend-links a:hover {
    color: #2563eb;
    text-decoration: underline;
}

.friend-links span {
    color: #d5d0c8;
}

.footer {
    background: transparent;
    padding: 25px;
    text-align: center;
    border-top: none;
}

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

.footer-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #3b82f6;
    font-size: 16px;
    font-weight: 600;
}

.footer-logo img {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.footer-info p {
    color: #7a7570;
    font-size: 13px;
    margin-bottom: 5px;
}

.footer-info a {
    color: #3b82f6;
    text-decoration: none;
}

.footer-info a:hover {
    text-decoration: underline;
    color: #2563eb;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 8px;
}

.footer-links a {
    color: #7a7570;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.3s ease;
}

.footer-links a:hover {
    color: #3b82f6;
    text-decoration: underline;
}

.footer-links span {
    color: #d0cbc3;
}

body.dark-mode .footer-links a {
    color: rgba(255, 255, 255, 0.7);
}

body.dark-mode .footer-links a:hover {
    color: #60a5fa;
}

body.dark-mode .footer-links span {
    color: rgba(255, 255, 255, 0.2);
}

@media (max-width: 1200px) {
    .site-card {
        width: calc(100% / 5 - 10px);
    }
}

@media (max-width: 1000px) {
    .site-card {
        width: calc(100% / 4 - 10px);
    }
}

@media (max-width: 800px) {
    .site-card {
        width: calc(100% / 3 - 10px);
    }
}

/* 侧边栏遮罩层 */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
        position: fixed;
        left: 0;
        top: 0;
        width: 220px;
        height: 100vh;
        z-index: 1001;
        flex-direction: column;
        padding-top: 20px;
        transition: transform 0.3s ease;
    }

    .sidebar.mobile-open {
        display: flex;
        transform: translateX(0);
    }

    .sidebar.mobile-hidden {
        display: flex;
        transform: translateX(-100%);
    }

    .main-content {
        margin-left: 0;
    }

    .menu-btn {
        display: block;
    }

    .search-box {
        padding: 0 5px;
    }

    .search-input {
        width: 100% !important;
        max-width: 100% !important;
    }

    .search-form {
        display: flex;
        width: 100%;
    }

    .quick-tabs {
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 5px;
        scrollbar-width: none;
    }

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

    .quick-tabs .tab {
        flex-shrink: 0;
        font-size: 13px;
        padding: 6px 14px;
    }

    .quick-links {
        gap: 8px;
    }

    .quick-links a {
        font-size: 12px;
        padding: 5px 10px;
    }

    .banner {
        font-size: 12px;
        padding: 8px 12px;
        margin: 0 5px 15px;
    }

    .content {
        padding: 0 10px 30px;
    }

    .category-section {
        padding: 14px;
        margin-bottom: 14px;
    }

    .section-header {
        margin-bottom: 10px;
        padding-bottom: 8px;
    }

    .sites-grid {
        gap: 8px;
    }

    .site-card {
        width: calc(100% / 2 - 4px);
        padding: 10px;
        gap: 8px;
        min-width: 0;
    }

    .site-icon {
        width: 24px;
        height: 24px;
        border-radius: 5px;
    }

    .site-name {
        font-size: 13px;
    }

    .site-desc {
        font-size: 11px;
    }

    .hero-section {
        padding: 12px 10px;
    }

    .header {
        padding: 10px 12px;
    }

    .logo-text {
        font-size: 20px;
    }

    .float-buttons {
        right: 12px;
        bottom: 20px;
        gap: 8px;
    }

    .float-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .footer {
        padding: 20px 12px;
    }
}

@media (max-width: 480px) {
    .hero-section {
        padding: 10px 8px;
    }

    .content {
        padding: 0 8px 20px;
    }

    .category-section {
        padding: 12px;
        margin-bottom: 12px;
        border-radius: 10px;
    }

    .category-title {
        font-size: 14px;
    }

    .sites-grid {
        gap: 6px;
    }

    .site-card {
        width: calc(100% / 2 - 3px);
        padding: 8px;
        gap: 6px;
    }

    .site-icon {
        width: 22px;
        height: 22px;
    }

    .site-name {
        font-size: 12px;
    }

    .site-desc {
        font-size: 10px;
    }

    .search-input {
        height: 40px;
        font-size: 14px;
    }

    .search-btn {
        height: 40px;
        padding: 0 16px;
    }

    .quick-tabs {
        gap: 6px;
        margin-bottom: 10px;
    }

    .quick-tabs .tab {
        font-size: 12px;
        padding: 5px 12px;
    }

    .quick-links {
        gap: 6px;
        margin-bottom: 10px;
    }

    .quick-links a {
        font-size: 11px;
        padding: 4px 8px;
    }

    .banner {
        font-size: 11px;
        padding: 6px 10px;
        border-radius: 20px;
    }

    .header {
        padding: 8px 10px;
    }

    .logo-text {
        font-size: 18px;
    }

    .footer-info p {
        font-size: 12px;
    }

    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }

    .friend-links {
        gap: 6px;
    }

    .friend-links a {
        font-size: 12px;
    }
}

@media (max-width: 360px) {
    .site-card {
        padding: 6px;
        gap: 5px;
    }

    .site-icon {
        width: 20px;
        height: 20px;
    }

    .site-name {
        font-size: 11px;
    }

    .site-desc {
        display: none;
    }

    .quick-links a {
        font-size: 10px;
        padding: 3px 6px;
    }
}

img.lazy {
    background: #e8e4dd;
}

body.dark-mode img.lazy {
    background: rgba(45, 45, 75, 0.5);
}