/* games.css - 小游戏页面样式（针对您的HTML结构定制） */

/* 基础重置与全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
    min-height: 100vh;
    padding: 20px;
    padding-top: 100px;
    margin: 0;
}

/* 隐藏空div，修复移动端大空白 */
div:empty {
    display: none !important;
}

/* ============================================================
   导航栏 - 所有导航链接（排除xsx图片）
   ============================================================ */
body > a:not([href='/xsx']):not([href='/operate']):not([href='/users']) {
    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;
    backdrop-filter: blur(10px);
    height: 45px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body > a:not([href='/xsx']):not([href='/operate']):not([href='/users']):hover {
    background-color: #e74c3c;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

body > a[href='/']:not([href='/xsx']):not([href='/operate']):not([href='/users']) {
    left: 0;
    width: 7%;
    min-width: 50px;
}

body > a[href='/publicShare']:not([href='/xsx']):not([href='/operate']):not([href='/users']) {
    left: 7%;
    width: 11%;
    min-width: 80px;
}

body > a[href='/article']:not([href='/xsx']):not([href='/operate']):not([href='/users']) {
    left: 18%;
    width: 7%;
    min-width: 55px;
}

body > a[href='/essay']:not([href='/xsx']):not([href='/operate']):not([href='/users']) {
    display: none !important;
}

body > a[href='/chat']:not([href='/xsx']):not([href='/operate']):not([href='/users']) {
    left: 25%;
    width: 9%;
    min-width: 65px;
}

body > a[href='/tools']:not([href='/xsx']):not([href='/operate']):not([href='/users']) {
    left: 34%;
    width: 7%;
    min-width: 55px;
}

body > a[href='/games']:not([href='/xsx']):not([href='/operate']):not([href='/users']) {
    left: 41%;
    width: 7%;
    min-width: 55px;
    background-color: #e74c3c;
}

body > a[href='/login']:not([href='/xsx']):not([href='/operate']):not([href='/users']) {
    left: 48%;
    width: 6%;
    min-width: 50px;
}

body > a[href='/signUp']:not([href='/xsx']):not([href='/operate']):not([href='/users']) {
    left: 54%;
    width: 6%;
    min-width: 50px;
}

body > a[href='/comment']:not([href='/xsx']):not([href='/operate']):not([href='/users']) {
    left: 60%;
    width: 11%;
    min-width: 80px;
}

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;
}

/* ============================================================
   主标题
   ============================================================ */
h1 {
    margin: 30px auto 40px;
    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 #e74c3c;
    max-width: 90%;
    text-align: center;
    position: relative;
}

h1::before {
    content: "🎮 ";
    margin-right: 10px;
}

/* ============================================================
   center 容器样式 - 游戏按钮居中排列
   ============================================================ */
center {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 20px;
    max-width: 900px;
    margin: 0 auto;
    padding: 10px;
}

/* ============================================================
   游戏按钮样式 - 正方形方块
   ============================================================ */
center button {
    display: block;
    width: 180px;
    height: 180px;
    padding: 0;
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    border: 2px solid rgba(231, 76, 60, 0.15);
    border-radius: 20px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    flex-shrink: 0;
}

/* 顶部装饰条 */
center button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #e74c3c, #c0392b, #e74c3c);
    background-size: 200% 100%;
    transition: background-position 0.5s ease;
    z-index: 2;
}

center button:hover::before {
    background-position: 100% 0;
}

/* 按钮悬停效果 */
center button:hover {
    transform: translateY(-8px) scale(1.03);
    box-shadow: 0 20px 50px rgba(231, 76, 60, 0.2);
    border-color: rgba(231, 76, 60, 0.3);
}

center button:active {
    transform: translateY(-4px) scale(0.97);
}

/* 按钮内部链接样式 - 铺满整个按钮 */
center button a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: #2c3e50;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 15px;
    position: relative;
    z-index: 1;
}

