/**
 * ============================================
 * 倩之物语 - 样式表
 * ============================================
 * 
 * 设计理念：
 * 朦胧美学风格，使用柔和的粉色调和毛玻璃效果，
 * 营造温馨、梦幻的视觉体验。
 * 
 * 设计特点：
 * - 毛玻璃效果（backdrop-filter）
 * - 柔和的色彩搭配
 * - 流畅的动画过渡
 * - 响应式设计
 * - 移动端优化
 * 
 * 性能优化：
 * - 使用 CSS 变量提高可维护性
 * - GPU 加速动画（transform, opacity）
 * - 避免触发重排的属性
 * - 使用 will-change 提示浏览器优化
 * 
 * 浏览器兼容性：
 * - 现代浏览器（Chrome 90+, Firefox 88+, Safari 14+）
 * - 移动端浏览器
 * - 提供降级方案（Flexbox 替代 Grid）
 * 
 * @version 1.0.0
 */

/* ============================================
   全局变量与重置
   ============================================ */

/* CSS 自定义属性（变量）
   定义全局颜色、字体和安全区域 */
:root {
    --primary-pink: #eecbc4;
    --bg-cream: #fdfbf7;
    --text-main: #5e5e5e;
    --text-accent: #8d7b68;
    --glass-bg: rgba(255, 255, 255, 0.25);
    --glass-border: rgba(255, 255, 255, 0.4);
    --font-serif: 'Noto Serif SC', serif;
    --font-script: 'Dancing Script', cursive;
    
    /* 安全区域适配（用于有刘海屏的设备） */
    --safe-area-inset-top: env(safe-area-inset-top);
    --safe-area-inset-right: env(safe-area-inset-right);
    --safe-area-inset-bottom: env(safe-area-inset-bottom);
    --safe-area-inset-left: env(safe-area-inset-left);
}

/* ============================================
   页面加载指示器
   需求：6.1, 6.2
   ============================================ */

/* 加载指示器容器
   全屏覆盖，渐变背景，居中显示 */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bg-cream) 0%, #fff5f0 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

.page-loader.fade-out {
    opacity: 0;
    visibility: hidden;
}

.loader-content {
    text-align: center;
    animation: breathe 3s infinite ease-in-out;
}

.loader-spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 1.5rem;
    border: 4px solid rgba(238, 203, 196, 0.2);
    border-top: 4px solid var(--primary-pink);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loader-text {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-accent);
    letter-spacing: 3px;
    margin-bottom: 0.5rem;
}

.loader-subtext {
    font-family: var(--font-script);
    font-size: 1.2rem;
    color: var(--primary-pink);
    letter-spacing: 2px;
}

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

body {
    font-family: var(--font-serif);
    background-color: var(--bg-cream);
    color: var(--text-main);
    overflow-x: hidden;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
}

a { text-decoration: none; color: inherit; transition: 0.3s; }
ul { list-style: none; }

/* --- 核心特效类 --- */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
}

@keyframes breathe {
    0% { transform: scale(1); opacity: 0.9; }
    50% { transform: scale(1.02); opacity: 1; }
    100% { transform: scale(1); opacity: 0.9; }
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

/* ============================================
   导航栏
   需求：1.1, 1.2, 1.3, 1.4
   ============================================ */

/* 导航栏容器
   固定定位，毛玻璃效果，支持安全区域 */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 1.5rem 5%;
    padding-top: calc(1.5rem + var(--safe-area-inset-top));
    padding-left: calc(5% + var(--safe-area-inset-left));
    padding-right: calc(5% + var(--safe-area-inset-right));
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    transition: 0.4s ease;
}

nav.scrolled {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(15px);
    padding: 1rem 5%;
    box-shadow: 0 2px 20px rgba(0,0,0,0.05);
}

/* 修改 .logo 容器样式，让图片和文字横向排列 */
.logo {
    display: flex;
    align-items: center;
    gap: 10px; /* 图片和文字的间距 */
    text-decoration: none;
}

/* 新增：Logo 图片样式 */
.logo-img {
    height: 50px;  /* 限制高度，防止图片撑破导航栏 */
    width: auto;   /* 宽度自动保持比例 */
    border-radius: 50%; /* 如果图片没切圆，这行代码可以强制让它变圆 */
    transition: transform 0.5s ease;
}

/* 鼠标悬停时 Logo 轻轻旋转 */
.logo:hover .logo-img {
    transform: rotate(10deg); 
}

/* 如果保留了文字，给文字单独加样式 */
.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-accent);
    letter-spacing: 2px;
}
.nav-links {
    display: flex;
    gap: 2.5rem;
}

