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

:root {
    --background: #ffffff;
    --foreground: #0f172a;
    --card: #ffffff;
    --primary: #2563eb;
    --primary-foreground: #f8fafc;
    --primary-hover: #1d4ed8;
    --secondary: #f1f5f9;
    --secondary-foreground: #0f172a;
    --muted: #f1f5f9;
    --muted-foreground: #64748b;
    --border: #e2e8f0;
    --input: #ffffff;
    --ring: #2563eb;
    --radius: 0.5rem;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
}

@media (prefers-color-scheme: dark) {
    :root {
        --background: #0f172a;
        --foreground: #f8fafc;
        --card: #1e293b;
        --primary: #3b82f6;
        --primary-foreground: #f8fafc;
        --primary-hover: #2563eb;
        --secondary: #1e293b;
        --secondary-foreground: #f8fafc;
        --muted: #1e293b;
        --muted-foreground: #94a3b8;
        --border: #334155;
        --input: #1e293b;
        --ring: #3b82f6;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background-color: var(--background);
    color: var(--foreground);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s, color 0.3s;
}

/* ===== 公共布局 ===== */
.main { flex: 1; padding: 2rem 1rem; }
.container { margin: 0 auto; }

/* ===== 公共组件 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}
.btn-primary { background-color: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover:not(:disabled) { background-color: var(--primary-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-full { width: 100%; }

/* ===== 渐变标题 ===== */
.gradient-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary), #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== 加载动画 ===== */
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.loading-spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background-color: var(--primary);
    color: var(--primary-foreground);
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1001;
    display: none;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
}
.toast.show { display: block; opacity: 1; transform: translateX(0); }

/* ===== 导航栏 ===== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 50;
    width: 100%;
    border-bottom: 1px solid var(--border);
    background-color: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

@media (prefers-color-scheme: dark) {
    .navbar { background-color: rgba(15, 23, 42, 0.95); }
}

.navbar-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 4rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--foreground);
    font-weight: 600;
    font-size: 1.125rem;
}

.logo-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    background: linear-gradient(135deg, var(--primary), #3b82f6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link {
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--muted-foreground);
    transition: all 0.2s;
    font-weight: 500;
}

.nav-link:hover,
.nav-link.active {
    color: var(--foreground);
    background-color: var(--muted);
}

.mobile-menu-toggle {
    display: none;
}

@media (max-width: 768px) {
    .nav-links {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        background: var(--background);
        border: 1px solid var(--border);
        border-top: none;
        border-radius: 0 0 12px 12px;
        padding: 1rem;
        flex-direction: column;
        gap: 0.5rem;
        z-index: 1000;
        transform: translateY(-100vh);
        transition: transform 0.3s ease;
    }

    .nav-links.active {
        transform: translateY(0);
    }

    .mobile-menu-toggle {
        display: block;
        background: none;
        border: none;
        color: var(--foreground);
        font-size: 1.5rem;
        cursor: pointer;
        padding: 0.5rem;
        border-radius: var(--radius);
        transition: background-color 0.2s;
    }

    .mobile-menu-toggle:hover {
        background-color: var(--muted);
    }

    .navbar-container {
        justify-content: space-between;
    }
}

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

.github-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--muted-foreground);
    text-decoration: none;
    transition: color 0.2s;
}

.github-link:hover {
    color: var(--foreground);
}
