:root {
    --bg-primary: #fafaf9;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f5f5f4;
    --text-primary: #1c1917;
    --text-secondary: #57534e;
    --text-tertiary: #a8a29e;
    --accent: #dc2626;
    --accent-hover: #b91c1c;
    --accent-light: #fef2f2;
    --accent-glow: rgba(220, 38, 38, 0.15);
    --border: #e7e5e4;
    --border-light: #f5f5f4;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08);
    --shadow-glow: 0 0 60px rgba(220, 38, 38, 0.08);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    --font-sans: "Inter", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
    --font-mono: "JetBrains Mono", "SF Mono", "Fira Code", "Consolas", monospace;
    --transition-fast: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    --max-width: 1100px;
    --nav-height: 64px;
}

[data-theme="dark"] {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #242424;
    --text-primary: #f5f5f4;
    --text-secondary: #c0bdb8;
    --text-tertiary: #78716c;
    --accent: #ef4444;
    --accent-hover: #f87171;
    --accent-light: #1f1115;
    --accent-glow: rgba(239, 68, 68, 0.18);
    --border: #2a2a2a;
    --border-light: #1f1f1f;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 80px rgba(239, 68, 68, 0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    transition: background-color var(--transition-smooth), color var(--transition-smooth);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}
/* 背景装饰光效（iOS Safari 兼容版本） */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    height: 100vh;
    background: radial-gradient(ellipse at 50% 0%, var(--accent-glow) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
    -webkit-backface-visibility: hidden; /* 修复 Safari 渲染问题 */
    backface-visibility: hidden;
}

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: auto;
    min-height: var(--nav-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-smooth);
}
.navbar-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 10px;
    min-height: var(--nav-height);
}
.nav-logo {
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
    color: #e53935;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.nav-logo .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    display: inline-block;
    animation: pulse-dot 2.5s ease-in-out infinite;
}
.nav-logo .logo-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    display: inline-block;
    animation: pulse-dot 2.5s ease-in-out infinite;
}
.nav-logo-img {
    height: 32px;
    width: auto;
    object-fit: contain;
}
@keyframes pulse-dot {
    0%,100% { box-shadow: 0 0 0 0 var(--accent-glow); }
    50% { box-shadow: 0 0 0 10px transparent; }
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.nav-link {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-fast);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}
.nav-link:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.nav-link.active { background: var(--accent-light); color: var(--accent); font-weight: 600; }

.nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
    position: relative;
}
.nav-search-form {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-tertiary);
    border-radius: 999px;
    padding: 4px 4px 4px 14px;
    border: 1.5px solid var(--border);
    transition: border-color var(--transition-fast);
}
.nav-search-form:focus-within { border-color: var(--accent); }
.nav-search-input {
    border: none;
    background: transparent;
    outline: none;
    color: var(--text-primary);
    font-size: 0.85rem;
    width: 120px;
    transition: width var(--transition-fast);
    font-family: var(--font-sans);
}
.nav-search-input:focus { width: 160px; }
.nav-search-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 6px 10px;
    border-radius: 50%;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
}
.nav-search-btn:hover { color: var(--text-primary); }
.nav-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    font-size: 1.15rem;
}
.nav-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }

.hamburger-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    font-size: 1.3rem;
    flex-shrink: 0;
}
.hamburger-btn:hover { background: var(--bg-tertiary); }

.mobile-search-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 1.15rem;
    align-items: center;
    justify-content: center;
}
.mobile-search-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100%;
    background: var(--bg-secondary);
    z-index: 2100;
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
}
.sidebar.show {
    transform: translateX(0);
}
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    min-height: var(--nav-height);
}
.sidebar-logo {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}
.sidebar-logo .dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent);
    display: inline-block;
}
.sidebar-logo .logo-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent);
    display: inline-block;
}
.sidebar-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all var(--transition-fast);
}
.sidebar-close:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.sidebar-body {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}
.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    width: 100%;
    text-align: left;
    text-decoration: none;
    transition: all var(--transition-fast);
    font-family: var(--font-sans);
}
.sidebar-nav-item:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.sidebar-nav-item.active { background: var(--accent-light); color: var(--accent); font-weight: 600; }
.sidebar-divider {
    height: 1px;
    background: var(--border-light);
    margin: 8px 20px;
}
.sidebar-section-title {
    padding: 6px 24px 2px;
    font-size: 0.7rem;
    color: var(--text-tertiary);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sidebar-theme-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: var(--font-sans);
    transition: all var(--transition-fast);
    width: 100%;
}
.sidebar-theme-btn:hover { border-color: var(--accent); background: var(--accent-light); }

