/* 全局重置和基础设置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CSS变量定义 */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --card-bg: white;
    --text-primary: #333;
    --text-secondary: #444;
    --accent-color: #667eea;
    --shadow-light: 0 4px 15px rgba(0, 0, 0, 0.05);
    --shadow-medium: 0 8px 32px rgba(0, 0, 0, 0.1);
    --shadow-heavy: 0 12px 25px rgba(0, 0, 0, 0.12);
    --radius-small: 8px;
    --radius-medium: 12px;
    --radius-large: 20px;
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* 导入现代字体 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* 修改body样式，禁止水平滚动并适应窗口宽度 */
body {
    min-height: 100vh;
    height: auto;
    background: var(--primary-gradient);
    background-attachment: fixed;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    color: var(--text-primary);
    padding: 40px 20px 20px;
    line-height: 1.6;
    position: relative;
    overflow-x: hidden; /* 禁止水平滚动 */
    overflow-y: auto;
    /* 确保背景在iOS设备上正确显示 */
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
}

/* 添加背景装饰元素 */
body::before, body::after {
    content: '';
    position: fixed; /* 使用fixed定位而不是absolute，避免影响页面宽度 */
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    z-index: -1;
    pointer-events: none; /* 防止这些装饰元素干扰页面交互 */
}

body::before {
    width: 600px;
    height: 600px;
    background: var(--secondary-gradient);
    top: -200px;
    left: -200px;
    animation: float 20s ease-in-out infinite;
}

body::after {
    width: 500px;
    height: 500px;
    background: var(--primary-gradient);
    bottom: -200px;
    right: -200px;
    animation: float 15s ease-in-out infinite reverse;
}

/* 创建浮动动画 */
@keyframes float {
    0% { transform: translate(0, 0); }
    50% { transform: translate(20px, 20px); }
    100% { transform: translate(0, 0); }
}

/* 页面标题 */
.page-title {
    color: white;
    font-size: 2rem; /* 减小字体大小 */
    font-weight: 700;
    text-align: center;
    margin-bottom: 25px; /* 减小底部边距，减少顶部空白 */
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    animation: fadeIn 1s ease-out;
    letter-spacing: -0.5px;
}

/* 修改容器样式，限制每行最多显示5个链接 */
.shortcut-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 25px;
    width: 100%;
    max-width: calc(130px * 5 + 25px * 4 + 90px); /* 5个卡片 + 4个间隙 + 左右padding，稍微加大了一点 */
    padding: 40px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    border-radius: var(--radius-large);
    box-shadow: var(--shadow-medium);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: visible;
    animation: fadeIn 0.8s ease-out;
}

/* 容器装饰线 */
.shortcut-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--secondary-gradient);
}

/* 固定卡片大小 */
.shortcut {
    text-decoration: none;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 130px;
    min-width: 130px;
    padding: 25px 20px;
    border-radius: var(--radius-medium);
    background: var(--card-bg);
    box-shadow: var(--shadow-light);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.5);
    opacity: 0;
    animation: fadeIn 0.5s ease-out forwards;
}

/* 卡片悬停效果 */
.shortcut:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: var(--shadow-heavy);
    z-index: 10;
}

/* 卡片悬停时的背景渐变 */
.shortcut:hover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--secondary-gradient);
}

/* 图标容器 */
.icon-container {
    width: 70px;
    height: 70px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    background: linear-gradient(135deg, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0.5) 100%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: all var(--transition-normal);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

/* 图标样式 */
.shortcut-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    object-fit: cover;
    transition: all var(--transition-normal);
}

/* 图标悬停效果 */
.shortcut:hover .icon-container {
    transform: rotate(5deg);
    box-shadow: 0 8px 16px rgba(102, 126, 234, 0.15);
}

.shortcut:hover .shortcut-icon {
    transform: scale(1.1);
}

/* 文本样式 */
.shortcut-name {
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    color: var(--text-secondary);
    transition: color var(--transition-fast);
    line-height: 1.3;
    position: relative;
    z-index: 2;
}

/* 文本悬停效果 */
.shortcut:hover .shortcut-name {
    color: var(--accent-color);
}

/* 卡片内发光效果 */
.shortcut::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.1) 0%, transparent 70%);
    transform: scale(0.2);
    opacity: 0;
    transition: all var(--transition-slow);
    pointer-events: none;
}

.shortcut:hover::after {
    transform: scale(1);
    opacity: 1;
}

