/* 基础样式重置 - 与之前页面保持一致 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
    color: #333;
    min-height: 100vh;
    padding-top: 100px;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 悬浮导航栏 - 8个链接 */
body > a {
    display: inline-block;
    position: fixed;
    top: 0;
    z-index: 1000;
    text-decoration: none;
    padding: 12px 10px;
    font-weight: 600;
    font-size: 0.85rem;
    color: #fff;
    background-color: rgba(52, 73, 94, 0.95);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    text-align: center;
    backdrop-filter: blur(10px);
}

/* 导航链接悬停效果 */
body > a:hover {
    background-color: #3498db;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* 为每个导航链接定位 - 8个链接 */
body > a[href='/'] {
    left: 0;
    width: 8%;
    min-width: 65px;
    background-color: #3498db;
}

body > a[href='/publicShare'] {
    left: 8%;
    width: 14%;
    min-width: 100px;
}

body > a[href='/article'] {
    left: 22%;
    width: 10%;
    min-width: 80px;
}

body > a[href='/chat'] {
    left: 32%;
    width: 12%;
    min-width: 90px;
}

body > a[href='/tools'] {
    left: 44%;
    width: 9%;
    min-width: 75px;
}

body > a[href='/login'] {
    left: 53%;
    width: 8%;
    min-width: 65px;
}

body > a[href='/signUp'] {
    left: 61%;
    width: 8%;
    min-width: 65px;
}

body > a[href='/comment'] {
    left: 69%;
    width: 14%;
    min-width: 100px;
}

/* xsx图片链接单独处理，固定在右上角 */
body > a[href='/xsx'] {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 1001;
    width: 55px;
    height: 45px;
    background: transparent;
    border: none;
    padding: 0;
    backdrop-filter: none;
}

body > a[href='/xsx'] img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    margin: 0;
    border-radius: 0;
    border: none;
    box-shadow: none;
}

body > a[href='/xsx'] img:hover {
    transform: none;
    animation: none;
}

/* 主标题 */
h1 {
    margin: 30px auto 20px;
    font-size: clamp(2.5rem, 5vw, 4rem);
    color: #2c3e50;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    letter-spacing: 1.5px;
    padding-bottom: 15px;
    border-bottom: 3px solid #3498db;
    max-width: 90%;
    text-align: center;
    position: relative;
}


/* 小猪图片样式 */
body > img[src='./static/img/pig.gif'] {
    display: block;
    margin: 20px auto;
    border-radius: 18px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2);
    max-width: 85%;
    height: auto;
    transition: transform 0.5s ease, box-shadow 0.5s ease;
    border: 5px solid white;
}

body > img[src='./static/img/pig.gif']:hover {
    transform: scale(1.05) rotate(2deg);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.3);
}

/* 欢迎语h4样式 */
h4 {
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    color: #2ecc71;
    margin: 20px auto 40px;
    padding: 15px 25px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    max-width: 80%;
    text-align: center;
    border-left: 4px solid #2ecc71;
    font-weight: 600;
    position: relative;
    padding-right: 50px;
}

/* video视频样式 */
video {
    display: block;
    margin: 30px auto;
    border-radius: 18px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2);
    max-width: 85%;
    height: auto;
    border: 5px solid white;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

video:hover {
    transform: scale(1.02);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.3);
}

/* operate链接样式 */
a[href='/operate'] {
    display: block;
    width: fit-content;
    margin: 30px auto 20px;
    padding: 16px 35px;
    font-size: 1.2rem;
    background: linear-gradient(135deg, #3498db, #2ecc71);
    color: white;
    border-radius: 50px;
    border: none;
    text-decoration: none;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.35);
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

a[href='/operate']::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #2ecc71, #3498db);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.4s ease;
}

a[href='/operate']:hover {
    transform: translateY(-7px) scale(1.05);
    box-shadow: 0 15px 35px rgba(52, 152, 219, 0.5);
}

a[href='/operate']:hover::before {
    opacity: 1;
}

a[href='/operate']:active {
    transform: translateY(0) scale(0.98);
}

/* 添加operate按钮图标 */
a[href='/operate']::after {
    content: "🚀";
    margin-left: 10px;
}

/* users链接样式 */
a[href='/users'] {
    display: block;
    width: fit-content;
    margin: 20px auto 20px;
    padding: 16px 35px;
    font-size: 1.2rem;
    background: linear-gradient(135deg, #e74c3c, #9b59b6);
    color: white;
    border-radius: 50px;
    border: none;
    text-decoration: none;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 8px 25px rgba(231, 76, 60, 0.35);
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

a[href='/users']::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #9b59b6, #e74c3c);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.4s ease;
}

a[href='/users']:hover {
    transform: translateY(-7px) scale(1.05);
    box-shadow: 0 15px 35px rgba(231, 76, 60, 0.5);
}

a[href='/users']:hover::before {
    opacity: 1;
}

a[href='/users']:active {
    transform: translateY(0) scale(0.98);
}

/* 添加users按钮图标 */
a[href='/users']::after {
    content: "👥";
    margin-left: 10px;
}

/* about联系我们区域样式 */
.about {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.9));
    border-radius: 20px;
    padding: 25px 35px;
    margin: 40px auto 30px;
    width: 90%;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-top: 4px solid #3498db;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.about:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.about h3 {
    font-size: 1.2rem;
    color: #2c3e50;
    margin: 8px 0;
    font-weight: 500;
}

