/* 全局重置与基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "微软雅黑", Arial, sans-serif;
}

body {
    background-color: #f0f2f5;
    padding: 20px;
    min-height: 100vh;
}

/* 主容器样式 */
.main-container {
    max-width: 800px;
    margin: 0 auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Tab标签栏样式 */
.tabs-nav {
    display: flex;
    background-color: #fdf2f8;
    overflow-x: auto; /* 移动端横向滚动 */
    scrollbar-width: none; /* 隐藏滚动条 */
}

.tabs-nav::-webkit-scrollbar {
    display: none;
}

.tab-item {
    flex: 0 0 auto;
    padding: 16px 20px;
    text-align: center;
    list-style: none;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    color: #333;
}

.tab-item.active {
    background-color: #fff;
    border-bottom-color: #e63946;
    color: #e63946;
    font-weight: 600;
}

.tab-item:hover {
    background-color: #fef7fb;
}

/* Tab面板通用样式 */
.tab-panel {
    padding: 30px;
    display: none;
    animation: fadeIn 0.5s ease;
}

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

.tab-panel.active {
    display: block;
}

/* 1. 温馨页面样式 */
.welcome-panel {
    text-align: center;
}

.text-box {
    color: #e63946;
    margin-bottom: 20px;
}

.text-box h1 {
    font-size: 28px;
    margin-bottom: 10px;
}

.text-box p {
    font-size: 18px;
    line-height: 1.6;
}

.img-box img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 2. 小游戏通用样式 */
.game-title {
    color: #333;
    margin-bottom: 20px;
    font-size: 22px;
    text-align: center;
}

.game-desc {
    color: #666;
    margin-bottom: 25px;
    line-height: 1.6;
    text-align: center;
}

.game-btn {
    padding: 10px 20px;
    background-color: #e63946;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px;
    margin: 5px;
}

.game-btn:hover {
    background-color: #d62828;
}

.game-btn:active {
    transform: scale(0.98);
}

.game-input {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    width: 200px;
    margin: 0 10px;
    outline: none;
}

.game-input:focus {
    border-color: #e63946;
    box-shadow: 0 0 0 2px rgba(230, 57, 70, 0.2);
}

.game-result {
    margin-top: 20px;
    padding: 15px;
    border-radius: 6px;
    background-color: #f8f9fa;
    color: #333;
    min-height: 40px;
    text-align: center;
    font-size: 18px;
}

/* 猜数字游戏样式 */
.guess-wrap {
    text-align: center;
}

/* 石头剪刀布样式 */
.rps-wrap {
    text-align: center;
}

.rps-options {
    margin: 20px 0;
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* 记忆卡片游戏样式 */
.memory-wrap {
    text-align: center;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    max-width: 500px;
    margin: 20px auto;
}

.memory-card {
    width: 100%;
    aspect-ratio: 1/1;
    background-color: #e63946;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: transparent;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.memory-card.flipped {
    background-color: #fff;
    color: #e63946;
    border: 2px solid #e63946;
}

.memory-card.matched {
    background-color: #67c23a;
    color: #fff;
    cursor: default;
}

/* 井字棋游戏样式 */
.tic-tac-toe-wrap {
    text-align: center;
}

.ttt-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-width: 300px;
    margin: 20px auto;
}

.ttt-cell {
    width: 100%;
    aspect-ratio: 1/1;
    background-color: #f8f9fa;
    border: 2px solid #e63946;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: #e63946;
    transition: background-color 0.2s ease;
}

.ttt-cell:hover {
    background-color: #fef0f0;
}

.ttt-cell.disabled {
    cursor: not-allowed;
    background-color: #fff;
}

/* 响应式适配 */
@media (max-width: 600px) {
    .card-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .game-input {
        width: 100%;
        margin: 10px 0;
    }

    .game-btn {
        width: 100%;
        margin: 5px 0;
    }

    .tab-item {
        padding: 12px 15px;
        font-size: 14px;
    }

    .tab-panel {
        padding: 20px 15px;
    }

    .text-box h1 {
        font-size: 24px;
    }

    .text-box p {
        font-size: 16px;
    }

    .ttt-cell {
        font-size: 30px;
    }
}