/* 响应式设计调整 */
@media (max-width: 992px) {
    .shortcut-container {
        max-width: calc(130px * 5 + 25px * 4 + 90px); /* 5个卡片 + 4个间隙 + 左右padding，稍微加大了一点 */
        padding: 30px;
    }
}

/* 768px以下设备的响应式样式 - 合并背景修复和布局调整 */
@media (max-width: 768px) {
    /* 修复移动设备背景偏白问题 */
    body {
        /* 移除fixed可能导致的移动端显示问题 */
        background-attachment: scroll;
        /* 确保背景色在所有设备上一致 */
        background-color: #667eea;
        background-image: var(--primary-gradient);
        /* 修复iOS上的渲染问题 */
        -webkit-backface-visibility: hidden;
        -webkit-transform: translateZ(0);
        /* 确保背景覆盖整个屏幕 */
        background-position: center;
        background-repeat: no-repeat;
        background-size: cover;
        /* 解决某些Android设备上的渲染问题 */
        -webkit-background-size: cover;
        -moz-background-size: cover;
        -o-background-size: cover;
    }
    
    /* 调整移动设备上的背景装饰元素 */
    body::before,
    body::after {
        filter: blur(60px);
        opacity: 0.4;
        /* 确保装饰元素不会影响页面滚动 */
        pointer-events: none;
        /* 固定定位，避免滚动时跟随移动 */
        position: fixed;
    }
    
    body::before {
        width: 400px;
        height: 400px;
        top: -150px;
        left: -150px;
    }
    
    body::after {
        width: 300px;
        height: 300px;
        bottom: -150px;
        right: -150px;
    }
    
    /* 页面标题和布局调整 */
    .page-title {
        font-size: 2rem;
        margin-bottom: 30px;
    }
    
    .shortcut-container {
        max-width: calc(110px * 4 + 18px * 3 + 70px); /* 4个卡片 + 3个间隙 + 左右padding */
        padding: 25px;
        gap: 18px;
    }
    
    .shortcut {
        width: 110px;
        min-width: 110px;
        padding: 20px 15px;
    }
    
    .icon-container {
        width: 60px;
        height: 60px;
    }
    
    .shortcut-icon {
        width: 42px;
        height: 42px;
    }
    
    .shortcut-name {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 30px 15px;
    }
    
    .page-title {
        font-size: 1.8rem;
        margin-bottom: 25px;
    }
    
    .shortcut-container {
        max-width: calc(95px * 3 + 15px * 2 + 70px); /* 3个卡片 + 2个间隙 + 左右padding，稍微加大了一点 */
        padding: 20px;
        gap: 15px;
    }
    
    .shortcut {
        width: 95px;
        min-width: 95px;
        padding: 18px 10px;
    }
    
    .icon-container {
        width: 55px;
        height: 55px;
    }
    
    .shortcut-icon {
        width: 38px;
        height: 38px;
    }
    
    .shortcut-name {
        font-size: 13px;
    }
}

/* 添加页面加载动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 为每个卡片添加延迟动画 */
.shortcut:nth-child(1) { animation-delay: 0.1s; }
.shortcut:nth-child(2) { animation-delay: 0.15s; }
.shortcut:nth-child(3) { animation-delay: 0.2s; }
.shortcut:nth-child(4) { animation-delay: 0.25s; }
.shortcut:nth-child(5) { animation-delay: 0.3s; }
.shortcut:nth-child(6) { animation-delay: 0.35s; }
.shortcut:nth-child(7) { animation-delay: 0.4s; }
.shortcut:nth-child(8) { animation-delay: 0.45s; }
.shortcut:nth-child(9) { animation-delay: 0.5s; }
.shortcut:nth-child(10) { animation-delay: 0.55s; }

/* 添加焦点状态样式 */
.shortcut:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

/* 页脚样式 */
footer {
    margin-top: 30px;
    margin-bottom: 10px;
    color: white;
    font-size: 14px;
    text-align: center;
    opacity: 0.8;
    animation: fadeIn 1.2s ease-out;
    width: 100%;
    max-width: 1000px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

footer #busuanzi_container_site_pv {
    font-size: 13px;
    opacity: 0.9;
}

footer p {
    margin: 0;
}

footer a {
    color: white;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    transition: all var(--transition-fast);
}

footer a:hover {
    border-bottom-color: white;
    opacity: 1;
}