* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

/* 画面の基本設定 */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease-in-out;
}

.screen.hidden {
    display: none;
}

/* メインメニュー */
.menu-container {
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.game-title {
    font-size: 3.5rem;
    color: white;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.game-subtitle {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 30px;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.menu-btn, .back-btn, .cancel-btn {
    background: linear-gradient(45deg, #FF6B6B, #4ECDC4);
    border: none;
    color: white;
    padding: 15px 30px;
    font-size: 1.1rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    font-weight: 600;
}

.menu-btn:hover, .back-btn:hover, .cancel-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.back-btn {
    background: linear-gradient(45deg, #FFA726, #FF7043);
    padding: 10px 20px;
    font-size: 0.9rem;
}

.cancel-btn {
    background: linear-gradient(45deg, #EF5350, #E53935);
    margin-top: 15px;
}

/* ルール画面 */
.rules-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
}

.rules-container h2 {
    color: #333;
    margin-bottom: 20px;
    text-align: center;
}

.rules-content h3 {
    color: #555;
    margin: 20px 0 10px 0;
}

.rules-content ul, .rules-content ol {
    margin-left: 20px;
    margin-bottom: 15px;
}

.rules-content li {
    margin-bottom: 8px;
    line-height: 1.6;
}

/* ゲーム画面 */
.game-container {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.game-header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 30px;
}

.player {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-weight: 600;
}

.player-ball {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.player-ball.white {
    background: linear-gradient(45deg, #FFFFFF, #F5F5F5);
    border: 2px solid #E0E0E0;
}

.player-ball.black {
    background: linear-gradient(45deg, #424242, #212121);
    border: 2px solid #000000;
}

.turn-indicator {
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 25px;
    color: white;
    font-weight: 600;
}

/* ゲームボード */
.game-board-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

#gameCanvas, #finalBoardCanvas {
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    background: white;
    cursor: pointer;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

/* キャンバスのレスポンシブ対応を改善 */
#gameCanvas {
    max-width: 100%;
    max-height: 70vh;
    width: auto;
    height: auto;
}

/* モーダル */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.modal-content h3 {
    margin-bottom: 20px;
    color: #333;
}

.direction-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
    max-width: 200px;
}

.direction-btn {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 10px;
    font-size: 1.5rem;
    cursor: pointer;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.direction-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* 結果画面 */
.result-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
    max-width: 600px;
}

.result-container h2 {
    color: #333;
    margin-bottom: 10px;
    font-size: 2.5rem;
}

.result-container p {
    color: #666;
    font-size: 1.2rem;
    margin-bottom: 30px;
}

.final-board {
    margin: 30px 0;
}

.final-board h3 {
    color: #555;
    margin-bottom: 15px;
}

.result-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .game-title {
        font-size: 2.5rem;
    }
    
    .menu-container, .rules-container, .result-container {
        margin: 20px;
        padding: 20px;
    }
    
    .player-info {
        gap: 15px;
    }
    
    .player {
        font-size: 0.9rem;
    }
    
    .result-buttons {
        flex-direction: column;
    }
    
    .game-board-container {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .game-header {
        padding: 10px;
    }
    
    .player-info {
        flex-direction: column;
        gap: 10px;
    }
    
    .turn-indicator {
        order: -1;
    }
    
    .direction-buttons {
        max-width: 150px;
    }
    
    .direction-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
} 