.nav-links a {
    font-size: 1rem;
    color: var(--text-main);
    position: relative;
    letter-spacing: 1px;
}

.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 1px;
    bottom: -5px;
    left: 0;
    background-color: var(--primary-pink);
    transition: width 0.3s ease;
}

.nav-links a:hover::after {
    width: 100%;
}

.nav-links a.active {
    color: var(--primary-pink);
    font-weight: 500;
}

.nav-links a.active::after {
    width: 100%;
}

/* ============================================
   移动端菜单切换按钮（汉堡图标）
   需求：1.4, 5.2
   ============================================ */

/* 汉堡菜单按钮
   默认隐藏，移动端显示 */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    position: relative;
    transition: transform 0.2s ease;
}

.mobile-menu-toggle:focus {
    outline: 2px solid var(--primary-pink);
    outline-offset: 4px;
    border-radius: 4px;
}

.hamburger-line {
    width: 100%;
    height: 3px;
    background-color: var(--text-accent);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* ============================================
   Hero 区域（首屏）
   ============================================ */

/* Hero 容器
   全屏高度，背景图片，渐变遮罩 */
.hero {
    height: 100vh;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    background: url('https://images.unsplash.com/photo-1516820005720-3b499cb63378?ixlib=rb-4.0.3&auto=format&fit=crop&w=1920&q=80') no-repeat center center/cover;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(253, 251, 247, 0.2), rgba(253, 251, 247, 0.8));
}

.hero-content {
    position: relative;
    text-align: center;
    z-index: 1;
    padding: 3rem 5rem;
    border-radius: 30px;
    background: rgba(255,255,255,0.4);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.6);
    animation: breathe 6s infinite ease-in-out;
}

.hero h1 {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: var(--text-accent);
    text-shadow: 2px 2px 10px rgba(255,255,255,0.8);
}

.hero p {
    font-size: 1.5rem;
    font-family: var(--font-script);
    color: var(--text-main);
    margin-bottom: 2rem;
}

.scroll-down {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    animation: float 2s infinite ease-in-out;
    font-size: 0.9rem;
    color: var(--text-accent);
    opacity: 0.7;
}

/* --- 内容板块 --- */
.section-title {
    text-align: center;
    margin: 6rem 0 3rem;
    font-size: 2rem;
    color: var(--text-accent);
    letter-spacing: 0.2em;
}

.section-subtitle {
    text-align: center;
    display: block;
    margin-top: -2.5rem;
    margin-bottom: 3rem;
    font-family: var(--font-script);
    font-size: 1.2rem;
    color: var(--primary-pink);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* ============================================
   卡片网格布局
   使用 CSS Grid 实现响应式布局
   ============================================ */

/* 网格容器
   自适应列数，最小宽度 300px */
.grid-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2.5rem;
    padding-bottom: 5rem;
}

.card {
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    height: 400px;
    transition: all 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
    cursor: pointer;
}

.card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
}

.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s ease;
}

.card:hover .card-img {
    transform: scale(1.05);
}

.card-content {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    padding: 1.5rem;
    border-radius: 15px;
    text-align: left;
    opacity: 0.9;
    transform: translateY(0);
}

.card-title {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: #333;
}

.card-desc {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.6;
}

/* --- 新增：时光手账 (Notebook Style) --- */
        .journal-section {
            padding: 4rem 0;
            position: relative;
        }

        /* 笔记本容器：横向排列 */
        .notebook-container {
            display: flex;
            justify-content: center;
            flex-wrap: wrap;
            gap: 3rem;
            margin-top: 2rem;
        }

        /* 单页日记纸样式 */
        .journal-page {
            background-color: #fffbf0; /* 暖米色纸张 */
            width: 320px;
            height: 420px;
            padding: 2.5rem 1.5rem 1.5rem;
            position: relative;
            box-shadow: 5px 5px 15px rgba(0,0,0,0.08);
            transition: transform 0.3s ease;
            
            /* CSS绘制横格线效果 */
            background-image: linear-gradient(rgba(238, 203, 196, 0.4) 1px, transparent 1px);
            background-size: 100% 2rem; /* 行高 */
            line-height: 2rem;
        }

        /* 鼠标悬停时的轻微浮动 */
        .journal-page:hover {
            transform: rotate(-2deg) translateY(-10px);
            z-index: 10;
        }
        
        /* 偶数页反向旋转，增加随意感 */
        .journal-page:nth-child(even):hover {
            transform: rotate(2deg) translateY(-10px);
        }

        /* 顶部“和纸胶带”效果 */
        .journal-page::before {
            content: '';
            position: absolute;
            top: -10px;
            left: 50%;
            transform: translateX(-50%);
            width: 100px;
            height: 25px;
            background-color: rgba(238, 203, 196, 0.7); /* 胶带颜色 */
            opacity: 0.8;
            box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        }

        /* 胶带颜色交替 */
        .journal-page:nth-child(2n)::before {
            background-color: rgba(186, 215, 233, 0.7); /* 浅蓝色胶带 */
        }
        
        .journal-date {
            font-family: var(--font-serif);
            font-weight: 700;
            color: var(--text-accent);
            border-bottom: 2px solid var(--primary-pink);
            display: inline-block;
            margin-bottom: 1rem;
            font-size: 0.9rem;
        }

        .journal-text {
            font-family: var(--font-script); /* 使用手写体 */
            font-size: 1.3rem;
            color: #666;
            margin-top: 0;
        }