.sidebar-contact-wrapper {
    position: relative;
}
.sidebar-contact-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: var(--font-sans);
    transition: all var(--transition-fast);
    width: 100%;
}
.sidebar-contact-btn:hover { border-color: var(--accent); background: var(--accent-light); }
.qr-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 12px;
    display: none;
    z-index: 2200;
    text-align: center;
    white-space: nowrap;
}
.sidebar-contact-wrapper:hover .qr-tooltip {
    display: block;
}
.qr-tooltip img {
    width: 150px;
    height: 150px;
    display: block;
    border-radius: var(--radius-sm);
}
.qr-tooltip span {
    display: block;
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.floating-side {
    position: fixed;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 900;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.floating-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-fast);
    position: relative;
    text-decoration: none;
}
.floating-btn:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}
.floating-contact-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
}
.floating-qr-wrapper {
    position: relative;
}
.floating-qr-tooltip {
    position: absolute;
    right: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 10px;
    display: none;
    z-index: 910;
    text-align: center;
    white-space: nowrap;
}
.floating-qr-wrapper:hover .floating-qr-tooltip {
    display: block;
}
.floating-qr-tooltip img {
    width: 130px;
    height: 130px;
    display: block;
    border-radius: var(--radius-sm);
}
.floating-qr-tooltip span {
    display: block;
    margin-top: 4px;
    font-size: 0.7rem;
    color: var(--text-tertiary);
}

.nav-dropdown-wrapper {
    position: relative;
}
.nav-link.dropdown-toggle {
    cursor: pointer;
}
.nav-link.dropdown-toggle .dropdown-arrow {
    font-size: 0.6rem;
    margin-left: 3px;
    transition: transform var(--transition-fast);
}
.nav-link.dropdown-toggle.open .dropdown-arrow {
    transform: rotate(180deg);
}
.nav-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 220px;
    z-index: 1100;
    display: none;
    padding: 6px 0;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.nav-dropdown.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}
.nav-dropdown-group {
    padding: 8px 16px 4px;
    font-size: 0.7rem;
    color: var(--text-tertiary);
    font-weight: 600;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
.nav-dropdown-divider {
    height: 1px;
    background: var(--border-light);
    margin: 4px 12px;
}
.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    transition: all var(--transition-fast);
    white-space: nowrap;
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-sans);
    width: 100%;
    text-align: left;
}
.nav-dropdown-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}
.nav-dropdown-item .dd-emoji {
    font-size: 0.85rem;
    width: 18px;
    text-align: center;
}

.nav-search-results {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    width: 300px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1100;
    display: none;
    margin-top: 6px;
    padding: 6px 0;
}
.nav-search-results.show { display: block; }
.search-result-item {
    display: block;
    padding: 10px 16px;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition-fast);
}
.search-result-item:last-child {
    border-bottom: none;
}
.search-result-item:hover { background: var(--bg-tertiary); }
.search-result-name {
    font-weight: 600;
    display: block;
}
.search-result-path {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 2px;
    display: block;
}
.search-no-result {
    padding: 12px 16px;
    color: var(--text-tertiary);
    font-size: 0.85rem;
    text-align: center;
}

