/* === 陆筒工作室 - 全局样式 === */

:root {
    --bg: #FDFBF7;
    --surface: #F5F2EC;
    --surface-hover: #EDE8DE;
    --text: #4A4540;
    --text-dim: #6D665E;
    --accent: #8CB4C5;
    --accent-text: #5F8CA0;
    --accent-glow: rgba(140, 180, 197, 0.3);
    --accent2: #C9A96E;
    --border: #E5E0D8;
    --radius: 12px;
    --shadow: 0 4px 24px rgba(74, 69, 64, 0.12);
    --nav-bg: rgba(253, 251, 247, 0.92);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Noto Sans SC', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent2); }

/* === 入场动画 === */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(140,180,197,0.4); }
    50%      { box-shadow: 0 0 0 12px rgba(140,180,197,0); }
}
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
}
@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
@keyframes borderGlow {
    0%, 100% { border-color: var(--border); }
    50%      { border-color: var(--accent); }
}

/* === 背景动画 - 柔和渐变 === */
.bg-particles {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(140,180,197,0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(201,169,110,0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(140,180,197,0.04) 0%, transparent 50%);
    animation: fadeIn 1.5s ease-out;
}

/* === 导航栏 === */
.navbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
    display: flex; align-items: center; justify-content: space-between;
    height: 60px;
    transition: box-shadow var(--dur-base) var(--ease-out);
}
/* 滚动后阴影增强层次（由 main.js 的滚动监听添加 .scrolled） */
.navbar.scrolled { box-shadow: 0 2px 16px rgba(74, 69, 64, 0.08); }
.nav-logo {
    font-size: 1.25rem; font-weight: 900; color: var(--text);
    letter-spacing: 0.05em;
    display: flex; align-items: center; gap: 0.5rem;
}
.nav-logo img { height: 32px; width: 32px; border-radius: 50%; object-fit: cover; }
.nav-logo span { color: var(--accent-text); }
.nav-logo small {
    font-size: 0.6rem; font-weight: 400; letter-spacing: 0.12em;
    color: var(--text-dim); text-transform: uppercase;
}
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a {
    color: var(--text-dim); font-size: 0.9rem;
    transition: color 0.3s; font-weight: 400;
    position: relative; padding: 0.3rem 0;
}
.nav-links a::after {
    content: ''; position: absolute; bottom: 0; left: 0;
    width: 0; height: 2px; background: var(--accent);
    border-radius: 2px; transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-links a i {
    display: block; font-style: normal; font-size: 0.6rem;
    letter-spacing: 0.08em; opacity: 0.5; margin-top: 1px;
}
.nav-links a:hover::after,
.nav-links a.active::after { width: 100%; }
.nav-links a:hover,
.nav-links a.active { color: var(--text); }
.nav-user { display: flex; align-items: center; gap: 0.75rem; }
.nav-user .btn {
    padding: 0.4rem 1rem; font-size: 0.85rem;
    border-radius: 6px; cursor: pointer; border: none;
    transition: all 0.2s;
}
.btn-login {
    background: transparent; color: var(--text); border: 1px solid var(--border) !important;
}
.btn-login:hover { border-color: var(--accent) !important; color: var(--accent); }
.btn-register {
    background: var(--accent-text); color: #fff;
}
.btn-register:hover { background: #4E7588; }
.btn-logout {
    background: transparent; color: var(--text-dim); border: 1px solid var(--border) !important;
    font-size: 0.8rem; padding: 0.35rem 0.8rem;
}
.btn-logout:hover { border-color: var(--accent) !important; color: var(--accent); }
.user-greeting { font-size: 0.85rem; color: var(--text-dim); }
.nav-avatar-wrap { display: inline-flex; align-items: center; vertical-align: middle; }
.nav-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.nav-avatar-fallback {
    width: 32px; height: 32px; border-radius: 50%; background: var(--accent2);
    color: #fff; font-weight: 700; font-size: 0.85rem;
    display: flex; align-items: center; justify-content: center;
}
.admin-link {
    font-size: 0.8rem; color: var(--accent2); text-decoration: none;
    margin-right: 12px; font-weight: 600; transition: opacity 0.2s;
}
.admin-link:hover { opacity: 0.8; }

/* === 主体内容 === */
.main-content {
    position: relative; z-index: 1;
    padding-top: 100px;
    max-width: 1280px; margin: 0 auto;
    padding-left: 2rem; padding-right: 2rem;
    padding-bottom: 4rem;
}

/* === Hero 区域 === */
.hero {
    text-align: center; padding: 3rem 0 4rem;
}
.hero-logo {
    max-width: 200px; height: auto; margin: 0 auto 1.5rem;
    display: block;
    animation: fadeInUp 0.8s ease-out both;
}
.hero h1 {
    font-size: 3.5rem; font-weight: 900; letter-spacing: 0.06em;
    line-height: 1.2; margin-bottom: 1rem;
    animation: fadeInUp 0.8s 0.15s ease-out both;
}
.hero h1 .highlight { color: var(--accent); position: relative; }
.hero h1 .highlight::after {
    content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 6px;
    background: var(--accent); opacity: 0.3; border-radius: 3px;
}
.hero-en {
    font-size: 0.85rem; color: var(--text-dim); letter-spacing: 0.15em;
    text-transform: uppercase; margin-bottom: 1.5rem;
    animation: fadeInUp 0.8s 0.25s ease-out both;
}
.hero .subtitle {
    font-size: 1.1rem; color: var(--text-dim);
    max-width: 500px; margin: 0 auto 1.5rem;
    animation: fadeInUp 0.8s 0.3s ease-out both;
}
.hero-tagline {
    font-size: 0.95rem; color: var(--accent);
    font-style: italic; margin-bottom: 2rem;
    animation: fadeInUp 0.8s 0.4s ease-out both;
}
.hero-tagline span {
    display: block; font-size: 0.75rem; color: var(--text-dim);
    font-style: normal; letter-spacing: 0.04em; margin-top: 0.3rem; opacity: 0.7;
}
.hero-actions {
    display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap;
    animation: fadeInUp 0.8s 0.45s ease-out both;
}

.btn-primary {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.75rem 2rem; border-radius: 8px;
    background: linear-gradient(135deg, var(--accent), #7BA3B4);
    color: #fff; font-weight: 700;
    font-size: 1rem; border: none; cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none; position: relative; overflow: hidden;
}
.btn-primary::before {
    content: ''; position: absolute; top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.6s;
}
.btn-primary:hover::before { left: 100%; }
.btn-primary:hover {
    color: #fff;
    box-shadow: 0 8px 32px rgba(140,180,197,0.45);
    transform: translateY(-3px);
}
.btn-primary:active { transform: translateY(-1px); }
.btn-secondary {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.75rem 2rem; border-radius: 8px;
    background: transparent; color: var(--text);
    border: 2px solid var(--border); font-weight: 700;
    font-size: 1rem; cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
}
.btn-secondary:hover {
    border-color: var(--accent); color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(140,180,197,0.15);
}

/* === 区块标题 === */
.section-title {
    font-size: 1.8rem; font-weight: 900; margin-bottom: 2rem;
    display: flex; align-items: center; gap: 0.75rem;
    animation: fadeInUp 0.6s ease-out both;
}
.section-title::before {
    content: ''; display: inline-block;
    width: 4px; height: 28px; background: var(--accent); border-radius: 2px;
    transition: height 0.3s;
}
.section-title:hover::before { height: 36px; }

/* === 作品集搜索 === */
.gallery-search {
    position: relative;
    max-width: 480px;
    margin-bottom: 2rem;
}
.gallery-search input {
    width: 100%;
    padding: 14px 20px 14px 44px;
    background: var(--surface);
    border: 2px solid transparent;
    border-radius: 50px;
    color: var(--text);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
}
.gallery-search::before {
    content: '🔍'; position: absolute; left: 16px; top: 50%;
    transform: translateY(-50%); font-size: 0.9rem; z-index: 2;
    transition: transform 0.3s;
}
.gallery-search:focus-within::before { transform: translateY(-50%) scale(1.15); }
.gallery-search input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(140,180,197,0.12), 0 4px 24px rgba(140,180,197,0.12);
    background: var(--surface-hover);
}

/* === 作品集网格 === */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}
.gallery-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
}
.gallery-card-link {
    display: block; color: inherit; text-decoration: none;
}
.gallery-download {
    position: absolute; top: 10px; right: 10px; z-index: 2;
    background: rgba(253, 251, 247, 0.92); color: var(--text-dim);
    border: 1px solid var(--border); border-radius: 6px;
    padding: 6px 12px; min-height: 32px; font-size: 0.78rem;
    text-decoration: none; transition: all 0.2s;
}
.gallery-download:hover { color: var(--accent); border-color: var(--accent); }
.gallery-card:hover {
    border-color: var(--accent);
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 16px 48px rgba(140,180,197,0.25), 0 0 0 1px rgba(140,180,197,0.3);
}
.card-image {
    width: 100%; height: 200px; background: var(--surface-hover);
    display: flex; align-items: center; justify-content: center;
    font-size: 3rem; color: var(--text-dim);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}