/* --- 树洞区域 --- */
.tree-hole {
    background-color: #f2efeb;
    padding: 5rem 0;
    text-align: center;
    margin-top: 4rem;
    position: relative;
}

.tree-hole p {
    max-width: 600px;
    margin: 0 auto 2rem;
    line-height: 2;
}

.btn {
    display: inline-block;
    padding: 12px 30px;
    background: linear-gradient(135deg, #eecbc4, #d4a5a5);
    color: white;
    border-radius: 50px;
    font-size: 1rem;
    letter-spacing: 1px;
    box-shadow: 0 5px 15px rgba(212, 165, 165, 0.4);
    transition: 0.3s;
}

.btn:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(212, 165, 165, 0.6);
}

/* ============================================
   图片查看器模态窗口
   需求：2.1, 2.2, 2.3, 2.4, 2.5
   ============================================ */

/* 模态窗口容器
   全屏覆盖，居中显示，初始隐藏 */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.image-modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    cursor: pointer;
}

.modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90vh;
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    z-index: 2001;
}

.image-modal.active .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    font-size: 2rem;
    line-height: 1;
    color: var(--text-accent);
    cursor: pointer;
    z-index: 2002;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.modal-close:hover {
    background: var(--primary-pink);
    color: white;
    transform: rotate(90deg);
}

.modal-close:focus {
    outline: 2px solid var(--primary-pink);
    outline-offset: 2px;
}

.modal-image {
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
    display: block;
    background: #f5f5f5;
}

.modal-info {
    padding: 2rem;
    background: white;
}

.modal-title {
    font-size: 1.5rem;
    color: var(--text-accent);
    margin-bottom: 0.8rem;
    letter-spacing: 1px;
}

.modal-description {
    font-size: 1rem;
    color: var(--text-main);
    line-height: 1.8;
}

/* ============================================
   树洞秘密提交表单
   需求：3.1, 3.2, 3.3, 3.4, 3.5
   ============================================ */

/* 表单容器
   全屏覆盖，居中显示，初始隐藏 */
.secret-form-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.secret-form-container.active {
    opacity: 1;
    visibility: visible;
}

.secret-form-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    cursor: pointer;
}

.secret-form {
    position: relative;
    width: 90%;
    max-width: 500px;
    padding: 2.5rem;
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    z-index: 3001;
}

.secret-form-container.active .secret-form {
    transform: scale(1) translateY(0);
}

.form-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 35px;
    height: 35px;
    background: rgba(255, 255, 255, 0.8);
    border: none;
    border-radius: 50%;
    font-size: 1.8rem;
    line-height: 1;
    color: var(--text-accent);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

.form-close:hover {
    background: var(--primary-pink);
    color: white;
    transform: rotate(90deg);
}

.form-close:focus {
    outline: 2px solid var(--primary-pink);
    outline-offset: 2px;
}

.form-title {
    font-size: 1.8rem;
    color: var(--text-accent);
    margin-bottom: 0.5rem;
    text-align: center;
    letter-spacing: 2px;
}

.form-subtitle {
    font-size: 0.95rem;
    color: var(--text-main);
    text-align: center;
    margin-bottom: 1.5rem;
    opacity: 0.8;
    font-style: italic;
}

.secret-input {
    width: 100%;
    min-height: 150px;
    padding: 1rem;
    border: 2px solid rgba(238, 203, 196, 0.3);
    border-radius: 15px;
    font-family: var(--font-serif);
    font-size: 1rem;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.8);
    resize: vertical;
    transition: border-color 0.3s ease;
    line-height: 1.6;
}