.back-to-top {
    position: fixed; bottom: 28px; right: 28px; width: 44px; height: 44px; border-radius: 50%;
    background: var(--bg-secondary); border: 1.5px solid var(--border); cursor: pointer;
    z-index: 999; display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; color: var(--text-secondary); box-shadow: var(--shadow-md);
    transition: all var(--transition-fast); opacity: 0; transform: translateY(20px); pointer-events: none;
}
.back-to-top.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.back-to-top:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.toast {
    position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%) translateY(100px);
    background: var(--text-primary); color: var(--bg-primary); padding: 10px 22px;
    border-radius: 999px; font-size: 0.85rem; z-index: 9999; transition: transform var(--transition-smooth);
    box-shadow: var(--shadow-lg);
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast-error { background: #ef4444; color: #fff; }

.copy-btn { background: #fce7f3; color: #be185d; }
.copy-btn.copied { background: #dcfce7; color: #15803d; }

.footer {
    text-align: center; padding: 28px 24px 40px; color: var(--text-tertiary);
    font-size: 0.78rem; margin-top: 20px;
}
.footer a { color: var(--accent); text-decoration: none; }
.footer a:hover { text-decoration: underline; }
.beian-info { margin-top: 8px; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }

@media (max-width: 768px) {
    .navbar-inner {
        flex-wrap: nowrap;
        padding: 0 14px;
        gap: 0;
        min-height: var(--nav-height);
        flex-direction: row;
        align-items: center;
    }
    .nav-menu {
        display: none;
    }
    .hamburger-btn {
        display: flex;
    }
    .nav-logo {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        font-size: 1.1rem;
        z-index: 2;
    }
    .nav-actions {
        margin-left: auto;
        width: auto;
        max-width: 30%;
        justify-content: flex-end;
        flex-wrap: nowrap;
        gap: 4px;
        flex-shrink: 1;
        min-width: 0;
    }
    .nav-search-form {
        padding: 3px 3px 3px 8px;
        width: 100%;
        display: flex;
        align-items: center;
        flex-wrap: nowrap;
    }
    .nav-search-input {
        width: 50px;
        font-size: 0.75rem;
        min-width: 0;
        flex: 1;
    }
    .nav-search-input:focus {
        width: 60px;
    }
    .nav-search-btn {
        padding: 4px 6px;
        font-size: 0.8rem;
        flex-shrink: 0;
    }
    .mobile-search-btn {
        display: none;
    }
    .nav-btn {
        width: 34px;
        height: 34px;
        font-size: 1rem;
    }
    .main-container {
        padding: calc(var(--nav-height) + 24px) 16px 32px;
    }
    .card {
        padding: 22px 16px;
    }
    .hero-name {
        font-size: 1.3rem;
    }
    .hero-tagline {
        font-size: 0.85rem;
    }
    .link-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 8px;
    }
    .link-item {
        padding: 10px 12px;
        font-size: 0.82rem;
    }
    .tool-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .search-form {
        flex-direction: row;
        align-items: center;
        flex-wrap: nowrap;
        gap: 8px;
    }
    .search-engine-select {
        padding: 8px 10px;
        font-size: 0.8rem;
        min-width: 80px;
        max-width: 100px;
        align-self: center;
    }
    .search-input {
        min-width: 0;
        flex: 1;
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    .search-form .btn {
        padding: 8px 14px;
        font-size: 0.8rem;
        white-space: nowrap;
    }
    .section {
        margin-bottom: 20px;
    }
    .badge {
        font-size: 0.72rem;
        padding: 4px 10px;
    }
    .btn {
        padding: 8px 16px;
        font-size: 0.82rem;
    }
    .nav-search-results {
        width: 260px;
        right: 0;
        left: auto;
        max-height: 60vh;
        overflow-y: auto;
    }
    .search-result-path {
        word-break: break-all;
        font-size: 0.7rem;
    }
    .back-to-top {
        bottom: 16px;
        right: 16px;
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }
    .footer {
        padding: 20px 16px 32px;
    }
    .tool-panel-header {
        padding: 10px 14px;
    }
    .tool-panel-title {
        font-size: 0.85rem;
    }
    .floating-btn {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    .floating-side {
        right: 8px;
        gap: 6px;
    }
    .sidebar {
        width: 260px;
    }
}
@media (max-width: 400px) {
    .nav-search-form {
        padding: 3px 3px 3px 10px;
    }
    .nav-search-input {
        width: 60px;
    }
    .nav-search-input:focus {
        width: 80px;
    }
    .link-grid {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    .link-item {
        padding: 8px 10px;
        font-size: 0.78rem;
    }
    .hero-name {
        font-size: 1.3rem;
    }
    .card {
        padding: 16px 12px;
    }
    .main-container {
        padding: calc(var(--nav-height) + 20px) 10px 24px;
    }
}
