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

/* 确保 html 和 body 完全全屏无边距 */
html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* 新增背景层样式 */
.background-layer {
    position: fixed;
    inset: -10%;
    /* 扩大范围，确保边缘完全覆盖 */
    background: url('/static/homepage/bg/bg.png') no-repeat center center;
    /* 使用 cover+ 确保完全覆盖，避免视差移动时露出边缘 */
    background-size: 90% 90%;
    z-index: -1;
    /* 支持硬件加速，提升变换性能 */
    will-change: transform;
    /* 确保变换平滑 */
    backface-visibility: hidden;
    /* 强制消除任何可能的边框或间隙 */
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    /* 移除原有的 background 属性 */
    min-height: 100vh;
    color: #2d2d2d;
    overflow-x: hidden;
}

.header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 20px 2%;
    background: linear-gradient(135deg, #202020 0%, #393939 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    position: fixed;

    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.logo:before {
    content: "";
    display: inline-block;
    background: url("/static/logo/white.png") center center no-repeat;
    background-size: contain;
    border-right: 2px solid #d4d4d4;
    height: 2em;
    vertical-align: middle;
    aspect-ratio: 1308/501;
    margin-right: 20px;
    padding-right: 20px;
    margin-bottom: 10px;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: -10px;
}

.auth-container {
    position: relative;
}

/* 用户头像和下拉菜单样式 */
.user-dropdown {
    position: relative;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px 15px;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.user-info:hover {
    background: rgba(255, 255, 255, 0.3);
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #202020 0%, #393939 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* 用户上传的头像图片样式 */
.avatar-img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.username {
    color: white;
    font-weight: 500;
    font-size: 16px;
}

.dropdown-arrow {
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    transition: transform 0.3s ease;
}

.user-info:hover .dropdown-arrow {
    color: white;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    min-width: 150px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: block;
    padding: 12px 20px;
    color: #333;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    border-bottom: 1px solid #eee;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: #f8f9fa;
    color: #667eea;
}

/* 专门为退出登录项设置红色 */
.dropdown-item.warn-item {
    color: #dc3545 !important;
}

.dropdown-item.warn-item:hover {
    background: #f8f9fa;
    color: #c82333 !important;
}

.auth-buttons {
    display: flex;
    gap: 15px;
}

.btn {
    padding: 12px 25px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    font-size: 16px;
}

.btn-login {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-login:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* 登录用户的小按钮样式 */
.btn-small {
    padding: 8px 15px;
    font-size: 0.9rem;
    background: linear-gradient(135deg, #202020 0%, #393939 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 5px;
}

.btn-small:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d !important;
}

.btn-secondary:hover {
    box-shadow: 0 5px 15px rgba(108, 117, 125, 0.4) !important;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 50px 20px;
    text-align: center;
}

.welcome-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 60px 40px;
    margin-bottom: 40px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

h1 {
    font-size: 3rem;
    margin-bottom: 20px;
    color: #4a5568;
    background: linear-gradient(135deg, #202020 0%, #393939 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.2rem;
    color: #718096;
    margin-bottom: 40px;
    line-height: 1.6;
}



.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 50px;
}

.feature-card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-10px);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 20px;
}

.feature-title {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: #4a5568;
}

.feature-desc {
    color: #718096;
    line-height: 1.6;
}


/* 棋子展示容器 - 新增核心样式 */
.chess-display-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1;
    pointer-events: none;
    /* 让鼠标事件穿透到 canvas */
    /* 确保容器没有任何边距或边框 */
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

#chessCanvas {
    display: block;
    pointer-events: auto;
    /* canvas 本身可以接收鼠标事件 */
    touch-action: none;
    /* 防止移动端默认触摸行为 */
    mix-blend-mode: multiply;
    /* 关键：变暗混合模式，使 canvas 内容（黑色线稿）与背景纸张纹理混合，产生铅笔画效果 */
    /* 确保 canvas 完全覆盖 */
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.click-hint {
    position: absolute;
    bottom: 10%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.2rem;
    font-weight: 500;
    text-align: center;
    padding: 15px 30px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 50px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    transition: opacity 0.3s ease;
    pointer-events: none;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    letter-spacing: 1px;
}

footer,
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    text-align: center;
    color: rgba(255, 255, 255, 0.6);

    font-size: 1.1rem;
    z-index: 10;
    padding: 10px 20px;
    background: linear-gradient(135deg, #202020 0%, #393939 100%);
    backdrop-filter: blur(5px);
    border-radius: 0;
}

/* 退出确认弹框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    background: linear-gradient(135deg, #202020 0%, #393939 100%);
    color: white;
    padding: 20px;
    text-align: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
}

.modal-body {
    padding: 30px;
    text-align: center;
}

.modal-body p {
    margin: 0;
    font-size: 1.1rem;
    color: #555;
}

.modal-footer {
    padding: 20px;
    display: flex;
    gap: 15px;
    justify-content: center;
    background: #f8f9fa;
    border-top: 1px solid #eee;
}

.btn-cancel {
    background: #6c757d;
    color: white;
    padding: 10px 25px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-cancel:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-confirm {
    background: #dc3545;
    color: white;
    padding: 10px 25px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-confirm:hover {
    background: #c82333;
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
    }

    h1 {
        font-size: 2rem;
    }

    .welcome-section {
        padding: 40px 20px;
    }

    .user-info {
        padding: 6px 12px;
    }

    .avatar {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .username {
        font-size: 14px;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .click-hint {
        font-size: 1rem;
        padding: 12px 20px;
        bottom: 15%;
    }
}