.card-image img {
    width: 100%; height: 100%; object-fit: contain;
}
.gallery-card:hover .card-image { transform: scale(1.05); }
.card-body { padding: 1.25rem; }
.card-body .card-tag {
    display: inline-block; padding: 0.2rem 0.6rem;
    background: rgba(140,180,197,0.2); color: var(--accent-text);
    border-radius: 4px; font-size: 0.75rem; margin-bottom: 0.5rem;
    transition: all 0.3s;
}
.gallery-card:hover .card-tag {
    background: rgba(140,180,197,0.35);
}
.card-body h3 { font-size: 1.1rem; margin-bottom: 0.25rem; }
.card-body p { font-size: 0.85rem; color: var(--text-dim); }

/* === 小页面卡片 === */
.pages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 3rem;
}
.page-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.5rem;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    text-decoration: none; color: var(--text);
}
.page-card:hover {
    border-color: var(--accent2);
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 8px 32px rgba(201,169,110,0.2), 0 0 0 1px rgba(201,169,110,0.15);
}
.page-card .page-icon {
    font-size: 2.5rem; margin-bottom: 0.75rem;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.page-card:hover .page-icon { transform: scale(1.15); }
.page-card h3 { font-size: 1rem; margin-bottom: 0.25rem; }
.page-card p { font-size: 0.8rem; color: var(--text-dim); }

/* === 浏览历史 === */
.history-section { margin-bottom: 3rem; }
.history-list {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.25rem;
}
.history-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.6rem 0; border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
.history-item:last-child { border-bottom: none; }
.history-item .time { color: var(--text-dim); font-size: 0.8rem; }
.history-empty { text-align: center; color: var(--text-dim); padding: 1.5rem; }

/* === 模态框 === */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(74,69,64,0.5); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    z-index: 200; opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal-box {
    background: #fff; border: 1px solid var(--border);
    border-radius: var(--radius); padding: 2rem;
    width: 100%; max-width: 400px;
    box-shadow: var(--shadow);
    transform: translateY(20px) scale(0.97);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.modal-overlay.active .modal-box {
    transform: translateY(0) scale(1);
}
.modal-box h2 {
    font-size: 1.5rem; margin-bottom: 1.5rem; text-align: center;
}
.modal-box h2 span { color: var(--accent); }
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block; font-size: 0.85rem; color: var(--text-dim); margin-bottom: 0.35rem;
}
.form-group input {
    width: 100%; padding: 0.7rem 0.9rem; border-radius: 8px;
    background: var(--bg); border: 2px solid transparent;
    color: var(--text); font-size: 0.95rem; outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
}
.form-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(140,180,197,0.1);
    background: #fff;
}
.form-submit {
    width: 100%; padding: 0.75rem; border-radius: 8px;
    background: linear-gradient(135deg, var(--accent), #7BA3B4);
    color: #fff; font-weight: 700;
    font-size: 1rem; border: none; cursor: pointer;
    margin-top: 0.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative; overflow: hidden;
}
.form-submit::before {
    content: ''; position: absolute; top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.6s;
}
.form-submit:hover::before { left: 100%; }
.form-submit:hover {
    box-shadow: 0 6px 24px rgba(140,180,197,0.4);
    transform: translateY(-2px);
}
.input-row { display: flex; gap: 8px; }
.input-row input { flex: 1; }
.btn-random {
    background: var(--surface); border: 1px solid var(--border); color: var(--text);
    padding: 0 12px; border-radius: 8px; cursor: pointer; font-size: 1.1rem; transition: all 0.2s; flex-shrink: 0;
}
.btn-random:hover { border-color: var(--accent); background: var(--accent-glow); }
.form-switch {
    text-align: center; margin-top: 1rem; font-size: 0.85rem; color: var(--text-dim);
}
.form-switch a { cursor: pointer; color: var(--accent); }
.modal-close {
    position: absolute; top: 1rem; right: 1rem;
    background: none; border: none; color: var(--text-dim);
    font-size: 1.5rem; cursor: pointer;
}
.modal-msg { text-align: center; margin-top: 0.75rem; font-size: 0.85rem; }

/* === 删除记录 === */
.delete-records-area {
    text-align: right; margin-top: 1rem; position: relative;
}
.btn-delete-records {
    background: transparent; color: var(--text-dim); border: 1px solid var(--border);
    padding: 0.4rem 1rem; border-radius: 6px; cursor: pointer; font-size: 0.8rem;
    transition: all 0.2s;
}
.btn-delete-records:hover { border-color: var(--accent); color: var(--accent); }
.delete-menu {
    position: absolute; right: 0; top: 100%; margin-top: 4px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 8px; min-width: 140px; z-index: 50;
    box-shadow: var(--shadow); overflow: hidden;
}
.delete-menu a {
    display: block; padding: 0.55rem 1rem; font-size: 0.85rem;
    color: var(--text-dim); cursor: pointer; transition: all 0.15s;
    border-bottom: 1px solid var(--border);
}
.delete-menu a:last-child { border-bottom: none; }
.delete-menu a:hover { background: var(--surface-hover); color: var(--accent); }

/* === Footer === */
.footer {
    text-align: center; padding: 2rem;
    color: var(--text-dim); font-size: 0.8rem;
    border-top: 1px solid var(--border);
    position: relative; overflow: hidden;
}
.footer::before {
    content: ''; position: absolute; top: 0; left: 50%;
    transform: translateX(-50%);
    width: 60px; height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    border-radius: 1px;
}
.footer .name { color: var(--accent); font-weight: 700; }
/* 页脚备案链接对比度（覆盖内联 #999，需 ≥4.5:1）+ 触控目标 ≥44px */
.footer a[href] { color: #6D665E !important; display: inline-block; padding: 8px 4px; min-height: 44px; line-height: 1.4; }

/* === 自定义滚动条 === */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
    background: var(--border); border-radius: 3px;
    transition: background 0.3s;
}
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* === 全局选择高亮 === */
::selection {
    background: rgba(140,180,197,0.3); color: var(--text);
}

/* === 动效规范（遵循 Primer 原则：元素出现而非表演） ===
 * 1. 时长：微交互 100-150ms（--dur-fast），简单过渡 150-300ms（--dur-base）
 * 2. 只动 transform / opacity / box-shadow，避免触发重排的属性动画
 * 3. 所有动效必须兼容 prefers-reduced-motion 降级（见下方媒体查询）
 * 4. 主题切换过渡预留：切换时给 <html> 加 .theme-transition 类（切换后移除）
 */
:root {
    --dur-fast: 0.15s;
    --dur-base: 0.25s;
    --ease-out: cubic-bezier(0.25, 0.1, 0.25, 1);
    --ease-in:  cubic-bezier(0.55, 0.06, 0.68, 0.19);
}

/* 主题切换时颜色平滑过渡（需 JS 在切换前后短暂添加 .theme-transition） */
html.theme-transition *,
html.theme-transition *::before,
html.theme-transition *::after {
    transition: background-color var(--dur-base), color var(--dur-base),
                border-color var(--dur-base), box-shadow var(--dur-base) !important;
}

/* 尊重系统"减少动效"偏好：关闭动画与平滑滚动 */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 小小众页面桌面端基础 */
.extras-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; max-width: 900px; margin: 2rem auto; padding: 0 1.5rem; }