.about h3:first-child {
    font-size: 1.5rem;
    font-weight: 700;
    color: #3498db;
    margin-bottom: 15px;
}

/* 空div的隐藏 */
div:empty {
    display: none;
}

/* ========= 移动端折叠/展开按钮样式 ========= */
.nav-toggle-btn {
    display: none;
    position: fixed;
    top: 5px;
    left: 10px;
    z-index: 1002;
    width: 44px;
    height: 44px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.nav-toggle-btn:hover {
    background: #2c3e50;
    transform: scale(1.02);
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding-top: 90px;
    }
    
    /* 导航栏在小屏幕上垂直堆叠 - 默认展开 */
    body > a:not([href='/xsx']) {
        position: fixed;
        display: block;
        width: 100% !important;
        left: 0 !important;
        top: auto;
        padding: 8px 10px;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        font-size: 0.8rem;
        transform: translateX(0);
        opacity: 1;
        visibility: visible;
        transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s;
    }
    
    /* 收缩状态（点击按钮后隐藏） */
    body.nav-expanded > a:not([href='/xsx']) {
        transform: translateX(-100%);
        opacity: 0;
        visibility: hidden;
    }
    
    /* 为每个导航链接设置垂直位置 - 8个链接 */
    body > a[href='/']:not([href='/xsx']) {
        top: 0;
    }
    
    body > a[href='/publicShare']:not([href='/xsx']) {
        top: 38px;
    }
    
    body > a[href='/article']:not([href='/xsx']) {
        top: 76px;
    }
    
    body > a[href='/chat']:not([href='/xsx']) {
        top: 114px;
    }
    
    body > a[href='/tools']:not([href='/xsx']) {
        top: 152px;
    }
    
    body > a[href='/login']:not([href='/xsx']) {
        top: 190px;
    }
    
    body > a[href='/signUp']:not([href='/xsx']) {
        top: 228px;
    }
    
    body > a[href='/comment']:not([href='/xsx']) {
        top: 266px;
    }
    
    /* xsx图片链接在移动端调整位置 */
    body > a[href='/xsx'] {
        position: fixed;
        top: 0;
        right: 0;
        width: 50px;
        height: 40px;
    }
    
    /* 显示折叠按钮 */
    .nav-toggle-btn {
        display: block;
    }
    
    /* 展开时防止页面滚动穿透 */
    body.nav-expanded {
        overflow-x: hidden;
    }
    
    h1 {
        margin-top: 80px;
        font-size: 2rem;
    }
    
    h4 {
        font-size: 1.2rem;
        margin: 15px auto 30px;
        padding: 10px 15px;
    }
    
    video {
        max-width: 95%;
    }
    
    a[href='/operate'],
    a[href='/users'] {
        padding: 12px 25px;
        font-size: 1rem;
        margin: 15px auto;
    }
    
    .about {
        width: 95%;
        padding: 20px;
    }
    
    .about h3 {
        font-size: 1rem;
    }
    
    .about h3:first-child {
        font-size: 1.3rem;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    body > a:not([href='/xsx']) {
        font-size: 0.8rem;
        padding: 10px 6px;
    }
    
    h1 {
        font-size: 3rem;
    }
}

/* 移动端优化 - 小屏幕手机 */
@media (max-width: 480px) {
    body > a:not([href='/xsx']) {
        font-size: 0.7rem;
        padding: 6px 10px;
        height: 32px;
        line-height: 20px;
    }
    
    body > a[href='/']:not([href='/xsx']) {
        top: 0;
    }
    
    body > a[href='/publicShare']:not([href='/xsx']) {
        top: 32px;
    }
    
    body > a[href='/article']:not([href='/xsx']) {
        top: 64px;
    }
    
    body > a[href='/chat']:not([href='/xsx']) {
        top: 96px;
    }
    
    body > a[href='/tools']:not([href='/xsx']) {
        top: 128px;
    }
    
    body > a[href='/login']:not([href='/xsx']) {
        top: 160px;
    }
    
    body > a[href='/signUp']:not([href='/xsx']) {
        top: 192px;
    }
    
    body > a[href='/comment']:not([href='/xsx']) {
        top: 224px;
    }
    
    body > a[href='/xsx'] {
        width: 40px;
        height: 32px;
    }
    
    .nav-toggle-btn {
        width: 38px;
        height: 38px;
        font-size: 24px;
        top: 3px;
        left: 8px;
    }
    
    h1 {
        font-size: 1.8rem;
        margin-top: 70px;
    }
    
    h4 {
        font-size: 1rem;
        padding: 8px 12px;
    }
    
    a[href='/operate'],
    a[href='/users'] {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .about {
        padding: 15px;
    }
    
    .about h3 {
        font-size: 0.9rem;
    }
    
    .about h3:first-child {
        font-size: 1.2rem;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes slideInFromTop {
    0% {
        transform: translateY(-100%);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

h1, h4, video, a[href='/operate'], a[href='/users'], .about {
    animation: fadeIn 1s ease-out;
}

body > a:not([href='/xsx']) {
    animation: slideInFromTop 0.5s ease-out;
}

video {
    animation-delay: 0.2s;
}

a[href='/operate'] {
    animation-delay: 0.4s;
}

a[href='/users'] {
    animation-delay: 0.5s;
}

.about {
    animation-delay: 0.6s;
}

/* 添加装饰元素 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(to right, #3498db, #2ecc71, #e74c3c, #f39c12);
    z-index: 1001;
}

/* 添加当前页面指示器 */
body > a[href='/']:not([href='/xsx'])::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 50%;
    height: 3px;
    background-color: #fff;
    border-radius: 3px 3px 0 0;
}

/* 添加页面背景装饰点 */
body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(52, 152, 219, 0.05) 0%, transparent 20%),
        radial-gradient(circle at 90% 30%, rgba(46, 204, 113, 0.05) 0%, transparent 20%),
        radial-gradient(circle at 50% 80%, rgba(155, 89, 182, 0.05) 0%, transparent 20%);
    z-index: -1;
    pointer-events: none;
}

/* 添加平滑滚动效果 */
html {
    scroll-behavior: smooth;
}

/* 添加按钮悬停效果增强 */
a[href='/operate']:hover::after,
a[href='/users']:hover::after {
    animation: bounce 0.5s ease infinite alternate;
}

@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-5px); }
}

