* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部 */
.header {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 16px 0;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 24px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-btn {
    padding: 8px 16px;
    border: none;
    background: #f0f0f0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.nav-btn:hover {
    background: #e0e0e0;
}

/* 主内容 */
main {
    padding: 40px 0;
    min-height: calc(100vh - 140px);
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-title {
    text-align: center;
    color: white;
    margin-bottom: 40px;
    font-size: 28px;
    font-weight: 500;
}

/* 游戏卡片 */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
}

.game-card {
    background: white;
    border-radius: 16px;
    padding: 32px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.game-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.15);
}

.game-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.game-card h3 {
    font-size: 20px;
    margin-bottom: 12px;
    color: #333;
}

.game-card p {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 20px;
}

.play-btn {
    color: #667eea;
    font-weight: 500;
    font-size: 14px;
}

/* 游戏页面 */
.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    padding: 16px 24px;
    border-radius: 12px 12px 0 0;
    gap: 16px;
}

.back-btn {
    padding: 8px 16px;
    border: none;
    background: #f0f0f0;
    border-radius: 6px;
    cursor: pointer;
}

.game-header h2 {
    flex: 1;
    font-size: 18px;
}

.game-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.game-info button {
    padding: 8px 16px;
    border: none;
    background: #667eea;
    color: white;
    border-radius: 6px;
    cursor: pointer;
}

.game-container {
    background: white;
    padding: 30px;
    display: flex;
    justify-content: center;
    position: relative;
    border-radius: 0 0 12px 12px;
}

#game-canvas {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #fafafa;
}

.game-tips {
    text-align: center;
    color: rgba(255,255,255,0.9);
    margin-top: 16px;
    font-size: 14px;
}

/* 弹窗 */
.modal {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 0 12px 12px;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 32px 48px;
    border-radius: 12px;
    text-align: center;
}

.modal-content h3 {
    margin-bottom: 12px;
    font-size: 24px;
}

.modal-content p {
    margin-bottom: 20px;
    color: #666;
}

.modal-content button {
    padding: 10px 24px;
    border: none;
    background: #667eea;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
}

/* 底部 */
.footer {
    text-align: center;
    padding: 20px;
    color: rgba(255,255,255,0.8);
    font-size: 14px;
}

/* 响应式 */
@media (max-width: 600px) {
    .game-header {
        flex-wrap: wrap;
    }
    
    .game-container {
        padding: 15px;
        overflow-x: auto;
    }
}