/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* 头部样式 */
header {
    text-align: center;
    padding: 2rem 1rem;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* 主内容区域 */
main {
    padding: 2rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* 游戏卡片容器 */
.games-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    padding: 0 1rem;
    max-width: 1600px;
    margin: 0 auto;
}

/* 游戏卡片样式 */
.game-card {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    min-height: 350px;
}

.game-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.game-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.game-card h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: #333;
}

.game-card p {
    font-size: 1rem;
    color: #666;
    margin-bottom: 1.5rem;
    line-height: 1.5;
    flex-grow: 1;
}

.play-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    font-size: 1.1rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    margin-top: auto; /* 确保按钮始终在底部 */
}

.play-btn:hover {
    background: linear-gradient(45deg, #5a6fd8, #6a4190);
    transform: scale(1.05);
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
}

.modal-content {
    background-color: white;
    margin: 0;
    padding: 1rem;
    border-radius: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    overflow-y: auto;
    position: relative;
}


/* 游戏结束弹窗 */
.game-over-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.game-over-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    padding: 2rem;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    min-width: 300px;
    max-width: 90vw;
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.game-over-header {
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 1rem;
}

.game-over-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: bounce 1s ease infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.game-over-stats {
    background: rgba(102, 126, 234, 0.1);
    border-radius: 15px;
    padding: 1rem;
    margin: 1rem 0;
    border: 2px solid rgba(102, 126, 234, 0.2);
}

.game-over-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0.5rem 0;
    font-size: 1.1rem;
}

.game-over-stat-label {
    font-weight: 600;
    color: #333;
}

.game-over-stat-value {
    font-weight: bold;
    color: #667eea;
    font-size: 1.2rem;
}

.game-over-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.game-over-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.game-over-btn.primary {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.game-over-btn.primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.game-over-btn.secondary {
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.game-over-btn.secondary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.4);
}

/* 确认弹窗 */
.confirm-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.confirm-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(240, 240, 255, 0.95) 100%);
    padding: 2rem;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3),
                0 0 0 1px rgba(102, 126, 234, 0.1);
    min-width: 300px;
    max-width: 90vw;
    animation: slideIn 0.5s ease;
    backdrop-filter: blur(10px);
}

.confirm-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    animation: bounce 2s infinite;
}

.confirm-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 1rem;
}

.confirm-message {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.confirm-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.confirm-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
}

.confirm-btn.cancel {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: white;
    box-shadow: 0 2px 10px rgba(108, 117, 125, 0.3);
}

.confirm-btn.cancel:hover {
    background: linear-gradient(135deg, #5a6268 0%, #495057 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.4);
}

.confirm-btn.confirm {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

.confirm-btn.confirm:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* 游戏容器 */
#game-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 0;
    box-sizing: border-box;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    overflow: hidden;
    touch-action: manipulation; /* 只允许基本触摸操作 */
    -webkit-touch-callout: none; /* 禁用iOS长按菜单 */
    -webkit-user-select: none; /* 禁用文本选择 */
    user-select: none; /* 禁用文本选择 */
}

/* 游戏头部 */
.game-header {
    background: rgba(255, 255, 255, 0.95);
    padding: 1rem;
    text-align: center;
    backdrop-filter: blur(10px);
    flex-shrink: 0;
    position: relative;
    overflow: visible;
    z-index: 100;
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.game-title-wrapper {
    position: relative;
    display: inline-block;
}

.game-title {
    margin: 0.5rem 0;
    font-size: 1.5rem;
    font-weight: bold;
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    color: #667eea;
}

.game-title:hover {
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-color: rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

/* 游戏选择菜单 */
.game-menu {
    position: fixed;
    background: white;
    border: 3px solid #667eea;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    padding: 0.8rem;
    min-width: 200px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 9999;
    display: none;
}

.game-menu.show {
    opacity: 1;
    pointer-events: auto;
    display: block;
}

.game-menu-item {
    padding: 0.8rem 1rem;
    margin: 0.2rem 0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
}

.game-menu-item:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    transform: translateX(4px);
}

.game-menu-item:first-child {
    margin-top: 0;
}

.game-menu-item:last-child {
    margin-bottom: 0;
}

.game-menu-item:first-child {
    margin-top: 0;
}

.game-menu-item:last-child {
    margin-bottom: 0;
}

/* 游戏导航 */
.game-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding: 0 0.5rem;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid rgba(102, 126, 234, 0.3);
    color: #667eea;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    min-height: 36px;
    display: flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.nav-btn:hover {
    background: rgba(102, 126, 234, 0.9);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    border-color: rgba(102, 126, 234, 0.8);
}

.nav-btn.back {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(220, 53, 69, 0.3);
    color: #dc3545;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.1);
}

.nav-btn.back:hover {
    background: rgba(220, 53, 69, 0.9);
    color: white;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
    border-color: rgba(220, 53, 69, 0.8);
}

.nav-btn span {
    font-size: 1rem;
}

/* 游戏主体内容 */
.game-main {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    flex: 1;
    justify-content: center;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* 游戏区域容器 */
.game-area {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 249, 250, 0.95) 100%);
    backdrop-filter: blur(20px);
    border-radius: 25px;
    padding: 1.5rem;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.4);
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.game-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg,
        rgba(102, 126, 234, 0.05) 0%,
        rgba(118, 75, 162, 0.05) 50%,
        rgba(102, 126, 234, 0.05) 100%);
    border-radius: 25px;
    pointer-events: none;
}