/* ========= 移动端折叠/展开功能（默认展开，可收缩） ========= */
@media (max-width: 768px) {
    /* 覆盖之前的强制显示规则，让导航栏可以被JS控制 */
    body > a:not([href='/xsx']) {
        transform: translateX(0) !important;
        opacity: 1 !important;
        visibility: visible !important;
        transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s;
    }
    
    /* 收缩状态：点击按钮后隐藏 */
    body.nav-collapsed > a:not([href='/xsx']) {
        transform: translateX(-100%) !important;
        opacity: 0 !important;
        visibility: hidden !important;
    }
}


/* ========= 访客统计卡片样式 ========= */
.visitor-stats {
    position: relative;
    width: fit-content;
    margin: 15px auto;  /* 改为 auto 实现水平居中 */
    background: linear-gradient(135deg, rgba(255,255,255,0.98), rgba(248,249,252,0.96));
    backdrop-filter: blur(4px);
    border-radius: 60px;
    padding: 8px 24px 8px 20px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.8);
    border-left: 5px solid #ff6b6b;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 5;
    transition: all 0.3s ease;
}

/* 去掉原来的移动端单独边距设置，保持居中 */
@media (max-width: 768px) {
    .visitor-stats {
        margin: 12px auto;  /* 移动端也居中 */
        padding: 5px 16px 5px 14px;
    }
    .visitor-icon { 
        font-size: 22px; 
    }
    .visitor-number { 
        font-size: 1.5rem; 
        min-width: 55px; 
    }
    .visitor-text { 
        font-size: 0.8rem; 
    }
}

@media (max-width: 480px) {
    .visitor-stats { 
        margin: 10px auto;  /* 小屏幕也居中 */
        padding: 4px 12px; 
        gap: 6px; 
    }
    .visitor-icon { 
        font-size: 18px; 
    }
    .visitor-number { 
        font-size: 1.3rem; 
        min-width: 45px; 
    }
}

/* ========= 桌面端：鼠标放在"文章"上时展开显示"随笔"链接 ========= */
@media (min-width: 769px) {
    /* 默认隐藏随笔导航项 */
    body > a[href='/essay'] {
        display: none !important;
        opacity: 0;
        visibility: hidden;
        position: fixed;
        top: 38px;
        left: 22%;
        width: 10%;
        min-width: 60px;
        background-color: rgba(52, 73, 94, 0.98);
        backdrop-filter: blur(12px);
        border-radius: 0 0 8px 8px;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        height: 40px;
        line-height: 40px;
        padding: 0 6px;
        font-size: 0.75rem;
        text-align: center;
        z-index: 999;
        transition: all 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
        transform: translateY(-10px);
        pointer-events: none;
    }
    
    /* 当鼠标悬浮在"文章"链接上时，显示"随笔"链接 */
    body > a[href='/article']:hover ~ a[href='/essay'],
    body > a[href='/article']:hover + a[href='/essay'] {
        display: inline-block !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateY(0) !important;
        pointer-events: auto !important;
    }
    
    /* 当鼠标移动到"随笔"链接上时，保持展开状态 */
    body > a[href='/essay']:hover {
        display: inline-block !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateY(0) !important;
        pointer-events: auto !important;
        background-color: #e67e22;
    }
    
    /* 文章链接悬浮时改变背景色 */
    body > a[href='/article']:hover {
        background-color: #e67e22;
    }
    
    /* 随笔链接悬停效果 */
    body > a[href='/essay']:hover {
        background-color: #e67e22 !important;
        transform: translateY(2px);
    }
}

/* 动画 */
@keyframes essayDropdownIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}