/* games.css - 小游戏页面样式（仅核心功能，不含导航和切换按钮） */

/* 基础重置与全局样式 */
* {
    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;
    transition: background 0.4s ease, color 0.4s ease;
}

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

/* ============================================================
   主标题
   ============================================================ */
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;
    }

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

@media (max-width: 480px) {
    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) {
    h1 {
        font-size: 2.8rem;
    }
    center button {
        width: 160px;
        height: 160px;
    }
}

/* 桌面端优化 (≥1025px) */
@media (min-width: 1025px) {
    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; }

/* 平滑滚动 */
html {
    scroll-behavior: smooth;
}

/* ============================================================
   ★★★ 夜间模式 - 仅游戏页面核心元素 ★★★
   （导航和切换按钮的夜间样式已移至独立CSS）
   ============================================================ */

/* 1. body 背景变黑 */
body.dark-mode {
    background: #121212 !important;
    color: #e0e0e0 !important;
}

/* 2. 主标题（夜间） */
body.dark-mode h1 {
    color: #e0e0e0 !important;
    border-bottom-color: #5a1a1a !important;
}

/* 3. 游戏按钮（夜间） */
body.dark-mode center button {
    background: linear-gradient(145deg, #2a2a40, #1e1e32) !important;
    border-color: rgba(231, 76, 60, 0.2) !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3) !important;
}
body.dark-mode center button:hover {
    box-shadow: 0 20px 50px rgba(231, 76, 60, 0.15) !important;
    border-color: rgba(231, 76, 60, 0.4) !important;
}
body.dark-mode center button a {
    color: #ddd !important;
}
body.dark-mode center button::before {
    background: linear-gradient(90deg, #5a1a1a, #3a0a0a, #5a1a1a) !important;
}
body.dark-mode center button::after {
    color: #e57373 !important;
}
body.dark-mode center button a .game-tag {
    background: linear-gradient(135deg, #5a1a1a, #3a0a0a) !important;
}

/* 隔离 #bottom 不受全局样式影响 */
#bottom,
#bottom * {
    all: initial;
    display: revert;
}

/* 重新定义 #bottom 内部需要的样式 */
#bottom {
    display: block;
    padding: 0;
    margin: 0;
}

#bottom h5 {
    display: block;
    font-size: 0.83em;
    font-weight: bold;
    margin: 1.5em 0;
    text-align: center;
}

#bottom a {
    text-decoration: underline;
    cursor: pointer;
}


#bottom center {
    display: block;
    text-align: center;
}