.secret-input:focus {
    outline: none;
    border-color: var(--primary-pink);
    background: white;
}

.secret-input::placeholder {
    color: #aaa;
    font-style: italic;
}

.char-counter {
    text-align: right;
    font-size: 0.85rem;
    color: #999;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.btn-cancel,
.btn-submit {
    padding: 0.8rem 2rem;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-family: var(--font-serif);
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 1px;
}

.btn-cancel {
    background: rgba(200, 200, 200, 0.3);
    color: var(--text-main);
}

.btn-cancel:hover {
    background: rgba(200, 200, 200, 0.5);
    transform: translateY(-2px);
}

.btn-submit {
    background: linear-gradient(135deg, #eecbc4, #d4a5a5);
    color: white;
    box-shadow: 0 5px 15px rgba(212, 165, 165, 0.4);
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(212, 165, 165, 0.6);
}

.btn-submit:active,
.btn-cancel:active {
    transform: translateY(0);
}

.feedback-message {
    display: none;
    margin-top: 1rem;
    padding: 0.8rem;
    border-radius: 10px;
    text-align: center;
    font-size: 0.95rem;
    animation: fadeIn 0.3s ease;
}

.feedback-message.success {
    background: rgba(144, 238, 144, 0.2);
    color: #2d7a2d;
    border: 1px solid rgba(144, 238, 144, 0.5);
}

.feedback-message.error {
    background: rgba(255, 182, 193, 0.2);
    color: #c44569;
    border: 1px solid rgba(255, 182, 193, 0.5);
}

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

/* --- Footer --- */
footer {
    text-align: center;
    padding: 3rem;
    font-size: 0.8rem;
    color: #999;
    background: white;
}

/* ============================================
   响应式设计 - 移动端优化
   需求：5.1, 5.2, 5.3, 5.4, 5.5
   断点：768px（平板和手机）
   ============================================ */

/* 移动端样式（< 768px）
   优化布局、字体大小、交互元素 */
@media (max-width: 768px) {
    /* Hero 区域移动端优化 */
    .hero h1 { 
        font-size: 2.5rem; 
    }
    
    .hero p {
        font-size: 1.2rem;
    }
    
    .hero-content {
        padding: 2rem 2rem;
        border-radius: 20px;
    }
    
    /* 网格布局移动端优化 */
    .grid-gallery { 
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    /* 显示移动端菜单切换按钮 */
    .mobile-menu-toggle {
        display: flex;
    }
    
    /* 隐藏导航链接，通过切换按钮控制显示 */
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 75%;
        max-width: 300px;
        height: 100vh;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 2.5rem;
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: -5px 0 30px rgba(0, 0, 0, 0.15);
        z-index: 999;
    }
    
    /* 移动端菜单打开状态 */
    .nav-links.mobile-open {
        right: 0;
    }
    
    .nav-links a {
        font-size: 1.4rem;
        padding: 1rem 2rem;
        width: 80%;
        text-align: center;
        border-radius: 10px;
        transition: all 0.3s ease;
    }
    
    /* 移动端导航链接触摸反馈 */
    .nav-links a:active {
        background: rgba(238, 203, 196, 0.2);
        transform: scale(0.95);
    }
    
    /* 移动端导航链接高亮状态增强 */
    .nav-links a.active {
        background: rgba(238, 203, 196, 0.3);
        font-weight: 600;
    }
    
    /* 移动端菜单切换按钮触摸反馈 */
    .mobile-menu-toggle:active {
        transform: scale(0.9);
    }
    
    /* 卡片移动端优化 */
    .card {
        height: 350px;
    }
    
    /* 卡片触摸反馈 */
    .card:active {
        transform: scale(0.98);
    }
    
    /* 按钮触摸反馈 */
    .btn:active {
        transform: scale(0.95);
    }
    
    /* 模态窗口移动端适配 */
    .modal-content {
        max-width: 95%;
        max-height: 95vh;
        border-radius: 15px;
    }
    
    .modal-image {
        max-height: 60vh;
    }
    
    .modal-info {
        padding: 1.5rem;
    }
    
    .modal-title {
        font-size: 1.2rem;
    }
    
    .modal-description {
        font-size: 0.9rem;
        line-height: 1.6;
    }
    
    .modal-close {
        width: 40px;
        height: 40px;
        font-size: 1.8rem;
        top: 10px;
        right: 10px;
    }
    
    /* 模态关闭按钮触摸反馈 */
    .modal-close:active {
        transform: scale(0.9) rotate(90deg);
    }
    
    /* 树洞表单移动端适配 */
    .secret-form {
        width: 95%;
        max-width: 450px;
        padding: 2rem 1.5rem;
        border-radius: 20px;
    }
    
    .form-title {
        font-size: 1.5rem;
    }
    
    .form-subtitle {
        font-size: 0.9rem;
    }
    
    .secret-input {
        min-height: 140px;
        font-size: 1rem;
        padding: 1.2rem;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 0.8rem;
    }
    
    .btn-cancel,
    .btn-submit {
        width: 100%;
        padding: 1rem;
        font-size: 1.05rem;
    }
    
    /* 表单按钮触摸反馈 */
    .btn-cancel:active,
    .btn-submit:active {
        transform: scale(0.97);
    }
    
    .form-close:active {
        transform: scale(0.9) rotate(90deg);
    }
    
    /* 区域标题移动端优化 */
    .section-title {
        font-size: 1.8rem;
        margin: 4rem 0 2.5rem;
    }
    
    .section-subtitle {
        font-size: 1.1rem;
        margin-top: -2rem;
        margin-bottom: 2.5rem;
    }
    
    /* 容器移动端优化 */
    .container {
        padding: 0 1.5rem;
    }
    
    /* 树洞区域移动端优化 */
    .tree-hole {
        padding: 4rem 1.5rem;
    }
    
    .tree-hole p {
        font-size: 0.95rem;
        line-height: 1.8;
        padding: 0 1rem;
    }
    
    /* 导航栏移动端优化 */
    nav {
        padding: 1rem 5%;
    }
    
    nav.scrolled {
        padding: 0.8rem 5%;
    }
    
    .logo {
        font-size: 1.5rem;
    }
}

/* 小屏幕手机优化 (< 480px) */
@media (max-width: 480px) {
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    .hero-content {
        padding: 1.5rem 1.5rem;
    }
    
    .nav-links {
        width: 85%;
    }
    
    .nav-links a {
        font-size: 1.3rem;
        padding: 0.9rem 1.5rem;
    }
    
    .card {
        height: 320px;
    }
    
    .section-title {
        font-size: 1.6rem;
    }
    
    .section-subtitle {
        font-size: 1rem;
    }
    
    .logo {
        font-size: 1.3rem;
    }
    
    .modal-image {
        max-height: 50vh;
    }
    
    .secret-form {
        padding: 1.5rem 1.2rem;
    }
    
    .form-title {
        font-size: 1.3rem;
    }
}

/* 平板设备优化 (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .nav-links {
        width: 60%;
    }
    
    .grid-gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
    
    .card {
        height: 380px;
    }
}

/* ============================================
   触摸设备通用优化
   需求：5.5
   检测：hover: none 和 pointer: coarse
   ============================================ */

/* 触摸设备特定样式
   增大可点击区域，优化触摸反馈 */
@media (hover: none) and (pointer: coarse) {
    /* 增大可点击区域 */
    .nav-links a {
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .mobile-menu-toggle {
        min-width: 44px;
        min-height: 44px;
    }
    
    .modal-close,
    .form-close {
        min-width: 44px;
        min-height: 44px;
    }
    
    .btn,
    .btn-cancel,
    .btn-submit {
        min-height: 48px;
    }
    
    /* 移除 hover 效果，使用 active 代替 */
    .card:hover {
        transform: none;
    }
    
    .card:active {
        transform: translateY(-5px) scale(0.98);
    }
    
    /* 优化触摸滚动 */
    .nav-links.mobile-open {
        -webkit-overflow-scrolling: touch;
        overflow-y: auto;
    }
    
    /* 防止文本选择干扰触摸交互 */
    .mobile-menu-toggle,
    .modal-close,
    .form-close,
    .btn,
    .btn-cancel,
    .btn-submit {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }
    
    /* 优化输入框在移动端的体验 */
    input,
    textarea {
        font-size: 16px; /* 防止 iOS 自动缩放 */
    }
}

/* 修复移动浏览器地址栏导致的高度问题 */
@supports (-webkit-touch-callout: none) {
    .hero {
        min-height: -webkit-fill-available;
    }
    
    .nav-links {
        height: -webkit-fill-available;
    }
}

/* 横屏模式优化 */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        height: auto;
        min-height: 100vh;
        padding: 6rem 0 3rem;
    }
    
    .hero-content {
        padding: 1.5rem 2rem;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    .nav-links {
        gap: 1.5rem;
        padding: 2rem 0;
    }
    
    .nav-links a {
        font-size: 1.2rem;
        padding: 0.7rem 1.5rem;
    }
}
