* {
    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;
    overflow-x: hidden;
}

.page {
    display: none;
    min-height: 100vh;
    padding: 20px;
    max-width: 100vw;
}

.page.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* 主菜单样式 */
.menu-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 500px;
    width: 100%;
}

.game-title {
    font-size: 2.5em;
    color: #333;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.menu-options {
    margin-bottom: 30px;
}

.color-selection, .difficulty-selection {
    margin-bottom: 25px;
}

.color-selection h3, .difficulty-selection h3 {
    color: #555;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.color-picker {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.color-option {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s ease;
}

.color-option:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.color-option.selected {
    border-color: #333;
    transform: scale(1.2);
}

#difficultySelect {
    padding: 10px 20px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1em;
    background: white;
    cursor: pointer;
}

.menu-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* 按钮样式 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.btn.primary {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
}

.btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn.secondary {
    background: #f0f0f0;
    color: #333;
}

.btn.secondary:hover {
    background: #e0e0e0;
}

.btn.small {
    padding: 8px 16px;
    font-size: 0.9em;
}


/* 游戏说明页面 */
.rules-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    max-width: 700px;
    width: 100%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.rules-container h2 {
    color: #333;
    margin-bottom: 30px;
    text-align: center;
    font-size: 2em;
}

.rules-content {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 20px;
}

/* Custom Scrollbar */
.rules-content::-webkit-scrollbar {
    width: 10px;
}

.rules-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

.rules-content::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 10px;
    border: 3px solid transparent;
    background-clip: content-box;
}

.rules-content::-webkit-scrollbar-thumb:hover {
    background-color: #aaa;
}

.rules-content h3 {
    color: #555;
    margin: 20px 0 10px 0;
    font-size: 1.3em;
}

.rules-content p, .rules-content li {
    color: #666;
    line-height: 1.6;
    margin-bottom: 10px;
}

.rules-content ul {
    margin-left: 20px;
    margin-bottom: 20px;
}

/* 游戏页面 */
#gamePage {
    padding: 0;
}

.game-header {
    background: rgba(255, 255, 255, 0.9);
    padding: 15px 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.score-board {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 800px;
    margin: 0 auto;
}

.player-score {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.player-name {
    font-weight: bold;
    color: #333;
    min-width: 60px;
}

.score-bar {
    flex: 1;
    height: 20px;
    background: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
    max-width: 150px;
}

.score-fill {
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 10px;
}

.score-fill.player1 {
    background: linear-gradient(45deg, #ff6b6b, #ff8e8e);
}

.score-fill.player2 {
    background: linear-gradient(45deg, #4ecdc4, #44a08d);
}

.score-text {
    font-weight: bold;
    color: #333;
    min-width: 40px;
}

.game-controls {
    display: flex;
    gap: 10px;
}

.game-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    padding: 20px;
}

#gameCanvas {
    border: 3px solid #333;
    border-radius: 10px;
    background: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.game-status {
    text-align: center;
    padding: 10px;
    color: white;
    font-size: 1.2em;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* 覆盖层样式 */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.overlay.active {
    display: flex;
}

.pause-container, .gameover-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    width: 90%;
}

.pause-container h2, .gameover-container h2 {
    color: #333;
    margin-bottom: 30px;
    font-size: 2em;
}

.pause-buttons, .gameover-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#gameOverMessage {
    color: #666;
    font-size: 1.2em;
    margin-bottom: 30px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-title {
        font-size: 2em;
    }
    
    .menu-container, .rules-container {
        padding: 20px;
        margin: 10px;
    }
    
    #gameCanvas {
        width: 100%;
        max-width: 600px;
        height: auto;
    }
    
    .score-board {
        flex-direction: column;
        gap: 15px;
    }
    
    .player-score {
        justify-content: center;
    }
}
