/* ==========================================================
   site.css — 全站公共样式
   抽取自各页面模板的重复部分：
   变量/重置/背景/顶部导航/页头/footer/PWA悬浮按钮/登录注册卡片
   页面专属样式在各模板的 {% block extra_css %} 中定义
   ========================================================== */

:root {
    --primary: #6366f1;
    --secondary: #ec4899;
    --accent: #06b6d4;
    --bg-light: #f8fafc;
    --card-white: rgba(255, 255, 255, 0.7);
    --text-dark: #1e293b;
    --text-muted: #64748b;
}

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

body {
    background-color: var(--bg-light);
    color: var(--text-dark);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", "PingFang SC", sans-serif;
    overflow-x: hidden;
    min-height: 100vh;
}

/* 活泼的弥散背景 */
.mesh-bg {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
    background:
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(236, 72, 153, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.15) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(250, 204, 21, 0.1) 0px, transparent 50%);
    filter: blur(100px);
}

/* ---------- 顶部导航（全站一致） ---------- */
.top-nav {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(255, 255, 255, 0.55);
    border-bottom: 1px solid rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(16px) saturate(180%);
}
.top-nav .nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.nav-center {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 900;
    letter-spacing: -0.5px;
    color: var(--text-dark);
    text-decoration: none;
    user-select: none;
}
.brand-mark {
    height: 34px;
    display: grid;
    place-items: center;
    overflow: hidden;
}
.brand-mark img {
    height: 100%;
    width: auto;
    max-width: 120px;
    object-fit: contain;
    display: block;
}
.brand-text { font-size: 1.05rem; }
/* 导航链接：轻量文字链接风格，与右侧按钮明显区分 */
.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 0;
    justify-content: center;
}
.nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: 0.2s;
}
.nav-link:hover { color: var(--text-dark); background: rgba(0, 0, 0, 0.04); }
.nav-link.active {
    color: var(--primary);
    background: transparent;
    font-weight: 700;
    box-shadow: none;
    border-radius: 0;
    padding-bottom: 8px;
    position: relative;
}
.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 2px;
    background: var(--primary);
    border-radius: 1px;
}
/* 登录/注册：明确按钮造型，与导航区分 */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-dark);
    background: #fff;
    transition: 0.2s;
    white-space: nowrap;
}
.nav-btn:hover { background: #f8fafc; border-color: var(--text-dark); }
.nav-btn.primary {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 55%, #ec4899 100%);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}
.nav-btn.primary:hover { filter: brightness(1.05); }
.nav-btn.current {
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary);
    border-color: rgba(99, 102, 241, 0.35);
    cursor: default;
}
.nav-btn.primary.current { cursor: default; }

/* ---------- 页面通用页头（badge + 渐变大标题） ---------- */
header { text-align: center; margin-bottom: 28px; }
header .badge {
    display: inline-block;
    padding: 6px 16px;
    background: #fff;
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--primary);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 14px;
}
header h1 {
    font-size: clamp(2rem, 6vw, 3rem);
    font-weight: 900;
    line-height: 1.12;
    letter-spacing: -1.5px;
    background: linear-gradient(135deg, #4f46e5 0%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}
header p { color: var(--text-muted); }

/* ---------- 页脚 ---------- */
footer {
    margin-top: 48px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    opacity: 0.85;
    padding: 0 24px 40px;
}

/* ---------- PWA 安装悬浮按钮（仅移动端展示） ---------- */
.pwa-install-fab {
    position: fixed;
    right: 16px;
    bottom: 20px;
    z-index: 40;
    display: none;
    padding: 10px 14px;
    border-radius: 999px;
    border: none;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 55%, #ec4899 100%);
    color: #f9fafb;
    font-size: 0.86rem;
    font-weight: 600;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.35);
    cursor: pointer;
}
.pwa-install-fab span { margin-left: 4px; }

/* ---------- 登录/注册共用：卡片、表单、Tab、QQ按钮 ---------- */
.auth-card {
    max-width: 520px;
    margin: 0 auto;
    background: var(--card-white);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 28px;
    padding: 26px;
    backdrop-filter: blur(20px) saturate(180%);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.03);
}
.auth-tabs {
    display: flex;
    justify-content: center;
    gap: 48px;
    padding: 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.35);
}
.auth-tab {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    padding: 10px 4px 14px;
    position: relative;
}
.auth-tab.active { color: var(--primary); }
.auth-tab.active::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: var(--primary);
    border-radius: 1px;
}
.auth-panel { display: none; }
.auth-panel.is-active { display: block; }
.qq-auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    border-radius: 16px;
    cursor: pointer;
    transition: 0.2s ease;
    text-decoration: none;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 55%, #ec4899 100%);
}
.qq-auth-btn:hover {
    border-color: rgba(99, 102, 241, 0.55);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}
