/* 基础样式重置 */
* {
    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;
}

/* 悬浮导航栏 - 现在有9个链接（包括article和xsx） */
body > a:not([href='/compressImage']):not([href='/convertImage']):not([href='/imageToIco']):not([href='/xsx']) {
    display: inline-block;
    position: fixed;
    top: 0;
    z-index: 1000;
    text-decoration: none;
    padding: 10px 6px;
    font-weight: 600;
    font-size: 0.75rem;
    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;
    height: 45px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 导航链接悬停效果 */
body > a:not([href='/compressImage']):not([href='/convertImage']):not([href='/imageToIco']):not([href='/xsx']):hover {
    background-color: #9b59b6;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* 为每个导航链接定位 - 8个左侧导航链接（xsx单独处理） */
body > a[href='/']:not([href='/compressImage']):not([href='/convertImage']):not([href='/imageToIco']):not([href='/xsx']) {
    left: 0;
    width: 8%;
    min-width: 55px;
}

body > a[href='/publicShare']:not([href='/compressImage']):not([href='/convertImage']):not([href='/imageToIco']):not([href='/xsx']) {
    left: 8%;
    width: 12%;
    min-width: 85px;
}

body > a[href='/article']:not([href='/compressImage']):not([href='/convertImage']):not([href='/imageToIco']):not([href='/xsx']) {
    left: 20%;
    width: 8%;
    min-width: 60px;
}

body > a[href='/chat']:not([href='/compressImage']):not([href='/convertImage']):not([href='/imageToIco']):not([href='/xsx']) {
    left: 28%;
    width: 10%;
    min-width: 70px;
}

body > a[href='/tools']:not([href='/compressImage']):not([href='/convertImage']):not([href='/imageToIco']):not([href='/xsx']) {
    left: 38%;
    width: 8%;
    min-width: 60px;
    background-color: #9b59b6;
}

body > a[href='/login']:not([href='/compressImage']):not([href='/convertImage']):not([href='/imageToIco']):not([href='/xsx']) {
    left: 46%;
    width: 7%;
    min-width: 55px;
}

body > a[href='/signUp']:not([href='/compressImage']):not([href='/convertImage']):not([href='/imageToIco']):not([href='/xsx']) {
    left: 53%;
    width: 7%;
    min-width: 55px;
}

body > a[href='/comment']:not([href='/compressImage']):not([href='/convertImage']):not([href='/imageToIco']):not([href='/xsx']) {
    left: 60%;
    width: 12%;
    min-width: 85px;
}

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

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 50px;
    font-size: clamp(2.2rem, 5vw, 3.2rem);
    color: #2c3e50;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    letter-spacing: 1px;
    padding-bottom: 15px;
    border-bottom: 3px solid #9b59b6;
    max-width: 90%;
    text-align: center;
    position: relative;
}

/* 添加工具图标到标题 */
h1::before {
    content: "🛠️ ";
    margin-right: 10px;
}

/* 工具链接容器 - 包含图片压缩、格式转换、图片转ico */
body > a[href='/compressImage'],
body > a[href='/convertImage'],
body > a[href='/imageToIco'] {
    display: block;
    width: 80%;
    max-width: 600px;
    margin: 25px auto;
    text-decoration: none;
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    color: white;
    padding: clamp(18px, 3vw, 25px);
    border-radius: 15px;
    font-size: clamp(1.2rem, 2.5vw, 1.5rem);
    font-weight: 600;
    text-align: center;
    box-shadow: 0 8px 25px rgba(155, 89, 182, 0.25);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

/* 工具链接悬停效果 */
body > a[href='/compressImage']:hover,
body > a[href='/convertImage']:hover,
body > a[href='/imageToIco']:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 35px rgba(155, 89, 182, 0.4);
    background: linear-gradient(135deg, #8e44ad, #9b59b6);
}

/* 工具链接激活效果 */
body > a[href='/compressImage']:active,
body > a[href='/convertImage']:active,
body > a[href='/imageToIco']:active {
    transform: translateY(0) scale(0.98);
}

/* 工具链接图标 - 背景光效 */
body > a[href='/compressImage']::before,
body > a[href='/convertImage']::before,
body > a[href='/imageToIco']::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

body > a[href='/compressImage']:hover::before,
body > a[href='/convertImage']:hover::before,
body > a[href='/imageToIco']:hover::before {
    opacity: 1;
}

/* 为每个工具链接添加特定图标 */
body > a[href='/compressImage']::after {
    content: "📷";
    margin-left: 10px;
    font-size: 1.2em;
}

body > a[href='/convertImage']::after {
    content: "🔄";
    margin-left: 10px;
    font-size: 1.2em;
}

body > a[href='/imageToIco']::after {
    content: "➡️";
    margin-left: 10px;
    font-size: 1.2em;
}

/* 图片转ico链接单独的颜色（可选，稍有不同的紫色） */
body > a[href='/imageToIco'] {
    background: linear-gradient(135deg, #8e44ad, #6c3483);
}

body > a[href='/imageToIco']:hover {
    background: linear-gradient(135deg, #6c3483, #8e44ad);
}

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

/* 响应式设计 - 移动端 */
@media (max-width: 768px) {
    body {
        padding-top: 100px;
    }
    
    /* 导航栏在小屏幕上垂直堆叠 */
    body > a:not([href='/compressImage']):not([href='/convertImage']):not([href='/imageToIco']):not([href='/xsx']) {
        position: fixed;
        display: block;
        width: 100% !important;
        left: 0 !important;
        top: auto;
        padding: 8px 12px;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        font-size: 0.8rem;
        height: 36px;
        text-align: left;
        padding-left: 20px;
    }
    
    /* 为每个导航链接设置垂直位置 - 8个链接 */
    body > a[href='/']:not([href='/compressImage']):not([href='/convertImage']):not([href='/imageToIco']):not([href='/xsx']) {
        top: 0;
    }
    
    body > a[href='/publicShare']:not([href='/compressImage']):not([href='/convertImage']):not([href='/imageToIco']):not([href='/xsx']) {
        top: 36px;
    }
    
    body > a[href='/article']:not([href='/compressImage']):not([href='/convertImage']):not([href='/imageToIco']):not([href='/xsx']) {
        top: 72px;
    }
    
    body > a[href='/chat']:not([href='/compressImage']):not([href='/convertImage']):not([href='/imageToIco']):not([href='/xsx']) {
        top: 108px;
    }
    
    body > a[href='/tools']:not([href='/compressImage']):not([href='/convertImage']):not([href='/imageToIco']):not([href='/xsx']) {
        top: 144px;
    }
    
    body > a[href='/login']:not([href='/compressImage']):not([href='/convertImage']):not([href='/imageToIco']):not([href='/xsx']) {
        top: 180px;
    }
    
    body > a[href='/signUp']:not([href='/compressImage']):not([href='/convertImage']):not([href='/imageToIco']):not([href='/xsx']) {
        top: 216px;
    }
    
    body > a[href='/comment']:not([href='/compressImage']):not([href='/convertImage']):not([href='/imageToIco']):not([href='/xsx']) {
        top: 252px;
    }
    
    /* xsx图片链接在移动端调整位置 */
    body > a[href='/xsx'] {
        position: fixed;
        top: 0;
        right: 0;
        width: 45px;
        height: 36px;
    }
    
    h1 {
        margin-top: 72px;
        font-size: 2rem;
    }
    
    body > a[href='/compressImage'],
    body > a[href='/convertImage'],
    body > a[href='/imageToIco'] {
        width: 90%;
        margin: 20px auto;
        padding: 18px;
    }
}

/* 平板设备 */
@media (min-width: 769px) and (max-width: 1024px) {
    body > a:not([href='/compressImage']):not([href='/convertImage']):not([href='/imageToIco']):not([href='/xsx']) {
        padding: 10px 4px;
        font-size: 0.7rem;
        height: 42px;
    }
    
    body > a[href='/publicShare']:not([href='/compressImage']):not([href='/convertImage']):not([href='/imageToIco']):not([href='/xsx']),
    body > a[href='/comment']:not([href='/compressImage']):not([href='/convertImage']):not([href='/imageToIco']):not([href='/xsx']) {
        font-size: 0.65rem;
    }
    
    h1 {
        font-size: 2.8rem;
    }
}

/* 桌面端优化 */
@media (min-width: 1025px) {
    body > a:not([href='/compressImage']):not([href='/convertImage']):not([href='/imageToIco']):not([href='/xsx']) {
        padding: 12px 8px;
        font-size: 0.8rem;
    }
}

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

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

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

h1 {
    animation: fadeIn 0.8s ease-out;
}

body > a[href='/compressImage'],
body > a[href='/convertImage'],
body > a[href='/imageToIco'] {
    animation: fadeIn 0.8s ease-out;
}

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

body > a[href='/compressImage'] {
    animation-delay: 0.1s;
    animation-fill-mode: both;
}

body > a[href='/convertImage'] {
    animation-delay: 0.2s;
    animation-fill-mode: both;
}

body > a[href='/imageToIco'] {
    animation-delay: 0.3s;
    animation-fill-mode: both;
}

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

/* 添加工具页面说明 */
h1::after {
    content: "选择你需要的小工具";
    display: block;
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    color: #7f8c8d;
    font-weight: normal;
    margin-top: 10px;
    letter-spacing: 0;
}

/* 添加当前页面指示器 */
body > a[href='/tools']:not([href='/compressImage']):not([href='/convertImage']):not([href='/imageToIco']):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;
}

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

/* 移动端优化 - 小屏幕手机 */
@media (max-width: 480px) {
    body > a:not([href='/compressImage']):not([href='/convertImage']):not([href='/imageToIco']):not([href='/xsx']) {
        font-size: 0.7rem;
        padding: 6px 10px;
        height: 32px;
    }
    
    body > a[href='/']:not([href='/compressImage']):not([href='/convertImage']):not([href='/imageToIco']):not([href='/xsx']) {
        top: 0;
    }
    
    body > a[href='/publicShare']:not([href='/compressImage']):not([href='/convertImage']):not([href='/imageToIco']):not([href='/xsx']) {
        top: 32px;
    }
    
    body > a[href='/article']:not([href='/compressImage']):not([href='/convertImage']):not([href='/imageToIco']):not([href='/xsx']) {
        top: 64px;
    }
    
    body > a[href='/chat']:not([href='/compressImage']):not([href='/convertImage']):not([href='/imageToIco']):not([href='/xsx']) {
        top: 96px;
    }
    
    body > a[href='/tools']:not([href='/compressImage']):not([href='/convertImage']):not([href='/imageToIco']):not([href='/xsx']) {
        top: 128px;
    }
    
    body > a[href='/login']:not([href='/compressImage']):not([href='/convertImage']):not([href='/imageToIco']):not([href='/xsx']) {
        top: 160px;
    }
    
    body > a[href='/signUp']:not([href='/compressImage']):not([href='/convertImage']):not([href='/imageToIco']):not([href='/xsx']) {
        top: 192px;
    }
    
    body > a[href='/comment']:not([href='/compressImage']):not([href='/convertImage']):not([href='/imageToIco']):not([href='/xsx']) {
        top: 224px;
    }
    
    body > a[href='/xsx'] {
        width: 40px;
        height: 32px;
    }
    
    h1 {
        font-size: 1.8rem;
        margin-top: 64px;
    }
    
    body > a[href='/compressImage'],
    body > a[href='/convertImage'],
    body > a[href='/imageToIco'] {
        padding: 14px;
        font-size: 1rem;
    }
}

/* ========= 移动端折叠/展开按钮样式 ========= */
.nav-toggle-btn {
    display: none;
    position: fixed;
    top: 5px;
    left: 10px;
    z-index: 1002;
    width: 44px;
    height: 44px;
    background: #9b59b6;
    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: #8e44ad;
    transform: scale(1.02);
}

/* 移动端显示按钮 */
@media (max-width: 768px) {
    .nav-toggle-btn {
        display: block;
    }
}

/* 小屏手机适配 */
@media (max-width: 480px) {
    .nav-toggle-btn {
        width: 38px;
        height: 38px;
        font-size: 24px;
        top: 3px;
        left: 8px;
    }
}

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

/* ========= 桌面端：鼠标放在"文章"上时在下方展开显示"随笔"链接 ========= */
@media (min-width: 769px) {
    /* 确保文章链接和随笔链接有正确的层级关系 */
    body > a[href='/article'] {
        position: relative;
        z-index: 1001;
    }
    
    /* 默认隐藏随笔导航项 */
    body > a[href='/essay'] {
        display: none !important;
        position: fixed;
        top: 40px !important;  /* 文章链接高度40px，正好在下方 */
        left: 20% !important;   /* 与文章链接相同的left值 */
        width: 8% !important;
        min-width: 60px !important;
        background: linear-gradient(135deg, rgba(52, 73, 94, 0.98), rgba(44, 62, 80, 0.98));
        backdrop-filter: blur(12px);
        border-radius: 0 0 10px 10px;
        border-top: 2px solid #e67e22;
        height: 40px;
        line-height: 40px;
        padding: 0 6px;
        font-size: 0.75rem;
        font-weight: 600;
        text-align: center;
        color: #fff;
        text-decoration: none;
        z-index: 1002;
        opacity: 0;
        visibility: hidden;
        transition: all 0.25s ease;
        transform: translateY(-5px);
        pointer-events: none;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
    
    /* 鼠标悬浮在文章链接上时，显示随笔链接 */
    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: linear-gradient(135deg, #e67e22, #d35400) !important;
    }
    
    /* 文章链接悬浮时改变背景色 */
    body > a[href='/article']:hover {
        background-color: #e67e22 !important;
    }
    
    /* 随笔链接悬停效果增强 */
    body > a[href='/essay']:hover {
        background-color: #e67e22 !important;
        color: #fff !important;
    }
}

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