/* === 移动端底部 Tab 栏（悬浮岛式，仅 ≤768px 显示） === */
.mobile-tabbar {
    position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%);
    z-index: 99;
    display: flex; align-items: center; justify-content: space-around; gap: 2px;
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 6px;
    box-shadow: 0 8px 24px rgba(74, 69, 64, 0.14);
    width: min(92vw, 360px);
}
.mobile-tabbar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; min-width: 64px; min-height: 44px;
    border-radius: 16px; color: var(--text-dim);
    text-decoration: none;
    transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
    padding: 6px 10px;
}
.mobile-tabbar a svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mobile-tabbar a span { font-size: 0.7rem; line-height: 1; }
.mobile-tabbar a.active {
    color: var(--accent-text); font-weight: 700;
    background: rgba(140, 180, 197, 0.18);
}
/* 桌面端隐藏 Tab 栏；有 Tab 栏时页面底部留出空间防遮挡 */
@media (min-width: 769px) { .mobile-tabbar { display: none; } }
body.has-mobile-tabbar { padding-bottom: 88px; }
@media (min-width: 769px) { body.has-mobile-tabbar { padding-bottom: 0; } }
/* 桌面端隐藏抽屉导航与汉堡按钮（其样式仅在 ≤768px 媒体查询内定义） */
@media (min-width: 769px) {
    .menu-toggle, .nav-drawer, .nav-overlay { display: none !important; }
    body.nav-open { overflow: auto; }
}