/* 游戏容器 - 确保正方形显示，PC端更大 */
.puzzle-container, .schulte-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    max-width: 800px;
    width: 100%;
}

/* 移动端容器优化 */
@media (max-width: 768px) {
    .puzzle-container {
        padding: 0.5rem;
    }
}

.puzzle-grid {
    display: grid;
    gap: 8px;
    background: #2c3e50;
    padding: 12px;
    border-radius: 16px;
    width: min(80vw, 80vh, 600px);
    height: min(80vw, 80vh, 600px);
    aspect-ratio: 1;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* PC端更大的游戏网格 */
@media (min-width: 1024px) {
    .puzzle-grid {
        width: min(60vw, 60vh, 700px);
        height: min(60vw, 60vh, 700px);
    }
}

@media (min-width: 1440px) {
    .puzzle-grid {
        width: min(50vw, 50vh, 800px);
        height: min(50vw, 50vh, 800px);
    }
}

.puzzle-tile {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.puzzle-tile:hover {
    transform: scale(0.95);
    opacity: 0.9;
}

.puzzle-tile.empty {
    background: transparent;
    cursor: default;
}

.puzzle-tile.empty:hover {
    transform: none;
    opacity: 1;
}

.schulte-table {
    display: grid;
    gap: 8px;
    background: #2c3e50;
    padding: 12px;
    border-radius: 16px;
    width: min(80vw, 80vh, 600px);
    height: min(80vw, 80vh, 600px);
    aspect-ratio: 1;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* PC端更大的舒尔特表格 */
@media (min-width: 1024px) {
    .schulte-table {
        width: min(60vw, 60vh, 700px);
        height: min(60vw, 60vh, 700px);
    }
}

@media (min-width: 1440px) {
    .schulte-table {
        width: min(50vw, 50vh, 800px);
        height: min(50vw, 50vh, 800px);
    }
}

.schulte-cell {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.schulte-cell:hover {
    transform: scale(0.95);
    opacity: 0.9;
}

.schulte-cell.clicked {
    background: #6c757d;
    cursor: default;
    transform: none;
}

.schulte-cell.clicked:hover {
    transform: none;
    opacity: 0.8;
}

/* 紧凑型游戏统计面板 */
.game-stats-compact {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 0.8rem;
    margin-bottom: 1rem;
    padding: 0.8rem 1rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 800px;
}

.game-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0 1 auto;
    min-width: 80px;
}

.game-stat-item .label {
    font-size: 0.7rem;
    color: #666;
    margin-bottom: 0.3rem;
    font-weight: 500;
}

.game-stat-item .value {
    font-size: 1rem;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    min-width: 60px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(102, 126, 234, 0.3);
}

/* 重置按钮与其他控件保持一致 */
.game-stat-item:last-child {
    align-items: center;
    justify-content: center;
}

.game-stat-item:last-child .btn-reset {
    align-self: center;
}

.game-stat-item select {
    font-size: 0.9rem;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    text-align: center;
    cursor: pointer;
    font-weight: 600;
    min-width: 70px;
    transition: all 0.2s ease;
}

.game-stat-item select:hover {
    border-color: #764ba2;
    transform: translateY(-1px);
}

.game-stat-item button {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.4rem 0.6rem;
    margin: 0;
    border-radius: 6px;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.game-stat-item .btn-reset {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 1px 4px rgba(102, 126, 234, 0.3);
    padding: 0.4rem 0.6rem;
    width: 70px; /* 固定宽度，与select保持一致 */
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 6px;
    border: none;
    text-align: center;
    transition: all 0.2s ease;
}

.game-stat-item .btn-reset:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}


/* 游戏控制面板 */
.game-controls {
    background: rgba(255, 255, 255, 0.95);
    padding: 0.8rem;
    border-radius: 15px;
    margin: 0 0 1rem 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

.game-controls-group {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin: 0.5rem 0;
    flex-wrap: wrap;
}

.game-controls button {
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.3s ease;
    min-height: 48px;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
    position: relative;
    overflow: hidden;
}

.game-controls button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.6s;
}

.game-controls button:hover::before {
    left: 100%;
}

.game-controls button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.4);
}

.game-controls button:active {
    transform: translateY(-1px);
}

.game-controls button.primary {
    background: linear-gradient(45deg, #667eea, #764ba2);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.game-controls button.primary:hover {
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.game-controls button.secondary {
    background: linear-gradient(45deg, #6c757d, #495057);
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.game-controls button.secondary:hover {
    box-shadow: 0 8px 25px rgba(108, 117, 125, 0.4);
}

.game-controls select {
    background: white;
    border: 2px solid #667eea;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    min-height: 48px;
    transition: all 0.3s ease;
    font-weight: 500;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.1);
}

.game-controls select:hover {
    border-color: #764ba2;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.game-controls select:focus {
    outline: none;
    border-color: #764ba2;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

/* 游戏区域美化 */
.sliding-puzzle, .schulte-grid, .memory-grid, .game2048-container {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    border-radius: 20px;
    margin: 1rem 0;
    padding: 1rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 2048特殊布局 */
.puzzle-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
}

/* 移动端2048布局优化 */
@media (max-width: 768px) {
    .puzzle-container {
        gap: 15px;
        padding: 0 10px;
    }
}

/* 记忆翻牌游戏样式 */
.memory-grid {
    display: grid;
    gap: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 12px;
    border-radius: 16px;
    width: min(85vw, 85vh);
    height: min(85vw, 85vh);
    max-width: 350px;
    max-height: 350px;
    margin: 0 auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* PC端更大的记忆网格 */
@media (min-width: 1024px) {
    .memory-grid {
        width: min(80vw, 80vh, 600px);
        height: min(80vw, 80vh, 600px);
        max-width: 600px;
        max-height: 600px;
    }
}

@media (min-width: 1440px) {
    .memory-grid {
        width: min(70vw, 70vh, 700px);
        height: min(70vw, 70vh, 700px);
        max-width: 700px;
        max-height: 700px;
    }
}

.memory-card {
    aspect-ratio: 1;
    cursor: pointer;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 3px solid rgba(255, 255, 255, 0.2);
    user-select: none;
    -webkit-user-select: none;
    overflow: hidden;
    position: relative;
}

.memory-card.hidden {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 1.8em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.memory-card.hidden::before {
    content: '?';
    font-size: 0.8em;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.memory-card.revealed {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border-color: rgba(255, 255, 255, 0.4);
    font-size: 1.4em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    box-shadow: 0 4px 15px rgba(240, 147, 251, 0.4);
    transform: rotateY(0deg);
}

.memory-card.matched {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    border-color: rgba(255, 255, 255, 0.6);
    animation: matchSuccess 0.8s ease-in-out;
    pointer-events: none;
    font-size: 1.5em;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    box-shadow: 0 6px 25px rgba(79, 172, 254, 0.5);
}

.memory-card:hover:not(.matched) {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.4);
}

@keyframes matchSuccess {
    0% {
        transform: scale(1) rotate(0deg);
        box-shadow: 0 4px 15px rgba(79, 172, 254, 0.4);
    }
    25% {
        transform: scale(1.15) rotate(5deg);
        box-shadow: 0 8px 30px rgba(79, 172, 254, 0.6);
    }
    50% {
        transform: scale(1.1) rotate(-3deg);
        box-shadow: 0 10px 35px rgba(79, 172, 254, 0.8);
    }
    75% {
        transform: scale(1.05) rotate(1deg);
        box-shadow: 0 6px 20px rgba(79, 172, 254, 0.6);
    }
    100% {
        transform: scale(1) rotate(0deg);
        box-shadow: 0 6px 25px rgba(79, 172, 254, 0.5);
    }
}

/* 响应式调整 - 移动端 */
@media (max-width: 768px) {
    .memory-grid {
        gap: 6px;
        padding: 10px;
        width: min(75vw, 75vh);
        height: min(75vw, 75vh);
        max-width: 320px;
        max-height: 320px;
        margin: 0 auto;
        flex-shrink: 0;
    }
}

@media (max-width: 480px) {
    .memory-grid {
        gap: 4px;
        padding: 8px;
        width: min(80vw, 80vh);
        height: min(80vw, 80vh);
        max-width: 300px;
        max-height: 300px;
        margin: 0 auto;
        flex-shrink: 0;
    }
}

/* 2048游戏样式 */
.game2048-grid {
    display: grid;
    background: #bbada0;
    border-radius: 12px;
    padding: 10px;
    gap: 10px;
    width: min(80vw, 80vh, 500px);
    height: min(80vw, 80vh, 500px);
    aspect-ratio: 1;
    margin: 0 auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    touch-action: manipulation; /* 2048网格允许触摸操作 */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.game2048-cell {
    background: rgba(238, 228, 218, 0.35);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
}

.game2048-tile {
    background: #eee4da;
    color: #776e65;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    transition: all 0.15s ease-in-out;
    animation: tileAppear 0.2s ease-in-out;
}

/* 2048控制按钮 */
.game2048-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.control-row {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.control-btn {
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.control-btn:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.control-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

/* PC端更大的2048网格 */
@media (min-width: 1024px) {
    .game2048-grid {
        width: min(60vw, 60vh, 600px);
        height: min(60vw, 60vh, 600px);
    }

    .game2048-controls {
        .control-btn {
            width: 70px;
            height: 70px;
            font-size: 1.8rem;
        }
    }
}

@media (min-width: 1440px) {
    .game2048-grid {
        width: min(50vw, 50vh, 700px);
        height: min(50vw, 50vh, 700px);
    }

    .game2048-controls {
        .control-btn {
            width: 80px;
            height: 80px;
            font-size: 2rem;
        }
    }
}

/* 数独游戏样式 */
.sudoku-board {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(9, 1fr);
    gap: 1px;
    background: #764ba2;
    padding: 2px;
    border-radius: 10px;
    width: min(90vw, 90vh);
    height: min(90vw, 90vh);
    max-width: 650px;
    max-height: 650px;
    margin: 0 auto;
}

.sudoku-cell {
    background: white;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    aspect-ratio: 1;
    text-align: center;
    min-width: 35px;
    min-height: 35px;
}

.sudoku-cell:hover {
    background: #f0f8ff;
}

.sudoku-cell.sudoku-selected {
    background: #e6f3ff !important;
    border: 2px solid #667eea;
}

.sudoku-cell.sudoku-given {
    background: #f8f8f8;
    color: #333;
    font-weight: 700;
    cursor: default;
}

.sudoku-cell.sudoku-user-input {
    color: #667eea;
}

.sudoku-cell.sudoku-empty {
    color: #999;
}

.sudoku-cell.sudoku-error {
    background: #ffe6e6 !important;
    color: #dc3545;
    animation: shake 0.5s ease;
}

.sudoku-cell.sudoku-hint {
    background: #e6ffe6 !important;
    animation: pulse 1s ease;
}

.sudoku-border-top {
    border-top: 2px solid #764ba2;
}

.sudoku-border-left {
    border-left: 2px solid #764ba2;
}

.sudoku-border-bottom {
    border-bottom: 2px solid #764ba2;
}

.sudoku-border-right {
    border-right: 2px solid #764ba2;
}

.sudoku-numbers {
    margin-top: 1.5rem;
    text-align: center;
}

.sudoku-numbers-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 1rem;
}

.sudoku-number-buttons {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.sudoku-number-btn {
    width: 40px;
    height: 40px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 50%;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sudoku-number-btn:hover {
    background: #667eea;
    color: white;
    transform: scale(1.1);
}

.sudoku-number-btn:active {
    transform: scale(0.95);
}

.sudoku-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.sudoku-control-btn {
    padding: 0.6rem 1.2rem;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sudoku-control-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.sudoku-control-btn:active {
    transform: translateY(0);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

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


/* 井字棋游戏样式 */
.tic-tac-toe-status {
    text-align: center;
    margin-bottom: 1.5rem;
}

.tic-tac-toe-turn {
    font-size: 1.3rem;
    font-weight: 600;
    color: #333;
    padding: 0.8rem 1.5rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    border-radius: 15px;
    display: inline-block;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.tic-tac-toe-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 8px;
    background: #333;
    padding: 8px;
    border-radius: 15px;
    max-width: 400px;
    width: 100%;
    aspect-ratio: 1;
    margin: 0 auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.tic-tac-toe-cell {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    aspect-ratio: 1;
    text-align: center;
    position: relative;
    color: #333;
}

.tic-tac-toe-cell:hover:not(.tic-tac-toe-x):not(.tic-tac-toe-o) {
    background: #e3f2fd;
    border-color: #667eea;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.tic-tac-toe-cell.tic-tac-toe-x {
    color: #dc3545;
    background: #ffebee;
    border-color: #dc3545;
    font-size: 4rem;
    text-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

.tic-tac-toe-cell.tic-tac-toe-o {
    color: #007bff;
    background: #e3f2fd;
    border-color: #007bff;
    font-size: 4rem;
    text-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

.tic-tac-toe-cell.tic-tac-toe-winning {
    background: #ffe6e6 !important;
    animation: pulse 1s ease infinite;
}

.tic-tac-toe-border-right {
    border-right: 2px solid #764ba2;
}

.tic-tac-toe-border-bottom {
    border-bottom: 2px solid #764ba2;
}

.tic-tac-toe-controls {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.tic-tac-toe-difficulty, .tic-tac-toe-mode, .tic-tac-toe-first-move {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.tic-tac-toe-difficulty label, .tic-tac-toe-mode label, .tic-tac-toe-first-move label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
}

.tic-tac-toe-difficulty select, .tic-tac-toe-mode select, .tic-tac-toe-first-move select {
    padding: 0.4rem 0.6rem;
    border: 2px solid #667eea;
    border-radius: 6px;
    background: white;
    color: #667eea;
    text-align: center;
    cursor: pointer;
    font-weight: 600;
    min-width: 100px;
}

/* 4x4和5x5棋盘的特殊样式 */
.tic-tac-toe-board[data-size="4"] {
    max-width: 500px;
}

.tic-tac-toe-board[data-size="5"] {
    max-width: 550px;
}

.tic-tac-toe-board[data-size="4"] .tic-tac-toe-border-right {
    border-right: 2px solid #333;
}

.tic-tac-toe-board[data-size="4"] .tic-tac-toe-border-bottom {
    border-bottom: 2px solid #333;
}

.tic-tac-toe-board[data-size="5"] .tic-tac-toe-border-right {
    border-right: 2px solid #333;
}

.tic-tac-toe-board[data-size="5"] .tic-tac-toe-border-bottom {
    border-bottom: 2px solid #333;
}

/* 移动端优化 */
@media (max-width: 768px) {
    .game2048-controls {
        padding: 10px;
        gap: 8px;
        margin-top: 15px;
    }

    .control-btn {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    .control-row {
        gap: 8px;
    }

    /* PC端更大的数独棋盘 */
    @media (min-width: 1024px) {
        .sudoku-board {
            width: min(80vw, 80vh, 950px);
            height: min(80vw, 80vh, 950px);
            max-width: 950px;
            max-height: 950px;
        }

        .sudoku-cell {
            font-size: 1.9rem;
            min-width: 48px;
            min-height: 48px;
        }
    }

    @media (min-width: 1440px) {
        .sudoku-board {
            width: min(70vw, 70vh, 1000px);
            height: min(70vw, 70vh, 1000px);
            max-width: 1000px;
            max-height: 1000px;
        }

        .sudoku-cell {
            font-size: 2.1rem;
            min-width: 55px;
            min-height: 55px;
        }
    }

    /* 超大屏幕优化 */
    @media (min-width: 1920px) {
        .sudoku-board {
            width: min(60vw, 60vh, 1100px);
            height: min(60vw, 60vh, 1100px);
            max-width: 1100px;
            max-height: 1100px;
        }

        .sudoku-cell {
            font-size: 2.3rem;
            min-width: 60px;
            min-height: 60px;
        }
    }

    /* 数独游戏移动端优化 */
    .sudoku-board {
        max-width: 80vw;
        gap: 1px;
        min-height: 280px;
        width: 280px;
        height: 280px;
        margin: 0 auto;
        flex-shrink: 0;
    }

    .sudoku-numbers {
        margin-top: 0.5rem;
        padding: 0.5rem;
    }

    .sudoku-cell {
        font-size: 1.1rem;
        min-width: 28px;
        min-height: 28px;
    }

    .sudoku-numbers {
        margin-top: 1rem;
    }

    .sudoku-number-buttons {
        gap: 0.3rem;
    }

    .sudoku-number-btn {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
    }

    .sudoku-controls {
        flex-direction: column;
        gap: 0.5rem;
    }

    .sudoku-control-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.75rem;
        min-width: 60px;
        flex: 1;
    }

    /* 数独游戏更紧凑的移动端布局 */
    .sudoku-board {
        width: min(85vw, 85vh);
        height: min(85vw, 85vh);
        max-width: 280px;
        max-height: 280px;
        gap: 1px;
        margin-bottom: 0.3rem;
    }

    .sudoku-numbers {
        margin-top: 0rem;
        padding: 0.15rem 0.3rem;
        margin-bottom: 0.3rem;
    }

    .sudoku-cell {
        font-size: 1.1rem;
        min-width: auto;
        min-height: auto;
    }

    .sudoku-number-buttons {
        gap: 0.15rem;
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: center;
        padding: 0.1rem 0;
        margin-bottom: 0.3rem;
    }

    .sudoku-number-btn {
        width: 30px;
        height: 30px;
        font-size: 0.85rem;
        padding: 0;
        flex-shrink: 0;
        border-width: 1.5px;
    }

    .sudoku-controls {
        flex-direction: row;
        gap: 0.6rem;
        justify-content: center;
        margin-top: 0rem;
    }

    .sudoku-control-btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.85rem;
        min-width: 80px;
        flex: 1;
    }

    /* 井字棋游戏移动端优化 */
    .tic-tac-toe-board {
        max-width: 300px;
        gap: 5px;
        padding: 5px;
    }

    .tic-tac-toe-board[data-size="4"] {
        max-width: 320px;
    }

    .tic-tac-toe-board[data-size="5"] {
        max-width: 350px;
    }

    .tic-tac-toe-cell {
        font-size: 2.2rem;
        border-width: 1px;
    }

    .tic-tac-toe-cell.tic-tac-toe-x,
    .tic-tac-toe-cell.tic-tac-toe-o {
        font-size: 2.4rem;
    }

    .tic-tac-toe-controls {
        gap: 1rem;
        flex-direction: column;
        align-items: center;
    }

    .tic-tac-toe-difficulty, .tic-tac-toe-mode, .tic-tac-toe-first-move {
        gap: 0.3rem;
        flex-direction: row;
    }

    .tic-tac-toe-difficulty select, .tic-tac-toe-mode select, .tic-tac-toe-first-move select {
        font-size: 0.8rem;
        padding: 0.3rem 0.5rem;
        min-width: 70px;
    }

    /* 确认框移动端优化 */
    .confirm-content {
        min-width: 280px;
        max-width: 85vw;
        padding: 1.5rem;
    }

    .confirm-icon {
        font-size: 2.5rem;
    }

    .confirm-title {
        font-size: 1.3rem;
    }

    .confirm-message {
        font-size: 1rem;
        margin-bottom: 1.2rem;
    }

    .confirm-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
        min-width: 80px;
    }

    .confirm-buttons {
        gap: 0.8rem;
        flex-direction: column-reverse;
    }

    .confirm-buttons .confirm-btn {
        width: 100%;
    }
}

.game2048-cell-bg {
    background: rgba(238, 228, 218, 0.35);
    border-radius: 6px;
}

.game2048-tile {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    border-radius: 6px;
    transition: all 0.15s ease-in-out;
    animation: tileAppear 0.2s ease-in-out;
}

@keyframes tileAppear {
    0% {
        opacity: 0;
        transform: scale(0);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* 2048数字块颜色 */
.game2048-tile-2 {
    background: #eee4da;
    color: #776e65;
}

.game2048-tile-4 {
    background: #ede0c8;
    color: #776e65;
}

.game2048-tile-8 {
    background: #f2b179;
    color: #f9f6f2;
}

.game2048-tile-16 {
    background: #f59563;
    color: #f9f6f2;
}

.game2048-tile-32 {
    background: #f67c5f;
    color: #f9f6f2;
}

.game2048-tile-64 {
    background: #f65e3b;
    color: #f9f6f2;
}

.game2048-tile-128 {
    background: #edcf72;
    color: #f9f6f2;
    font-size: 1.8rem;
}

.game2048-tile-256 {
    background: #edcc61;
    color: #f9f6f2;
    font-size: 1.8rem;
}

.game2048-tile-512 {
    background: #edc850;
    color: #f9f6f2;
    font-size: 1.8rem;
}

.game2048-tile-1024 {
    background: #edc53f;
    color: #f9f6f2;
    font-size: 1.5rem;
}

.game2048-tile-2048 {
    background: #edc22e;
    color: #f9f6f2;
    font-size: 1.5rem;
    box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0.3);
}

/* 更大数字的颜色 */
.game2048-tile-4096 {
    background: #3c3a32;
    color: #f9f6f2;
    font-size: 1.3rem;
}

.game2048-tile-8192 {
    background: #3c3a32;
    color: #f9f6f2;
    font-size: 1.3rem;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .games-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
        max-width: 800px;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .games-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        max-width: 600px;
    }

    .game-card {
        padding: 1.5rem;
        min-height: 320px;
    }

    /* 移动端游戏头部优化 */
    .game-header {
        padding: 0.8rem;
    }

    .game-title {
        font-size: 1.3rem;
        padding: 0.4rem 0.8rem;
    }

    /* 移动端紧凑统计面板 */
    .game-stats-compact {
        padding: 0.6rem 0.8rem;
        margin-bottom: 0.8rem;
        gap: 0.5rem;
        flex-wrap: wrap;
        justify-content: center;
        align-items: flex-end;
    }

    .game-stat-item {
        min-width: 70px;
        flex: 1 1 calc(50% - 0.5rem);
        max-width: 120px;
    }

    /* 确保最后一个item（重置按钮）在移动端也居中对齐 */
    .game-stats-compact .game-stat-item:last-child {
        align-items: center;
        justify-content: center;
    }

    .game-stat-item .label {
        font-size: 0.65rem;
        margin-bottom: 0.2rem;
    }

    .game-stat-item .value {
        font-size: 0.9rem;
        padding: 0.3rem 0.6rem;
        min-width: 50px;
    }

    .game-stat-item select {
        font-size: 0.8rem;
        padding: 0.3rem 0.5rem;
        min-width: 60px;
    }

    .game-stat-item button {
        font-size: 0.75rem;
        padding: 0.3rem 0.5rem;
        margin: 0;
        width: 60px; /* 固定宽度，与select保持一致 */
    }

    /* 游戏主区域移动端 */
    .game-main {
        padding: 0.8rem;
    }

    /* 游戏元素触摸优化 */
    .puzzle-tile, .schulte-cell {
        min-height: 50px;
        touch-action: manipulation; /* 允许基本触摸操作 */
        font-size: 1rem;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }

    .memory-card {
        touch-action: manipulation; /* 允许基本触摸操作 */
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }

    .control-btn {
        touch-action: manipulation; /* 按钮允许触摸 */
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }

    .game-stat-item select, .game-stat-item button {
        touch-action: manipulation; /* 控件允许触摸 */
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }

    .game-card {
        touch-action: manipulation; /* 首页卡片允许触摸 */
    }

    /* 首页特殊处理 */
    body:not(.game-active) .game-card {
        -webkit-touch-callout: auto;
        -webkit-user-select: auto;
        user-select: auto;
    }

    /* 模态框在移动端全屏 */
    .modal-content {
        border-radius: 0;
        padding: 0.5rem;
    }

    }

@media (max-width: 480px) {
    /* 游戏头部更小 */
    .game-header {
        padding: 0.6rem;
    }

    .game-title {
        font-size: 1.2rem;
        padding: 0.3rem 0.6rem;
    }

    /* 超小屏幕紧凑统计面板 */
    .game-stats-compact {
        padding: 0.5rem;
        gap: 0.4rem;
        margin-bottom: 0.6rem;
    }

    .game-stat-item {
        min-width: 60px;
        max-width: 100px;
        flex: 1 1 calc(50% - 0.4rem);
    }

    .game-stat-item .label {
        font-size: 0.6rem;
    }

    .game-stat-item .value {
        font-size: 0.85rem;
        padding: 0.3rem 0.5rem;
        min-width: 45px;
    }

    .game-stat-item select {
        font-size: 0.75rem;
        padding: 0.3rem 0.4rem;
        min-width: 55px;
    }

    .game-stat-item button {
        font-size: 0.7rem;
        padding: 0.3rem 0.4rem;
        margin: 0;
    }

    /* 游戏主区域超小屏 */
    .game-main {
        padding: 0.6rem;
    }

    /* 游戏网格更小 */
    .puzzle-grid, .schulte-table {
        gap: 6px;
        padding: 8px;
        width: min(85vw, 85vh, 350px);
        height: min(85vw, 85vh, 350px);
    }

    .puzzle-tile, .schulte-cell {
        font-size: 0.9rem;
        min-height: 40px;
    }

    #game-container {
        padding: 0.2rem;
    }

    /* 防止双击缩放 */
    * {
        touch-action: manipulation;
    }
}

/* 五子棋游戏样式 */
.gomoku-status {
    text-align: center;
    margin-bottom: 1rem;
}

.gomoku-turn {
    font-size: 1.1rem;
    color: #fff;
    font-weight: 500;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    display: inline-block;
}

.gomoku-board-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 10px 0;
    padding: 8px;
}

.gomoku-board {
    display: grid;
    background: #f0d9b5;
    border: 3px solid #8b4513;
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    width: min(85vw, 85vh);
    height: min(85vw, 85vh);
    max-width: 520px;
    max-height: 520px;
    min-width: 350px;
    min-height: 350px;
    margin: 0 auto;
    gap: 0;
    flex-shrink: 0;
    box-sizing: border-box;
}

.gomoku-cell {
    background: #f0d9b5;
    border: 1px solid #8b4513;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    height: 100%;
    color: #333;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    position: relative;
    flex-shrink: 0;
    overflow: hidden;
}

.gomoku-cell:hover:not(.gomoku-x):not(.gomoku-o) {
    background: #e5c29f;
}

.gomoku-cell.gomoku-x {
    background: #f0d9b5;
    border-color: #8b4513;
    border-width: 1px;
    color: #000;
    font-size: 1.4rem;
    font-weight: normal;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
}

.gomoku-cell.gomoku-o {
    background: #f0d9b5;
    border-color: #8b4513;
    border-width: 1px;
    color: #333;
    font-size: 1.4rem;
    font-weight: normal;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.gomoku-cell.gomoku-last-move {
    background: rgba(255, 193, 7, 0.3) !important;
    border-color: #ffc107;
    border-width: 2px;
}

.gomoku-cell.gomoku-winning {
    background: rgba(255, 193, 7, 0.6) !important;
    border-color: #ffc107;
    border-width: 3px;
    animation: pulse 1s ease infinite;
}

.gomoku-mode,
.gomoku-first-move {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
}

.gomoku-mode label,
.gomoku-first-move label {
    color: #666;
    font-weight: 500;
    font-size: 0.7rem;
    line-height: 1.2;
    margin-bottom: 2px;
}

.gomoku-mode select,
.gomoku-first-move select {
    padding: 6px 12px;
    border: 2px solid #667eea;
    border-radius: 6px;
    background: white;
    color: #333;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 70px;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.gomoku-mode select:hover,
.gomoku-first-move select:hover {
    border-color: #764ba2;
    background: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.gomoku-mode select:focus,
.gomoku-first-move select:focus {
    outline: none;
    border-color: #764ba2;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.3);
}

/* PC端更大的五子棋棋盘 */
@media (min-width: 1024px) {
    .gomoku-board {
        width: min(70vw, 70vh, 600px);
        height: min(70vw, 70vh, 600px);
        max-width: 600px;
        max-height: 600px;
        min-width: 520px;
        min-height: 520px;
    }

    .gomoku-cell {
        font-size: 1.2rem;
    }

    .gomoku-cell.gomoku-x,
    .gomoku-cell.gomoku-o {
        font-size: 1.6rem;
    }
}

@media (min-width: 1440px) {
    .gomoku-board {
        width: min(60vw, 60vh, 700px);
        height: min(60vw, 60vh, 700px);
        max-width: 700px;
        max-height: 700px;
        min-width: 600px;
        min-height: 600px;
    }

    .gomoku-cell {
        font-size: 1.4rem;
    }

    .gomoku-cell.gomoku-x,
    .gomoku-cell.gomoku-o {
        font-size: 1.8rem;
    }
}


/* 移动端优化 */
@media (max-width: 768px) {
    .gomoku-board {
        width: 320px !important;
        height: 320px !important;
        max-width: 320px !important;
        max-height: 320px !important;
        min-width: 320px !important;
        min-height: 320px !important;
        padding: 0;
    }

    .gomoku-cell {
        font-size: 0.85rem;
    }

    .gomoku-cell.gomoku-x,
    .gomoku-cell.gomoku-o {
        font-size: 1rem;
        font-weight: normal;
        line-height: 1;
    }

    .gomoku-status {
        margin-bottom: 0.5rem;
    }

    .gomoku-turn {
        font-size: 0.9rem;
        padding: 4px 8px;
    }
}