.qq-auth-btn img { width: auto; height: 24px; }
.qq-auth-btn span { font-weight: 600; color: #ffffff; }
.qq-auth-hint {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.auth-lead {
    text-align: center;
    margin: 8px 0 10px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.field { display: grid; gap: 8px; margin-bottom: 14px; }
.label { font-weight: 900; letter-spacing: -0.3px; }
.input {
    width: 100%;
    border: 1px solid rgba(99, 102, 241, 0.18);
    background: rgba(255, 255, 255, 0.85);
    border-radius: 16px;
    padding: 12px 14px;
    font-size: 1rem;
    outline: none;
    transition: 0.2s ease;
}
.input:focus {
    border-color: rgba(99, 102, 241, 0.55);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}
.help { color: var(--text-muted); font-size: 0.92rem; line-height: 1.5; }

/* 密码输入框 + 可见切换按钮（login/register 共用） */
.pwd-field { position: relative; }
.pwd-field .input { padding-right: 48px; }
.pwd-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: 10px;
    transition: 0.2s;
}
.pwd-toggle:hover { color: var(--primary); background: rgba(99, 102, 241, 0.08); }
.pwd-toggle .eye-off { display: none; }
.pwd-toggle.is-show .eye-on { display: none; }
.pwd-toggle.is-show .eye-off { display: block; }
.row { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin: 10px 0 16px; }
.link { color: #4f46e5; text-decoration: none; font-weight: 900; cursor: pointer; }
.link:hover { text-decoration: underline; }
.btn, .btn-secondary {
    width: 100%;
    border: none;
    height: 46px;
    border-radius: 18px;
    font-weight: 900;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 55%, #ec4899 100%);
    box-shadow: 0 14px 28px rgba(99, 102, 241, 0.25);
    transition: 0.2s ease;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.btn:active { transform: scale(0.99); }
.btn-secondary {
    width: auto;
    padding: 0 14px;
    background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
    box-shadow: 0 10px 22px rgba(14, 165, 233, 0.35);
}
.msg {
    margin-top: 12px;
    min-height: 1.4em;
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--text-muted);
}
.msg.success { color: #16a34a; }
.msg.error { color: #ef4444; }

/* ---------- 响应式（导航部分全站一致） ---------- */
@media (max-width: 900px) {
    .top-nav .nav-inner { padding: 12px 16px; }
    .nav-link { padding: 9px 14px; font-size: 1rem; }
    .nav-center { gap: 12px; }
    .nav-btn { padding: 9px 12px; font-size: 1rem; }
}

@media (max-width: 768px) {
    .pwa-install-fab {
        display: inline-flex;
        align-items: center;
    }
}

@media (max-width: 640px) {
    /* 移动端导航优化 */
    .top-nav .nav-inner {
        padding: 10px 12px;
        gap: 8px;
    }
    header h1 { font-size: 24px; }
    .nav-center {
        flex-direction: row;
        gap: 8px;
    }
    .nav-links {
        order: 2;
        width: 100%;
        justify-content: center;
        gap: 4px;
        margin: 4px 0;
    }
    .nav-link {
        padding: 4px 10px;
        font-size: 0.8rem;
    }
    .nav-actions {
        order: 3;
        width: 100%;
        justify-content: flex-end;
        gap: 4px;
    }
    .nav-btn {
        padding: 4px 8px;
        font-size: 0.75rem;
    }
    .auth-card { padding: 22px; }
}