/* === 响应式 === */
/* === 响应式：平板 / 小屏 (≤768px) === */
@media (max-width: 768px) {
    .main-content { padding-left: 1rem; padding-right: 1rem; padding-top: 80px; }

    /* 导航栏 — 汉堡菜单 */
    .navbar {
        flex-wrap: wrap; height: auto;
        padding: 0.5rem 1rem; align-items: center;
    }
    .nav-logo {
        width: 100%; display: flex; justify-content: space-between;
        align-items: center; cursor: pointer; user-select: none;
    }
    /* 汉堡按钮（由 main.js 注入，替代原 hover 展开） */
    .menu-toggle {
        display: inline-flex; align-items: center; justify-content: center;
        width: 44px; height: 44px; padding: 0;
        background: transparent; border: none; border-radius: 10px;
        color: var(--text-dim); cursor: pointer;
        transition: color var(--dur-fast), background var(--dur-fast);
    }
    .menu-toggle:hover { color: var(--accent-text); background: rgba(140,180,197,0.12); }
    .menu-toggle svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

    .nav-links {
        display: none; flex-direction: column; width: 100%;
        gap: 0; padding: 0.5rem 0;
        border-top: 1px solid var(--border); margin-top: 0.5rem;
    }
    .nav-links a {
        padding: 0.6rem 0.5rem; font-size: 0.95rem;
        border-bottom: 1px solid rgba(74,69,64,0.04);
    }
    .nav-links a:last-child { border-bottom: none; }

    /* 悬浮/点击展开菜单（抽屉模式由 body.nav-open 接管，此处仅保留降级） */
    .navbar:hover .nav-links,
    .navbar:focus-within .nav-links { display: flex; }

    .nav-user {
        display: none;
        width: 100%; justify-content: center;
        padding: 0.6rem 0; margin-top: 0;
        border-top: 1px solid var(--border);
    }
    .navbar:hover .nav-user,
    .navbar:focus-within .nav-user { display: flex; }
    .nav-user .btn { font-size: 0.8rem; padding: 0.35rem 0.8rem; }
    .user-greeting { font-size: 0.8rem; }

    /* === 移动端抽屉导航（全屏滑入，body.nav-open 激活） === */
    .nav-drawer {
        position: fixed; top: 0; right: 0; bottom: 0; z-index: 200;
        width: min(78vw, 320px);
        background: var(--bg);
        border-left: 1px solid var(--border);
        padding: 5rem 1rem 2rem;
        display: flex; flex-direction: column; gap: 0.25rem;
        transform: translateX(100%);
        transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
        visibility: hidden;
        overflow-y: auto;
        box-shadow: -8px 0 24px rgba(30, 28, 25, 0.08);
    }
    body.nav-open .nav-drawer {
        transform: translateX(0);
        visibility: visible;
    }
    /* 抽屉链接容器：独立布局，不再继承顶部 nav-links 的 display:none */
    .nav-drawer-links {
        display: flex; flex-direction: column; gap: 2px;
    }
    .nav-drawer-links a {
        display: flex; align-items: center; justify-content: space-between;
        padding: 0.9rem 0.75rem; border-radius: 10px;
        color: var(--text-dim); font-size: 1rem;
        text-decoration: none;
        transition: color var(--dur-fast), background var(--dur-fast);
    }
    .nav-drawer-links a:hover,
    .nav-drawer-links a.active { color: var(--accent-text); background: rgba(140,180,197,0.14); font-weight: 600; }
    .nav-drawer-links a i { font-style: normal; font-size: 0.75rem; margin-left: 0.5rem; opacity: 0.6; }
    .nav-drawer-user {
        display: flex; flex-direction: column; gap: 0.5rem;
        margin-top: 1rem; padding: 1rem 0.25rem 0;
        border-top: 1px solid var(--border);
    }
    .nav-drawer-user .btn { width: 100%; min-height: 44px; font-size: 0.9rem; }
    .nav-drawer-user .user-greeting { display: block; text-align: center; margin-bottom: 0.25rem; }
    .nav-drawer-user .admin-link { display: block; text-align: center; padding: 0.5rem; }

    /* 抽屉遮罩 */
    .nav-overlay {
        position: fixed; inset: 0; z-index: 190;
        background: rgba(30, 28, 25, 0.45);
        opacity: 0; visibility: hidden;
        transition: opacity 0.25s ease;
    }
    body.nav-open .nav-overlay { opacity: 1; visibility: visible; }
    /* 打开抽屉时锁定页面滚动 */
    body.nav-open { overflow: hidden; }

    /* Hero */
    .hero { padding: 2rem 0 2.5rem; }
    .hero-logo { max-width: 120px; }
    .hero h1 { font-size: 2rem; }
    .hero .subtitle { font-size: 0.95rem; }

    /* 作品集 */
    .gallery-grid { grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
    .gallery-card .card-image { height: 120px; font-size: 2rem; }
    .gallery-card .card-body { padding: 0.6rem; }
    .gallery-card .card-body h3 { font-size: 0.8rem; }
    .gallery-card .card-body p { font-size: 0.7rem; display: none; }
    .gallery-card .card-body .card-tag { font-size: 0.65rem; padding: 0.1rem 0.4rem; }
    .gallery-search { max-width: 100%; }

    /* 小页面卡片 */
    .pages-grid { grid-template-columns: repeat(5, 1fr); gap: 0.4rem; }
    .page-card { padding: 0.5rem; }
    .page-card .page-icon { font-size: 1.4rem; margin-bottom: 0.25rem; }
    .page-card h3 { font-size: 0.65rem; margin-bottom: 0; }
    .page-card p { display: none; }

    /* 模态框 */
    .modal-box { max-width: 90%; padding: 1.5rem; }

    /* Footer */
    .footer { padding: 1.5rem 1rem; }

    /* 作品集页面 (gallery.html) */
    .gallery-hero { padding: 2rem 0 0.5rem; }
    .gallery-hero h1 { font-size: 1.6rem; }
    .gallery-toolbar { justify-content: center; padding: 0 1rem; }
    .gallery-toolbar select { width: 100%; max-width: 320px; }
    .gallery-container { padding: 0 1rem 2rem; }
    .gallery-pagination { gap: 0.3rem; }
    .gallery-pagination button { padding: 8px 12px; font-size: 0.8rem; min-height: 40px; }
    .gallery-more-card { min-height: 160px !important; }

    /* 小小众页面 (extras.html) */
    .extras-hero { padding: 2rem 0 0.5rem; }
    .extras-hero h1 { font-size: 1.6rem; }
    .extras-grid { grid-template-columns: repeat(5, 1fr); gap: 0.4rem; margin: 1rem auto; padding: 0 1rem; }
    .extras-footer { padding: 1.5rem; }
    .btn-more { padding: 12px 24px; font-size: 0.95rem; min-height: 44px; display: inline-flex; align-items: center; }

    /* 个人中心 (profile.html) */
    .profile-container { max-width: 100%; padding: 0 0.5rem; }
    .profile-card { padding: 1.5rem; }
    .profile-avatar { width: 64px; height: 64px; font-size: 1.5rem; }
    .profile-avatar .avatar-initial { font-size: 1.5rem; }
    .profile-row { flex-direction: column; align-items: flex-start; gap: 0.25rem; }
    .profile-label { width: auto; margin-bottom: 0.15rem; }
    .profile-value { width: 100%; }
    .profile-actions .btn-save { padding: 0.65rem 1.8rem; min-height: 44px; }

    /* 触控友好：按钮/链接最小触摸区域 */
    .btn-primary, .btn-secondary { min-height: 44px; display: inline-flex; align-items: center; }
    .nav-links a { min-height: 44px; display: flex; align-items: center; }
    .nav-user .btn { min-height: 36px; }

    /* 评论区响应式补充 */
    .comment-item.reply { margin-left: 1.5rem; }
    .comment-body { padding-left: 2.4rem; }
    .comment-reply-form { padding-left: 2.4rem; }
}

/* === 响应式：手机 (≤480px) === */
@media (max-width: 480px) {
    .main-content { padding-top: 70px; }

    .navbar { padding: 0.4rem 0.75rem; }

    .hero h1 { font-size: 1.6rem; }
    .hero-logo { max-width: 100px; }
    .hero .subtitle { font-size: 0.85rem; max-width: 100%; }
    .hero-actions { flex-direction: column; align-items: stretch; }
    .hero-actions .btn-primary,
    .hero-actions .btn-secondary { text-align: center; justify-content: center; }

    .section-title { font-size: 1.4rem; }
    .section-title::before { height: 22px; width: 3px; }

    .pages-grid { grid-template-columns: repeat(5, 1fr); gap: 0.3rem; }
    .page-card { padding: 0.35rem; }
    .page-card .page-icon { font-size: 1.1rem; margin-bottom: 0.15rem; }
    .page-card h3 { font-size: 0.55rem; }

    .gallery-grid { grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
    .gallery-card .card-image { height: 90px; font-size: 1.5rem; }
    .gallery-card .card-body { padding: 0.4rem; }
    .gallery-card .card-body h3 { font-size: 0.7rem; }
    .gallery-card .card-body .card-tag { font-size: 0.55rem; }

    .modal-box { max-width: 95%; padding: 1rem; margin: 0.5rem; }
    .modal-box h2 { font-size: 1.1rem; margin-bottom: 0.75rem; }
    .modal-close { top: 0.5rem; right: 0.6rem; font-size: 1.2rem; }
    .form-group { margin-bottom: 0.6rem; }
    .form-group label { font-size: 0.75rem; margin-bottom: 0.2rem; }
    .form-group input { padding: 0.5rem 0.6rem; font-size: 0.8rem; }
    .btn-submit { padding: 0.55rem 1rem; font-size: 0.85rem; }

    .history-item { flex-direction: column; align-items: flex-start; gap: 0.25rem; }

    .btn-primary,
    .btn-secondary { padding: 0.65rem 1.5rem; font-size: 0.9rem; width: 100%; }

    /* 作品集分页进一步紧凑 */
    .gallery-pagination { gap: 0.2rem; flex-wrap: wrap; }
    .gallery-pagination button { padding: 6px 10px; font-size: 0.75rem; min-height: 36px; }

    /* 小小众页面 */
    .extras-grid { grid-template-columns: repeat(5, 1fr); gap: 0.3rem; }
    .extras-hero h1 { font-size: 1.4rem; }
    .extras-footer { padding: 1rem; }

    /* 个人中心 */
    .profile-card { padding: 1.25rem; }
    .profile-avatar { width: 56px; height: 56px; }
    .profile-avatar .avatar-initial { font-size: 1.3rem; }
    .profile-actions .btn-save { width: 100%; }
    .profile-row { padding: 0.65rem 0; }
    .profile-value input { padding: 0.6rem 0.7rem; font-size: 0.9rem; }
    .history-item { font-size: 0.82rem; flex-wrap: wrap; }

    /* 评论区 */
    .comment-item.reply { margin-left: 0.75rem; padding-left: 0.75rem; }
    .comment-body { padding-left: 0; font-size: 0.85rem; }
    .comment-reply-form { padding-left: 0; }
    .comment-header { flex-wrap: wrap; }
    .comment-form textarea { min-height: 72px; font-size: 0.85rem; }
}

/* === 断点规范（#20）：640 / 1023 / 1024 / 1280 === */
/* 手机 ≤640px：网格单列卡片化（#22），覆盖上方 768/480 的多列紧凑布局 */
@media (max-width: 640px) {
    .gallery-grid { grid-template-columns: 1fr; gap: 1rem; }
    .pages-grid { grid-template-columns: 1fr; gap: 0.75rem; }
    .extras-grid { grid-template-columns: 1fr; gap: 0.75rem; }

    /* 卡片化：恢复信息密度，避免缩成小格子 */
    .gallery-card .card-image { height: auto; aspect-ratio: 4 / 3; }
    .gallery-card .card-body { padding: 1rem; }
    .gallery-card .card-body h3 { font-size: 1.05rem; }
    .gallery-card .card-body p { display: block; font-size: 0.85rem; }
    .gallery-card .card-body .card-tag { font-size: 0.72rem; padding: 0.2rem 0.6rem; }
    .page-card { padding: 1.1rem; }
    .page-card .page-icon { font-size: 2.1rem; margin-bottom: 0.4rem; }
    .page-card h3 { font-size: 1.05rem; margin-bottom: 0.15rem; }
    .page-card p { display: block; font-size: 0.82rem; }
    .extras-grid { max-width: 480px; }
}

/* 平板横屏 / 中小屏 641-1023px：双列 */
@media (min-width: 641px) and (max-width: 1023px) {
    .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
    .pages-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
    .extras-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
}

/* 桌面 ≥1024px：作品集三列 */
@media (min-width: 1024px) {
    .gallery-grid { grid-template-columns: repeat(3, 1fr); }
}

/* === 返回顶部按钮（footer 注入，触控目标 ≥44px）=== */
.back-to-top {
    position: fixed; right: 20px; bottom: 24px; z-index: 150;
    width: 48px; height: 48px; border-radius: 50%;
    border: 1px solid var(--border); background: var(--surface);
    color: var(--text-dim); font-size: 1.25rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 20px rgba(30, 28, 25, 0.14);
    opacity: 0; visibility: hidden; transform: translateY(8px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
}
.back-to-top.show {
    opacity: 1; visibility: visible; transform: translateY(0);
}
.back-to-top:hover { color: var(--accent-text); border-color: var(--accent); }
/* 移动端底部 Tab 栏上方避让 */
body.has-mobile-tabbar .back-to-top { bottom: 96px; }
@media (min-width: 769px) { body.has-mobile-tabbar .back-to-top { bottom: 24px; } }
/* 动效降级：系统要求减少动效时禁用过渡 */
@media (prefers-reduced-motion: reduce) {
    .back-to-top { transition: none; }
}