/* 游戏图标 - 使用伪元素添加 🎲 */
center button a::before {
    content: "🎲";
    font-size: 3.5rem;
    display: block;
    margin-bottom: 8px;
    line-height: 1;
}

/* 按钮右下角箭头 */
center button::after {
    content: "→";
    position: absolute;
    right: 14px;
    bottom: 14px;
    font-size: 1.1rem;
    color: #e74c3c;
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
    z-index: 2;
}

center button:hover::after {
    opacity: 1;
    transform: translateX(0);
}

/* 游戏标签 - 右上角小标签 */
center button a .game-tag {
    display: inline-block;
    padding: 3px 12px;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: #fff;
    border-radius: 12px;
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-top: 6px;
}

/* ============================================================
   移动端通用调整
   ============================================================ */
@media (max-width: 768px) {
    body {
        padding: 15px;
        padding-top: 60px;
    }

    body > a[href='/essay'] {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }

    body > a:not([href='/xsx']):not([href='/operate']):not([href='/users']) {
        animation: none !important;
        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;
        transform: translateX(-100%);
        opacity: 0;
        visibility: hidden;
        transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s;
    }

    body.nav-collapsed > a:not([href='/xsx']):not([href='/operate']):not([href='/users']) {
        transform: translateX(0) !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    body > a[href='/']:not([href='/xsx']):not([href='/operate']):not([href='/users']) { top: 0; }
    body > a[href='/publicShare']:not([href='/xsx']):not([href='/operate']):not([href='/users']) { top: 36px; }
    body > a[href='/article']:not([href='/xsx']):not([href='/operate']):not([href='/users']) { top: 72px; }
    body > a[href='/essay']:not([href='/xsx']):not([href='/operate']):not([href='/users']) { display: none !important; }
    body > a[href='/chat']:not([href='/xsx']):not([href='/operate']):not([href='/users']) { top: 108px; }
    body > a[href='/tools']:not([href='/xsx']):not([href='/operate']):not([href='/users']) { top: 144px; }
    body > a[href='/games']:not([href='/xsx']):not([href='/operate']):not([href='/users']) { top: 180px; }
    body > a[href='/login']:not([href='/xsx']):not([href='/operate']):not([href='/users']) { top: 216px; }
    body > a[href='/signUp']:not([href='/xsx']):not([href='/operate']):not([href='/users']) { top: 252px; }
    body > a[href='/comment']:not([href='/xsx']):not([href='/operate']):not([href='/users']) { top: 288px; }

    body > a[href='/xsx'] {
        position: fixed;
        top: 0;
        right: 0;
        width: 45px;
        height: 36px;
        z-index: 1001;
    }

    .nav-toggle-btn {
        display: block !important;
    }

    h1 {
        margin-top: 60px;
        font-size: 2rem;
    }

    center {
        gap: 14px;
        padding: 5px;
    }

    center button {
        width: 140px;
        height: 140px;
        border-radius: 16px;
    }

    center button a {
        font-size: 1.1rem;
    }

    center button a::before {
        font-size: 2.8rem;
    }

    center button::after {
        display: none;
    }
}

/* 超小屏幕 (≤480px) */
@media (max-width: 480px) {
    body > a:not([href='/xsx']):not([href='/operate']):not([href='/users']) {
        font-size: 0.7rem;
        padding: 6px 10px;
        height: 32px;
    }

    body > a[href='/']:not([href='/xsx']):not([href='/operate']):not([href='/users']) { top: 0; }
    body > a[href='/publicShare']:not([href='/xsx']):not([href='/operate']):not([href='/users']) { top: 32px; }
    body > a[href='/article']:not([href='/xsx']):not([href='/operate']):not([href='/users']) { top: 64px; }
    body > a[href='/essay']:not([href='/xsx']):not([href='/operate']):not([href='/users']) { display: none !important; }
    body > a[href='/chat']:not([href='/xsx']):not([href='/operate']):not([href='/users']) { top: 96px; }
    body > a[href='/tools']:not([href='/xsx']):not([href='/operate']):not([href='/users']) { top: 128px; }
    body > a[href='/games']:not([href='/xsx']):not([href='/operate']):not([href='/users']) { top: 160px; }
    body > a[href='/login']:not([href='/xsx']):not([href='/operate']):not([href='/users']) { top: 192px; }
    body > a[href='/signUp']:not([href='/xsx']):not([href='/operate']):not([href='/users']) { top: 224px; }
    body > a[href='/comment']:not([href='/xsx']):not([href='/operate']):not([href='/users']) { top: 256px; }

    body > a[href='/xsx'] {
        width: 40px;
        height: 32px;
    }

    .nav-toggle-btn {
        width: 38px;
        height: 38px;
        font-size: 24px;
        top: 3px;
        left: 8px;
        display: block !important;
    }

    h1 {
        font-size: 1.6rem;
        margin-top: 50px;
    }

    center {
        gap: 10px;
    }

    center button {
        width: 110px;
        height: 110px;
        border-radius: 14px;
    }

    center button a {
        font-size: 0.95rem;
        padding: 10px;
    }

    center button a::before {
        font-size: 2.2rem;
        margin-bottom: 4px;
    }

    center button a .game-tag {
        font-size: 0.5rem;
        padding: 2px 8px;
    }
}

/* 平板设备 (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    body > a:not([href='/xsx']):not([href='/operate']):not([href='/users']) {
        font-size: 0.65rem;
        padding: 10px 4px;
        height: 42px;
    }

    body > a[href='/publicShare']:not([href='/xsx']):not([href='/operate']):not([href='/users']),
    body > a[href='/comment']:not([href='/xsx']):not([href='/operate']):not([href='/users']) {
        font-size: 0.6rem;
    }

    h1 {
        font-size: 2.8rem;
    }

    center button {
        width: 160px;
        height: 160px;
    }
}

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

    center button {
        width: 180px;
        height: 180px;
    }
}

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

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

center button {
    animation: fadeIn 0.6s ease-out;
}

center button:nth-child(1) { animation-delay: 0.05s; }
center button:nth-child(2) { animation-delay: 0.1s; }
center button:nth-child(3) { animation-delay: 0.15s; }
center button:nth-child(4) { animation-delay: 0.2s; }

body > a:not([href='/xsx']):not([href='/operate']):not([href='/users']) {
    animation: none !important;
}

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

body > a[href='/games']:not([href='/xsx']):not([href='/operate']):not([href='/users'])::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 {
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(231, 76, 60, 0.04) 0%, transparent 20%),
        radial-gradient(circle at 90% 30%, rgba(231, 76, 60, 0.04) 0%, transparent 20%),
        radial-gradient(circle at 50% 80%, rgba(231, 76, 60, 0.04) 0%, transparent 20%);
}

html {
    scroll-behavior: smooth;
}

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

/* ============================================================
   桌面端：文章悬停显示随笔
   ============================================================ */
@media (min-width: 769px) {
    body > a[href='/essay']:not([href='/xsx']):not([href='/operate']):not([href='/users']) {
        display: none !important;
        opacity: 0;
        visibility: hidden;
        position: fixed;
        top: 45px;
        left: 18%;
        width: 7%;
        min-width: 55px;
        z-index: 999;
        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;
        transition: all 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
        transform: translateY(-10px);
        pointer-events: none;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    body > a[href='/article']:not([href='/xsx']):not([href='/operate']):not([href='/users']):hover ~ a[href='/essay']:not([href='/xsx']):not([href='/operate']):not([href='/users']) {
        display: inline-block !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateY(0) !important;
        pointer-events: auto !important;
    }

    body > a[href='/essay']:not([href='/xsx']):not([href='/operate']):not([href='/users']):hover {
        display: inline-block !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateY(0) !important;
        pointer-events: auto !important;
        background-color: #e67e22 !important;
    }

    body > a[href='/article']:not([href='/xsx']):not([href='/operate']):not([href='/users']):hover {
        background-color: #e67e22;
    }
}

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